From 155492a5b96cec674846973a8524238b0365a848 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 6 Mar 2013 00:24:19 +0000 Subject: [PATCH] Renamed all SQL-related functions to camel-case notation --- DOCS/de/SECURITY.txt | 2 +- DOCS/de/TODO.txt | 4 +- DOCS/en/SECURITY.txt | 2 +- DOCS/en/TODO.txt | 4 +- beg.php | 12 +- birthday_confirm.php | 10 +- debug.php | 2 +- doubler.php | 4 +- inc/ajax/ajax_installer.php | 8 +- inc/callback-functions.php | 2 +- inc/classes/resolver.class.php | 14 +- inc/config-functions.php | 18 +- inc/daily/daily_100_bonus.php | 12 +- inc/daily/daily_birthday.php | 12 +- inc/daily/daily_holiday.php | 18 +- inc/daily/daily_order.php | 2 +- inc/daily/daily_profile.php | 10 +- inc/daily/daily_user.php | 24 +- inc/daily/daily_user_subids.php | 6 +- inc/db/lib-mysql3.php | 80 ++--- inc/extensions-functions.php | 64 ++-- inc/extensions/ext-mydata.php | 2 +- inc/extensions/ext-rewrite.php | 4 +- inc/extensions/order/mode-update.php | 2 +- inc/filter-functions.php | 8 +- inc/filter/beg_filter.php | 2 +- inc/filter/bonus_filter.php | 4 +- inc/filter/earning_filter.php | 8 +- inc/filter/online_filter.php | 14 +- inc/filter/rallye_filter.php | 12 +- inc/filter/register_filter.php | 6 +- inc/filter/user_filter.php | 18 +- inc/filters.php | 50 +-- inc/fix_filters.php | 10 +- inc/fix_menu.php | 10 +- inc/fix_refsystem.php | 22 +- inc/fix_user_points.php | 16 +- inc/functions.php | 26 +- inc/gen_mediadata.php | 12 +- inc/http-functions.php | 6 +- inc/install-functions.php | 16 +- inc/install/install_page_finalize.php | 6 +- inc/language/de.php | 4 +- inc/libs/admins_functions.php | 108 +++---- inc/libs/beg_functions.php | 4 +- inc/libs/blacklist_functions.php | 12 +- inc/libs/bonus_functions.php | 30 +- inc/libs/booking_functions.php | 2 +- inc/libs/country_functions.php | 8 +- inc/libs/doubler_functions.php | 8 +- inc/libs/earning_functions.php | 8 +- inc/libs/forced_functions.php | 32 +- inc/libs/grade_functions.php | 8 +- inc/libs/holiday_functions.php | 12 +- inc/libs/jackpot_functions.php | 18 +- inc/libs/mailid_functions.php | 12 +- inc/libs/mediadata_functions.php | 18 +- inc/libs/network_functions.php | 192 ++++++------ inc/libs/optimize_functions.php | 24 +- inc/libs/payout_functions.php | 8 +- inc/libs/rallye_functions.php | 110 +++---- inc/libs/refback_functions.php | 46 +-- inc/libs/register_functions.php | 54 ++-- inc/libs/sponsor_functions.php | 62 ++-- inc/libs/surfbar_functions.php | 126 ++++---- inc/libs/task_functions.php | 8 +- inc/libs/theme_functions.php | 34 +- inc/libs/transfer_functions.php | 24 +- inc/libs/user_functions.php | 58 ++-- inc/libs/wernis_functions.php | 2 +- inc/libs/yoomedia_functions.php | 16 +- inc/loader/load- | 6 +- inc/loader/load-admins.php | 12 +- inc/loader/load-config.php | 6 +- inc/loader/load-earning.php | 6 +- inc/loader/load-extension.php | 8 +- inc/loader/load-filter.php | 6 +- inc/loader/load-imprint.php | 6 +- inc/loader/load-modules.php | 8 +- inc/loader/load-payments.php | 6 +- inc/loader/load-points_data.php | 6 +- inc/loader/load-refdepths.php | 6 +- inc/loader/load-refsystem.php | 6 +- inc/loader/load-themes.php | 8 +- inc/mails/beg_mails.php | 12 +- inc/mails/bonus_mails.php | 12 +- inc/mails/doubler_mails.php | 22 +- inc/module-functions.php | 34 +- inc/modules/admin/admin-inc.php | 160 +++++----- inc/modules/admin/overview-inc.php | 40 +-- inc/modules/admin/what-add_points.php | 10 +- inc/modules/admin/what-add_rallye.php | 10 +- inc/modules/admin/what-admin_add.php | 20 +- inc/modules/admin/what-adminedit.php | 30 +- inc/modules/admin/what-admins_mails.php | 22 +- inc/modules/admin/what-config_home.php | 6 +- inc/modules/admin/what-config_imprint.php | 6 +- inc/modules/admin/what-config_network_api.php | 16 +- .../admin/what-config_network_types.php | 32 +- inc/modules/admin/what-config_payouts.php | 38 +-- inc/modules/admin/what-config_register.php | 10 +- inc/modules/admin/what-config_rewrite.php | 6 +- inc/modules/admin/what-del_email.php | 50 +-- inc/modules/admin/what-del_holiday.php | 22 +- inc/modules/admin/what-del_sponsor.php | 14 +- inc/modules/admin/what-del_transfer.php | 12 +- inc/modules/admin/what-edit_emails.php | 18 +- inc/modules/admin/what-edit_sponsor.php | 12 +- inc/modules/admin/what-edit_user.php | 10 +- inc/modules/admin/what-email_archiv.php | 20 +- inc/modules/admin/what-email_details.php | 32 +- inc/modules/admin/what-extensions.php | 36 +-- inc/modules/admin/what-guest_add.php | 20 +- inc/modules/admin/what-guestedit.php | 36 +-- inc/modules/admin/what-list_admins_acls.php | 32 +- inc/modules/admin/what-list_autopurge.php | 8 +- inc/modules/admin/what-list_bank_package.php | 8 +- inc/modules/admin/what-list_beg.php | 6 +- inc/modules/admin/what-list_bonus.php | 6 +- inc/modules/admin/what-list_cats.php | 28 +- inc/modules/admin/what-list_country.php | 24 +- inc/modules/admin/what-list_coupon.php | 16 +- inc/modules/admin/what-list_email_max_rec.php | 32 +- inc/modules/admin/what-list_holiday.php | 8 +- inc/modules/admin/what-list_links.php | 26 +- inc/modules/admin/what-list_mods.php | 14 +- .../what-list_network_array_translation.php | 8 +- inc/modules/admin/what-list_network_data.php | 8 +- .../what-list_network_request_params.php | 8 +- inc/modules/admin/what-list_network_types.php | 8 +- inc/modules/admin/what-list_notifications.php | 14 +- inc/modules/admin/what-list_payouts.php | 38 +-- inc/modules/admin/what-list_rallye_prices.php | 40 +-- inc/modules/admin/what-list_rallyes.php | 44 +-- inc/modules/admin/what-list_refs.php | 16 +- inc/modules/admin/what-list_sponsor.php | 28 +- inc/modules/admin/what-list_sponsor_pay.php | 28 +- inc/modules/admin/what-list_sponsor_pays.php | 6 +- inc/modules/admin/what-list_task.php | 12 +- inc/modules/admin/what-list_transfer.php | 8 +- inc/modules/admin/what-list_unconfirmed.php | 18 +- inc/modules/admin/what-list_user.php | 30 +- inc/modules/admin/what-list_user_amounts.php | 8 +- inc/modules/admin/what-list_user_cats.php | 12 +- inc/modules/admin/what-list_user_subid.php | 2 +- inc/modules/admin/what-list_wernis.php | 8 +- inc/modules/admin/what-lock_sponsor.php | 10 +- inc/modules/admin/what-lock_user.php | 12 +- inc/modules/admin/what-logs.php | 2 +- inc/modules/admin/what-mem_add.php | 20 +- inc/modules/admin/what-memedit.php | 36 +-- inc/modules/admin/what-payments.php | 20 +- inc/modules/admin/what-refbanner.php | 28 +- inc/modules/admin/what-repair_amnu.php | 18 +- inc/modules/admin/what-repair_cats.php | 10 +- inc/modules/admin/what-repair_gmnu.php | 18 +- inc/modules/admin/what-repair_mmnu.php | 18 +- inc/modules/admin/what-send_coupon.php | 16 +- inc/modules/admin/what-send_newsletter.php | 8 +- inc/modules/admin/what-stats_mods.php | 12 +- inc/modules/admin/what-sub_points.php | 10 +- inc/modules/admin/what-surfbar_stats.php | 14 +- inc/modules/admin/what-theme_edit.php | 12 +- inc/modules/admin/what-theme_import.php | 4 +- inc/modules/admin/what-unlock_emails.php | 10 +- inc/modules/admin/what-unlock_sponsor.php | 36 +-- inc/modules/admin/what-usage.php | 2 +- inc/modules/admin/what-usr_online.php | 8 +- inc/modules/frametester.php | 2 +- inc/modules/guest/what-active.php | 6 +- inc/modules/guest/what-login.php | 6 +- inc/modules/guest/what-mediadata.php | 30 +- inc/modules/guest/what-rallyes.php | 6 +- inc/modules/guest/what-register.php | 2 +- inc/modules/guest/what-sponsor_infos.php | 16 +- inc/modules/guest/what-sponsor_login.php | 42 +-- inc/modules/guest/what-sponsor_reg.php | 16 +- inc/modules/guest/what-stats.php | 30 +- inc/modules/guest/what-top10.php | 18 +- inc/modules/member/what-beg2.php | 8 +- inc/modules/member/what-bonus.php | 8 +- inc/modules/member/what-cash_coupon.php | 20 +- inc/modules/member/what-categories.php | 12 +- inc/modules/member/what-earning.php | 16 +- inc/modules/member/what-holiday.php | 56 ++-- inc/modules/member/what-html_mail.php | 2 +- inc/modules/member/what-list_coupon.php | 8 +- inc/modules/member/what-mydata.php | 16 +- inc/modules/member/what-nickname.php | 8 +- inc/modules/member/what-order.php | 70 ++--- inc/modules/member/what-payout.php | 26 +- inc/modules/member/what-points.php | 16 +- inc/modules/member/what-rallyes.php | 8 +- inc/modules/member/what-refback.php | 8 +- inc/modules/member/what-reflinks.php | 8 +- inc/modules/member/what-reflist.php | 8 +- inc/modules/member/what-stats.php | 16 +- inc/modules/member/what-subids.php | 2 +- inc/modules/member/what-themes.php | 4 +- inc/modules/member/what-transfer.php | 70 ++--- inc/modules/member/what-unconfirmed.php | 32 +- inc/modules/member/what-wernis.php | 10 +- inc/modules/sponsor/account.php | 8 +- inc/modules/sponsor/settings.php | 8 +- inc/modules/sponsor/welcome.php | 6 +- inc/monthly/monthly_beg.php | 10 +- inc/monthly/monthly_bonus.php | 10 +- inc/mysql-manager.php | 296 +++++++++--------- inc/pool-functions.php | 22 +- inc/pool/pool-bonus.php | 14 +- inc/pool/pool-user.php | 30 +- inc/purge/purge-coupon.php | 12 +- inc/purge/purge-general.php | 36 +-- inc/purge/purge-inact.php | 18 +- inc/purge/purge-mails.php | 26 +- inc/purge/purge-tasks.php | 12 +- inc/purge/purge-unconfirmed.php | 8 +- inc/referral-functions.php | 64 ++-- inc/request-functions.php | 20 +- inc/session-functions.php | 2 +- inc/sql-functions.php | 102 +++--- inc/stats-functions.php | 24 +- inc/template-functions.php | 2 +- inc/wrapper-functions.php | 8 +- mailid.php | 36 +-- show_bonus.php | 8 +- 226 files changed, 2367 insertions(+), 2367 deletions(-) diff --git a/DOCS/de/SECURITY.txt b/DOCS/de/SECURITY.txt index dab710d70c..ccf07b9ba1 100644 --- a/DOCS/de/SECURITY.txt +++ b/DOCS/de/SECURITY.txt @@ -125,7 +125,7 @@ Bis zur Version 0.2.0-pre10 mit Patch-Level 485 und aelter war es fuer einen entfernten Angreifer theoretisch moeglich, SQL-Befehle einzuschleusen und auch Attacken auf die Variable $PHP_SELF durchzufueheren. Seit Patch 486 und 487 (laden Sie sich am Besten immer die aktuellsten Patches herunter!) sind nun -entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion SQL_QUERY_ESC) +entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion sqlQueryEscaped) entfernt und sollten nicht mehr angreifbar sein. Der generierten SQL-Befehl wurde vor der Ausfuehrung nochmals "uebersetzt", also alle sicherheitsgefaehrdenen Zeichen wieder eingebaut. Zudem existiert im Script diff --git a/DOCS/de/TODO.txt b/DOCS/de/TODO.txt index 90915f1d46..f755befd16 100644 --- a/DOCS/de/TODO.txt +++ b/DOCS/de/TODO.txt @@ -32,10 +32,10 @@ - Den gesamten HTML-Code auf XHTML portieren und mit http://validator.w3.org validieren - Replace all HTTP_GET_VARS and HTTP_POST_VARS with _GET and _POST -- Replace SQL_QUERY() command with SQL_QUERY_ESC() commands where ever it is +- Replace sqlQuery() command with sqlQueryEscaped() commands where ever it is needed to secure SQL queries. - Secure ID numbers with bigintval() - Secure other non-numberous data with sprintf() and later with new security functions -- Use the abstract function SQL_FREERESULT() wherever we transfer massive data +- Use the abstract function sqlFreeResult() wherever we transfer massive data from the database to free memory diff --git a/DOCS/en/SECURITY.txt b/DOCS/en/SECURITY.txt index 5e50920a03..e0cea8967a 100644 --- a/DOCS/en/SECURITY.txt +++ b/DOCS/en/SECURITY.txt @@ -122,7 +122,7 @@ Bis zur Version 0.2.0-pre10 mit Patch-Level 485 und aelter war es fuer einen entfernten Angreifer theoretisch moeglich, SQL-Befehle einzuschleusen und auch Attacken auf die Variable $PHP_SELF durchzufueheren. Seit Patch 486 und 487 (laden Sie sich am Besten immer die aktuellsten Patches herunter!) sind nun -entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion SQL_QUERY_ESC) +entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion sqlQueryEscaped) entfernt sollten nicht mehr angreifbar sein. Der generierten SQL-Befehl wurde vor der Ausfuehrung nochmals "uebersetzt", also alle sicherheitsgefaehrdenen Zeichen wieder eingebaut. Zudem existiert im Script diff --git a/DOCS/en/TODO.txt b/DOCS/en/TODO.txt index 481a7c11e9..f316a25df3 100644 --- a/DOCS/en/TODO.txt +++ b/DOCS/en/TODO.txt @@ -5,9 +5,9 @@ TODO - Extend the documenation! - Complete english language translation -- Replace SQL_QUERY() command with SQL_QUERY_ESC() commands where ever it is +- Replace sqlQuery() command with sqlQueryEscaped() commands where ever it is needed to secure SQL queries. -- Use the abstract function SQL_FREERESULT() wherever we trasnfer massive data +- Use the abstract function sqlFreeResult() wherever we trasnfer massive data from the database to free memory - Simplify CSS classes - Add more database abstraction layers like ODBC/M$SQL/Oracle diff --git a/beg.php b/beg.php index d585e56cfc..81cb992df9 100644 --- a/beg.php +++ b/beg.php @@ -96,11 +96,11 @@ if (isGetRequestElementSet('userid')) { // User id valid and not webmaster's id? if ((isValidId(getUserData('userid'))) && (getBegUserid() != getUserData('userid'))) { // Update counter - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_clicks`=`beg_clicks`+1 WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_clicks`=`beg_clicks`+1 WHERE `userid`=%s LIMIT 1", array(getUserData('userid')), __FILE__, __LINE__); // Check for last entry for userid w/o IP number 12 33 2 23 44 3 21 1 1 - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE ((UNIX_TIMESTAMP() - `timeout`) >= {?beg_timeout?} OR ((UNIX_TIMESTAMP() - `timeout`) >= {?beg_userid_timeout?} AND `userid`=%s)) AND (`remote_ip`='%s' OR `sid`='%s') LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE ((UNIX_TIMESTAMP() - `timeout`) >= {?beg_timeout?} OR ((UNIX_TIMESTAMP() - `timeout`) >= {?beg_userid_timeout?} AND `userid`=%s)) AND (`remote_ip`='%s' OR `sid`='%s') LIMIT 1", array( getUserData('userid'), determineRealRemoteAddress(), @@ -109,7 +109,7 @@ if (isGetRequestElementSet('userid')) { // Entry not found, points set and not logged in? //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'SQL_HASZERONUMS()=' . intval(SQL_HASZERONUMS($result)) . ',isAdmin()=' . intval(isAdmin()) . ',points=' . $points . ',isMember()=' . intval(isMember()) . ',getBegPayMode()=' . getBegPayMode()); - if ((SQL_HASZERONUMS($result)) && ($points > 0) && (getBegPayMode() == 'NONE') && ((!isMember()) || (isAdmin()))) { + if ((ifSqlHasZeroNums($result)) && ($points > 0) && (getBegPayMode() == 'NONE') && ((!isMember()) || (isAdmin()))) { // Default is result from isAdmin(), mostly false $isPayed = isAdmin(); @@ -120,7 +120,7 @@ if (isGetRequestElementSet('userid')) { * but only when there is no admin begging. * Admins shall be able to test it! */ - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_beg_ips` (`userid`, `remote_ip`, `sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_beg_ips` (`userid`, `remote_ip`, `sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())", array( getUserData('userid'), determineRealRemoteAddress(), @@ -128,7 +128,7 @@ if (isGetRequestElementSet('userid')) { ), __FILE__, __LINE__); // Was is successfull? - $isPayed = (!SQL_HASZEROAFFECTED()); + $isPayed = (!ifSqlHasZeroAffectedRows()); } // END - if // Pay points? @@ -159,7 +159,7 @@ if (isGetRequestElementSet('userid')) { } // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Include header loadIncludeOnce('inc/header.php'); diff --git a/birthday_confirm.php b/birthday_confirm.php index 219a15f5cf..e3827d80f6 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -61,7 +61,7 @@ $userid = bigintval(getRequestElement('userid')); $chk = bigintval(getRequestElement('check'), FALSE); // Check if link is not clicked so far -$result = SQL_QUERY_ESC("SELECT +$result = sqlQueryEscaped("SELECT `b`.`points`, `d`.`userid`, `d`.`gender`, @@ -89,9 +89,9 @@ LIMIT 1", $content = array(); // Is an entry there? -if (SQL_NUMROWS($result) == 1) { +if (sqlNumRows($result) == 1) { // Ok, congratulation again! Here's your gift from us... - $data = SQL_FETCHARRAY($result, FALSE); + $data = sqlFetchArray($result, FALSE); // Is the account confirmed? if ($data['status'] == 'CONFIRMED') { @@ -100,7 +100,7 @@ if (SQL_NUMROWS($result) == 1) { addPointsThroughReferralSystem('birthday_confirm', $userid, $data['points']); // Remove entry from table - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1", array($userid, $chk), __FILE__, __LINE__); // Load message from template @@ -115,7 +115,7 @@ if (SQL_NUMROWS($result) == 1) { } // Free memory -SQL_FREERESULT($result); +sqlFreeResult($result); // Set this because there is no module in URI $GLOBALS['__module'] = 'birthday_confirm'; diff --git a/debug.php b/debug.php index 36638d2705..10af24c857 100644 --- a/debug.php +++ b/debug.php @@ -57,7 +57,7 @@ if ((isExtensionActive('debug')) && (!ifFatalErrorsDetected())) { // Construct FQFN for the module $inc = sprintf("inc/debug/%s/request_%s.php", getConfig('debug_mode'), - SQL_ESCAPE(postRequestElement('request')) + sqlEscapeString(postRequestElement('request')) ); // Is the module there? Else we log it! diff --git a/doubler.php b/doubler.php index 72f7123cf1..5d4c3ce092 100644 --- a/doubler.php +++ b/doubler.php @@ -99,7 +99,7 @@ if (isFormSent()) { if (($points - getConfig('doubler_left') - postRequestElement('points') * getDoublerCharge() / 100) >= 0) { // Enough points are left so let's continue with the doubling process // Create doubling "account" with *DOUBLED* points - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')", array( getUserData('userid'), convertZeroToNull(determineReferralId()), @@ -118,7 +118,7 @@ if (isFormSent()) { // Add second line for the referral but only when userid != refid if ((isValidId(determineReferralId())) && (determineReferralId() != getUserData('userid'))) { // Okay add a refid line and apply refid percents - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')", array( convertZeroToNull(determineReferralId()), (postRequestElement('points') * 2 * getDoublerRef() / 100), diff --git a/inc/ajax/ajax_installer.php b/inc/ajax/ajax_installer.php index 55b2be00c7..108fd3e913 100644 --- a/inc/ajax/ajax_installer.php +++ b/inc/ajax/ajax_installer.php @@ -57,7 +57,7 @@ function establishAjaxInstallerDatabaseLink () { unsetSqlLinkUp(__FUNCTION__, __LINE__); // Establish link - $linkResource = SQL_CONNECT(getSession('mysql_host'), getSession('mysql_login'), getSession('mysql_password1'), __FUNCTION__, __LINE__); + $linkResource = sqlConnectToDatabase(getSession('mysql_host'), getSession('mysql_login'), getSession('mysql_password1'), __FUNCTION__, __LINE__); // Is this a link resource? if (!is_resource($linkResource)) { @@ -66,7 +66,7 @@ function establishAjaxInstallerDatabaseLink () { } // END - if // Does selecting the database work? - if (!SQL_SELECT_DB(getSession('mysql_dbase'), __FUNCTION__, __LINE__)) { + if (!sqlSelectDatabase(getSession('mysql_dbase'), __FUNCTION__, __LINE__)) { // Could not be selected reportBug(__FUNCTION__, __LINE__, 'Could not select database ' . getSession('mysql_dbase')); } elseif ((!isFileReadable(getSession('base_path') . 'install/tables.sql')) || (!isFileReadable(getSession('base_path') . 'install/menu-'.getLanguage().'.sql'))) { @@ -578,7 +578,7 @@ function doAjaxInstallerStepImportTablesSql () { runFilterChain('run_sqls'); // Close SQL link - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); } // Call-back function to import menu SQL file @@ -602,7 +602,7 @@ function doAjaxInstallerStepImportMenuSql () { runFilterChain('run_sqls'); // Close SQL link - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); } // Call-back function to install some important extensions diff --git a/inc/callback-functions.php b/inc/callback-functions.php index 3a3edebb5a..821bbd4daf 100644 --- a/inc/callback-functions.php +++ b/inc/callback-functions.php @@ -1349,7 +1349,7 @@ function doXmlNoEntryFoundMessage ($resource, $attributes) { // Checks for string without any added extra data function isXmlTypeString ($value) { // Just let SQL_ESCAPE() do the job - return ($value == SQL_ESCAPE($value)); + return ($value == sqlEscapeString($value)); } // Fake-check for array type diff --git a/inc/classes/resolver.class.php b/inc/classes/resolver.class.php index 09846cf513..aca38bb875 100644 --- a/inc/classes/resolver.class.php +++ b/inc/classes/resolver.class.php @@ -66,13 +66,13 @@ class HostnameResolver { $ret = '0.0.0.0'; // Search for hostname in cache - $result = SQL_QUERY_ESC("SELECT `ip` FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE `hostname`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `ip` FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE `hostname`='%s' LIMIT 1", array($hostname), __METHOD__, __LINE__); // Does an entry exist? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then load the hostname - list($ip) = SQL_FETCHROW($result); + list($ip) = sqlFetchRow($result); // Count cache hit incrementStatsEntry('dns_cache_hits'); @@ -93,7 +93,7 @@ class HostnameResolver { // Seems to be an IP! Now check deeper... if (($matches[0] == $ip) && ($matches[1] >= 0) && ($matches[1] <= 255) && ($matches[2] >= 0) && ($matches[2] <= 255) && ($matches[3] >= 0) && ($matches[3] <= 255) && ($matches[4] > 0) && ($matches[4] < 255)) { // We also cache IP addresses - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())", array($ip, $hostname), __METHOD__, __LINE__); // Set return value to $ip @@ -108,7 +108,7 @@ class HostnameResolver { //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("Cannot lookup: %s", $hostname)); } else { // Put entry in DB - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_dns_cache` (`ip`, `hostname`, `added`) VALUES ('%s', '%s', NOW())", array($ip, $hostname), __METHOD__, __LINE__); // Set return value to $ip @@ -118,7 +118,7 @@ class HostnameResolver { } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return IP number (let's hope it) return $ret; @@ -127,7 +127,7 @@ class HostnameResolver { // Purge old entries function purgeEntries() { // SQL for cleaning up - SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`added`) >= {?dns_cache_timeout?})', + sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`added`) >= {?dns_cache_timeout?})', __METHOD__, __LINE__); } } diff --git a/inc/config-functions.php b/inc/config-functions.php index c9925db2fc..4fd2eca376 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -334,7 +334,7 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0' setConfigEntry($entry, $values[$idx]); } else { // String detected - $SQL .= sprintf("`%s`='%s',", $entry, SQL_ESCAPE($values[$idx])); + $SQL .= sprintf("`%s`='%s',", $entry, sqlEscapeString($values[$idx])); // Set it in config as well setConfigEntry($entry, $values[$idx]); @@ -368,15 +368,15 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0' setConfigEntry($entries, time()); } else { // Regular entry to update - $SQL = sprintf("`%s`='%s'", $entries, SQL_ESCAPE($values)); + $SQL = sprintf("`%s`='%s'", $entries, sqlEscapeString($values)); // Set it in config as well - setConfigEntry($entries, SQL_ESCAPE($values)); + setConfigEntry($entries, sqlEscapeString($values)); } // Run database update //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SQL=' . $SQL); - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_config` SET ".$SQL." WHERE `config`=%s LIMIT 1", + 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()); @@ -402,21 +402,21 @@ function FILTER_LOAD_CONFIGURATION ($no = '0') { // Load config from cache mergeConfig($GLOBALS['cache_array']['config'][$no]); - // Count cache hits + // Count cache hits incrementStatsEntry('cache_hits'); } elseif ((!isExtensionActive('cache')) || (!isset($GLOBALS['cache_array']['config'][$no]))) { // Load config from DB - $result_config = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_config` WHERE `config`='%s' LIMIT 1", + $result_config = sqlQueryEscaped("SELECT * FROM `{?_MYSQL_PREFIX?}_config` WHERE `config`='%s' LIMIT 1", array(bigintval($no)), __FUNCTION__, __LINE__); // Is the config there? - if (SQL_NUMROWS($result_config) == 1) { + if (sqlNumRows($result_config) == 1) { // Get config from database - mergeConfig(SQL_FETCHARRAY($result_config)); + mergeConfig(sqlFetchArray($result_config)); } // END - if // Free result - SQL_FREERESULT($result_config); + sqlFreeResult($result_config); // Remember this config in the array $GLOBALS['cache_array']['config'][$no] = getConfigArray(); diff --git a/inc/daily/daily_100_bonus.php b/inc/daily/daily_100_bonus.php index 65575ff328..4664ad29f8 100644 --- a/inc/daily/daily_100_bonus.php +++ b/inc/daily/daily_100_bonus.php @@ -50,7 +50,7 @@ if (!defined('__SECURITY')) { //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset started.'); // Check for 100% klickrate mails -$result_bonus = SQL_QUERY("SELECT +$result_bonus = sqlQuery("SELECT `id`, `userid`, `subject`, @@ -66,11 +66,11 @@ WHERE ORDER BY `userid` ASC", __FILE__, __LINE__); -if (!SQL_HASZERONUMS($result_bonus)) { +if (!ifSqlHasZeroNums($result_bonus)) { // We found some mail orders... - while ($content = SQL_FETCHARRAY($result_bonus)) { + while ($content = sqlFetchArray($result_bonus)) { // Add points - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_stats`=`bonus_stats`+{?bonus_stats?} WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_stats`=`bonus_stats`+{?bonus_stats?} WHERE `userid`=%s LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__); // Translate some data @@ -81,7 +81,7 @@ if (!SQL_HASZERONUMS($result_bonus)) { sendEmail($content['userid'], '{--MEMBER_BONUS_STATS_SUBJECT--}', $message); // Update database - $result_update = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `bonus_stats_active`='Y' WHERE `id`=%s LIMIT 1", + $result_update = sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `bonus_stats_active`='Y' WHERE `id`=%s LIMIT 1", array(bigintval($content['id'])), __FILE__, __LINE__); } // END - while @@ -90,7 +90,7 @@ if (!SQL_HASZERONUMS($result_bonus)) { } // END - if // Free memory -SQL_FREERESULT($result_bonus); +sqlFreeResult($result_bonus); // Debug line //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset ended.'); diff --git a/inc/daily/daily_birthday.php b/inc/daily/daily_birthday.php index 97f8b3775b..81aeb519b1 100644 --- a/inc/daily/daily_birthday.php +++ b/inc/daily/daily_birthday.php @@ -72,7 +72,7 @@ if (isExtensionActive('holiday')) { } // END - if // Only confirmed members shall receive birthday mails... -$result_birthday = SQL_QUERY_ESC("SELECT +$result_birthday = sqlQueryEscaped("SELECT `d`.`userid`, `d`.`email`, `d`.`birth_year` @@ -89,9 +89,9 @@ ORDER BY `d`.`userid` ASC", array($day, $month), __FILE__, __LINE__); -if (!SQL_HASZERONUMS($result_birthday)) { +if (!ifSqlHasZeroNums($result_birthday)) { // Start sending out birthday mails - while ($content = SQL_FETCHARRAY($result_birthday)) { + while ($content = sqlFetchArray($result_birthday)) { // Calculate own timestamp for birthday and today $bd = $content['birth_year'] + 12 * $month + 365 * $day; $now = $year + 12 * $month + 365 * $day; @@ -110,7 +110,7 @@ if (!SQL_HASZERONUMS($result_birthday)) { } // END - for // Insert row into database - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_birthday` (`userid`, `points`, `chk_value`) VALUES (%s,{?birthday_points?},'%s' )", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_birthday` (`userid`, `points`, `chk_value`) VALUES (%s,{?birthday_points?},'%s' )", array( bigintval($content['userid']), $content['check'] @@ -127,12 +127,12 @@ if (!SQL_HASZERONUMS($result_birthday)) { sendEmail($content['userid'], '{--MEMBER_HAPPY_BIRTHDAY_SUBJECT--}', $message); // Remember him that he has received a birthday mail - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__); } // END - while // Free memory - SQL_FREERESULT($result_birthday); + sqlFreeResult($result_birthday); } // END - if // Debug line diff --git a/inc/daily/daily_holiday.php b/inc/daily/daily_holiday.php index b35ae3e79d..1470a27983 100644 --- a/inc/daily/daily_holiday.php +++ b/inc/daily/daily_holiday.php @@ -50,7 +50,7 @@ if (!defined('__SECURITY')) { //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset started.'); // Check for holidays we need to enable and send email to user -$result_main = SQL_QUERY("SELECT +$result_main = sqlQuery("SELECT `userid`, `holiday_activated` FROM @@ -64,14 +64,14 @@ ORDER BY __FILE__, __LINE__); // Entries found? -if (!SQL_HASZERONUMS($result_main)) { +if (!ifSqlHasZeroNums($result_main)) { // Init SQLs initSqls(); // We have found at least one useraccount so let's check it... - while ($content = SQL_FETCHARRAY($result_main)) { + while ($content = sqlFetchArray($result_main)) { // Check if his holiday can be activated - $result_holiday = SQL_QUERY_ESC("SELECT + $result_holiday = sqlQueryEscaped("SELECT `holiday_start`, `holiday_end` FROM @@ -84,9 +84,9 @@ LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result_holiday) == 1) { + if (sqlNumRows($result_holiday) == 1) { // Okay, this user can be send away to holiday... - $content = merge_array($content, SQL_FETCHARRAY($result_holiday)); + $content = merge_array($content, sqlFetchArray($result_holiday)); // Prepare all data for the template $content = merge_array($content, array( @@ -100,7 +100,7 @@ LIMIT 1", sendEmail($content['userid'], '{--MEMBER_HOLIDAY_ACTIVATED_SUBJECT--}', $message); // Update account - addSql(SQL_QUERY_ESC("UPDATE + addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `holiday_active`='Y' @@ -111,7 +111,7 @@ LIMIT 1", } // END - if // Free memory - SQL_FREERESULT($result_holiday); + sqlFreeResult($result_holiday); } // END - while // Run all SQLs @@ -119,7 +119,7 @@ LIMIT 1", } // END - if // Free memory -SQL_FREERESULT($result_main); +sqlFreeResult($result_main); // Stop currently activated holidays stopHolidays(); diff --git a/inc/daily/daily_order.php b/inc/daily/daily_order.php index d60e59d865..40f14ca9c4 100644 --- a/inc/daily/daily_order.php +++ b/inc/daily/daily_order.php @@ -50,7 +50,7 @@ if (!defined('__SECURITY')) { //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset started.'); // Reset mail order values -$result_ext = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__); +$result_ext = sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__); // Debug line //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset ended.'); diff --git a/inc/daily/daily_profile.php b/inc/daily/daily_profile.php index 34e7445123..6e76ce4075 100644 --- a/inc/daily/daily_profile.php +++ b/inc/daily/daily_profile.php @@ -52,7 +52,7 @@ if (!defined('__SECURITY')) { if ((isSendProfileUpdateEnabled()) && (getProfileUpdate() > 0) && (getResendProfileUpdate() > 0)) { // Load personal data - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `userid`, `email`, `last_update`, @@ -76,9 +76,9 @@ ORDER BY `userid` ASC", __FILE__, __LINE__); // Are there some notifications to sent? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // We need to send-out notifications... - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Translate timestamp $content['joined'] = generateDateTime($content['joined'], '0'); @@ -95,7 +95,7 @@ ORDER BY sendEmail($content['userid'], '{--MEMBER_PROFILE_OUTDATED_SUBJECT--}', $message); // Update profile data - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_profile_sent`=UNIX_TIMESTAMP(), @@ -108,7 +108,7 @@ LIMIT 1", } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Debug line diff --git a/inc/daily/daily_user.php b/inc/daily/daily_user.php index 4979448bd9..575f65eec6 100644 --- a/inc/daily/daily_user.php +++ b/inc/daily/daily_user.php @@ -52,7 +52,7 @@ if (!defined('__SECURITY')) { // Update user profiles if (isExtensionInstalledAndNewer('order', '0.1.1')) { // Latest version - SQL_QUERY('UPDATE + sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `receive_mails`=`max_mails`, @@ -62,7 +62,7 @@ WHERE ' . runFilterChain('user_exclusion_sql', ' ') . '', __FILE__, __LINE__); } else { // Obsolete version - SQL_QUERY('UPDATE + sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `receive_mails`=`max_mails` @@ -72,7 +72,7 @@ WHERE } // Transfer points from locked_points to points -$result_daily = SQL_QUERY("SELECT +$result_daily = sqlQuery("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -84,16 +84,16 @@ ORDER BY `userid` ASC", __FILE__, __LINE__); //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;daily|numRows=' . SQL_NUMROWS($result_daily)); -if (!SQL_HASZERONUMS($result_daily)) { +if (!ifSqlHasZeroNums($result_daily)) { // Init SQLs initSqls(); // Run through all 'locked_(foo)_points columsn foreach (runFilterChain('locked_points_columns_array', array('points')) as $columnName) { // Start checking accounts which are on 0 confirmed-to-go mails - while ($content = SQL_FETCHARRAY($result_daily)) { + while ($content = sqlFetchArray($result_daily)) { //* DEBUG: */ debugOutput(basename(__FILE__) . ':' . $content['userid']); - $result_points = SQL_QUERY_ESC("SELECT + $result_points = sqlQueryEscaped("SELECT `ref_depth`, `locked_%s` FROM @@ -110,16 +110,16 @@ ORDER BY ), __FILE__, __LINE__); //* DEBUG: */ debugOutput(basename(__FILE__) . ':payout=0;points|numRows=' . SQL_NUMROWS($result_points)); - if (!SQL_HASZERONUMS($result_points)) { + if (!ifSqlHasZeroNums($result_points)) { // Ok transfer points - while ($content2 = SQL_FETCHARRAY($result_points)) { + while ($content2 = sqlFetchArray($result_points)) { // Merge both arrays $content = merge_array($content, $content2); //* DEBUG: */ debugOutput(basename(__FILE__) . ':userid=' . $content['userid'].',depth='.$content['ref_depth'].',columnName=' . $columnName . ',locked='.$content['locked_' . $columnName]); if ($content['ref_depth'] > 0) { // Level 1+ - addSql(SQL_QUERY_ESC("UPDATE + addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s, @@ -139,7 +139,7 @@ LIMIT 1", ); } else { // Level zero - addSql(SQL_QUERY_ESC("UPDATE + addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s, @@ -167,7 +167,7 @@ LIMIT 1", } // END - if // Free memory - SQL_FREERESULT($result_points); + sqlFreeResult($result_points); } // END - while } // END - foreach @@ -176,7 +176,7 @@ LIMIT 1", } // END - if // Free memory -SQL_FREERESULT($result_daily); +sqlFreeResult($result_daily); // Debug line //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset ended.'); diff --git a/inc/daily/daily_user_subids.php b/inc/daily/daily_user_subids.php index af0b636b56..cf4c8f3ae5 100644 --- a/inc/daily/daily_user_subids.php +++ b/inc/daily/daily_user_subids.php @@ -52,16 +52,16 @@ if (!defined('__SECURITY')) { // Is auto-purging activated and configured correctly? if ((isApSubidsEnabled()) && (getApSubidsSince() > 0)) { // Start purging - SQL_QUERY('DELETE LOW_PRIORITY FROM + sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_subid_log` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`entry_added`)) >= {?ap_subids_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_SUBID_LOG_SUBJECT--}', 'admin_purge_user_subid_log', SQL_AFFECTEDROWS()); + sendAdminNotification('{--ADMIN_PURGE_USER_SUBID_LOG_SUBJECT--}', 'admin_purge_user_subid_log', sqlAffectedRows()); } // END - if } // END - if diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 96210d25f1..969b5025c2 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // SQL queries -function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { +function sqlQuery ($sqlString, $F, $L, $enableCodes = TRUE) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$sqlString])) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called: ' . $sqlString); @@ -56,7 +56,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { basename($F), $L )); - } elseif (!SQL_IS_LINK_UP()) { + } elseif (!isSqlLinkUp()) { // We should not quietly ignore this reportBug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s", $sqlStringModified, @@ -69,13 +69,13 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { $sqlStringModified = str_replace(array(chr(9), PHP_EOL, chr(13)), array(' ', ' ', ' '), $sqlStringModified); // Compile config entries out - $sqlStringModified = SQL_PREPARE_SQL_STRING($sqlStringModified, $enableCodes); + $sqlStringModified = sqlPrepareQueryString($sqlStringModified, $enableCodes); // Cache it and remember as last SQL query $GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified; $GLOBALS['last_sql'] = $sqlStringModified; //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified); - } elseif (!SQL_IS_LINK_UP()) { + } 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)); } else { @@ -92,8 +92,8 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { // Run SQL command //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . basename($F) . ',L=' . $L . ',sql=' . $GLOBALS['last_sql']); - $result = mysql_query($GLOBALS['last_sql'], SQL_GET_LINK()) - or SQL_ERROR($F, $L, 'file='. basename($F) . ',line=' . $L . ':mysql_error()=' . mysql_error() . ',last_query=' . $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))); // Calculate query time @@ -112,7 +112,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { incrementConfigEntry('sql_count'); // Debug output - if (SQL_DEBUG_ENABLED()) { + if (isSqlDebugEnabled()) { // Is this the first call? if (!isset($GLOBALS['sql_first_entry'])) { // Write first entry @@ -121,7 +121,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { } // END - if // Append debug line - appendLineToFile(getCachePath() . 'mysql.log', basename($F) . '|LINE=' . $L . '|NUM=' . (is_resource($result) ? SQL_NUMROWS($result) : 'false') . '|AFFECTED=' . SQL_AFFECTEDROWS() . '|QUERYTIME:' . ($queryTime * 1000) . 'ms): ' . str_replace(array(chr(13), PHP_EOL), array('', ' '), $GLOBALS['last_sql'])); + 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'])); } // END - if // Increment stats entry @@ -132,9 +132,9 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = TRUE) { } // SQL num rows -function SQL_NUMROWS ($resource) { +function sqlNumRows ($resource) { // Valid link resource? - if (!SQL_IS_LINK_UP()) return FALSE; + if (!isSqlLinkUp()) return FALSE; // Link is not up, no rows by default $lines = FALSE; @@ -159,30 +159,30 @@ function SQL_NUMROWS ($resource) { } // SQL affected rows -function SQL_AFFECTEDROWS () { +function sqlAffectedRows () { // Valid link resource? - if (!SQL_IS_LINK_UP()) return FALSE; + if (!isSqlLinkUp()) return FALSE; // Get affected rows - $lines = mysql_affected_rows(SQL_GET_LINK()); + $lines = mysql_affected_rows(getSqlLink()); // Return it return $lines; } // SQL fetch row -function SQL_FETCHROW ($resource) { +function sqlFetchRow ($resource) { // Is $resource valid? - if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return FALSE; + if ((!is_resource($resource)) || (!isSqlLinkUp())) return FALSE; // Fetch the data and return it return mysql_fetch_row($resource); } // SQL fetch array -function SQL_FETCHARRAY ($resource) { +function sqlFetchArray ($resource) { // Is $resource valid? - if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return FALSE; + if ((!is_resource($resource)) || (!isSqlLinkUp())) return FALSE; // Load row as array from database $row = mysql_fetch_assoc($resource); @@ -198,9 +198,9 @@ function SQL_FETCHARRAY ($resource) { } // SQL result -function SQL_RESULT ($resource, $row, $field = '0') { +function sqlResult ($resource, $row, $field = '0') { // Is $resource valid? - if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return FALSE; + if ((!is_resource($resource)) || (!isSqlLinkUp())) return FALSE; // Run the result command $result = mysql_result($resource, $row, $field); @@ -210,22 +210,22 @@ function SQL_RESULT ($resource, $row, $field = '0') { } // SQL connect -function SQL_CONNECT ($host, $login, $password, $F, $L) { +function sqlConnectToDatabase ($host, $login, $password, $F, $L) { // Try to connect - $linkResource = mysql_connect($host, $login, $password) or SQL_ERROR($F, $L, mysql_error()); + $linkResource = mysql_connect($host, $login, $password) or sqlError($F, $L, mysql_error()); // Set the link resource if (is_resource($linkResource)) { /* * A non-resource (boolean) may happen on installation phase which * shall not be set here. Only valid link resources shall be set so - * SQL_IS_LINK_UP() will only return 'true' if there is really a + * isSqlLinkUp() will only return 'true' if there is really a * working database link. */ - SQL_SET_LINK(__FUNCTION__, __LINE__, $linkResource); + setSqlLink(__FUNCTION__, __LINE__, $linkResource); // Init charsets (UTF-8 is default now) - SQL_QUERY("SET + sqlQuery("SET `character_set_results`='utf8', `character_set_client`='utf8', `character_set_connection`='utf8', @@ -239,26 +239,26 @@ function SQL_CONNECT ($host, $login, $password, $F, $L) { } // SQL select database -function SQL_SELECT_DB ($dbName, $F, $L) { +function sqlSelectDatabase ($dbName, $F, $L) { // Is there still a valid link? If not, skip it. - if (!SQL_IS_LINK_UP()) return FALSE; + if (!isSqlLinkUp()) return FALSE; // Return the result //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Selecting database ' . $dbName); - return mysql_select_db($dbName, SQL_GET_LINK()) or SQL_ERROR($F, $L, mysql_error()); + return mysql_select_db($dbName, getSqlLink()) or sqlError($F, $L, mysql_error()); } // SQL close link -function SQL_CLOSE ($F, $L) { +function sqlCloseLink ($F, $L) { // Is the link up? - if (!SQL_IS_LINK_UP()) { + if (!isSqlLinkUp()) { // Skip double close //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Called but no link is open.'); return FALSE; } // END - if // Close database link and forget the link - $close = mysql_close(SQL_GET_LINK()) or SQL_ERROR($F . ':' . __FUNCTION__, $L . ':' . __LINE__, mysql_error()); + $close = mysql_close(getSqlLink()) or sqlError($F . ':' . __FUNCTION__, $L . ':' . __LINE__, mysql_error()); // Close link in this layer unsetSqlLinkUp(__FUNCTION__, __LINE__); @@ -269,8 +269,8 @@ function SQL_CLOSE ($F, $L) { } // SQL free result -function SQL_FREERESULT ($resource) { - if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) { +function sqlFreeResult ($resource) { + if ((!is_resource($resource)) || (!isSqlLinkUp())) { // Abort here return FALSE; } // END - if @@ -283,20 +283,20 @@ function SQL_FREERESULT ($resource) { } // Get id from last INSERT command and secure id -function SQL_INSERT_ID () { - if (!SQL_IS_LINK_UP()) return FALSE; +function getSqlInsertId () { + if (!isSqlLinkUp()) return FALSE; return bigintval(mysql_insert_id()); } // Escape a string for the database -function SQL_ESCAPE ($str, $secureString = TRUE, $strip = TRUE) { +function sqlEscapeString ($str, $secureString = TRUE, $strip = TRUE) { // Is there cache? if (!isset($GLOBALS['sql_escapes']['' . $str . ''])) { // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'str=' . $str . ' - BEFORE!'); // Prepare the string here - $str = SQL_PREPARE_SQL_STRING($str); + $str = sqlPrepareQueryString($str); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'str=' . $str . ' - AFTER!'); @@ -316,7 +316,7 @@ function SQL_ESCAPE ($str, $secureString = TRUE, $strip = TRUE) { // Init (invalid) value $ret = '!INVALID!'; - if (!SQL_IS_LINK_UP()) { + if (!isSqlLinkUp()) { // Fall-back to escapeQuotes() when there is no link $ret = escapeQuotes($str); } elseif (function_exists('mysql_real_escape_string')) { @@ -324,13 +324,13 @@ function SQL_ESCAPE ($str, $secureString = TRUE, $strip = TRUE) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'str=' . $str); // The new and improved version - $ret = mysql_real_escape_string($str, SQL_GET_LINK()); + $ret = mysql_real_escape_string($str, getSqlLink()); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'str=' . $str . ',ret=' . $ret); } elseif (function_exists('mysql_escape_string')) { // The obsolete function - $ret = mysql_escape_string($str, SQL_GET_LINK()); + $ret = mysql_escape_string($str, getSqlLink()); } else { // If nothing else works, fall back to escapeQuotes() again $ret = escapeQuotes($str); @@ -351,7 +351,7 @@ function SQL_ESCAPE ($str, $secureString = TRUE, $strip = TRUE) { } // Log SQL errors to debug.log in installation phase or call reportBug() -function SQL_ERROR ($file, $line, $message) { +function sqlError ($file, $line, $message) { // Remember plain error in last_sql_error $GLOBALS['last_sql_error'] = mysql_error(); diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 309897b661..23556632d8 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -373,7 +373,7 @@ function registerExtension ($ext_name, $taskId, $isDryRun = FALSE, $ignoreUpdate if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { // New way, with CSS //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $currentName . ',always_active=' . getThisExtensionAlwaysActive() . ', ext_ver=' . getCurrentExtensionVersion() . 'ext_css=' . getExtensionHasCss()); - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_extensions` (`ext_name`, `ext_active`, `ext_version`, `ext_has_css`) VALUES ('%s','%s','%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_extensions` (`ext_name`, `ext_active`, `ext_version`, `ext_has_css`) VALUES ('%s','%s','%s','%s')", array( $currentName, getThisExtensionAlwaysActive(), @@ -383,7 +383,7 @@ function registerExtension ($ext_name, $taskId, $isDryRun = FALSE, $ignoreUpdate } else { // Old way, no CSS //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $currentName . ',always_active=' . getThisExtensionAlwaysActive() . ', ext_ver=' . getCurrentExtensionVersion()); - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_extensions` (`ext_name`, `ext_active`, `ext_version`) VALUES ('%s','%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_extensions` (`ext_name`, `ext_active`, `ext_version`) VALUES ('%s','%s','%s')", array( $currentName, getThisExtensionAlwaysActive(), @@ -395,7 +395,7 @@ function registerExtension ($ext_name, $taskId, $isDryRun = FALSE, $ignoreUpdate * Use the insert id as extension id and "cache" all data for * this extension for early usage. */ - copyExtensionDataToCacheArray($currentName, SQL_INSERT_ID()); + copyExtensionDataToCacheArray($currentName, getSqlInsertId()); // Mark it as installed $GLOBALS['ext_is_installed'][$currentName] = TRUE; @@ -432,7 +432,7 @@ function registerExtension ($ext_name, $taskId, $isDryRun = FALSE, $ignoreUpdate } elseif ((isValidId($taskId)) && (getCurrentExtensionName() != '')) { // Remove task from system when id and extension's name is valid //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName()); - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s AND `status`='NEW' LIMIT 1", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s AND `status`='NEW' LIMIT 1", array(bigintval($taskId)), __FUNCTION__, __LINE__); } @@ -499,7 +499,7 @@ function doExtensionSqls ($ext_id, $load_mode) { runFilterChain('extension_' . $load_mode); // Remove cache file(s) if extension is active - if (((isExtensionActive('cache')) && ((!SQL_HASZEROAFFECTED()) || ($sqlRan === TRUE) || ($load_mode == 'activate') || ($load_mode == 'deactivate')))) { + if (((isExtensionActive('cache')) && ((!ifSqlHasZeroAffectedRows()) || ($sqlRan === TRUE) || ($load_mode == 'activate') || ($load_mode == 'deactivate')))) { // Run filters runFilterChain('post_extension_run_sql', getCurrentExtensionName()); } // END - if @@ -597,20 +597,20 @@ function isExtensionActive ($ext_name) { } elseif (($ext_name == 'cache') || (!isExtensionInstalled('cache'))) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'DB! ext_name=' . $ext_name); // Load from database - $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load entry - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set cache setExtensionCacheRow($ext_name, $data); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } else { // Extension not active! //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ': Not active!'); @@ -679,14 +679,14 @@ function getExtensionVersion ($ext_name, $force = FALSE) { incrementStatsEntry('cache_hits'); } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (!isHtmlOutputMode())) { // Load from database - $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", + $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).''); // Is the extension there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load entry - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set cache setExtensionCacheRow($ext_name, $data); @@ -696,7 +696,7 @@ function getExtensionVersion ($ext_name, $force = FALSE) { } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Extension version should not be invalid @@ -895,17 +895,17 @@ function getExtensionName ($ext_id) { incrementStatsEntry('cache_hits'); } elseif (!isExtensionActive('cache')) { // Load from database - $result = SQL_QUERY_ESC("SELECT `ext_name` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `id`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `ext_name` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `id`=%s LIMIT 1", array(bigintval($ext_id)), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get the extension's name from database - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Did we find some extension? @@ -932,20 +932,20 @@ function getExtensionId ($ext_name) { incrementStatsEntry('cache_hits'); } else { // Load from database - $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT * FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get the extension's id from database - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set cache setExtensionCacheRow($ext_name, $data); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return value @@ -997,7 +997,7 @@ function doActivateExtension ($ext_name) { } // END - if // Activate the extension - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='Y' WHERE `ext_name`='%s' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='Y' WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Then run all queries @@ -1013,7 +1013,7 @@ function doDeactivateExtension ($ext_name, $inRebuild = FALSE) { } // END - if // Activate the extension - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='%s' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Then run all queries @@ -1110,7 +1110,7 @@ function createExtensionDeactivationTask ($ext_name) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',taskId[' . gettype($taskId) . ']=' . $taskId); if ((!isValidId($taskId)) && (isExtensionInstalled($ext_name))) { // Task not created so add it - $taskId = createNewTask($subject, SQL_ESCAPE(loadTemplate('task_EXTENSION_deactivated', TRUE, $ext_name)), 'EXTENSION_DEACTIVATION'); + $taskId = createNewTask($subject, sqlEscapeString(loadTemplate('task_EXTENSION_deactivated', TRUE, $ext_name)), 'EXTENSION_DEACTIVATION'); } // END - if // Return task id @@ -1129,17 +1129,17 @@ function determineExtensionTaskId ($ext_name) { $data['task_id'] = NULL; // Search for extension task's id - $result = SQL_QUERY_ESC("SELECT `id` AS `task_id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` AS `task_id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Task found so load task's id and register extension... - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it return $data['task_id']; @@ -1151,17 +1151,17 @@ function determineTaskIdBySubject ($subject) { $data['task_id'] = '0'; // Search for task id - $result = SQL_QUERY_ESC("SELECT `id` AS `task_id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` AS `task_id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", array($subject), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Task found so load task's id and register extension... - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it return $data['task_id']; diff --git a/inc/extensions/ext-mydata.php b/inc/extensions/ext-mydata.php index 8f1c937907..b0da3620a7 100644 --- a/inc/extensions/ext-mydata.php +++ b/inc/extensions/ext-mydata.php @@ -136,7 +136,7 @@ switch (getExtensionMode()) { case '0.1.4': // SQL queries for v0.1.4 // Update notes (these will be set as task text!) - setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert."); + setExtensionUpdateNotes("SQL-Anweisungen mit sqlQueryEscaped() abgesichert."); break; case '0.1.5': // SQL queries for v0.1.5 diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index 8636addbf6..ccc62f1819 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -69,7 +69,7 @@ switch (getExtensionMode()) { case 'activate': // Do stuff when admin activates this extension // Check if mod_rewrite is loadeded if (!isApacheModuleLoaded('mod_rewrite')) { - SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); + sqlQuery("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); enableExtensionReportingFailure(TRUE); addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}'); } // END - if @@ -166,7 +166,7 @@ switch (getExtensionMode()) { // Check if mod_rewrite is loadeded if (!isApacheModuleLoaded('mod_rewrite')) { enableExtensionReportingFailure(TRUE); - SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); + sqlQuery("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); if (!isAdmin()) { addFatalMessage(__FILE__, __LINE__, '{--MOD_REWRITE_ERROR--}'); } // END - if diff --git a/inc/extensions/order/mode-update.php b/inc/extensions/order/mode-update.php index 9fe66b1a8f..8dd5abc245 100644 --- a/inc/extensions/order/mode-update.php +++ b/inc/extensions/order/mode-update.php @@ -194,7 +194,7 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us case '0.3.7': // SQL queries for v0.3.7 // Update notes (these will be set as task text!) - setExtensionUpdateNotes("SQL-Anweisungen mit SQL_QUERY_ESC() abgesichert."); + setExtensionUpdateNotes("SQL-Anweisungen mit sqlQueryEscaped() abgesichert."); break; case '0.3.8': // SQL queries for v0.3.8 diff --git a/inc/filter-functions.php b/inc/filter-functions.php index a9ea5430ea..0fd3e13cd6 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -63,7 +63,7 @@ function initFilterSystem () { } // END - if // Load all filters - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `filter_name`, `filter_function`, `filter_active` @@ -74,9 +74,9 @@ ORDER BY `filter_id` ASC', __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all filters - while ($filterArray = SQL_FETCHARRAY($result)) { + while ($filterArray = sqlFetchArray($result)) { // Get filter name and function $filterName = $filterArray['filter_name']; $filterFunction = $filterArray['filter_function']; @@ -99,7 +99,7 @@ ORDER BY } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Init filters diff --git a/inc/filter/beg_filter.php b/inc/filter/beg_filter.php index 9865a58550..ed1c378eb2 100644 --- a/inc/filter/beg_filter.php +++ b/inc/filter/beg_filter.php @@ -67,7 +67,7 @@ function FILTER_BEG_PURGE_IPS_NOTIFY_USER ($filterData) { } // END - if // Run the SQL query - SQL_QUERY_ESC('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE (UNIX_TIMESTAMP() - `timeout`) >= %s', + sqlQueryEscaped('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE (UNIX_TIMESTAMP() - `timeout`) >= %s', array($OLD + 60*60), __FUNCTION__, __LINE__); // Check for beg rallye is active and send mails out diff --git a/inc/filter/bonus_filter.php b/inc/filter/bonus_filter.php index 4ab41f8d26..0f86567030 100644 --- a/inc/filter/bonus_filter.php +++ b/inc/filter/bonus_filter.php @@ -54,7 +54,7 @@ function FILTER_ADD_LOGIN_BONUS ($filterData) { if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (isBonusRallyeActive()) && (isIncludeBonusLoginEnabled())) { // Update last login if far enougth away // @TODO This query isn't right, it will only update if the user was for a longer time away! - SQL_QUERY_ESC('UPDATE + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_login`=UNIX_TIMESTAMP() @@ -68,7 +68,7 @@ LIMIT 1', ); // Updated entry? - $bonus = (!SQL_HASZEROAFFECTED()); + $bonus = (!ifSqlHasZeroAffectedRows()); } // END - if if (($bonus === TRUE) && (getRequestElement('do') == 'bonus')) { diff --git a/inc/filter/earning_filter.php b/inc/filter/earning_filter.php index fcc23d78bc..1125cf1c3a 100644 --- a/inc/filter/earning_filter.php +++ b/inc/filter/earning_filter.php @@ -50,7 +50,7 @@ function FILTER_ADD_EARNING_GROUP_POPUP ($filterData) { } // END - if // Now check if the user has subscription and amount left - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `d`.`earning_id`, `d`.`earning_provider`, `u`.`earning_current_amount`, @@ -77,9 +77,9 @@ ORDER BY ), __FUNCTION__, __LINE__); // Are there entries left? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all names - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Merge the $filterData array in $content = merge_array($content, $filterData); @@ -96,7 +96,7 @@ ORDER BY } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return filter data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); diff --git a/inc/filter/online_filter.php b/inc/filter/online_filter.php index 118ebf8a0d..fca99bf04b 100644 --- a/inc/filter/online_filter.php +++ b/inc/filter/online_filter.php @@ -69,13 +69,13 @@ function FILTER_UPDATE_ONLINE_LIST ($filterData) { } // END - if // Now search for the user - $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_online` WHERE `sid`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_online` WHERE `sid`='%s' LIMIT 1", array(session_id()), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then update it - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_online` SET `module`='%s', @@ -87,7 +87,7 @@ SET `is_admin`='%s', `timestamp`=UNIX_TIMESTAMP(), `ip`='%s' -WHERE +WHERE `sid`='%s' LIMIT 1", array( @@ -103,7 +103,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); } else { // No entry does exists so we simply add it! - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_online` (`module`, `action`, `what`, `userid`, `refid`, `is_member`, `is_admin`, `timestamp`, `sid`, `ip`) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_online` (`module`, `action`, `what`, `userid`, `refid`, `is_member`, `is_admin`, `timestamp`, `sid`, `ip`) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')", array( getModule(), $action, @@ -118,10 +118,10 @@ LIMIT 1", } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Purge old entries - SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_online` WHERE (UNIX_TIMESTAMP() - `timestamp`) >= {?online_timeout?}', __FUNCTION__, __LINE__); + sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_online` WHERE (UNIX_TIMESTAMP() - `timestamp`) >= {?online_timeout?}', __FUNCTION__, __LINE__); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); diff --git a/inc/filter/rallye_filter.php b/inc/filter/rallye_filter.php index 286b11dbf6..507a35e835 100644 --- a/inc/filter/rallye_filter.php +++ b/inc/filter/rallye_filter.php @@ -63,7 +63,7 @@ function FILTER_RALLYE_NOTIFY_USERS ($filterData) { )); // Check for new started but not notified rallyes - $result = SQL_QUERY("SELECT SQL_SMALL_RESULT + $result = sqlQuery("SELECT SQL_SMALL_RESULT `d`.`id`, `d`.`title`, `d`.`start_time`, @@ -79,16 +79,16 @@ WHERE `d`.`start_time` <= UNIX_TIMESTAMP() AND `d`.`end_time` > UNIX_TIMESTAMP() LIMIT 1", __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Start rallye autostartReferralRallyes($result); } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Check for expired rallyes - $result = SQL_QUERY("SELECT SQL_SMALL_RESULT + $result = sqlQuery("SELECT SQL_SMALL_RESULT `d`.`id`, `d`.`title`, `d`.`start_time`, @@ -103,13 +103,13 @@ WHERE `d`.`expired`='N' AND (`d`.`end_time` <= UNIX_TIMESTAMP()" . $sqlAddons['or'] . ") LIMIT 1", __FILE__, __LINE__); - if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('autopurge'))) { + if ((sqlNumRows($result) == 1) && (isExtensionActive('autopurge'))) { // End rallye here... stopRallyeByResult($result); } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return data diff --git a/inc/filter/register_filter.php b/inc/filter/register_filter.php index 06af7b4162..156362c264 100644 --- a/inc/filter/register_filter.php +++ b/inc/filter/register_filter.php @@ -44,11 +44,11 @@ if (!defined('__SECURITY')) { function FILTER_REGISTER_MUST_FILLOUT ($filterData) { // Get all fields for output //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $result = SQL_QUERY('SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC', + $result = sqlQuery('SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC', __FUNCTION__, __LINE__); // Walk through all entries - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Must the user fill out this element? $value = ''; if ($row['field_required'] == 'Y') { @@ -60,7 +60,7 @@ function FILTER_REGISTER_MUST_FILLOUT ($filterData) { } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index 75e699f4ad..7c731dab58 100644 --- a/inc/filter/user_filter.php +++ b/inc/filter/user_filter.php @@ -179,7 +179,7 @@ function FILTER_GENERIC_UPDATE_USER_REFERRAL ($filterData) { assert(isReferralIdValid()); // Update ref counter, determineReferralId() must already be called before this filter is executed - SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`={%pipe,getReferralId%} LIMIT 1', __FUNCTION__, __LINE__); + sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`={%pipe,getReferralId%} LIMIT 1', __FUNCTION__, __LINE__); // Return filter data return $filterData; @@ -191,12 +191,12 @@ function FILTER_UPDATE_USER_SUBID ($filterData) { assert(isReferralIdValid()); // Get sub id and secure it - $subId = SQL_ESCAPE(getRequestElement('subid')); + $subId = sqlEscapeString(getRequestElement('subid')); // Is the sub id available and registered with referral id? if (countSumTotalData(getReferralId(), 'user_subids', 'id', 'userid', TRUE, sprintf(" AND `subid`='%s'", $subId)) == 1) { // Sub id is assigned to referral id, so add a record - SQL_QUERY_ESC("INSERT INTO + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_subid_log` ( `refid`, @@ -212,12 +212,12 @@ function FILTER_UPDATE_USER_SUBID ($filterData) { '{%%pipe,detectUserAgent%%}' )", array( - // @NOTE: SQL_QUERY_ESC() already escape it, don't use $subId here + // @NOTE: sqlQueryEscaped() already escape it, don't use $subId here getRequestElement('subid') ), __FUNCTION__, __LINE__); // Add insert id for other filters - $filterData['insert_id'] = SQL_INSERT_ID(); + $filterData['insert_id'] = getSqlInsertId(); // Register sub id in filter setSession('subid', $subId); @@ -247,15 +247,15 @@ function FILTER_MEMBER_REFLINK_USER_SUBIDS_CONTENT ($content = '') { // Does the current user have sub ids? if (getTotalMemberSubIds() > 0) { // Then Load all - $result = SQL_QUERY_ESC('SELECT `id`, `subid` FROM `{?_MYSQL_PREFIX?}_user_subids` WHERE `userid`=%s ORDER BY `subid` ASC', + $result = sqlQueryEscaped('SELECT `id`, `subid` FROM `{?_MYSQL_PREFIX?}_user_subids` WHERE `userid`=%s ORDER BY `subid` ASC', array(getMemberId()), __FUNCTION__, __LINE__); // There should be entries left - assert(!SQL_HASZERONUMS($result)); + assert(!ifSqlHasZeroNums($result)); // Load all $out = ''; - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Load row template $out .= loadTemplate('member_list_reflink_user_subids_row', TRUE, $row); } // END - while @@ -264,7 +264,7 @@ function FILTER_MEMBER_REFLINK_USER_SUBIDS_CONTENT ($content = '') { $content .= loadTemplate('member_list_reflink_user_subids', TRUE, $out); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return data diff --git a/inc/filters.php b/inc/filters.php index 9e135b3e47..e07fc7bcc8 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -46,10 +46,10 @@ function FILTER_FLUSH_FILTERS () { 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; @@ -82,7 +82,7 @@ function FILTER_FLUSH_FILTERS () { //* 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); @@ -270,17 +270,17 @@ function FILTER_RUN_SQLS ($filterData) { 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 @@ -567,10 +567,10 @@ function FILTER_COMPILE_EXPRESSION_CODE ($filterData) { // 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 @@ -665,7 +665,7 @@ function FILTER_RUN_MONTHLY_INCLUDES () { // 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 @@ -943,7 +943,7 @@ function FILTER_COUNT_MODULE () { //* 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!'); } @@ -1107,7 +1107,7 @@ function FILTER_RESET_USER_LOGIN_FAILURE () { // 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, @@ -1149,7 +1149,7 @@ function FILTER_LOAD_PAGE_HEADER () { $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 @@ -1253,12 +1253,12 @@ function FILTER_HANDLE_HOME_IN_INDEX_SETTING ($filterData) { // 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; @@ -1329,11 +1329,11 @@ function FILTER_HANDLE_REFERRER_BANNER_CLICK ($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 @@ -1348,16 +1348,16 @@ function FILTER_HANDLE_REFERRER_BANNER_VIEW ($filterData) { // 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 ... @@ -1371,7 +1371,7 @@ function FILTER_HANDLE_REFERRER_BANNER_VIEW ($filterData) { logDebugMessage(__FUNCTION__, __LINE__, 'Banner ' . bigintval(getRequestElement('banner')) . ' not found.'); // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Do nothing for now @@ -1413,16 +1413,16 @@ function FILTER_SERVER_NAME_EXTRA_AUTOPURGE ($filterData) { // 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 diff --git a/inc/fix_filters.php b/inc/fix_filters.php index 9b87c77513..2e05a95382 100644 --- a/inc/fix_filters.php +++ b/inc/fix_filters.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Get all filters -$result = SQL_QUERY('SELECT +$result = sqlQuery('SELECT `filter_name`, `filter_function` FROM @@ -51,11 +51,11 @@ ORDER BY `filter_function` ASC', __FILE__, __LINE__); // Are there entries? (there should be!) -if (!SQL_HASZERONUMS($result)) { +if (!ifSqlHasZeroNums($result)) { // Load row by row - while ($filter = SQL_FETCHARRAY($result)) { + while ($filter = sqlFetchArray($result)) { // Now search again for this filter and get it's total count - $count = countSumTotalData($filter['filter_name'], 'filters', 'filter_id', 'filter_name', TRUE, sprintf(" AND `filter_function`='%s'", SQL_ESCAPE($filter['filter_function']))); + $count = countSumTotalData($filter['filter_name'], 'filters', 'filter_id', 'filter_name', TRUE, sprintf(" AND `filter_function`='%s'", sqlEscapeString($filter['filter_function']))); // Is there more than one entry? if ($count > 1) { @@ -70,7 +70,7 @@ if (!SQL_HASZERONUMS($result)) { } // END - if // Free result -SQL_FREERESULT($result); +sqlFreeResult($result); // Now insert our unqiue key addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_filters` DROP KEY `name_function`'); diff --git a/inc/fix_menu.php b/inc/fix_menu.php index 99e319b1b7..2aad72e31f 100644 --- a/inc/fix_menu.php +++ b/inc/fix_menu.php @@ -43,14 +43,14 @@ if (!defined('__SECURITY')) { // Get all menus foreach (array('guest','member','admin') as $menu) { // Query it - $result = SQL_QUERY_ESC("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC", + $result = sqlQueryEscaped("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC", array($menu), __FILE__, __LINE__); // Init array $menus = array(); // Load all entries - while ($entry = SQL_FETCHARRAY($result)) { + while ($entry = sqlFetchArray($result)) { // Is the menu entry set? if (!isset($menus['menu'][$entry['action']][$entry['what']])) { // Not found @@ -71,7 +71,7 @@ foreach (array('guest','member','admin') as $menu) { // Remove all except one if (is_null($entry['what'])) { // Main menu is double - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s", array( $menu, $entry['action'], @@ -79,7 +79,7 @@ foreach (array('guest','member','admin') as $menu) { ), __FILE__, __LINE__); } else { // Sub menu is double - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s", array( $menu, $entry['action'], @@ -92,7 +92,7 @@ foreach (array('guest','member','admin') as $menu) { } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Init sqls initSqls(); diff --git a/inc/fix_refsystem.php b/inc/fix_refsystem.php index a63edb3019..a932a5c4ba 100644 --- a/inc/fix_refsystem.php +++ b/inc/fix_refsystem.php @@ -41,29 +41,29 @@ if (!defined('__SECURITY')) { } // END - if // Sanity-check: Is there ref level 0? If so, this must be fixed to NULL and `level` must be increased by one -$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__); -if (!SQL_HASZERONUMS($result)) { +$result = sqlQuery('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__); +if (!ifSqlHasZeroNums($result)) { // Remove index temporaly - SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__); + sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__); // Upgrade refsystem - SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__); + sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__); // Add it again - SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE INDEX `userid_level` (`userid`, `level`)', __FILE__, __LINE__); + sqlQueryAlterTable('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE INDEX `userid_level` (`userid`, `level`)', __FILE__, __LINE__); // Rebuild cache rebuildCache('refsystem', 'refsystem'); } // END - if // Free result -SQL_FREERESULT($result); +sqlFreeResult($result); // Reset the table -SQL_QUERY('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__); +sqlQuery('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__); // Begin with all users in level one -$result_direct = SQL_QUERY('SELECT +$result_direct = sqlQuery('SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -74,9 +74,9 @@ ORDER BY `userid` ASC', __FILE__, __LINE__); // Are there entries? -if (!SQL_HASZERONUMS($result_direct)) { +if (!ifSqlHasZeroNums($result_direct)) { // When 'walk' through all users - while ($content = SQL_FETCHARRAY($result_direct)) { + while ($content = sqlFetchArray($result_direct)) { // Update refback table /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'userid=' . $content['userid'] . ' - BEFORE!'); updateReferralTable($content['userid']); @@ -85,7 +85,7 @@ if (!SQL_HASZERONUMS($result_direct)) { } // END - if // Free result -SQL_FREERESULT($result_direct); +sqlFreeResult($result_direct); // [EOF] ?> diff --git a/inc/fix_user_points.php b/inc/fix_user_points.php index 4d637f31f7..b4a61ae4f9 100644 --- a/inc/fix_user_points.php +++ b/inc/fix_user_points.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Get all user points -$result = SQL_QUERY('SELECT +$result = sqlQuery('SELECT `userid`, `points`, `locked_points`, @@ -55,15 +55,15 @@ ORDER BY `userid` ASC', __FILE__, __LINE__); // Are there entries? (there should be!) -if (!SQL_HASZERONUMS($result)) { +if (!ifSqlHasZeroNums($result)) { // Load row by row - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Update the database again foreach (array_keys($row) as $column) { // Not userid itself if ($column != 'userid') { // Update amount - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth` IS NULL", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth` IS NULL", array( $column, $column, @@ -72,9 +72,9 @@ if (!SQL_HASZERONUMS($result)) { ), __FILE__, __LINE__); // Nothing has been updated? - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // Then insert it - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,NULL,%s)", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`, `ref_depth`, `%s`) VALUES (%s,NULL,%s)", array( $column, $row['userid'], @@ -87,10 +87,10 @@ if (!SQL_HASZERONUMS($result)) { } // END - if // Free result -SQL_FREERESULT($result); +sqlFreeResult($result); // Remove all entries -SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `ref_depth`=0', __FILE__, __LINE__); +sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `ref_depth`=0', __FILE__, __LINE__); // [EOF] ?> diff --git a/inc/functions.php b/inc/functions.php index 0ae32cc285..4cd9373bec 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1688,9 +1688,9 @@ function doShutdown () { runFilterChain('shutdown', NULL); // Check if link is up - if (SQL_IS_LINK_UP()) { + if (isSqlLinkUp()) { // Close link - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); } elseif (!isInstallationPhase()) { // No database link reportBug(__FUNCTION__, __LINE__, 'Database link is already down, while shutdown is running.'); @@ -1889,7 +1889,7 @@ function mapModuleToTable ($moduleName) { // Map only these, still lame code... switch ($moduleName) { case 'index': // 'index' is the guest's menu - $moduleName = 'guest'; + $moduleName = 'guest'; break; case 'login': // ... and 'login' the member's menu @@ -1909,7 +1909,7 @@ function addSqlToDebug ($result, $sqlString, $timing, $F, $L) { // Check it and cache it in $GLOBALS $GLOBALS['debug_sql_available'] = ((isConfigurationLoaded()) && (isDisplayDebugSqlEnabled())); } // END - if - + // Don't execute anything here if we don't need or ext-other is missing if ($GLOBALS['debug_sql_available'] === FALSE) { return; @@ -1926,8 +1926,8 @@ function addSqlToDebug ($result, $sqlString, $timing, $F, $L) { // Generate record $record = array( - 'num_rows' => SQL_NUMROWS($result), - 'affected' => SQL_AFFECTEDROWS(), + 'num_rows' => sqlNumRows($result), + 'affected' => sqlAffectedRows(), 'sql_str' => $sqlString, 'timing' => $timing, 'file' => basename($F), @@ -2210,7 +2210,7 @@ function generateAdminMailLinks ($mailType, $mailId) { // Is the mail type supported? if (!empty($table)) { // Query for the mail - $result = SQL_QUERY_ESC("SELECT `id`, `%s` AS `mail_status` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `id`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `id`, `%s` AS `mail_status` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `id`=%s LIMIT 1", array( $statusColumn, $table, @@ -2218,9 +2218,9 @@ function generateAdminMailLinks ($mailType, $mailId) { ), __FILE__, __LINE__); // Is there one entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load the entry - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); // Add output and type $content['type'] = $mailType; @@ -2234,7 +2234,7 @@ function generateAdminMailLinks ($mailType, $mailId) { } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return generated HTML code @@ -2447,7 +2447,7 @@ function memberAddEntries ($tableName, $columns = array(), $filterFunctions = ar doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex); // Entry has been added? - if ((!SQL_HASZEROAFFECTED()) && ($GLOBALS['__XML_PARSE_RESULT'] === TRUE)) { + if ((!ifSqlHasZeroAffectedRows()) && ($GLOBALS['__XML_PARSE_RESULT'] === TRUE)) { // Display success message displayMessage('{--MEMBER_ENTRY_ADDED--}'); } else { @@ -2529,7 +2529,7 @@ function memberDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunc displayMessage('{--MEMBER_ALL_ENTRIES_REMOVED--}'); } else { // Some are still there :( - displayMessage(sprintf(getMessage('MEMBER_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), countPostSelection($idColumn[0]))); + displayMessage(sprintf(getMessage('MEMBER_SOME_ENTRIES_NOT_DELETED'), sqlAffectedRows(), countPostSelection($idColumn[0]))); } } else { // List for deletion confirmation @@ -2635,7 +2635,7 @@ function getArrayFromArrayIndex ($array, $key) { /** * Compress given data and encodes it into BASE64 to be stored in database with - * SQL_QUERY_ESC() + * sqlQueryEscaped() * * @param $data Data to be compressed and encoded * @return $data Compressed+encoded data diff --git a/inc/gen_mediadata.php b/inc/gen_mediadata.php index 5dabc850f8..7f9ff7c388 100644 --- a/inc/gen_mediadata.php +++ b/inc/gen_mediadata.php @@ -50,17 +50,17 @@ $content = array( ); // Check for normal mails -$result_media = SQL_QUERY('SELECT +$result_media = sqlQuery('SELECT SUM(`max_rec`) AS `normal_send`, SUM(`clicks`) AS `normal_clicks` FROM `{?_MYSQL_PREFIX?}_user_stats`', __FILE__, __LINE__); // Merge data together -$content = merge_array($content, SQL_FETCHARRAY($result_media)); +$content = merge_array($content, sqlFetchArray($result_media)); // Free memory -SQL_FREERESULT($result_media); +sqlFreeResult($result_media); // Check for bonus extension if (isExtensionActive('bonus')) { @@ -68,7 +68,7 @@ if (isExtensionActive('bonus')) { $bcount = countSumTotalData('', 'bonus', 'id', '', TRUE); // Check for bonus mails - $result_media = SQL_QUERY('SELECT + $result_media = sqlQuery('SELECT SUM(`mails_send`) AS `bonus_send`, SUM(`clicks`) AS `bonus_clicks` FROM @@ -76,10 +76,10 @@ FROM LIMIT 1', __FILE__, __LINE__); // Merge data together - $content = merge_array($content, SQL_FETCHARRAY($result_media)); + $content = merge_array($content, sqlFetchArray($result_media)); // Free memory - SQL_FREERESULT($result_media); + sqlFreeResult($result_media); } // END - if // Load (maybe) missing file diff --git a/inc/http-functions.php b/inc/http-functions.php index 16d8b80dce..8ae5daa783 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -896,9 +896,9 @@ function logWrongServerNameRedirect () { // Is ext-sql_patches at least version 0.9.2? if (isExtensionInstalledAndNewer('sql_patches', '0.9.2')) { // Is there an entry? - if (countSumTotalData(detectServerName(), 'server_name_log', 'server_name_id', 'server_name', TRUE, str_replace('%', '{PER}', sprintf(" AND `server_name_remote_addr`='%s' AND `server_name_ua`='%s' AND `server_name_referrer`='%s'", SQL_ESCAPE(detectRemoteAddr(TRUE)), SQL_ESCAPE(detectUserAgent(TRUE)), SQL_ESCAPE(detectReferer(TRUE))))) == 1) { + if (countSumTotalData(detectServerName(), 'server_name_log', 'server_name_id', 'server_name', TRUE, str_replace('%', '{PER}', sprintf(" AND `server_name_remote_addr`='%s' AND `server_name_ua`='%s' AND `server_name_referrer`='%s'", sqlEscapeString(detectRemoteAddr(TRUE)), sqlEscapeString(detectUserAgent(TRUE)), sqlEscapeString(detectReferer(TRUE))))) == 1) { // Update counter, as all are the same - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_server_name_log` SET `server_name_counter`=`server_name_counter`+1 @@ -916,7 +916,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); } else { // Then log it away - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`, `server_name_remote_addr`, `server_name_ua`, `server_name_referrer`) VALUES('%s','%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`, `server_name_remote_addr`, `server_name_ua`, `server_name_referrer`) VALUES('%s','%s', '%s', '%s')", array( detectServerName(), detectRemoteAddr(TRUE), diff --git a/inc/install-functions.php b/inc/install-functions.php index 85b3b9c54e..4e3605f2b6 100644 --- a/inc/install-functions.php +++ b/inc/install-functions.php @@ -655,10 +655,10 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { unsetSqlLinkUp(__FUNCTION__, __LINE__); // Try to connect to the database - SQL_CONNECT(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__); + sqlConnectToDatabase(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__); // Is the link up - if (!SQL_IS_LINK_UP()) { + if (!isSqlLinkUp()) { // Cannot connect to database $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_CONNECT_ERROR--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_login', 'mysql_password1', 'mysql_password2'); @@ -666,13 +666,13 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { } // END - if // Then attempt to select the database - if (!SQL_SELECT_DB(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) { + if (!sqlSelectDatabase(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) { // Could not find database $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_SELECT_FAILED--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase'); // Disconnect here, we don't need idle database connections laying around - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); // Abort here return FALSE; @@ -692,7 +692,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); // Disconnect here, we don't need idle database connections laying around - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); // Abort here return FALSE; @@ -702,7 +702,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); // Disconnect here, we don't need idle database connections laying around - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); // Abort here return FALSE; @@ -728,7 +728,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); // Disconnect here, we don't need idle database connections laying around - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); // Abort here return FALSE; @@ -784,7 +784,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { $isValid = (count($tables) == $missingTables); // Disconnect here, we don't need idle database connections laying around - SQL_CLOSE(__FUNCTION__, __LINE__); + sqlCloseLink(__FUNCTION__, __LINE__); // If the status is true, disconnect the database if ($isValid === FALSE) { diff --git a/inc/install/install_page_finalize.php b/inc/install/install_page_finalize.php index 257930fbd4..14c2a0cc15 100644 --- a/inc/install/install_page_finalize.php +++ b/inc/install/install_page_finalize.php @@ -49,12 +49,12 @@ if ((isPostRequestElementSet('finalize')) && (!isInstalled())) { unsetSqlLinkUp(__FILE__, __LINE__); // Connect to database server - SQL_CONNECT($GLOBALS['install_mysql']['host'], $GLOBALS['install_mysql']['login'], $GLOBALS['install_mysql']['password1'], __FILE__, __LINE__); + sqlConnectToDatabase($GLOBALS['install_mysql']['host'], $GLOBALS['install_mysql']['login'], $GLOBALS['install_mysql']['password1'], __FILE__, __LINE__); // Is the link up? - if (SQL_IS_LINK_UP()) { + if (isSqlLinkUp()) { // Seems to work, also right database? - if (SQL_SELECT_DB($GLOBALS['install_mysql']['dbase'], __FILE__, __LINE__) === TRUE) { + if (sqlSelectDatabase($GLOBALS['install_mysql']['dbase'], __FILE__, __LINE__) === TRUE) { // Check for dumps if ((!isFileReadable(postRequestElement('spath') . 'install/tables.sql')) || (!isFileReadable(postRequestElement('spath') . 'install/menu-'.getLanguage().'.sql'))) { // Installation area not found diff --git a/inc/language/de.php b/inc/language/de.php index 1d2b257f0f..aa7c6d483c 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -89,7 +89,7 @@ addMessages(array( 'ADMIN_REGISTER_DONE' => "Das Admin-Account wurde soeben erstellt. Sie können sich nun mit den eingegeben Login-Daten einloggen.", 'ADMIN_CANNOT_COMPLETE' => "Kann die Regsitrierung des Admin-Accounts nicht abschliessen.", 'ADMIN_LOGIN_TITLE' => "Einloggen zum Administrationsbereich", - 'ADMIN_LOGIN_NOW' => "Sie können sich nun in den Administratorbereich einloggen. Geben Sie Ihren Admin-Login und das Passwort dazu ein.", + 'ADMIN_LOGIN_NOW' => "Login zum Administratorbereich. Geben Sie Ihren Admin-Login und das Passwort dazu ein.", 'ENTER_ADMIN_LOGIN' => "Administrator-Login", 'ENTER_ADMIN_PASS' => "Passwort zum Admin-Account", 'ADMIN_LOGIN_SUBMIT' => "Einloggen", @@ -869,7 +869,7 @@ addMessages(array( 'ADMIN_EXTENSION_INITIAL_RELEASE' => "Erstes Release fertiggestellt.", 'ADMIN_EXTENSION_DEVELOPER_RELEASE' => "Entwickler-Version zum Testen.", 'ADMIN_EXTENSION_UPDATE_NOTICES_404' => "Keine Update-Hinweise gefunden.", - 'MYSQL_QUERY_STRING' => "SQL-Abfragebefehl war:", + 'MYsqlQuery_STRING' => "SQL-Abfragebefehl war:", 'MEMBER_NO_MAILS_IN_POOL' => "Sie haben noch keine Mailbuchungen aufgegeben! Es können somit Ihnen auch keine angezeigt werden.", 'ADMIN_BACK_TO_GUEST_MENU' => "Zum Gastmenü zurück...", 'ADMIN_LOGOUT_NOW' => "Aus dem Admin-Bereich ausloggen", diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 59ce7e3de2..72d64ec02a 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -102,22 +102,22 @@ function isAdminsAllowedByAcl ($action, $what) { $result = FALSE; if (!empty($action)) { // Main menu - $result = SQL_QUERY_ESC("SELECT `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `action_menu`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `action_menu`='%s' LIMIT 1", array(bigintval($adminId), $action), __FUNCTION__, __LINE__); } elseif (!empty($what)) { // Sub menu - $result = SQL_QUERY_ESC("SELECT `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `what_menu`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `what_menu`='%s' LIMIT 1", array(bigintval($adminId), $what), __FUNCTION__, __LINE__); } // Is an entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load ACL - list($aclMode) = SQL_FETCHROW($result); + list($aclMode) = sqlFetchRow($result); } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // But default result is failed @@ -140,7 +140,7 @@ function generateAdminEmailLink ($email, $mod = 'admin') { // Is it an email? if (isInString('@', $email)) { // Create email link - $result = SQL_QUERY_ESC("SELECT `id` + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE @@ -149,16 +149,16 @@ LIMIT 1", array($email), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load userid - list($adminId) = SQL_FETCHROW($result); + list($adminId) = sqlFetchRow($result); // Call this function again $email = generateAdminEmailLink($adminId, $mod); } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } elseif (isValidId($email)) { // Direct id given $email = '{%url=modules.php?module=' . $mod . '&what=admins_contct&id=' . bigintval($email) . '%}'; @@ -185,7 +185,7 @@ function adminsChangeAdminAccount ($postData, $element = '', $displayMessage = T // When both passwords match update admin account if ((!empty($element)) && (isset($postData[$element]))) { // Save this setting - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `%s`='%s' WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `%s`='%s' WHERE `id`=%s LIMIT 1", array( $element, $postData[$element][$id], @@ -205,7 +205,7 @@ function adminsChangeAdminAccount ($postData, $element = '', $displayMessage = T // Save password when set if (!empty($postData['password1'][$id])) { - $add = sprintf(",`password`='%s'", SQL_ESCAPE($hash)); + $add = sprintf(",`password`='%s'", sqlEscapeString($hash)); } // END - if // Get admin's id @@ -237,7 +237,7 @@ function adminsChangeAdminAccount ($postData, $element = '', $displayMessage = T // Update admin account if ($default == 'allow') { // Allow changing default ACL - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `login`='%s'" . $add . ", @@ -256,7 +256,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); } else { // Do not allow it here - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `login`='%s'" . $add . ", @@ -284,10 +284,10 @@ LIMIT 1", $SQL = getUpdateSqlFromArray($postData, 'admins', 'id', '%s', array('login', 'id'), $id); // Run it - SQL_QUERY_ESC($SQL, array(bigintval($id)), __FUNCTION__, __LINE__); + sqlQueryEscaped($SQL, array(bigintval($id)), __FUNCTION__, __LINE__); // Was it updated? - if (SQL_AFFECTEDROWS() == 1) { + if (sqlAffectedRows() == 1) { // Admin account saved $message = '{--ADMIN_ACCOUNT_SAVED--}'; } else { @@ -322,11 +322,11 @@ function adminsEditAdminAccount ($postData) { $id = bigintval($id); // Get the admin's data - $result = SQL_QUERY_ESC('SELECT `login`, `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + $result = sqlQueryEscaped('SELECT `login`, `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($id), __FUNCTION__, __LINE__); - if ((SQL_NUMROWS($result) == 1) && ($selected == 1)) { + if ((sqlNumRows($result) == 1) && ($selected == 1)) { // Entry found - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); // Prepare some more data for the template $content['id'] = $id; @@ -345,7 +345,7 @@ function adminsEditAdminAccount ($postData) { } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - foreach // Load template @@ -415,7 +415,7 @@ function adminsDeleteAdminAccount ($postData) { $id = bigintval($id); // Get the admin's data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `login`, `email`, `default_acl` AS `access_mode`, @@ -428,9 +428,9 @@ LIMIT 1', array($id), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Entry found, so load data - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); $content['access_mode'] = '{--ADMIN_ADMINS_ACCESS_MODE_' . strtoupper($content['access_mode']) . '--}'; $content['la_mode'] = '{--ADMIN_ADMINS_LA_MODE_' . strtoupper($content['la_mode']) . '--}'; @@ -442,7 +442,7 @@ LIMIT 1', } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - foreach // Load template @@ -464,11 +464,11 @@ function adminsRemoveAdminAccount ($postData) { // Delete only when it's not your own account! if (($del == 1) && (getCurrentAdminId() != $id)) { // Rewrite his tasks to all admins - SQL_QUERY_ESC('UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `assigned_admin`=NULL WHERE `assigned_admin`=%s', + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `assigned_admin`=NULL WHERE `assigned_admin`=%s', array($id), __FUNCTION__, __LINE__); // Remove account - SQL_QUERY_ESC('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + sqlQueryEscaped('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($id), __FUNCTION__, __LINE__); } } @@ -480,7 +480,7 @@ function adminsRemoveAdminAccount ($postData) { // List all admin accounts function adminsListAdminAccounts() { // Select all admin accounts - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id`, `login`, `email`, @@ -491,7 +491,7 @@ FROM ORDER BY `login` ASC', __FUNCTION__, __LINE__); $OUT = ''; - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Compile some variables $content['access_mode'] = '{--ADMIN_ADMINS_ACCESS_MODE_' . strtoupper($content['access_mode']) . '--}'; $content['la_mode'] = '{--ADMIN_ADMINS_LA_MODE_' . strtoupper($content['la_mode']) . '--}'; @@ -501,7 +501,7 @@ ORDER BY } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Load template loadTemplate('admin_list_admins', FALSE, $OUT); @@ -517,31 +517,31 @@ function sendAdminsEmails ($subject, $template, $content, $userid) { $message = loadEmailTemplate($template, $content, $userid); // Check which admin shall receive this mail - $result = SQL_QUERY_ESC("SELECT `admin_id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `admin_id` ASC", + $result = sqlQueryEscaped("SELECT `admin_id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `admin_id` ASC", array($template), __FUNCTION__, __LINE__); // No entries found? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // Is ext-admins' version at least 0.7.9? if (isExtensionInstalledAndNewer('admins', '0.7.9')) { // Create new entry (to all admins) - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (NULL, '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (NULL, '%s')", array($template), __FUNCTION__, __LINE__); } // END - if // Select all email adresses (default) - $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC', + $result = sqlQuery('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC', __FUNCTION__, __LINE__); } else { // Load admin ids... // @TODO This can be, somehow, rewritten $adminIds = array(); - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { array_push($adminIds, $content['admin_id']); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Init result $result = FALSE; @@ -568,11 +568,11 @@ function sendAdminsEmails ($subject, $template, $content, $userid) { return; } elseif (($adminId == '0') || (empty($adminId))) { // Select all email adresses - $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC', + $result = sqlQuery('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC', __FUNCTION__, __LINE__); } else { // If Admin-Id is not "to-all" select - $result = SQL_QUERY_ESC('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id` IN (%s) ORDER BY `id` ASC', + $result = sqlQueryEscaped('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id` IN (%s) ORDER BY `id` ASC', array($adminId), __FUNCTION__, __LINE__); } } @@ -587,12 +587,12 @@ function sendAdminsEmails ($subject, $template, $content, $userid) { } // END - if // Load email addresses and send away - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { sendEmail($content['email'], $subject, $message, 'N', $mailHeader); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // "Getter" for current admin's expert settings @@ -612,20 +612,20 @@ function getAminsExpertSettings () { incrementStatsEntry('cache_hits'); } elseif (!isExtensionInstalled('cache')) { // Load from database - $result = SQL_QUERY_ESC('SELECT `expert_settings` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + $result = sqlQueryEscaped('SELECT `expert_settings` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($adminId), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch data - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set cache $GLOBALS['cache_array']['admin']['expert_settings'][$adminId] = $data['expert_settings']; } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return the result @@ -649,20 +649,20 @@ function getAminsExpertWarning () { incrementStatsEntry('cache_hits'); } elseif (!isExtensionInstalled('cache')) { // Load from database - $result = SQL_QUERY_ESC('SELECT `expert_warning` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + $result = sqlQueryEscaped('SELECT `expert_warning` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($adminId), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch data - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set cache $GLOBALS['cache_array']['admin']['expert_warning'][$adminId] = $data['expert_warning']; } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return the result @@ -688,17 +688,17 @@ function getAdminLoginFailures ($adminId) { incrementStatsEntry('cache_hits'); } elseif (!isExtensionActive('cache')) { // Load from database - $result = SQL_QUERY_ESC('SELECT `login_failures` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + $result = sqlQueryEscaped('SELECT `login_failures` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($adminId), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get it - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return the login_failures @@ -724,17 +724,17 @@ function getAdminLastFailure ($adminId) { incrementStatsEntry('cache_hits'); } elseif (!isExtensionActive('cache')) { // Load from database - $result = SQL_QUERY_ESC('SELECT UNIX_TIMESTAMP(`last_failure`) AS `last_failure` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', + $result = sqlQueryEscaped('SELECT UNIX_TIMESTAMP(`last_failure`) AS `last_failure` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1', array($adminId), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get it - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return the last_failure diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 01b63002ee..b93c09d0aa 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -48,11 +48,11 @@ function addPointsBeg ($userid, $points) { // Is begging rallye active? if (isBegRallyeEnabled()) { // Add points to rallye account - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", array($points, $userid), __FUNCTION__, __LINE__); // We need to set $add here, two - $added = (!SQL_HASZEROAFFECTED()); + $added = (!ifSqlHasZeroAffectedRows()); } else { // Add points to account initReferralSystem(); diff --git a/inc/libs/blacklist_functions.php b/inc/libs/blacklist_functions.php index ab92566791..9097b41772 100644 --- a/inc/libs/blacklist_functions.php +++ b/inc/libs/blacklist_functions.php @@ -69,7 +69,7 @@ function isGenericBlacklisted ($type, $data) { return FALSE; } elseif (!isset($GLOBALS['blacklist_data'][$type][$data])) { // Check black-list for given email - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `id`, `data`, `pool_id`, @@ -88,16 +88,16 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Jupp, we got one listed - $GLOBALS['blacklist_data'][$type][$data] = SQL_FETCHARRAY($result); + $GLOBALS['blacklist_data'][$type][$data] = sqlFetchArray($result); // Mark it as listed $listed = TRUE; } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } else { // Is found in cache -> black-listed $listed = TRUE; @@ -133,7 +133,7 @@ function insertGenericInBlacklist ($type, $data, $poolId = NULL, $provider = 'BL reportBug(__FUNCTION__, __LINE__, 'Blacklisting of type ' . $type . ' is disabled, data=' . $data . ',poolId=' . convertZeroToNull($poolId)); } elseif (!isUrlBlacklisted($data)) { // Did not find a record so we can add it... :) - SQL_QUERY_ESC("INSERT INTO + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_blacklist` ( `data`, @@ -155,7 +155,7 @@ function insertGenericInBlacklist ($type, $data, $poolId = NULL, $provider = 'BL } // END - if // Return insert id for debugging/reporting pursposes - return SQL_INSERT_ID(); + return getSqlInsertId(); } // ---------------------------------------------------------------------------- diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index bb118906a0..b053c1d193 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -96,14 +96,14 @@ function addTurboBonus ($id, $userid, $type) { } // Add points to his account directly - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `turbo_bonus`=`turbo_bonus`+%s WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `turbo_bonus`=`turbo_bonus`+%s WHERE `userid`=%s LIMIT 1", array( $points, bigintval($userid) ), __FUNCTION__, __LINE__); // Rember this whole data for displaying ranking list - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`, `mail_id`, `bonus_id`, `level`, `points`, `timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`, `mail_id`, `bonus_id`, `level`, `points`, `timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())", array( bigintval($userid), $mailId, @@ -132,7 +132,7 @@ function addBonusRanks ($data, $type, $userid) { $ranks = count(explode(';', getTurboRates())) + 1; // Load current user's data - $result = SQL_QUERY_ESC("SELECT `level`, `points`, `timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND `userid`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `level`, `points`, `timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND `userid`=%s LIMIT 1", array( $type, $data, @@ -140,9 +140,9 @@ function addBonusRanks ($data, $type, $userid) { ), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load data - $GLOBALS['ranking_content'] = merge_array($GLOBALS['ranking_content'], SQL_FETCHARRAY($result)); + $GLOBALS['ranking_content'] = merge_array($GLOBALS['ranking_content'], sqlFetchArray($result)); // Remember all values for later use $self = TRUE; @@ -155,13 +155,13 @@ function addBonusRanks ($data, $type, $userid) { } // END - if // Load rankings - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}", array($type, $data), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Output all ranks (levels) - for ($rank = 1; $rank <= SQL_NUMROWS($result); $rank++) { + for ($rank = 1; $rank <= sqlNumRows($result); $rank++) { // Load data - $result_users = SQL_QUERY_ESC("SELECT + $result_users = sqlQueryEscaped("SELECT `userid`, `points` FROM @@ -177,13 +177,13 @@ LIMIT 1", $rows['points'] = '---'; // Are you one of them? - if (SQL_NUMROWS($result_users) == 1) { + if (sqlNumRows($result_users) == 1) { // Load data - $rows = merge_array($rows, SQL_FETCHARRAY($result_users)); + $rows = merge_array($rows, sqlFetchArray($result_users)); } // END - if // Free result - SQL_FREERESULT($result_users); + sqlFreeResult($result_users); // Add more $rows['rank'] = $rank; @@ -274,11 +274,11 @@ function handleBonusPoints ($mode, $userid) { // Purges expired fast-click bonus entries function purgeExpiredTurboBonus () { // Remove entries - $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE (UNIX_TIMESTAMP() - `timemark`) >= {?bonus_timeout?}', __FUNCTION__, __LINE__); + $result = sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE (UNIX_TIMESTAMP() - `timemark`) >= {?bonus_timeout?}', __FUNCTION__, __LINE__); - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Send out email to admin - sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_purge_turbo', SQL_AFFECTEDROWS()); + sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_purge_turbo', sqlAffectedRows()); } // END - if } diff --git a/inc/libs/booking_functions.php b/inc/libs/booking_functions.php index 21ae3239f2..758dc7d847 100644 --- a/inc/libs/booking_functions.php +++ b/inc/libs/booking_functions.php @@ -49,7 +49,7 @@ function addBookingRecord ($subject, $userid, $points, $pointsMode, $accountType } // END - if // Add record entry here - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_booking` (`userid`, `subject`, `points_mode`, `points_account_type`, `points`) VALUES (%s, '%s', '%s', '%s', %s)", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_booking` (`userid`, `subject`, `points_mode`, `points_account_type`, `points`) VALUES (%s, '%s', '%s', '%s', %s)", array( bigintval($userid), $subject, diff --git a/inc/libs/country_functions.php b/inc/libs/country_functions.php index 5f54e8211c..7254ff1022 100644 --- a/inc/libs/country_functions.php +++ b/inc/libs/country_functions.php @@ -46,7 +46,7 @@ function generateCountryInfo ($id) { $ret = '{--COUNTRY_CODE_404--}'; // Load code and description - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `code`, `descr` FROM @@ -57,9 +57,9 @@ LIMIT 1", array(bigintval($id)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load entry - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); //* DEBUG: */ print($id.'=
'.print_r($content, TRUE).'
'); // Construct human-readable description @@ -67,7 +67,7 @@ LIMIT 1", } // END - if // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return info return $ret; diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index 89303d8aef..4e312104a4 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -67,7 +67,7 @@ function generateDoublerTable ($userid = NULL, $done = 'N', $ref = 'N', $sort = } // List entries - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `userid`, `refid`, `points`, @@ -88,10 +88,10 @@ LIMIT %s", $limit ), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // List entries $OUT = ''; - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Rewrite userid/refid only if admin is in // @TODO Can't this be moved into EL? if (isAdmin()) { @@ -112,7 +112,7 @@ LIMIT %s", } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } else { // List no entries $OUT = ' diff --git a/inc/libs/earning_functions.php b/inc/libs/earning_functions.php index 345a06cd53..cac106ac28 100644 --- a/inc/libs/earning_functions.php +++ b/inc/libs/earning_functions.php @@ -103,7 +103,7 @@ function doMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { // Insert member earning entry function insertMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { // Insert the record - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_earning` (`earning_id`, `earning_userid`, `earning_daily_amount`, `earning_active`) VALUES(%s,%s,%s,'%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_earning` (`earning_id`, `earning_userid`, `earning_daily_amount`, `earning_active`) VALUES(%s,%s,%s,'%s')", array( bigintval($earningId), getMemberId(), @@ -113,7 +113,7 @@ function insertMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { // Prepare content $content = array( - 'insert_id' => SQL_INSERT_ID(), + 'insert_id' => getSqlInsertId(), 'earning_id' => bigintval($earningId), 'daily_amount' => bigintval($dailyAmount), 'is_active' => $isActive @@ -144,7 +144,7 @@ function updateMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { } // END - if // Update database record - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_earning` SET `earning_daily_amount`=%s, @@ -161,7 +161,7 @@ LIMIT 1", array( ), __FUNCTION__, __LINE__); // Determine whether something has changed - $status = (!SQL_HASZEROAFFECTED()); + $status = (!ifSqlHasZeroAffectedRows()); // Has the record changed? if ($status === TRUE) { diff --git a/inc/libs/forced_functions.php b/inc/libs/forced_functions.php index 0f9c80d381..1705959c93 100644 --- a/inc/libs/forced_functions.php +++ b/inc/libs/forced_functions.php @@ -189,11 +189,11 @@ function getArrayFromForcedAdsByType ($forcedType = NULL) { // Is forced type not NULL? if (!is_null($forcedType)) { // Then set proper WHERE - $where = sprintf("WHERE `forced_ads_type`='%s'", SQL_ESCAPE($forcedType)); + $where = sprintf("WHERE `forced_ads_type`='%s'", sqlEscapeString($forcedType)); } // END - if // Search all given types - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `forced_ads_id`, `forced_ads_ad_url`, `forced_ads_click_url`, @@ -213,16 +213,16 @@ ORDER BY `forced_ads_id` ASC', __FUNCTION__, __LINE__); // Is there at least one entry? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Get all elements - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add it $forcedAds[$content['forced_ads_id']] = $content; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it return $forcedAds; @@ -237,11 +237,11 @@ function getArrayFromForcedCostsByVisibility ($visibility = NULL) { // Is visibility not NULL? if (!is_null($visibility)) { // Then add WHERE statement - $where = sprintf(" WHERE `forced_costs_visibility`='%s'", SQL_ESCAPE($visibility)); + $where = sprintf(" WHERE `forced_costs_visibility`='%s'", sqlEscapeString($visibility)); } // END - if // Search all given types - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `forced_costs_id`, `forced_costs_price_click`, `forced_costs_payment_click`, @@ -253,16 +253,16 @@ ORDER BY `forced_costs_id` ASC", __FUNCTION__, __LINE__); // Is there at least one entry? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Get all elements - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add it $forcedCosts[$content['forced_costs_id']] = $content; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it return $forcedCosts; @@ -274,7 +274,7 @@ function getArrayFromForcedCampaignsByArray ($ids, $status) { $forcedCampaigns = array(); // Search all given types - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `forced_campaign_id`, UNIX_TIMESTAMP(`forced_campaign_created`) AS `forced_campaign_created`, `forced_campaign_status`, @@ -301,16 +301,16 @@ ORDER BY ), __FUNCTION__, __LINE__); // Is there at least one entry? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Get all elements - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add it $forcedCampaigns[$content['forced_campaign_id']] = $content; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it return $forcedCampaigns; @@ -372,7 +372,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data // Update the status now // ---------- Comment out for debugging/developing member actions! --------- - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_forced_campaigns` SET `forced_campaign_status`='%s' WHERE `forced_campaign_id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_forced_campaigns` SET `forced_campaign_status`='%s' WHERE `forced_campaign_id`=%s LIMIT 1", array( $newStatus, bigintval($campaignId) @@ -381,7 +381,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data // Was that fine? // ---------- Comment out for debugging/developing member actions! --------- - if (SQL_AFFECTEDROWS() != 1) { + if (sqlAffectedRows() != 1) { // No, something went wrong return FALSE; } // END - if diff --git a/inc/libs/grade_functions.php b/inc/libs/grade_functions.php index a3dc9067e1..42c781db2a 100644 --- a/inc/libs/grade_functions.php +++ b/inc/libs/grade_functions.php @@ -54,7 +54,7 @@ function generateGradeDataParentIdOptions ($defaultId = NULL) { } // END - if // Look for all - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `grade_id`, `grade_name` FROM @@ -68,9 +68,9 @@ ORDER BY $gradeValues = array(); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all entries - while ($grade = SQL_FETCHARRAY($result)) { + while ($grade = sqlFetchArray($result)) { // Add it to arrays array_push($gradeKeys , $grade['grade_id']); array_push($gradeValues, $grade['grade_name']); @@ -86,7 +86,7 @@ ORDER BY ); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return cache diff --git a/inc/libs/holiday_functions.php b/inc/libs/holiday_functions.php index 01a28020d3..340a5abac8 100644 --- a/inc/libs/holiday_functions.php +++ b/inc/libs/holiday_functions.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { // Stops all expired holidays function stopHolidays () { // Let's find some expired holiday requests... - $result_stop = SQL_QUERY("SELECT + $result_stop = sqlQuery("SELECT `userid`, `holiday_start`, `holiday_end`, @@ -54,7 +54,7 @@ WHERE `holiday_end` <= UNIX_TIMESTAMP() ORDER BY `userid` ASC", __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result_stop)) { + if (!ifSqlHasZeroNums($result_stop)) { // We foud at least one $admin = ''; @@ -62,13 +62,13 @@ ORDER BY initSqls(); // Process all found entries - while ($content = SQL_FETCHARRAY($result_stop)) { + while ($content = sqlFetchArray($result_stop)) { // Stop holiday - addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_holidays` WHERE `userid`=%s LIMIT 1", + addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_holidays` WHERE `userid`=%s LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, FALSE)); // Unlock account - addSql(SQL_QUERY_ESC("UPDATE + addSql(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `holiday_active`='N', @@ -101,7 +101,7 @@ LIMIT 1", } // END - if // Free memory - SQL_FREERESULT($result_stop); + sqlFreeResult($result_stop); } // ---------------------------------------------------------------------------- diff --git a/inc/libs/jackpot_functions.php b/inc/libs/jackpot_functions.php index 4c8efb6688..a8964e07ba 100644 --- a/inc/libs/jackpot_functions.php +++ b/inc/libs/jackpot_functions.php @@ -47,19 +47,19 @@ function getJackpotPoints () { $data['points'] = '0.00000'; // Read them - $result = SQL_QUERY("SELECT `points` FROM `{?_MYSQL_PREFIX?}_jackpot` WHERE `ok`='ok' LIMIT 1", __FUNCTION__, __LINE__); + $result = sqlQuery("SELECT `points` FROM `{?_MYSQL_PREFIX?}_jackpot` WHERE `ok`='ok' LIMIT 1", __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // No, so create line - SQL_QUERY("INSERT INTO `{?_MYSQL_PREFIX?}_jackpot` (`ok`, `points`) VALUES ('ok','0.00000')", __FUNCTION__, __LINE__); + sqlQuery("INSERT INTO `{?_MYSQL_PREFIX?}_jackpot` (`ok`, `points`) VALUES ('ok','0.00000')", __FUNCTION__, __LINE__); } else { // Read the line - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return them return $data['points']; @@ -71,7 +71,7 @@ function addPointsToJackpot ($points) { $jackpot = getJackpotPoints(); // Update points - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_jackpot` SET `points`=`points`+%s WHERE `ok`='ok' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_jackpot` SET `points`=`points`+%s WHERE `ok`='ok' LIMIT 1", array($points), __FUNCTION__, __LINE__); } @@ -86,13 +86,13 @@ function subtractPointsFromJackpot ($points) { // Enougth points i jackpot? if ($jackpot >= $points) { // Update points when there are enougth points in jackpot - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_jackpot` SET `points`=`points`-%s WHERE `ok`='ok' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_jackpot` SET `points`=`points`-%s WHERE `ok`='ok' LIMIT 1", array($points), __FUNCTION__, __LINE__); - $ret = (!SQL_HASZEROAFFECTED()); + $ret = (!ifSqlHasZeroAffectedRows()); } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return the result return $ret; diff --git a/inc/libs/mailid_functions.php b/inc/libs/mailid_functions.php index c56b861466..7d1aeb7f14 100644 --- a/inc/libs/mailid_functions.php +++ b/inc/libs/mailid_functions.php @@ -93,7 +93,7 @@ function doMailIdAdd ($data) { // @TODO Rewrite this to a filter switch ($data['link_type']) { case 'NORMAL': - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", array(bigintval($data['id'])), __FILE__, __LINE__); // Update mediadata as well @@ -104,7 +104,7 @@ function doMailIdAdd ($data) { break; case 'BONUS': - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", array(bigintval($data['id'])), __FILE__, __LINE__); // Update mediadata as well @@ -123,13 +123,13 @@ function doMailIdAdd ($data) { // @TODO Rewrite these blocks to filter if (isExtensionInstalledAndNewer('user', '0.1.2')) { // Update counter - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mails_confirmed`=`mails_confirmed`+1 WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mails_confirmed`=`mails_confirmed`+1 WHERE `userid`=%s LIMIT 1", array(bigintval($data['userid'])), __FILE__, __LINE__); // Update random confirmed as well? if ((isExtensionInstalledAndNewer('user', '0.3.4')) && (isRandomReferralIdEnabled())) { // Update second counter - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=`rand_confirmed` + 1 WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=`rand_confirmed` + 1 WHERE `userid`=%s LIMIT 1", array(bigintval($data['userid'])), __FILE__, __LINE__); } // END - if } // END - if @@ -152,7 +152,7 @@ function doMailIdAdd ($data) { } // END - if // Count down ref_payout value - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=`ref_payout`-1 WHERE `userid`=%s AND `ref_payout` > 0 LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=`ref_payout`-1 WHERE `userid`=%s AND `ref_payout` > 0 LIMIT 1", array(bigintval($data['userid'])), __FILE__, __LINE__); // Add points @@ -197,7 +197,7 @@ function doMailIdAdd ($data) { } // Remove link from table - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `id`=%s LIMIT 1", array(bigintval($data['link_id'])), __FILE__, __LINE__); } diff --git a/inc/libs/mediadata_functions.php b/inc/libs/mediadata_functions.php index d59b9ab730..27f38ad324 100644 --- a/inc/libs/mediadata_functions.php +++ b/inc/libs/mediadata_functions.php @@ -51,7 +51,7 @@ function updateMediadataEntry ($keys_array, $mode, $value) { // Is an array so we can run it through foreach ($keys_array as $key) { // First check if it does exist - $result_media = SQL_QUERY_ESC("SELECT + $result_media = sqlQueryEscaped("SELECT `media_key` FROM `{?_MYSQL_PREFIX?}_mediadata` @@ -59,9 +59,9 @@ WHERE `media_key`='%s' LIMIT 1", array($key), __FUNCTION__, __LINE__); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',SQL_NUMROWS()=' . SQL_NUMROWS($result_media)); - if (SQL_NUMROWS($result_media) == 0) { + if (sqlNumRows($result_media) == 0) { // Not found so we create it (mode will be ignored here!) - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')", array($key, $value), __FUNCTION__, __LINE__); } else { // Update entry @@ -72,17 +72,17 @@ LIMIT 1", array($key), __FUNCTION__, __LINE__); if ($mode == 'init') { // Initialize entry - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=%s WHERE `media_key`='%s' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=%s WHERE `media_key`='%s' LIMIT 1", array($value, $key), __FUNCTION__, __LINE__); } else { // Update entry - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=`media_value`".$mode."%s WHERE `media_key`='%s' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=`media_value`".$mode."%s WHERE `media_key`='%s' LIMIT 1", array($value, $key), __FUNCTION__, __LINE__); } } //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'added=' . intval($added)); - $added = (!SQL_HASZEROAFFECTED()); + $added = (!ifSqlHasZeroAffectedRows()); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'added=' . intval($added)); } // END - foreach } // END - if @@ -104,13 +104,13 @@ function getMediadataEntry ($key) { $value = ''; // Check for entry - $result = SQL_QUERY_ESC("SELECT `media_value` FROM `{?_MYSQL_PREFIX?}_mediadata` WHERE `media_key`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `media_value` FROM `{?_MYSQL_PREFIX?}_mediadata` WHERE `media_key`='%s' LIMIT 1", array($key), __FUNCTION__, __LINE__); // Is there one? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load data - list($value) = SQL_FETCHROW($result); + list($value) = sqlFetchRow($result); } // END - if // Return data diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index bb5d7c5adf..e811faed5a 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -194,7 +194,7 @@ function isNetworkTypeHandleValid ($type, $networkId) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$networkId][$type])) { // Does it exist? - $GLOBALS[__FUNCTION__][$networkId][$type] = (countSumTotalData(bigintval($networkId), 'network_types', 'network_type_id', 'network_id', TRUE, sprintf(" AND `network_type_handler`='%s'", SQL_ESCAPE($type))) == 1); + $GLOBALS[__FUNCTION__][$networkId][$type] = (countSumTotalData(bigintval($networkId), 'network_types', 'network_type_id', 'network_id', TRUE, sprintf(" AND `network_type_handler`='%s'", sqlEscapeString($type))) == 1); } // END - if // Return result @@ -206,7 +206,7 @@ function isNetworkRequestElementValid ($key, $networkTypeId, $networkId) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key])) { // Does it exist? - $GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key] = (countSumTotalData(bigintval($networkId), 'network_request_params', 'network_request_param_id', 'network_id', TRUE, sprintf(" AND `network_type_id`=%s AND `network_request_param_key`='%s'", bigintval($networkTypeId), SQL_ESCAPE($key))) == 1); + $GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key] = (countSumTotalData(bigintval($networkId), 'network_request_params', 'network_request_param_id', 'network_id', TRUE, sprintf(" AND `network_type_id`=%s AND `network_request_param_key`='%s'", bigintval($networkTypeId), sqlEscapeString($key))) == 1); } // END - if // Return result @@ -218,7 +218,7 @@ function isNetworkArrayTranslationValid ($key, $networkTypeId, $networkId) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key])) { // Does it exist? - $GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key] = (countSumTotalData(bigintval($networkId), 'network_array_translation', 'network_array_id', 'network_id', TRUE, sprintf(" AND `network_type_id`=%s AND `network_array_index`='%s'", bigintval($networkTypeId), SQL_ESCAPE($key))) == 1); + $GLOBALS[__FUNCTION__][$networkId][$networkTypeId][$key] = (countSumTotalData(bigintval($networkId), 'network_array_translation', 'network_array_id', 'network_id', TRUE, sprintf(" AND `network_type_id`=%s AND `network_array_index`='%s'", bigintval($networkTypeId), sqlEscapeString($key))) == 1); } // END - if // Return result @@ -245,7 +245,7 @@ function getNetworkDataFromId ($networkId, $column = '') { $GLOBALS['network_data'][$networkId] = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_id`, `network_short_name`, `network_title`, @@ -264,13 +264,13 @@ LIMIT 1', array(bigintval($networkId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then get it - $GLOBALS['network_data'][$networkId] = SQL_FETCHARRAY($result); + $GLOBALS['network_data'][$networkId] = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return result @@ -300,7 +300,7 @@ function getNetworkDataByTypeId ($networkTypeId, $column = '') { $GLOBALS['network_type_data'][$networkTypeId] = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `d`.`network_id`, `d`.`network_short_name`, `d`.`network_title`, @@ -330,13 +330,13 @@ LIMIT 1', array(bigintval($networkTypeId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then get it - $GLOBALS['network_type_data'][$networkTypeId] = SQL_FETCHARRAY($result); + $GLOBALS['network_type_data'][$networkTypeId] = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return result @@ -366,7 +366,7 @@ function getNetworkTypeDataByTypeId ($networkTypeId) { $GLOBALS['network_type_data'][$networkTypeId] = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_type_id`, `network_id`, `network_type_handler`, @@ -381,13 +381,13 @@ LIMIT 1', array(bigintval($networkTypeId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then get it - $GLOBALS['network_type_data'][$networkTypeId] = SQL_FETCHARRAY($result); + $GLOBALS['network_type_data'][$networkTypeId] = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return result @@ -408,7 +408,7 @@ function getNetworkTypeDataFromId ($networkId) { $GLOBALS['network_types'][$networkId] = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_type_id`, `network_id`, `network_type_handler`, @@ -424,16 +424,16 @@ ORDER BY array(bigintval($networkId)), __FUNCTION__, __LINE__); // Is there an entry? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Then add all - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Add it with new index as it is no longer required $GLOBALS['network_types'][$networkId][] = $row; } // END - if } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return result @@ -452,7 +452,7 @@ function getNetworkRequestParamsDataFromId ($networkRequestId) { $networkRequestData = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_request_param_id`, `network_id`, `network_type_id`, @@ -467,13 +467,13 @@ LIMIT 1', array(bigintval($networkRequestId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then get it - $networkRequestData = SQL_FETCHARRAY($result); + $networkRequestData = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $networkRequestData; @@ -491,7 +491,7 @@ function getNetworkArrayTranslationsDataFromId ($networkTranslationId) { $networkTranslationData = array(); // Query for the network data - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_array_id`, `network_id`, `network_type_id`, @@ -505,13 +505,13 @@ LIMIT 1', array(bigintval($networkTranslationId)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Then get it - $networkTranslationData = SQL_FETCHARRAY($result); + $networkTranslationData = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $networkTranslationData; @@ -531,7 +531,7 @@ function getNetworkRequestParametersByTypeId ($networkTypeId) { $GLOBALS['network_request_parameters'][$networkTypeId] = array(); // Search for all - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_id`, `network_type_id`, `network_request_param_key`, @@ -548,16 +548,16 @@ ORDER BY ), __FUNCTION__, __LINE__); // Are there records? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all but make new indexes as the old are not required - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Add it $GLOBALS['network_request_parameters'][$networkTypeId][] = $row; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return "cached" values @@ -578,7 +578,7 @@ function getFullNetworkConfigurationByTypeId ($networkTypeId) { $GLOBALS['network_full_config'][$networkTypeId] = array(); // Search for all - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `nac`.`network_id`, `ntc`.`network_type_id`, `nac`.`network_api_affiliate_id`, @@ -617,13 +617,13 @@ LIMIT 1', ), __FUNCTION__, __LINE__); // Is there one entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load it - $GLOBALS['network_full_config'][$networkTypeId] = SQL_FETCHARRAY($result); + $GLOBALS['network_full_config'][$networkTypeId] = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return "cached" values @@ -633,7 +633,7 @@ LIMIT 1', // Removes given network entry function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) { // Remove the entry - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_network_%s` WHERE `%s`=%s LIMIT %s", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_network_%s` WHERE `%s`=%s LIMIT %s", array( $table, $column, @@ -642,7 +642,7 @@ function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) { ), __FUNCTION__, __LINE__); // Return affected rows - return SQL_AFFECTEDROWS(); + return sqlAffectedRows(); } // Generates a list of networks for given script and returns it @@ -651,7 +651,7 @@ function generateAdminNetworkList ($separated = FALSE, $includeConfigured = TRUE $content = ''; // Query for all networks - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `network_id`, `network_short_name`, `network_title`, @@ -667,10 +667,10 @@ ORDER BY `network_short_name` ASC', __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // List all entries $rows = array(); - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Is this valid, then add it if ((is_array($row)) && (isset($row['network_id']))) { // Exclude configured and is it configured or same for unconfired but only if not separated lists? @@ -717,7 +717,7 @@ ORDER BY } // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return the list return $content; @@ -729,7 +729,7 @@ function generateAdminNetworkTypeList ($networkId) { $content = ''; // Query all types of this network - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_type_id`, `network_type_handler` FROM @@ -744,10 +744,10 @@ ORDER BY ), __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // List all entries $rows = array(); - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Is this valid, then add it if ((is_array($row)) && (isset($row['network_type_id']))) { // Add entry @@ -763,7 +763,7 @@ ORDER BY } // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return content return $content; @@ -775,7 +775,7 @@ function generateAdminDistinctNetworkTypeList () { $content = ''; // Query all types of this network - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `t`.`network_type_id`, `t`.`network_type_handler`, `d`.`network_title` @@ -791,10 +791,10 @@ ORDER BY `t`.`network_type_handler` ASC', __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // List all entries $rows = array(); - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Is this valid, then add it if ((is_array($row)) && (isset($row['network_type_id']))) { // Add entry @@ -810,7 +810,7 @@ ORDER BY } // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); //* DEBUG: */ die('
'.encodeEntities($content).'
'); // Return content @@ -1164,7 +1164,7 @@ function logNetworkResponseHeaders ($networkId, $networkTypeId, $headers, $type) // Is debug logging enabled or status code not 200 OK? if ((getConfig('network_logging_debug') == 'Y') || (!isHttpStatusOkay($headers[0]))) { // Add entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_network_header_logging` (`network_id`, `network_type_id`, `network_http_status_code`, `network_http_headers`, `network_logging_type`) VALUES(%s, %s, '%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_network_header_logging` (`network_id`, `network_type_id`, `network_http_status_code`, `network_http_headers`, `network_logging_type`) VALUES(%s, %s, '%s', '%s', '%s')", array( bigintval($networkId), bigintval($networkTypeId), @@ -1195,7 +1195,7 @@ function saveNetworkResponseBodyInCache ($networkId, $networkTypeId, $responseBo // So is there cache? if (countSumTotalData($networkId, 'network_cache', 'network_cache_id', 'network_id', TRUE, ' AND `network_type_id`=' . bigintval($networkTypeId)) == 1) { // Entry found, so update it - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_network_cache` SET `network_cache_data`='%s', @@ -1217,7 +1217,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); } else { // Add entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_network_cache` (`network_id`, `network_type_id`, `network_cache_data`, `network_cache_body`, `network_cache_type`, `network_cache_admin_id`) VALUES(%s, %s, '%s', '%s', '%s', %s)", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_network_cache` (`network_id`, `network_type_id`, `network_cache_data`, `network_cache_body`, `network_cache_type`, `network_cache_admin_id`) VALUES(%s, %s, '%s', '%s', '%s', %s)", array( bigintval($networkId), bigintval($networkTypeId), @@ -1276,13 +1276,13 @@ function countNetworkApiRequest ($networkData) { } // END - if // Okay, so update database - $result = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_network_api_config` SET `network_api_remaining_requests`=`network_api_remaining_requests`-1 WHERE `network_id`=%s LIMIT 1", + $result = sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_network_api_config` SET `network_api_remaining_requests`=`network_api_remaining_requests`-1 WHERE `network_id`=%s LIMIT 1", array( bigintval($networkData['network_id']) ), __FUNCTION__, __LINE__); // Return affected rows - return SQL_AFFECTEDROWS(); + return sqlAffectedRows(); } /** @@ -1398,7 +1398,7 @@ function translateNetworkApiIndex ($index) { $GLOBALS['network_array_index'] = array(); // Get all entries - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `network_array_id`, `network_array_index`, `network_translation_name` @@ -1412,16 +1412,16 @@ ORDER BY `network_array_sort` ASC', __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Get all entries - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Add it to our global array $GLOBALS['network_array_index'][$row['network_array_index']] = $row; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Default name is unknown @@ -1824,13 +1824,13 @@ function doAdminNetworkProcessAddNetwork () { } // END - if // Add the whole request to database - SQL_QUERY(getInsertSqlFromArray(postRequestArray(), 'network_data'), __FUNCTION__, __LINE__); + sqlQuery(getInsertSqlFromArray(postRequestArray(), 'network_data'), __FUNCTION__, __LINE__); // Add the id for output only - setPostRequestElement('network_id', SQL_INSERT_ID()); + setPostRequestElement('network_id', getSqlInsertId()); // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added loadTemplate('admin_network_added', FALSE, postRequestArray()); } else { @@ -2101,10 +2101,10 @@ function doAdminNetworkProcessAddNetworkType () { } // END - if // Add the whole request to database - SQL_QUERY(getInsertSqlFromArray(postRequestArray(), 'network_types'), __FUNCTION__, __LINE__); + sqlQuery(getInsertSqlFromArray(postRequestArray(), 'network_types'), __FUNCTION__, __LINE__); // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added loadTemplate('admin_network_type_added', FALSE, postRequestArray()); } else { @@ -2374,10 +2374,10 @@ function doAdminNetworkProcessAddRequestParam () { } // END - if // Add the whole request to database - SQL_QUERY(getInsertSqlFromArray(postRequestArray(), 'network_request_params'), __FUNCTION__, __LINE__); + sqlQuery(getInsertSqlFromArray(postRequestArray(), 'network_request_params'), __FUNCTION__, __LINE__); // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added loadTemplate('admin_network_request_param_added', FALSE, postRequestArray()); } else { @@ -2411,10 +2411,10 @@ function doAdminNetworkProcessAddNetworkArrayTranslation () { ) + 1)); // Add the whole request to database - SQL_QUERY(getInsertSqlFromArray(postRequestArray(), 'network_array_translation'), __FUNCTION__, __LINE__); + sqlQuery(getInsertSqlFromArray(postRequestArray(), 'network_array_translation'), __FUNCTION__, __LINE__); // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added loadTemplate('admin_network_array_translation_added', FALSE, postRequestArray()); } else { @@ -2511,10 +2511,10 @@ function doAdminNetworkProcessNetworkApiConfig () { } // Run the query - SQL_QUERY($SQL, __FUNCTION__, __LINE__); + sqlQuery($SQL, __FUNCTION__, __LINE__); // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added displayMessage('{--ADMIN_CONFIG_NETWORK_API_SAVED--}'); } else { @@ -2566,11 +2566,11 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE, $co // Shall we set for all? if ($setAll === TRUE) { // Get all handlers - $result = SQL_QUERY_ESC('SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s ORDER BY `network_type_id` ASC', + $result = sqlQueryEscaped('SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s ORDER BY `network_type_id` ASC', array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__); // Are there entries? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // No, then abort here displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}'); return; @@ -2580,7 +2580,7 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE, $co $numRows = 0; // Fetch all ids - while (list($typeId) = SQL_FETCHROW($result)) { + while (list($typeId) = sqlFetchRow($result)) { // Set it in GET data setGetRequestElement('network_type_id', $typeId); @@ -2589,7 +2589,7 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE, $co } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output message if ($numRows > 0) { @@ -2604,12 +2604,12 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE, $co $SQL = getInsertSqlFromArray(postRequestArray(), 'network_handler_config'); // Run the query - SQL_QUERY($SQL, __FUNCTION__, __LINE__); + sqlQuery($SQL, __FUNCTION__, __LINE__); // Shall we display the message? if ($displayMessage === TRUE) { // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}'); } else { @@ -2618,7 +2618,7 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE, $co } } else { // Return amount of affected rows (1 or 2) - return SQL_AFFECTEDROWS(); + return sqlAffectedRows(); } } } @@ -2662,11 +2662,11 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE, $c // Shall we set for all? if ($setAll === TRUE) { // Get all data entries - $result = SQL_QUERY_ESC('SELECT `network_data_id` FROM `{?_MYSQL_PREFIX?}_network_handler_config` WHERE `network_id`=%s ORDER BY `network_type_id` ASC', + $result = sqlQueryEscaped('SELECT `network_data_id` FROM `{?_MYSQL_PREFIX?}_network_handler_config` WHERE `network_id`=%s ORDER BY `network_type_id` ASC', array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__); // Are there entries? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // No, then abort here displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}'); return; @@ -2676,7 +2676,7 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE, $c $numRows = 0; // Fetch all ids - while (list($dataId) = SQL_FETCHROW($result)) { + while (list($dataId) = sqlFetchRow($result)) { // Set it in GET data setPostRequestElement('network_data_id', $dataId); @@ -2685,7 +2685,7 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE, $c } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output message if ($numRows > 0) { @@ -2700,12 +2700,12 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE, $c $SQL = getUpdateSqlFromArray(postRequestArray(), 'network_handler_config', 'network_data_id', postRequestElement('network_data_id'), array('network_data_id')); // Run the query - SQL_QUERY($SQL, __FUNCTION__, __LINE__); + sqlQuery($SQL, __FUNCTION__, __LINE__); // Shall we display the message? if ($displayMessage === TRUE) { // Output message - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Successfully added displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}'); } else { @@ -2714,7 +2714,7 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE, $c } } else { // Return amount of affected rows (1 or 2) - return SQL_AFFECTEDROWS(); + return sqlAffectedRows(); } } } @@ -2803,7 +2803,7 @@ function doAdminNetworkProcessExport () { // Exports (and displays) the table 'network_data' function doAdminNetworkExportData () { // Query for all networks - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `network_short_name`, `network_title`, `network_reflink`, @@ -2824,7 +2824,7 @@ ORDER BY $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_network_data` (`network_short_name`, `network_title`, `network_reflink`, `network_data_separator`, `network_row_separator`, `network_request_type`, `network_charset`, `network_require_id_card`, `network_query_amount`, `network_active`) VALUES' . PHP_EOL; // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row $SQL .= "('" . $content['network_short_name'] . "', '" . @@ -2843,7 +2843,7 @@ ORDER BY $SQL = substr($SQL, 0, -2); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output the SQL query loadTemplate('admin_export_network_data', FALSE, $SQL); @@ -2858,7 +2858,7 @@ function doAdminNetworkExportTypes () { } // END - if // Get all network types of given network - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_type_id`, `network_id`, `network_type_handler`, @@ -2881,7 +2881,7 @@ ORDER BY $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`, `network_type_handler`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`, `network_type_reload_time_unit`, `network_text_encoding`) VALUES' . PHP_EOL; // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row $SQL .= '(' . $content['network_type_id'] . ', ' . @@ -2915,7 +2915,7 @@ ORDER BY $SQL = substr($SQL, 0, -2); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output the SQL query loadTemplate('admin_export_network_types', FALSE, $SQL); @@ -2930,7 +2930,7 @@ function doAdminNetworkExportRequestParams () { } // END - if // Get all network types of given network - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_id`, `network_type_id`, `network_request_param_key`, @@ -2951,14 +2951,14 @@ ORDER BY $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`, `network_type_id`, `network_request_param_key`, `network_request_param_value`, `network_request_param_default`) VALUES' . PHP_EOL; // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row $SQL .= '(' . $content['network_id'] . ', ' . $content['network_type_id'] . ", '" . $content['network_request_param_key'] . "', '" . $content['network_request_param_value'] . "', "; - + // Is the column NULL? if (is_null($content['network_request_param_default'])) { // Column is NULL @@ -2973,7 +2973,7 @@ ORDER BY $SQL = substr($SQL, 0, -2); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output the SQL query loadTemplate('admin_export_network_request_params', FALSE, $SQL); @@ -2988,7 +2988,7 @@ function doAdminNetworkExportArrayTranslation () { } // END - if // Get all network types of given network - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `network_id`, `network_type_id`, `network_array_index`, @@ -3008,7 +3008,7 @@ ORDER BY $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_network_array_translation` (`network_id`, `network_type_id`, `network_array_index`, `network_array_sort`) VALUES' . PHP_EOL; // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row $SQL .= '(' . $content['network_id'] . ', ' . @@ -3021,7 +3021,7 @@ ORDER BY $SQL = substr($SQL, 0, -2); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Output the SQL query loadTemplate('admin_export_network_array_translation', FALSE, $SQL); diff --git a/inc/libs/optimize_functions.php b/inc/libs/optimize_functions.php index 9a30d05b1e..cc4f0ac078 100644 --- a/inc/libs/optimize_functions.php +++ b/inc/libs/optimize_functions.php @@ -50,17 +50,17 @@ function repairOptimizeDatabase () { $tot_all = '0'; // Get table status - $result = SQL_QUERY('SHOW TABLE STATUS FROM `{?__DB_NAME?}`', __FUNCTION__, __LINE__); + $result = sqlQuery('SHOW TABLE STATUS FROM `{?__DB_NAME?}`', __FUNCTION__, __LINE__); // Init array $ret['total_size'] = '0'; - $ret['total_tabs'] = SQL_NUMROWS($result); + $ret['total_tabs'] = sqlNumRows($result); $ret['tables'] = array(); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Fetch all rows - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { $tot_data = $row['Data_length']; $tot_idx = $row['Index_length']; $total = $tot_data + $tot_idx; @@ -72,14 +72,14 @@ function repairOptimizeDatabase () { $gain = round ($gain, 3); // Repair table - $result1 = SQL_QUERY_ESC("REPAIR TABLE `%s`", + $result1 = sqlQueryEscaped("REPAIR TABLE `%s`", array($row['Name']), __FUNCTION__, __LINE__); - $rep = SQL_FETCHARRAY($result1); + $rep = sqlFetchArray($result1); // Optimize table - $result1 = SQL_QUERY_ESC("OPTIMIZE TABLE `%s`", + $result1 = sqlQueryEscaped("OPTIMIZE TABLE `%s`", array($row['Name']), __FUNCTION__, __LINE__); - $opt = SQL_FETCHARRAY($result1); + $opt = sqlFetchArray($result1); // Add data to array array_push($ret['tables'], array($row['Name'], $opt['Msg_text'], $rep['Msg_text'], $total, $gain)); @@ -93,15 +93,15 @@ function repairOptimizeDatabase () { $ret['total_gain'] = $total_gain; // Insert new row - $result = SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_optimize_gain` (`gain`) VALUES (%s)", + $result = sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_optimize_gain` (`gain`) VALUES (%s)", array($total_gain), __FUNCTION__, __LINE__); // Get total runs and total optimization count - $result = SQL_QUERY('SELECT COUNT(`id`) AS `total_rows`, SUM(`gain`) AS `total_optimized` FROM `{?_MYSQL_PREFIX?}_optimize_gain`', __FUNCTION__, __LINE__); - $ret = merge_array($ret, SQL_FETCHARRAY($result)); + $result = sqlQuery('SELECT COUNT(`id`) AS `total_rows`, SUM(`gain`) AS `total_optimized` FROM `{?_MYSQL_PREFIX?}_optimize_gain`', __FUNCTION__, __LINE__); + $ret = merge_array($ret, sqlFetchArray($result)); // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return array return $ret; diff --git a/inc/libs/payout_functions.php b/inc/libs/payout_functions.php index a75d1124d2..e8b2e853b5 100644 --- a/inc/libs/payout_functions.php +++ b/inc/libs/payout_functions.php @@ -45,7 +45,7 @@ function outputPayoutList ($points) { // Enougth points? if ($points > 0) { // Pay this out! - $result = SQL_QUERY_ESC('SELECT + $result = sqlQueryEscaped('SELECT `id`, `type`, `rate`, @@ -57,12 +57,12 @@ WHERE ORDER BY `type` ASC', array($points), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Init output $OUT = ''; // Now let's check - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Are these points enougth? if ($points >= $content['min_points']) { // Prepare content for template @@ -81,7 +81,7 @@ ORDER BY } // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } else { // Points is empty displayErrorMessage('{--MEMBER_PAYOUT_NO_POINTS_ENTERED--}'); diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 6e349c730c..849874be8d 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -43,13 +43,13 @@ if (!defined('__SECURITY')) { // Auto-start referral rallyes function autostartReferralRallyes ($result) { // Load all rallyes (usally we have only one rallye active per time! - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Set notified to Y - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `notified`='Y' @@ -59,7 +59,7 @@ LIMIT 1", array(bigintval($content['id'])), __FUNCTION__, __LINE__); // Query all users - $result_user = SQL_QUERY("SELECT + $result_user = sqlQuery("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -70,7 +70,7 @@ ORDER BY `userid` ASC", __FUNCTION__, __LINE__); // Let's begin with the userids... - while ($row = SQL_FETCHARRAY($result_user)) { + while ($row = sqlFetchArray($result_user)) { // Merge both arrays $content = merge_array($content, $row); @@ -81,7 +81,7 @@ ORDER BY if (empty($count)) $count = '0'; // Added prevent some unknown troubles... :-? // Check if line is already included... - $result_ref = SQL_QUERY_ESC("SELECT + $result_ref = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` @@ -92,9 +92,9 @@ LIMIT 1", array(bigintval($content['id']), bigintval($content['userid'])), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_HASZERONUMS($result_ref)) { + if (ifSqlHasZeroNums($result_ref)) { // Add userid and his ref count to table - $result_ref = SQL_QUERY_ESC("SELECT + $result_ref = sqlQueryEscaped("SELECT SUM(`p`.`points`) AS `points` FROM `{?_MYSQL_PREFIX?}_user_points` AS `p` @@ -113,15 +113,15 @@ WHERE array(bigintval($content['userid'])), __FUNCTION__, __LINE__); // Get points - list($cpoints) = SQL_FETCHROW($result_ref); + list($cpoints) = sqlFetchRow($result_ref); // Free result - SQL_FREERESULT($result_ref); + sqlFreeResult($result_ref); if (empty($cpoints)) $cpoints = '0.00000'; // Add info line - SQL_QUERY_ESC("INSERT INTO + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` ( `rallye_id`, @@ -144,7 +144,7 @@ WHERE } // END - if // Free memory - SQL_FREERESULT($result_ref); + sqlFreeResult($result_ref); // Ignored but for the template required refs (made before start of rallye) $content['refs'] = $count; @@ -167,7 +167,7 @@ WHERE sendAdminNotification('{%message,ADMIN_RALLYE_NOTIFY_SUBJECT=' . $content['title'] . '%}', $templ, $content); // Free memory - SQL_FREERESULT($result_user); + sqlFreeResult($result_user); } // @@ -179,7 +179,7 @@ function addReferralRallyePrices ($rallye, $mode = 'email') { } // END - switch // Load prices - $result_prices = SQL_QUERY_ESC("SELECT + $result_prices = sqlQueryEscaped("SELECT `price_level`, `points`, `info` @@ -192,14 +192,14 @@ ORDER BY array($rallye), __FUNCTION__, __LINE__); // Entries found? - if (!SQL_HASZERONUMS($result_prices)) { + if (!ifSqlHasZeroNums($result_prices)) { // Load prices $prices = ''; if ($mode == PHP_EOL) { $prices = '{--RALLYE_MEMBER_PRICES_ADDED--}:' . $mode . '------------------------------' . $mode; } // END - if - while ($content = SQL_FETCHARRAY($result_prices)) { + while ($content = sqlFetchArray($result_prices)) { $prices .= $content['price_level']. '{--RALLYE_PRICE--}:'; if (!empty($content['info'])) { $prices .= $content['info']; @@ -210,7 +210,7 @@ ORDER BY } // END - if // Free memory - SQL_FREERESULT($result_prices); + sqlFreeResult($result_prices); } else { // No prices??? $prices = '{%message,RALLYE_MEMBER_NO_PRICES=' . $mode . '%}'; @@ -235,7 +235,7 @@ function addReferralRallyeTopUsers ($mode, $rallye, $default=0) { $prices = getTotalRallyePrices($rallye); // And load only limited users - $result = SQL_QUERY_ESC("SELECT DISTINCT + $result = sqlQueryEscaped("SELECT DISTINCT `u`.`userid`, `u`.`refs`, `u`.`curr_points`, @@ -266,13 +266,13 @@ ORDER BY ); // Load all users - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $row['userid'] . ',refs=' . $row['refs']); // Get current refs $count = getReferralRallyeRefsCount($row['userid'], $row['refs']); // Points of ref's - $result_ref = SQL_QUERY_ESC("SELECT + $result_ref = sqlQueryEscaped("SELECT `p`.`points` FROM `{?_MYSQL_PREFIX?}_user_points` AS `p` @@ -291,10 +291,10 @@ LIMIT 1", array(bigintval($row['userid'])), __FUNCTION__, __LINE__); // Get points - list($refpoints) = SQL_FETCHROW($result_ref); + list($refpoints) = sqlFetchRow($result_ref); // Free result - SQL_FREERESULT($result_ref); + sqlFreeResult($result_ref); // Fix empty values (ugly code again) if (empty($refpoints)) { @@ -321,7 +321,7 @@ LIMIT 1", } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Sort whole array array_pk_sort($content, array('cpoints', 'ref'), 0, 1, TRUE); @@ -382,7 +382,7 @@ function addUserToReferralRallye ($userid, $content = array()) { } // END - if // Check for an auto-add rallye - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `id`, `title`, `start_time`, @@ -397,16 +397,16 @@ WHERE `auto_add_new_user`='Y' AND `expired`='N' LIMIT 1", __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Init variables $min_users = '0'; $min_prices = '0'; // Load and merge data - $content = merge_array($content, SQL_FETCHARRAY($result)); + $content = merge_array($content, sqlFetchArray($result)); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Notify the user? if ($content['send_notify'] == 'Y') { @@ -415,7 +415,7 @@ LIMIT 1", __FUNCTION__, __LINE__); } // END - if // Check if line is already included... - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` @@ -429,9 +429,9 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // Is this user added? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // Add userid and his ref count to table - SQL_QUERY_ESC("INSERT INTO + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` ( `rallye_id`, @@ -449,7 +449,7 @@ LIMIT 1", } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if } @@ -483,10 +483,10 @@ function getTotalRallyeWinners ($rallyeId) { // Stops the given rallye result (from SQL layer) by marking it as expirced function stopRallyeByResult ($result) { // Load rallye data - $content = SQL_FETCHARRAY($result); + $content = sqlFetchArray($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Init array $count = '0'; @@ -523,7 +523,7 @@ function stopRallyeByResult ($result) { } // END - if // Expire rallye - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `expired`='Y' WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_rallye_data` SET `expired`='Y' WHERE `id`=%s LIMIT 1", array(bigintval($content['id'])), __FUNCTION__, __LINE__); // Run array through (by userid is the most important 2nd-level-array) @@ -609,7 +609,7 @@ function getReferralRallyeUserDataFromArray ($userIds) { $ret = ''; // Load users - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `userid`, `gender`, `surname`, `family`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -624,7 +624,7 @@ LIMIT %s", $userid_string, count($userIds) ), __FUNCTION__, __LINE__); - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Construct the message masked and add it $ret .= sprintf("{%%pipe,translateGender=%s%} %s %s (%s) - %s\n", $content['gender'], @@ -649,7 +649,7 @@ function getArrayFromReferralRallyePrices ($rallye) { ); // Load prices - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `price_level`, `points`, `info` @@ -662,14 +662,14 @@ ORDER BY array(bigintval($rallye)), __FUNCTION__, __LINE__); // Transfer elements - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { $prices['level'][] = $content['price_level']; array_push($prices['points'], $content['points']); array_push($prices['info'], $content['info']); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return array return $prices; @@ -695,7 +695,7 @@ function getArrayFromReferralRallyeUsers ($rallye) { * - refs = Old amount of referrals (before the rallye has started) * - curr_points = Current amount of total points */ - $result_user = SQL_QUERY_ESC("SELECT + $result_user = sqlQueryEscaped("SELECT `userid`, `refs`, `curr_points` @@ -706,12 +706,12 @@ WHERE ORDER BY `userid` ASC", array(bigintval($rallye)), __FUNCTION__, __LINE__); - while ($content = SQL_FETCHARRAY($result_user)) { + while ($content = sqlFetchArray($result_user)) { // Load current ref count $count = getReferralRallyeRefsCount($content['userid'], $content['refs']); // Points of ref's - $result_ref = SQL_QUERY_ESC("SELECT + $result_ref = sqlQueryEscaped("SELECT SUM(`p`.`points`) AS `points` FROM `{?_MYSQL_PREFIX?}_user_points` AS `p` @@ -731,10 +731,10 @@ LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__); // Get points - list($refpoints) = SQL_FETCHROW($result_ref); + list($refpoints) = sqlFetchRow($result_ref); // Free result - SQL_FREERESULT($result_ref); + sqlFreeResult($result_ref); // Fix empty refpoints if (empty($refpoints)) $refpoints = '0'; @@ -746,7 +746,7 @@ LIMIT 1", } // END - while // Free memory - SQL_FREERESULT($result_user); + sqlFreeResult($result_user); // Sort array for refs (descending) array_pk_sort($users, array('cpoints', 'ref'), 0, 1, TRUE); @@ -836,7 +836,7 @@ function addReferralRallyeWinners ($mode, $rallye, $default=0) { function purgeExpiredReferralRallyes () { // Check for expired rallyes $EXPIRE = 3; // @TODO The hard-coded value... - $result_rallye = SQL_QUERY_ESC("SELECT + $result_rallye = sqlQueryEscaped("SELECT `id`, `title`, `start_time`, @@ -848,12 +848,12 @@ WHERE `expired`='Y'", array($EXPIRE), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result_rallye)) { + if (!ifSqlHasZeroNums($result_rallye)) { // Init SQLs initSqls(); // Expire found rallyes and notify admin - while ($content = SQL_FETCHARRAY($result_rallye)) { + while ($content = sqlFetchArray($result_rallye)) { // Prepare data for mail template $content['start_time'] = generateDateTime($content['start_time'], 1); $content['end_time'] = generateDateTime($content['end_time'] , 1); @@ -863,11 +863,11 @@ WHERE sendAdminNotification('{%message,ADMIN_RALLYE_PURGED_SUBJECT=' . $content['title'] . '%}', 'admin_rallye_purged', $content); // Purge whole rallye - addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1", + addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1", array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); - addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s LIMIT 1", + addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s LIMIT 1", array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); - addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1", + addSql(sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1", array(bigintval($content['id'])), __FUNCTION__, __LINE__, FALSE)); // Add task (we ignore the task id here @@ -879,7 +879,7 @@ WHERE } // END - if // Free memory - SQL_FREERESULT($result_rallye); + sqlFreeResult($result_rallye); } // @@ -965,7 +965,7 @@ function getReferralRallyeRefsCount ($currUserid, $oldReferralCount = '0') { } // END - if } else { // Load current refs from database - $result_ref = SQL_QUERY_ESC("SELECT + $result_ref = sqlQueryEscaped("SELECT SUM(s.counter) AS `cnt` FROM `{?_MYSQL_PREFIX?}_refsystem` AS `s` @@ -981,10 +981,10 @@ WHERE ), __FUNCTION__, __LINE__); // Load count @TODO Can't we rewrite this to our API? - list($count) = SQL_FETCHROW($result_ref); + list($count) = sqlFetchRow($result_ref); // Free result - SQL_FREERESULT($result_ref); + sqlFreeResult($result_ref); if (empty($count)) { $count = '0'; } else { diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index f079c6a353..b8f077ba06 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -50,11 +50,11 @@ function addRefbackPoints ($userid, $ref, $points, $ref_points) { $return = $ref_points; // Get all ref levels - $result_refs = SQL_QUERY('SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level` > 0 ORDER BY `level` ASC', + $result_refs = sqlQuery('SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level` > 0 ORDER BY `level` ASC', __FUNCTION__, __LINE__); // "Walk" through all level - while ($content = SQL_FETCHARRAY($result_refs)) { + while ($content = sqlFetchArray($result_refs)) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'level=' . $content['level'] . ',percents=' . $content['percents'] . ' - LOOP START!'); // Reset ref depths initReferralSystem(); @@ -81,7 +81,7 @@ function addRefbackPoints ($userid, $ref, $points, $ref_points) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'points=' . $points . ',percents=' . $content['percents'] . ',refback_percents=' . $content['refback_percents'] . ',level=' . $content['level'] . ',refback_points=' . $refbackPoints); // Update refback table ('refid' and 'userid' must be exchanged!) - SQL_QUERY_ESC('UPDATE + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_user_refs` SET `refback_points`=`refback_points`+%s @@ -96,7 +96,7 @@ LIMIT 1', ), __FUNCTION__, __LINE__); // Something must have been updated - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // Please report this bug reportBug(__FUNCTION__, __LINE__, 'Nothing has been updated in user_refs,userid=' . $userid . ',refid=' . convertNullToZero($refid) . ',refbackPoints=' . $refbackPoints); } // END - if @@ -117,7 +117,7 @@ LIMIT 1', } // END - while // Free result - SQL_FREERESULT($result_refs); + sqlFreeResult($result_refs); // Restore ref depth $GLOBALS['ref_level'] = $GLOBALS['refback_depth'][$userid][$ref]; @@ -150,13 +150,13 @@ function getRefbackPercents ($userid, $refid) { $GLOBALS['refback_percents'][$userid][$refid] = '0'; // Get percents from database - $result = SQL_QUERY_ESC("SELECT `refback_percents` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `refid`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `refback_percents` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `refid`=%s LIMIT 1", array($userid, $refid), __FUNCTION__, __LINE__); // Entry found? (Should be!) - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch percents - list($GLOBALS['refback_percents'][$userid][$refid]) = SQL_FETCHROW($result); + list($GLOBALS['refback_percents'][$userid][$refid]) = sqlFetchRow($result); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ',percents=' . $GLOBALS['refback_percents'][$userid][$refid]); } else { // Please report all findings @@ -164,7 +164,7 @@ function getRefbackPercents ($userid, $refid) { } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return percents @@ -179,7 +179,7 @@ function getArrayFromRefbackLevel ($refid, $level) { $userIds = array(); // Look for all - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_refs` @@ -192,16 +192,16 @@ ORDER BY // Entries found? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'numRows=' . SQL_NUMROWS($result)); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Add all - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',level=' . $level . ',userid=' . $content['userid']); array_push($userIds, $content['userid']); } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return array //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',userIds()=' . count($userIds) . ' - EXIT!'); @@ -215,7 +215,7 @@ function getArrayFromRefbackUserRefs ($userid, $level) { $refs = array(); // Get refs from database - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `r`.`id`, `r`.`refid`, `r`.`refback_percents`, @@ -239,9 +239,9 @@ ORDER BY array(bigintval($userid), bigintval($level)), __FUNCTION__, __LINE__); // Are there some entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Fetch all entries - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Init click rate $row['click_rate'] = '0'; @@ -257,7 +257,7 @@ ORDER BY } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refs()=' . count($refs) . ' - EXIT!'); @@ -274,17 +274,17 @@ function getArrayFromUserRefbackData ($id) { $id = bigintval($id); // Get entry from database - $result = SQL_QUERY_ESC("SELECT `id`, `userid`, `refid`, `refback_percents`, `level`, `refback_points` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `id`=%s AND `userid`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `id`, `userid`, `refid`, `refback_percents`, `level`, `refback_points` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `id`=%s AND `userid`=%s LIMIT 1", array($id, getMemberId()), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch data - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return entry //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $id . ',data()=' . count($data) . ' - EXIT!'); @@ -326,7 +326,7 @@ function updateMemberRefbackPercents ($id, $percents, $note) { $percents = convertCommaToDot($percents); // Update entry - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_refs` SET `refback_percents`='%s' WHERE `id`=%s AND `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_refs` SET `refback_percents`='%s' WHERE `id`=%s AND `userid`=%s LIMIT 1", array( $percents, $id, @@ -334,7 +334,7 @@ function updateMemberRefbackPercents ($id, $percents, $note) { ), __FUNCTION__, __LINE__); // Entry updated? - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // Entry not updated! $status['message'] = 'MEMBER_REFBACK_ERROR_NOT_UPDATED'; return $status; diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 2b2f0c08c4..94826655e7 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -46,11 +46,11 @@ function ifRequiredRegisterFieldsAreSet (&$array) { $ret = TRUE; foreach ($array as $key => $value) { // Check all fields that must register - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_must_register` WHERE `field_name`='%s' AND `field_required`='Y' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_must_register` WHERE `field_name`='%s' AND `field_required`='Y' LIMIT 1", array($key), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Check if extension country is not found (you have to enter the 2-chars long country code) or // if extensions is present check if country code was selected // 01 2 21 12 3 32 234 5 54 4 43 34 4 4 5 5432 2 3 3210 @@ -63,7 +63,7 @@ function ifRequiredRegisterFieldsAreSet (&$array) { } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - foreach // Return result @@ -87,7 +87,7 @@ function registerGenerateCategoryTable ($mode, $configEntry = 'register_default' } // END - if // Look for categories - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id`, `cat`, `visible` @@ -98,10 +98,10 @@ ORDER BY `sort` ASC', __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // List alle visible modules (or all to the admin) $OUT .= ''; - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Prepare array for the template $content['default_yes'] = ''; $content['default_no'] = ''; @@ -119,7 +119,7 @@ ORDER BY $OUT .= '
'; // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } else { // No categories setted up so far... $OUT .= displayMessage('{--NO_CATEGORIES_VISIBLE--}', TRUE); @@ -312,7 +312,7 @@ function doUserRegistration () { } // END - if // Create user's account... - SQL_QUERY_ESC("INSERT INTO + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_data` ( `gender`, @@ -383,7 +383,7 @@ function doUserRegistration () { ), __FUNCTION__, __LINE__); // Get his userid - $filterData['register_insert_id'] = SQL_INSERT_ID(); + $filterData['register_insert_id'] = getSqlInsertId(); // Did this work? if (!isValidId($filterData['register_insert_id'])) { @@ -397,7 +397,7 @@ function doUserRegistration () { // Shall we reset random refid? Only possible with latest ext-user if (isExtensionInstalledAndNewer('user', '0.3.4')) { // Reset all accounts, registration is done - SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__); + sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__); } // END - if // Update referral table @@ -431,7 +431,7 @@ function doUserRegistration () { } // END - foreach // Run SQL without last commata - SQL_QUERY(substr($sql, 0, -1), __FUNCTION__, __LINE__); + sqlQuery(substr($sql, 0, -1), __FUNCTION__, __LINE__); } // END - if // Registration phase is done here, so for tester accounts we end here @@ -451,32 +451,32 @@ function doUserRegistration () { $content = array( 'hash' => $GLOBALS['register_confirm_hash'], 'userid' => $filterData['register_insert_id'], - 'gender' => SQL_ESCAPE(postRequestElement('gender')), - 'surname' => SQL_ESCAPE(postRequestElement('surname')), - 'family' => SQL_ESCAPE(postRequestElement('family')), - 'email' => SQL_ESCAPE(postRequestElement('email')), - 'street' => SQL_ESCAPE(postRequestElement('street_nr')), - 'city' => SQL_ESCAPE(postRequestElement('city')), + 'gender' => sqlEscapeString(postRequestElement('gender')), + 'surname' => sqlEscapeString(postRequestElement('surname')), + 'family' => sqlEscapeString(postRequestElement('family')), + 'email' => sqlEscapeString(postRequestElement('email')), + 'street' => sqlEscapeString(postRequestElement('street_nr')), + 'city' => sqlEscapeString(postRequestElement('city')), 'zip' => bigintval(postRequestElement('zip')), 'country' => $GLOBALS['register_country_data'], - 'refid' => SQL_ESCAPE(postRequestElement('refid')), - 'password' => SQL_ESCAPE(postRequestElement('password1')), + 'refid' => sqlEscapeString(postRequestElement('refid')), + 'password' => sqlEscapeString(postRequestElement('password1')), ); } else { // No ZIP code entered $content = array( 'hash' => $GLOBALS['register_confirm_hash'], 'userid' => $filterData['register_insert_id'], - 'gender' => SQL_ESCAPE(postRequestElement('gender')), - 'surname' => SQL_ESCAPE(postRequestElement('surname')), - 'family' => SQL_ESCAPE(postRequestElement('family')), - 'email' => SQL_ESCAPE(postRequestElement('email')), - 'street' => SQL_ESCAPE(postRequestElement('street_nr')), - 'city' => SQL_ESCAPE(postRequestElement('city')), + 'gender' => sqlEscapeString(postRequestElement('gender')), + 'surname' => sqlEscapeString(postRequestElement('surname')), + 'family' => sqlEscapeString(postRequestElement('family')), + 'email' => sqlEscapeString(postRequestElement('email')), + 'street' => sqlEscapeString(postRequestElement('street_nr')), + 'city' => sqlEscapeString(postRequestElement('city')), 'zip' => '', 'country' => $GLOBALS['register_country_data'], - 'refid' => SQL_ESCAPE(postRequestElement('refid')), - 'password' => SQL_ESCAPE(postRequestElement('password1')), + 'refid' => sqlEscapeString(postRequestElement('refid')), + 'password' => sqlEscapeString(postRequestElement('password1')), ); } diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index ff25ea405a..fc12052eea 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -72,11 +72,11 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array() $SAVE = FALSE; } else { // Add a new sponsor or update his data? - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE email='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE email='%s' LIMIT 1", array($postData['email']), __FUNCTION__, __LINE__); // Is a sponsor alread in the db? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Yes, he is! if ((getWhat() == 'add_sponsor') || ($update)) { // Already found @@ -88,7 +88,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array() } // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } break; @@ -189,7 +189,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array() foreach ($postData as $k => $v) { // Do not add 'force' ! if ($k != 'force') { - $OUT .= ''; + $OUT .= ''; } // END - if } // END - foreach @@ -208,7 +208,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array() if (!empty($sql)) { // Run SQL command - $result = SQL_QUERY_ESC($sql, $DATA['values'], __FUNCTION__, __LINE__); + $result = sqlQueryEscaped($sql, $DATA['values'], __FUNCTION__, __LINE__); } // END - if } else { // Error detected @@ -272,7 +272,7 @@ function addSponsorMenu ($current) { if (isAdmin()) $WHERE = ''; // Load main menu entries - $result_main = SQL_QUERY("SELECT + $result_main = sqlQuery("SELECT `action` AS `main_action`, `title` AS `main_title` FROM @@ -282,11 +282,11 @@ WHERE " . $WHERE . " ORDER BY `sort` ASC", __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result_main)) { + if (!ifSqlHasZeroNums($result_main)) { // Load every menu and it's sub menus - while ($content = SQL_FETCHARRAY($result_main)) { + while ($content = sqlFetchArray($result_main)) { // Load sub menus - $result_sub = SQL_QUERY_ESC("SELECT + $result_sub = sqlQueryEscaped("SELECT `what` AS `sub_what`, `title` AS `sub_title` FROM @@ -299,10 +299,10 @@ WHERE ORDER BY `sort` ASC", array($content['main_action']), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result_sub)) { + if (!ifSqlHasZeroNums($result_sub)) { // Load sub menus $SUB = ''; - while ($content2 = SQL_FETCHARRAY($result_sub)) { + while ($content2 = sqlFetchArray($result_sub)) { // Check if current selected menu is matching the loaded one if ($current == $content2['sub_what']) $content2['sub_title'] = '' . $content2['sub_title'] . ''; @@ -321,7 +321,7 @@ ORDER BY } // Free memory - SQL_FREERESULT($result_sub); + sqlFreeResult($result_sub); } // END - while } else { // No main menus active @@ -329,7 +329,7 @@ ORDER BY } // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); // Return content return $OUT; @@ -362,7 +362,7 @@ function updateSponsorLogin () { // Is sponsor? if (isSponsor()) { // Update last online timestamp - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `last_online`=NOW() @@ -376,7 +376,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // This update went fine? - $login = (!SQL_HASZEROAFFECTED()); + $login = (!ifSqlHasZeroAffectedRows()); } // END - if // Return status @@ -409,7 +409,7 @@ function saveSponsorData ($postData, $content) { unset($postData[$remove]); } // END - foreach - // This array is for the submitted data which we will use with the SQL_QUERY_ESC() function to + // This array is for the submitted data which we will use with the sqlQueryEscaped() function to // secure the data $DATA = array(); @@ -419,7 +419,7 @@ function saveSponsorData ($postData, $content) { // Mmmmm, too less security here??? $sql .= " `" . secureString($key) . "`='%s',"; - // We will secure this later inside the SQL_QUERY_ESC() function + // We will secure this later inside the sqlQueryEscaped() function array_push($DATA, secureString($value)); } // END - foreach @@ -478,11 +478,11 @@ function saveSponsorData ($postData, $content) { } // END - switch // Has an entry updated? - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Template and subject are set? if (!empty($templ) && !empty($subject)) { // Run SQL command and check for success - $result = SQL_QUERY_ESC($sql, $DATA, __FUNCTION__, __LINE__); + $result = sqlQueryEscaped($sql, $DATA, __FUNCTION__, __LINE__); // Add all data to content $content['new_data'] = $postData; @@ -535,7 +535,7 @@ function generateSponsorEmailLink ($email, $mod = 'admin') { // But admins shall always see it if (isAdmin()) $locked = ''; - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` @@ -544,16 +544,16 @@ WHERE " . $locked . " LIMIT 1", array($email), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load sponsor_id - list($sponsor_id) = SQL_FETCHROW($result); + list($sponsor_id) = sqlFetchRow($result); // Rewrite email address to contact link $email = '{%url=modules.php?module=' . $mod . '&what=sponsor_contct&sponsor_id=' . bigintval($sponsor_id) . '%}'; } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return rewritten (?) email address return $email; @@ -571,11 +571,11 @@ function doProcessSponsorFormRequest ($messageArray = array()) { switch ($status) { case 'added': // Sponsor successfully added with account status = UNCONFIRMED! // Check for his id number - $result = SQL_QUERY_ESC("SELECT `id`, `hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE '%s' REGEXP `email` LIMIT 1", + $result = sqlQueryEscaped("SELECT `id`, `hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE '%s' REGEXP `email` LIMIT 1", array(postRequestElement('email')), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // id found so let's load it for the confirmation email - list($id, $hash) = SQL_FETCHROW($result); + list($id, $hash) = sqlFetchRow($result); // Prepare data for the email template $content['id'] = $id; @@ -601,7 +601,7 @@ function doProcessSponsorFormRequest ($messageArray = array()) { } // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); break; default: @@ -686,13 +686,13 @@ function fetchSponsorData ($sponsor_id, $column = 'id') { $ADD = ''; // Query for the sponsor - $result = SQL_QUERY_ESC("SELECT *".$ADD." FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `%s`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT *".$ADD." FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `%s`='%s' LIMIT 1", array($column, $sponsor_id), __FUNCTION__, __LINE__); // Is there a record? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load data from cookies - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set the sponsor_id for later use setCurrentSponsorId($data['id']); @@ -730,7 +730,7 @@ function fetchSponsorData ($sponsor_id, $column = 'id') { } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $found; diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 55af52e3da..9dbc62b998 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -292,20 +292,20 @@ function getSurfbarActionsDataFromId ($columnName, $id) { $GLOBALS[__FUNCTION__][$id][$columnName] = '*INVALID*'; // Search for it - $result = SQL_QUERY_ESC("SELECT `%s` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_id`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `%s` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_id`=%s LIMIT 1", array( $columnName, bigintval($id) ), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load it - list($GLOBALS[__FUNCTION__][$id][$columnName]) = SQL_FETCHROW($result); + list($GLOBALS[__FUNCTION__][$id][$columnName]) = sqlFetchRow($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return value @@ -315,14 +315,14 @@ function getSurfbarActionsDataFromId ($columnName, $id) { // Validate if the requested action can be performed on current URL status function isSurfbarMemberActionStatusValid ($action, $status) { // Search for the requested action/status combination in database - $result = SQL_QUERY_ESC("SELECT `actions_new_status` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_action`='%s' AND `actions_status`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `actions_new_status` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_action`='%s' AND `actions_status`='%s' LIMIT 1", array( strtoupper($action), strtoupper($status) ), __FUNCTION__, __LINE__); // Is the entry there? - $isValid = (SQL_NUMROWS($result) == 1); + $isValid = (sqlNumRows($result) == 1); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'action=' . $action . ',status=' . $status . ',isValid=' . intval($isValid)); @@ -330,11 +330,11 @@ function isSurfbarMemberActionStatusValid ($action, $status) { // Fetch the new status if found if ($isValid === TRUE) { // Load new status - list($GLOBALS['surfbar_cache']['new_status']) = SQL_FETCHROW($result); + list($GLOBALS['surfbar_cache']['new_status']) = sqlFetchRow($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return status return $isValid; @@ -478,7 +478,7 @@ function executeSurfbarMemberEditAction ($urlData) { if (TRUE) { // @TODO if (($urlData['url_views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) { // Run the query - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url`='%s', @@ -566,7 +566,7 @@ function doHandleSurfbarLowPoints () { doSurfbarNotifyMember('low_points', $content); // Update last notified - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `surfbar_low_notified`=NOW() WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `surfbar_low_notified`=NOW() WHERE `userid`=%s LIMIT 1", array($userid), __FUNCTION__, __LINE__); } // END - if } // END - foreach @@ -605,7 +605,7 @@ function getSurfbarUrlData ($searchTerm, $column = 'url_id', $order = 'url_id', } // END - if // Look up the record - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `url_id`, `url_userid`, `url_package_id`, @@ -637,9 +637,9 @@ ORDER BY ), __FUNCTION__, __LINE__); // Is there at least one record? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Then load all! - while ($dataRow = SQL_FETCHARRAY($result)) { + while ($dataRow = sqlFetchArray($result)) { // Shall we group these results? if ($group == 'url_id') { // Add the row by id as index @@ -652,7 +652,7 @@ ORDER BY } // END - if // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return the result return $GLOBALS['last_url_data']; @@ -716,7 +716,7 @@ function insertSurfbarUrlByArray ($urlData) { } // END - if // Just run the insert query for now - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_urls` (`url_userid`, `url`, `url_status`, `url_views_max`, `url_views_allowed`, `url_fixed_reload`, `url_fixed_waiting`) VALUES (%s, '%s', '%s', %s, %s, %s, %s)", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_urls` (`url_userid`, `url`, `url_status`, `url_views_max`, `url_views_allowed`, `url_fixed_reload`, `url_fixed_waiting`) VALUES (%s, '%s', '%s', %s, %s, %s, %s)", array( $userid, $urlData['url'], @@ -729,7 +729,7 @@ function insertSurfbarUrlByArray ($urlData) { ); // Return secured insert id - return SQL_INSERT_ID(); + return getSqlInsertId(); } // Notify admin(s) with a selected message and content @@ -952,7 +952,7 @@ function isSurfbarReloadFull () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'surf_lock=' . $GLOBALS['surfbar_cache']['surf_lock'] . ' - AFTER'); // Ask the database - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT COUNT(`l`.`locks_id`) AS `cnt` FROM `{?_MYSQL_PREFIX?}_surfbar_locks` AS `l` @@ -972,7 +972,7 @@ LIMIT 1", ); // Fetch row - list($GLOBALS['surfbar_cache']['user_locks']) = SQL_FETCHROW($result); + list($GLOBALS['surfbar_cache']['user_locks']) = sqlFetchRow($result); // Is it null? if (is_null($GLOBALS['surfbar_cache']['user_locks'])) { @@ -981,7 +981,7 @@ LIMIT 1", } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Get total URLs $total = getSurfbarTotalUrls(); @@ -1012,7 +1012,7 @@ function getSurfbarTotalUrls ($status = 'ACTIVE', $excludeUserId = NULL) { } // END - if // Get amount from database - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT COUNT(`url_id`) AS `cnt` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` @@ -1024,10 +1024,10 @@ LIMIT 1", ); // Fetch row - list($count) = SQL_FETCHROW($result); + list($count) = sqlFetchRow($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $count . ' - EXIT!'); @@ -1126,7 +1126,7 @@ function addSurfbarReloadLockById ($urlId) { // Is there no record? if ($countLock == 0) { // Just add it to the database - SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`, `locks_url_id`) VALUES (%s, %s)', + sqlQueryEscaped('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`, `locks_url_id`) VALUES (%s, %s)', array( getMemberId(), bigintval($urlId) @@ -1134,7 +1134,7 @@ function addSurfbarReloadLockById ($urlId) { } // END - if // Remove the salt from database - SQL_QUERY_ESC('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_surfbar_salts` WHERE `salts_url_id`=%s AND `salts_userid`=%s LIMIT 1', + sqlQueryEscaped('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_surfbar_salts` WHERE `salts_url_id`=%s AND `salts_userid`=%s LIMIT 1', array( bigintval($urlId), getMemberId() @@ -1176,20 +1176,20 @@ function updateInsertSurfbarStatisticsRecord () { } // END - if // Update URL stats - SQL_QUERY_ESC('UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url_views_total`=`url_views_total`+1' . $add . ' WHERE `url_id`=%s LIMIT 1', + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url_views_total`=`url_views_total`+1' . $add . ' WHERE `url_id`=%s LIMIT 1', array(getSurfbarId()), __FUNCTION__, __LINE__); // Update the stats entry - SQL_QUERY_ESC('UPDATE `{?_MYSQL_PREFIX?}_surfbar_stats` SET `stats_count`=`stats_count`+1 WHERE `stats_userid`=%s AND `stats_url_id`=%s LIMIT 1', + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_surfbar_stats` SET `stats_count`=`stats_count`+1 WHERE `stats_userid`=%s AND `stats_url_id`=%s LIMIT 1', array( getMemberId(), getSurfbarId() ), __FUNCTION__, __LINE__); // Was that update okay? - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // No, then insert entry - SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)', + sqlQueryEscaped('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)', array( getMemberId(), getSurfbarId() @@ -1221,7 +1221,7 @@ function updateSurfbarSaltStatistics () { updateInsertSurfbarStatisticsRecord(); // Simply store the salt from cache away in database... - SQL_QUERY("UPDATE + sqlQuery("UPDATE `{?_MYSQL_PREFIX?}_surfbar_salts` SET `salts_last_salt`='{%pipe,getSurfbarSalt%}' @@ -1234,9 +1234,9 @@ LIMIT 1", __FUNCTION__, __LINE__); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt=' . getSurfbarSalt() . ',id=' . getSurfbarId() . ',userid=' . getMemberId() . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS() . ' - UPDATE!'); // Was that okay? - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // Insert missing entry! - SQL_QUERY("INSERT INTO + sqlQuery("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` ( `salts_url_id`, @@ -1253,14 +1253,14 @@ LIMIT 1", __FUNCTION__, __LINE__); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows=' . SQL_AFFECTEDROWS() . ' - EXIT!'); // Return if the update was okay - return (!SQL_HASZEROAFFECTED()); + return (!ifSqlHasZeroAffectedRows()); } // Check if the reload lock is active for given id function ifSurfbarReloadLock ($urlId) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $urlId . ' - ENTERED!'); // Ask the database - $result = SQL_QUERY_ESC('SELECT COUNT(`locks_id`) AS `cnt` + $result = sqlQueryEscaped('SELECT COUNT(`locks_id`) AS `cnt` FROM `{?_MYSQL_PREFIX?}_surfbar_locks` WHERE @@ -1274,10 +1274,10 @@ LIMIT 1', ); // Fetch counter - list($count) = SQL_FETCHROW($result); + list($count) = sqlFetchRow($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return check //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',count=' . $count . ',getSurfbarSurfLock()=' . getSurfbarSurfLock() . ' - EXIT!'); @@ -1301,7 +1301,7 @@ function determineSurfbarDepletedUserids ($limit=0) { $userids['notified'][getMemberId()] = '0'; // Get all userid except logged in one - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `u`.`url_userid`, UNIX_TIMESTAMP(`d`.`surfbar_low_notified`) AS `notified` FROM @@ -1321,7 +1321,7 @@ ORDER BY array(getMemberId()), __FUNCTION__, __LINE__); } else { // Get all userid - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `u`.`url_userid`, UNIX_TIMESTAMP(`d`.`surfbar_low_notified`) AS `notified` FROM @@ -1340,7 +1340,7 @@ ORDER BY } // Load all userid - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Get total points $points = getTotalPoints($content['url_userid']); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $content['url_userid'] . ',points=' . $points); @@ -1356,7 +1356,7 @@ ORDER BY } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UIDs::count=' . count($userids) . ' (with own userid=' . getMemberId() . ')'); @@ -1368,7 +1368,7 @@ ORDER BY // Determine how many users are Online in surfbar function determineSurfbarTotalOnline () { // Count all users in surfbar modue and return the value - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `stats_id` FROM `{?_MYSQL_PREFIX?}_surfbar_stats` @@ -1378,10 +1378,10 @@ GROUP BY `stats_userid` ASC', __FUNCTION__, __LINE__); // Fetch count - $count = SQL_NUMROWS($result); + $count = sqlNumRows($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $count; @@ -1443,7 +1443,7 @@ function changeSurfbarUrlStatus ($urlId, $prevStatus, $newStatus, $data = array( // Update the status now // ---------- Comment out for debugging/developing member actions! --------- - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url_status`='%s' WHERE `url_id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url_status`='%s' WHERE `url_id`=%s LIMIT 1", array( $newStatus, bigintval($urlId) @@ -1452,7 +1452,7 @@ function changeSurfbarUrlStatus ($urlId, $prevStatus, $newStatus, $data = array( // Was that fine? // ---------- Comment out for debugging/developing member actions! --------- - if (SQL_AFFECTEDROWS() != 1) { + if (sqlAffectedRows() != 1) { // No, something went wrong return FALSE; } // END - if @@ -1553,7 +1553,7 @@ function getSurfbarLockIdsArray () { $ignored = array(); // Get all id from locks within the timestamp - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `locks_id`, `locks_url_id`, UNIX_TIMESTAMP(`locks_last_surfed`) AS `last_surfed` @@ -1566,7 +1566,7 @@ ORDER BY __FUNCTION__, __LINE__); // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'next - lid='.$content['locks_id'].',url='.$content['locks_url_id'].',rest='.(time() - $content['last_surfed']).'/'.getSurfbarSurfLock()); @@ -1596,7 +1596,7 @@ ORDER BY } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return array return $USE; @@ -1605,7 +1605,7 @@ ORDER BY // "Getter" for maximum random number function getSurfbarMaximumRandom ($userids, $add) { // Count max availabe entries - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `sbu`.`url_id` AS `cnt` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu` @@ -1629,10 +1629,10 @@ GROUP BY //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS()); // Fetch max rand - $maxRand = SQL_NUMROWS($result); + $maxRand = sqlNumRows($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return value return $maxRand; @@ -1644,7 +1644,7 @@ function getSurfbarUserUrls () { $urlArray = array(); // Begin the query - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `u`.`url_id`, `u`.`url_userid`, `u`.`url_package_id`, @@ -1666,16 +1666,16 @@ ORDER BY array(getMemberId()), __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all rows - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Add the row $urlArray[$row['url_id']] = $row; } // END - while } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return the array return $urlArray; @@ -1687,20 +1687,20 @@ function getSurfbarArrayFromStatus ($status) { $returnArray = array(); // Get all assigned actions - $result = SQL_QUERY_ESC("SELECT `actions_action` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_status`='%s' ORDER BY `actions_id` ASC", + $result = sqlQueryEscaped("SELECT `actions_action` FROM `{?_MYSQL_PREFIX?}_surfbar_actions` WHERE `actions_status`='%s' ORDER BY `actions_id` ASC", array($status), __FUNCTION__, __LINE__); // Some entries there? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Load all actions // @TODO This can be somehow rewritten - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { array_push($returnArray, $content['actions_action']); } // END - if } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $returnArray; @@ -1762,7 +1762,7 @@ function determineSurfbarNextId ($urlId = NULL) { // And query the database //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'randNum='.$randNum.',maxRand='.$maxRand.',surfLock='.getSurfbarSurfLock()); - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `sbu`.`url_id`, `sbu`.`url_userid`, `sbu`.`url_package_id`, @@ -1798,7 +1798,7 @@ LIMIT %s,1", ); } else { // Get data from specified id number - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `sbu`.`url_id`, `sbu`.`url_userid`, `sbu`.`url_package_id`, @@ -1831,10 +1831,10 @@ LIMIT 1", // Is there an id number? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS()); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load/cache data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - BEFORE', FALSE); - $GLOBALS['surfbar_cache'] = merge_array($GLOBALS['surfbar_cache'], SQL_FETCHARRAY($result)); + $GLOBALS['surfbar_cache'] = merge_array($GLOBALS['surfbar_cache'], sqlFetchArray($result)); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - AFTER', FALSE); // Determine waiting time @@ -1872,7 +1872,7 @@ LIMIT 1", } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',nextId=' . $nextId . ' - EXIT!'); diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index ecca7689d4..d01582467b 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -557,7 +557,7 @@ function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) { // New format... foreach ($sqls as $key => $sql) { // Run SQL command, get line numbers and free memory - $result = SQL_QUERY($sql, __FUNCTION__, __LINE__); + $result = sqlQuery($sql, __FUNCTION__, __LINE__); // Prepare array for output $content = array( @@ -570,17 +570,17 @@ function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) { $content['bottom'] = 'bottom'; } // END - if - if ((!SQL_HASZERONUMS($result)) && (!empty($WHATs[$key]))) { + if ((!ifSqlHasZeroNums($result)) && (!empty($WHATs[$key]))) { if (empty($TITLEs[$key])) { $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}'; } // END - if - $content['row_link'] = '' . SQL_NUMROWS($result) . ''; + $content['row_link'] = '' . sqlNumRows($result) . ''; } else { $content['row_link'] = '0'; } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // And insert the final string into extras template $OUT .= loadTemplate('admin_overview_task_rows', TRUE, $content); diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index e4f4426f4d..09dee2dd5d 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -66,7 +66,7 @@ function generateThemeSelectionBox () { } // END - if // Select all themes we want - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `theme_path`, `theme_name` FROM @@ -76,7 +76,7 @@ ORDER BY `theme_name` ASC', __FUNCTION__, __LINE__); // Load all themes - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Construct relative include file name $inc = sprintf("theme/%s/theme.php", secureString($row['theme_path'])); @@ -90,7 +90,7 @@ ORDER BY } // END - while // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); // Construct selection form for the box template // @TODO Can't this be rewritten to an API function? @@ -134,17 +134,17 @@ function getThemeVersion ($name) { incrementStatsEntry('cache_hits'); } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) { // Load version from database - $result = SQL_QUERY_ESC("SELECT `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' LIMIT 1", array($name), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch data - list($cver) = SQL_FETCHROW($result); + list($cver) = sqlFetchRow($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return version @@ -177,14 +177,14 @@ function isThemeActive ($name) { incrementStatsEntry('cache_hits'); } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) { // Check if current theme is already imported or not - $result = SQL_QUERY_ESC("SELECT `theme_active` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1", + $result = sqlQueryEscaped("SELECT `theme_active` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1", array($name), __FUNCTION__, __LINE__); // Is the theme active and installed? - $active = (SQL_NUMROWS($result) == 1); + $active = (sqlNumRows($result) == 1); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return result @@ -211,14 +211,14 @@ function getCurrentThemeName () { incrementStatsEntry('cache_hits'); } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) { // Check if current theme is already imported or not - $result = SQL_QUERY_ESC("SELECT `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1", + $result = sqlQueryEscaped("SELECT `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1", array($name), __FUNCTION__, __LINE__); // Load theme name - list($name) = SQL_FETCHROW($result); + list($name) = sqlFetchRow($result); // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return name @@ -286,17 +286,17 @@ function getThemeId ($name) { incrementStatsEntry('cache_hits'); } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) { // Check if current theme is already imported or not - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' LIMIT 1", array($name), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Fetch data - list($id) = SQL_FETCHROW($result); + list($id) = sqlFetchRow($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return id diff --git a/inc/libs/transfer_functions.php b/inc/libs/transfer_functions.php index d940ebb94a..f96d058488 100644 --- a/inc/libs/transfer_functions.php +++ b/inc/libs/transfer_functions.php @@ -43,36 +43,36 @@ if (!defined('__SECURITY')) { // Purge expired transfer entries function autoPurgeTransfers ($max, $age) { // First get total in-going lines - $result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` ORDER BY `id` ASC', __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > $max) { + $result = sqlQuery('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` ORDER BY `id` ASC', __FUNCTION__, __LINE__); + if (sqlNumRows($result) > $max) { // Update overdue transfers - $remove = SQL_NUMROWS($result) - $max; + $remove = sqlNumRows($result) - $max; // This will make it really old, so the final removal query will find it - $result = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_in` SET `time_trans`=0 ORDER BY `id` ASC LIMIT %s", + $result = sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_in` SET `time_trans`=0 ORDER BY `id` ASC LIMIT %s", array($remove), __FUNCTION__, __LINE__); } // END - if // Second get total out-going lines - $result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `id` ASC', __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) > $max) { + $result = sqlQuery('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `id` ASC', __FUNCTION__, __LINE__); + if (sqlNumRows($result) > $max) { // Update overdue transfers - $remove = SQL_NUMROWS($result) - $max; + $remove = sqlNumRows($result) - $max; // This will make it really old, so the final removal query will find it - $result = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_out` SET `time_trans`=0 ORDER BY `id` ASC LIMIT %s", + $result = sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_out` SET `time_trans`=0 ORDER BY `id` ASC LIMIT %s", array($remove), __FUNCTION__, __LINE__); } // END - if // Remove old in-going transfers - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)", + $result = sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)", array($age), __FUNCTION__, __LINE__); - $removed = SQL_AFFECTEDROWS(); + $removed = sqlAffectedRows(); // Remove old out-going transfers - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)", + $result = sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)", array($age), __FUNCTION__, __LINE__); - $removed += SQL_AFFECTEDROWS(); + $removed += sqlAffectedRows(); // Only send email to admin(s) when we have removed entries if ($removed > 0) { diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 28d57b316d..c199c3affc 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -199,7 +199,7 @@ function generateUserEmailLink ($email, $mod = 'admin') { } // END - if // Search for the email address - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -210,16 +210,16 @@ LIMIT 1", array($email), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load userid - list($userid) = SQL_FETCHROW($result); + list($userid) = sqlFetchRow($result); // Rewrite email address to contact link $email = '{%url=modules.php?module=' . $mod . '&what=user_contct&userid=' . bigintval($userid) . '%}'; } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return rewritten (?) email address return $email; @@ -241,20 +241,20 @@ function determineRandomReferralId () { $randUserid = mt_rand(0, ($totalUsers - 1)); // Look for random user - $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` " . runFilterChain('user_exclusion_sql', "WHERE `status`='CONFIRMED'") . ' AND `rand_confirmed` >= {?user_min_confirmed?} ORDER BY `rand_confirmed` DESC LIMIT %s, 1', + $result = sqlQueryEscaped("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` " . runFilterChain('user_exclusion_sql', "WHERE `status`='CONFIRMED'") . ' AND `rand_confirmed` >= {?user_min_confirmed?} ORDER BY `rand_confirmed` DESC LIMIT %s, 1', array($randUserid), __FUNCTION__, __LINE__); // Is there one entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Use that userid as new referral id - list($refid) = SQL_FETCHROW($result); + list($refid) = sqlFetchRow($result); // Debug message /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . $refid . ' - choosen!'); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if } // END - if @@ -323,7 +323,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // ... and update database // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1", array($content['hash'], $userid), __FUNCTION__, __LINE__); // No login bonus by default @@ -360,9 +360,9 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',hash=' . $content['hash'] . '(' . strlen($content['hash']) . ')'); if ((setSession('userid', $userid )) && (setSession('u_hash', encodeHashForCookie($content['hash'])))) { // Update database records - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1", array($userid), __FUNCTION__, __LINE__); - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Is a success URL set? if (empty($successUrl)) { // Procedure to checking for login data @@ -387,7 +387,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p } } elseif (isExtensionInstalledAndNewer('sql_patches', '0.6.1')) { // Update failure counter - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1", array($userid), __FUNCTION__, __LINE__); // Wrong password! @@ -452,7 +452,7 @@ function doNewUserPassword ($email, $userid) { $newPassword = generatePassword(); // Update database - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s LIMIT 1", array( generateHash($newPassword), getUserData('userid') @@ -504,7 +504,7 @@ function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = NULL) { } // END - if // Try to find the entry - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT UNIX_TIMESTAMP(`inserted`) AS `inserted` FROM `{?_MYSQL_PREFIX?}_user_stats_data` @@ -520,13 +520,13 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get this stamp - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return stamp return $data['inserted']; @@ -546,7 +546,7 @@ function insertUserStatsRecord ($userid, $statsType, $statsData) { // Does it exist? if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { // Then insert it! - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`, `stats_type`, `stats_data`) VALUES (%s,'%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`, `stats_type`, `stats_data`) VALUES (%s,'%s','%s')", array( bigintval($userid), $statsType, @@ -554,7 +554,7 @@ function insertUserStatsRecord ($userid, $statsType, $statsData) { ), __FUNCTION__, __LINE__); // Does it have worked? - $return = (!SQL_HASZEROAFFECTED()); + $return = (!ifSqlHasZeroAffectedRows()); } elseif (is_array($statsData)) { // Invalid data! logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',type=' . $statsType . ',data=' . gettype($statsData) . ': Invalid statistics data type!'); @@ -576,11 +576,11 @@ function doConfirmUserAccount ($hash) { $userid = NULL; // Search for an unconfirmed or confirmed account - $result = SQL_QUERY_ESC("SELECT `userid`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1", + $result = sqlQueryEscaped("SELECT `userid`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1", array($hash), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Ok, he want's to confirm now so we load some data - list($userid, $refid) = SQL_FETCHROW($result); + list($userid, $refid) = sqlFetchRow($result); // Fetch user data if (!fetchUserData($userid)) { @@ -592,7 +592,7 @@ function doConfirmUserAccount ($hash) { $content = getUserDataArray(); // Unlock his account (but only when it is on UNCONFIRMED!) - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='CONFIRMED', @@ -604,7 +604,7 @@ LIMIT 1", array($hash), __FILE__, __LINE__); // Was it updated? - if (!SQL_HASZEROAFFECTED()) { + if (!ifSqlHasZeroAffectedRows()) { // Send email if updated $message = loadEmailTemplate('guest_user_confirmed', $content, bigintval($userid)); @@ -621,7 +621,7 @@ LIMIT 1", // If version matches add ref bonus to refid's account if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) { // Add points (directly only!) - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1", array(bigintval($refid)), __FILE__, __LINE__); // Subtract points from system @@ -891,17 +891,17 @@ function getSubId ($id) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$id])) { // Check database for record - $result = SQL_QUERY_ESC("SELECT `subid` FROM `{?_MYSQL_PREFIX?}_user_subids` WHERE `id`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `subid` FROM `{?_MYSQL_PREFIX?}_user_subids` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load it - list($GLOBALS[__FUNCTION__][$id]) = SQL_FETCHROW($result); + list($GLOBALS[__FUNCTION__][$id]) = sqlFetchRow($result); } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // END - if // Return cache diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 6135f5921e..0868db2f3d 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -335,7 +335,7 @@ function translateWernisTransferStatus ($status) { // Log the transfer function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') { // Register this wernis movement - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_wernis` (`userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`, `wernis_api_message`, `wernis_api_status`) VALUES (%s, %s, %s, UNIX_TIMESTAMP(), '%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_wernis` (`userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`, `wernis_api_message`, `wernis_api_status`) VALUES (%s, %s, %s, UNIX_TIMESTAMP(), '%s', '%s', '%s')", array( getMemberId(), bigintval($wdsId), diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 952d538623..7007190e74 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -264,7 +264,7 @@ function YOOMEDIA_EXCLUDE_MAIL ($data, $mailMode) { $mailMode = YOOMEDIA_CONVERT_MODE($mailMode); // Add the entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`, `inserted`) VALUES ('%s',%s,%s,'0000-00-00 00:00')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`, `inserted`) VALUES ('%s',%s,%s,'0000-00-00 00:00')", array( $mailMode, bigintval($data['id']), @@ -279,7 +279,7 @@ function YOOMEDIA_UNLIST_MAIL ($data, $mailMode) { $mailMode = YOOMEDIA_CONVERT_MODE($mailMode); // Add the entry - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1", array($mailMode, bigintval($data['id'])), __FUNCTION__, __LINE__); } @@ -325,18 +325,18 @@ function YOOMEDIA_CHECK_RELOAD ($id, $reload, $type) { $reloaded = FALSE; // Query database - $result = SQL_QUERY_ESC("SELECT `id`, UNIX_TIMESTAMP(`inserted`) AS `inserted` FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1", + $result = sqlQueryEscaped("SELECT `id`, UNIX_TIMESTAMP(`inserted`) AS `inserted` FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1", array($type, bigintval($id)), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load time - list($id, $time) = SQL_FETCHROW($result); + list($id, $time) = sqlFetchRow($result); // Are we ready to sent again? if (((time() - $time) >= ($reload * 60*60)) && ($time > 0)) { // Remove entry - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `id`=%s LIMIT 1", array($id), __FUNCTION__, __LINE__); } else { // Dont' sent again this mail @@ -345,7 +345,7 @@ function YOOMEDIA_CHECK_RELOAD ($id, $reload, $type) { } // END - if // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $reloaded; @@ -359,7 +359,7 @@ function YOOMEDIA_RELOAD_LOCK ($data, $mailMode) { $mailMode = YOOMEDIA_CONVERT_MODE($mailMode); // Add the entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`) VALUES ('%s',%s,%s)", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`) VALUES ('%s',%s,%s)", array($mailMode, bigintval($data['id']), bigintval($data['reload'])), __FUNCTION__, __LINE__); } // END - if } diff --git a/inc/loader/load- b/inc/loader/load- index 3b1d8f7209..aba412eedd 100644 --- a/inc/loader/load- +++ b/inc/loader/load- @@ -52,14 +52,14 @@ if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_insta $GLOBALS['cache_instance']->init(); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_foos` ORDER BY `some_bar` ASC', __FILE__, __LINE__); - while ($dummy = SQL_FETCHARRAY($result)) { + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_foos` ORDER BY `some_bar` ASC', __FILE__, __LINE__); + while ($dummy = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($dummy); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('foo'); diff --git a/inc/loader/load-admins.php b/inc/loader/load-admins.php index bd45492d8e..96edeb3163 100644 --- a/inc/loader/load-admins.php +++ b/inc/loader/load-admins.php @@ -89,7 +89,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins $add = runFilterChain('sql_admin_extra_data'); // Query the database about this - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id` AS `admin_id`, `login`, `password`, @@ -99,13 +99,13 @@ FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `login` ASC', __FILE__, __LINE__); - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($row); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('admins'); @@ -157,16 +157,16 @@ if (isExtensionInstalledAndNewer('admins', '0.3')) { $GLOBALS['cache_instance']->init(); // Load all admins and their data - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC,`action_menu` ASC,`what_menu` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC,`action_menu` ASC,`what_menu` ASC', __FILE__, __LINE__); // Add all rows - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('admins'); diff --git a/inc/loader/load-config.php b/inc/loader/load-config.php index 1acb1e2465..b840901364 100644 --- a/inc/loader/load-config.php +++ b/inc/loader/load-config.php @@ -63,16 +63,16 @@ if (($GLOBALS['cache_instance']->loadCacheFile('config')) && ($GLOBALS['cache_in $GLOBALS['cache_instance']->init(); // Query for all config entries - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_config` ORDER BY `config` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_config` ORDER BY `config` ASC', __FILE__, __LINE__); // .. and load them - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-earning.php b/inc/loader/load-earning.php index 57b8499de1..d6a8e67d41 100644 --- a/inc/loader/load-earning.php +++ b/inc/loader/load-earning.php @@ -55,14 +55,14 @@ if (($GLOBALS['cache_instance']->loadCacheFile('earning')) && ($GLOBALS['cache_i $GLOBALS['cache_instance']->init(); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_earning_data` ORDER BY `earning_id` ASC', __FILE__, __LINE__); - while ($dummy = SQL_FETCHARRAY($result)) { + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_earning_data` ORDER BY `earning_id` ASC', __FILE__, __LINE__); + while ($dummy = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($dummy); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('earning'); diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php index 841274af01..0d35dd4501 100644 --- a/inc/loader/load-extension.php +++ b/inc/loader/load-extension.php @@ -144,7 +144,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache } // END - if // Query for all extensions - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id` AS `ext_id`, `ext_name`, `ext_active`, @@ -156,13 +156,13 @@ ORDER BY `ext_name` ASC', __FILE__, __LINE__); // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Load extension if (!loadExtension($content['ext_name'], 'test')) { // Is the name valid? if (!isExtensionNameValid($content['ext_name'])) { // Is not valid name (empty ext-foo.php script) - 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($content['ext_name']), __FILE__, __LINE__); } else { // Didn't load so deactivate it @@ -195,7 +195,7 @@ ORDER BY } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-filter.php b/inc/loader/load-filter.php index 8859626cfa..48debd41b3 100644 --- a/inc/loader/load-filter.php +++ b/inc/loader/load-filter.php @@ -55,16 +55,16 @@ if (($GLOBALS['cache_instance']->loadCacheFile('filter')) && ($GLOBALS['cache_in $GLOBALS['cache_instance']->init(); // Query for all filters - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_filters` ORDER BY `filter_name` ASC, `filter_id` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_filters` ORDER BY `filter_name` ASC, `filter_id` ASC', __FILE__, __LINE__); // Load all filters - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-imprint.php b/inc/loader/load-imprint.php index c8065198b0..dd1a514249 100644 --- a/inc/loader/load-imprint.php +++ b/inc/loader/load-imprint.php @@ -55,14 +55,14 @@ if (($GLOBALS['cache_instance']->loadCacheFile('imprint')) && ($GLOBALS['cache_i $GLOBALS['cache_instance']->init(); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_imprint_data` ORDER BY `imprint_id` ASC', __FILE__, __LINE__); - while ($row = SQL_FETCHARRAY($result)) { + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_imprint_data` ORDER BY `imprint_id` ASC', __FILE__, __LINE__); + while ($row = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($row); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('imprint'); diff --git a/inc/loader/load-modules.php b/inc/loader/load-modules.php index 68562bf270..f52226607f 100644 --- a/inc/loader/load-modules.php +++ b/inc/loader/load-modules.php @@ -94,7 +94,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i // Is there up-to-date ext-sql_patches? if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) { // Yes, has_menu shall be there - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id`, `module`, `title`, @@ -110,7 +110,7 @@ ORDER BY `module` ASC', __FILE__, __LINE__); } else { // Not recent enough ext-sql_patches ... - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id`, `module`, `title`, @@ -126,13 +126,13 @@ ORDER BY } // ... and load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('mods'); diff --git a/inc/loader/load-payments.php b/inc/loader/load-payments.php index ae53f946f6..de1647c137 100644 --- a/inc/loader/load-payments.php +++ b/inc/loader/load-payments.php @@ -71,14 +71,14 @@ if (($GLOBALS['cache_instance']->loadCacheFile('payments')) && ($GLOBALS['cache_ $GLOBALS['cache_instance']->init(); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `id` ASC', __FILE__, __LINE__); - while ($dummy = SQL_FETCHARRAY($result)) { + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `id` ASC', __FILE__, __LINE__); + while ($dummy = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($dummy); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('payments'); diff --git a/inc/loader/load-points_data.php b/inc/loader/load-points_data.php index 01457795b6..91da8e922b 100644 --- a/inc/loader/load-points_data.php +++ b/inc/loader/load-points_data.php @@ -83,14 +83,14 @@ if (($GLOBALS['cache_instance']->loadCacheFile('points_data')) && ($GLOBALS['cac $GLOBALS['cache_instance']->init(); // Query the database about this - $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_points_data` ORDER BY `id` ASC', __FILE__, __LINE__); - while ($dummy = SQL_FETCHARRAY($result)) { + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_points_data` ORDER BY `id` ASC', __FILE__, __LINE__); + while ($dummy = sqlFetchArray($result)) { // Save row $GLOBALS['cache_instance']->addRow($dummy); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-refdepths.php b/inc/loader/load-refdepths.php index 6aa4153e2c..446896fc79 100644 --- a/inc/loader/load-refdepths.php +++ b/inc/loader/load-refdepths.php @@ -52,16 +52,16 @@ if (($GLOBALS['cache_instance']->loadCacheFile('refdepths')) && ($GLOBALS['cache $GLOBALS['cache_instance']->init(); // Query for all referral depths - $result = SQL_QUERY('SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC', __FILE__, __LINE__); // ... and load them - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-refsystem.php b/inc/loader/load-refsystem.php index 4748a23fa3..9fcc557dfb 100644 --- a/inc/loader/load-refsystem.php +++ b/inc/loader/load-refsystem.php @@ -52,7 +52,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache $GLOBALS['cache_instance']->init(); // Query for all referrals - $result = SQL_QUERY('SELECT + $result = sqlQuery('SELECT `id`, `userid`, `level`, @@ -64,13 +64,13 @@ ORDER BY `level` ASC', __FILE__, __LINE__); // Load all entries - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); diff --git a/inc/loader/load-themes.php b/inc/loader/load-themes.php index a2fb5c1439..a349240e19 100644 --- a/inc/loader/load-themes.php +++ b/inc/loader/load-themes.php @@ -76,17 +76,17 @@ if (($GLOBALS['cache_instance']->loadCacheFile('themes')) && ($GLOBALS['cache_in // Load all themes and their data if (isExtensionInstalledAndNewer('theme', '0.0.7')) { - $result = SQL_QUERY('SELECT `id`, `theme_path`, `theme_active`, `theme_ver`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT `id`, `theme_path`, `theme_active`, `theme_ver`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__); } else { - $result = SQL_QUERY('SELECT `id`, `theme_path`, `theme_active`, `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__); + $result = sqlQuery('SELECT `id`, `theme_path`, `theme_active`, `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__); } - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Add row to cache file $GLOBALS['cache_instance']->addRow($content); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('theme'); diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index efe0738383..a773063f8e 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -99,8 +99,8 @@ if (!empty($sql)) { } // END - if // Check for accounts to be notified - $result_main = SQL_QUERY($sql, __FILE__, __LINE__); - if (!SQL_HASZERONUMS($result_main)) { + $result_main = sqlQuery($sql, __FILE__, __LINE__); + if (!ifSqlHasZeroNums($result_main)) { // Normal notification mails or bonus mails? $sentBonusMails = ((getBegNotifyBonus() > 0) && ($mode == 'enable') && (isExtensionActive('bonus'))); @@ -109,12 +109,12 @@ if (!empty($sql)) { $receiver = ''; $userids = array(); // Okay lets notify all users! - while ($row = SQL_FETCHARRAY($result_main)) { + while ($row = sqlFetchArray($result_main)) { // Merge arrays $content = merge_array($content, $row); // Update account - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_rallye_%s_notify`=UNIX_TIMESTAMP() @@ -146,12 +146,12 @@ LIMIT 1", $url = 'modules.php?module=index&what=login'; // Insert mail - addBonusMailToQueue('{--BEG_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBegNotifyBonus(), getBegNotifyWait(), $url, 0, 'normal', SQL_NUMROWS($result_main)); + addBonusMailToQueue('{--BEG_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBegNotifyBonus(), getBegNotifyWait(), $url, 0, 'normal', sqlNumRows($result_main)); } // END - if } // END - if // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); } // END - if // [EOF] diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 058022011b..24b10ea547 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -98,12 +98,12 @@ if (!empty($sql)) { $receiver = ''; $userids = array(); // Check for accounts to be notified - $result_main = SQL_QUERY($sql, __FILE__, __LINE__); - if (!SQL_HASZERONUMS($result_main)) { + $result_main = sqlQuery($sql, __FILE__, __LINE__); + if (!ifSqlHasZeroNums($result_main)) { // Okay lets notify all users! - while ($content = SQL_FETCHARRAY($result_main)) { + while ($content = sqlFetchArray($result_main)) { // Update account - SQL_QUERY_ESC("UPDATE + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_rallye_%s_notify`=UNIX_TIMESTAMP() @@ -135,12 +135,12 @@ LIMIT 1", $url = 'modules.php?module=index&what=login'; // Insert mail - addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBonusNotifyPoints(), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main)); + addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBonusNotifyPoints(), getConfig('bonus_notify_wait'), $url, 0, 'normal', sqlNumRows($result_main)); } // END - if } // END - if // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); } // END - if // diff --git a/inc/mails/doubler_mails.php b/inc/mails/doubler_mails.php index cac484c098..92606bfba8 100644 --- a/inc/mails/doubler_mails.php +++ b/inc/mails/doubler_mails.php @@ -58,7 +58,7 @@ if (isExtensionActive('jackpot')) { // Get total points of the doubler itself $totalPoints = getDoublerTotalPointsLeft(); if ($totalPoints == '0') { - // Exit here to prevent some SQL errors (SQL_QUERY_ESC doen't insert zeros! We need to fix this...) + // Exit here to prevent some SQL errors (sqlQueryEscaped doen't insert zeros! We need to fix this...) return; } // END - if @@ -79,7 +79,7 @@ if (isExtensionActive('holiday')) { } // END - if // Check for doubles which we can pay out -$result_total = SQL_QUERY_ESC("SELECT +$result_total = sqlQueryEscaped("SELECT COUNT(`do`.`id`) AS `cnt`, FROM `{?_MYSQL_PREFIX?}_doubler` AS `do` @@ -101,13 +101,13 @@ ORDER BY ), __FILE__, __LINE__); // Get total count -list($totalCount) = SQL_FETCHROW($result_total); +list($totalCount) = sqlFetchRow($result_total); // Free memory -SQL_FREERESULT($result_total); +sqlFreeResult($result_total); // Check for accounts with limitation -$result_main = SQL_QUERY_ESC("SELECT +$result_main = sqlQueryEscaped("SELECT `do`.`id`, `do`.`userid`, `do`.`points`, @@ -134,7 +134,7 @@ LIMIT {?doubler_max_sent?}", ), __FILE__, __LINE__); // Are there entries found? -if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMROWS($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != 'Y'))) { +if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((sqlNumRows($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != 'Y'))) { // Switch to matching SQL resource $result_load = $result_main; if (($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) { @@ -142,7 +142,7 @@ if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMRO } // END - if // At least one account was found - while ($content = SQL_FETCHARRAY($result_load)) { + while ($content = sqlFetchArray($result_load)) { // Only double when points are enougth! if ($totalPoints >= $content['points']) { // Check for his ref points @@ -156,7 +156,7 @@ if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMRO if (($refPoints > 0) && ($GLOBALS['local_doubler_userid'] == $content['userid']) && (!empty($refPoints))) { // Referral points found so add them and set line(s) to completed='Y' $content['points'] += $refPoints; - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `refid`=%s AND `completed`='N' AND `is_ref`='Y'", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `refid`=%s AND `completed`='N' AND `is_ref`='Y'", array(bigintval($content['userid'])), __FILE__, __LINE__); } else { // No referral points found @@ -171,7 +171,7 @@ if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMRO } // END - if // Set entry as "payed" - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `id`=%s LIMIT 1", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `id`=%s LIMIT 1", array(bigintval($content['id'])), __FILE__, __LINE__); $okay = FALSE; @@ -210,8 +210,8 @@ if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMRO } // END - if // Free memory -SQL_FREERESULT($result_total); -SQL_FREERESULT($result_main); +sqlFreeResult($result_total); +sqlFreeResult($result_main); // [EOF] ?> diff --git a/inc/module-functions.php b/inc/module-functions.php index 39fab38c7a..ba6ba895cf 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -59,17 +59,17 @@ function getModuleTitle ($module) { incrementStatsEntry('cache_hits'); } elseif (!isExtensionActive('cache')) { // Load from database - $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `title` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", array($module), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Get the title from database - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); } // END - if // Free the result - SQL_FREERESULT($result); + sqlFreeResult($result); } } // END - if @@ -85,7 +85,7 @@ function getModuleTitle ($module) { } else { // No name found $data['title'] = '{%message,UNKNOWN_MODULE_DETECTED_TITLE=' . $module . '%}'; - if ((is_resource($result)) && (SQL_HASZERONUMS($result))) { + if ((is_resource($result)) && (ifSqlHasZeroNums($result))) { // Add module to database and ignore return value checkModulePermissions($module); } // END - if @@ -145,11 +145,11 @@ function isModuleRegistered ($module) { } elseif (!isExtensionActive('cache')) { // Check for module in database //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using database.'); - $result = SQL_QUERY_ESC("SELECT `locked`, `hidden`, `admin_only`, `mem_only` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `locked`, `hidden`, `admin_only`, `mem_only` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", array($module), __FUNCTION__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Read data - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Set all entries foreach ($data as $key => $value) { @@ -164,7 +164,7 @@ function isModuleRegistered ($module) { } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } // Return status @@ -291,20 +291,20 @@ function checkModulePermissions ($module = '') { * Since 0.3.6 there is a has_menu column, this took me a half * hour to find a loop here... *sigh* */ - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` (`module`, `locked`, `hidden`, `mem_only`, `admin_only`, `has_menu`) VALUES ('%s','Y','N','N','N','N')", array($module_chk), __FUNCTION__, __LINE__); } else { // Wrong/missing sql_patches! - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` (`module`, `locked`, `hidden`, `mem_only`, `admin_only`) VALUES ('%s','Y','N','N','N')", array($module_chk), __FUNCTION__, __LINE__); } // Everthing is fine? - if (SQL_HASZEROAFFECTED()) { + if (ifSqlHasZeroAffectedRows()) { // Something bad happend! setModuleStatus($module_chk, 'major'); return 'major'; @@ -368,13 +368,13 @@ function ifModuleHasMenu ($module, $forceDb = FALSE) { } } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((!isExtensionActive('cache')) || ($forceDb === TRUE))) { // Check database for entry - $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1", array($module), __FUNCTION__, __LINE__); // Entry found? - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // Load "has_menu" column - $data = SQL_FETCHARRAY($result); + $data = sqlFetchArray($result); // Fake cache... ;-) $GLOBALS['cache_array']['extension']['ext_menu'][$module] = $data['has_menu']; @@ -384,7 +384,7 @@ function ifModuleHasMenu ($module, $forceDb = FALSE) { } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); } elseif (!isExtensionInstalled('sql_patches')) { // No ext-sql_patches installed, so maybe in admin/guest/member/sponsor area or no admin registered? $ret = in_array($module, array('admin', 'index', 'login', 'sponsor')); // Then there is a menu! @@ -501,7 +501,7 @@ function doIncludeModule () { if ((isExtensionActive('maintenance')) && (isMaintenanceEnabled()) && (!isAdmin()) && (getModule() != 'admin')) { // Maintain mode is active and you are no admin addFatalMessage(__FUNCTION__, __LINE__, '{--MAILER_DOWN_FOR_MAINTENANCE--}'); - } elseif ((SQL_IS_LINK_UP()) && (!ifFatalErrorsDetected())) { + } elseif ((isSqlLinkUp()) && (!ifFatalErrorsDetected())) { // Do the small "load module" call $isModuleValid = loadModule(); } elseif (!ifFatalErrorsDetected()) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 93ee404289..b4f8ff20fa 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -46,15 +46,15 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'd $ret = 'already'; // Lookup the admin - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", array($adminLogin), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_HASZERONUMS($result)) { + if (ifSqlHasZeroNums($result)) { // Is ext-admins installed and version at least 0.3.0? if (isExtensionInstalledAndNewer('admins', '0.3.0')) { // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", array( $adminLogin, $passHash, @@ -63,7 +63,7 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'd ), __FUNCTION__, __LINE__); } else { // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", array( $adminLogin, $passHash, @@ -76,7 +76,7 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'd } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $ret; @@ -187,7 +187,7 @@ function doAdminAction () { loadTemplate('admin_main', FALSE, $content); // Check if action/what pair is valid - $result_action = SQL_QUERY_ESC("SELECT + $result_action = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` @@ -212,7 +212,7 @@ LIMIT 1", ), __FUNCTION__, __LINE__); // Is there an entry? - if (SQL_NUMROWS($result_action) == 1) { + if (sqlNumRows($result_action) == 1) { // Is valid but does the inlcude file exists? $inc = sprintf("inc/modules/admin/action-%s.php", $action); if ((isIncludeReadable($inc)) && (isMenuActionValid('admin', $action, $what)) && ($GLOBALS['acl_allow'] === TRUE)) { @@ -231,7 +231,7 @@ LIMIT 1", } // Free memory - SQL_FREERESULT($result_action); + sqlFreeResult($result_action); // Tableset footer loadTemplate('admin_main_footer', FALSE, $content); @@ -264,7 +264,7 @@ function addAdminMenu ($action, $what) { $GLOBALS['menu']['title'] = array(); // Build main menu - $result_main = SQL_QUERY("SELECT + $result_main = sqlQuery("SELECT `action` AS `main_action`, `title` AS `main_title`, `descr` AS `main_descr` @@ -277,11 +277,11 @@ ORDER BY `id` DESC", __FUNCTION__, __LINE__); // Are there entries? - if (!SQL_HASZERONUMS($result_main)) { + if (!ifSqlHasZeroNums($result_main)) { $OUT .= ''; // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); } // END - if // Return content @@ -344,7 +344,7 @@ function addAdminSubMenu ($mainContent, $action, $what) { $OUT = ''; // Check for menu entries - $result_what = SQL_QUERY_ESC("SELECT + $result_what = sqlQueryEscaped("SELECT `what` AS `sub_what`, `title` AS `sub_title`, `descr` AS `sub_descr` @@ -360,7 +360,7 @@ ORDER BY array($mainContent['main_action']), __FUNCTION__, __LINE__); // Remember the count for later checks - setAdminMenuHasEntries($mainContent['main_action'], ((!SQL_HASZERONUMS($result_what)) && (($action == $mainContent['main_action']) || (isAdminMenuJavascriptEnabled())))); + setAdminMenuHasEntries($mainContent['main_action'], ((!ifSqlHasZeroNums($result_what)) && (($action == $mainContent['main_action']) || (isAdminMenuJavascriptEnabled())))); // Start li-tag for sub menu content $OUT .= '
  • '; @@ -371,12 +371,12 @@ ORDER BY $SUB = TRUE; // Are there entries? - if (!SQL_HASZERONUMS($result_what)) { + if (!ifSqlHasZeroNums($result_what)) { // Start HTML code $OUT .= '