$userid,
$chk
), __FILE__, __LINE__);
-//* DEBUG: */ debugOutput("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestElement('check')).'/'.SQL_NUMROWS($result) . ')');
+//* DEBUG: */ debugOutput("userid=".$userid.",chk=".$chk." (".strlen($chk).'/'.strlen(getRequestElement('check')).'/'.sqlNumRows($result) . ')');
// Prepare content
$content = array();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQL=' . $SQL);
sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_config` SET ".$SQL." WHERE `config`=%s LIMIT 1",
array(bigintval($config)), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQL=' . $SQL . ',affectedRows=' . SQL_AFFECTEDROWS());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQL=' . $SQL . ',affectedRows=' . sqlAffectedRows());
// Rebuild cache
rebuildCache('config', 'config');
ORDER BY
`userid` ASC", __FILE__, __LINE__);
-//* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;daily|numRows=' . SQL_NUMROWS($result_daily));
+//* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;daily|numRows=' . sqlNumRows($result_daily));
if (!ifSqlHasZeroNums($result_daily)) {
// Init SQLs
initSqls();
$columnName
), __FILE__, __LINE__);
- //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . SQL_NUMROWS($result_points));
+ //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . sqlNumRows($result_points));
if (!ifSqlHasZeroNums($result_points)) {
// Ok transfer points
while ($content2 = sqlFetchArray($result_points)) {
} // END - if
// SQL queries
-function sqlQuery ($sqlString, $F, $L, $enableCodes = TRUE) {
+function sqlQuery ($sqlString, $file, $line, $enableCodes = TRUE) {
// Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$sqlString])) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called: ' . $sqlString);
if (empty($sqlStringModified)) {
// Empty SQL string!
reportBug(__FUNCTION__, __LINE__, sprintf("SQL string is empty, please fix this: file=%s, line=%s",
- basename($F),
- $L
+ basename($file),
+ $line
));
} elseif (!isSqlLinkUp()) {
// We should not quietly ignore this
reportBug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
$sqlStringModified,
- basename($F),
- $L
+ basename($file),
+ $line
));
}
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified);
} elseif (!isSqlLinkUp()) {
// Link went down while using cached SQL
- reportBug(__FUNCTION__, __LINE__, 'Link went down while using cached SQL: sqlString=' . $sqlString . ',F=' . basename($F) . ',L=' . $L . ',enableCodes=' . intval($enableCodes));
+ reportBug(__FUNCTION__, __LINE__, 'Link went down while using cached SQL: sqlString=' . $sqlString . ',file=' . basename($file) . ',line=' . $line . ',enableCodes=' . intval($enableCodes));
} else {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString);
$querytimeBefore = microtime(TRUE);
// Run SQL command
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . basename($F) . ',L=' . $L . ',sql=' . $GLOBALS['last_sql']);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . basename($file) . ',line=' . $line . ',sql=' . $GLOBALS['last_sql']);
$result = mysql_query($GLOBALS['last_sql'], getSqlLink())
- or sqlError($F, $L, 'file='. basename($F) . ',line=' . $L . ':mysql_error()=' . mysql_error() . ',last_query=' . $GLOBALS['last_sql']);
- //* DEBUG: */ logDebugMessage($F, $L, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . SQL_AFFECTEDROWS() . ',numRows='.(is_resource($result) ? SQL_NUMROWS($result) : gettype($result)));
+ or sqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysql_error()=' . mysql_error() . ',last_query=' . $GLOBALS['last_sql']);
+ //* DEBUG: */ logDebugMessage($file, $line, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . sqlAffectedRows() . ',numRows='.(is_resource($result) ? sqlNumRows($result) : gettype($result)));
// Calculate query time
$queryTime = microtime(TRUE) - $querytimeBefore;
// Add this query to array including timing
- addSqlToDebug($result, $GLOBALS['last_sql'], $queryTime, $F, $L);
+ addSqlToDebug($result, $GLOBALS['last_sql'], $queryTime, $file, $line);
// Save last successfull query
setConfigEntry('db_last_query', $GLOBALS['last_sql']);
} // END - if
// Append debug line
- appendLineToFile(getCachePath() . 'mysql.log', basename($F) . '|LINE=' . $L . '|NUM=' . (is_resource($result) ? sqlNumRows($result) : 'false') . '|AFFECTED=' . sqlAffectedRows() . '|QUERYTIME:' . ($queryTime * 1000) . 'ms): ' . str_replace(array(chr(13), PHP_EOL), array('', ' '), $GLOBALS['last_sql']));
+ appendLineToFile(getCachePath() . 'mysql.log', basename($file) . '|LINE=' . $line . '|NUM=' . (is_resource($result) ? sqlNumRows($result) : 'false') . '|AFFECTED=' . sqlAffectedRows() . '|QUERYTIME:' . ($queryTime * 1000) . 'ms): ' . str_replace(array(chr(13), PHP_EOL), array('', ' '), $GLOBALS['last_sql']));
} // END - if
// Increment stats entry
}
// SQL connect
-function sqlConnectToDatabase ($host, $login, $password, $F, $L) {
+function sqlConnectToDatabase ($host, $login, $password, $file, $line) {
// Try to connect
- $linkResource = mysql_connect($host, $login, $password) or sqlError($F, $L, mysql_error());
+ $linkResource = mysql_connect($host, $login, $password) or sqlError($file, $line, mysql_error());
// Set the link resource
if (is_resource($linkResource)) {
} // END - if
// Return the resource
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'linkResource[]=' . gettype($linkResource));
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'linkResource[]=' . gettype($linkResource));
return $linkResource;
}
// SQL select database
-function sqlSelectDatabase ($dbName, $F, $L) {
+function sqlSelectDatabase ($dbName, $file, $line) {
// Is there still a valid link? If not, skip it.
if (!isSqlLinkUp()) return FALSE;
// Return the result
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Selecting database ' . $dbName);
- return mysql_select_db($dbName, getSqlLink()) or sqlError($F, $L, mysql_error());
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Selecting database ' . $dbName);
+ return mysql_select_db($dbName, getSqlLink()) or sqlError($file, $line, mysql_error());
}
// SQL close link
-function sqlCloseLink ($F, $L) {
+function sqlCloseLink ($file, $line) {
// Is the link up?
if (!isSqlLinkUp()) {
// Skip double close
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Called but no link is open.');
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Called but no link is open.');
return FALSE;
} // END - if
// Close database link and forget the link
- $close = mysql_close(getSqlLink()) or sqlError($F . ':' . __FUNCTION__, $L . ':' . __LINE__, mysql_error());
+ $close = mysql_close(getSqlLink()) or sqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysql_error());
// Close link in this layer
unsetSqlLinkUp(__FUNCTION__, __LINE__);
// Return the result
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'close[' . gettype($close) . ']=' . intval($close));
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'close[' . gettype($close) . ']=' . intval($close));
return $close;
}
// Load from database
$result = sqlQueryEscaped("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': DB - '.SQL_NUMROWS($result).'');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': DB - '.sqlNumRows($result).'');
// Is the extension there?
if (sqlNumRows($result) == 1) {
}
// "Registers" a new filter function
-function registerFilter ($F, $L, $filterName, $filterFunction, $silentAbort = TRUE, $force = FALSE, $isDryRun = FALSE) {
+function registerFilter ($file, $line, $filterName, $filterFunction, $silentAbort = TRUE, $force = FALSE, $isDryRun = FALSE) {
// Extend the filter function name
$filterFunction = 'FILTER_' . strtoupper($filterFunction);
// Debug message with FILTER_ prefix
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',file=' . basename($file) . ',line=' . $line . ' - ENTERED!');
// Is that filter already there?
if ((isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) {
// In installation phase we always want to abort
if (($silentAbort === FALSE) || (isInstallationPhase())) {
// Add fatal message
- reportBug(__FUNCTION__, __LINE__, sprintf("Filter chain %s has already filter function %s registered! F=%s,L=%s,force=%d", $filterName, $filterFunction, basename($F), $L, intval($force)));
+ reportBug(__FUNCTION__, __LINE__, sprintf("Filter chain %s has already filter function %s registered! file=%s,L=%s,force=%d", $filterName, $filterFunction, basename($file), $line, intval($force)));
} // END - if
// Abort here
// Is the function there?
if (!function_exists($filterFunction)) {
// Then abort here
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force)));
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. file=%s,L=%s,force=%d", $filterFunction, $filterName, basename($file), $line, intval($force)));
return FALSE;
} // END - if
// Simply add it to the array
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REGISTER: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REGISTER: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',file=' . basename($file) . ',line=' . $line);
$GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'A';
$GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = '0';
} // END - if
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',file=' . basename($file) . ',line=' . $line . ' - EXIT!');
// Worked
return TRUE;
}
// "Unregisters" a filter from the given chain
-function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = FALSE, $isDryRun = FALSE) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - ENTERED!');
+function unregisterFilter ($file, $line, $filterName, $filterFunction, $force = FALSE, $isDryRun = FALSE) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . $file . ',line=' . $line . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - ENTERED!');
// Extend the filter function name only if not loaded from database
if (!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) {
// Shall we remove? (default, not while just showing an extension removal)
if (($isDryRun === FALSE) && (isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction]))) {
// Mark for filter removal
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ' - REMOVE!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . $file . ',line=' . $line . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ' - REMOVE!');
$GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R';
} // END - if
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . $file . ',line=' . $line . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - EXIT!');
// Worked
return TRUE;
// Count module click
sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
array(getModule()), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS() . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ',sqlAffectedRows()=' . sqlAffectedRows() . ' - EXIT!');
}
// Handles fatal errors
}
// Add a fatal error message to the queue array
-function addFatalMessage ($F, $L, $message, $extra = '') {
+function addFatalMessage ($file, $line, $message, $extra = '') {
if (is_array($extra)) {
// Multiple extras for a message with masks
$message = call_user_func_array('sprintf', $extra);
array_push($GLOBALS['fatal_messages'], $message);
// Log fatal messages away
- logDebugMessage($F, $L, 'Fatal error message: ' . compileCode($message));
+ logDebugMessage($file, $line, 'Fatal error message: ' . compileCode($message));
}
// Getter for total fatal message count
}
// Add SQL debug data to array for later output
-function addSqlToDebug ($result, $sqlString, $timing, $F, $L) {
+function addSqlToDebug ($result, $sqlString, $timing, $file, $line) {
// Is there cache?
if (!isset($GLOBALS['debug_sql_available'])) {
// Check it and cache it in $GLOBALS
} // END - if
// Already executed?
- if (isset($GLOBALS['debug_sqls'][$F][$L][$sqlString])) {
+ if (isset($GLOBALS['debug_sqls'][$file][$line][$sqlString])) {
// Then abort here, we don't need to profile a query twice
return;
} // END - if
// Remeber this as profiled (or not, but we don't care here)
- $GLOBALS['debug_sqls'][$F][$L][$sqlString] = TRUE;
+ $GLOBALS['debug_sqls'][$file][$line][$sqlString] = TRUE;
// Generate record
$record = array(
'affected' => sqlAffectedRows(),
'sql_str' => $sqlString,
'timing' => $timing,
- 'file' => basename($F),
- 'line' => $L
+ 'file' => basename($file),
+ 'line' => $line
);
// Add it
WHERE
`media_key`='%s'
LIMIT 1", array($key), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',SQL_NUMROWS()=' . SQL_NUMROWS($result_media));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',sqlNumRows()=' . sqlNumRows($result_media));
if (sqlNumRows($result_media) == 0) {
// Not found so we create it (mode will be ignored here!)
sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')",
} // END - if
// Add points again, but only directly
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . convertNullToZero($refid) . ' - REFBACK-UPDATE! (' . SQL_AFFECTEDROWS() . ')');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . convertNullToZero($refid) . ' - REFBACK-UPDATE! (' . sqlAffectedRows() . ')');
addPointsThroughReferralSystem(sprintf("refback:%s", $refid), $userid, $refbackPoints);
// Reduce points if refid is found
array($refid, $level), __FUNCTION__, __LINE__);
// Entries found?
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'numRows=' . SQL_NUMROWS($result));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'numRows=' . sqlNumRows($result));
if (!ifSqlHasZeroNums($result)) {
// Add all
while ($content = sqlFetchArray($result)) {
getMemberId()
), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',getMemberId()=' . getMemberId() . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS() . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',getMemberId()=' . getMemberId() . ',sqlAffectedRows()=' . sqlAffectedRows() . ' - EXIT!');
}
// Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
LIMIT 1", __FUNCTION__, __LINE__);
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt=' . getSurfbarSalt() . ',id=' . getSurfbarId() . ',userid=' . getMemberId() . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS() . ' - UPDATE!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt=' . getSurfbarSalt() . ',id=' . getSurfbarId() . ',userid=' . getMemberId() . ',sqlAffectedRows()=' . sqlAffectedRows() . ' - UPDATE!');
// Was that okay?
if (ifSqlHasZeroAffectedRows()) {
} // END - if
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows=' . SQL_AFFECTEDROWS() . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows=' . sqlAffectedRows() . ' - EXIT!');
// Return if the update was okay
return (!ifSqlHasZeroAffectedRows());
`sbu`.`url_id` ASC", __FUNCTION__, __LINE__);
// Log last query
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.sqlNumRows($result).'|Affected='.sqlAffectedRows());
// Fetch max rand
$maxRand = sqlNumRows($result);
}
// Is there an id number?
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.sqlNumRows($result).'|Affected='.sqlAffectedRows());
if (sqlNumRows($result) == 1) {
// Load/cache data
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - BEFORE', FALSE);
$userid,
$levels['level']
), __FILE__, __LINE__);
- //* DEBUG: */ debugOutput($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs));
+ //* DEBUG: */ debugOutput($userid.'/'.$levels['level'].'/'.sqlNumRows($result_refs));
// Is there levels?
if (!ifSqlHasZeroNums($result_refs)) {
// Load entry
while (list($userid) = sqlFetchRow($result)) {
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NUMS=' . SQL_NUMROWS($result) . ',userid=' . $userid);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NUMS=' . sqlNumRows($result) . ',userid=' . $userid);
// By default no code is unique
$isUnique = FALSE;
// We can now send mails to them...
foreach ($receivers as $key => $userid) {
// Lookup user id
- //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.SQL_NUMROWS($result_user).'*');
+ //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.sqlNumRows($result_user).'*');
if (fetchUserData($userid)) {
// Is there a stats entry?
$result_stats = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
array($mailData['id'], $mailData['sender_userid'], $mailData['timestamp']), __FILE__, __LINE__);
// If there's no stats entry add it!
- //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
+ //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.sqlNumRows($result_stats).'!');
if (ifSqlHasZeroNums($result_stats)) {
// No entry was found, so we add him!
sqlQueryEscaped("INSERT INTO
array(bigintval($mailData['id']), bigintval($mailData['sender_userid']), bigintval($mailData['timestamp'])), __FILE__, __LINE__);
} // END - if
- //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
+ //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.sqlNumRows($result_stats).'!');
if (sqlNumRows($result_stats) == 1) {
// We got one!
list($stats_id) = sqlFetchRow($result_stats);
bigintval($GLOBALS['ref_level'])
), __FUNCTION__, __LINE__);
}
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - UPDATE! ('.sqlAffectedRows().')');
// No entry updated?
if (ifSqlHasZeroAffectedRows()) {
convertZeroToNull($GLOBALS['ref_level']),
$ref_points
), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - INSERTED! ('.sqlAffectedRows().')');
} // END - if
// Check affected rows
), __FUNCTION__, __LINE__);
// When no entry was updated then we have to create it here
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ',level=' . $GLOBALS['cache_array']['ref_level'][$refid] . ',updated=' . SQL_AFFECTEDROWS());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ',level=' . $GLOBALS['cache_array']['ref_level'][$refid] . ',updated=' . sqlAffectedRows());
if (ifSqlHasZeroAffectedRows()) {
// First count!
sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
bigintval($refid),
convertZeroToNull($GLOBALS['cache_array']['ref_level'][$refid])
), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ',level=' . $GLOBALS['cache_array']['ref_level'][$refid] . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ',level=' . $GLOBALS['cache_array']['ref_level'][$refid] . ',sqlAffectedRows()=' . sqlAffectedRows());
} // END - if
// Advance to next level
array($userid), __FUNCTION__, __LINE__);
// Are there entries?
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',SQL_NUMROWS()=' . SQL_NUMROWS($GLOBALS['referral_result'][$userid]));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',sqlNumRows()=' . sqlNumRows($GLOBALS['referral_result'][$userid]));
if (sqlNumRows($GLOBALS['referral_result'][$userid]) > 0) {
// Then walk through all levels
while (list($level) = sqlFetchRow($GLOBALS['referral_result'][$userid])) {
array($userid), __FUNCTION__, __LINE__);
// Are there entries?
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',SQL_NUMROWS()=' . SQL_NUMROWS($GLOBALS['referral_result_refs'][$userid]));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',sqlNumRows()=' . sqlNumRows($GLOBALS['referral_result_refs'][$userid]));
if (sqlNumRows($GLOBALS['referral_result_refs'][$userid]) > 0) {
// Then again walk through all
while (list($refid) = sqlFetchRow($GLOBALS['referral_result_refs'][$userid])) {
}
// Function to unset __is_sql_link_up
-function unsetSqlLinkUp ($F, $L) {
+function unsetSqlLinkUp ($file, $line) {
// Unset it
- //* DEBUG: */ logDebugMessage($F, $L, __FUNCTION__ . ': Called!');
- setSqlLink($F, $L, NULL);
+ //* DEBUG: */ logDebugMessage($file, $line, __FUNCTION__ . ': Called!');
+ setSqlLink($file, $line, NULL);
}
// Initializes the SQL link by bringing it up if set
}
// SQL string escaping
-function sqlQueryEscaped ($sqlString, $data, $F, $L, $run = TRUE, $strip = TRUE, $secure = TRUE) {
+function sqlQueryEscaped ($sqlString, $data, $file, $line, $run = TRUE, $strip = TRUE, $secure = TRUE) {
// Link is there?
if ((!isSqlLinkUp()) || (!is_array($data))) {
// Link is down or data is not an array
- //* DEBUG: */ logDebugMessage($F, $L, 'isSqlLinkUp()=' . intval(isSqlLinkUp()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
+ //* DEBUG: */ logDebugMessage($file, $line, 'isSqlLinkUp()=' . intval(isSqlLinkUp()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
return FALSE;
} // END - if
if ($run === TRUE) {
// Run SQL query (default)
- return sqlQuery($query, $F, $L);
+ return sqlQuery($query, $file, $line);
} else {
// Return secured string
return $query;
}
// SELECT query string from table, columns and so on... ;-)
-function getSqlResultFromArray ($table, $columns, $idRow, $id, $F, $L) {
+function getSqlResultFromArray ($table, $columns, $idRow, $id, $file, $line) {
// Is columns an array?
if (!is_array($columns)) {
// No array
reportBug(__FUNCTION__, __LINE__, sprintf("columns is not an array. %s != array, file=%s, line=%s",
gettype($columns),
- basename($F),
- $L
+ basename($file),
+ $line
));
// Abort here with 'false'
$table,
$idRow,
bigintval($id),
- ), $F, $L
+ ), $file, $line
);
}
// ALTER TABLE wrapper function
-function sqlQueryAlterTable ($sql, $F, $L, $enableCodes = TRUE) {
+function sqlQueryAlterTable ($sql, $file, $line, $enableCodes = TRUE) {
// Abort if link is down
if (!isSqlLinkUp()) return FALSE;
if (((!ifSqlTableColumnExists($tableName, $columnName)) && (isInString('ADD', $sql))) || ((ifSqlTableColumnExists($tableName, $columnName)) && ((isInString('DROP', $sql)) || ((isInString('CHANGE', $sql)) && ($idx == 4) && ((!ifSqlTableColumnExists($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
// Do the query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
- $result = sqlQuery($sql, $F, $L, FALSE);
+ $result = sqlQuery($sql, $file, $line, FALSE);
// Skip further attempt(s)
break;
} // END - foreach
} elseif ((getTableType() == 'InnoDB') && (isInString('FULLTEXT', $sql))) {
// Skip this query silently because InnoDB does not understand fulltext indexes
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : ifSqlTableColumnExists($columnName)), $F, $L));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : ifSqlTableColumnExists($columnName)), $file, $line));
} elseif ($isAlterIndex === TRUE) {
// And column name as well without backticks
$keyName = str_replace('`', '', $tableArray[5]);
if (($tableArray[3] == 'ADD') && (!ifSqlTableIndexExist($tableName, $keyName))) {
// Send it to the sqlQuery() function to add it
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ' - ADDING!');
- $result = sqlQuery($sql, $F, $L, $enableCodes);
+ $result = sqlQuery($sql, $file, $line, $enableCodes);
} elseif (($tableArray[3] == 'DROP') && (ifSqlTableIndexExist($tableName, $keyName))) {
// Send it to the sqlQuery() function to drop it
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ' - DROPPING!');
- $result = sqlQuery($sql, $F, $L, $enableCodes);
+ $result = sqlQuery($sql, $file, $line, $enableCodes);
} else {
// Not executed
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
} else {
// Other ALTER TABLE query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
- $result = sqlQuery($sql, $F, $L, $enableCodes);
+ $result = sqlQuery($sql, $file, $line, $enableCodes);
}
// Return result
}
// Setter for link
-function setSqlLink ($F, $L, $link) {
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'link[]=' . gettype($link) . ' - ENTERED!');
+function setSqlLink ($file, $line, $link) {
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'link[]=' . gettype($link) . ' - ENTERED!');
// Is this a resource or null?
if ((ifFatalErrorsDetected()) && (isInstallationPhase())) {
// This may happen in installation phase
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Some fatal errors detected in installation phase.');
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Some fatal errors detected in installation phase.');
return;
} elseif ((!is_resource($link)) && (!is_null($link))) {
// This should never happen!
- reportBug($F . ':' . __FUNCTION__, $L . ':' . __LINE__, sprintf("Type of link is not resource or null, type=%s", gettype($link)));
+ reportBug($file . ':' . __FUNCTION__, $line . ':' . __LINE__, sprintf("Type of link is not resource or null, type=%s", gettype($link)));
} // END - if
// Set it
// Re-init cache
$GLOBALS['__is_sql_link_up'] = is_resource($link);
- //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, '__is_sql_link_up=' . intval($GLOBALS['__is_sql_link_up']) . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, '__is_sql_link_up=' . intval($GLOBALS['__is_sql_link_up']) . ' - EXIT!');
}
// Checks if the link is up
* functionality like logging and admin notification (which you can configure
* through your admin area).
*
- * @param $F Function or file basename where the error came from
- * @param $L Line number where the error came from
+ * @param $file Function or file basename where the error came from
+ * @param $line Line number where the error came from
* @param $message Message which shall be output to web
* @return void
*/
-function app_exit ($F, $L, $message) {
+function app_exit ($file, $line, $message) {
// Check if Script is already dieing and not let it kill itself another 1000 times
if (isset($GLOBALS['app_died'])) {
// Script tried to kill itself twice
- die('[' . __FUNCTION__ . ':' . __LINE__ . ']: Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $F . ', line=' . $L);
+ die('[' . __FUNCTION__ . ':' . __LINE__ . ']: Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $file . ', line=' . $line);
} // END - if
// Make sure, that the script realy realy diese here and now
// Rewrite message for output
$message = sprintf(
getMessage('MAILER_HAS_DIED'),
- basename($F),
- $L,
+ basename($file),
+ $line,
$message
);
* app_exit() is more a "private" function and will only output a bug message to
* the user, no email and no logging.
*
- * @param $F Function or file basename where the error came from
- * @param $L Line number where the error came from
+ * @param $file Function or file basename where the error came from
+ * @param $line Line number where the error came from
* @param $sendEmail Wether to send an email to all configured administrators
* @return void
*/
-function reportBug ($F, $L, $message = '', $sendEmail = TRUE) {
+function reportBug ($file, $line, $message = '', $sendEmail = TRUE) {
// Is this already called?
if (isset($GLOBALS[__FUNCTION__])) {
// Other backtrace
- print '[' . $F . ':' . $L . ':] ' . __FUNCTION__ . ' has already died! Message:' . $message . '<br />Backtrace:<pre>';
+ print '[' . $file . ':' . $line . ':] ' . __FUNCTION__ . ' has already died! Message:' . $message . '<br />Backtrace:<pre>';
debug_print_backtrace();
die('</pre>');
} // END - if
);
// @TODO Add a little more infos here
- logDebugMessage($F, $L, strip_tags($message));
+ logDebugMessage($file, $line, strip_tags($message));
} // END - if
// Add output
// Is there HTML/CSS/AJAX mode?
if (((isHtmlOutputMode()) || (isCssOutputMode()) || (isAjaxOutputMode())) && (isDebugModeEnabled())) {
// And abort here
- app_exit($F, $L, $debug);
+ app_exit($file, $line, $debug);
} else {
// Raw/image output mode and all other modes doesn't work well with text ...
die();
$GLOBALS['frameset_mode'] = TRUE;
} // END - if
- // Init result for below SQL_NUMROWS() function
+ // Init result for below sqlNumRows() function
$result_main = FALSE;
// Maybe he wants to confirm an email?