From 0f9bc55be42f9851cc87a06f3971c853a83425a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 5 Jul 2010 08:47:20 +0000 Subject: [PATCH] More cached wrapper functions introduced --- inc/libs/active_functions.php | 2 +- inc/libs/register_functions.php | 2 +- inc/modules/admin/what-config_points.php | 6 +-- inc/modules/guest/what-confirm.php | 2 +- inc/modules/member/what-primera.php | 2 +- inc/modules/member/what-wernis.php | 2 +- inc/mysql-manager.php | 2 +- inc/wrapper-functions.php | 48 ++++++++++++++++++++++++ 8 files changed, 57 insertions(+), 9 deletions(-) diff --git a/inc/libs/active_functions.php b/inc/libs/active_functions.php index 302480e265..97390364d6 100644 --- a/inc/libs/active_functions.php +++ b/inc/libs/active_functions.php @@ -48,7 +48,7 @@ function FILTER_ADD_LINK_ACTIVE_LIST () { if ((isExtensionActive('active')) && (isExtensionActive('online'))) { // Init fake-content because there is no `what`='active' in database $content = array( - 'menu' => '{%config=menu_blur_spacer%}{--GUEST_ACTIVE_LINK--}', + 'menu' => '{?menu_blur_spacer?}{--GUEST_ACTIVE_LINK--}', 'what' => 'active', 'visible' => 'Y', 'locked' => 'N' diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 665a4b7873..29a476ac23 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -377,7 +377,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF // Write his welcome-points // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable - addPointsDirectly('register_welcome', $userid, getConfig('points_register')); + addPointsDirectly('register_welcome', $userid, getPointsRegister()); // Write catgories if ((is_array(postRequestParameter('cat'))) && (count(postRequestParameter('cat')))) { diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 43e15afc41..4126c7efa9 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -53,14 +53,14 @@ if (isGetRequestParameterSet('sub')) { // Yes, then do some sanity-checks switch (getRequestParameter('sub')) { case 'points': - if ((!isPostRequestParameterSet(('points_register'))) || (!isPostRequestParameterSet(('points_ref')))) { + if ((!isPostRequestParameterSet('points_register')) || (!isPostRequestParameterSet('points_ref'))) { unsetPostRequestParameter('ok'); - } + } // END - if break; case 'ref': if (isGetRequestParameterSet('do')) { - if (((!isPostRequestParameterSet(('level'))) || (!isPostRequestParameterSet(('percents')))) && (getRequestParameter('do') == 'add')) { + if (((!isPostRequestParameterSet('level')) || (!isPostRequestParameterSet('percents'))) && (getRequestParameter('do') == 'add')) { unsetPostRequestParameter('ok'); } } diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index 2a75a7d2f0..569f4d4e0a 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -119,7 +119,7 @@ LIMIT 1", // Add one-time referal bonus over referal system or directly // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); - addPointsThroughReferalSystem('referal_bonus', $refid, getConfig('points_ref'), true, bigintval($userid), $locked, getConfig('reg_points_mode')); + addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), $locked, getConfig('reg_points_mode')); } // END - if } // END - if diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index a683c4777e..f38dfd5b9b 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -106,7 +106,7 @@ if (getRequestParameter('mode') == 'pay') { $points = bigintval($points[0]); // Remove the registration fee - $points = $points - getConfig('points_register'); + $points = $points - getPointsRegister(); // Is this enougth for a payout? if ($points < getConfig('primera_min_payout')) { diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index 8cd3a295f5..3e3189811f 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -120,7 +120,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points'); // Remove the registration fee - $points = $points - getConfig('points_register'); + $points = $points - getPointsRegister(); // Is there a percentage or fixed fee? $points = WERNIS_TAKE_FEE($points, 'payout'); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 105ea2961e..571697aabd 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -266,7 +266,7 @@ ORDER BY } // Menu title - $OUT .= getConfig('menu_blur_spacer') . $content['sub_title']; + $OUT .= '{?menu_blur_spacer?}' . $content['sub_title']; if (isIncludeReadable($inc)) { $OUT .= ''; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 748a49a34a..770c266eba 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1646,6 +1646,18 @@ function getCopy () { return $GLOBALS['copy']; } +// "Getter" for webmaster +function getWebmaster () { + // Do we have cache? + if (!isset($GLOBALS['webmaster'])) { + // Determine it + $GLOBALS['webmaster'] = getConfig('WEBMASTER'); + } // END - if + + // Return cache + return $GLOBALS['webmaster']; +} + // "Getter" for sql_count function getSqlCount () { // Do we have cache? @@ -1682,6 +1694,42 @@ function getDnsCacheTimeout () { return $GLOBALS['dns_cache_timeout']; } +// "Getter" for menu_blur_spacer +function getMenuBlurSpacer () { + // Do we have cache? + if (!isset($GLOBALS['menu_blur_spacer'])) { + // Determine it + $GLOBALS['menu_blur_spacer'] = getConfig('menu_blur_spacer'); + } // END - if + + // Return cache + return $GLOBALS['menu_blur_spacer']; +} + +// "Getter" for points_register +function getPointsRegister () { + // Do we have cache? + if (!isset($GLOBALS['points_register'])) { + // Determine it + $GLOBALS['points_register'] = getConfig('points_register'); + } // END - if + + // Return cache + return $GLOBALS['points_register']; +} + +// "Getter" for points_ref +function getPointsRef () { + // Do we have cache? + if (!isset($GLOBALS['points_ref'])) { + // Determine it + $GLOBALS['points_ref'] = getConfig('points_ref'); + } // END - if + + // Return cache + return $GLOBALS['points_ref']; +} + // Checks wether proxy configuration is used function isProxyUsed () { // Do we have cache? -- 2.39.5