@@ -185,13+184,6 @@ function RALLYE_ADD_PRICES($rallye,$mode="email")
//
function RALLYE_ADD_TOPUSERS($rallye,$default=0)
{
- global $_CONFIG;
- // Init variable
- $since = 0;
- if (EXT_IS_ACTIVE("autopurge")) {
- $since = $_CONFIG['ap_inactive_since'];
- } // END - if
-
// First check how many prices are set
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level",
array(bigintval($rallye)), __FILE__, __LINE__);
@@ -219,20+211,19 @@ WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC",
// Points of ref's
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM "._MYSQL_PREFIX."_user_points AS p
-LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
+LEFT JOIN `"._MYSQL_PREFIX."_user_data` AS d
ON p.userid=d.userid
-WHERE d.userid=%s AND d.status='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s AND d.last_online >= (UNIX_TIMESTAMP() - %s)
@@ -488,7+474,7 @@ function RALLYE_LOAD_USER_DATA($uids_array)
$uid_string = implode(",", $uids_array['uid']);
// Load users
- $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid IN(%s) AND status='CONFIRMED' ORDER BY userid LIMIT %s",
+ $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid IN(%s) AND status='CONFIRMED' ORDER BY userid LIMIT %s",