From 4418d7cfabd34a285cc5ff3638e3ba05d8afd16b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 23 Jan 2013 14:31:38 +0000 Subject: [PATCH] Introduced (means, being added and then used) more wrappers for ext-order/other --- inc/libs/order_functions.php | 62 ++++++++++++++++++++++++++++++- inc/libs/other_functions.php | 36 ++++++++++++++++++ inc/modules/member/what-order.php | 6 +-- inc/wrapper-functions.php | 6 +-- 4 files changed, 103 insertions(+), 7 deletions(-) diff --git a/inc/libs/order_functions.php b/inc/libs/order_functions.php index cbdff252a2..5c35c7885c 100644 --- a/inc/libs/order_functions.php +++ b/inc/libs/order_functions.php @@ -167,7 +167,7 @@ function getMaxUnconfirmed () { } // Getter for 'max_text_length' config entry -function getMaxTextLenngth () { +function getMaxTextLength () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it @@ -178,5 +178,65 @@ function getMaxTextLenngth () { return $GLOBALS[__FUNCTION__]; } +// Getter for 'order_min' config entry +function getOrderMin () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('order_min'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Getter for 'allow_url_in_text' config entry +function getAllowUrlInText () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('allow_url_in_text'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Determines whether 'allow_url_in_text' is set to 'Y' +function isAllowUrlInTextEnabled () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getAllowUrlInText() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Getter for 'allow_url_in_subject' config entry +function getAllowUrlInSubject () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('allow_url_in_subject'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Determines whether 'allow_url_in_subject' is set to 'Y' +function isAllowUrlInSubjectEnabled () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getAllowUrlInSubject() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/libs/other_functions.php b/inc/libs/other_functions.php index 1aba657195..a2b9fffed7 100644 --- a/inc/libs/other_functions.php +++ b/inc/libs/other_functions.php @@ -124,5 +124,41 @@ function getActivateXchange () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for admin_notify +function getAdminNotify () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('admin_notify'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for internal_stats +function getInternalStats () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('internal_stats'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for display_debug_sqls +function getDisplayDebugSqls () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('display_debug_sqls'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index a084b89e4a..f0d56c922a 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -100,7 +100,7 @@ LIMIT 1", * and check the text and subject against some filters */ $data['url'] = ''; - if (getConfig('allow_url_in_text') == 'Y') { + if (!isAllowUrlInTextEnabled()) { // Test submitted text against some filters (length, URLs in text etc.) if ((isInStringIgnoreCase('https://', postRequestElement('text'))) || (isInStringIgnoreCase('http://', postRequestElement('text'))) || (isInStringIgnoreCase('www', postRequestElement('text')))) { // URL found @@ -118,7 +118,7 @@ LIMIT 1", } // END - if // Shall I test the subject line against URLs? - if (getConfig('allow_url_in_subject') == 'Y') { + if (!isAllowUrlInSubjectEnabled()) { // Check the subject line for issues setPostRequestElement('subject', str_replace(chr(92), '[nl]', substr(postRequestElement('subject'), 0, 200))); if ((isInStringIgnoreCase('https://', postRequestElement('subject'))) || (isInStringIgnoreCase('http://', postRequestElement('subject'))) || (isInStringIgnoreCase('www', postRequestElement('subject')))) { @@ -134,7 +134,7 @@ LIMIT 1", } // END - if // Enougth receivers entered? - if ((postRequestElement('receiver') < getConfig('order_min')) && (!isAdmin())) { + if ((postRequestElement('receiver') < getOrderMin()) && (!isAdmin())) { // Less than allowed receivers entered! $data['url'] = 'modules.php?module=login&what=order&code=' . getCode('MORE_RECEIVERS3'); } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 6e41821cd2..e3f992d0be 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1619,7 +1619,7 @@ function isDisplayDebugSqlEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y')); + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getDisplayDebugSqls() == 'Y')); } // END - if // Return cache @@ -1655,7 +1655,7 @@ function ifInternalStatsEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Then determine it - $GLOBALS[__FUNCTION__] = (getConfig('internal_stats') == 'Y'); + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.2.6')) && (getInternalStats() == 'Y')); } // END - if // Return cached value @@ -1667,7 +1667,7 @@ function isAdminNotificationEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.3.0')) && (getConfig('admin_notify') == 'Y')); + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.3.0')) && (getAdminNotify() == 'Y')); } // END - if // Return cache -- 2.39.5