fixed debug level
This commit is contained in:
parent
b5e550cb5c
commit
49451d9ebb
8 changed files with 96 additions and 23 deletions
|
|
@ -2191,7 +2191,7 @@ class OGPDatabaseMySQL extends OGPDatabase
|
|||
return $this->listQuery($query);
|
||||
}
|
||||
|
||||
public function getIpPorts_limit($ip_id = 0,$page_dashboardlist,$limit_dashboardlist) {
|
||||
public function getIpPorts_limit($ip_id = 0, $page_dashboardlist = 1, $limit_dashboardlist = 25) {
|
||||
$ip_id = $this->realEscapeSingle($ip_id);
|
||||
$user_request_page = ($page_dashboardlist - 1) * $limit_dashboardlist;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,21 @@
|
|||
* GSP – Global Debug System
|
||||
* -------------------------
|
||||
* Loaded early in every request (after config.inc.php defines DEBUG_MODE).
|
||||
* Controlled by the DEBUG_MODE constant. Set to false (or leave undefined)
|
||||
* in production to disable ALL output and keep standard error suppression.
|
||||
*
|
||||
* Activation:
|
||||
* In includes/config.inc.php add: define('DEBUG_MODE', true);
|
||||
* In production set it to false or remove the line entirely.
|
||||
* Constants (set in includes/config.inc.php):
|
||||
* DEBUG_MODE – true/false master switch.
|
||||
* DEBUG_LEVEL – 0=off, 1=fatal only, 2=errors+warnings, 3=all (default 1)
|
||||
*
|
||||
* The panel Settings page exposes a "debug_level" dropdown that overrides
|
||||
* DEBUG_LEVEL at runtime (applied in home.php after the DB is ready).
|
||||
*/
|
||||
|
||||
if (!defined('DEBUG_MODE')) {
|
||||
define('DEBUG_MODE', false);
|
||||
}
|
||||
if (!defined('DEBUG_LEVEL')) {
|
||||
define('DEBUG_LEVEL', 1); // fatal errors only by default
|
||||
}
|
||||
|
||||
if (!DEBUG_MODE) {
|
||||
// Production: suppress all output, only log to server error log
|
||||
|
|
@ -26,14 +30,52 @@ if (!DEBUG_MODE) {
|
|||
|
||||
// ── Development mode ──────────────────────────────────────────────────────────
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// Apply the initial level from the constant; may be overridden from DB later.
|
||||
gsp_apply_debug_level(DEBUG_LEVEL);
|
||||
|
||||
// Accumulated non-fatal errors collected by the custom handler
|
||||
$GLOBALS['_gsp_debug_errors'] = [];
|
||||
|
||||
/**
|
||||
* Apply an error-reporting level for GSP debug mode.
|
||||
*
|
||||
* Level map:
|
||||
* 0 = off – suppress everything
|
||||
* 1 = fatal only – E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR
|
||||
* 2 = errors+warnings – adds E_WARNING, E_USER_ERROR, E_USER_WARNING
|
||||
* 3 = all – E_ALL
|
||||
*
|
||||
* Safe to call multiple times (e.g. once from config, once after DB load).
|
||||
*/
|
||||
function gsp_apply_debug_level(int $level): void
|
||||
{
|
||||
switch ($level) {
|
||||
case 0:
|
||||
error_reporting(0);
|
||||
ini_set('display_errors', '0');
|
||||
break;
|
||||
case 1:
|
||||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
|
||||
ini_set('display_errors', '1');
|
||||
break;
|
||||
case 2:
|
||||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR
|
||||
| E_RECOVERABLE_ERROR | E_WARNING | E_USER_ERROR | E_USER_WARNING);
|
||||
ini_set('display_errors', '1');
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Custom error handler – captures E_WARNING, E_NOTICE, E_DEPRECATED, etc.
|
||||
* Fatal errors (E_ERROR, E_PARSE …) are handled by the shutdown function.
|
||||
|
|
|
|||
|
|
@ -26,27 +26,29 @@ define("DEFAULT_REFRESH_TIME","2");
|
|||
|
||||
class OGPView {
|
||||
|
||||
private $meta;
|
||||
private $title;
|
||||
private string $meta = '';
|
||||
private string $title = 'Open Game Panel';
|
||||
private string $header_code = '';
|
||||
|
||||
private $refreshTime;
|
||||
private $refreshUrl;
|
||||
|
||||
public string $logo = 'home.php?m=dashboard&p=dashboard';
|
||||
public string $bg_wrapper = '';
|
||||
public string $charset = 'utf-8';
|
||||
public string $time_zone = 'America/Chicago';
|
||||
|
||||
function __construct() {
|
||||
ob_start();
|
||||
$this->logo = "home.php?m=dashboard&p=dashboard";
|
||||
$this->bg_wrapper = "";
|
||||
$this->title = "Open Game Panel";
|
||||
$this->charset = "utf-8";
|
||||
$this->refreshTime = DEFAULT_REFRESH_TIME;
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
|
||||
}
|
||||
|
||||
function menu(){}
|
||||
|
||||
function menu(){}
|
||||
|
||||
function printView($cleared = false, $dataType = "html") {
|
||||
global $db, $OGPLangPre;
|
||||
|
||||
|
|
@ -134,9 +136,9 @@ class OGPView {
|
|||
{
|
||||
$global_js_file = 'js/' . MODULES . "{$m['folder']}_global.js";
|
||||
if(is_readable($path . $global_js_file)) // Priority to the theme's js
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"${path}${global_js_file}\"></script>\n";
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"{$path}{$global_js_file}\"></script>\n";
|
||||
elseif(is_readable($global_js_file))
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"${global_js_file}\"></script>\n";
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"{$global_js_file}\"></script>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,15 +147,15 @@ class OGPView {
|
|||
{
|
||||
$subpage = (isset($_GET['p']) and !empty($_GET['p']))?$_GET['p']:$_GET['m'];
|
||||
$fc = array(
|
||||
$path . MODULES . "{$_GET['m']}/${subpage}.css",
|
||||
$path . MODULES . "{$_GET['m']}/{$subpage}.css",
|
||||
$path . MODULES . "{$_GET['m']}/{$_GET['m']}.css",
|
||||
MODULES . "{$_GET['m']}/${subpage}.css",
|
||||
MODULES . "{$_GET['m']}/{$subpage}.css",
|
||||
MODULES . "{$_GET['m']}/{$_GET['m']}.css"
|
||||
);
|
||||
|
||||
foreach ((array)$fc as $file_check){
|
||||
if(is_readable($file_check)){
|
||||
$stylesheet .= "<link rel=\"stylesheet\" href=\"${file_check}\">\n";
|
||||
$stylesheet .= "<link rel=\"stylesheet\" href=\"{$file_check}\">\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -165,7 +167,7 @@ class OGPView {
|
|||
|
||||
foreach ((array)$fc as $file_check){
|
||||
if(is_readable($file_check)){
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"${file_check}\"></script>\n";
|
||||
$javascript .= "<script type=\"text/javascript\" src=\"{$file_check}\"></script>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue