From: Roland Häder Date: Sat, 10 Nov 2012 14:37:24 +0000 (+0000) Subject: Minor cleanups X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c5e4e7531db6a636c66ba2e672b832f9a13be648;p=mailer.git Minor cleanups --- diff --git a/beg.php b/beg.php index ba9bc75965..bd6e262d5c 100644 --- a/beg.php +++ b/beg.php @@ -61,7 +61,7 @@ if (isGetRequestElementSet('userid')) { $points = '0'; // Don't pay is the default... - $pay = FALSE; + $isPayed = FALSE; // Validate if it is not a number if ((isExtensionActive('nickname')) && (isNicknameUsed(getRequestElement('userid')))) { @@ -113,7 +113,7 @@ if (isGetRequestElementSet('userid')) { //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'SQL_HASZERONUMS()=' . intval(SQL_HASZERONUMS($result)) . ',isAdmin()=' . intval(isAdmin()) . ',points=' . $points . ',isMember()=' . intval(isMember()) . ',getBegPayMode()=' . getBegPayMode()); if ((SQL_HASZERONUMS($result)) && ($points > 0) && (getBegPayMode() == 'NONE') && ((!isMember()) || (isAdmin()))) { // Default is result from isAdmin(), mostly false - $pay = isAdmin(); + $isPayed = isAdmin(); // Admin is testing? if (!isAdmin()) { @@ -130,12 +130,12 @@ if (isGetRequestElementSet('userid')) { ), __FILE__, __LINE__); // Was is successfull? - $pay = (!SQL_HASZEROAFFECTED()); + $isPayed = (!SQL_HASZEROAFFECTED()); } // END - if // Pay points? - //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'pay=' . intval($pay)); - if ($pay === TRUE) { + //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'isPayed=' . intval($isPayed)); + if ($isPayed === TRUE) { // Add points to user or begging rallye account if (addPointsBeg(getUserData('userid'), $points)) { // Set 'done' message @@ -154,7 +154,7 @@ if (isGetRequestElementSet('userid')) { } elseif (getBegPayMode() != 'NONE') { // Other pay-mode active! // Load message template depending on pay-mode $content['message'] = loadTemplate('beg_pay_mode_' . strtolower(getBegPayMode()), TRUE, $content); - $pay = TRUE; + $isPayed = TRUE; } else { // Clicked received while reload lock is active $content['message'] = loadTemplate('beg_failed', TRUE, $content); @@ -170,7 +170,7 @@ if (isGetRequestElementSet('userid')) { loadTemplate('beg_link', FALSE, $content); // Tracker code enabled? (We don't track users here! - if ((getBegPayMode() != 'NONE') && ($pay === TRUE)) { + if ((getBegPayMode() != 'NONE') && ($isPayed === TRUE)) { // Prepare content for template // @TODO Opps, what is missing here??? $content = array( @@ -178,7 +178,7 @@ if (isGetRequestElementSet('userid')) { // Include config-depending template loadTemplate('beg_pay_code_' . strtolower(getBegPayMode()), FALSE, $content); - } elseif (($pay === FALSE) && (!isset($content['message']))) { + } elseif (($isPayed === FALSE) && (!isset($content['message']))) { // Cannot pay! :-( $content['message'] = loadTemplate('beg_failed', TRUE); } diff --git a/inc/expression-functions.php b/inc/expression-functions.php index 4b64265df5..3e8da702f9 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { // Private function to replace the code function replaceExpressionCode ($data, $replacer) { // Replace the code - // @TODO is escapeQuotes() enougth for strings with single/double quotes? + // @TODO is escapeQuotes() enough for strings with single/double quotes? return str_replace($data['matches'][0][$data['key']], $replacer, escapeQuotes($data['code'])); } @@ -79,8 +79,8 @@ function isExpressionFunctionAvaiable ($data) { // And cache it $GLOBALS['expression_function_available'][$entry] = FALSE; } - } elseif ($GLOBALS['expression_function_available'][$entry] == FALSE) { - // Debug message + } elseif (($GLOBALS['expression_function_available'][$entry] == FALSE) && (isDebugModeEnabled())) { + // Debug message in debug mode logDebugMessage(__FUNCTION__, __LINE__, 'Expression function for entry ' . $entry . ' requested but does not exist.'); } @@ -91,7 +91,7 @@ function isExpressionFunctionAvaiable ($data) { // Getter for above expression function function getExpressionFunction ($data) { // Get the enty we need - $entry = $data['matches'][4][$data['key']]; + $entry = trim($data['matches'][4][$data['key']]); // Return it return $GLOBALS['expression_function_name'][$entry]; diff --git a/inc/libs/autopurge_functions.php b/inc/libs/autopurge_functions.php index 769099587e..a8ecdd1771 100644 --- a/inc/libs/autopurge_functions.php +++ b/inc/libs/autopurge_functions.php @@ -57,6 +57,10 @@ function addPointsAutoPurge ($userid, $points) { sendEmail($userid, '{--MEMBER_AUTOPURGE_SUBJECT--}', $message); } +// ---------------------------------------------------------------------------- +// Wrapper for configuration entries +// ---------------------------------------------------------------------------- + // Checks whether auto-purging is enabled function isAutoPurgingActive () { // Is there cache? @@ -93,5 +97,53 @@ function isAutopurgeInactiveEnabled () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for ap_inactive_time +function getApInactiveTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_dm_timeout +function getApDmTimeout () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_dm_timeout'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_tasks_time +function getApTasksTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_tasks_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_unconfirmed_time +function getApUnconfirmedTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_unconfirmed_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/modules/admin/action-coupon.php b/inc/modules/admin/action-coupon.php index f1e3e3c4dd..64c95d2ace 100644 --- a/inc/modules/admin/action-coupon.php +++ b/inc/modules/admin/action-coupon.php @@ -45,7 +45,7 @@ addYouAreHereLink('admin', __FILE__); // Load the include file $inc = sprintf("inc/modules/admin/what-%s.php", getWhat()); -if (isIncludeReadable($inc)) { +if (isIncludeReadable($inc)) { // Ok, we finally load the admin action module loadIncludeOnce($inc); } else { diff --git a/inc/modules/admin/action-grade.php b/inc/modules/admin/action-grade.php index 45a247b715..662dfcb62e 100644 --- a/inc/modules/admin/action-grade.php +++ b/inc/modules/admin/action-grade.php @@ -45,7 +45,7 @@ addYouAreHereLink('admin', __FILE__); // Load the include file $inc = sprintf("inc/modules/admin/what-%s.php", getWhat()); -if (isIncludeReadable($inc)) { +if (isIncludeReadable($inc)) { // Ok, we finally load the admin action module loadIncludeOnce($inc); } else { diff --git a/inc/modules/admin/action-network.php b/inc/modules/admin/action-network.php index 9470c94373..07d25d9bba 100644 --- a/inc/modules/admin/action-network.php +++ b/inc/modules/admin/action-network.php @@ -45,7 +45,7 @@ addYouAreHereLink('admin', __FILE__); // Load the include file $inc = sprintf("inc/modules/admin/what-%s.php", getWhat()); -if (isIncludeReadable($inc)) { +if (isIncludeReadable($inc)) { // Ok, we finally load the admin action module loadIncludeOnce($inc); } else { diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index ba56fb2c8e..d8f3143357 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1946,79 +1946,6 @@ function getUserMinConfirmed () { // Return cache return $GLOBALS[__FUNCTION__]; } - -// "Getter" for auto_purge -function getAutoPurge () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('auto_purge'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for bonus_userid -function getBonusUserid () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('bonus_userid'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for ap_inactive_time -function getApInactiveTime () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_time'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for ap_dm_timeout -function getApDmTimeout () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('ap_dm_timeout'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for ap_tasks_time -function getApTasksTime () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('ap_tasks_time'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for ap_unconfirmed_time -function getApUnconfirmedTime () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('ap_unconfirmed_time'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - // "Getter" for points function getPoints () { // Is there cache? diff --git a/mailid.php b/mailid.php index 784bd996b4..976d4d98c7 100644 --- a/mailid.php +++ b/mailid.php @@ -182,7 +182,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr // Was that mail a valid one? if ($isValid === TRUE) { // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems - if (($time == '0') && ($payment > 0)) { + if (($time == '0') && ($payment > 0)) { $url = getUrl(); $time = 1; } // END - if