noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 07/07: Improve DEBUG


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 07/07: Improve DEBUG
Date: Fri, 30 Sep 2022 09:35:56 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit e133e0ca89ed8cc9f3513b521aae4c45cc5b9c9a
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Sep 30 15:35:42 2022 +0200

    Improve DEBUG
---
 html/do.php               | 73 ++++-------------------------------------------
 html/user_login.php       |  8 ++++++
 include/lib/ac_common.php | 57 +++++++++++++++++++++++++++++++++++-
 3 files changed, 70 insertions(+), 68 deletions(-)

diff --git a/html/do.php b/html/do.php
index d668aa8e7..8fa3c80d8 100644
--- a/html/do.php
+++ b/html/do.php
@@ -78,73 +78,12 @@ 
$style_user=$http->post("style_user","string",$_SESSION[SESSION_KEY.'g_theme']);
 
 html_page_start($style_user);
 if ( DEBUGNOALYSS > 1 ) {
-/**
- * Debug Design
- */
-echo <<<EOF
-<div class="d-none d-sm-block d-md-none d-lg-none d-xl-none " 
style="background-color:red">Small</div>
-<div class="d-none d-md-block d-lg-none " 
style="background-color:orangered">Medium</div>
-<div class="d-none d-lg-block d-xl-none " 
style="background-color:orange">Large</div>
-<div class="d-none d-xl-block " style="background-color:wheat">X Large</div>
-EOF;
-
-    ?>
-<div id="debug_div" style="border:slategray solid 1px;margin-left: 
0px;position:absolute;background:white;top:2px;left:25px;z-index:1000;display:none">
-       <h2 style="margin-top:100px"> Memory Usage </h2>
-       <?php  echo memory_get_usage()/1024.0 . " kb \n"; ?>
-
-
-    <h2>$_POST</h2>
-    <pre>
-    <?php        
-    print_r($_POST);
-    ?>
-        
-    </pre>
-    <h2>$_GET</h2>
-    <pre>
-    <?php        
-    print_r($_GET);
-    ?>
-    </pre>
-    <h2>$_REQUEST</h2>
-    <pre>
-    <?php        
-    print_r($_REQUEST);
-    ?>
-    </pre>
-    <h2>$_SESSION</h2>
-    <pre>
-    <?php        
-    print_r($_SESSION);
-    ?>
-    </pre>
-    
-    <h2>$GLOBALS</h2>
-    <pre>
-    <?php        
-    // Use much of memory
-    print_r($GLOBALS);
-    ?>
-    </pre>
-    
-</div>
-<script>
-    function show_debug_request() {
-        var visible=document.getElementById('debug_div').style.display;
-        var new_state="";
-        if ( visible === 'block') { new_state='none';}
-        else
-        if ( visible == 'none') { new_state='block';}
-        else 
-            console.log('erreur');
-        document.getElementById('debug_div').style.display=new_state;
-    }
-</script>
-<input type="button" class="tinybutton" 
style="position:absolute;top:40px;left:50px;margin-left:50px;z-index:1000" 
value="show request" onclick="show_debug_request()">
-
-<?php
-
+    /**
+     * Debug Design
+     */
+    debug_show_size();
+    debug_show_request();
+    debug_show_global();
 } //<--- if DEBUG 
 $g_parameter=new Noalyss_Parameter_Folder($cn);
 
diff --git a/html/user_login.php b/html/user_login.php
index 280272431..cb8a396b7 100644
--- a/html/user_login.php
+++ b/html/user_login.php
@@ -61,6 +61,14 @@ if ( strpos($browser,'MSIE 6')!=false ||
 EOF;
     exit();
 }
+if ( DEBUGNOALYSS > 1 ) {
+    /**
+     * Debug Design
+     */
+    debug_show_size();
+    debug_show_request();
+    debug_show_global();
+} //<--- if DEBUG
 $ac=new Database();
 $hi=new HttpInput();
 
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index a6955346d..5dd61a0ea 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1682,4 +1682,59 @@ function linkTo($p_url)
     } else {
         return $p_url;
     }
-}
\ No newline at end of file
+}
+function debug_show_size()
+{
+    echo <<<EOF
+<div class="d-block d-sm-none  " style="background-color:lightblue">Xtra  
Small</div>
+<div class="d-none d-sm-block d-md-none d-lg-none d-xl-none " 
style="background-color:red">Small</div>
+<div class="d-none d-md-block d-lg-none " 
style="background-color:orangered">Medium</div>
+<div class="d-none d-lg-block d-xl-none " 
style="background-color:orange">Large</div>
+<div class="d-none d-xl-block " style="background-color:wheat">X Large</div>
+EOF;
+}
+/**
+ * @brief for development , show request (POST, GET)
+ * @return void
+ */
+ function debug_show_request() {
+    $id=uniqid("debug");
+    $title=\HtmlInput::title_box(_("REQUEST"),$id,"hide");
+    ?>
+    <div class=" col-10 inner_box" style="display:none" id="<?=$id?>">
+        <?=$title?>
+
+        <h2 style="margin-top:100px"> Memory Usage </h2>
+           <?php  echo memory_get_usage()/1024.0 . " kb \n"; ?>
+
+        $_POST
+        <pre><?php echo print_r($_POST)?></pre>
+        $_GET
+        <pre><?=print_r($_GET)?></pre>
+        $_REQUEST
+        <pre><?=print_r($_REQUEST)?></pre>
+        <?=\HtmlInput::button_hide($id)?>
+    </div>
+    <input type="button" onclick="document.getElementById('<?=$id?>').show();" 
value="Show request">
+    <?php
+}
+
+/**
+ * @brief for development , show GLOBAL and SESSION
+ * @return void
+ */
+ function debug_show_global() {
+    $id=uniqid("debug");
+    $title=\HtmlInput::title_box(_("GLOBALS"),$id,"hide");
+    ?>
+    <div class=" col-10 inner_box" style="display:none" id="<?=$id?>">
+        <?=$title?>
+        $GLOBALS
+        <pre><?=print_r($GLOBALS)?></pre>
+
+        <?=\HtmlInput::button_hide($id)?>
+    </div>
+    <input type="button" onclick="document.getElementById('<?=$id?>').show();" 
value="Show session">
+    <?php
+}
+



reply via email to

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