From 8cf27a4147da16cabc4917f313235021cf4c4e01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 11 Mar 2010 12:23:46 +0000 Subject: [PATCH] Yet another wrapper function 'cached' --- inc/functions.php | 5 +++-- inc/wrapper-functions.php | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index d45f5e5663..9a1f4e1cd9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2721,11 +2721,12 @@ function isUrlValidSimple ($url) { $pattern['d1g12'] = $http . $domain1 . $getstring1; $pattern['d2g12'] = $http . $domain2 . $getstring1; $pattern['ipg12'] = $http . $ip . $getstring1; + // Test all patterns $reg = false; foreach ($pattern as $key => $pat) { // Debug regex? - if (isDebugRegExpressionEnabled()) { + if (isDebugRegularExpressionEnabled()) { // @TODO Are these convertions still required? $pat = str_replace('.', "\.", $pat); $pat = str_replace('@', "\@", $pat); @@ -2733,7 +2734,7 @@ function isUrlValidSimple ($url) { } // END - if // Check if expression matches - $reg = ($reg || preg_match(('^' . $pat.'^'), $url)); + $reg = ($reg || preg_match(('^' . $pat . '^'), $url)); // Does it match? if ($reg === true) break; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c81d9d09d3..e7ef273e79 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -356,11 +356,18 @@ function isDebugModeEnabled () { // Checks wether SQL debugging is enabled function isSqlDebuggingEnabled () { - return ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + // Is cache set? + if (!isset($GLOBALS['is_sql_debug_enabled'])) { + // Determine if SQL debugging is enabled + $GLOBALS['is_sql_debug_enabled'] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_sql_debug_enabled']; } // Checks wether we shall debug regular expressions -function isDebugRegExpressionEnabled () { +function isDebugRegularExpressionEnabled () { // Simply check it return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y')); } -- 2.30.2