diff --git a/html/admin-noalyss.php b/html/admin-noalyss.php index d5046f813..4965c7676 100644 --- a/html/admin-noalyss.php +++ b/html/admin-noalyss.php @@ -31,6 +31,7 @@ if (file_exists("../include/config.inc.php") ) { define ('ALLOWED',1); define ('ALLOWED_ADMIN',1); require_once '../include/constant.php'; + \Noalyss\Dbg::echo_file(__FILE__); require_once NOALYSS_INCLUDE.'/admin_repo.inc.php'; } else { // Redirect to install file , if this file exists then diff --git a/html/do.php b/html/do.php index 8fa3c80d8..4c72f0d45 100644 --- a/html/do.php +++ b/html/do.php @@ -81,9 +81,9 @@ if ( DEBUGNOALYSS > 1 ) { /** * Debug Design */ - debug_show_size(); - debug_show_request(); - debug_show_global(); + \Noalyss\Dbg::display_size(); + \Noalyss\Dbg::display_request(); + \Noalyss\Dbg::display_global(); } //<--- if DEBUG $g_parameter=new Noalyss_Parameter_Folder($cn); diff --git a/html/user_login.php b/html/user_login.php index cb8a396b7..ef8079bd0 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -65,9 +65,9 @@ if ( DEBUGNOALYSS > 1 ) { /** * Debug Design */ - debug_show_size(); - debug_show_request(); - debug_show_global(); + \Noalyss\Dbg::display_size(); + \Noalyss\Dbg::display_request(); + \Noalyss\Dbg::display_global(); } //<--- if DEBUG $ac=new Database(); $hi=new HttpInput(); diff --git a/include/admin_repo.inc.php b/include/admin_repo.inc.php index ae9b3294c..a28b845fa 100644 --- a/include/admin_repo.inc.php +++ b/include/admin_repo.inc.php @@ -23,7 +23,7 @@ */ if ( ! defined ('ALLOWED')) { die (_('Non autorisé'));} if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));} - +\Noalyss\Dbg::echo_file(__FILE__); include_once NOALYSS_INCLUDE."/class/user.class.php"; require_once NOALYSS_INCLUDE."/lib/user_common.php"; include_once NOALYSS_INCLUDE."/lib/ac_common.php"; diff --git a/include/audit_log.php b/include/audit_log.php index 4dc2a7f63..b4c480e25 100644 --- a/include/audit_log.php +++ b/include/audit_log.php @@ -23,6 +23,7 @@ * \brief let you see the list of the connexion */ if ( !defined ('ALLOWED')) die('Forbidden'); +\Noalyss\Dbg::echo_file(__FILE__); ?>
diff --git a/include/category_card.inc.php b/include/category_card.inc.php index 018adecd0..0806239c6 100644 --- a/include/category_card.inc.php +++ b/include/category_card.inc.php @@ -28,7 +28,7 @@ */ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); -if ( DEBUGNOALYSS > 1 ) { echo __FILE__;} +NoalyssDbg::echo_file(__FILE__); global $http; $str_dossier=Dossier::get(); diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php index d666a0a0b..5ae2c17c2 100644 --- a/include/class/dossier.class.php +++ b/include/class/dossier.class.php @@ -292,7 +292,7 @@ class Dossier } /** - * connect to folder and give to admin. the profile Admin(builtin) + * @brief connect to folder and give to admin. the profile Admin(builtin) * @param int $p_id dossier::id() */ static function synchro_admin($p_id) @@ -331,7 +331,7 @@ class Dossier } } /** - * Upgrade check if the folder ACCOUNT_REPOSITORY needs to be upgrade thanks the variable DBVERSIONREPO + * @brief Upgrade check if the folder ACCOUNT_REPOSITORY needs to be upgrade thanks the variable DBVERSIONREPO * and run all the SQL script named ac-upgradeX.sql from the folder noalyss/include/sql/patch * until X equal DBVERSIONREPO-1 * After it will call the function apply_patch, remove_inexistant_user and clean_orphan_log for each folder diff --git a/include/constant.php b/include/constant.php index 0fec75759..4353f3926 100644 --- a/include/constant.php +++ b/include/constant.php @@ -40,6 +40,7 @@ $g_template_dir = $dirname . "/template"; if (file_exists($dirname . '/config.inc.php')) require_once $dirname . '/config.inc.php'; if (!defined("NOALYSS_HOME")) define("NOALYSS_HOME", dirname($dirname) . "/html"); +if (!defined("NOALYSS_BASE")) define("NOALYSS_BASE", dirname($dirname) ); if (!defined("NOALYSS_PLUGIN")) define("NOALYSS_PLUGIN", $g_ext_dir); if (!defined("NOALYSS_INCLUDE")) define("NOALYSS_INCLUDE", $g_include_dir); if (!defined("NOALYSS_TEMPLATE")) define("NOALYSS_TEMPLATE", $g_template_dir); @@ -360,6 +361,7 @@ if (!defined("DEFAULT_SERVER_VIDEO_CONF")) { function noalyss_class_autoloader($class) { $class = strtolower($class); + foreach (array("class","lib","database") as $path) { if ( file_exists(NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php')) { require_once NOALYSS_INCLUDE.'/'.$path.'/'.$class.'.class.php'; @@ -385,7 +387,8 @@ function noalyss_class_autoloader($class) "ismallbutton" => "lib/ibutton.class.php", "inputswitch" => "lib/input_switch.class.php", "noalyss\mobile" => "class/mobile.class.php", - "htmlinput" => "lib/html_input.class.php" + "htmlinput" => "lib/html_input.class.php", + "noalyss\dbg"=>"lib/dbg.php" ); if (isset ($aClass[$class])) { require_once NOALYSS_INCLUDE . "/" . $aClass[$class]; diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 2c2fbafaf..a440354dd 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -168,13 +168,10 @@ function nbm($p_number,$p_dec = 2) function echo_error($p_log, $p_line="", $p_message="") { - echo "ERREUR :" . $p_log . " " . $p_line . " " . $p_message; - $fdebug = fopen($_ENV['TMP'] . DIRECTORY_SEPARATOR . "noalyss_error.log", "a+"); - if ($fdebug != null) - { - fwrite($fdebug, date("Ymd H:i:s") . $p_log . " " . $p_line . " " . $p_message . "\n"); - fclose($fdebug); - } + $msg="ERREUR :" . $p_log . " " . $p_line . " " . $p_message; + echo $msg; + syslog(LOG_ERR,$msg); + } /** @@ -1179,11 +1176,7 @@ function display_menu($p_menuid) $array=compute_variable($file[0]['me_parameter']); put_global($array); } - if ( DEBUGNOALYSS == 2) - { - echo $file[0]['me_file']," param : ",$file[0]['me_parameter'] ; - - } + \Noalyss\Dbg::echo_var(1,$file[0]['me_file']." ".$file[0]['me_parameter']); /* * Log the file we input to put in the folder test-noalyss for replaying it */ @@ -1683,58 +1676,5 @@ function linkTo($p_url) return $p_url; } } -function debug_show_size() -{ - echo <<Xtra Small
-
Small
-
Medium
-
Large
-
X Large
-EOF; -} -/** - * @brief for development , show request (POST, GET) - * @return void - */ - function debug_show_request() { - $id=uniqid("debug"); - $title=\HtmlInput::title_box(_("REQUEST"),$id,"hide"); - ?> - - - - - - $n_level) { + echo ''; + $type = gettype($msg); + if (in_array($type, ["string", "integer", "double"])) { + echo $msg; + } else { + + echo "
DBG";
+                var_export($msg);
+                echo '
'; + } + echo '
'; + } + } + + public static function echo_file($msg) + { + if (DEBUGNOALYSS > 1) { + echo ''; + echo "[FILE: $msg]"; + + echo ''; + } + } + + static function display_size() + { + echo <<Xtra Small +
Small
+
Medium
+
Large
+
X Large
+EOF; + } + + /** + * @brief for development , show request (POST, GET) + * @return void + */ + static function display_request() + { + $id = uniqid("debug"); + $title = \HtmlInput::title_box(_("REQUEST"), $id, "hide"); + ?> + + + + + + +{$title} +
+
+    {$content}
+
+
+
+{$button_close} + +🕶 + +EOF; + return $r; + } +} +?> \ No newline at end of file diff --git a/include/modele.inc.php b/include/modele.inc.php index 56f787e96..37ad0d242 100644 --- a/include/modele.inc.php +++ b/include/modele.inc.php @@ -27,6 +27,7 @@ * */ if ( !defined ('ALLOWED')) die('Forbidden'); +\Noalyss\Dbg::echo_file(__FILE__); $http=new HttpInput(); $sa = $http->request("sa", "string", 'list'); if (isset($_POST['upd']) && diff --git a/include/restore.inc.php b/include/restore.inc.php index 7d4aeca94..c62550a16 100644 --- a/include/restore.inc.php +++ b/include/restore.inc.php @@ -19,6 +19,7 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu if ( !defined ('ALLOWED')) die('Forbidden'); +\Noalyss\Dbg::echo_file(__FILE__); $http=new HttpInput(); /*!\file * \brief restaure a database diff --git a/include/template/acc_ledger-input_extra_info.php b/include/template/acc_ledger-input_extra_info.php index a4f45d379..9cd54d33d 100644 --- a/include/template/acc_ledger-input_extra_info.php +++ b/include/template/acc_ledger-input_extra_info.php @@ -21,7 +21,7 @@ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); -if (DEBUGNOALYSS>1) { echo __FILE__;} +\Noalyss\Dbg::echo_file(__FILE__); /** * @file * @brief display supplemental information to save when entering an operation of diff --git a/include/template/card_multiple_display_option.php b/include/template/card_multiple_display_option.php index 9e37e481a..79687bb2d 100644 --- a/include/template/card_multiple_display_option.php +++ b/include/template/card_multiple_display_option.php @@ -34,10 +34,11 @@ if (!defined('ALLOWED')) * - $a_option.ap_id (-1 if option for this contact doesn't exist) * @see Card_Multiple */ +\Noalyss\Dbg::echo_file(__FILE__); ?>

-

+
diff --git a/include/template/mobile-display_menu.php b/include/template/mobile-display_menu.php index 1017c061b..b586bc70f 100644 --- a/include/template/mobile-display_menu.php +++ b/include/template/mobile-display_menu.php @@ -25,10 +25,7 @@ if (!defined('ALLOWED')) * @file * @brief show the mobile menu */ -if (DEBUGNOALYSS>1) -{ - echo __FILE__; -}; +\Noalyss\Dbg::dbgecho_file(__FILE__); ?>
diff --git a/include/upgrade-core.php b/include/upgrade-core.php index bf11fbb94..b9f4cab79 100644 --- a/include/upgrade-core.php +++ b/include/upgrade-core.php @@ -21,7 +21,7 @@ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));} - +\Noalyss\Dbg::echo_file(__FILE__); global $version_noalyss; /** * @file diff --git a/include/upgrade-plugin.php b/include/upgrade-plugin.php index 092281cc4..a902b186e 100644 --- a/include/upgrade-plugin.php +++ b/include/upgrade-plugin.php @@ -25,7 +25,7 @@ if (!defined('ALLOWED_ADMIN')) die(_('Non autorisé')); } - +\Noalyss\Dbg::echo_file(__FILE__); /** * @file diff --git a/include/upgrade-template.php b/include/upgrade-template.php index f109f15d1..0dec1b405 100644 --- a/include/upgrade-template.php +++ b/include/upgrade-template.php @@ -24,7 +24,7 @@ if (!defined('ALLOWED_ADMIN')) { die(_('Non autorisé')); } - +\Noalyss\Dbg::echo_file(__FILE__); $package_repository=new Package_Repository(); $xml=$package_repository->getContent(); diff --git a/include/upgrade.inc.php b/include/upgrade.inc.php index 3b79dfed9..dc2c1495f 100644 --- a/include/upgrade.inc.php +++ b/include/upgrade.inc.php @@ -25,7 +25,7 @@ */ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));} - +\Noalyss\Dbg::echo_file(__FILE__); $http=new HttpInput(); $menu=array( diff --git a/include/user.inc.php b/include/user.inc.php index 7cb024572..af1e3ed9e 100644 --- a/include/user.inc.php +++ b/include/user.inc.php @@ -28,6 +28,7 @@ if ( !defined ('ALLOWED')) die('Forbidden'); */ $http=new HttpInput(); echo '
'; +\Noalyss\Dbg::echo_file(__FILE__); /******************************************************/ // Add user /******************************************************/