Added 'debugStatusMes function feature
This commit is contained in:
@@ -13,6 +13,7 @@ try {
|
|||||||
} catch (mysqli_sql_exception $e) {
|
} catch (mysqli_sql_exception $e) {
|
||||||
// Access Deny
|
// Access Deny
|
||||||
include(PAGES_FOLD . "db-error.php");
|
include(PAGES_FOLD . "db-error.php");
|
||||||
|
debugStatusMes("Database connection failed.", "High");
|
||||||
|
|
||||||
|
|
||||||
die();
|
die();
|
||||||
|
|||||||
@@ -50,3 +50,65 @@ function resolve_page() {
|
|||||||
$GLOBALS["current_page"] = "404";
|
$GLOBALS["current_page"] = "404";
|
||||||
return PAGES_FOLD . "404.php";
|
return PAGES_FOLD . "404.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DEBUG FUNCTIONS AND ARRAY
|
||||||
|
*/
|
||||||
|
|
||||||
|
$debug_messages = [
|
||||||
|
'High' => [],
|
||||||
|
'Medium' => [],
|
||||||
|
'Low' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// FUNCTION TO GET DEBUG STATUS MESSAGES
|
||||||
|
function debugStatusMes( string $Message, string $intensity) {
|
||||||
|
global $debug, $debug_messages;
|
||||||
|
|
||||||
|
// Controlla se il debug è attivo
|
||||||
|
if ($debug !== "on") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalizza l'intensità per evitare errori di battitura (es. "high" diventa "High")
|
||||||
|
$intensity = ucfirst(strtolower($intensity));
|
||||||
|
|
||||||
|
// Verifica che l'intensità sia valida prima di inserire il messaggio
|
||||||
|
if (array_key_exists($intensity, $debug_messages)) {
|
||||||
|
$debug_messages[$intensity][] = $Message;
|
||||||
|
} else {
|
||||||
|
// Se l'intensità non è corretta, la salva in una categoria generica o Low
|
||||||
|
$debug_messages['Low'][] = "[Intensità errata: $intensity] " . $Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DISPLAY DEBUG ERROR FOOTER BAR
|
||||||
|
function displayDebugFooter() {
|
||||||
|
global $debug, $debug_messages;
|
||||||
|
|
||||||
|
if ($debug !== "on") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div id="debug-footer-container" style="background: #222; color: #fff; padding: 15px; font-family: monospace; border-top: 3px solid #ff4444; margin-top: 30px;">';
|
||||||
|
echo '<h3>⚙️ Debug Status Messages</h3>';
|
||||||
|
|
||||||
|
foreach ($debug_messages as $level => $messages) {
|
||||||
|
if (!empty($messages)) {
|
||||||
|
// Assegna un colore diverso in base alla gravità
|
||||||
|
$color = '#d3fcc8'; // Default Low
|
||||||
|
if ($level === 'High') $color = '#ff4444';
|
||||||
|
if ($level === 'Medium') $color = '#ffbb33';
|
||||||
|
|
||||||
|
echo "<div class='debug-group' style='margin-bottom: 10px;'>";
|
||||||
|
echo "<strong style='color: $color;'>[" . $level . "]</strong>";
|
||||||
|
echo "<ul style='margin: 5px 0; padding-left: 20px;'>";
|
||||||
|
foreach ($messages as $msg) {
|
||||||
|
echo "<li>" . htmlspecialchars($msg) . "</li>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
echo "</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
@@ -22,5 +22,6 @@
|
|||||||
}
|
}
|
||||||
require_once(ROOT_DIR . "config/constants.php");
|
require_once(ROOT_DIR . "config/constants.php");
|
||||||
require_once(CONFIG_FOLD . "settings.php");
|
require_once(CONFIG_FOLD . "settings.php");
|
||||||
|
require_once(FUNCTIONS_FOLD . "functions.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
### LIST OF FUNCTIONS TO INCLUDE ###
|
||||||
|
Include in this array all the function files you may want to include.
|
||||||
|
You don't need to specify the extension .php, the system will automatically add it.
|
||||||
|
*/
|
||||||
|
$fun_to_inc = array(
|
||||||
|
//"example",
|
||||||
|
"test"
|
||||||
|
);
|
||||||
|
|
||||||
|
// DON'T CHANGE THE CODE BELOW!!!
|
||||||
|
if (isset($fun_to_inc) && is_array($fun_to_inc) && !empty($fun_to_inc)){
|
||||||
|
foreach ($fun_to_inc as $fun){
|
||||||
|
if (file_exists(FUNCTIONS_FOLD . $fun . ".php")){
|
||||||
|
require_once(FUNCTIONS_FOLD . $fun . ".php");
|
||||||
|
} else {
|
||||||
|
debugStatusMes("Function file $fun.php not found in functions folder: '" . FUNCTIONS_FOLD . "'", "Medium");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -62,10 +62,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if (DB_DEBUG == "yes"){
|
if (DB_DEBUG == "yes"){
|
||||||
echo "<p class=' details err_env_help'><span>Error Details: </span>" . $e->getMessage() . "</p>";
|
echo "<p class=' details err_env_help'><span>Error Details: </span>" . $e->getMessage() . "</p>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
debugStatusMes("Database connection failed.", "High");
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<div class="footer-credit">© <year>year</year> - Company Name. All right reserved.</div>
|
<div class="footer-credit">© <year>year</year> - Company Name. All right reserved.</div>
|
||||||
<div class="webmaster_footer">Website designed by Simone Cusano - SimoLinuxDesign.org</div>
|
<div class="webmaster_footer">Website designed by Simone Cusano - SimoLinuxDesign.org</div>
|
||||||
</footer>
|
</footer>
|
||||||
<?php include(INCLUDES_FOLD . "js_footer.php"); ?>
|
<?php include(INCLUDES_FOLD . "js_footer.php"); ?>
|
||||||
|
<?php displayDebugFooter(); ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user