noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 167/173: Task 0001912: Developpement DEBUG ne


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 167/173: Task 0001912: Developpement DEBUG new system with level
Date: Mon, 22 Mar 2021 12:59:25 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit a2c0e116fa6942f74296dd7cde2a53cc4da57662
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Mar 19 14:09:45 2021 +0100

    Task 0001912:  Developpement DEBUG new system with level
---
 html/do.php                                   |  2 +-
 html/index.php                                |  4 ++--
 html/install.php                              | 21 ++++++++++--------
 include/ajax/ajax_action_concerned_list.php   |  4 ++--
 include/ajax/ajax_action_remove_concerned.php |  4 ++--
 include/ajax/ajax_admin.php                   |  6 +++---
 include/ajax/ajax_card.php                    |  4 ++--
 include/ajax/ajax_history.php                 |  2 +-
 include/ajax/ajax_ledger.php                  |  2 +-
 include/ajax/ajax_operation_tag.php           |  8 +++----
 include/ajax/ajax_poste.php                   |  2 +-
 include/ajax/ajax_tag_detail.php              |  4 ++--
 include/ajax/ajax_tag_list.php                |  2 +-
 include/class/acc_ledger_purchase.class.php   |  6 +++---
 include/class/acc_ledger_sold.class.php       | 10 ++++-----
 include/class/acc_operation.class.php         |  4 ++--
 include/class/anc_key.class.php               |  2 +-
 include/class/database.class.php              |  4 ++--
 include/class/dossier.class.php               |  4 ++--
 include/constant.php                          | 31 ++++++++++++++++++---------
 include/lib/ac_common.php                     |  6 +++++-
 include/lib/config_file.php                   | 18 +++++++++++-----
 include/lib/database_core.class.php           | 16 +++++++-------
 23 files changed, 96 insertions(+), 70 deletions(-)

