From 3129899ab904d5f2f2dbeb5800477759b5204b7c Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Tue, 10 Sep 2019 12:45:26 -0400 Subject: [PATCH] Added code to only show debug status when not an AJAX call. --- defines.php | 2 +- index.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/defines.php b/defines.php index 6661ba5..46361b6 100755 --- a/defines.php +++ b/defines.php @@ -6,7 +6,7 @@ */ // Set to true to add more debug messages to the error log -define('GLM_SERVERSTATS_PLUGIN_DEBUG', false); +define('GLM_SERVERSTATS_PLUGIN_DEBUG', true); // Database Connection define('GLM_SERVERSTATS_DATABASE_NAME', 'bandwidth'); diff --git a/index.php b/index.php index 4dfc05b..4ba66b6 100755 --- a/index.php +++ b/index.php @@ -194,7 +194,7 @@ if ($websiteSettings['show_cookie_popup'] && !is_admin()) { */ function glmServerStatsAjax() { - + $glmAjaxActionCalled = true; $glmAction = false; // Get the requested model @@ -204,7 +204,7 @@ function glmServerStatsAjax() // Call controller to handle AJAX request - Ajax models should not return to controller if ($glmAction && $glmAction != '') { - serverStatsController($glmAction); + serverStatsController($glmAction, true); } } @@ -217,7 +217,7 @@ function glmServerStatsAjax() * model and the view. * */ -function serverStatsController($model) +function serverStatsController($model, $isAjax = false) { if (GLM_SERVERSTATS_PLUGIN_DEBUG) { @@ -225,6 +225,10 @@ function serverStatsController($model) trigger_error("GLM Usage Controller Start: Model = $model", E_USER_NOTICE ); } + if (GLM_SERVERSTATS_PLUGIN_DEBUG && !$isAjax) { + trigger_error("GLM Usage Plugin Debug Enabled: *** Turn off for production *** - See defines.php", E_USER_NOTICE ); + } + // Enque admin scripts and css here so that only happens when we're doing something glmServerJqueryScipts(); glmServerStatsScripts(); -- 2.17.1