// 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))) {
// 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())) {
// 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())) {
// 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())) {
// 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()))) {
// 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())))) {
// 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())) {
// 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())) {
*/
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)) {
// 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
// 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
// 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
// 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__);
// 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'));
$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 = '';
} // 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()) {
} // 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
// 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)) {
// @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);
// "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();
//* 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
);
// Should work
- assert(isValidId(getSqlInsertId()), 'getSqlInsertId() is not valid id number.');
+ assert(isValidId(getSqlInsertId()));
}
// Calculates transaction fee for sender amount
// "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;
), $allowed, '', FALSE);
// Should always work
- assert($updated === TRUE, 'Nothing has been updated which is not expected.');
+ assert($updated === TRUE);
} // END - if
} // END - if
);
// Should always work
- assert(sqlAffectedRows() == count($failedIds), 'sqlAffectedRows()=' . sqlAffectedRows() . ',failedIds()=' . count($failedIds));
+ assert(sqlAffectedRows() == count($failedIds));
} // END - if
// Return status
// 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])) {
// 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';
// 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')))) {
}
// 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']);
// 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',
// "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 = '';
// 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);
// 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 = '';
// 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]);