Browse Source

Mise à jour du mode debug

stany.ferer 1 year ago
parent
commit
9fcf1b68eb
41 changed files with 174 additions and 132 deletions
  1. 3 0
      conf.inc.php
  2. 0 41
      core/class/core.class.php
  3. 28 6
      core/class/db.class.php
  4. 60 39
      core/class/debug.class.php
  5. 4 4
      core/class/document.class.php
  6. 2 2
      core/class/maj.class.php
  7. 2 2
      core/controllers/header.php
  8. 24 0
      core/javascript/cms.debug.php
  9. 2 2
      core/submit/cms.parametres-debug-activation.php
  10. 13 0
      core/submit/cms.parametres-debug-sql-activation.php
  11. 2 2
      core/submit/cms.parametres-debug-submit-activation.php
  12. 2 2
      core/submit/cms.parametres-maintenance-activation.php
  13. 1 1
      core/views/_cms.foot.php
  14. 1 1
      core/views/_events.nav.php
  15. 1 1
      core/views/pages/cms.compte-historique-csv.php
  16. 1 1
      core/views/pages/cms.compte.php
  17. 1 1
      core/views/pages/cms.document.php
  18. 1 1
      core/views/pages/cms.documents-my-assign.php
  19. 1 1
      core/views/pages/cms.documents.php
  20. 1 1
      core/views/pages/cms.evenement-inscrits.php
  21. 1 1
      core/views/pages/cms.evenement-salaries.php
  22. 1 1
      core/views/pages/cms.evenements.php
  23. 1 1
      core/views/pages/cms.historique.php
  24. 1 1
      core/views/pages/cms.lottery-inscrits.php
  25. 1 1
      core/views/pages/cms.lottery-winners.php
  26. 1 1
      core/views/pages/cms.lotterys.php
  27. 1 1
      core/views/pages/cms.parametre-teams.php
  28. 1 1
      core/views/pages/cms.parametre-users.php
  29. 2 2
      core/views/pages/cms.parametres-debug.php
  30. 2 2
      core/views/pages/cms.parametres-restore.php
  31. 2 2
      core/views/pages/cms.parametres.php
  32. 1 1
      core/views/pages/cms.proweb-export-csv.php
  33. 1 1
      core/views/pages/cms.proweb-historique-excel.php
  34. 1 1
      core/views/pages/cms.proweb-salaries.php
  35. 1 1
      core/views/pages/cms.rh-historique-excel.php
  36. 1 1
      core/views/pages/cms.rh-import-to-temp.php
  37. 1 1
      core/views/pages/cms.rh-liste-salaries.php
  38. 1 1
      core/views/pages/cms.user.php
  39. 1 1
      core/views/pages/events.login-control.php
  40. 1 1
      core/views/pages/events.login-salarie.php
  41. 1 1
      public-cms/submit.php

+ 3 - 0
conf.inc.php

@@ -87,8 +87,11 @@ define("EMEMARGEMENT_END", 1800); // Possibilité de s'émarger 1800 secondes so
 // Backup
 define("BACKUP_LIMIT", 15); // nombre de backup max
 define("FILE_MAINTENANCE", ".lock-maintenance");
+
+// Debug
 define("FILE_DEBUG", ".active-debug");
 define("FILE_DEBUG_SUBMIT", ".active-debug-submit");
+define("FILE_DEBUG_SQL", ".active-debug-sql");
 
 // Email
 define("EMAIL_SMTP_HOST", "ssl0.ovh.net");

+ 0 - 41
core/class/core.class.php

@@ -198,15 +198,6 @@ class core
         }
     }
 
