X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Frallye_functions.php;h=d38b61b2e6861a618e28497524bdd649c49d2369;hb=d016e24dd4686f613a17733b96bc28fac936a4ac;hp=cf06f007354efc5738e03a64088a0907d39cde21;hpb=f9355ef19837da4e8cb88e0d6c0febf082a1824d;p=mailer.git
diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php
index cf06f00735..d38b61b2e6 100644
--- a/inc/libs/rallye_functions.php
+++ b/inc/libs/rallye_functions.php
@@ -42,18 +42,18 @@ function RALLYE_AUTOSTART_RALLYES($result)
{
// Global data array for LOAD_EMAIL_TEMPLATE()
$DATA = array();
- global $DATA, $_CONFIG;
+ global $DATA;
// Load all rallyes (usally we have only one rallye active per time!
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Set notified to Y
- $result_notified = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_rallye_data SET notified='Y' WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET notified='Y' WHERE id=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
// Do a snapshot off all user refs
- $result_user = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
+ $result_user = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__);
// Transfer all neccessary data to the global $DATA array
$DATA['uid_cnt'] = SQL_NUMROWS($result_user);
@@ -65,7 +65,7 @@ function RALLYE_AUTOSTART_RALLYES($result)
if ($min_users == 0) {
// Rallye ends without user limitation
- $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION;
+ $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION');
} else {
// Rallye ends when X members are totally in your exchange
$DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
@@ -73,7 +73,7 @@ function RALLYE_AUTOSTART_RALLYES($result)
if ($min_prices == 0) {
// Rallye ends without user limitation
- $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION;
+ $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION');
} else {
// Rallye ends when X members are totally in your exchange
$DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
@@ -91,28 +91,28 @@ function RALLYE_AUTOSTART_RALLYES($result)
if (empty($cnt)) $cnt = 0; // Added prevent some unknown troubles... :-?
// Check if line is already included...
- $result_ref = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%s AND userid=%s LIMIT 1",
- array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
+ $result_ref = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s AND userid=%s LIMIT 1",
+ array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result_ref) == 0) {
// Free memory
SQL_FREERESULT($result_ref);
// Add userid and his ref count to table
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(p.points)
-FROM "._MYSQL_PREFIX."_user_points AS p
-LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
+FROM `{!_MYSQL_PREFIX!}_user_points` AS p
+LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
ON p.userid=d.userid
-WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s",
- array($_CONFIG['ref_payout'], bigintval($uid)), __FILE__, __LINE__);
+WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s",
+ array(getConfig('ref_payout'), bigintval($uid)), __FILE__, __LINE__);
list($cpoints) = SQL_FETCHROW($result_ref);
SQL_FREERESULT($result_ref);
if (empty($cpoints)) $cpoints = "0.00000";
// Add info line
- $result_ref = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_rallye_users (rallye_id, userid, refs, curr_points)
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_users` (rallye_id, userid, refs, curr_points)
VALUES ('%s','%s','%s','%s')",
- array(bigintval($id), bigintval($uid), bigintval($cnt), $cpoints), __FILE__, __LINE__);
+ array(bigintval($id), bigintval($uid), bigintval($cnt), $cpoints), __FILE__, __LINE__);
$un = true;
} // END - if
@@ -147,7 +147,7 @@ function RALLYE_ADD_PRICES($rallye,$mode="email")
}
// Load prices
- $result_prices = SQL_QUERY("SELECT price_level, points, info FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id='".$rallye."' ORDER BY price_level", __FILE__, __LINE__);
+ $result_prices = SQL_QUERY("SELECT price_level, points, info FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id='".$rallye."' ORDER BY price_level", __FILE__, __LINE__);
if (SQL_NUMROWS($result_prices) > 0)
{
// Load prices
@@ -184,17 +184,15 @@ function RALLYE_ADD_PRICES($rallye,$mode="email")
//
function RALLYE_ADD_TOPUSERS($rallye,$default=0)
{
- global $_CONFIG;
-
// 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",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
array(bigintval($rallye)), __FILE__, __LINE__);
$prices = SQL_NUMROWS($result);
SQL_FREERESULT($result);
// And load only limited users
- $result = SQL_QUERY_ESC("SELECT DISTINCT u.userid, u.refs, u.curr_points FROM "._MYSQL_PREFIX."_rallye_users AS u
-LEFT JOIN "._MYSQL_PREFIX."_refsystem AS r
+ $result = SQL_QUERY_ESC("SELECT DISTINCT u.userid, u.refs, u.curr_points FROM `{!_MYSQL_PREFIX!}_rallye_users` AS u
+LEFT JOIN `{!_MYSQL_PREFIX!}_refsystem` AS r
ON u.userid=r.userid
WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC",
array(bigintval($rallye)), __FILE__, __LINE__);
@@ -206,17 +204,17 @@ WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC",
'cpoints' => array()
);
- while(list($uid, $refs, $cpoints) = SQL_FETCHROW($result))
+ while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result))
{
// Get current refs
$cnt = RALLYE_GET_REFCOUNT($uid, $refs);
// 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
+ $result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM `{!_MYSQL_PREFIX!}_user_points` AS p
+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
-LIMIT 1", array(bigintval($uid), $_CONFIG['ref_payout']), __FILE__, __LINE__);
+WHERE d.userid=%s AND d.`status`='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s
+LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FILE__, __LINE__);
list($refpoints) = SQL_FETCHROW($result_ref);
SQL_FREERESULT($result_ref);
@@ -248,19 +246,19 @@ LIMIT 1", array(bigintval($uid), $_CONFIG['ref_payout']), __FILE__, __LINE__);
if (empty($DATA['uid'][$idx])) $DATA['uid'][$idx] = "---";
if (empty($DATA['ref'][$idx])) $DATA['ref'][$idx] = "---";
// Add row
- $OUT .= "