inc/filter/cache_filter.php svneol=native#text/plain
inc/filter/country_filter.php svneol=native#text/plain
inc/filter/coupon_filter.php svneol=native#text/plain
+inc/filter/doubler_filter.php svneol=native#text/plain
inc/filter/earning_filter.php svneol=native#text/plain
inc/filter/forced_filter.php svneol=native#text/plain
inc/filter/mediadata_filter.php svneol=native#text/plain
### WARNING: THIS FILE IS AUTO-GENERATED BY ../../contrib/todo-builder.sh (uid=/user=quix0r) ###
### DO NOT EDIT THIS FILE. ###
./api.php:68:// @TODO Do stuff here
-./autoreg.php:58:// @TODO Add processing of request here
+./autoreg.php:62:// @TODO Add processing of request here
./beg.php:175: // @TODO Opps, what is missing here???
./cron.php:62:// @TODO Do stuff here
./inc/classes/cachesystem.class.php:516: // @TODO Add support for more types which break in last else-block
-./inc/config-functions.php:149: // @TODO Make this all better... :-/
-./inc/config-functions.php:325: // @TODO Call setConfigEntry() somehow
-./inc/config-functions.php:353: // @TODO Call setConfigEntry() somehow
+./inc/config-functions.php:150: // @TODO Make this all better... :-/
+./inc/config-functions.php:326: // @TODO Call setConfigEntry() somehow
+./inc/config-functions.php:354: // @TODO Call setConfigEntry() somehow
./inc/daily/daily_beg.php:52:// @TODO This should be converted in a daily beg rallye
./inc/daily/daily_birthday.php:99: // @TODO 4 is hard-coded here, should we move it out in config?
./inc/email-functions.php:113: * @TODO Rewrite this to an extension 'smtp'
./inc/extensions/ext-network.php:97: // @TODO network_type_handler is an internal name and needs documentation
./inc/extensions/ext-newsletter.php:218: // @TODO Move these into configuration
./inc/extensions/ext-nickname.php:52: // @TODO NOT NULL DEFAULT '' is bad practice, use NULL
-./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table?
+./inc/extensions/ext-yoomedia.php:120: // @TODO Can this be moved into a database table?
./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y');
./inc/extensions-functions.php:2169: // @TODO Is this really neccessary?
./inc/extensions-functions.php:2220:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
./inc/language/refback_de.php:51: // @TODO Rewrite these constants to one
./inc/libs/admins_functions.php:537: // @TODO This can be, somehow, rewritten
./inc/libs/bonus_functions.php:195: // @TODO Move this HTML to a template
+./inc/libs/doubler_functions.php:130:// @TODO This could be rewritten to a filter
./inc/libs/doubler_functions.php:44:// @TODO Lame description
./inc/libs/doubler_functions.php:96: // @TODO Can't this be moved into EL?
./inc/libs/forced_functions.php:457:// @TODO Can't we use our new expression language instead of this ugly code?
./inc/modules/admin/what-list_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
./inc/modules/admin/what-list_rallye_prices.php:222: // @TODO Rewrite these two constants
./inc/modules/admin/what-list_refs.php:101: // @TODO Try to rewrite some to EL
-./inc/modules/admin/what-list_unconfirmed.php:114: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
-./inc/modules/admin/what-list_unconfirmed.php:84: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
-./inc/modules/admin/what-list_unconfirmed.php:87: // @TODO `id` has been used two times???
+./inc/modules/admin/what-list_unconfirmed.php:120: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
+./inc/modules/admin/what-list_unconfirmed.php:90: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
+./inc/modules/admin/what-list_unconfirmed.php:93: // @TODO `id` has been used two times???
./inc/modules/admin/what-list_user_cats.php:54: // @TODO No longer needed? define('__CATEGORIES_BASE' , '<a href="{%url=modules.php?module=admin&userid=');
./inc/modules/admin/what-list_user_cats.php:68: // @TODO Rewrite this to countSum.....() function
./inc/modules/admin/what-list_user.php:104: // @TODO Refacture these old link generation to functions
./inc/modules/order.php:78: // @TODO Unused: 2,4
./inc/mysql-manager.php:1492: // @TODO Rewrite these lines to a filter
./inc/mysql-manager.php:1516: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1822: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1990: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
-./inc/mysql-manager.php:2113: // @TODO Used generic 'userid' here
-./inc/mysql-manager.php:2334:// @TODO cacheFiles is not yet supported
+./inc/mysql-manager.php:1832: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:2000: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
+./inc/mysql-manager.php:2123: // @TODO Used generic 'userid' here
+./inc/mysql-manager.php:2344:// @TODO cacheFiles is not yet supported
./inc/mysql-manager.php:408: // @TODO Try to rewrite this to one or more functions
./inc/mysql-manager.php:44:// @TODO Can we cache this?
-./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter
./inc/revision-functions.php:168:// @TODO This function does also set and get in 'cache_array'
./inc/template-functions.php:1040: // @TODO <label for="' . $prefix . '_' . $field . '"></<label> not working here
./inc/template-functions.php:1095: // @TODO Deprecate this thing
./inc/template-functions.php:209: * @TODO On some pages this is buggy
./inc/template-functions.php:298: // @TODO Remove these sanity checks if all is fine
./inc/template-functions.php:747: // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
-./inc/wrapper-functions.php:3197: // @TODO Find a way to not use direct module comparison
-./inc/wrapper-functions.php:512:// @TODO Do some more sanity check here
+./inc/wrapper-functions.php:3209: // @TODO Find a way to not use direct module comparison
+./inc/wrapper-functions.php:524:// @TODO Do some more sanity check here
./inc/xml-functions.php:240: // @TODO Handle characters
./mailid.php:101: // @TODO Rewrite this to a filter
./mailid.php:144: // @TODO Rewrite this to a filter
// 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
+ `{?_MYSQL_PREFIX?}_user_birthday` AS `b`
INNER JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_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,
// CFG: ERROR-REPORTING
error_reporting(E_ALL | E_DEPRECATED | E_STRICT);
-// Is the function there? (removed in PHP 5.4.x)
+// Is the function there? (removed in PHP 5.4.0)
if (function_exists('import_request_variables')) {
// CFG: REGISTER-GLOBALS
@import_request_variables('');
$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 = SQL_QUERY_ESC("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?
$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 = SQL_QUERY_ESC("SELECT `id` AS `task_id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
array($subject), __FUNCTION__, __LINE__);
// Entry found?
} // END - if
// Version number
-setThisExtensionVersion('0.3.4');
+setThisExtensionVersion('0.3.5');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running
// Unregister filter
unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'BEG_RALLYE_USER_REGISTRATION_ADD_SQL_COLUMNS', TRUE, isExtensionDryRun());
unregisterFilter(__FILE__, __LINE__, 'init', 'BEG_PURGE_IPS_NOTIFY_USER', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXCLUDE_BEG_USERID', TRUE, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
// Update notes
setExtensionUpdateNotes("Verwendungszwecke für Referralgutgschriften registriert.");
break;
+
+ case '0.3.5': // SQL queries for v0.3.5
+ // Register a filter
+ registerFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXCLUDE_BEG_USERID', FALSE, TRUE, isExtensionDryRun());
+
+ // Update notes
+ setExtensionUpdateNotes("Filter für das Ausschließen des konfigurierbaren Mitgliedaccounts hinzugefügt.");
+ break;
} // END - switch
break;
} // END - if
// Version of this extension
-setThisExtensionVersion('0.9.9');
+setThisExtensionVersion('1.0.0');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.6', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3', '0.9.4', '0.9.5', '0.9.6', '0.9.7', '0.9.8', '0.9.9'));
+setExtensionVersionHistory(array('0.0.0', '0.1.6', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3', '0.9.4', '0.9.5', '0.9.6', '0.9.7', '0.9.8', '0.9.9', '1.0.0'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running
unregisterFilter(__FILE__, __LINE__, 'add_bonus_points_user_columns', 'ADD_BONUS_POINTS_USER_COLUMNS', TRUE, isExtensionDryRun());
unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'BONUS_USER_REGISTRATION_ADD_SQL_COLUMNS', TRUE, isExtensionDryRun());
unregisterFilter(__FILE__, __LINE__, 'init', 'SEND_BONUS_NOTIFICATIONS', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXLCUDE_BONUS_USERID', TRUE, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Filter zum Hinzufügen von SQL-Spalten bei der Mitgliederanmeldung.");
break;
+
+ case '1.0.0': // SQL queries for v1.0.0
+ // Register filter
+ registerFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXLCUDE_BONUS_USERID', FALSE, TRUE, isExtensionDryRun());
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Filter zum Ausschließen des konfigurierten Mitgliedaccounts.");
+ break;
} // END - switch
break;
} // END - if
// Version number
-setThisExtensionVersion('0.1.9');
+setThisExtensionVersion('0.2.0');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running
// Unregister points data
unregisterExtensionPointsData('doubler_direct');
unregisterExtensionPointsData('doubler_reset');
+
+ // Unregister filters
+ unregisterFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXLCUDE_DOUBLER_USERID', TRUE, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
// Update notes
setExtensionUpdateNotes("Fehlender Konfigurationseintrag <strong>doubler_used</strong> hinzgefügt.");
break;
+
+ case '0.2.0': // SQL queries for v0.2.0
+ // Register filter
+ registerFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXLCUDE_DOUBLER_USERID', FALSE, TRUE, isExtensionDryRun());
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Filter zum Ausschließen des konfigurierten Mitgliedaccounts.");
+ break;
} // END - switch
break;
} // END - if
// Version number
-setThisExtensionVersion('0.9.6');
+setThisExtensionVersion('0.9.7');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3', '0.9.4', '0.9.5', '0.9.6'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1', '0.9.2', '0.9.3', '0.9.4', '0.9.5', '0.9.6', '0.9.7'));
// Keep this extension always active!
setExtensionAlwaysActive('Y');
unregisterFilter(__FILE__, __LINE__, 'init', 'GENERATE_FILE_SECRET_HASH', TRUE, isExtensionDryRun());
unregisterFilter(__FILE__, __LINE__, 'extra_autopurge', 'SERVER_NAME_EXTRA_AUTOPURGE', TRUE, isExtensionDryRun());
unregisterFilter(__FILE__, __LINE__, 'determine_menu_mode', 'DETERMINE_MENU_MODE_GENERIC', TRUE, isExtensionDryRun());
+ unregisterFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXCLUDE_DEFAULT_REFID', TRUE, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Filter hinzugefügt, der den Menümodus für weitere von dieser Erweiterung benutzten Module erkennen soll.");
break;
+
+ case '0.9.7': // SQL queries for v0.9.7
+ // Register filter
+ registerFilter(__FILE__, __LINE__, 'config_userid_exclusion_sql', 'EXCLUDE_DEFAULT_REFID', FALSE, TRUE, isExtensionDryRun());
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Filter hinzugefügt, der die Standard-Referral-Id für SQL-Befehle ausschliesst.");
+ break;
} // END - switch
break;
return $filterData;
}
+// Filter to add exclusion SQL for configured userid
+function FILTER_EXCLUDE_BEG_USERID ($filterData = array()) {
+ // Is it valid?
+ if (isValidId(getBegUserid())) {
+ // Exclude it
+ array_push($filterData, '{?beg_userid?}');
+ } // END - if
+
+ // Return it
+ return $filterData;
+}
+
// [EOF]
?>
return $filterData;
}
+// Filter to add exclusion SQL for configured userid
+function FILTER_EXLCUDE_BONUS_USERID ($filterData = array()) {
+ // Is it valid?
+ if (isValidId(getBonusUserid())) {
+ // Exclude it
+ array_push($filterData, '{?bonus_userid?}');
+ } // END - if
+
+ // Return it
+ return $filterData;
+}
+
// [EOF]
?>
--- /dev/null
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 01/10/2013 *
+ * =================== Last change: 01/10/2013 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : doubler_filter.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Filters for ext-doubler *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Filter fuer ext-doubler *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ die();
+} // END - if
+
+// Filter to add exclusion SQL for configured userid
+function FILTER_EXLCUDE_DOUBLER_USERID ($filterData = array()) {
+ // Is it valid?
+ if (isValidId(getDoublerUserid())) {
+ // Exclude it
+ array_push($filterData, '{?doubler_userid?}');
+ } // END - if
+
+ // Return it
+ return $filterData;
+}
+
+// [EOF]
+?>
// Now check if the user has subscription and amount left
$result = SQL_QUERY_ESC("SELECT
- d.`earning_id`,
- d.`earning_provider`,
- u.`earning_current_amount`,
- u.`earning_daily_amount`,
- u.`earning_active`,
- u.`earning_added`,
- u.`earning_canceled`,
- u.`earning_points`
+ `d`.`earning_id`,
+ `d`.`earning_provider`,
+ `u`.`earning_current_amount`,
+ `u`.`earning_daily_amount`,
+ `u`.`earning_active`,
+ `u`.`earning_added`,
+ `u`.`earning_canceled`,
+ `u`.`earning_points`
FROM
- `{?_MYSQL_PREFIX?}_user_earning` AS u
+ `{?_MYSQL_PREFIX?}_user_earning` AS `u`
INNER JOIN
- `{?_MYSQL_PREFIX?}_earning_data` AS d
+ `{?_MYSQL_PREFIX?}_earning_data` AS `d`
ON
- u.`earning_id`=d.`earning_id`
+ `u`.`earning_id`=`d`.`earning_id`
WHERE
- u.`earning_userid`=%s AND
- u.`earning_active`='Y' AND
- u.`earning_current_amount` < u.`earning_daily_amount` AND
- d.`earning_group`='POPUP'
+ `u`.`earning_userid`=%s AND
+ `u`.`earning_active`='Y' AND
+ `u`.`earning_current_amount` < `u`.`earning_daily_amount` AND
+ `d`.`earning_group`='POPUP'
ORDER BY
- d.`earning_sorting` ASC",
+ `d`.`earning_sorting` ASC",
array(
getMemberId()
), __FUNCTION__, __LINE__);
// Check for new started but not notified rallyes
$result = SQL_QUERY("SELECT SQL_SMALL_RESULT
- d.`id`,
- d.`title`,
- d.`start_time`,
- d.`end_time`,
- d.`send_notify`
+ `d`.`id`,
+ `d`.`title`,
+ `d`.`start_time`,
+ `d`.`end_time`,
+ `d`.`send_notify`
" . $sqlAddons['add'] . "
FROM
- `{?_MYSQL_PREFIX?}_rallye_data` AS d
+ `{?_MYSQL_PREFIX?}_rallye_data` AS `d`
WHERE
- d.`is_active`='Y' AND
- d.`notified`='N' AND
- d.`expired`='N' AND
- d.`start_time` <= UNIX_TIMESTAMP() AND
- d.`end_time` > UNIX_TIMESTAMP()
+ `d`.`is_active`='Y' AND
+ `d`.`notified`='N' AND
+ `d`.`expired`='N' AND
+ `d`.`start_time` <= UNIX_TIMESTAMP() AND
+ `d`.`end_time` > UNIX_TIMESTAMP()
LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Start rallye
// Check for expired rallyes
$result = SQL_QUERY("SELECT SQL_SMALL_RESULT
- d.`id`,
- d.`title`,
- d.`start_time`,
- d.`end_time`,
- d.`send_notify`
+ `d`.`id`,
+ `d`.`title`,
+ `d`.`start_time`,
+ `d`.`end_time`,
+ `d`.`send_notify`
" . $sqlAddons['add'] . "
FROM
- `{?_MYSQL_PREFIX?}_rallye_data` AS d
+ `{?_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()" . $sqlAddons['or'] . ")
+ `d`.`is_active`='Y' AND
+ `d`.`notified`='Y' AND
+ `d`.`expired`='N' AND
+ (`d`.`end_time` <= UNIX_TIMESTAMP()" . $sqlAddons['or'] . ")
LIMIT 1", __FILE__, __LINE__);
if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('autopurge'))) {
// End rallye here...
if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
// Add more data on higher versions
$filterData['add'] .= ',`min_users`, `min_prices`';
- $filterData['or'] .= ' OR (d.`min_users` <= ' . getTotalConfirmedUser() . ' AND d.`min_users` > 0)';
+ $filterData['or'] .= ' OR (`d`.`min_users` <= ' . getTotalConfirmedUser() . ' AND `d`.`min_users` > 0)';
} // END - if
// Return data
return $filterData;
}
+// Filter to exclude default referral id
+function FILTER_EXCLUDE_DEFAULT_REFID ($filterData = array()) {
+ // Is it valid?
+ if (isValidId(getDefRefid())) {
+ // Exclude it
+ array_push($filterData, '{?def_refid?}');
+ } // END - if
+
+ // Return it
+ return $filterData;
+}
+
// [EOF]
?>
}
// Get total points left in doubler pot
+// @TODO This could be rewritten to a filter
function getDoublerTotalPointsLeft() {
// Initialize variables
$points = '0';
} // END - if
if ((getConfig('doubler_jackpot') == 'Y') && (isExtensionActive('jackpot'))) {
- // Load jackpot
- $jackpot = getJackpotPoints();
-
- if (!empty($jackpot)) $points += $jackpot;
+ // Get+add jackpot points
+ $points += getJackpotPoints();
} // END - if
if (isValidId(getDoublerUserid())) {
// Get user's points
- $user = getTotalPoints(getDoublerUserid());
- $points += $user;
+ $points += getTotalPoints(getDoublerUserid());
} // END - if
// Return value
// Query all types of this network
$result = SQL_QUERY('SELECT
- t.`network_type_id`,
- t.`network_type_handler`,
- d.`network_title`
+ `t`.`network_type_id`,
+ `t`.`network_type_handler`,
+ `d`.`network_title`
FROM
- `{?_MYSQL_PREFIX?}_network_types` AS t
+ `{?_MYSQL_PREFIX?}_network_types` AS `t`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_network_data` AS d
+ `{?_MYSQL_PREFIX?}_network_data` AS `d`
ON
- t.`network_id`=d.`network_id`
+ `t`.`network_id`=`d`.`network_id`
' . getNetworkActivatedColumn('WHERE', 'd') . '
ORDER BY
- d.`network_short_name` ASC,
- t.`network_type_handler` ASC', __FUNCTION__, __LINE__);
+ `d`.`network_short_name` ASC,
+ `t`.`network_type_handler` ASC', __FUNCTION__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
if (SQL_HASZERONUMS($result_ref)) {
// Add userid and his ref count to table
$result_ref = SQL_QUERY_ESC("SELECT
- SUM(p.`points`) AS `points`
+ SUM(`p`.`points`) AS `points`
FROM
- `{?_MYSQL_PREFIX?}_user_points` AS p
+ `{?_MYSQL_PREFIX?}_user_points` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
p.userid=d.userid
WHERE
- d.`status`='CONFIRMED'
+ `d`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . " AND
- d.`max_mails` > 0 AND
- d.`mails_confirmed` >= {?ref_payout?} AND
- p.`ref_depth`=1 AND
- p.`points` > 0 AND
- d.`userid`=%s",
+ `d`.`max_mails` > 0 AND
+ `d`.`mails_confirmed` >= {?ref_payout?} AND
+ `p`.`ref_depth`=1 AND
+ `p`.`points` > 0 AND
+ `d`.`userid`=%s",
array(bigintval($content['userid'])), __FUNCTION__, __LINE__);
// Get points
// And load only limited users
$result = SQL_QUERY_ESC("SELECT DISTINCT
- u.`userid`,
- u.`refs`,
- u.`curr_points`,
- rd.`min_users`,
- rd.`min_prices`
+ `u`.`userid`,
+ `u`.`refs`,
+ `u`.`curr_points`,
+ `rd`.`min_users`,
+ `rd`.`min_prices`
FROM
- `{?_MYSQL_PREFIX?}_rallye_users` AS u
+ `{?_MYSQL_PREFIX?}_rallye_users` AS `u`
INNER JOIN
- `{?_MYSQL_PREFIX?}_refsystem` AS r
+ `{?_MYSQL_PREFIX?}_refsystem` AS `r`
ON
u.userid=r.userid
INNER JOIN
- `{?_MYSQL_PREFIX?}_rallye_data` AS rd
+ `{?_MYSQL_PREFIX?}_rallye_data` AS `rd`
ON
- u.`rallye_id`=rd.`id`
+ `u`.`rallye_id`=r`d`.`id`
WHERE
- u.`rallye_id`=%s AND
- r.`counter` > 0
+ `u`.`rallye_id`=%s AND
+ `r`.`counter` > 0
ORDER BY
u.refs DESC",
array(bigintval($rallye)), __FUNCTION__, __LINE__);
// Points of ref's
$result_ref = SQL_QUERY_ESC("SELECT
- p.`points`
+ `p`.`points`
FROM
- `{?_MYSQL_PREFIX?}_user_points` AS p
+ `{?_MYSQL_PREFIX?}_user_points` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- p.`userid`=d.`userid`
+ `p`.`userid`=`d`.`userid`
WHERE
- d.`userid`=%s AND
- d.`status`='CONFIRMED'
+ `d`.`userid`=%s AND
+ `d`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . " AND
- p.`ref_depth`=1 AND
- d.`max_mails` > 0 AND
- d.`mails_confirmed` >= {?ref_payout?}
+ `p`.`ref_depth`=1 AND
+ `d`.`max_mails` > 0 AND
+ `d`.`mails_confirmed` >= {?ref_payout?}
LIMIT 1",
array(bigintval($row['userid'])), __FUNCTION__, __LINE__);
// Points of ref's
$result_ref = SQL_QUERY_ESC("SELECT
- SUM(p.`points`) AS `points`
+ SUM(`p`.`points`) AS `points`
FROM
- `{?_MYSQL_PREFIX?}_user_points` AS p
+ `{?_MYSQL_PREFIX?}_user_points` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- p.`userid`=d.`userid`
+ `p`.`userid`=`d`.`userid`
WHERE
- d.`status`='CONFIRMED'
+ `d`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ' ) . " AND
- d.`max_mails` > 0 AND
- d.`mails_confirmed` >= {?ref_payout?} AND
- p.`ref_depth`=1 AND
- p.`points` > 0 AND
- d.`userid`=%s
+ `d`.`max_mails` > 0 AND
+ `d`.`mails_confirmed` >= {?ref_payout?} AND
+ `p`.`ref_depth`=1 AND
+ `p`.`points` > 0 AND
+ `d`.`userid`=%s
LIMIT 1",
array(bigintval($content['userid'])), __FUNCTION__, __LINE__);
$result_ref = SQL_QUERY_ESC("SELECT
SUM(s.counter) AS `cnt`
FROM
- `{?_MYSQL_PREFIX?}_refsystem` AS s
+ `{?_MYSQL_PREFIX?}_refsystem` AS `s`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_refdepths` AS d
+ `{?_MYSQL_PREFIX?}_refdepths` AS `d`
ON
- s.level=d.level
+ s.`level`=`d`.`level`
WHERE
- s.userid=%s AND
- s.level=1",
+ s.`userid`=%s AND
+ s.`level`=1",
array(
bigintval($userid)
), __FUNCTION__, __LINE__);
// Get refs from database
$result = SQL_QUERY_ESC("SELECT
- r.`id`,
- r.`refid`,
- r.`refback_percents`,
- r.`refback_points`,
- d.`status`,
- d.`joined`,
- d.`mails_confirmed`,
- d.`emails_received`,
- d.`refid` AS `level_refid`
+ `r`.`id`,
+ `r`.`refid`,
+ `r`.`refback_percents`,
+ `r`.`refback_points`,
+ `d`.`status`,
+ `d`.`joined`,
+ `d`.`mails_confirmed`,
+ `d`.`emails_received`,
+ `d`.`refid` AS `level_refid`
FROM
- `{?_MYSQL_PREFIX?}_user_refs` AS r
+ `{?_MYSQL_PREFIX?}_user_refs` AS `r`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- r.`refid`=d.`userid`
+ `r`.`refid`=`d`.`userid`
WHERE
- r.`userid`=%s AND
- r.`level`=%s
+ `r`.`userid`=%s AND
+ `r`.`level`=%s
ORDER BY
- r.`refid` ASC",
+ `r`.`refid` ASC",
array(bigintval($userid), bigintval($level)), __FUNCTION__, __LINE__);
// Are there some entries?
INNER JOIN
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `u`
ON
- u.`url_id`=l.`locks_url_id`
+ `u`.`url_id`=l.`locks_url_id`
WHERE
l.`locks_userid`=%s AND
(UNIX_TIMESTAMP() - {%%pipe,getSurfbarSurfLock%%}) < UNIX_TIMESTAMP(l.`locks_last_surfed`) AND
(
- ((UNIX_TIMESTAMP(l.`locks_last_surfed`) - u.`url_fixed_reload`) < 0 AND u.`url_fixed_reload` > 0) OR
- u.`url_fixed_reload` = 0
+ ((UNIX_TIMESTAMP(l.`locks_last_surfed`) - `u`.`url_fixed_reload`) < 0 AND `u`.`url_fixed_reload` > 0) OR
+ `u`.`url_fixed_reload` = 0
)
LIMIT 1",
array(getMemberId()), __FUNCTION__, __LINE__
// Get all userid except logged in one
$result = SQL_QUERY_ESC("SELECT
- u.`url_userid`,
- UNIX_TIMESTAMP(d.`surfbar_low_notified`) AS `notified`
+ `u`.`url_userid`,
+ UNIX_TIMESTAMP(`d`.`surfbar_low_notified`) AS `notified`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `u`
INNER JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- u.`url_userid`=d.`userid`
+ `u`.`url_userid`=`d`.`userid`
WHERE
- u.`url_userid` NOT IN (%s) AND
- u.`url_userid` IS NOT NULL AND
- u.`url_status`='ACTIVE'
+ `u`.`url_userid` NOT IN (%s) AND
+ `u`.`url_userid` IS NOT NULL AND
+ `u`.`url_status`='ACTIVE'
GROUP BY
- u.`url_userid`
+ `u`.`url_userid`
ORDER BY
- u.`url_userid` ASC",
+ `u`.`url_userid` ASC",
array(getMemberId()), __FUNCTION__, __LINE__);
} else {
// Get all userid
$result = SQL_QUERY("SELECT
- u.`url_userid`,
- UNIX_TIMESTAMP(d.`surfbar_low_notified`) AS `notified`
+ `u`.`url_userid`,
+ UNIX_TIMESTAMP(`d`.`surfbar_low_notified`) AS `notified`
FROM
- `{?_MYSQL_PREFIX?}_surfbar_urls` AS u
+ `{?_MYSQL_PREFIX?}_surfbar_urls` AS `u`
INNER JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- u.`url_userid`=d.`userid`
+ `u`.`url_userid`=`d`.`userid`
WHERE
- u.`url_userid` > 0 AND
- u.`url_status`='ACTIVE'
+ `u`.`url_userid` > 0 AND
+ `u`.`url_status`='ACTIVE'
GROUP BY
- u.`url_userid`
+ `u`.`url_userid`
ORDER BY
- u.`url_userid` ASC", __FUNCTION__, __LINE__);
+ `u`.`url_userid` ASC", __FUNCTION__, __LINE__);
}
// Load all userid
function getSurfbarMaximumRandom ($userids, $add) {
// Count max availabe entries
$result = SQL_QUERY("SELECT
- sbu.`url_id` AS `cnt`
+ `sbu`.`url_id` AS `cnt`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_salts` AS `sbs`
ON
- sbu.`url_id`=sbs.`salts_url_id`
+ `sbu`.`url_id`=`sbs`.`salts_url_id`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- sbu.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=l.`locks_url_id`
WHERE
- 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'
+ `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 . "
GROUP BY
- sbu.`url_id` ASC", __FUNCTION__, __LINE__);
+ `sbu`.`url_id` ASC", __FUNCTION__, __LINE__);
// Log last query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS());
// Begin the query
$result = SQL_QUERY_ESC("SELECT
- u.`url_id`,
- u.`url_userid`,
- u.`url_package_id`,
- u.`url`,
- u.`url_status`,
- u.`url_views_total`,
- u.`url_views_max`,
- u.`url_views_allowed`,
- UNIX_TIMESTAMP(u.`url_registered`) AS `url_registered`,
- UNIX_TIMESTAMP(u.`url_last_locked`) AS `url_last_locked`,
- u.`url_lock_reason`
+ `u`.`url_id`,
+ `u`.`url_userid`,
+ `u`.`url_package_id`,
+ `u`.`url`,
+ `u`.`url_status`,
+ `u`.`url_views_total`,
+ `u`.`url_views_max`,
+ `u`.`url_views_allowed`,
+ UNIX_TIMESTAMP(`u`.`url_registered`) AS `url_registered`,
+ UNIX_TIMESTAMP(`u`.`url_last_locked`) AS `url_last_locked`,
+ `u`.`url_lock_reason`
FROM
- `{?_MYSQL_PREFIX?}_surfbar_urls` AS u
+ `{?_MYSQL_PREFIX?}_surfbar_urls` AS `u`
WHERE
- u.`url_userid`=%s AND
- u.`url_status` != 'DELETED'
+ `u`.`url_userid`=%s AND
+ `u`.`url_status` != 'DELETED'
ORDER BY
- u.`url_id` ASC",
+ `u`.`url_id` ASC",
array(getMemberId()), __FUNCTION__, __LINE__);
// Are there entries?
$add = '';
if (count($USE) > 0) {
// Ignore some!
- $add = " AND sbu.`url_id` NOT IN (";
+ $add = " AND `sbu`.`url_id` NOT IN (";
foreach ($USE as $url_id => $lid) {
// Add URL id
$add .= $url_id.',';
// And query the database
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'randNum='.$randNum.',maxRand='.$maxRand.',surfLock='.getSurfbarSurfLock());
$result = SQL_QUERY_ESC("SELECT
- sbu.`url_id`,
- sbu.`url_userid`,
- sbu.`url_package_id`,
- sbu.`url`,
- sbs.`salts_last_salt`,
- sbu.`url_views_total`,
- sbu.`url_views_max`,
- sbu.`url_views_allowed`,
+ `sbu`.`url_id`,
+ `sbu`.`url_userid`,
+ `sbu`.`url_package_id`,
+ `sbu`.`url`,
+ `sbs`.`salts_last_salt`,
+ `sbu`.`url_views_total`,
+ `sbu`.`url_views_max`,
+ `sbu`.`url_views_allowed`,
UNIX_TIMESTAMP(l.`locks_last_surfed`) AS `last_surfed`,
- sbu.`url_fixed_reload`
+ `sbu`.`url_fixed_reload`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_salts` AS `sbs`
ON
- sbu.`url_id`=sbs.`salts_url_id`
+ `sbu`.`url_id`=`sbs`.`salts_url_id`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- sbu.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=l.`locks_url_id`
WHERE
- (sbu.`url_userid` NOT IN (" . implode(',', $userids['url_userid']) . ") OR sbu.`url_userid` IS NULL) AND
- sbu.`url_status`='ACTIVE' AND
- (sbu.`url_views_allowed`=0 OR (sbu.`url_views_allowed` > 0 AND sbu.`url_views_max` > 0))
+ (`sbu`.`url_userid` NOT IN (" . implode(',', $userids['url_userid']) . ") OR `sbu`.`url_userid` IS NULL) AND
+ `sbu`.`url_status`='ACTIVE' AND
+ (`sbu`.`url_views_allowed`=0 OR (`sbu`.`url_views_allowed` > 0 AND `sbu`.`url_views_max` > 0))
" . $add . "
GROUP BY
- sbu.`url_id`
+ `sbu`.`url_id`
ORDER BY
l.`locks_last_surfed` ASC,
- sbu.`url_id` ASC
+ `sbu`.`url_id` ASC
LIMIT %s,1",
array($randNum), __FUNCTION__, __LINE__
);
} else {
// Get data from specified id number
$result = SQL_QUERY_ESC("SELECT
- sbu.`url_id`,
- sbu.`url_userid`,
- sbu.`url_package_id`,
- sbu.`url`,
- sbs.`salts_last_salt`,
- sbu.`url_views_total`,
- sbu.`url_views_max`,
- sbu.`url_views_allowed`,
+ `sbu`.`url_id`,
+ `sbu`.`url_userid`,
+ `sbu`.`url_package_id`,
+ `sbu`.`url`,
+ `sbs`.`salts_last_salt`,
+ `sbu`.`url_views_total`,
+ `sbu`.`url_views_max`,
+ `sbu`.`url_views_allowed`,
UNIX_TIMESTAMP(l.`locks_last_surfed`) AS `last_surfed`,
- sbu.`url_fixed_reload`
+ `sbu`.`url_fixed_reload`
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls` AS `sbu`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_salts` AS `sbs`
ON
- sbu.`url_id`=sbs.`salts_url_id`
+ `sbu`.`url_id`=`sbs`.`salts_url_id`
LEFT JOIN
`{?_MYSQL_PREFIX?}_surfbar_locks` AS `l`
ON
- sbu.`url_id`=l.`locks_url_id`
+ `sbu`.`url_id`=l.`locks_url_id`
WHERE
- (sbu.`url_userid` != %s OR sbu.`url_userid` IS NULL) AND
- sbu.`url_status`='ACTIVE' AND
- sbu.`url_id`=%s AND
- (sbu.`url_views_allowed` = 0 OR (sbu.`url_views_allowed` > 0 AND sbu.`url_views_max` > 0))
+ (`sbu`.`url_userid` != %s OR `sbu`.`url_userid` IS NULL) AND
+ `sbu`.`url_status`='ACTIVE' AND
+ `sbu`.`url_id`=%s AND
+ (`sbu`.`url_views_allowed` = 0 OR (`sbu`.`url_views_allowed` > 0 AND `sbu`.`url_views_max` > 0))
LIMIT 1",
array(getMemberId(), bigintval($urlId)), __FUNCTION__, __LINE__
);
// Check for more extensions
// @TODO These can be rewritten to filter
- if (isValidId(getDefRefid())) $userExclusionSql .= ' AND d.`userid` != {?def_refid?}';
- if (isExtensionActive('beg')) $userExclusionSql .= ' AND d.`userid` != {?beg_userid?}';
- if (isExtensionActive('bonus')) $userExclusionSql .= ' AND d.`userid` != {?bonus_userid?}';
- if (isExtensionActive('doubler')) $userExclusionSql .= ' AND d.`userid` != {?doubler_userid?}';
+ if (isValidId(getDefRefid())) $userExclusionSql .= ' AND `d`.`userid` != {?def_refid?}';
+ if (isExtensionActive('beg')) $userExclusionSql .= ' AND `d`.`userid` != {?beg_userid?}';
+ if (isExtensionActive('bonus')) $userExclusionSql .= ' AND `d`.`userid` != {?bonus_userid?}';
+ if (isExtensionActive('doubler')) $userExclusionSql .= ' AND `d`.`userid` != {?doubler_userid?}';
if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
// Recent ext-holiday found
- $userExclusionSql .= " AND d.`holiday_active`='N'";
+ $userExclusionSql .= " AND `d`.`holiday_active`='N'";
} // END - if
// Check for all accounts
addSql("SELECT
- d.`userid`,
- d.`email`,
- d.`last_online`
+ `d`.`userid`,
+ `d`.`email`,
+ `d`.`last_online`
FROM
`{?_MYSQL_PREFIX?}_user_data` AS `d`
WHERE
- d.`status`='CONFIRMED' AND
- (UNIX_TIMESTAMP() - d.`joined`) >= {?ap_inactive_since?} AND
- (UNIX_TIMESTAMP() - d.`last_online`) >= {?ap_inactive_since?} AND
- (UNIX_TIMESTAMP() - d.`ap_notified`) >= {?ap_inactive_since?}
+ `d`.`status`='CONFIRMED' AND
+ (UNIX_TIMESTAMP() - `d`.`joined`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `d`.`last_online`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `d`.`ap_notified`) >= {?ap_inactive_since?}
" . $userExclusionSql . "
ORDER BY
- d.`userid` ASC");
+ `d`.`userid` ASC");
$WHATs[] = 'list_autopurge';
$DESCRs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE--}';
$TITLEs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE--}';
// Try to find the entry
$result = SQL_QUERY_ESC("SELECT
- UNIX_TIMESTAMP(`inserted`) AS inserted
+ UNIX_TIMESTAMP(`inserted`) AS `inserted`
FROM
`{?_MYSQL_PREFIX?}_user_stats_data`
WHERE
$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 = SQL_QUERY_ESC("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?
$result_total = SQL_QUERY_ESC("SELECT
d.id, d.userid, d.points, d.remote_ip, d.timemark
FROM
- `{?_MYSQL_PREFIX?}_doubler` AS d
+ `{?_MYSQL_PREFIX?}_doubler` AS `d`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS u
+ `{?_MYSQL_PREFIX?}_user_data` AS `u`
ON
- d.`userid`=u.`userid`
+ `d`.`userid`=`u`.`userid`
WHERE
- u.`status`='CONFIRMED'
+ `u`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . " AND
- d.`points` <= %s AND
- d.`points` >= ({?doubler_min?} * 2) AND
- d.`completed`='N' AND
- d.`is_ref`='N'
+ `d`.`points` <= %s AND
+ `d`.`points` >= ({?doubler_min?} * 2) AND
+ `d`.`completed`='N' AND
+ `d`.`is_ref`='N'
ORDER BY
- d.`timemark` ASC",
+ `d`.`timemark` ASC",
array(
$DOUBLER_POINTS
), __FILE__, __LINE__);
// Check for accounts with limitation
$result_main = SQL_QUERY_ESC("SELECT
- d.`id`,
- d.`userid`,
- d.`points`,
- d.`remote_ip`,
- d.`timemark`
+ `d`.`id`,
+ `d`.`userid`,
+ `d`.`points`,
+ `d`.`remote_ip`,
+ `d`.`timemark`
FROM
- `{?_MYSQL_PREFIX?}_doubler` AS d
+ `{?_MYSQL_PREFIX?}_doubler` AS `d`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS u
+ `{?_MYSQL_PREFIX?}_user_data` AS `u`
ON
- d.`userid`=u.`userid`
+ `d`.`userid`=`u`.`userid`
WHERE
- u.`status`='CONFIRMED'
+ `u`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . " AND
- d.`points` <= %s AND
- d.`points` >= ({?doubler_min?} * 2) AND
- d.`completed`='N' AND
- d.`is_ref`='N'
+ `d`.`points` <= %s AND
+ `d`.`points` >= ({?doubler_min?} * 2) AND
+ `d`.`completed`='N' AND
+ `d`.`is_ref`='N'
ORDER BY
- d.`timemark` ASC
+ `d`.`timemark` ASC
LIMIT {?doubler_max_sent?}",
array(
$DOUBLER_POINTS
} else {
// Load all assigned mails
$result = SQL_QUERY("SELECT
- m.`id`,
- m.`admin_id`,
- a.`login`,
- m.`mail_template`
+ `m`.`id`,
+ `m`.`admin_id`,
+ `a`.`login`,
+ `m`.`mail_template`
FROM
`{?_MYSQL_PREFIX?}_admins_mails` AS `m`
LEFT JOIN
`{?_MYSQL_PREFIX?}_admins` AS `a`
ON
- m.`admin_id`=a.`id`
+ `m`.`admin_id`=`a`.`id`
WHERE
- (m.`admin_id`=a.`id` OR m.`admin_id` < 1) AND m.`mail_template` != ''
+ (`m`.`admin_id`=`a`.`id` OR `m`.`admin_id` < 1) AND `m`.`mail_template` != ''
ORDER BY
- m.`admin_id` ASC,
- m.`mail_template` ASC", __FILE__, __LINE__);
+ `m`.`admin_id` ASC,
+ `m`.`mail_template` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Shall I change entries?
// Query again...
$result = SQL_QUERY("SELECT
- m.id, m.admin_id, a.login, m.mail_template
+ `m`.`id`,
+ `m`.`admin_id`,
+ `a`.`login`,
+ `m`.`mail_template`
FROM
- `{?_MYSQL_PREFIX?}_admins_mails` AS m
+ `{?_MYSQL_PREFIX?}_admins_mails` AS `m`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_admins` AS a
+ `{?_MYSQL_PREFIX?}_admins` AS `a`
ON
- m.admin_id=a.id
+ `m`.`admin_id`=`a`.`id`
WHERE
- (m.admin_id=a.id OR m.admin_id < 1) AND m.mail_template != ''
+ (`m`.`admin_id`=`a`.`id` OR `m`.`admin_id` < 1) AND `m`.`mail_template` != ''
ORDER BY
- m.admin_id ASC,
- m.mail_template ASC", __FILE__, __LINE__);
+ `m`.`admin_id` ASC,
+ `m`.`mail_template` ASC", __FILE__, __LINE__);
} // END - if
// List found entries
if (isGetRequestElementSet('network_type_id')) {
// Load data for given network
$result = SQL_QUERY_ESC('SELECT
- t.`network_id`,
- t.`network_type_id`,
- t.`network_type_handler`,
- t.`network_type_reload_time_unit`,
- d.`network_active`,
+ `t`.`network_id`,
+ `t`.`network_type_id`,
+ `t`.`network_type_handler`,
+ `t`.`network_type_reload_time_unit`,
+ `d`.`network_active`,
NULL AS `network_data_id`,
NULL AS `network_max_reload_time`,
NULL AS `network_min_waiting_time`,
NULL AS `network_media_size`,
NULL AS `network_media_output`
FROM
- `{?_MYSQL_PREFIX?}_network_types` AS t
+ `{?_MYSQL_PREFIX?}_network_types` AS `t`
INNER JOIN
- `{?_MYSQL_PREFIX?}_network_data` AS d
+ `{?_MYSQL_PREFIX?}_network_data` AS `d`
ON
d.network_id=t.network_id
WHERE
- t.`network_id`=%s AND
- t.`network_type_id`=%s
+ `t`.`network_id`=%s AND
+ `t`.`network_type_id`=%s
LIMIT 1',
array(
bigintval(getRequestElement('network_id')),
// Fetch right stats_id from pool
$result_pool = SQL_QUERY_ESC("SELECT
- s.id
+ s.`id`
FROM
- `{?_MYSQL_PREFIX?}_user_stats` AS s
+ `{?_MYSQL_PREFIX?}_user_stats` AS `s`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_pool` AS p
+ `{?_MYSQL_PREFIX?}_pool` AS `p`
ON
- s.pool_id=p.id
+ s.`pool_id`=`p`.`id`
WHERE
s.`pool_id`=%s
LIMIT 1",
if (isExtensionActive('beg')) $userExclusionSql .= ' AND d.userid != {?beg_userid?}';
if (isExtensionActive('bonus')) $userExclusionSql .= ' AND d.userid != {?bonus_userid?}';
if (isExtensionActive('doubler')) $userExclusionSql .= ' AND d.userid != {?doubler_userid?}';
-if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $userExclusionSql .= " AND d.`holiday_active`='N'";
+if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $userExclusionSql .= " AND `d`.`holiday_active`='N'";
// Check for all accounts
$result = SQL_QUERY("SELECT
- d.`userid`,
- d.`gender`,
- d.`surname`,
- d.`family`,
- d.`email`,
- d.`joined`,
- d.`last_online`,
- d.`ap_notified`
+ `d`.`userid`,
+ `d`.`gender`,
+ `d`.`surname`,
+ `d`.`family`,
+ `d`.`email`,
+ `d`.`joined`,
+ `d`.`last_online`,
+ `d`.`ap_notified`
FROM
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
WHERE
- d.`status`='CONFIRMED' AND
- (UNIX_TIMESTAMP() - d.`joined`) >= {?ap_inactive_since?} AND
- (UNIX_TIMESTAMP() - d.`last_online`) >= {?ap_inactive_since?} AND
- (UNIX_TIMESTAMP() - d.`ap_notified`) >= {?ap_inactive_since?}
+ `d`.`status`='CONFIRMED' AND
+ (UNIX_TIMESTAMP() - `d`.`joined`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `d`.`last_online`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `d`.`ap_notified`) >= {?ap_inactive_since?}
" . $userExclusionSql . "
ORDER BY
- d.`userid` ASC", __FILE__, __LINE__);
+ `d`.`userid` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Ok, we have found some inactive accounts
if (isGetRequestElementSet('coupon_id')) {
// List userids for given coupon
$result = SQL_QUERY_ESC('SELECT
- u.`coupon_id`,
- u.`userid`,
- UNIX_TIMESTAMP(u.`cashed_on`) AS `cashed_on`,
- UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
- UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
- d.`points`,
- d.`total_created`,
- d.`total_cashed`,
- d.`coupon_description`
+ `u`.`coupon_id`,
+ `u`.`userid`,
+ UNIX_TIMESTAMP(`u`.`cashed_on`) AS `cashed_on`,
+ UNIX_TIMESTAMP(`d`.`coupon_created`) AS `coupon_created`,
+ UNIX_TIMESTAMP(`d`.`coupon_expired`) AS `coupon_expired`,
+ `d`.`points`,
+ `d`.`total_created`,
+ `d`.`total_cashed`,
+ `d`.`coupon_description`
FROM
- `{?_MYSQL_PREFIX?}_user_coupons` AS u
+ `{?_MYSQL_PREFIX?}_user_coupons` AS `u`
INNER JOIN
- `{?_MYSQL_PREFIX?}_coupon_data` AS d
+ `{?_MYSQL_PREFIX?}_coupon_data` AS `d`
ON
- u.`coupon_id`=d.`id`
+ `u`.`coupon_id`=`d`.`id`
WHERE
- u.`coupon_id`=%s
+ `u`.`coupon_id`=%s
ORDER BY
- u.`cashed_on` DESC',
+ `u`.`cashed_on` DESC',
array(
bigintval(getRequestElement('coupon_id'))
), __FILE__, __LINE__);
} else {
// Check if the user has cashed coupons
$result = SQL_QUERY('SELECT
- d.`id` AS `coupon_id`,
- UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
- UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
- d.`points`,
- d.`total_created`,
- d.`total_cashed`,
- d.`coupon_description`
+ `d`.`id` AS `coupon_id`,
+ UNIX_TIMESTAMP(`d`.`coupon_created`) AS `coupon_created`,
+ UNIX_TIMESTAMP(`d`.`coupon_expired`) AS `coupon_expired`,
+ `d`.`points`,
+ `d`.`total_created`,
+ `d`.`total_cashed`,
+ `d`.`coupon_description`
FROM
- `{?_MYSQL_PREFIX?}_coupon_data` AS d
+ `{?_MYSQL_PREFIX?}_coupon_data` AS `d`
ORDER BY
- d.`id` ASC', __FILE__, __LINE__);
+ `d`.`id` ASC', __FILE__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
h.`holiday_start`,
h.`holiday_end`,
h.`comments`,
- d.`status`,
- d.`last_online`
+ `d`.`status`,
+ `d`.`last_online`
FROM
`{?_MYSQL_PREFIX?}_user_holidays` AS `h`
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- h.`userid`=d.`userid`
+ h.`userid`=`d`.`userid`
ORDER BY
h.`userid` ASC", __FILE__, __LINE__);
$ADD = '';
if ((isPostRequestElementSet('network_type_id')) && (!is_array(postRequestElement('network_type_id')))) {
// Only show from current type handler
- $ADD = sprintf(" AND p.`network_type_id`=%s", bigintval(postRequestElement('network_type_id')));
+ $ADD = sprintf(" AND `p`.`network_type_id`=%s", bigintval(postRequestElement('network_type_id')));
// Overwrite type id
$networkData['network_type_id'] = bigintval(postRequestElement('network_type_id'));
// Load all advert types for given network
$result = SQL_QUERY_ESC("SELECT
- p.`network_request_param_id`,
- t.`network_type_id`,
- t.`network_type_handler`,
- p.`network_request_param_key`,
- p.`network_request_param_value`,
- p.`network_request_param_default`
+ `p`.`network_request_param_id`,
+ `t`.`network_type_id`,
+ `t`.`network_type_handler`,
+ `p`.`network_request_param_key`,
+ `p`.`network_request_param_value`,
+ `p`.`network_request_param_default`
FROM
- `{?_MYSQL_PREFIX?}_network_request_params` AS p
+ `{?_MYSQL_PREFIX?}_network_request_params` AS `p`
INNER JOIN
- `{?_MYSQL_PREFIX?}_network_types` AS t
+ `{?_MYSQL_PREFIX?}_network_types` AS `t`
ON
- p.`network_type_id`=t.`network_type_id`
+ `p`.`network_type_id`=`t`.`network_type_id`
WHERE
- p.`network_id`=%s" . $ADD . "
+ `p`.`network_id`=%s" . $ADD . "
ORDER BY
- t.`network_type_handler` ASC,
- p.`network_request_param_id` ASC",
+ `t`.`network_type_handler` ASC,
+ `p`.`network_request_param_id` ASC",
array(bigintval(getRequestElement('network_id'))), __FILE__, __LINE__);
// Are there entries?
} else {
// No rallye selected so display all available without prices
$result = SQL_QUERY("SELECT
- d.id AS `rallye_id`,
- d.admin_id,
- d.start_time,
- d.end_time,
- d.title,
- a.login,
- d.is_active
+ `d`.`id` AS `rallye_id`,
+ `d`.`admin_id`,
+ `d`.`start_time`,
+ `d`.`end_time`,
+ `d`.`title`,
+ `a`.`login`,
+ `d`.`is_active`
FROM
- `{?_MYSQL_PREFIX?}_rallye_data` AS d
+ `{?_MYSQL_PREFIX?}_rallye_data` AS `d`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_admins` AS a
+ `{?_MYSQL_PREFIX?}_admins` AS `a`
ON
- d.admin_id=a.id
+ `d`.`admin_id`=`a`.`id`
ORDER BY
- d.start_time DESC", __FILE__, __LINE__);
+ `d`.`start_time` DESC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// List found rallyes
$OUT = '';
if (isGetRequestElementSet('mid')) {
// SQL query for mail data
$sql = sprintf("SELECT
- s.`id`, p.`sender`, p.`subject`, p.`text`, p.`url`, p.`timestamp`, s.`max_rec`
+ s.`id`,
+ `p`.`sender`,
+ `p`.`subject`,
+ `p`.`text`,
+ `p`.`url`,
+ `p`.`timestamp`,
+ s.`max_rec`
FROM
- `{?_MYSQL_PREFIX?}_pool` AS p
+ `{?_MYSQL_PREFIX?}_pool` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_stats` AS s
+ `{?_MYSQL_PREFIX?}_user_stats` AS `s`
ON
- p.id=s.pool_id
+ `p`.`id`=s.`pool_id`
WHERE
- p.`id`=%s
+ `p`.`id`=%s
LIMIT 1",
bigintval(getRequestElement('mid'))
);
// accounts. So if you have delete one you did not see those links
$result = SQL_QUERY_ESC("SELECT
l.`userid`,
- u.`status`,
- u.`surname`,
- u.`family`,
- u.`gender`,
- u.`email`
+ `u`.`status`,
+ `u`.`surname`,
+ `u`.`family`,
+ `u`.`gender`,
+ `u`.`email`
FROM
`{?_MYSQL_PREFIX?}_user_links` AS `l`
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `u`
ON
- l.`userid`=u.`userid`
+ l.`userid`=`u`.`userid`
WHERE
l.`%s`=%s
ORDER BY
$sql = '';
foreach (runFilterChain('locked_points_columns_array', array('points')) as $column) {
// Add it with/-out locked
- $sql .= 'p.`' . $column . '` + p.`locked_' . $column . '` +';
+ $sql .= '`p`.`' . $column . '` + `p`.`locked_' . $column . '` +';
} // END - foreach
// Remove last plus
// Run the query to obtain all user's amounts (regardless of their status)
$result = SQL_QUERY('SELECT
- p.`userid`,
+ `p`.`userid`,
SUM(
' . $sql . ' -
- d.`used_points`
+ `d`.`used_points`
) AS `points`
FROM
`{?_MYSQL_PREFIX?}_user_points` AS `p`
INNER JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- d.`userid`=p.`userid`
+ `d`.`userid`=`p`.`userid`
GROUP BY
- p.`userid`
+ `p`.`userid`
ORDER BY
- p.`userid` ASC', __FILE__, __LINE__);
+ `p`.`userid` ASC', __FILE__, __LINE__);
// Are there entries? (sorry, the XML functions cannot "produce" the above SQL statement)
if (!SQL_HASZERONUMS($result)) {
// Check for open payments and close them
$result = SQL_QUERY_ESC("SELECT
- so.admin_id, so.pay_count,
- UNIX_TIMESTAMP(so.pay_ordered) AS `pay_ordered`,
- so.pay_status, sp.pay_name, sp.pay_rate, sp.pay_currency
+ `so`.`admin_id`,
+ `so`.`pay_count`,
+ UNIX_TIMESTAMP(`so`.`pay_ordered`) AS `pay_ordered`,
+ `so`.`pay_status`,
+ `sp`.`pay_name`,
+ `sp`.`pay_rate`,
+ `sp`.`pay_currency`
FROM
- `{?_MYSQL_PREFIX?}_sponsor_orders` AS so
+ `{?_MYSQL_PREFIX?}_sponsor_orders` AS `so`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_sponsor_paytypes` AS sp
+ `{?_MYSQL_PREFIX?}_sponsor_paytypes` AS `sp`
ON
- sp.id=so.payment_id
+ `sp`.`id`=`so`.`payment_id`
WHERE
- so.sponsor_id=%s
+ `so`.`sponsor_id`=%s
ORDER BY
- sp.pay_name ASC",
+ `sp`.`pay_name` ASC",
array($content['id']), __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Payment does exist
// Total referral link clicks, total logins
$result = SQL_QUERY('SELECT
- SUM(d.`ref_clicks`) AS `total_ref_clicks`,
- SUM(d.`total_logins`) AS `total_logins`
+ SUM(`d`.`ref_clicks`) AS `total_ref_clicks`,
+ SUM(`d`.`total_logins`) AS `total_logins`
FROM
`{?_MYSQL_PREFIX?}_user_data` AS `d`
' . runFilterChain('user_exclusion_sql', ''), __FILE__, __LINE__);
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- h.`userid`=d.`userid`
+ h.`userid`=`d`.`userid`
WHERE
- d.`holiday_active`='Y'
+ `d`.`holiday_active`='Y'
" . runFilterChain('user_exclusion_sql', ' '),
__FILE__, __LINE__);
list($holiday) = SQL_FETCHROW($result);
if (isExtensionActive('transfer')) {
// Statistics for points transfers
$result = SQL_QUERY("SELECT
- COUNT(t.`id`) AS `cnt`,
- SUM(t.`points`) AS `points`
+ COUNT(`t`.`id`) AS `cnt`,
+ SUM(`t`.`points`) AS `points`
FROM
`{?_MYSQL_PREFIX?}_user_transfers_in` AS `t`
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- t.`userid`=d.`userid`
+ `t`.`userid`=`d`.`userid`
" . runFilterChain('user_exclusion_sql', ''),
__FILE__, __LINE__);
list($count_in, $points_in) = SQL_FETCHROW($result);
if (empty($points_in)) $points_in = '0';
$result = SQL_QUERY("SELECT
- COUNT(t.`id`) AS `cnt`, SUM(t.`points`) AS `points`
+ COUNT(`t`.`id`) AS `cnt`, SUM(`t`.`points`) AS `points`
FROM
`{?_MYSQL_PREFIX?}_user_transfers_out` AS `t`
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
- t.userid=d.userid
+ `t`.`userid`=`d`.`userid`
" . runFilterChain('user_exclusion_sql', ''),
__FILE__, __LINE__);
list($count_out, $points_out) = SQL_FETCHROW($result);
outputHtml('<div align="center">');
// Check for possible running rallyes
-$ADD = " AND d.`is_active`='Y'";
+$ADD = " AND `d`.`is_active`='Y'";
if (isAdmin()) $ADD = '';
$result = SQL_QUERY("SELECT
- d.`id`,
- d.`admin_id`,
- a.`login`,
- d.`title`,
- d.`descr`,
- d.`template`,
- d.`start_time`,
- d.`end_time`,
- d.`min_users`,
- d.`min_prices`
+ `d`.`id`,
+ `d`.`admin_id`,
+ `a`.`login`,
+ `d`.`title`,
+ `d`.`descr`,
+ `d`.`template`,
+ `d`.`start_time`,
+ `d`.`end_time`,
+ `d`.`min_users`,
+ `d`.`min_prices`
FROM
- `{?_MYSQL_PREFIX?}_rallye_data` AS d
+ `{?_MYSQL_PREFIX?}_rallye_data` AS `d`
INNER JOIN
- `{?_MYSQL_PREFIX?}_admins` AS a
+ `{?_MYSQL_PREFIX?}_admins` AS `a`
ON
- d.`admin_id`=a.`id`
+ `d`.`admin_id`=`a`.`id`
WHERE
- d.`notified`='Y'
+ `d`.`notified`='Y'
" . $ADD . "
ORDER BY
- d.`end_time` ASC
+ `d`.`end_time` ASC
LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load all sponsor actions
$result_act = SQL_QUERY("SELECT
- m.title AS `conv_title`, c.conv_rate, c.conv_name
+ `m`.`title` AS `conv_title`,
+ `c`.`conv_rate`,
+ `c`.`conv_name`
FROM
- `{?_MYSQL_PREFIX?}_sponsor_menu` AS m
+ `{?_MYSQL_PREFIX?}_sponsor_menu` AS `m`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_sponsor_action_convert` AS c
+ `{?_MYSQL_PREFIX?}_sponsor_action_convert` AS `c`
ON
- m.what=c.ext_name
+ `m`.`what`=`c`.`ext_name`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_sponsor_registry` AS r
+ `{?_MYSQL_PREFIX?}_sponsor_registry` AS `r`
ON
- m.what=r.ext_name
+ `m`.`what`=`r`.`ext_name`
WHERE
- m.`action`='actions' AND
- r.is_active='Y'
+ `m`.`action`='actions' AND
+ `r`.`is_active`='Y'
ORDER BY
- m.sort ASC", __FILE__, __LINE__);
+ `m`.`sort` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result_act)) {
// Load all actions
// TOP earners
$result = SQL_QUERY("SELECT
- d.`userid`,
- SUM(p.`points` + p.`locked_points`) AS `points`,
- d.`last_online`
+ `d`.`userid`,
+ SUM(`p`.`points` + `p`.`locked_points`) AS `points`,
+ `d`.`last_online`
FROM
`{?_MYSQL_PREFIX?}_user_data` AS `d`
LEFT JOIN
{?_MYSQL_PREFIX?}_user_points AS `p`
ON
- p.`userid`=d.`userid`
+ `p`.`userid`=`d`.`userid`
WHERE
- p.`points` > 0 AND
- d.`status`='CONFIRMED'
+ `p`.`points` > 0 AND
+ `d`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . "
GROUP BY
- p.`userid`
+ `p`.`userid`
ORDER BY
`points` DESC,
- d.`last_online` DESC
+ `d`.`last_online` DESC
LIMIT {?top10_max?}", __FILE__, __LINE__);
$OUT = ''; $count = 1;
// TOP referral "hunter"
$result = SQL_QUERY("SELECT
- d.`userid`,
- SUM(r.`counter`) AS `refs`,
- d.`last_online`
+ `d`.`userid`,
+ SUM(`r`.`counter`) AS `refs`,
+ `d`.`last_online`
FROM
`{?_MYSQL_PREFIX?}_user_data` AS `d`
LEFT JOIN
{?_MYSQL_PREFIX?}_refsystem AS `r`
ON
- r.`userid`=d.`userid`
+ `r`.`userid`=`d`.`userid`
WHERE
- r.`counter` > 0 AND
- d.`status`='CONFIRMED'
+ `r`.`counter` > 0 AND
+ `d`.`status`='CONFIRMED'
" . runFilterChain('user_exclusion_sql', ' ') . "
GROUP BY
- r.`userid`
+ `r`.`userid`
ORDER BY
`refs` DESC,
- d.`last_online` DESC
+ `d`.`last_online` DESC
LIMIT {?top10_max?}", __FILE__, __LINE__);
$OUT = ''; $count = 1;
// Check for all earnings
$result = SQL_QUERY('SELECT
- d.`earning_id`,
- d.`earning_group`,
- d.`earning_provider`
+ `d`.`earning_id`,
+ `d`.`earning_group`,
+ `d`.`earning_provider`
FROM
- `{?_MYSQL_PREFIX?}_earning_data` AS d
+ `{?_MYSQL_PREFIX?}_earning_data` AS `d`
ORDER BY
- d.`earning_sorting` ASC', __FILE__, __LINE__);
+ `d`.`earning_sorting` ASC', __FILE__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
while ($content = SQL_FETCHARRAY($result)) {
// Load user_earning data
$result2 = SQL_QUERY_ESC('SELECT
- u.`earning_active`,
- UNIX_TIMESTAMP(u.`earning_added`) AS `earning_added`,
- UNIX_TIMESTAMP(u.`earning_canceled`) AS `earning_canceled`,
- u.`earning_daily_amount`,
- u.`earning_points`
+ `u`.`earning_active`,
+ UNIX_TIMESTAMP(`u`.`earning_added`) AS `earning_added`,
+ UNIX_TIMESTAMP(`u`.`earning_canceled`) AS `earning_canceled`,
+ `u`.`earning_daily_amount`,
+ `u`.`earning_points`
FROM
- `{?_MYSQL_PREFIX?}_user_earning` AS u
+ `{?_MYSQL_PREFIX?}_user_earning` AS `u`
WHERE
- u.`earning_id`=%s AND
- u.`earning_userid`=%s
+ `u`.`earning_id`=%s AND
+ `u`.`earning_userid`=%s
LIMIT 1',
array(
bigintval($content['earning_id']),
// Check if the user has cashed coupons
$result = SQL_QUERY_ESC("SELECT
- UNIX_TIMESTAMP(u.`cashed_on`) AS `cashed_on`,
- UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
- UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
- d.`points`,
- d.`total_created`,
- d.`total_cashed`,
- d.`coupon_description`
+ UNIX_TIMESTAMP(`u`.`cashed_on`) AS `cashed_on`,
+ UNIX_TIMESTAMP(`d`.`coupon_created`) AS `coupon_created`,
+ UNIX_TIMESTAMP(`d`.`coupon_expired`) AS `coupon_expired`,
+ `d`.`points`,
+ `d`.`total_created`,
+ `d`.`total_cashed`,
+ `d`.`coupon_description`
FROM
- `{?_MYSQL_PREFIX?}_user_coupons` AS u
+ `{?_MYSQL_PREFIX?}_user_coupons` AS `u`
INNER JOIN
- `{?_MYSQL_PREFIX?}_coupon_data` AS d
+ `{?_MYSQL_PREFIX?}_coupon_data` AS `d`
ON
- u.`coupon_id`=d.`id`
+ `u`.`coupon_id`=`d`.`id`
WHERE
- u.`userid`=%s AND
- u.`coupon_code` IS NULL AND
- u.`cashed_on` IS NOT NULL
+ `u`.`userid`=%s AND
+ `u`.`coupon_code` IS NULL AND
+ `u`.`cashed_on` IS NOT NULL
ORDER BY
- u.`cashed_on` DESC", array(getMemberId()), __FILE__, __LINE__);
+ `u`.`cashed_on` DESC", array(getMemberId()), __FILE__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
$result = SQL_QUERY_ESC("SELECT
`c`.`userid`
FROM
- `{?_MYSQL_PREFIX?}_user_cats` AS c
+ `{?_MYSQL_PREFIX?}_user_cats` AS `c`
INNER JOIN
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
ON
`c`.`userid`=`d`.`userid`
WHERE
$result_holiday = SQL_QUERY_ESC("SELECT
COUNT(`d`.`userid`) AS `cnt`
FROM
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_user_holidays` AS h
+ `{?_MYSQL_PREFIX?}_user_holidays` AS `h`
ON
`d`.`userid`=`h`.`userid`
WHERE
// Check for his payouts
$result_payouts = SQL_QUERY_ESC("SELECT
- p.`id`,
- p.`payout_total`,
- p.`target_account`,
- p.`target_bank`,
- t.`type`,
- p.`payout_timestamp`,
- p.`status`,
- t.`allow_url` AS `allow`,
- p.`target_url` AS `url`,
- p.`link_text`,
- p.`banner_url` AS `banner`
+ `p`.`id`,
+ `p`.`payout_total`,
+ `p`.`target_account`,
+ `p`.`target_bank`,
+ `t`.`type`,
+ `p`.`payout_timestamp`,
+ `p`.`status`,
+ `t`.`allow_url` AS `allow`,
+ `p`.`target_url` AS `url`,
+ `p`.`link_text`,
+ `p`.`banner_url` AS `banner`
FROM
`{?_MYSQL_PREFIX?}_user_payouts` AS `p`
LEFT JOIN
`{?_MYSQL_PREFIX?}_payout_types` AS `t`
ON
- p.`payout_id` = t.`id`
+ `p`.`payout_id`=`t`.`id`
WHERE
- p.`userid` = %s
+ `p`.`userid`=%s
ORDER BY
- p.`payout_timestamp` DESC",
+ `p`.`payout_timestamp` DESC",
array(getMemberId()), __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result_payouts)) {
// List all his requests
}
} else {
// Chedk if he can get paid by selected type
- $result = SQL_QUERY_ESC("SELECT `type`, `rate`, `min_points`, `allow_url` AS allow FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE `id`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `type`, `rate`, `min_points`, `allow_url` AS `allow` FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('payout'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
$content = merge_array($content, $data);
// Default for referral level > 0
- $depth = 'p.`ref_depth`=%s';
+ $depth = '`p`.`ref_depth`=%s';
if (is_null($content['level'])) {
- $depth = 'p.`ref_depth` IS NULL';
+ $depth = '`p`.`ref_depth` IS NULL';
} // END - if
// Load referral points
$result_points = SQL_QUERY_ESC('SELECT
' . getAllPointColumns('p.', ',') . '
- r.`counter`
+ `r`.`counter`
FROM
- `{?_MYSQL_PREFIX?}_user_points` AS p
+ `{?_MYSQL_PREFIX?}_user_points` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_refsystem` AS r
+ `{?_MYSQL_PREFIX?}_refsystem` AS `r`
ON
- p.`userid`=r.`userid` AND
- p.`ref_depth`=r.`level`
+ `p`.`userid`=`r`.`userid` AND
+ `p`.`ref_depth`=`r`.`level`
WHERE
- p.`userid`=%s AND
+ `p`.`userid`=%s AND
' . $depth . '
LIMIT 1',
array(
} // END - if
// Check for possible running rallyes
-$ADD = " AND d.`is_active`='Y'";
+$ADD = " AND `d`.`is_active`='Y'";
if (isAdmin()) $ADD = '';
$result = SQL_QUERY("SELECT
- d.`id`,
- d.`admin_id`,
- a.`login`,
- d.`title`,
- d.`descr`,
- d.`template`,
- d.`start_time`,
- d.`end_time`,
- d.`min_users`,
- d.`min_prices`
+ `d`.`id`,
+ `d`.`admin_id`,
+ `a`.`login`,
+ `d`.`title`,
+ `d`.`descr`,
+ `d`.`template`,
+ `d`.`start_time`,
+ `d`.`end_time`,
+ `d`.`min_users`,
+ `d`.`min_prices`
FROM
- `{?_MYSQL_PREFIX?}_rallye_data` AS d
+ `{?_MYSQL_PREFIX?}_rallye_data` AS `d`
INNER JOIN
- `{?_MYSQL_PREFIX?}_admins` AS a
+ `{?_MYSQL_PREFIX?}_admins` AS `a`
ON
- d.`admin_id`=a.`id`
+ `d`.`admin_id`=`a`.`id`
WHERE
- d.`notified`='Y'
+ `d`.`notified`='Y'
" . $ADD . "
ORDER BY
- d.`end_time` ASC
+ `d`.`end_time` ASC
LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load all referral levels
$result = SQL_QUERY('SELECT
- r.`level`,
- r.`percents`
+ `r`.`level`,
+ `r`.`percents`
FROM
- `{?_MYSQL_PREFIX?}_refdepths` AS r
+ `{?_MYSQL_PREFIX?}_refdepths` AS `r`
WHERE
- r.level > 0
+ `r`.`level` > 0
ORDER BY
- r.level ASC', __FILE__, __LINE__);
+ `r`.`level` ASC', __FILE__, __LINE__);
// Are there some entries? (Shall be!)
if (!SQL_HASZERONUMS($result)) {
$nothingMessage = '';
switch ($mode) {
case 'list_in':
- $sql = 'SELECT `trans_id`, `from_userid` AS party_userid,`points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
+ $sql = 'SELECT `trans_id`, `from_userid` AS `party_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
$nothingMessage = '{--MEMBER_TRANSFER_NO_INCOMING_TRANSFERS--}';
$content['balance'] = '{--MEMBER_TRANSFER_TOTAL_INCOMING--}';
$content['title'] = '{--MEMBER_LIST_INCOMING_TRANSFER_TITLE--}';
break;
case 'list_out':
- $sql = 'SELECT `trans_id`, `to_userid` AS party_userid,`points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
+ $sql = 'SELECT `trans_id`, `to_userid` AS `party_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
$nothingMessage = '{--MEMBER_TRANSFER_NO_OUTGOING_TRANSFERS--}';
$content['balance'] = '{--TRANSFER_TOTAL_OUTGOING--}';
$content['title'] = '{--MEMBER_LIST_OUTGOING_TRANSFER_TITLE--}';
$result_data = SQL_QUERY_ESC("SELECT
s.`id`,
s.`subject`,
- p.`text`,
+ `p`.`text`,
s.`timestamp_ordered` AS `timestamp`,
s.`cat_id`,
pay.`price` AS `points`,
- p.`sender`,
+ `p`.`sender`,
pay.`time`,
- p.`data_type`
+ `p`.`data_type`
FROM
`{?_MYSQL_PREFIX?}_user_stats` AS `s`
LEFT JOIN
LEFT JOIN
`{?_MYSQL_PREFIX?}_payments` AS `pay`
ON
- p.`payment_id`=pay.`id`
+ `p`.`payment_id`=pay.`id`
WHERE
s.`id`=%s
LIMIT 1",
s.`timestamp_ordered` AS `timestamp`,
s.`cat_id`,
s.`payment_id`,
- p.`sender`
+ `p`.`sender`
FROM
`{?_MYSQL_PREFIX?}_user_stats` AS `s`
LEFT JOIN
`{?_MYSQL_PREFIX?}_pool` AS `p`
ON
- s.`pool_id`=p.`id`
+ s.`pool_id`=`p`.`id`
WHERE
s.`id`=%s
LIMIT 1",
// Search for the points and user data
$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__);
// Category given?
if (isValidId($categoryId)) {
// Select category
- $extraColumns = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.`userid`=c.`userid`";
- $addWhere = sprintf(" AND c.`cat_id`=%s", $categoryId);
+ $extraColumns = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS `c` ON `d`.`userid`=`c`.`userid`";
+ $addWhere = sprintf(" AND `c`.`cat_id`=%s", $categoryId);
} // END - if
// Exclude users in holiday?
if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
// Add something for the holiday extension
- $addWhere .= " AND d.`holiday_active`='N'";
+ $addWhere .= " AND `d`.`holiday_active`='N'";
} // END - if
// Include only HTML recipients?
if ((isExtensionActive('html_mail')) && ($mode == 'html')) {
- $addWhere .= " AND d.`html`='Y'";
+ $addWhere .= " AND `d`.`html`='Y'";
} // END - if
// Run query
- $result = SQL_QUERY_ESC("SELECT d.`userid` FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$extraColumns." WHERE d.`status`='CONFIRMED' ".$addWhere." ORDER BY d.`{?order_select?}` {?order_mode?} LIMIT %s",
+ $result = SQL_QUERY_ESC("SELECT
+ `d`.`userid`
+FROM
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
+ " . $extraColumns . "
+WHERE
+ `d`.`status`='CONFIRMED'
+ " . $addWhere . "
+ORDER BY
+ `d`.`{?order_select?}` {?order_mode?}
+LIMIT %s",
array(
$receiver
), __FUNCTION__, __LINE__);
} // END - if
// Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
// Abort here
return FALSE;
} // END - if
// Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.
$result = SQL_QUERY('SELECT
- s.id, s.userid, s.pool_id, t.price
+ `s`.`id`,
+ `s`.`userid`,
+ `s`.`pool_id`,
+ `t`.`price`
FROM
- `{?_MYSQL_PREFIX?}_user_stats` AS s
+ `{?_MYSQL_PREFIX?}_user_stats` AS `s`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_payments` AS t
+ `{?_MYSQL_PREFIX?}_payments` AS `t`
ON
- s.`payment_id`=t.`id`
+ `s`.`payment_id`=`t`.`id`
WHERE
- (UNIX_TIMESTAMP() - s.`timestamp_ordered`) >= {?auto_purge?}
+ (UNIX_TIMESTAMP() - `s`.`timestamp_ordered`) >= {?auto_purge?}
ORDER BY
- s.userid ASC', __FILE__, __LINE__);
+ `s`.`userid` ASC', __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Start deleting procedure
$userid = NULL;
// Init SQLs
initSqls();
- // Init exclusion list
- // @TODO Rewrite these if() blocks to a filter
- $excludeUserids = '';
- if (isValidId(getDefRefid())) $excludeUserids .= ' AND `userid` != {?def_refid?}';
-
- // Check for more extensions
- if (isExtensionActive('beg')) $excludeUserids .= ' AND `userid` != {?beg_userid?}';
- if (isExtensionActive('bonus')) $excludeUserids .= ' AND `userid` != {?bonus_userid?}';
- if (isExtensionActive('doubler')) $excludeUserids .= ' AND `userid` != {?doubler_userid?}';
+ // Init userid exclusion
+ $excludeSql = '';
+ $excludedUserids = runFilterChain('config_userid_exclusion_sql', array());
+ if (count($excludedUserids) > 0) {
+ // Exclude all
+ $excludeSql = ' AND `userid` NOT IN (' . implode(', ', $excludedUserids) . ')';
+ } // END - if
// Check for new holiday extension
if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
// Include only users with no active holiday
- $excludeUserids .= " AND `holiday_active`='N'";
+ $excludeSql .= " AND `holiday_active`='N'";
} // END - if
// Check for all accounts
" . runFilterChain('user_exclusion_sql', ' ') . " AND
(UNIX_TIMESTAMP() - `joined`) >= {?ap_inactive_since?} AND
(UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?} AND
- (UNIX_TIMESTAMP() - `ap_notified`) >= {?ap_inactive_since?}
- " . $excludeUserids . "
+ (UNIX_TIMESTAMP() - `ap_notified`) >= {?ap_inactive_since?} AND
+ " . $excludeSql . "
ORDER BY
`userid` ASC", __FILE__, __LINE__);
(UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?} AND
(UNIX_TIMESTAMP() - `ap_notified`) >= {?ap_inactive_time?} AND
`ap_notified` > 0
-" . $excludeUserids . "
+ " . $excludeSql . "
ORDER BY
`userid` ASC", __FILE__, __LINE__);
} // END - if
// Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
// Abort here
return FALSE;
} // END - if
// Get refs from database
$result = SQL_QUERY_ESC('SELECT
- ur.`id`,
- ur.`refid`,
- ud.`status`,
- ud.`last_online`,
- ud.`mails_confirmed`,
- ud.`emails_received`,
- ud.`subid`
+ `ur`.`id`,
+ `ur`.`refid`,
+ `ud`.`status`,
+ `ud`.`last_online`,
+ `ud`.`mails_confirmed`,
+ `ud`.`emails_received`,
+ `ud`.`subid`
FROM
`{?_MYSQL_PREFIX?}_user_refs` AS `ur`
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_points` AS `up`
ON
- ur.`refid`=up.`userid` AND
- (ur.`level`=0 OR ur.`level` IS NULL)
+ `ur`.`refid`=`up`.`userid` AND
+ (`ur`.`level`=0 OR `ur`.`level` IS NULL)
LEFT JOIN
`{?_MYSQL_PREFIX?}_user_data` AS `ud`
ON
- ur.`refid`=ud.`userid`
+ `ur`.`refid`=`ud`.`userid`
WHERE
- ur.`userid`=%s AND
- ur.`level`=%s
+ `ur`.`userid`=%s AND
+ `ur`.`level`=%s
ORDER BY
- ur.`refid` ASC',
+ `ur`.`refid` ASC',
array(
bigintval($userid),
bigintval($level)
// Is the not level NULL?
if (!is_null($level)) {
// Then add referral level
- $add = ' AND r.`level`=' . bigintval($level);
+ $add = ' AND `r`.`level`=' . bigintval($level);
} // END - if
// Check for all referrals
$result = SQL_QUERY_ESC("SELECT
- COUNT(d.`userid`) AS `cnt`
+ COUNT(`d`.`userid`) AS `cnt`
FROM
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
INNER JOIN
- `{?_MYSQL_PREFIX?}_user_refs` AS r
+ `{?_MYSQL_PREFIX?}_user_refs` AS `r`
ON
- d.`userid`=r.`refid`
+ `d`.`userid`=`r`.`refid`
WHERE
- d.`status` != 'CONFIRMED' AND
- r.`userid`=%s
+ `d`.`status` != 'CONFIRMED' AND
+ `r`.`userid`=%s
" . $add . "
ORDER BY
- d.`userid` ASC
+ `d`.`userid` ASC
LIMIT 1",
array(
$userid
if (!empty($t)) {
// Check for data
$result = SQL_QUERY_ESC("SELECT
- d.`userid`,
- b.`level`,
- b.`points`
+ `d`.`userid`,
+ `b`.`level`,
+ `b`.`points`
FROM
- `{?_MYSQL_PREFIX?}_user_data` AS d
+ `{?_MYSQL_PREFIX?}_user_data` AS `d`
INNER JOIN
- `{?_MYSQL_PREFIX?}_bonus_turbo` AS b
+ `{?_MYSQL_PREFIX?}_bonus_turbo` AS `b`
ON
- d.`userid`=b.`userid`
+ `d`.`userid`=`b`.`userid`
WHERE
- d.`status`='CONFIRMED' AND
- d.`userid`=%s AND
- b.`%s`=%s
+ `d`.`status`='CONFIRMED' AND
+ `d`.`userid`=%s AND
+ `b`.`%s`=%s
LIMIT 1",
array(
bigintval(getRequestElement('userid')),