-    public static function print_r(array $_array, int $_exit = NULL)
-    {
-        echo "<div>".debug::getTraces() . "</div>";
-        echo "<pre>";
-        print_r($_array);
-        echo "</pre>";
-        ($_exit != NULL) ? exit() : NULL;
-    }
-
     public static function elementMenu(string $_id, string $_href, string $_titre, string $_style = NULL)
     {
         if (access::ifAccesss($_id)) {
@@ -287,38 +278,6 @@ class core
         return $date->format(time()) . " à " . date("H:i:s");
     }
 
-    public static function addFileMaintenance()
-    {
-        $myfile = fopen(DOCUMENT_ROOT . FILE_MAINTENANCE, "w");
-        fclose($myfile);
-    }
-
-    public static function removeFileMaintenance()
-    {
-        unlink(DOCUMENT_ROOT . FILE_MAINTENANCE);
-    }
-
-    public static function isMaintenance()
-    {
-        return (file_exists(DOCUMENT_ROOT . FILE_MAINTENANCE)) ? TRUE : FALSE;
-    }
-
-    public static function addFileDebug()
-    {
-        $myfile = fopen(DOCUMENT_ROOT . FILE_DEBUG, "w");
-        fclose($myfile);
-    }
-
-    public static function removeFileDebug()
-    {
-        unlink(DOCUMENT_ROOT . FILE_DEBUG);
-    }
-
-    public static function isDebug()
-    {
-        return (file_exists(DOCUMENT_ROOT . FILE_DEBUG)) ? TRUE : FALSE;
-    }
-
     public static function resetDatas()
     {
         db::query("TRUNCATE " . DB_T_TEMP_SALARIES);

+ 28 - 6
core/class/db.class.php

@@ -4,11 +4,14 @@ class db
 {
     private static $dbh;
     private static $error;
-    private static $qError;
     private static $stmt;
 
     private static function connexion()
     {
+        if (self::$dbh) {
+            return;
+        }
+
         $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME;
         $options = array(
             PDO::ATTR_PERSISTENT => true,
@@ -19,16 +22,23 @@ class db
             self::$dbh = new PDO($dsn, DB_USER, DB_PASS, $options);
         } catch (PDOException $e) {
             self::$error = $e->getMessage();
+            throw new Exception(self::$error);
         }
     }
 
+    public static function version()
+    {
+        self::connexion();
+        return self::$dbh->getAttribute(PDO::ATTR_SERVER_VERSION);
+    }
+
     public static function query(string $query)
     {
         self::connexion();
         self::$stmt = self::$dbh->prepare($query);
     }
 
-    public static function bind(string $param, string $value = NULL, string $type = null)
+    public static function bind(string $param, $value = null, $type = null)
     {
         if (is_null($type)) {
             switch (true) {
@@ -50,7 +60,8 @@ class db
 
     public static function execute()
     {
-        if(core::isDebug()){
+        self::connexion();
+        if (debug::isFile("sql")) {
             ob_start();
             $return = self::$stmt->execute();
             self::$stmt->debugDumpParams();
@@ -81,34 +92,45 @@ class db
 
     public static function lastInsertId()
     {
+        self::connexion();
         return self::$dbh->lastInsertId();
     }
 
     public static function beginTransaction()
     {
+        self::connexion();
         return self::$dbh->beginTransaction();
     }
 
     public static function endTransaction()
     {
+        self::connexion();
         return self::$dbh->commit();
     }
 
     public static function cancelTransaction()
     {
+        self::connexion();
         return self::$dbh->rollBack();
     }
 
     public static function debugDumpParams()
     {
+        self::connexion();
         return self::$stmt->debugDumpParams();
     }
 
     public static function queryError()
     {
-        self::$qError = self::$dbh->errorInfo();
-        if (!is_null(self::$qError[2])) {
-            echo self::$qError[2];
+        self::connexion();
+        $qError = self::$dbh->errorInfo();
+        if (!is_null($qError[2])) {
+            echo $qError[2];
         }
     }
+
+    public static function getError()
+    {
+        return self::$error;
+    }
 }

+ 60 - 39
core/class/debug.class.php

@@ -7,15 +7,43 @@ class debug
     private static $startTime;
     private static $closeTime;
 
-    public static function addFileSubmit()
+    private static function typeFile(string $_string){
+        switch ($_string) {
+            case 'debug':
+                return FILE_DEBUG;
+                break;
+            case 'maintenance':
+                return FILE_MAINTENANCE;
+                break;
+            case 'submit':
+                return FILE_DEBUG_SUBMIT;
+                break;
+            case 'sql':
+                return FILE_DEBUG_SQL;
+                break;
+            default:
+                return NULL;
+                break;
+        }
+
+    }
+    
+    public static function addFile(string $_string = NULL)
+    {
+        if($_string != NULL){
+            $myfile = fopen(DOCUMENT_ROOT . self::typeFile($_string), "w");
+            fclose($myfile);
+        }
+    }
+
+    public static function removeFile(string $_string = NULL)
     {
-        $myfile = fopen(DOCUMENT_ROOT . FILE_DEBUG_SUBMIT, "w");
-        fclose($myfile);
+        unlink(DOCUMENT_ROOT . self::typeFile($_string));
     }
 
-    public static function removeFileSubmit()
+    public static function isFile(string $_string = NULL)
     {
-        unlink(DOCUMENT_ROOT . FILE_DEBUG_SUBMIT);
+        return (file_exists(DOCUMENT_ROOT . self::typeFile($_string))) ? TRUE : FALSE;
     }
 
     public static function isSubmit()
@@ -25,7 +53,7 @@ class debug
     
     public static function includeDebug()
     {
-        if (core::isDebug()) {
+        if (debug::isFile("debug")) {
             echo '<link rel="stylesheet" href="css/debug.css">';
         }
     }
@@ -139,6 +167,15 @@ class debug
         return $return;
     }
 
+    public static function print_r(array $_array, int $_exit = NULL)
+    {
+        echo "<div>".debug::getTraces() . "</div>";
+        echo "<pre>";
+        print_r($_array);
+        echo "</pre>";
+        ($_exit != NULL) ? exit() : NULL;
+    }
+
     public static function log($_message, $_mark = NULL)
     {        
         $mark = "<div class='debug-head-console'>";
@@ -179,16 +216,20 @@ class debug
 
     public static function renderLogs()
     {
-        //if (!empty(self::$logs)) {
-
             echo "<div id='debugger-logs'>";
 
             echo "<div class='debug-renderLogs-header'>";
-            echo "PHP ". phpversion() . " | " . number_format(self::$closeTime, 4) . " secondes ";
+            echo "PHP ". phpversion() . " | MYSQL " . db::version() . " | " . number_format(self::$closeTime, 4) . " secondes ";
             echo "</div>";
-            echo "<div class=\"form-check form-switch\">
-                <input class=\"form-check-input\" type=\"checkbox\" id=\"checkIsSubmit\" " . core::checkboxSelecter(self::isSubmit(), 0) . " >
-                <label class=\"form-check-label\" for=\"checkIsSubmit\">Intercepter la validation</label>
+            echo "<div class=\"form-check form-switch\" style=\"margin-top: -30px;\">
+                <div>
+                    <input class=\"form-check-input\" type=\"checkbox\" id=\"checkIsSubmit\" " . core::checkboxSelecter(self::isFile("submit"), 0) . " >
+                    <label class=\"form-check-label\" for=\"checkIsSubmit\">Intercepter les Submit</label>
+                </div>
+                <div>
+                    <input class=\"form-check-input\" type=\"checkbox\" id=\"checkIsSql\" " . core::checkboxSelecter(self::isFile("sql"), 0) . " >
+                    <label class=\"form-check-label\" for=\"checkIsSql\">Intercepter les requêtes SQL</label>
+                </div>
             </div>";
 
             foreach (self::$logs as $log) {
@@ -202,30 +243,7 @@ class debug
             }
 
             echo "</div>";
-
-            echo "
-            <script>
-                $(document).ready(function() {
-
-                    $('#checkIsSubmit').on('change', function() {
-                        window.location.href = '/submit.php?from=parametres-debug-submit-activation&actif=' + $('#checkIsSubmit').prop('checked');
-                    });
-            
-                    $('.toggle-logs').click(function() {
-                        $('#debugger-logs').slideToggle();
-                    });
-
-                    // Apply syntax highlighting to log entries
-                    $('.log-entry').each(function() {
-                        var html = $(this).html();
-                        html = html.replace(/(\\$\\w+)/g, '<span class=\"variable\">$1</span>');
-                        html = html.replace(/(\\bfunction\\b)/g, '<span class=\"function\">$1</span>');
-                        $(this).html(html);
-                    });
-                });
-            </script>
-        ";
-        //}
+            get::javascript("debug");
     }
 
     public static function init()
@@ -256,13 +274,16 @@ class debug
 
     public static function getBadges(){
         $return = "";
-        if(core::isMaintenance()){
+        if(debug::isFile("maintenance")){
             $return .= "<a href=\"/parametsres.html\"><span class=\"badge\" style=\"background-color:red; margin:5px;\">SITE EN MODE MAINTENANCE</span></a>";
         }
-        if(core::isDebug()){
+        if(debug::isFile("debug")){
             $return .= "<a href=\"#\"><span class=\"badge toggle-logs\" style=\"background-color:orange; color:black; margin:5px;\">MODE DEBUG</span></a>";
         } 
-        if(self::isSubmit()){
+        if(self::isFile("sql")){
+            $return .= "<a href=\"#\"><span class=\"badge toggle-logs\" style=\"background-color:orange; color:black; margin:5px;\">MODE DEBUG SQL</span></a>";
+        }
+        if(self::isFile("submit")){
             $return .= "<a href=\"#\"><span class=\"badge toggle-logs\" style=\"background-color:orange; color:black; margin:5px;\">MODE DEBUG SUBMIT</span></a>";
         } 
         return $return;

+ 4 - 4
core/class/document.class.php

@@ -159,7 +159,7 @@ class document
                 $lastId = db::lastInsertId();
             } catch (Exception $ex) {
                 alert::recError("Erreur à l'enregistrement de la fiche : " . core::getPost("titre"));
-                if(core::isDebug()) { alert::recError("Stack : " . $ex); }
+                if(debug::isFile("debug")) { alert::recError("Stack : " . $ex); }
                 return FALSE;
             }
 
@@ -167,7 +167,7 @@ class document
                 $idFile = self::uploadFile($file);
             } catch (Exception $ex) {
                 alert::recError("Erreur à l'enregistrement de la pièce jointe : " . $idFile);
-                if(core::isDebug()) { alert::recError("Stack : " . $ex); }
+                if(debug::isFile("debug")) { alert::recError("Stack : " . $ex); }
                 return FALSE;
             }
 
@@ -175,7 +175,7 @@ class document
                 self::addFile($lastId, $idFile, 1);
             } catch (Exception $ex) {
                 alert::recError("Erreur à l'enregistrement de la liaison : " . $idFile);
-                if(core::isDebug()) { alert::recError("Stack : " . $ex); }
+                if(debug::isFile("debug")) { alert::recError("Stack : " . $ex); }
                 return FALSE;
             }
 
@@ -188,7 +188,7 @@ class document
                 
             } catch (Exception $ex) {
                 alert::recError("Erreur à l'enregistrement de la liaison : " . $idFile);
-                if(core::isDebug()) { alert::recError("Stack : " . $ex); }
+                if(debug::isFile("debug")) { alert::recError("Stack : " . $ex); }
                 return FALSE;
             }
 

+ 2 - 2
core/class/maj.class.php

@@ -59,7 +59,7 @@ class maj {
         // Activation du mode maintenance
         self::printSeparateur();
         self::print(">> Mode maintenance activé", self::$colorLineGrey);
-        core::addFileMaintenance();
+        debug::addFile("maintenance");
 
         // Création d'un backUp
         self::printSeparateur();
@@ -154,7 +154,7 @@ class maj {
 
         self::printSeparateur();
         self::print(">> Mode maintenance désactivé", self::$colorLineGrey);
-        core::removeFileMaintenance();
+        debug::removeFile("maintenance");
 
         self::printSeparateur();
         self::print(">> Fin de la mise à jour de " . DOMAIN_CMS, self::$colorLineGrey);

+ 2 - 2
core/controllers/header.php

@@ -15,13 +15,13 @@ spl_autoload_register(function ($class_name) {
     require_once DIR_PHP_CLASS.'/'.$class_name.'.class.php' : '';
 });
 
-if(core::isDebug()){
+if(debug::isFile("debug")){
     error_reporting(E_ALL);
     ini_set("display_errors", 1);
     debug::startTimer();
 }
 
-if(core::isMaintenance() AND $_SERVER['HTTP_HOST'] != DOMAIN_CMS){
+if(debug::isFile("maintenance") AND $_SERVER['HTTP_HOST'] != DOMAIN_CMS){
     get::page("maintenance");
     exit();
 }

+ 24 - 0
core/javascript/cms.debug.php

@@ -0,0 +1,24 @@
+<script>
+    $(document).ready(function() {
+
+        $('#checkIsSubmit').on('change', function() {
+            window.location.href = '/submit.php?from=parametres-debug-submit-activation&actif=' + $('#checkIsSubmit').prop('checked');
+        });
+
+        $('#checkIsSql').on('change', function() {
+            window.location.href = '/submit.php?from=parametres-debug-sql-activation&actif=' + $('#checkIsSql').prop('checked');
+        });
+
+        $('.toggle-logs').click(function() {
+            $('#debugger-logs').slideToggle();
+        });
+
+        // Apply syntax highlighting to log entries
+        $('.log-entry').each(function() {
+            var html = $(this).html();
+            html = html.replace(/(\\$\\w+)/g, '<span class=\"variable\">$1</span>');
+            html = html.replace(/(\\bfunction\\b)/g, '<span class=\"function\">$1</span>');
+            $(this).html(html);
+        });
+    });
+</script>

+ 2 - 2
core/submit/cms.parametres-debug-activation.php

@@ -1,7 +1,7 @@
 <?php
 if(core::ifGet("actif")){
     if(core::getGet("actif") == "true"){
-        core::addFileDebug();
+        debug::addFile("debug");
 
         historique::recRef("/parametres.html");
         historique::add(array(
@@ -13,7 +13,7 @@ if(core::ifGet("actif")){
 
         alert::recSuccess("Le mode debug est activé");
     } else {
-        core::removeFileDebug();
+        debug::removeFile("debug");
 
         historique::recRef("/parametres.html#parametres-debug");
         historique::add(array(

+ 13 - 0
core/submit/cms.parametres-debug-sql-activation.php

@@ -0,0 +1,13 @@
+<?php
+if(core::ifGet("actif")){
+    if(core::getGet("actif") == "true"){
+        debug::addFile("sql");
+        alert::recSuccess("Le mode debug sql est activé");
+    } else {
+        debug::removeFile("sql");
+        alert::recSuccess("Le mode debug sql est déactivé");
+    }
+}
+
+header("Location: " . $_SERVER['HTTP_REFERER']);
+exit();

+ 2 - 2
core/submit/cms.parametres-debug-submit-activation.php

@@ -1,10 +1,10 @@
 <?php
 if(core::ifGet("actif")){
     if(core::getGet("actif") == "true"){
-        debug::addFileSubmit();
+        debug::addFile("submit");
         alert::recSuccess("Le mode debug submit est activé");
     } else {
-        debug::removeFileSubmit();
+        debug::removeFile("submit");
         alert::recSuccess("Le mode debug submit est déactivé");
     }
 }

+ 2 - 2
core/submit/cms.parametres-maintenance-activation.php

@@ -1,7 +1,7 @@
 <?php
 if(core::ifGet("actif")){
     if(core::getGet("actif") == "true"){
-        core::addFileMaintenance();
+        debug::addFile("maintenance");
 
         historique::recRef("/parametres.html");
         historique::add(array(
@@ -13,7 +13,7 @@ if(core::ifGet("actif")){
 
         alert::recSuccess("Le mode maintenance est activé");
     } else {
-        core::removeFileMaintenance();
+        debug::removeFile("maintenance");
 
         historique::recRef("/parametres.html#parametres-debug");
         historique::add(array(

+ 1 - 1
core/views/_cms.foot.php

@@ -25,7 +25,7 @@
 </html>
 
 <?php
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::init();
         debug::endTimer();
     }

+ 1 - 1
core/views/_events.nav.php

@@ -15,7 +15,7 @@
         $logoHead = "img/logo-control.png";
     }
 
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         $titleDebug = "<span class=\"badge\" style=\"background-color:red; margin-left:5px;\">MODE DEBUG</span>";
     } else {
         $titleDebug = "";

+ 1 - 1
core/views/pages/cms.compte-historique-csv.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?file=banque-csv";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     }
 ?>

+ 1 - 1
core/views/pages/cms.compte.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?file=banque-lignes-".core::getGet("id");
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     }
 ?>

+ 1 - 1
core/views/pages/cms.document.php

@@ -25,7 +25,7 @@ if (core::getGet("id") == NULL) {
     $titre = "[#" . $document["id"] . "] " . $document["titre"];
 }
 
-if (core::isDebug()) {
+if (debug::isFile("debug")) {
     (!empty($document)) ? debug::log($document, "Données brutes document") : NULL;
     (!empty($files)) ? debug::log($files, "Données brutes files") : NULL;
 }

+ 1 - 1
core/views/pages/cms.documents-my-assign.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?jsonData=documents-my-assign";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.documents.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?file=documents";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.evenement-inscrits.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?jsonData=event-inscrits&id=".core::getGet("id");
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.evenement-salaries.php

@@ -4,7 +4,7 @@
     }
 
     $jsonTarget = "/json.php?jsonData=event-salaries&id=".core::getGet("id");
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.evenements.php

@@ -2,7 +2,7 @@
     json::create("events");
 
     $jsonTarget = "/json.php?file=events";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.historique.php

@@ -1,6 +1,6 @@
 <?php
     $json = "/json.php?jsonData=historique";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.lottery-inscrits.php

@@ -3,7 +3,7 @@
     $dataLottery = lottery::getInscriptionData(core::getGet("id"));
 
     $jsonTarget = "/json.php?jsonData=lottery-inscrits&id=" . core::getGet("id");
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.lottery-winners.php

@@ -3,7 +3,7 @@
 
 
     $jsonTarget = "/json.php?jsonData=lottery-winners&id=" . core::getGet("id");
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 

+ 1 - 1
core/views/pages/cms.lotterys.php

@@ -2,7 +2,7 @@
     json::create("lotterys");
 
     $jsonTarget = "/json.php?file=lotterys";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.parametre-teams.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?jsonData=parametre-access";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.parametre-users.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?file=users";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 2 - 2
core/views/pages/cms.parametres-debug.php

@@ -1,6 +1,6 @@
 <?php
-    $checkMaintenance = core::isMaintenance();
-    $checkDebug = core::isDebug();
+    $checkMaintenance = debug::isFile("maintenance");
+    $checkDebug = debug::isFile("debug");
 ?>
 <table class="table table-bordered">
 <tbody>

+ 2 - 2
core/views/pages/cms.parametres-restore.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?jsonData=parametres-restore";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>
@@ -45,7 +45,7 @@
         var fragment = window.location.hash;
         var onglet = fragment ? fragment.substring(1) : '';
     <?php
-        if(!core::isDebug()) { ?>
+        if(!debug::isFile("debug")) { ?>
             if(index == 0){
                 return '<form method="post" action="/submit.php" onsubmit="loading()">\n\
                 <input type="hidden" name="from" value="parametres-restore-backup-zip">\n\

+ 2 - 2
core/views/pages/cms.parametres.php

@@ -1,7 +1,7 @@
 <?php
 maj::bashFetch();
-$checkMaintenance = core::isMaintenance();
-$checkDebug = core::isDebug();
+$checkMaintenance = debug::isFile("maintenance");
+$checkDebug = debug::isFile("debug");
 ?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">

+ 1 - 1
core/views/pages/cms.proweb-export-csv.php

@@ -8,7 +8,7 @@ json::create("host");
 
     $jsonTarget1 = "/json.php?jsonData=proweb-transfert-sftp";
     $jsonTarget2 = "/json.php?jsonData=proweb-transfert-local";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget1, "OUVRIR LE JSON : ".$jsonTarget1), "JSON chargé en arrière plan");
         debug::log(debug::getBadge($jsonTarget2, "OUVRIR LE JSON : ".$jsonTarget2), "JSON chargé en arrière plan");
     } 

+ 1 - 1
core/views/pages/cms.proweb-historique-excel.php

@@ -1,6 +1,6 @@
 <?php
     $jsonTarget = "/json.php?file=excel-proweb";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.proweb-salaries.php

@@ -3,7 +3,7 @@ $dateData = get::jsonDateDataExcelProweb();
 $date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
 
     $jsonTarget = "/json.php?file=salaries-proweb";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.rh-historique-excel.php

@@ -3,7 +3,7 @@
     json::create("excel");
 
     $jsonTarget = "/json.php?file=excel";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.rh-import-to-temp.php

@@ -34,7 +34,7 @@ if(empty($json["excel"])){
 else {
 
     $jsonTarget = "/json.php?file=tmp_salaries";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.rh-liste-salaries.php

@@ -3,7 +3,7 @@
     $date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
 
     $jsonTarget = "/json.php?file=salaries";
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "JSON chargé en arrière plan");
     } 
 ?>

+ 1 - 1
core/views/pages/cms.user.php

@@ -11,7 +11,7 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
         $submit = "Modifier votre profil";
         $titre = "Votre fiche de profil";
         $protect = 1;
-        if (core::isDebug()) {
+        if (debug::isFile("debug")) {
             debug::log($user, "Données brutes user");
         }
     } else {

+ 1 - 1
core/views/pages/events.login-control.php

@@ -9,7 +9,7 @@
         $titleHead = "";
     }
 
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         $titleDebug = "<span class=\"badge\" style=\"background-color:red; margin-top:5px;\">MODE DEBUG</span>";
     } else {
         $titleDebug = "";

+ 1 - 1
core/views/pages/events.login-salarie.php

@@ -9,7 +9,7 @@
         $titleHead = "";
     }
 
-    if(core::isDebug()){
+    if(debug::isFile("debug")){
         $titleDebug = "<span class=\"badge\" style=\"background-color:red; margin-top:5px;\">MODE DEBUG</span>";
     } else {
         $titleDebug = "";

+ 1 - 1
public-cms/submit.php

@@ -8,7 +8,7 @@ require_once "../conf.inc.php";
 require_once DIR_PHP_LAYOUTS . "header.php"; 
 require_once DIR_PHP_LAYOUTS . "cms.session.php";
 
-if(debug::isSubmit() AND ( core::ifPost() OR core::ifFiles()) ) {
+if(debug::isFile("submit") AND ( core::ifPost() OR core::ifFiles()) ) {
     core::ifPost() ? core::print_r(core::getPost()) : NULL;
     core::ifFiles() ? core::print_r(core::getFiles()) : NULL;
     exit();