From 5eb7669649ebf60e74a83df70ad4f357d656b204 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 31 May 2013 17:18:29 +0000 Subject: [PATCH] Removed 2nd parameter for assert() as this is only available in PHP 5.4.8+ but Mailer 0.2.1-FINAL should support PHP 4 --- inc/extensions-functions.php | 30 +++++++++++++++--------------- inc/filter/blacklist_filter.php | 6 +++--- inc/filter/user_filter.php | 4 ++-- inc/functions.php | 12 ++++++------ inc/http-functions.php | 2 +- inc/libs/transaction_functions.php | 10 +++++----- inc/modules/admin/admin-inc.php | 4 ++-- inc/modules/member/what-order.php | 2 +- inc/pool-functions.php | 2 +- inc/sql-functions.php | 2 +- inc/wrapper-functions.php | 6 +++--- inc/xml-functions.php | 4 ++-- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index caf01774d2..8dfde689bd 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -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, 'fromTable must be different to toTable (' . $fromTable . ')'); + assert($fromTable != $toTable); // Is renaming required? if ((ifSqlTableExists($fromTable)) && (!ifSqlTableExists($toTable))) { @@ -2060,8 +2060,8 @@ 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'); + assert((!empty($tableName)) && (!empty($columnName)) && (!empty($columnSql))); + assert($columnName != $columnSql); // Is the column there? if (!ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $columnName, isInstaller())) { @@ -2079,8 +2079,8 @@ 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'); + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql))); + assert($indexName != $columnSql); // Is the column there? if (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { @@ -2098,8 +2098,8 @@ 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'); + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql))); + assert($indexName != $columnSql); // Is the column there? if (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { @@ -2117,8 +2117,8 @@ 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'); + assert((!empty($tableName)) && (!empty($indexName)) && (!empty($columnSql))); + assert($indexName != $columnSql); // Is the column there and MyISAM engine? (InnoDB doesn't support FULLTEXT) if ((getTableType() == 'MyISAM') && (!ifSqlTableIndexExist('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller()))) { @@ -2136,8 +2136,8 @@ 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.'); + assert((!empty($tableName)) && (!empty($fromColumnName)) && (!empty($toColumnName)) && (!empty($columnSql))); + assert(($fromColumnName != $columnSql) && ($toColumnName != $columnSql)); // Is the column there? if ((ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $fromColumnName)) && (($fromColumnName == $toColumnName) || (!ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $toColumnName, isInstaller())))) { @@ -2155,7 +2155,7 @@ 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.'); + assert((!empty($tableName)) && (!empty($columnName))); // Is the column there? if (ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $columnName, isInstaller())) { @@ -2173,7 +2173,7 @@ 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.'); + assert((!empty($tableName)) && (!empty($indexName))); // Is the column there? if (ifSqlTableColumnExists('{?_MYSQL_PREFIX?}_' . $tableName, $indexName, isInstaller())) { @@ -2212,8 +2212,8 @@ function addConfigChangeSql ($oldColumnName, $newColumnName, $columnSql) { */ 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.'); + assert((!empty($subject)) && (!empty($columnName)) && (!empty($lockedMode)) && (!empty($paymentMethod))); + assert((in_array($lockedMode, array('LOCKED', 'UNLOCKED'))) && (in_array($paymentMethod, array('DIRECT', 'REFERRAL')))); // Is the suffix '_ref' not set? if (!ifSubjectHasReferralSuffix($subject)) { diff --git a/inc/filter/blacklist_filter.php b/inc/filter/blacklist_filter.php index 82cce253ec..edba5885bf 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'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'email')); // @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'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'ip')); // @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'), 'filterData[init] must be set, filterData[blacklisted]=' . $filterData['blacklisted']); + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'url')); // @TODO Insert log entry diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index 3653be3904..fde26ce488 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(isValidReferralId(), 'isValidReferralId()=false which is not expected.'); + assert(isValidReferralId()); // 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(isValidReferralId(), 'isValidReferralId()=false which is not expected.'); + assert(isValidReferralId()); // Get sub id and secure it $subId = sqlEscapeString(getRequestElement('subid')); diff --git a/inc/functions.php b/inc/functions.php index 561bbdadf5..3951c79b5d 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, 'localAbc()=' . count($localAbc) . ' is to small.'); + assert(count($localAbc) >= 10); // 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), 'entries[]=bool which is not expected.'); + assert(!is_bool($entries)); } 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), 'entries[]=bool which is not expected.'); + assert(!is_bool($entries)); } // Return value @@ -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(), 'isMember()=false which is not expected.'); + assert(isMember()); // $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(), 'isMember()=false which is not expected.'); + assert(isMember()); // 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]), 'array[0][' . $key . '] is not set.'); + assert(isset($array[0][$key])); // Init new array $newArray = array(); diff --git a/inc/http-functions.php b/inc/http-functions.php index 727211d59b..4fc66c95a5 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), 'body[]=' . gettype($body) . ' must be an array.'); + assert(is_array($body)); // Good, we still have the HTTP headers in there, so we need to get rid // of them temporarly diff --git a/inc/libs/transaction_functions.php b/inc/libs/transaction_functions.php index 4422754cf3..26839aa6bb 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()), 'getSqlInsertId() is not valid id number.'); + assert(isValidId(getSqlInsertId())); } // 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), 'transactionId=' . $transactionId . ' is not valid id number.'); + assert(isValidId($transactionId)); // Default is NULL $code = NULL; @@ -319,7 +319,7 @@ LIMIT %s", ), $allowed, '', FALSE); // Should always work - assert($updated === TRUE, 'Nothing has been updated which is not expected.'); + assert($updated === TRUE); } // END - if } // END - if @@ -347,7 +347,7 @@ LIMIT %s", ); // Should always work - assert(sqlAffectedRows() == count($failedIds), 'sqlAffectedRows()=' . sqlAffectedRows() . ',failedIds()=' . count($failedIds)); + assert(sqlAffectedRows() == 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), 'username=' . $username . ' which is not a valid id number.'); + assert(isValidId($username)); // Is there "cache"? if (!isset($GLOBALS[__FUNCTION__][$username])) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 075242b2fd..078108d8f4 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')), 'accessLevel=' . $accessLevel . ', should be one of allow/deny.'); + assert(in_array($accessLevel, array('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(), 'isAdminRegistered()=false which is not expected.'); + assert(!isAdminRegistered()); // 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/member/what-order.php b/inc/modules/member/what-order.php index b064c4cb7a..6f3bc4fc4d 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']), 'data[id]=' . $data['id'] . ' is not a valid id number.'); + assert((isset($data['id'])) && (isValidId($data['id']))); // 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/pool-functions.php b/inc/pool-functions.php index 08490fb27f..1bfc33bfc4 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), 'data must not be an array.'); + assert(!is_array($data)); // 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/sql-functions.php b/inc/sql-functions.php index 503197b38f..8e64bc0df0 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -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), 'tableName=' . $tableName . ' does not exist. field=' . $field . ',type=' . $type); + assert(ifSqlTableExists($tableName)); // Default no field set $fieldSql = ''; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c5aea2d344..191b6164ca 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -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), 'array[]=' . gettype($array), ',expected: array'); - assert(isset($array[$key]), 'array[' . $key . '] not set.'); - assert(($array[$key] === $value), ',array[' . $key . ']=' . $array[$key] . ',value=' . $value); + assert(is_array($array)); + assert(isset($array[$key])); + assert($array[$key] === $value); // Shift it array_shift($array); diff --git a/inc/xml-functions.php b/inc/xml-functions.php index 54b494418b..0228d8f528 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), 'columnArray[]=' . gettype($columnArray) . ' must be an array.'); + assert(is_array($columnArray)); // 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]), 'columnArray[' . $childKey . '] is not set.'); + assert(isset($columnArray[$childKey])); // Now is it what we are looking for? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ',key=' . $key . ',childKey=' . $childKey . ',columnArray=' . $columnArray[$childKey]); -- 2.30.2