diff --git a/html/do.php b/html/do.php
index 412cd18..397359d 100644
--- a/html/do.php
+++ b/html/do.php
@@ -70,7 +70,7 @@ if ( ! $cn->exist_table('version')) {
 
$style_user=$http->post("style_user","string",$_SESSION[SESSION_KEY.'g_theme']);
 
 html_page_start($style_user);
-if ( DEBUG ) {
+if ( DEBUGNOALYSS > 1 ) {
 /**
  * Debug Design
  */
diff --git a/html/index.php b/html/index.php
index 5a2f40d..5be012e 100644
--- a/html/index.php
+++ b/html/index.php
@@ -157,7 +157,7 @@ $my_domain="";
 require_once '../include/constant.php';
 require_once '../include/config.inc.php';
 require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-if (file_exists("install.php")&&!DEBUG)
+if ( file_exists("install.php")&& DEBUGNOALYSS == 0 )
 {
     // At the end of the installation procedure , the install file must be 
removed
     if (isset($_GET['remove_install']))
@@ -186,7 +186,7 @@ if (file_exists("install.php")&&!DEBUG)
 /**
  * Debug Design
  */
-if (DEBUG)
+if ( DEBUGNOALYSS == 0 )
 {
     echo <<<EOF
 <div class="d-none d-sm-block d-md-none d-lg-none d-xl-none 
bg-info">Small</div>
diff --git a/html/install.php b/html/install.php
index 148a2a1..b96cc58 100644
--- a/html/install.php
+++ b/html/install.php
@@ -555,7 +555,7 @@ else
 if ($account == 0 ) {
 
   echo "Creation of ".domaine."account_repository";
-  if ( ! DEBUG) ob_start();
+  if ( DEBUGNOALYSS == 0 ) ob_start();
   $cn->exec_sql("create database ".domaine."account_repository 
encoding='utf8'");
   $cn=new Database();
   $cn->start();
@@ -570,13 +570,13 @@ if ($account == 0 ) {
 
   $cn->commit($cn);
 
-  if (!DEBUG)
+  if ( DEBUGNOALYSS ==  0 )
     {
         ob_end_clean();
     }
 
     echo _("Creation of Modele 1");
-  if (!DEBUG)
+  if ( DEBUGNOALYSS == 0 )
     {
         ob_start();
     }
@@ -589,7 +589,7 @@ if ($account == 0 ) {
   $cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
   $cn->commit();
 
-  if (!DEBUG)
+  if ( DEBUGNOALYSS == 0 )
     {
         ob_end_clean();
     }
@@ -598,13 +598,13 @@ if ($account == 0 ) {
   $cn->exec_sql("create database ".domaine."mod2 encoding='utf8'");
   $cn=new Database(2,'mod');
   $cn->start();
-  if ( ! DEBUG) { ob_start();  }
+  if ( DEBUGNOALYSS == 0 ) { ob_start();  }
   $cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/schema.sql');
   $cn->execute_script(NOALYSS_INCLUDE.'/sql/mod2/data.sql');
   $cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
   $cn->commit();
 
- if ( ! DEBUG) ob_end_clean();
+ if ( DEBUGNOALYSS == 0 ) ob_end_clean();
 echo '<h1>'._('Important').'</h1>';
 echo '<p>'._('Utilisateur  administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
 echo '<p>',_('Mot de passe')," ",NOALYSS_ADMIN_PASSWORD,'</p>';
@@ -623,10 +623,10 @@ if  (defined("MULTI") && MULTI == 0)
        $db = new Database();
        if ($db->exist_table("repo_version") == false) 
        {
-                        if ( ! DEBUG) { ob_start();  }
+                        if ( DEBUGNOALYSS > 0 ) { ob_start();  }
                         
$db->execute_script(NOALYSS_INCLUDE.'/sql/mono/mono.sql');
                      
-            if ( ! DEBUG) ob_end_clean();
+            if ( DEBUGNOALYSS > 0 ) ob_end_clean();
        }
        
         
@@ -651,7 +651,7 @@ if  (defined("MULTI") && MULTI == 0)
        echo "<p class=\"info\">"._("Tout est installé"). $succeed;
         
          echo "<h2>"._("Mise à jour Repository")."</h2>";
-         if ( DEBUG == false ) ob_start();
+         if ( DEBUGNOALYSS == 0 ) ob_start();
         $MaxVersion=DBVERSIONREPO-1;
         for ($i=4;$i<= $MaxVersion;$i++)
         {
@@ -662,6 +662,9 @@ if  (defined("MULTI") && MULTI == 0)
         
         $db->exec_sql("update ac_users set use_login=$1,use_pass=md5($2) where 
use_id=1",
               array(strtolower(NOALYSS_ADMINISTRATOR),NOALYSS_ADMIN_PASSWORD));
+        
+        if ( DEBUGNOALYSS == 0 ) ob_end_clean();
+        
         echo '<h1>'._('Important').'</h1>';
         echo '<p>'._('Utilisateur administrateur'),' 
',NOALYSS_ADMINISTRATOR,'</p>';
         
diff --git a/include/ajax/ajax_action_concerned_list.php 
b/include/ajax/ajax_action_concerned_list.php
index 55548a1..357a8b9 100644
--- a/include/ajax/ajax_action_concerned_list.php
+++ b/include/ajax/ajax_action_concerned_list.php
@@ -51,7 +51,7 @@ echo HtmlInput::button_anchor(_("Export CSV"), $csv,"",' 
title="Export Contacts
 echo HtmlInput::button_close("action_concerned_list_dv");
 $response = ob_get_clean();
 
-if ( headers_sent() && DEBUG) {
+if ( headers_sent() && DEBUGNOALYSS > 0) {
     echo $response;
 } 
 $html = escape_xml($response);
@@ -63,4 +63,4 @@ echo <<<EOF
 <code>$html</code>
 </data>
 EOF;
-?>     
\ No newline at end of file
+?>     
diff --git a/include/ajax/ajax_action_remove_concerned.php 
b/include/ajax/ajax_action_remove_concerned.php
index 0825171..a07e00a 100644
--- a/include/ajax/ajax_action_remove_concerned.php
+++ b/include/ajax/ajax_action_remove_concerned.php
@@ -60,7 +60,7 @@ echo $follow->button_action_add_concerned_card( );
 
 $response = ob_get_clean();
 
-if (headers_sent() && DEBUG) {
+if (headers_sent() && DEBUGNOALYSS > 0) {
     echo $response;
 }
 $html = escape_xml($response);
@@ -72,4 +72,4 @@ echo <<<EOF
 <code>$html</code>
 </data>
 EOF;
-?>        
\ No newline at end of file
+?>        
diff --git a/include/ajax/ajax_admin.php b/include/ajax/ajax_admin.php
index 6e958fe..44e8d01 100644
--- a/include/ajax/ajax_admin.php
+++ b/include/ajax/ajax_admin.php
@@ -354,10 +354,10 @@ if ($op=='upgradeCore')
         $progress->set_value(5);
         $core->download();
         $progress->set_value(55);
-        if (!DEBUG )
+        if ( DEBUGNOALYSS > 0 )
         {
             $core->install();
-        }
+        } 
         $progress->set_value(100);
 
         $url=sprintf('<a href="%s"> install.php</a>', 
NOALYSS_URL."/install.php");
@@ -414,4 +414,4 @@ if ($op=="installTemplate")
     echo _("Modèle installé");
     return;
 }
-?>        
\ No newline at end of file
+?>        
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 809ac72..d4acd9d 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -288,7 +288,7 @@ case 'st':
     if ( empty($array))
     {
         $html=_("Aucune catégorie de fiche ne correspond  à votre demande");
-        if ( DEBUG )        $html.=$sql;
+        if ( DEBUGNOALYSS > 0 )        $html.=$sql;
     }
     else
     {
@@ -793,7 +793,7 @@ case 'upr':
             
 } // switch
 $xml=escape_xml($html);
-if (DEBUG && headers_sent()) {
+if (DEBUGNOALYSS > 0 && headers_sent()) {
     echo $html;return;
 }
 header('Content-type: text/xml; charset=UTF-8');
diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php
index 2951e10..26d58b9 100644
--- a/include/ajax/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -221,7 +221,7 @@ if ( isset($_REQUEST['pcm_val']))
       }
   }
 $xml=escape_xml($html);
-if (DEBUG && headers_sent()) {
+if (DEBUGNOALYSS > 0 && headers_sent()) {
     echo $html;return;
 }
 header('Content-type: text/xml; charset=UTF-8');
diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php
index d9ac3ec..16ee64f 100644
--- a/include/ajax/ajax_ledger.php
+++ b/include/ajax/ajax_ledger.php
@@ -514,7 +514,7 @@ case 'save':
     catch (Exception $e)
     {
           record_log($e);
-      if ( DEBUG )   echo $e->getMessage();
+      if ( DEBUGNOALYSS > 0 )   echo $e->getMessage();
       alert(_( "Changement impossible: on ne peut pas changer la date dans une 
période fermée"));
     }
     $html=ob_get_contents();
diff --git a/include/ajax/ajax_operation_tag.php 
b/include/ajax/ajax_operation_tag.php
index 7c0a0d2..c444513 100644
--- a/include/ajax/ajax_operation_tag.php
+++ b/include/ajax/ajax_operation_tag.php
@@ -67,7 +67,7 @@ switch ($op)
         echo HtmlInput::button_close("tag_div");
 
         $response=ob_get_clean();
-        if (headers_sent()&&DEBUG)
+        if (headers_sent()&& DEBUGNOALYSS > 0 )
         {
             echo $response;
         }
@@ -116,7 +116,7 @@ EOF;
         $tag_operation->tag_cell($ctl);
 
         $response=ob_get_clean();
-        if (headers_sent()&&DEBUG)
+        if (headers_sent()&& DEBUGNOALYSS > 0)
         {
             echo $response;
         }
@@ -145,7 +145,7 @@ EOF;
         $tag_operation->tag_cell($pref);
 
         $response=ob_get_clean();
-        if (headers_sent()&&DEBUG)
+        if (headers_sent()&& DEBUGNOALYSS > 0)
         {
             echo $response;
         }
@@ -163,4 +163,4 @@ EOF;
 EOF;
         return;
         break;
-}
\ No newline at end of file
+}
diff --git a/include/ajax/ajax_poste.php b/include/ajax/ajax_poste.php
index 899dbad..8ecaaa6 100644
--- a/include/ajax/ajax_poste.php
+++ b/include/ajax/ajax_poste.php
@@ -152,7 +152,7 @@ case "sf":
     break;
 }
 $xml=escape_xml($html);
-if (headers_sent() && DEBUG ) {
+if (headers_sent() && DEBUGNOALYSS > 0) {
     echo $html;
 }
 else 
diff --git a/include/ajax/ajax_tag_detail.php b/include/ajax/ajax_tag_detail.php
index 7f2a9cc..a05bb3e 100644
--- a/include/ajax/ajax_tag_detail.php
+++ b/include/ajax/ajax_tag_detail.php
@@ -45,7 +45,7 @@ else :
 </form>
 <?php
     $response=  ob_get_clean();
-if (headers_sent() && DEBUG )    {
+if (headers_sent() && DEBUGNOALYSS > 0 )    {
     echo $response;
 }else {
     header('Content-type: text/xml; charset=UTF-8');
@@ -59,4 +59,4 @@ if (headers_sent() && DEBUG )    {
 </data>
 EOF;
     exit();
-    ?>
\ No newline at end of file
+    ?>
diff --git a/include/ajax/ajax_tag_list.php b/include/ajax/ajax_tag_list.php
index 794b21a..0babe10 100644
--- a/include/ajax/ajax_tag_list.php
+++ b/include/ajax/ajax_tag_list.php
@@ -35,7 +35,7 @@ if ( $g_user->check_action(TAGADD) == 1) { echo 
HtmlInput::button("tag_add", _("
 echo HtmlInput::button_close("tag_div");
 
 $response=  ob_get_clean();
-if (headers_sent() && DEBUG ){
+if (headers_sent() && DEBUGNOALYSS > 0  ){
     echo $response;
 } else {
     header('Content-type: text/xml; charset=UTF-8');
diff --git a/include/class/acc_ledger_purchase.class.php 
b/include/class/acc_ledger_purchase.class.php
index 3a4c5ba..99a5405 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -773,12 +773,12 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                 $operation_currency->insert();
                 
$tot_amount_cur=round(bcadd($tot_amount_cur,$acc_amount->amount_currency),2);
                 
$tot_amount_cur=round(bcadd($tot_amount_cur,$acc_amount->amount_vat_currency),2);
-                if (DEBUG ) {
+                if ( DEBUGNOALYSS > 0 ) {
                     echo __LINE__." insert into operation currency 
oc_amount:{$acc_amount->amount_currency} oc_vat_amount 
{$acc_amount->amount_vat_currency} <br>";
                 }
             }       // end loop : save all items
             /*  save total customer */
-            if ( DEBUG ) { 
+            if ( DEBUGNOALYSS > 0 ) { 
                 echo __LINE__." tot_amount $tot_amount<br>"; 
                 echo __LINE__." tot_tva $tot_tva<br>"; 
             
@@ -861,7 +861,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
             // Total DEB
             $acc_operation->amount=$this->db->get_value("select sum(j_montant) 
from jrnx where j_grpt = $1 and j_debit='t'",
                     array($seq));
-            if ( DEBUG ) { 
+            if ( DEBUGNOALYSS > 0 ) { 
                 echo __LINE__." amount ".$acc_operation->amount."<br>"; 
             
             }
diff --git a/include/class/acc_ledger_sold.class.php 
b/include/class/acc_ledger_sold.class.php
index a86b4fb..bc713a6 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -314,7 +314,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
                 
                 $tot_amount = bcadd($tot_amount, $amount);
                 $tot_amount = round($tot_amount, 2);
-                if ( DEBUG ) { echo __LINE__." tot_amount $tot_amount<br>";}
+                if ( DEBUGNOALYSS > 0 ) { echo __LINE__." tot_amount 
$tot_amount<br>";}
                 $acc_operation = new Acc_Operation($this->db);
                 $acc_operation->date = $e_date;
                 $sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
@@ -462,7 +462,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
             /*  save total customer */
             $cust_amount = bcadd($tot_amount, $tot_tva);
             $cust_amount = round($cust_amount,2);
-            if ( DEBUG ) { 
+            if ( DEBUGNOALYSS > 0 ) { 
                 echo __LINE__." cust_amount $cust_amount<br>"; 
                 echo __LINE__." tot_amount $tot_amount<br>"; 
                 echo __LINE__." tot_tva $tot_tva<br>"; 
@@ -499,7 +499,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
              * if if ($g_parameter->MY_TVA_USE == 'Y' )
              */
             if ($g_parameter->MY_TVA_USE == 'Y') {
-                if (DEBUG ) {
+                if ( DEBUGNOALYSS > 0 ) {
                     var_dump($tva);
                 }
                 foreach ($tva as $i => $value) {
@@ -524,7 +524,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
                         $tot_debit=round($tot_debit, 2);
                     }
                     $acc_operation->insert_jrnx();
-                    if ( DEBUG ) { 
+                    if ( DEBUGNOALYSS > 0 ) { 
                                     echo __LINE__." tot_tva $tot_tva<br>"; 
 
                     }
@@ -553,7 +553,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
              */
             
             /* insert into jrn */
-            if ( DEBUG ) { echo __LINE__." tot_debit 
".round($tot_debit,2)."<br>"; }
+            if ( DEBUGNOALYSS > 0 ) { echo __LINE__." tot_debit 
".round($tot_debit,2)."<br>"; }
             $acc_operation = new Acc_Operation($this->db);
             $acc_operation->date = $e_date;
             $acc_operation->echeance = $e_ech;
diff --git a/include/class/acc_operation.class.php 
b/include/class/acc_operation.class.php
index 9b0ae6c..314c1a1 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -187,7 +187,7 @@ class Acc_Operation
         {
             $this->type=($this->type=='d')?'c':'d';
         }
-        if ( DEBUG ) {
+        if ( DEBUGNOALYSS > 0 ) {
             echo "insert_jrnx = [{ $this->poste}]  {$this->amount}  rounded 
".round($this->amount,2)." type {$this->type}<br>";
         }
         $this->amount=abs($this->amount);
@@ -284,7 +284,7 @@ class Acc_Operation
     function insert_jrn()
     {
         $p_comment=$this->desc;
-        if  (DEBUG ) {
+        if ( DEBUGNOALYSS > 0 ) {
              echo "insert_jrn = {$this->amount}  <br>";
         }
         $diff=$this->db->get_value("select check_balance 
($1)",array($this->grpt));
diff --git a/include/class/anc_key.class.php b/include/class/anc_key.class.php
index 4fec773..a040e50 100644
--- a/include/class/anc_key.class.php
+++ b/include/class/anc_key.class.php
@@ -267,7 +267,7 @@ class Anc_Key
         catch (Exception $e)
         {
             
-            if ( DEBUG ) { echo $e->getTraceAsString(); } else { echo 
_('erreur').$e->getMessage();}
+            if ( DEBUGNOALYSS > 0 ) { echo $e->getTraceAsString(); } else { 
echo _('erreur').$e->getMessage();}
               record_log($e);
             $cn->rollback();
         }
diff --git a/include/class/database.class.php b/include/class/database.class.php
index 30da3f4..7d6808d 100644
--- a/include/class/database.class.php
+++ b/include/class/database.class.php
@@ -147,7 +147,7 @@ class Database extends DatabaseCore
                $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade' . 
$i . '.sql');
                echo $succeed;
 
-                if (!DEBUG)
+                if ( DEBUGNOALYSS == 0)
                     ob_start();
                 // specific for version 4
                 if ($i == 4) {
@@ -224,7 +224,7 @@ class Database extends DatabaseCore
                      $this->execute_script(NOALYSS_INCLUDE . 
"/sql/patch/upgrade141." . $country . ".sql");
                 }
 
-                if (!DEBUG)
+                if (DEBUGNOALYSS == 0 )
                     ob_end_clean();
 
             }
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index 031f915..d82f2ce 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -349,7 +349,7 @@ class Dossier
         
//----------------------------------------------------------------------
         echo "<h2>"._("Mise à jour de la base de données principale")."</h2>";
         $cn=new Database();
-        if (DEBUG==false)
+        if (DEBUGNOALYSS == 0)
             ob_start();
         $MaxVersion=DBVERSIONREPO-1;
         for ($i=4; $i<=$MaxVersion; $i++)
@@ -359,7 +359,7 @@ class Dossier
                 
$cn->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
             }
         }
-
+        if (DEBUGNOALYSS == 0)             ob_end_clean();
         
//----------------------------------------------------------------------
         // Upgrade the folders
         
//----------------------------------------------------------------------
diff --git a/include/constant.php b/include/constant.php
index 0992495..672e3de 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -88,9 +88,10 @@ define ('SMALLX','&times;');
 define ('BUTTONADD',"&#10010;");
 
 define ('SVNINFO',NOALYSS_VERSION);
-if ( ! defined  ('DEBUG')) {
-    define ("DEBUG",false);
+if ( ! defined  ('DEBUGNOALYSS')) {
+    define ("DEBUGNOALYSS",0);
 }
+
 if ( ! defined ('LOGINPUT')) {
     define ("LOGINPUT",false);
 }
@@ -132,21 +133,31 @@ if ( ! defined ('MAX_SEARCH_CARD') ) {
 define ('MAX_FOLDER_TO_SHOW',80);
 define ('MAX_ACTION_SHOW',20);
 
-if ( DEBUG ) {
+if ( DEBUGNOALYSS == 0 ) {
+       // PRODUCTION : nothing is displaid , report only errors and warning
+        // Rapporte les erreurs d'exécution de script
+        error_reporting(E_ERROR | E_WARNING );
+        ini_set("display_errors",0);
+       ini_set("html_errors",0);
+        ini_set('log_errors',1);
+        ini_set('log_errors_max_len',0);
+}elseif (DEBUGNOALYSS==1) {
+    /* DEVELOPPEMENT : display all errors warning notice deprecated ...*/
        error_reporting(2147483647);
        ini_set("display_errors",1);
        ini_set("display_startup_errors",1);
        ini_set("html_errors",1);
         ini_set('log_errors',1);
         ini_set('log_errors_max_len',0);
-}
-else {
-        // Rapporte les erreurs d'exécution de script
-        error_reporting(E_ERROR | E_WARNING | E_PARSE|E_NOTICE);
-        ini_set("display_errors",0);
-       ini_set("html_errors",0);
+} elseif (DEBUGNOALYSS == 2 ) {
+       // like level 1 plus extra  info (filename, ...)
+       error_reporting(2147483647);
+       ini_set("display_errors",1);
+       ini_set("display_startup_errors",1);
+       ini_set("html_errors",1);
         ini_set('log_errors',1);
         ini_set('log_errors_max_len',0);
+
 }
 // Erreur
 define ("NOERROR",0);
@@ -339,4 +350,4 @@ if ( ! defined ("NOALYSS_URL")) {
 }
 if (!defined ("DEFAULT_SERVER_VIDEO_CONF")) {
     define ("DEFAULT_SERVER_VIDEO_CONF","https://www.free-solutions.org/";);
-}
\ No newline at end of file
+}
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 04823f2..6c9a2d3 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1180,7 +1180,11 @@ function display_menu($p_menuid)
             }
             tracedebug("'menu", 
$file[0]['me_file'],__FUNCTION__.__LINE__."line");
             tracedebug("'menu", 
$file[0]['me_parameter'],__FUNCTION__.__LINE__."parm ");
-            if ( DEBUG ) { echo  $file[0]['me_file']," param : 
",$file[0]['me_parameter'] ;}
+            if ( DEBUGNOALYSS == 2)
+            { 
+                echo  $file[0]['me_file']," param : ",$file[0]['me_parameter'] 
;
+                
+            }
             /*
              * Log the file we input to put in the folder test-noalyss for 
replaying it
              */
diff --git a/include/lib/config_file.php b/include/lib/config_file.php
index b70da17..36e41eb 100644
--- a/include/lib/config_file.php
+++ b/include/lib/config_file.php
@@ -172,7 +172,19 @@ function 
display_file_config($p_array,$from_setup=1,$p_os=1)
     
     print ( 'define ("LOCALE",'.$clocale.');');
     print ("\r\n");
-
+    echo <<<EOF
+    /* 
+     * DEBUGNOALYSS let you see more information when you develop.
+     * 0 = for production
+     * 1 = display all errors
+     * 2 = display all errors + more information 
+     */
+EOF;     
+    
+    print ("\r\n");
+    print ( 'define ("DEBUGNOALYSS",0);');
+    print ("\r\n");
+    
     print ( 'define ("domaine","");');
     print ("\r\n");
     if (isset($multi))
@@ -187,10 +199,6 @@ function 
display_file_config($p_array,$from_setup=1,$p_os=1)
     print ( 'define ("dbname","'.$cdbname.'");');
     print ("\r\n");
     
-    print (' // Uncomment to DEBUG');
-    print ("\r\n");
-    print ( '// define ("DEBUG",TRUE);');
-    print ("\r\n");
     print (' // Uncomment to log your input');
     print ("\r\n");   
     print ( '// define ("LOGINPUT",TRUE);');
diff --git a/include/lib/database_core.class.php 
b/include/lib/database_core.class.php
index d7d5cb6..29ef8a1 100644
--- a/include/lib/database_core.class.php
+++ b/include/lib/database_core.class.php
@@ -55,7 +55,7 @@ class DatabaseCore
         $this->db = pg_connect("dbname=$p_dbname host='$p_host' user='$p_user'
                      password='$p_password' port=$p_port");
         if ($this->db == false) {
-            if (DEBUG) {
+            if ( DEBUGNOALYSS > 0 ) {
 
                 echo '<h2 class="error">'._('Impossible de se connecter à 
postgreSql').'</h2>';
                 echo '<p>';
@@ -160,7 +160,7 @@ class DatabaseCore
             $this->array = $p_array;
 
             if ($p_array == null) {
-                if (!DEBUG)
+                if ( DEBUGNOALYSS == 0 )
                     $this->ret = pg_query($this->db, $p_string);
                 else
                     $this->ret = @pg_query($this->db, $p_string);
@@ -169,7 +169,7 @@ class DatabaseCore
                 if (!is_array($p_array)) {
                     throw new Exception(_("Erreur : exec_sql attend un 
array"));
                 }
-                if (!DEBUG)
+                if ( DEBUGNOALYSS == 0 )
                     $this->ret =@pg_query_params($this->db, $p_string, 
$p_array);
                 else
                     $this->ret = pg_query_params($this->db, $p_string, 
$p_array);
@@ -179,7 +179,7 @@ class DatabaseCore
                 throw new Exception("  SQL ERROR $p_string " . $str_error, 1);
             }
         } catch (Exception $a) {
-            if (DEBUG) {
+            if ( DEBUGNOALYSS > 0 ) {
                 print_r($p_string);
                 print_r($p_array);
                 echo $a->getMessage();
@@ -277,7 +277,7 @@ class DatabaseCore
     function execute_script($script)
     {
 
-        if (!DEBUG) {
+        if ( DEBUGNOALYSS == 0 ) {
             ob_start();
         } else {
             $debug = fopen("/tmp/debug.log", "w+");
@@ -335,11 +335,11 @@ class DatabaseCore
                 $buffer = str_replace(';', '', $buffer);
             }
             $sql .= $buffer;
-            if (DEBUG) fwrite($debug, $sql);
+            if ( DEBUGNOALYSS > 0 ) fwrite($debug, $sql);
             if ($this->exec_sql($sql) == false) {
 
                 $this->rollback();
-                if (!DEBUG)
+                if ( DEBUGNOALYSS == 0 )
                     ob_end_clean();
                 print "ERROR : $sql";
                 throw new Exception("ERROR : $sql");
@@ -349,7 +349,7 @@ class DatabaseCore
             print "<hr>";
         } // while (feof)
         fclose($hf);
-        if (!DEBUG)
+        if ( DEBUGNOALYSS == 0 )
             ob_end_clean();
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]