X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=31c5e3eea50803a77b2a133e083bba972510f90c;hb=d7d40e177e09a7161b79bfc95a1d2e91fdff4691;hp=1593901d6a293938a3a367b21c3906357b164cd4;hpb=be0b83c7b9a7a8cf91ef6799bede2d49cfa5a131;p=mailer.git diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 1593901d6a..31c5e3eea5 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -389,10 +389,28 @@ function isHourlyResetEnabled () { return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === TRUE)); } -// Checks whether the reset mode is active +// Checks whether the daily reset mode is active +function isDailyResetEnabled () { + // Now simply check it + return ((isset($GLOBALS['daily_enabled'])) && ($GLOBALS['daily_enabled'] === TRUE)); +} + +// Checks whether the weekly reset mode is active +function isWeeklyResetEnabled () { + // Now simply check it + return ((isset($GLOBALS['weekly_enabled'])) && ($GLOBALS['weekly_enabled'] === TRUE)); +} + +// Checks whether the monthly reset mode is active +function isMonthlyResetEnabled () { + // Now simply check it + return ((isset($GLOBALS['monthly_enabled'])) && ($GLOBALS['monthly_enabled'] === TRUE)); +} + +// Checks whether one of the reset modes is enabled function isResetModeEnabled () { // Now simply check it - return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === TRUE)); + return ((isHourlyResetEnabled()) || (isDailyResetEnabled()) || (isWeeklyResetEnabled()) || (isMonthlyResetEnabled())); } // Checks whether the debug mode is enabled @@ -407,12 +425,48 @@ function isDebugModeEnabled () { return $GLOBALS[__FUNCTION__]; } -// Checks whether the debug reset is enabled -function isDebugResetEnabled () { +// Checks whether the debug hourly is enabled +function isDebugHourlyEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it - $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y')); + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_HOURLY')) && (getConfig('DEBUG_HOURLY') == 'Y')); + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + +// Checks whether the debug daily is enabled +function isDebugDailyEnabled () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Simply check it + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_DAILY')) && (getConfig('DEBUG_DAILY') == 'Y')); + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + +// Checks whether the debug weekly is enabled +function isDebugWeeklyEnabled () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Simply check it + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y')); + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + +// Checks whether the debug monthly is enabled +function isDebugMonthlyEnabled () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Simply check it + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y')); } // END - if // Return it @@ -1565,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 @@ -1596,12 +1650,24 @@ function isWhatTitleEnabled () { 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__]; +} + // Checks whether stats are enabled function ifInternalStatsEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { - // Then determine it - $GLOBALS[__FUNCTION__] = (getConfig('internal_stats') == 'Y'); + // Then determine it, do not add isExtensionInstalledAndNewer() here as it breaks very first SQL query + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('internal_stats')) && (getInternalStats() == 'Y')); } // END - if // Return cached value @@ -1613,7 +1679,7 @@ function isAdminNotificationEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = (getConfig('admin_notify') == 'Y'); + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.3.0')) && (getAdminNotify() == 'Y')); } // END - if // Return cache @@ -2159,96 +2225,96 @@ function getOneDay () { return $GLOBALS[__FUNCTION__]; } -// "Getter" for activate_xchange -function getActivateXchange () { +// "Getter" for img_type +function getImgType () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('activate_xchange'); + $GLOBALS[__FUNCTION__] = getConfig('img_type'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for img_type -function getImgType () { +// "Getter" for code_length +function getCodeLength () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('img_type'); + $GLOBALS[__FUNCTION__] = getConfig('code_length'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for code_length -function getCodeLength () { +// "Getter" for pass_len +function getPassLen () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('code_length'); + $GLOBALS[__FUNCTION__] = getConfig('pass_len'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for least_cats -function getLeastCats () { +// "Getter" for admin_menu +function getAdminMenu () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('least_cats'); + $GLOBALS[__FUNCTION__] = getConfig('admin_menu'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for pass_len -function getPassLen () { +// "Getter" for last_hourly +function getLastHourly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('pass_len'); + $GLOBALS[__FUNCTION__] = getConfig('last_hourly'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for admin_menu -function getAdminMenu () { +// "Getter" for last_daily +function getLastDaily () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('admin_menu'); + $GLOBALS[__FUNCTION__] = getConfig('last_daily'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for last_month -function getLastMonth () { +// "Getter" for last_weekly +function getLastWeekly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('last_month'); + $GLOBALS[__FUNCTION__] = getConfig('last_weekly'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } -// "Getter" for max_send -function getMaxSend () { +// "Getter" for last_monthly +function getLastMonthly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = getConfig('max_send'); + $GLOBALS[__FUNCTION__] = getConfig('last_monthly'); } // END - if // Return cache @@ -2459,30 +2525,6 @@ function getTitleMiddle () { return $GLOBALS[__FUNCTION__]; } -// Getter for 'check_double_email' -function getCheckDoubleEmail () { - // Is the cache entry set? - if (!isset($GLOBALS[__FUNCTION__])) { - // No, so determine it - $GLOBALS[__FUNCTION__] = getConfig('check_double_email'); - } // END - if - - // Return cached entry - return $GLOBALS[__FUNCTION__]; -} - -// Checks whether 'check_double_email' is 'Y' -function isCheckDoubleEmailEnabled () { - // Is the cache entry set? - if (!isset($GLOBALS[__FUNCTION__])) { - // No, so determine it - $GLOBALS[__FUNCTION__] = (getCheckDoubleEmail() == 'Y'); - } // END - if - - // Return cached entry - return $GLOBALS[__FUNCTION__]; -} - // Getter for 'display_home_in_index' function getDisplayHomeInIndex () { // Is the cache entry set? @@ -2804,18 +2846,6 @@ function getUserUsedPoints ($userid) { return $GLOBALS[__FUNCTION__][$userid]; } -// Wrapper to check if url_blacklist is enabled -function isUrlBlacklistEnabled () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = (getConfig('url_blacklist') == 'Y'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - // Checks whether direct payment is allowed in configuration function isDirectPaymentEnabled () { // Is there cache? @@ -3301,24 +3331,24 @@ function getUsersTotalLockedReferrals ($userid, $level = NULL) { // Is the not level NULL? if (!is_null($level)) { // Then add referral level - $add = ' AND r.`level`=' . bigintval($level); + $add = ' AND `r`.`level`=' . bigintval($level); } // END - if // Check for all referrals $result = SQL_QUERY_ESC("SELECT - COUNT(d.`userid`) AS `cnt` + COUNT(`d`.`userid`) AS `cnt` FROM - `{?_MYSQL_PREFIX?}_user_data` AS d + `{?_MYSQL_PREFIX?}_user_data` AS `d` INNER JOIN - `{?_MYSQL_PREFIX?}_user_refs` AS r + `{?_MYSQL_PREFIX?}_user_refs` AS `r` ON - d.`userid`=r.`refid` + `d`.`userid`=`r`.`refid` WHERE - d.`status` != 'CONFIRMED' AND - r.`userid`=%s + `d`.`status` != 'CONFIRMED' AND + `r`.`userid`=%s " . $add . " ORDER BY - d.`userid` ASC + `d`.`userid` ASC LIMIT 1", array( $userid @@ -3418,7 +3448,7 @@ function padLeftZero ($str, $amount = 2) { return prependZeros($str, $amount); } else { // Pad it - return str_pad($str, $amount, '0', STR_PAD_LEFT) + return str_pad($str, $amount, '0', STR_PAD_LEFT); } }