Fixes + asserts
authorRoland Häder <roland@mxchange.org>
Thu, 30 May 2013 18:48:00 +0000 (18:48 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 30 May 2013 18:48:00 +0000 (18:48 +0000)
31 files changed:
ajax.php
beg.php
doubler.php
inc/ajax-functions.php
inc/expression-functions.php
inc/extensions-functions.php
inc/extensions/bonus/mode-update.php
inc/filter/blacklist_filter.php
inc/filter/cache_filter.php
inc/filter/online_filter.php
inc/filter/user_filter.php
inc/filters.php
inc/functions.php
inc/gen_sql_patches.php
inc/http-functions.php
inc/libs/sponsor_functions.php
inc/libs/transaction_functions.php
inc/libs/user_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_points.php
inc/modules/member/what-order.php
inc/mysql-manager.php
inc/pool-functions.php
inc/referral-functions.php
inc/session-functions.php
inc/session.php
inc/sql-functions.php
inc/wrapper-functions.php
inc/xml-functions.php
ref.php
sponsor_ref.php

index 518c2c2512c0a40e2cc068f143f07ba92b5ba50b..f0a04892ee3b0276bda0b42147c4b7487f60c0d5 100644 (file)
--- 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 81cb992df91506515a35ccca35dc888c2177bb46..e9877f9699347750c932b7b8820cf53260d88989 100644 (file)
--- 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
index 5d4c3ce0924416621b04c9b03805f5e65a03ffa2..46f16f9122829361268eb60b0b08369c2629307e 100644 (file)
@@ -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 {
index 35cb192c65bb1559a3bcfe01dd3f949057a747e0..d3736e0f03043caddaca465a74056c03c9cc6915 100644 (file)
@@ -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;
 
index abce20ffbe04cefa564f8afb3a241976271e79c9..de71466a0277cb8215a2515207ec1c9af63d1c3f 100644 (file)
@@ -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
index b7b57b30f150d7aa943965b34dcf19bc1b5f76f9..caf01774d27168f6bc077ae68acb7e40fc0b6da7 100644 (file)
@@ -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
index 28985fb10679815057c1c23de0c9b47850179914..c3d58b75d989932e4abb8b06b143d46a0fb4eebe 100644 (file)
@@ -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 &uuml;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).");
index edba5885bf2ccb67ab02a6e8d7537aea44fed770..82cce253ecd5b013a08ad5555d1190a0af39bc0d 100644 (file)
@@ -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
 
index 02b456d55579c7c8accaed9944cea885cf88ec77..f514142b2d9bebbb00dd5abc5e78444bc58ddfd8 100644 (file)
@@ -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
 
index fca99bf04b2b25e9979b845952be03bca2ee1416..81bcb1f656f7ca06dec84285db39e2e60f7140f5 100644 (file)
@@ -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
index 7c731dab5801f1e7cc4fd1b82b1d159db0988ecf..3653be39047e17fcd32e00f1740ff1f069f8907c 100644 (file)
@@ -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'));
index ceaf0e0ac9c47e6332df05342cf8a914989f7848..7fba80252b32a099718e499c36eca6812509cdd0 100644 (file)
@@ -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'] .= '<input type="hidden" name="' . session_name() . '" value="' . session_id() . '" />';
        } // END - if
index b9c3f1f699efe2dc8825a78f367cb7d057d63b55..561bbdadf576f00aeef9b519712d8f8a951f48d3 100644 (file)
@@ -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 = '&amp;';
                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();
index 3e780dcac39499dbd74334881b43631fbf8bf5d6..b2b984b4e59cb36d146d06ce7fecc76eee3d6c38 100644 (file)
@@ -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()
index 4fc66c95a5a94a4850f1af9106d3a284b9e34ace..727211d59b834ca789d0d2b9023f52344dde1a7f 100644 (file)
@@ -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
index d7daeab73c8a7f8134e35a5986b29d3bc090c043..0edbbec6f1a703ca49999c01b4602832d37d26a7 100644 (file)
@@ -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;
 
index 6e47230b46325a25b17e9ec4809fa05e52a2b552..4422754cf3ca01f344bde3ba03f6b9965a264226 100644 (file)
@@ -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
index c199c3affce760aeba5f8477bf8e0fc299d3872d..4587ea84a93eef09ee5704915cf6ab4b4751fd64 100644 (file)
@@ -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'] . "')";
        }
index 078108d8f464f1e64958f21398e4fb67653857ee..075242b2fddc48f942a013b833b8152235f3e418 100644 (file)
@@ -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')))) {
index 48e98ec1453b79e48ed34784a0d783815bec3c3f..7753f42c2219a2243601a9794c2791522127f3b9 100644 (file)
@@ -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 = '<span class="bad">{--SETTINGS_NOT_SAVED--}</span>';
 
index 48049c784619a3fde28a1ca59c392d151acc66e2..cc8fdf421685eb1132743a28a07e7510ad3403a1 100644 (file)
@@ -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&amp;order=' . bigintval($data['id']);
index f6f55610d44d93cc4c46f339f61176a49dc25025..b98aea3993459c7cbbdeb1fb132acf30d5936ed4 100644 (file)
@@ -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
index 1bfc33bfc48411f2ff0bfe8ac99942f7977b45b3..08490fb27f00e15f8b56ed40fae9788e3046bd22 100644 (file)
@@ -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',
index 59a1c66a629a38ba6a7d71ed3e1c20fb8fb65a56..2e86d58cbd4ccb65401eddb8734d3f425c3479e8 100644 (file)
@@ -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);
index cd6eabdc5a241c6cf3788624a3cf5f9b40754dff..5421c1f013a55d2512f3c137b3675a4d17e51bb4 100644 (file)
@@ -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
index aa22eacdc545458fc46da54dd343a9890c333e52..355d77307ae34aeb4b7a6649782b5b9ac78f71a6 100644 (file)
@@ -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)
index 362e5d53cda28a6aeea9006d49ef57140d0378a9..503197b38f86a7d027f9371d89bcf989199a67b2 100644 (file)
@@ -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 = '';
index 9eee082a5fb26ac7d776654bca2d5d5ffd5d958c..c5aea2d344f62861eb17bf735393416d712a1649 100644 (file)
@@ -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);
index 0228d8f528cd5afe3af34844c55ae4a368080f39..54b494418b6bb31f0e95492ba8c6517400660cd1 100644 (file)
@@ -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 d73033da16ee3d8b80634f8adb8ad9b4f0273f7d..dec75785e1f38458dfb949a81b8f77d218372f2c 100644 (file)
--- 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');
 
index b251f6922adfe69d2682d305f13e1d10aa4041f6..dc134f1f5ee1a9c7b1a9e5e27bad2f8132ccb25c 100644 (file)
@@ -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 .= '&amp;what=sponsor_reg&amp;refid=' . determineReferralId();
 } // END - if