initSqls();
// Is a database link here and not in installation mode?
- if ((!SQL_IS_LINK_UP()) && (!isInstallationPhase())) {
+ if ((!isSqlLinkUp()) && (!isInstallationPhase())) {
// Abort here
reportBug(__FUNCTION__, __LINE__, 'No database link is up. Cannot flush filters.');
- } elseif ((isInstallationPhase()) && (!SQL_IS_LINK_UP())) {
+ } elseif ((isInstallationPhase()) && (!isSqlLinkUp())) {
// If the link is not up in installation phase, skip flushing filters
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters: No link is up.');
return;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
if (((!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) && ($active != 'R')) || ($active == 'A')) {
// Is this filter already in database?
- if (countSumTotalData($filterFunction, 'filters', 'filter_name', 'filter_function', TRUE, sprintf(" AND `filter_name`='%s'", SQL_ESCAPE($filterName))) == 0) {
+ if (countSumTotalData($filterFunction, 'filters', 'filter_name', 'filter_function', TRUE, sprintf(" AND `filter_name`='%s'", sqlEscapeString($filterName))) == 0) {
// Add this filter (all filters are active by default)
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ADD:'.$filterName.'/'.$filterFunction);
$insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
if ((substr(strtolower($sql), 0, 11) == 'alter table') && (!isset($filterData['ext_installing']))) {
// Analyse the alteration command
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Alterting table: ' . $sql . ',enable_codes=' . intval($filterData['enable_codes']));
- SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__, $filterData['enable_codes']);
+ sqlQueryAlterTable($sql, __FUNCTION__, __LINE__, $filterData['enable_codes']);
} else {
// Run regular SQL command
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running regular query: ' . $sql . ',enable_codes=' . intval($filterData['enable_codes']));
- SQL_QUERY($sql, __FUNCTION__, __LINE__, $filterData['enable_codes']);
+ sqlQuery($sql, __FUNCTION__, __LINE__, $filterData['enable_codes']);
}
// Has a line changed?
- if (!SQL_HASZEROAFFECTED()) {
+ if (!ifSqlHasZeroAffectedRows()) {
// Add it to total account
- $count += SQL_AFFECTEDROWS();
+ $count += sqlAffectedRows();
} // END - if
} // END - if
} // END - foreach
// Runs some generic filter update steps
function FILTER_UPDATE_EXTENSION_DATA ($ext_name) {
// Create task (we ignore the task id here)
- createExtensionUpdateTask(getCurrentAdminId(), $ext_name, $GLOBALS['update_ver'][$ext_name], SQL_ESCAPE(getExtensionNotes(getExtensionNotes())));
+ createExtensionUpdateTask(getCurrentAdminId(), $ext_name, $GLOBALS['update_ver'][$ext_name], sqlEscapeString(getExtensionNotes(getExtensionNotes())));
// Update extension's version
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_version`='%s' WHERE `ext_name`='%s' LIMIT 1",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_version`='%s' WHERE `ext_name`='%s' LIMIT 1",
array($GLOBALS['update_ver'][$ext_name], $ext_name), __FUNCTION__, __LINE__);
// Remove arrays
// Filter for removing the given extension
function FILTER_REMOVE_EXTENSION () {
// Delete this extension (remember to remove it from your server *before* you click on welcome!
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array(getCurrentExtensionName()), __FUNCTION__, __LINE__);
// Remove the extension from cache array as well
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ' - ENTERED!');
// Count module click
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
+ 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!');
}
// Remmeber login failures if available
if (isExtensionInstalledAndNewer('user', '0.3.7')) {
// Reset login failures
- SQL_QUERY_ESC("UPDATE
+ sqlQueryEscaped("UPDATE
`{?_MYSQL_PREFIX?}_user_data`
SET
`login_failures`=0,
$GLOBALS['__page_header'] .= loadTemplate(getMenuModeFromModule() . '_metadata', TRUE);
// Add meta description to header
- if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP()) && (getModule() == 'index')) {
+ if ((isInstalled()) && (isAdminRegistered()) && (isSqlLinkUp()) && (getModule() == 'index')) {
// Add meta description not in admin and login module and when the script is installed
generateMetaDescriptionCode();
} // END - if
// Filter to add history entry
function FILTER_ADD_HISTORY_ENTRY ($filterData) {
// Add the entry
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_history` (`history_subject`, `history_userid`, `history_value`) VALUES ('%s',%s,'%s')",
+ sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_history` (`history_subject`, `history_userid`, `history_value`) VALUES ('%s',%s,'%s')",
$filterData,
__FUNCTION__, __LINE__);
// Remember insert id for other filters
- $filterData['history_id'] = SQL_INSERT_ID();
+ $filterData['history_id'] = getSqlInsertId();
// Return data
return $filterData;
// Check required parameters
if ((isGetRequestElementSet('user')) && (isGetRequestElementSet('banner'))) {
// Update clicks counter...
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__);
// A line has been updated?
- if ((!SQL_HASZEROAFFECTED()) && (isGetRequestElementSet('user'))) {
+ if ((!ifSqlHasZeroAffectedRows()) && (isGetRequestElementSet('user'))) {
// Redirect to the user's referral link
redirectToUrl('ref.php?refid=' . bigintval(getRequestElement('user')));
} // END - if
// Are all required parameters set
if ((isGetRequestElementSet('user')) && (isGetRequestElementSet('banner'))) {
// For later things... ;-)
- $result = SQL_QUERY_ESC("SELECT `url` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1",
+ $result = sqlQueryEscaped("SELECT `url` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__);
// Is there the banner?
- if (SQL_NUMROWS($result) == 1) {
+ if (sqlNumRows($result) == 1) {
// Load the URL
- $data = SQL_FETCHARRAY($result);
+ $data = sqlFetchArray($result);
// Update counter
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `counter`=`counter`+1 WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `counter`=`counter`+1 WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__);
// Set header and ...
logDebugMessage(__FUNCTION__, __LINE__, 'Banner ' . bigintval(getRequestElement('banner')) . ' not found.');
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
} // END - if
// Do nothing for now
// Is purging configured?
if ((isApServerNameEnabled()) && (getApServerNameSince() > 0)) {
// Then start purging
- SQL_QUERY('DELETE LOW_PRIORITY FROM
+ sqlQuery('DELETE LOW_PRIORITY FROM
`{?_MYSQL_PREFIX?}_server_name_log`
WHERE
(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`server_name_added`)) >= {?ap_server_name_since?}',
__FILE__, __LINE__);
// Are some entries deleted?
- if (SQL_AFFECTEDROWS() > 0) {
+ if (sqlAffectedRows() > 0) {
// Okay, then send an email to the admin
- sendAdminNotification('{--ADMIN_PURGE_USER_SERVER_NAME_LOG_SUBJECT--}', 'admin_purge_user_server_name_log', SQL_AFFECTEDROWS());
+ sendAdminNotification('{--ADMIN_PURGE_USER_SERVER_NAME_LOG_SUBJECT--}', 'admin_purge_user_server_name_log', sqlAffectedRows());
} // END - if
} // END - if