From: Roland Häder Date: Thu, 30 May 2013 18:48:00 +0000 (+0000) Subject: Fixes + asserts X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=175b3f506e193d8d791ec6523db42276e296dd0b Fixes + asserts --- diff --git a/ajax.php b/ajax.php index 518c2c2512..f0a04892ee 100644 --- a/ajax.php +++ b/ajax.php @@ -68,7 +68,7 @@ loadIncludeOnce('inc/header.php'); // Process only POST requests and that at least 'level' is set if ((getHttpRequestMethod() == 'POST') && (isPostRequestElementSet('level'))) { // Okay, that is valid, now check that the requested level right is valid - if (isAjaxRequestLevelValid()) { + if (isValidAjaxRequestLevel()) { // Process the request processAjaxRequest(); diff --git a/beg.php b/beg.php index 81cb992df9..e9877f9699 100644 --- a/beg.php +++ b/beg.php @@ -79,7 +79,7 @@ if (isGetRequestElementSet('userid')) { $status = 'failed'; // Check if account was found - if ((isUserDataValid()) && (getUserData('status') == 'CONFIRMED')) { + if ((isValidUserData()) && (getUserData('status') == 'CONFIRMED')) { /* * Multiply configured values with 100000 and divide with 100000 so we can also handle small values * If we need more number behind the decimal dot then we just need to increase all these three diff --git a/doubler.php b/doubler.php index 5d4c3ce092..46f16f9122 100644 --- a/doubler.php +++ b/doubler.php @@ -76,7 +76,7 @@ if (isFormSent()) { } // Is the data valid? - if (!isUserDataValid()) { + if (!isValidUserData()) { // Output message that the userid is not okay displayMessage('{--DOUBLER_USERID_INVALID--}'); } // END - if @@ -88,7 +88,7 @@ if (isFormSent()) { $probe_points = ((postRequestElement('points') >= getDoublerMin()) && (postRequestElement('points') <= getDoublerMax())); // Check all together - if ((isUserDataValid()) && (getUserData('password') == generateHash(postRequestElement('password'), substr(getUserData('password'), 0, -40))) && (getUserData('status') == 'CONFIRMED') && ($probe_points)) { + if ((isValidUserData()) && (getUserData('password') == generateHash(postRequestElement('password'), substr(getUserData('password'), 0, -40))) && (getUserData('status') == 'CONFIRMED') && ($probe_points)) { // Nickname resolved to a unique userid or direct userid entered by the member $GLOBALS['local_doubler_userid'] = getUserData('userid'); @@ -179,7 +179,7 @@ if (getDoublerSendMode() == 'DIRECT') { // Output header loadIncludeOnce('inc/header.php'); -if (isUserDataValid()) { +if (isValidUserData()) { // Transfer userid/nickname to constant $content['refid'] = getUserData('userid'); } else { diff --git a/inc/ajax-functions.php b/inc/ajax-functions.php index 35cb192c65..d3736e0f03 100644 --- a/inc/ajax-functions.php +++ b/inc/ajax-functions.php @@ -80,7 +80,7 @@ function setAjaxReplyContent ($content) { * Checks whether the AJAX access level was valid. This function doesn't need * caching in $GLOBALS[__FUNCTION__] because it will be called only once. */ -function isAjaxRequestLevelValid () { +function isValidAjaxRequestLevel () { // By default nothing is valid $isValid = FALSE; diff --git a/inc/expression-functions.php b/inc/expression-functions.php index abce20ffbe..de71466a02 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -444,7 +444,7 @@ function doExpressionForm ($data) { if ($value == 'formmethodpost') { // Use it $data['__form_method'] = 'post'; - } elseif (($value == 'formmethodpost') && (!isSpider()) && (!isSessionValid())) { + } elseif (($value == 'formmethodpost') && (!isSpider()) && (!isValidSession())) { // Then expand 'value' with session id if (strpos($data['value'], '?') !== FALSE) { // '?' is set diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index b7b57b30f1..caf01774d2 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -490,7 +490,7 @@ function doExtensionSqls ($ext_id, $load_mode) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQLs::count=' . countSqls()); // Are there entries? - if (isSqlsValid()) { + if (ifSqlsRegistered()) { // Run SQL commands... runFilterChain('run_sqls'); } // END - if @@ -677,7 +677,7 @@ function getExtensionVersion ($ext_name, $force = FALSE) { // Count cache hits incrementStatsEntry('cache_hits'); - } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (!isHtmlOutputMode())) { + } elseif ((!isValidCacheInstance()) || (isset($GLOBALS['cache_array']['extension'])) || (!isHtmlOutputMode())) { // Load from database $result = sqlQueryEscaped("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); @@ -1920,7 +1920,7 @@ function addDropTableSql ($tableName) { // Adds a RENAME TABLE stament if 'from' table exist and 'to' table not function addRenameTableSql ($fromTable, $toTable) { // Make sure both are not the same - assert($fromTable != $toTable); + assert($fromTable != $toTable, 'fromTable must be different to toTable (' . $fromTable . ')'); // Is renaming required? if ((ifSqlTableExists($fromTable)) && (!ifSqlTableExists($toTable))) { @@ -2059,8 +2059,15 @@ function addSponsorMenuSql ($action, $what, $title, $active, $sort) { // Add ALTER TABLE `foo` ADD sql if not found function addExtensionAddTableColumnSql ($tableName, $columnName, $columnSql) { + // Assert on all + assert((!empty($tableName)) && (!empty($columnName)) && (!empty($columnSql)), 'tableName=' . $tableName . ',columnName=' . $columnName . ',columnSql=' . $columnSql); + assert($columnName != $columnSql . ',columnName=' . $columnName . ' must be non-equal to columnSql'); + // Is the column there? if (!ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $columnName, isInstaller())) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $columnName . ',columnSql=' . $columnSql); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` ADD `' . $columnName . '` ' . $columnSql); } elseif (isDebugModeEnabled()) { @@ -2071,8 +2078,15 @@ function addExtensionAddTableColumnSql ($tableName, $columnName, $columnSql) { // Add ALTER TABLE `foo` ADD INDEX sql if not found function addExtensionAddTableIndexSql ($tableName, $indexName, $columnSql) { + // Assert on all + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql)), 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + assert(($indexName != $columnSql), 'indexName=' . $indexName . ' must be unequal to columnSql'); + // Is the column there? if (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` ADD INDEX `' . $indexName . '` ' . $columnSql); } elseif (isDebugModeEnabled()) { @@ -2083,8 +2097,15 @@ function addExtensionAddTableIndexSql ($tableName, $indexName, $columnSql) { // Add ALTER TABLE `foo` ADD UNIQUE INDEX sql if not found function addExtensionAddTableUniqueSql ($tableName, $indexName, $columnSql) { + // Assert on all + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql)), 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + assert($indexName != $columnSql, 'indexName=' . $indexName . ' must be unequal to columnSql'); + // Is the column there? if (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` ADD UNIQUE INDEX `' . $indexName . '` ' . $columnSql); } elseif (isDebugModeEnabled()) { @@ -2095,8 +2116,15 @@ function addExtensionAddTableUniqueSql ($tableName, $indexName, $columnSql) { // Add ALTER TABLE `foo` ADD FULLTEXT sql if not found function addExtensionAddTableFulltextSql ($tableName, $indexName, $columnSql) { + // Assert on all + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql)), 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + assert($indexName != $columnSql, 'indexName=' . $indexName . ' must be unequal to columnSql'); + // Is the column there and MyISAM engine? (InnoDB doesn't support FULLTEXT) if ((getTableType() == 'MyISAM') && (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller()))) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',indexName=' . $indexName . ',columnSql=' . $columnSql); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` ADD FULLTEXT `' . $indexName . '` ' . $columnSql); } elseif (isDebugModeEnabled()) { @@ -2107,8 +2135,15 @@ function addExtensionAddTableFulltextSql ($tableName, $indexName, $columnSql) { // Add ALTER TABLE `foo` CHANGE sql if not found function addExtensionChangeTableColumnSql ($tableName, $fromColumnName, $toColumnName, $columnSql) { + // Assert on all + assert((!empty($tableName)) && (!empty($fromColumnName)) && (!empty($toColumnName)) && (!empty($columnSql)), 'tableName=' . $tableName . ',fromColumnName=' . $fromColumnName . ',toColumnName=' . $toColumnName . ',columnSql=' . $columnSql . ' must not be empty.'); + assert(($fromColumnName != $columnSql) && ($toColumnName != $columnSql), 'tableName=' . $tableName . ',fromColumnName=' . $fromColumnName . ',toColumnName=' . $toColumnName . ',columnSql=' . $columnSql . ' must not be equal.'); + // Is the column there? if ((ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $fromColumnName)) && (($fromColumnName == $toColumnName) || (!ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $toColumnName, isInstaller())))) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',fromColumnName=' . $fromColumnName . ',toColumnName=' . $toColumnName . ',columnSql=' . $columnSql); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` CHANGE `' . $fromColumnName . '` `' . $toColumnName . '` ' . $columnSql); } elseif (isDebugModeEnabled()) { @@ -2119,8 +2154,14 @@ function addExtensionChangeTableColumnSql ($tableName, $fromColumnName, $toColum // Add ALTER TABLE `foo` DROP sql if not found function addExtensionDropTableColumnSql ($tableName, $columnName) { + // Assert on all + assert((!empty($tableName)) && (!empty($columnName)), 'tableName=' . $tableName . ',columnName=' . $columnName . ' must not be empty.'); + // Is the column there? if (ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $columnName, isInstaller())) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $columnName); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` DROP `' . $columnName . '`'); } elseif (isDebugModeEnabled()) { @@ -2131,8 +2172,14 @@ function addExtensionDropTableColumnSql ($tableName, $columnName) { // Add ALTER TABLE `foo` DROP INDEX sql if not found function addExtensionDropTableIndexSql ($tableName, $indexName) { + // Assert on all + assert((!empty($tableName)) && (!empty($indexName)) . ',tableName=' . $tableName . ',indexName=' . $indexName . ' must not be empty.'); + // Is the column there? if (ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',indexName=' . $indexName); + // Then add it addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` DROP INDEX `' . $indexName . '`'); } elseif (isDebugModeEnabled()) { @@ -2164,6 +2211,10 @@ function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) { * extension registration queue. */ function registerExtensionPointsData ($subject, $columnName, $lockedMode, $paymentMethod) { + // Assert on all + assert((!empty($subject)) && (!empty($columnName)) && (!empty($lockedMode)) && (!empty($paymentMethod)), ',subject=' . $subject . ',columnName=' . $columnName . ',lockedMode=' . $lockedMode . ',paymentMethod=' . $paymentMethod . ' must not be empty.'); + assert((in_array($lockedMode, array('LOCKED', 'UNLOCKED'))) && (in_array($paymentMethod, array('DIRECT', 'REFERRAL'))), ',subject=' . $subject . ',columnName=' . $columnName . ',lockedMode=' . $lockedMode . ',paymentMethod=' . $paymentMethod . ' must be valid.'); + // Is the suffix '_ref' not set? if (!ifSubjectHasReferralSuffix($subject)) { // Register this first diff --git a/inc/extensions/bonus/mode-update.php b/inc/extensions/bonus/mode-update.php index 28985fb106..c3d58b75d9 100644 --- a/inc/extensions/bonus/mode-update.php +++ b/inc/extensions/bonus/mode-update.php @@ -130,8 +130,8 @@ INDEX `userid` (`userid`)", addExtensionChangeTableColumnSql('user_data', 'login_bonus', 'login_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); // For configuration, we need different entries - addExtensionAddTableColumnSql('user_data', 'turbo_bonus', 'turbo_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); - addExtensionAddTableColumnSql('user_data', 'login_bonus', 'login_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + addConfigChangeSql('turbo_bonus', 'turbo_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); + addConfigChangeSql('login_bonus', 'login_bonus', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("5 Nachkommastellen implementiert"); @@ -416,9 +416,9 @@ ORDER BY addConfigAddSql('bonus_new_member_notify', "ENUM('Y','N') NOT NULL DEFAULT 'N'"); addConfigAddSql('bonus_notify_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000'); addConfigAddSql('bonus_notify_wait', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 30'); - addExtensionAddTableColumnSql('user_data', 'bonus_ral_en_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); - addExtensionAddTableColumnSql('user_data', 'bonus_ral_di_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); - addExtensionAddTableColumnSql('user_data', 'bonus_ral_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionAddTableColumnSql('user_data', 'bonus_ralley_enable_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionAddTableColumnSql('user_data', 'bonus_ralley_disable_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addExtensionAddTableColumnSql('user_data', 'bonus_ralley_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Optionale automatische Benachrichtigung über aktivierte und/oder deaktivierte Aktiv-Rallye einstellbar."); @@ -509,7 +509,7 @@ ORDER BY case '0.9.2': // SQL queries for v0.9.2 addExtensionChangeTableColumnSql('user_data', 'bonus_ral_en_notify', 'bonus_ralley_enable_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); addExtensionChangeTableColumnSql('user_data', 'bonus_ral_di_notify', 'bonus_ralley_disable_notify', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); - addExtensionChangeTableColumnSql('user_data', 'bonus_ral_notify', 'bonus_rallley_notify', 'INT(20)', 'UNSIGNED NOT NULL DEFAULT 0'); + addExtensionChangeTableColumnSql('user_data', 'bonus_ral_notify', 'bonus_ralley_notify', 'INT(20)', 'UNSIGNED NOT NULL DEFAULT 0'); // Update notes setExtensionUpdateNotes("Umbenannt nach neuer Konvention (bitte Einstellungen kontrollieren)."); diff --git a/inc/filter/blacklist_filter.php b/inc/filter/blacklist_filter.php index edba5885bf..82cce253ec 100644 --- a/inc/filter/blacklist_filter.php +++ b/inc/filter/blacklist_filter.php @@ -100,7 +100,7 @@ function FILTER_CHECK_URL_BLACKLISTED ($filterData) { // Filter for logging blacklisted email addresses, is being called from above filter function FILTER_LOG_EMAIL_BLACKLISTED ($filerData) { // Make sure, that required data is there - assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'email')); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'email'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); // @TODO Insert log entry @@ -111,7 +111,7 @@ function FILTER_LOG_EMAIL_BLACKLISTED ($filerData) { // Filter for logging blacklisted IP addresses, is being called from above filter function FILTER_LOG_IP_BLACKLISTED ($filerData) { // Make sure, that required data is there - assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'ip')); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'ip'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); // @TODO Insert log entry @@ -122,7 +122,7 @@ function FILTER_LOG_IP_BLACKLISTED ($filerData) { // Filter for logging blacklisted URLs, is being called from above filter function FILTER_LOG_URL_BLACKLISTED ($filerData) { // Make sure, that required data is there - assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'url')); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'url'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); // @TODO Insert log entry diff --git a/inc/filter/cache_filter.php b/inc/filter/cache_filter.php index 02b456d555..f514142b2d 100644 --- a/inc/filter/cache_filter.php +++ b/inc/filter/cache_filter.php @@ -44,7 +44,7 @@ if (!defined('__SECURITY')) { function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($filterData) { // Return the data anyway if there is no cache extension //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - if (!isCacheInstanceValid()) { + if (!isValidCacheInstance()) { return FALSE; } // END - if @@ -63,7 +63,7 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($filterData) { function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - if (!isCacheInstanceValid()) { + if (!isValidCacheInstance()) { return FALSE; } // END - if @@ -79,7 +79,7 @@ function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($filterData) { function FILTER_CACHE_DESTROY_ALL ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - if (!isCacheInstanceValid()) { + if (!isValidCacheInstance()) { return FALSE; } // END - if @@ -97,7 +97,7 @@ function FILTER_CACHE_DESTROY_ALL ($filterData) { function FILTER_CACHE_DESTROY_FILTER ($filterData) { // Skip this step if the cache instance is not there //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - if ((!isCacheInstanceValid()) || ((isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') != 'Y'))) { + if ((!isValidCacheInstance()) || ((isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') != 'Y'))) { return FALSE; } // END - if diff --git a/inc/filter/online_filter.php b/inc/filter/online_filter.php index fca99bf04b..81bcb1f656 100644 --- a/inc/filter/online_filter.php +++ b/inc/filter/online_filter.php @@ -51,7 +51,7 @@ function FILTER_UPDATE_ONLINE_LIST ($filterData) { } // END - if // Empty session? - if (!isSessionValid()) { + if (!isValidSession()) { // This is invalid here! reportBug(__FUNCTION__, __LINE__, 'Invalid session.'); } // END - if diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index 7c731dab58..3653be3904 100644 --- a/inc/filter/user_filter.php +++ b/inc/filter/user_filter.php @@ -176,7 +176,7 @@ function FILTER_SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) { // Generic filter for updating referral counter of currently detected referral id function FILTER_GENERIC_UPDATE_USER_REFERRAL ($filterData) { // Make sure the referral id is detected - assert(isReferralIdValid()); + assert(isValidReferralId(), 'isValidReferralId()=false which is not expected.'); // Update ref counter, determineReferralId() must already be called before this filter is executed sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`={%pipe,getReferralId%} LIMIT 1', __FUNCTION__, __LINE__); @@ -188,7 +188,7 @@ function FILTER_GENERIC_UPDATE_USER_REFERRAL ($filterData) { // Filter for updating sub id records function FILTER_UPDATE_USER_SUBID ($filterData) { // Make sure the referral id is detected - assert(isReferralIdValid()); + assert(isValidReferralId(), 'isValidReferralId()=false which is not expected.'); // Get sub id and secure it $subId = sqlEscapeString(getRequestElement('subid')); diff --git a/inc/filters.php b/inc/filters.php index ceaf0e0ac9..7fba80252b 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -247,7 +247,7 @@ function FILTER_RUN_SQLS ($filterData) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Entered!'); // Is the array there? - if ((isSqlsValid()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == FALSE))) { + if ((ifSqlsRegistered()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == FALSE))) { // Run SQL commands //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.'); foreach (getSqls() as $mode => $sqls) { @@ -1442,7 +1442,7 @@ function FILTER_REDIRECT_WRONG_SERVER_NAME ($filterData) { // Filter for adding hidden session id function FILTER_ADD_INPUT_HIDDEN_SESSION_ID ($filterData) { // Is a spider detected? - if ((!isSpider()) && (!isSessionValid()) && ($filterData['__form_method'] == 'get')) { + if ((!isSpider()) && (!isValidSession()) && ($filterData['__form_method'] == 'get')) { // No, then add the hidden field $filterData['__replacer'] .= ''; } // END - if diff --git a/inc/functions.php b/inc/functions.php index b9c3f1f699..561bbdadf5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -95,7 +95,7 @@ function generatePassword ($length = '0', $exclude = array()) { $localAbc = array_diff($GLOBALS['_abc'], $exclude); // $localAbc must have at least 10 entries - assert(count($localAbc) >= 10); + assert(count($localAbc) >= 10, 'localAbc()=' . count($localAbc) . ' is to small.'); // Start creating password $password = ''; @@ -1412,7 +1412,7 @@ function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $u } // END - if // Make sure entries is not bool, then something went wrong - assert(!is_bool($entries)); + assert(!is_bool($entries), 'entries[]=bool which is not expected.'); } elseif (!empty($filterFunctions[$search])) { // Debug mode enabled? if (isDebugModeEnabled()) { @@ -1430,7 +1430,7 @@ function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $u } // END - if // Make sure entries is not bool, then something went wrong - assert(!is_bool($entries)); + assert(!is_bool($entries), 'entries[]=bool which is not expected.'); } // Return value @@ -1530,7 +1530,7 @@ function rebuildCache ($cache, $inc = '', $force = FALSE) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("cache=%s, inc=%s, force=%s", $cache, $inc, intval($force))); // Shall I remove the cache file? - if ((isExtensionInstalled('cache')) && (isCacheInstanceValid()) && (isHtmlOutputMode())) { + if ((isExtensionInstalled('cache')) && (isValidCacheInstance()) && (isHtmlOutputMode())) { // Rebuild cache only in HTML output-mode // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal. if ($GLOBALS['cache_instance']->loadCacheFile($cache)) { @@ -1541,7 +1541,7 @@ function rebuildCache ($cache, $inc = '', $force = FALSE) { // Include file given? if (!empty($inc)) { // Construct FQFN - $inc = sprintf("inc/loader/load-%s.php", $inc); + $inc = sprintf('inc/loader/load-%s.php', $inc); // Is the include there? if (isIncludeReadable($inc)) { @@ -2042,7 +2042,7 @@ function encodeUrl ($url, $outputMode = '0') { } // END - if // Is there a valid session? - if ((!isSessionValid()) && (!isSpider())) { + if ((!isValidSession()) && (!isSpider())) { // Determine right separator $separator = '&'; if (!isInString('?', $url)) { @@ -2526,7 +2526,7 @@ function memberEditEntriesConfirm ($tableName, $columns = array(), $filterFuncti // Delete rows by given id numbers function memberDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array(), $content = array()) { // Do this only for members - assert(isMember()); + assert(isMember(), 'isMember()=false which is not expected.'); // $tableName must be an array if ((!is_array($tableName)) || (count($tableName) != 1)) { @@ -2569,7 +2569,7 @@ function memberDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunc // @TODO cacheFiles is not yet supported function memberListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid'), $content = array()) { // Do this only for logged in member - assert(isMember()); + assert(isMember(), 'isMember()=false which is not expected.'); // Call inner (general) function doGenericListBuilder('member', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId, $content); @@ -2647,7 +2647,7 @@ function caluculateTimeUnitValue ($seconds, $timeUnit) { // "Getter" for an array from given one but only one index of it function getArrayFromArrayIndex ($array, $key) { // Some simple validation - assert(isset($array[0][$key])); + assert(isset($array[0][$key]), 'array[0][' . $key . '] is not set.'); // Init new array $newArray = array(); diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 3e780dcac3..b2b984b4e5 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -95,7 +95,7 @@ if ((getFileHash() == '') || (!isFileReadable(getPath() . getCachePath() . '.' . } // END - if // @TODO Rewrite this to a filter -if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) { +if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isValidCacheInstance())) { // Destroy some cache files foreach (array('config', 'extension', 'filter', 'modules') as $cache) { // Use rebuildCache() diff --git a/inc/http-functions.php b/inc/http-functions.php index 4fc66c95a5..727211d59b 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -545,7 +545,7 @@ function unchunkHttpResponse ($response) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isChunked=' . intval($isChunked)); if ($isChunked === TRUE) { // Make sure, that body is an array - assert(is_array($body)); + assert(is_array($body), 'body[]=' . gettype($body) . ' must be an array.'); // Good, we still have the HTTP headers in there, so we need to get rid // of them temporarly diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index d7daeab73c..0edbbec6f1 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -635,7 +635,7 @@ function doExpressionSponsor ($data) { // Sponsor data found $functionName = "getFetchedSponsorData('id', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')"; } - } elseif ((!empty($data['callback'])) && (isSponsorDataValid())) { + } elseif ((!empty($data['callback'])) && (isValidSponsorData())) { // "Call-back" alias column for current logged in sponsor's data $functionName = "getSponsorData('" . $data['callback'] . "')"; } @@ -670,11 +670,11 @@ function fetchSponsorData ($sponsor_id, $column = 'id') { if (!isValidId($sponsor_id)) { // Invalid, so abort here reportBug(__FUNCTION__, __LINE__, 'Sponsor id ' . $sponsor_id . ' is invalid.'); - } elseif (isSponsorDataValid()) { + } elseif (isValidSponsorData()) { // Use cache, so it is fine return TRUE; } - } elseif (isSponsorDataValid()) { + } elseif (isValidSponsorData()) { // Use cache, so it is fine return TRUE; } @@ -726,7 +726,7 @@ function fetchSponsorData ($sponsor_id, $column = 'id') { } // END - if // Found, but valid? - $found = isSponsorDataValid(); + $found = isValidSponsorData(); } // END - if // Free memory @@ -766,7 +766,7 @@ function getFetchedSponsorData ($keyColumn, $sponsor_id, $valueColumn) { // Checks if the sponsor data is valid, this may indicate that the sponsor has logged // in, but you should use isMember() if you want to find that out. -function isSponsorDataValid () { +function isValidSponsorData () { // Sponsor id should not be zero so abort here if (!isCurrentSponsorIdSet()) return FALSE; diff --git a/inc/libs/transaction_functions.php b/inc/libs/transaction_functions.php index 6e47230b46..4422754cf3 100644 --- a/inc/libs/transaction_functions.php +++ b/inc/libs/transaction_functions.php @@ -86,7 +86,7 @@ function logTransaction ($sender, $receiver, $level, $valueAmount, $originalAmou ); // Should work - assert(isValidId(getSqlInsertId())); + assert(isValidId(getSqlInsertId()), 'getSqlInsertId() is not valid id number.'); } // Calculates transaction fee for sender amount @@ -137,7 +137,7 @@ function generateHashFromTransactionData (array &$data, $oldHash = '') { // "Getter" for CAPTCHA code from given transaction id function getCaptchaCodeFromTransactionId ($transactionId) { // Must be valid - assert(isValidId($transactionId)); + assert(isValidId($transactionId), 'transactionId=' . $transactionId . ' is not valid id number.'); // Default is NULL $code = NULL; @@ -319,7 +319,7 @@ LIMIT %s", ), $allowed, '', FALSE); // Should always work - assert($updated === TRUE); + assert($updated === TRUE, 'Nothing has been updated which is not expected.'); } // END - if } // END - if @@ -347,7 +347,7 @@ LIMIT %s", ); // Should always work - assert(sqlAffectedRows() == count($failedIds)); + assert(sqlAffectedRows() == count($failedIds), 'sqlAffectedRows()=' . sqlAffectedRows() . ',failedIds()=' . count($failedIds)); } // END - if // Return status @@ -357,7 +357,7 @@ LIMIT %s", // Checks whether the given user has a fee exempt function ifUserHasTransactionFeeExempt ($username) { // Accept only valid ids - assert(isValidId($username)); + assert(isValidId($username), 'username=' . $username . ' which is not a valid id number.'); // Is there "cache"? if (!isset($GLOBALS[__FUNCTION__][$username])) { @@ -365,7 +365,7 @@ function ifUserHasTransactionFeeExempt ($username) { $GLOBALS[__FUNCTION__][$username] = FALSE; // "Determine" it - $GLOBALS[__FUNCTION__][$username] = (getTotalAmountByUserid($username) < getConfig('transaction_fee_exempt_amount')); + $GLOBALS[__FUNCTION__][$username] = (getTotalPoints($username) < getConfig('transaction_fee_exempt_amount')); } // END - if // Return cache diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index c199c3affc..4587ea84a9 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -303,10 +303,10 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p } // END - if // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',isUserDataValid()=' . intval(isUserDataValid()) . ',userStatus=' . getUserData('status') . ',errorCode=' . $errorCode . ',ext=' . $ext . ',isFound=' . intval($isFound)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',isValidUserData()=' . intval(isValidUserData()) . ',userStatus=' . getUserData('status') . ',errorCode=' . $errorCode . ',ext=' . $ext . ',isFound=' . intval($isFound)); // Is there an entry? - if (($errorCode == '0') && (isUserDataValid()) && (getUserData('status') == 'CONFIRMED') && (!empty($content['userid']))) { + if (($errorCode == '0') && (isValidUserData()) && (getUserData('status') == 'CONFIRMED') && (!empty($content['userid']))) { // Check for old MD5 passwords if ((strlen(getUserData('password')) == 32) && (md5($passwd) == getUserData('password'))) { // Just set the hash to the password from DB... :) @@ -393,13 +393,13 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Wrong password! $errorCode = getCode('WRONG_PASS'); } - } elseif ((isUserDataValid()) && (getUserData('status') != 'CONFIRMED')) { + } elseif ((isValidUserData()) && (getUserData('status') != 'CONFIRMED')) { // Create an error code from given status $errorCode = generateErrorCodeFromUserStatus(getUserData('status')); // Set userid in session setSession('userid', getUserData('userid')); - } elseif (!isUserDataValid()) { + } elseif (!isValidUserData()) { // User id not found $errorCode = getCode('WRONG_ID'); } else { @@ -948,7 +948,7 @@ function doExpressionUser ($data) { // Fix all together $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')"; } - } elseif ((!empty($data['callback'])) && (isUserDataValid())) { + } elseif ((!empty($data['callback'])) && (isValidUserData())) { // "Call-back" alias column for current logged in user's data $functionName = "getUserData('" . $data['callback'] . "')"; } diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 078108d8f4..075242b2fd 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { // Register an administrator account function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') { // Only let valid data pass - assert(in_array($accessLevel, array('allow', 'deny'))); + assert(in_array($accessLevel, array('allow', 'deny')), 'accessLevel=' . $accessLevel . ', should be one of allow/deny.'); // Login does already exist $ret = 'already'; @@ -1606,7 +1606,7 @@ function doAdminProcessMenuWeightning ($type, $AND) { // Function to register first admin function registerFirstAdmin () { // Make sure that no admin is registered - assert(!isAdminRegistered()); + assert(!isAdminRegistered(), 'isAdminRegistered()=false which is not expected.'); // Admin is not registered so we have to inform the user if ((isFormSent('add_first_admin')) && ((!isPostRequestElementSet('admin_login')) || (!isPostRequestElementSet('admin_password1')) || (strlen(postRequestElement('admin_password1')) < getConfig('minium_admin_pass_length')) || (!isPostRequestElementSet('admin_password2')) || (strlen(postRequestElement('admin_password2')) < getConfig('minium_admin_pass_length')) || (postRequestElement('admin_password1') != postRequestElement('admin_password2')))) { diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 48e98ec145..7753f42c22 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -95,7 +95,7 @@ WHERE } // END - switch // Is there an array? - if ((getRequestElement('sub') != 'points') && (isSqlsValid())) { + if ((getRequestElement('sub') != 'points') && (ifSqlsRegistered())) { // Default is failed-message $message = '{--SETTINGS_NOT_SAVED--}'; diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 48049c7846..cc8fdf4216 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -263,7 +263,7 @@ LIMIT 1", } // Make sure only valid id numbers can pass - assert(isValidId($data['id'])); + assert(isValidId($data['id']), 'data[id]=' . $data['id'] . ' is not a valid id number.'); // Id is received so we can redirect the user, used points will be added when he send's out the mail $data['url'] = 'modules.php?module=frametester&order=' . bigintval($data['id']); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index f6f55610d4..b98aea3993 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -492,12 +492,12 @@ function fetchUserData ($value, $column = 'userid') { if ((isCurrentUserIdSet()) && (getCurrentUserId() != $value)) { // Unset it unsetCurrentUserId(); - } elseif (isUserDataValid()) { + } elseif (isValidUserData()) { // Use cache, so it is fine //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' is valid, using cache #1'); return TRUE; } // END - if - } elseif (isUserDataValid()) { + } elseif (isValidUserData()) { // Using cache is fine //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' is valid, using cache #2'); return TRUE; @@ -555,7 +555,7 @@ function fetchUserData ($value, $column = 'userid') { } // END - if // Found, but valid? - $found = isUserDataValid(); + $found = isValidUserData(); } // END - if // Free memory diff --git a/inc/pool-functions.php b/inc/pool-functions.php index 1bfc33bfc4..08490fb27f 100644 --- a/inc/pool-functions.php +++ b/inc/pool-functions.php @@ -85,7 +85,7 @@ function updatePoolDataById ($poolId, $columnName, $data, $updateMode = NULL, $w // Is update mode set? if (!is_null($updateMode)) { // Don't allow array as data here - assert(!is_array($data)); + assert(!is_array($data), 'data must not be an array.'); // Then use this on the column with this mode (mostly counters) sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_pool` SET `%s`=`%s`%s%s WHERE `id`=%s' . $whereSql . ' LIMIT 1', diff --git a/inc/referral-functions.php b/inc/referral-functions.php index 59a1c66a62..2e86d58cbd 100644 --- a/inc/referral-functions.php +++ b/inc/referral-functions.php @@ -807,7 +807,7 @@ function setReferralId ($refid) { } // Checks if 'refid' is valid -function isReferralIdValid () { +function isValidReferralId () { return ((isset($GLOBALS['__refid'])) && (isValidId(getReferralId()))); } @@ -819,7 +819,7 @@ function getReferralId () { // Determines referral id and sets it function determineReferralId () { // Is it already detected? - if (isReferralIdValid()) { + if (isValidReferralId()) { // Do not determine it, just return it return getReferralId(); } elseif ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) { @@ -828,7 +828,7 @@ function determineReferralId () { } // Check if refid is set - if (isReferralIdValid()) { + if (isValidReferralId()) { // This is fine... //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GLOBALS (' . getReferralId() . ')'); } elseif (isPostRequestElementSet('refid')) { @@ -897,7 +897,7 @@ function determineReferralId () { // Set cookie //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferralId() . ') #1'); setSession('refid', getReferralId()); - } elseif ((!isReferralIdValid()) || (!fetchUserData(getReferralId()))) { + } elseif ((!isValidReferralId()) || (!fetchUserData(getReferralId()))) { // Not valid! //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not valid referral id (' . getReferralId() . '), setting NULL in session'); setReferralId(NULL); diff --git a/inc/session-functions.php b/inc/session-functions.php index cd6eabdc5a..5421c1f013 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -150,14 +150,14 @@ function destroyAdminSession ($destroy = FALSE) { // Destroys session and resets some "caches" function destroySession () { // Unset "cache" - unset($GLOBALS['isSessionValid']); + unset($GLOBALS['isValidSession']); // Destroy session return session_destroy(); } // Checks whether the session is valid -function isSessionValid () { +function isValidSession () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Then determine it diff --git a/inc/session.php b/inc/session.php index aa22eacdc5..355d77307a 100644 --- a/inc/session.php +++ b/inc/session.php @@ -50,10 +50,10 @@ if (isExtensionInstalledAndNewer('sql_patches', '0.5.3')) { } // END - if // Is a session id there? -if (!isSessionValid()) { +if (!isValidSession()) { // Start the session $GLOBALS['valid_session'] = session_start(); - $GLOBALS['isSessionValid'] = TRUE; + $GLOBALS['isValidSession'] = TRUE; } // END - if // Load language file(s) diff --git a/inc/sql-functions.php b/inc/sql-functions.php index 362e5d53cd..503197b38f 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -114,7 +114,7 @@ function countSqls () { } // Checks whether the SQLs array is filled -function isSqlsValid () { +function ifSqlsRegistered () { //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . intval(isSqlsInitialized()) . '/' . countSqls() . '/' . getCurrentExtensionName()); return ( ( @@ -755,7 +755,7 @@ function getArrayFromSupportedSqlEngines ($requestedEngine = 'ALL') { // "Getter" for result from given table and field/type LIKEs function sqlGetResultFromLikeColumnsType ($tableName, $field, $type) { // The table should be there - assert(ifSqlTableExists($tableName)); + assert(ifSqlTableExists($tableName), 'tableName=' . $tableName . ' does not exist. field=' . $field . ',type=' . $type); // Default no field set $fieldSql = ''; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 9eee082a5f..c5aea2d344 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -527,7 +527,7 @@ function isDebugBuildMailsEnabled () { } // Checks whether the cache instance is valid -function isCacheInstanceValid () { +function isValidCacheInstance () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it @@ -1085,7 +1085,7 @@ function getUserDataArray () { // Checks if the user data is valid, this may indicate that the user has logged // in, but you should use isMember() if you want to find that out. -function isUserDataValid () { +function isValidUserData () { // User id should not be zero so abort here if (!isCurrentUserIdSet()) { // Debug message, may be noisy @@ -3491,9 +3491,9 @@ function translateFullComma ($dotted) { // Wrapper to check if the first element to be shifted is set to given value function shift_array (&$array, $value, $key = '0') { // Is the element set and value matches? - assert(is_array($array)); - assert(isset($array[$key])); - assert($array[$key] === $value); + assert(is_array($array), 'array[]=' . gettype($array), ',expected: array'); + assert(isset($array[$key]), 'array[' . $key . '] not set.'); + assert(($array[$key] === $value), ',array[' . $key . ']=' . $array[$key] . ',value=' . $value); // Shift it array_shift($array); diff --git a/inc/xml-functions.php b/inc/xml-functions.php index 0228d8f528..54b494418b 100644 --- a/inc/xml-functions.php +++ b/inc/xml-functions.php @@ -308,7 +308,7 @@ function getSqlPartFromXmlArray ($columns) { // Walk through all entries foreach ($columns as $columnArray) { // Must be an array - assert(is_array($columnArray)); + assert(is_array($columnArray), 'columnArray[]=' . gettype($columnArray) . ' must be an array.'); // Init SQL part $sqlPart = ''; @@ -462,7 +462,7 @@ function searchXmlArray ($value, $columns, $childKey) { // Walk through whole array foreach ($columns as $key => $columnArray) { // Make sure the element is there - assert(isset($columnArray[$childKey])); + assert(isset($columnArray[$childKey]), 'columnArray[' . $childKey . '] is not set.'); // Now is it what we are looking for? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ',key=' . $key . ',childKey=' . $childKey . ',columnArray=' . $columnArray[$childKey]); diff --git a/ref.php b/ref.php index d73033da16..dec75785e1 100644 --- a/ref.php +++ b/ref.php @@ -55,7 +55,7 @@ setContentType('text/html'); $url = 'modules.php?module=index'; // Check for determined referral id -if ((isExtensionActive('user')) && (isReferralIdValid()) && (isValidId(determineReferralId()))) { +if ((isExtensionActive('user')) && (isValidReferralId()) && (isValidId(determineReferralId()))) { // Run filter chain for updating referral data runFilterChain('update_referral_data'); diff --git a/sponsor_ref.php b/sponsor_ref.php index b251f6922a..dc134f1f5e 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -54,7 +54,7 @@ setContentType('text/html'); $url = 'modules.php?module=index'; // Is there a referral id? -if (isReferralIdValid()) { +if (isValidReferralId()) { // We have an refid here. So we simply add it $url .= '&what=sponsor_reg&refid=' . determineReferralId(); } // END - if