// Check if link is not clicked so far
$result = SQL_QUERY_ESC("SELECT
- b.points, d.userid, d.gender, d.surname, d.family, d.status, d.ref_payout
+ b.`points`, d.`userid`, d.`gender`, d.`surname`, d.`family`, d.`status`, d.`ref_payout`
FROM
`{?_MYSQL_PREFIX?}_user_birthday` AS b
INNER JOIN
`{?_MYSQL_PREFIX?}_user_data` AS d
ON
- b.userid=d.userid
+ b.`userid`=d.`userid`
WHERE
- b.userid=%s AND
- b.chk_value='%s'
+ b.`userid`=%s AND
+ b.`chk_value`='%s'
LIMIT 1",
array(
$userid,
$admin_points = '0';
// Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
s.id, s.userid, s.pool_id, t.price
FROM
`{?_MYSQL_PREFIX?}_user_stats` AS s
WHERE
s.timestamp_ordered <= (UNIX_TIMESTAMP() - {?auto_purge?})
ORDER BY
- s.userid ASC", __FILE__, __LINE__);
+ s.userid ASC', __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Start deleting procedure
$userid = '0'; $points = '0';
// Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
// here for e.g. excluding holiday users
- $result_inactive = SQL_QUERY("SELECT
+ $result_inactive = SQL_QUERY('SELECT
d.userid, d.email, d.last_online
FROM
`{?_MYSQL_PREFIX?}_user_data` AS d
`joined` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
`last_online` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
`ap_notified` < (UNIX_TIMESTAMP() - {?ap_inactive_time?})
-".$EXCLUDE_LIST."
+' . $EXCLUDE_LIST . '
ORDER BY
- `userid` ASC", __FILE__, __LINE__);
+ `userid` ASC', __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result_inactive)) {
// Prepare variable...
FROM
`{?_MYSQL_PREFIX?}_pool`
WHERE
- `data_type`='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
+ `data_type`='DELETED' AND
+ `timestamp` <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
ORDER BY
`sender` ASC", __FILE__, __LINE__);
FROM
`{?_MYSQL_PREFIX?}_pool`
WHERE
- `data_type`='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
+ `data_type`='DELETED' AND
+ `timestamp` <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
ORDER BY
`sender` ASC", __FILE__, __LINE__);
} // END - if
// Reset query (to prevent possible errors) ...
$result_mails = SQL_QUERY("SELECT
- `userid` AS userid
+ `userid`
FROM
`{?_MYSQL_PREFIX?}_user_stats`
WHERE
// Purge old entries
function purgeEntries() {
// SQL for cleaning up
- SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE UNIX_TIMESTAMP(`added`) < (UNIX_TIMESTAMP() - {?dns_cache_timeout?})",
+ SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_dns_cache` WHERE UNIX_TIMESTAMP(`added`) < (UNIX_TIMESTAMP() - {?dns_cache_timeout?})',
__METHOD__, __LINE__);
}
}
} // END - if
// SQL queries
-function SQL_QUERY ($sqlString, $F, $L) {
+function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) {
// Trim SQL string
$sqlString = trim($sqlString);
$sqlString = str_replace("\t", ' ', str_replace("\n", ' ', str_replace("\r", ' ', $sqlString)));
// Compile config entries out
- $GLOBALS['last_sql'] = SQL_PREPARE_SQL_STRING($sqlString);
+ $GLOBALS['last_sql'] = SQL_PREPARE_SQL_STRING($sqlString, $enableCodes);
// Starting time
$querytimeBefore = microtime(true);
}
// ALTER TABLE wrapper function
-function SQL_ALTER_TABLE ($sql, $F, $L) {
+function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
// Abort if link is down
if (!SQL_IS_LINK_UP()) return false;
if ($skip === false) {
// Send it to the SQL_QUERY() function
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
- $result = SQL_QUERY($sql, $F, $L, false);
+ $result = SQL_QUERY($sql, $F, $L, $enableCodes);
} else {
// Not executed
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
} else {
// Other ALTER TABLE query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
- $result = SQL_QUERY($sql, $F, $L, false);
+ $result = SQL_QUERY($sql, $F, $L, $enableCodes);
}
// Return result
}
// Private function to prepare the SQL query string
-function SQL_PREPARE_SQL_STRING ($sqlString) {
+function SQL_PREPARE_SQL_STRING ($sqlString, $enableCodes = true) {
// Is it already cached?
if (!isset($GLOBALS['sql_strings'][$sqlString])) {
// Compile config+expression code
$sqlString2 = FILTER_COMPILE_EXPRESSION_CODE(FILTER_COMPILE_CONFIG($sqlString));
// Do final compilation
- $GLOBALS['sql_strings'][$sqlString] = doFinalCompilation($sqlString2, false);
+ $GLOBALS['sql_strings'][$sqlString] = doFinalCompilation($sqlString2, false, $enableCodes);
+ //die($sqlString.'<br />'.$sqlString2.'<br />'.$GLOBALS['sql_strings'][$sqlString]);
} // END - if
// Return it
setSqlsArray(getExtensionSqls());
// Run installation pre-installation filters
- runFilterChain('pre_extension_installed', array('dry_run' => isExtensionDryRun()));
+ runFilterChain('pre_extension_installed', array('dry_run' => isExtensionDryRun(), 'enable_codes' => false));
// Register extension
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'insert=' . getCurrentExtensionName() . '/' . getCurrentExtensionVersion() . ' - INSERT!');
setSqlsArray(getExtensionSqls());
// Run SQLs
- runFilterChain('run_sqls', array('dry_run' => isExtensionDryRun()));
+ runFilterChain('run_sqls', array('dry_run' => isExtensionDryRun(), 'enable_codes' => false));
if (isExtensionDryRun() === false) {
// Run filters on success extension update
// Prepare output for template
$content = array(
'i' => ($idx + 1),
- 'sql' => $sql
+ 'sql' => str_replace('{', '{', str_replace('}', '}', encodeEntities($sql)))
);
// Load row template
addAdminMenuSql('setup','config_beg','Bettel-Link','IP-Sperre, {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Vergütung usw. können Sie hier einstellen.', 10);
addGuestMenuSql('main','beg','{OPEN_CONFIG}POINTS{CLOSE_CONFIG} erbetteln!','N','Y',4);
addMemberMenuSql('main','beg','Ihr Bettel-Link','N','Y',6);
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD beg_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT '600'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD beg_userid_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT 1800");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD beg_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00100");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD beg_clicks BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_timeout` BIGINT(20) UNSIGNED NOT NULL DEFAULT '600'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_userid_timeout` BIGINT(20) UNSIGNED NOT NULL DEFAULT 1800");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00100");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `beg_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_ips`');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_beg_ips` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-remote_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
-timeout VARCHAR(10) NOT NULL DEFAULT '',
-KEY (userid),
-PRIMARY KEY (id)
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+`timeout` VARCHAR(10) NOT NULL DEFAULT '',
+KEY (`userid`),
+PRIMARY KEY (`id`)
) TYPE={?_TABLE_TYPE?}");
break;
// Remove old entries
$OLD = getConfig('beg_timeout');
if (getConfig('beg_userid_timeout') > $OLD) $OLD = getConfig('beg_userid_timeout');
- $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ".($OLD + 60*60).")", __FILE__, __LINE__);
+ $result_ext = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ' . ($OLD + 60*60) . ')', __FILE__, __LINE__);
// Check for beg rallye is active and send mails out
if ((isBegRallyeEnabled()) && (isBegNewMemberNotifyEnabled())) {
// @TODO This should be moved out to inc/reset/
if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) {
// 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 = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__);
} // END - if
break;
$ADD1 = ''; $ADD2 = ''; $OR = '';
if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
$ADD1 = ", `min_users`, `min_prices`";
- $ADD2 = ", d.min_users, d.min_prices";
- $OR = " OR (d.min_users <= ".$total." AND d.min_users > 0)";
+ $ADD2 = ", d.`min_users`, d.`min_prices`";
+ $OR = " OR (d.`min_users` <= " . $total . " AND d.`min_users` > 0)";
} // END - if
// Check for new started but not notified rallyes
$result = SQL_QUERY("SELECT SQL_SMALL_RESULT
- `id`, `title`, `start_time`, `end_time`, `send_notify`".$ADD1."
+ `id`, `title`, `start_time`, `end_time`, `send_notify`" . $ADD1 . "
FROM
`{?_MYSQL_PREFIX?}_rallye_data`
WHERE
// Check for expired rallyes
$result = SQL_QUERY("SELECT SQL_SMALL_RESULT
- d.id, d.title, d.start_time, d.end_time, d.send_notify".$ADD2."
+ d.`id`, d.`title`, d.`start_time`, d.`end_time`, d.`send_notify`" . $ADD2 . "
FROM
`{?_MYSQL_PREFIX?}_rallye_data` AS d
WHERE
- d.is_active='Y' AND
- d.notified='Y' AND
- d.expired='N' AND
- (d.end_time <= UNIX_TIMESTAMP()".$OR.")
+ d.`is_active`='Y' AND
+ d.`notified`='Y' AND
+ d.`expired`='N' AND
+ (d.`end_time` <= UNIX_TIMESTAMP()".$OR.")
LIMIT 1", __FILE__, __LINE__);
if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('autopurge'))) {
// End rallye here...
// Transfer from a member
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_in` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-from_userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-reason VARCHAR(255) NOT NULL DEFAULT '',
-time_trans VARCHAR(14) NOT NULL DEFAULT 0,
-trans_id VARCHAR(12) NOT NULL DEFAULT '',
-KEY (userid),
-KEY (from_userid),
-PRIMARY KEY (id)
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`from_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`reason` VARCHAR(255) NOT NULL DEFAULT '',
+`time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
+`trans_id` VARCHAR(12) NOT NULL DEFAULT '',
+KEY (`userid`),
+KEY (`from_userid`),
+PRIMARY KEY (`id`)
) Type={?_TABLE_TYPE?}");
// Transfers to a member
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_transfers_out` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-to_userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-reason VARCHAR(255) NOT NULL DEFAULT '',
-time_trans VARCHAR(14) NOT NULL DEFAULT 0,
-trans_id VARCHAR(12) NOT NULL DEFAULT '',
-KEY (userid),
-KEY (to_userid),
-PRIMARY KEY (id)
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`to_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`reason` VARCHAR(255) NOT NULL DEFAULT '',
+`time_trans` VARCHAR(14) NOT NULL DEFAULT 0,
+`trans_id` VARCHAR(12) NOT NULL DEFAULT '',
+KEY (`userid`),
+KEY (`to_userid`),
+PRIMARY KEY (`id`)
) Type={?_TABLE_TYPE?}");
// Admin menu
break;
case '0.2.3': // SQL queries for v0.2.3
- addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'list_transfer')");
- addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('member', '', 'del_transfer')");
- addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (la_id, la_action, la_what) VALUES ('config', '', 'config_transfer')");
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('member', '', 'list_transfer')");
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('member', '', 'del_transfer')");
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu_las` (`la_id`, `la_action`, `la_what`) VALUES ('config', '', 'config_transfer')");
// Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
addExtensionUpdateDependency('sql_patches');
if (isExtensionINstalledAndNewer('sql_patches', '0.6.0')) $add = ", `filter_counter`";
// Load all filters
- $result = SQL_QUERY("SELECT
- `filter_name`,`filter_function`,`filter_active`".$add."
+ $result = SQL_QUERY('SELECT
+ `filter_name`,`filter_function`,`filter_active`' . $add . '
FROM
`{?_MYSQL_PREFIX?}_filters`
ORDER BY
- `filter_id` ASC", __FUNCTION__, __LINE__);
+ `filter_id` ASC', __FUNCTION__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
// Trim spaces away
$sql = trim($sql);
+ // Is 'enable_codes' not set? Then set it to true
+ if (!isset($data['enable_codes'])) $data['enable_codes'] = true;
+
// Is there still a query left?
if (!empty($sql)) {
// Do we have an "ALTER TABLE" command?
if (substr(strtolower($sql), 0, 11) == 'alter table') {
// Analyse the alteration command
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
- SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
+ SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__, $data['enable_codes']);
} else {
// Run regular SQL command
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
- SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
+ SQL_QUERY($sql, __FUNCTION__, __LINE__, $data['enable_codes']);
}
} // END - if
} // END - foreach
updateMediadataEntry(array('total_orders', 'bonus_orders') , 'init', $bcount);
// Aquire total used points
-$result = SQL_QUERY('SELECT SUM(`used_points`) AS used_points FROM `{?_MYSQL_PREFIX?}_user_data`', __FILE__, __LINE__);
-list($used) = SQL_FETCHROW($result);
-SQL_FREERESULT($result);
+$used = countSumTotalData('', 'user_data', 'used_points', '');
// ... and total points
-$result = SQL_QUERY('SELECT SUM(`points`) AS points FROM `{?_MYSQL_PREFIX?}_user_points`', __FILE__, __LINE__);
-list($points) = SQL_FETCHROW($result);
-SQL_FREERESULT($result);
+$points = countSumTotalData('', 'user_points', 'points', '');
// Update database
updateMediadataEntry(array('total_points'), 'init', ($points - $used));
loadIncludeOnce('inc/libs/refback_functions.php');
// Sanity-check: Do we have ref level 0?
-$result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0", __FILE__, __LINE__);
+$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Remove index temporaly
- SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__);
+ SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__);
// Upgrade refsystem, ref-level 0 is silly here
- SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1", __FILE__, __LINE__);
+ SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__);
// Add it again
- SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`,`level` )", __FILE__, __LINE__);
+ SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`,`level` )', __FILE__, __LINE__);
// Rebuild cache
rebuildCache('refsystem', 'refsystem');
// List all admin accounts
function adminsListAdminAccounts() {
// Select all admin accounts
- $result = SQL_QUERY("SELECT `id`, `login`, `email`, `default_acl` AS mode, `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `login` ASC", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('SELECT `id`, `login`, `email`, `default_acl` AS mode, `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `login` ASC', __FUNCTION__, __LINE__);
$OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
// Compile some variables
}
} elseif (($adminId == '0') || (empty($adminId))) {
// Select all email adresses
- $result = SQL_QUERY("SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC",
+ $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC',
__FUNCTION__, __LINE__);
} else {
// If Admin-Id is not "to-all" select
// Purges expired fast-click bonus entries
function purgeExpiredTurboBonus() {
// Remove entries
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})', __FUNCTION__, __LINE__);
if (SQL_AFFECTEDROWS() > 0) {
// Send out email to admin
$content = '';
// Query for all networks
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
`network_id`, `network_short_name`, `network_title`
FROM
`{?_MYSQL_PREFIX?}_network_data`
ORDER BY
- `network_short_name` ASC", __FUNCTION__, __LINE__);
+ `network_short_name` ASC', __FUNCTION__, __LINE__);
// Do we have entries?
if (!SQL_HASZERONUMS($result)) {
$content = '';
// Query all types of this network
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
t.`network_type_id`, t.`network_type_handle`, d.`network_title`
FROM
`{?_MYSQL_PREFIX?}_network_types` AS t
t.`network_id`=d.`network_id`
ORDER BY
d.`network_short_name` ASC,
- t.`network_type_handle` ASC", __FUNCTION__, __LINE__);
+ t.`network_type_handle` ASC', __FUNCTION__, __LINE__);
// Do we have entries?
if (!SQL_HASZERONUMS($result)) {
unsetPostRequestParameter('ok');
// Add the whole request to database
- SQL_QUERY("INSERT INTO
+ SQL_QUERY('INSERT INTO
`{?_MYSQL_PREFIX?}_network_data`
(
- `" . implode('`,`', array_keys(postRequestArray())) . "`
+ `' . implode('`,`', array_keys(postRequestArray())) . "`
) VALUES (
'" . implode("','", array_values(postRequestArray())) . "'
)", __FUNCTION__, __LINE__);
} // END - if
// Add the whole request to database
- SQL_QUERY("INSERT INTO
+ SQL_QUERY('INSERT INTO
`{?_MYSQL_PREFIX?}_network_request_params`
(
- `" . implode('`,`', array_keys(postRequestArray())) . "`
+ `' . implode('`,`', array_keys(postRequestArray())) . "`
) VALUES (
'" . implode("','", array_values(postRequestArray())) . "'
)", __FUNCTION__, __LINE__);
$tot_data = '0'; $tabs = '0'; $opts = '0';
$tot_idx = '0'; $total_gain = '0';
$tot_all = '0';
- $result = SQL_QUERY("SHOW TABLE STATUS FROM `{?__DB_NAME?}`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('SHOW TABLE STATUS FROM `{?__DB_NAME?}`', __FUNCTION__, __LINE__);
$tabs = SQL_NUMROWS($result);
$ret['total_size'] = '0';
$ret['total_tabs'] = $tabs;
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__);
+ $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));
// Free memory
if (isAdmin()) $AND = '';
// Look for categories
- $result = SQL_QUERY("SELECT `id`, `cat`, `visible` FROM `{?_MYSQL_PREFIX?}_cats` ".$AND." ORDER BY `sort` ASC",
+ $result = SQL_QUERY('SELECT `id`, `cat`, `visible` FROM `{?_MYSQL_PREFIX?}_cats` ' . $AND . ' ORDER BY `sort` ASC',
__FUNCTION__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Run a filter for must-fillout fields
function FILTER_REGISTER_MUST_FILLOUT ($content) {
// Get all fields for output
- $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC",
+ $result = SQL_QUERY('SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC',
__FUNCTION__, __LINE__);
// Walk through all entries
//
function addSponsorMenu ($current) {
$OUT = '';
- $WHERE = " AND active='Y'";
+ $WHERE = " AND `active`='Y'";
if (isAdmin()) $WHERE = '';
// Load main menu entries
`{?_MYSQL_PREFIX?}_sponsor_menu`
WHERE
(`what`='' OR `what` IS NULL)
- ".$WHERE."
+ " . $WHERE . "
ORDER BY
`sort` ASC", __FUNCTION__, __LINE__);
if (!SQL_HASZERONUMS($result_main)) {
`action`='%s' AND
`what` != '' AND
`what` IS NOT NULL
- ".$WHERE."
+ " . $WHERE . "
ORDER BY
`sort` ASC",
array($content['main_action']), __FUNCTION__, __LINE__);
// Determine how many users are Online in surfbar
function SURFBAR_DETERMINE_TOTAL_ONLINE () {
// Count all users in surfbar modue and return the value
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
`stats_id`
FROM
`{?_MYSQL_PREFIX?}_surfbar_stats`
WHERE
(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`stats_last_surfed`)) <= {?online_timeout?}
GROUP BY
- `stats_userid` ASC", __FUNCTION__, __LINE__);
+ `stats_userid` ASC', __FUNCTION__, __LINE__);
// Fetch count
$cnt = SQL_NUMROWS($result);
ON
sbu.url_id=l.locks_url_id
WHERE
- sbu.url_userid NOT IN (".implode(',', $userids).") AND
+ sbu.url_userid NOT IN (" . implode(',', $userids) . ") AND
(sbu.url_views_allowed=0 OR (sbu.url_views_allowed > 0 AND sbu.url_views_max > 0)) AND
sbu.url_status='ACTIVE'
- ".$add."
+ " . $add . "
GROUP BY
sbu.url_id ASC", __FUNCTION__, __LINE__);
// Check for more extensions
// @TODO These can be rewritten to filter
- if (getConfig('def_refid') > 0) $EXCLUDE_LIST .= ' AND d.userid != {?def_refid?}';
- if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.userid != {?beg_userid?}';
- if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.userid != {?bonus_userid?}';
- if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.userid != {?doubler_userid?}';
+ if (getConfig('def_refid') > 0) $EXCLUDE_LIST .= ' AND d.`userid` != {?def_refid?}';
+ if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.`userid` != {?beg_userid?}';
+ if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.`userid` != {?bonus_userid?}';
+ if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.`userid` != {?doubler_userid?}';
if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
// Recent ext-holiday found
$EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
if (isAdmin()) $add = '';
// Select all themes we want
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
`theme_path`, `theme_name`
FROM
`{?_MYSQL_PREFIX?}_themes`
-".$add."
+' . $add . '
ORDER BY
- `theme_name` ASC", __FUNCTION__, __LINE__);
+ `theme_name` ASC', __FUNCTION__, __LINE__);
// Load all themes
while ($content = SQL_FETCHARRAY($result)) {
// 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__);
+ $result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` ORDER BY `id` ASC', __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
} // 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__);
+ $result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `id` ASC', __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `action`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Read menu structure
// @TODO Cant this be rewritten?
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
- array($value_main), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
+ array($value_main), __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Init arrays
$menus[$value_main] = array();
$BOTH = ((isPostRequestParameterSet('action_menu')) && (isPostRequestParameterSet('what_menu')));
if (((isPostRequestParameterSet('action_menu')) || (isPostRequestParameterSet('what_menu'))) && ($BOTH === false)) {
// Main or sub menu selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE admin_id=%s AND action_menu='%s' AND what_menu='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `action_menu`='%s' AND `what_menu`='%s' LIMIT 1",
array(bigintval(postRequestParameter('admin_id')), postRequestParameter('action_menu'), postRequestParameter('what_menu')), __FILE__, __LINE__);
if (SQL_HASZERONUMS($result)) {
// Finally add the new ACL
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_acls` (admin_id, action_menu, what_menu, access_mode)
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_acls` (`admin_id`, `action_menu`, `what_menu`, `access_mode`)
VALUES ('%s','%s','%s','%s')",
array(
bigintval(postRequestParameter('admin_id')),
} // END - if
// Query the pool
-$result = SQL_QUERY("SELECT
+$result = SQL_QUERY('SELECT
`id`, `sender`, `subject`, `payment_id`, `cat_id`
FROM
`{?_MYSQL_PREFIX?}_pool`
ORDER BY
- `timestamp` ASC", __FILE__, __LINE__);
+ `timestamp` ASC', __FILE__, __LINE__);
// Entries found?
if (!SQL_HASZERONUMS($result)) {
FROM
`{?_MYSQL_PREFIX?}_user_data`
WHERE
- `status`='CONFIRMED' AND beg_points > 0".$lastOnline."
+ `status`='CONFIRMED' AND
+ `beg_points` > 0
+ " . $lastOnline . "
ORDER BY
`beg_points` DESC,
`last_online` DESC,
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' ORDER BY `sort`",
- array($value_main), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' ORDER BY `sort` ASC",
+ array($value_main), __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Initialize arrays
$menus[$value_main] = array();
$ACTIONS = array();
// First fix all main menus (what = '')...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT `id`, `action` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `action` != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = '0'; $REP = '0';
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store act value for later usage in sorting sub menus
$ACTIONS = array();
// First fix all main menus (what = '')...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT `id`, `action` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `action` != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = '0'; $REP = '0';
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store act value for later usage in sorting sub menus
// Now sort every each menu
foreach ($ACTIONS as $action) {
- $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
array($action), __FILE__, __LINE__);
$cnt = 1;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Fix weight
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
$ACTIONS = array();
// First fix all main menus (what = '')...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT `id`, `action` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `action` != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = '0'; $REP = '0';
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store action value for later usage in sorting sub menus
$ACTIONS[] = $content['action'];
// Fix weight
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET sort=%s WHERE `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=%s WHERE `id`=%s LIMIT 1",
array($cnt, $content['id']), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Now sort every each menu
foreach ($ACTIONS as $action) {
- $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result_fix = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
array($action), __FILE__, __LINE__);
$cnt = 1;
while ($content = SQL_FETCHARRAY($result_fix)) {
FROM
`{?_MYSQL_PREFIX?}_user_data`
WHERE
- `last_online` >= {?START_TDAY?} AND `status`='CONFIRMED'
+ `last_online` >= {?START_TDAY?} AND
+ `status`='CONFIRMED'
ORDER BY
`last_online` DESC
LIMIT {?active_limit?}", __FILE__, __LINE__);
$content['jackpot'] = translateComma($jackpot);
// Total referal link clicks, total logins
-$result = SQL_QUERY("SELECT
+$result = SQL_QUERY('SELECT
SUM(d.ref_clicks), SUM(d.total_logins)
FROM
- `{?_MYSQL_PREFIX?}_user_data` AS d", __FILE__, __LINE__);
+ `{?_MYSQL_PREFIX?}_user_data` AS d', __FILE__, __LINE__);
list($ref, $logins) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (empty($count_in)) $count_in = '0';
if (empty($points_in)) $points_in = '0';
- $result = SQL_QUERY("SELECT COUNT(t.id), SUM(t.points)
-FROM `{?_MYSQL_PREFIX?}_user_transfers_out` AS t
-LEFT JOIN `{?_MYSQL_PREFIX?}_user_data` AS d
-ON t.userid=d.userid",
+ $result = SQL_QUERY("SELECT
+ COUNT(t.id), SUM(t.points)
+FROM
+ `{?_MYSQL_PREFIX?}_user_transfers_out` AS t
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+ t.userid=d.userid",
__FILE__, __LINE__);
list($count_out, $points_out) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (isAdmin()) $AND = '';
// Query for guest and member menus
- $guest_t10 = SQL_QUERY("SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `counter` > 0".$AND." ORDER BY `counter` DESC LIMIT 0,10", __FILE__, __LINE__);
- $mem_t10 = SQL_QUERY("SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `counter` > 0".$AND." ORDER BY `counter` DESC LIMIT 0,10", __FILE__, __LINE__);
+ $guest_t10 = SQL_QUERY('SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `counter` > 0' . $AND . ' ORDER BY `counter` DESC LIMIT 0,10', __FILE__, __LINE__);
+ $mem_t10 = SQL_QUERY('SELECT `counter`, `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `counter` > 0' . $AND . ' ORDER BY `counter` DESC LIMIT 0,10', __FILE__, __LINE__);
$OUT = '';
if (!SQL_HASZERONUMS($guest_t10)) {
} // END - while
// Reset accounts
- $result = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=0.00000 WHERE `beg_points` > 0", __FILE__, __LINE__);
+ $result = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=0.00000 WHERE `beg_points` > 0', __FILE__, __LINE__);
} // END - if
// Free memory
} // END - if
// Run SQL string to check for accounts
- $result_main = SQL_QUERY("SELECT
+ $result_main = SQL_QUERY('SELECT
`userid`, `email`, `gender`, `surname`, `family`, (0" . $add . ") AS points
FROM
`{?_MYSQL_PREFIX?}_user_data`
-" . $whereStatement1 . "
+' . $whereStatement1 . '
ORDER BY
`points` DESC,
`userid` ASC
-LIMIT {?bonus_ranks?}", __FILE__, __LINE__);
+LIMIT {?bonus_ranks?}', __FILE__, __LINE__);
// Some entries were found?
if (!SQL_HASZERONUMS($result_main)) {
switch ($mode) {
case 'guest':
// Guests (in the registration form) are not allowed to select 0 mails per day.
- $result = SQL_QUERY("SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value` > 0 ORDER BY `value` ASC",
+ $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value` > 0 ORDER BY `value` ASC',
__FUNCTION__, __LINE__);
break;
case 'member':
// Members are allowed to set to zero mails per day (we will change this soon!)
- $result = SQL_QUERY("SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
+ $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC',
__FUNCTION__, __LINE__);
break;
// because we need it when there is no ext-admins installed
function sendAdminEmails ($subj, $message) {
// Load all admin email addresses
- $result = SQL_QUERY("SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC', __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Send the email out
sendEmail($content['email'], $subj, $message);
$data['points'] = '0';
$result = SQL_QUERY_ESC("SELECT
- (SUM(p.points) - d.used_points) AS points
+ (SUM(p.`points`) - d.`used_points`) AS `points`
FROM
`{?_MYSQL_PREFIX?}_user_points` AS p
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS d
ON
- p.userid=d.userid
+ p.`userid`=d.`userid`
WHERE
- p.userid=%s
+ p.`userid`=%s
LIMIT 1",
array(bigintval($userid)), __FUNCTION__, __LINE__);
);
// Get categories
- $result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort` ASC",
+ $result = SQL_QUERY('SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`' . $whereStatement . ' ORDER BY `sort` ASC',
__FUNCTION__, __LINE__);
// Do we have entries?
// Category given?
if ($cat > 0) {
// Select category
- $CAT_TABS = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.userid=c.userid";
- $CAT_WHERE = sprintf(" AND c.cat_id=%s", $cat);
+ $CAT_TABS = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.`userid`=c.`userid`";
+ $CAT_WHERE = sprintf(" AND c.`cat_id`=%s", $cat);
} // END - if
// Exclude users in holiday?
purgeExpiredTurboBonus();
// Reset accounts
-SQL_QUERY("UPDATE
+SQL_QUERY('UPDATE
`{?_MYSQL_PREFIX?}_user_data`
SET
`turbo_bonus`=0,
`login_bonus`=0,
`bonus_order`=0,
`bonus_stats`=0,
- `bonus_ref`=0",
+ `bonus_ref`=0',
__FILE__, __LINE__);
// [EOF]
// Update user profiles
if (isExtensionInstalledAndNewer('order', '0.1.1')) {
// Latest version
- SQL_QUERY("UPDATE
+ SQL_QUERY('UPDATE
`{?_MYSQL_PREFIX?}_user_data`
SET
`receive_mails`=`max_mails`,
`mail_orders`=0
WHERE
- `receive_mails` != `max_mails`", __FILE__, __LINE__);
+ `receive_mails` != `max_mails`', __FILE__, __LINE__);
} else {
// Obsolete version
- SQL_QUERY("UPDATE
+ SQL_QUERY('UPDATE
`{?_MYSQL_PREFIX?}_user_data`
SET
`receive_mails`=`max_mails`
WHERE
- `receive_mails` != `max_mails`", __FILE__, __LINE__);
+ `receive_mails` != `max_mails`', __FILE__, __LINE__);
}
// Transfer points from locked_points to points
if ((getConfig('send_prof_update') == 'Y') && (getConfig('profile_update') > 0) && (getConfig('resend_profile_update'))) {
// Load personal data
- $result = SQL_QUERY("SELECT `userid`, `email`, `last_update`, `joined`
+ $result = SQL_QUERY('SELECT `userid`, `email`, `last_update`, `joined`
FROM
`{?_MYSQL_PREFIX?}_user_data`
WHERE
(`last_update` < (UNIX_TIMESTAMP() - {?profile_update?}) AND
- `last_update` != 0 AND
+ `last_update` > 0 AND
`last_profile_sent` < (UNIX_TIMESTAMP() - {?resend_profile_update?}))
OR
- (`last_update` = '0' AND `last_profile_sent` = '0' AND `joined` < (UNIX_TIMESTAMP() - {?profile_update?}))
+ (`last_update` = 0 AND `last_profile_sent` = 0 AND `joined` < (UNIX_TIMESTAMP() - {?profile_update?}))
ORDER BY
- `userid` ASC", __FILE__, __LINE__);
+ `userid` ASC', __FILE__, __LINE__);
// Do we have some notifications to sent?
if (!SQL_HASZERONUMS($result)) {
}
// Main compilation loop
-function doFinalCompilation ($code, $insertComments = true) {
+function doFinalCompilation ($code, $insertComments = true, $enableCodes = true) {
// Insert comments? (Only valid with HTML templates, of course)
enableTemplateHtml($insertComments);
// Compile it
//* DEBUG: */ debugOutput('<pre>'.linenumberCode($code).'</pre>');
- $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code))) . '";';
+ $eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code), false, true, $enableCodes)) . '";';
//* DEBUG: */ if (!$insertComments) print('<pre>'.linenumberCode($eval).'</pre>');
eval($eval);
//* DEBUG: */ die('<pre>'.encodeEntities($newContent).'</pre>');