$ADMIN = " AND d.is_active='Y'";
if (IS_ADMIN()) $ADMIN = '';
-$result = SQL_QUERY("SELECT DISTINCT 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!}_admins` AS a
-WHERE d.admin_id=a.id".$ADMIN." AND d.notified='Y'
-ORDER BY d.end_time LIMIT 1", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT DISTINCT
+ 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
+INNER JOIN
+ `{!_MYSQL_PREFIX!}_admins` AS a
+ON
+ d.admin_id=a.id
+WHERE
+ d.notified='Y'".$ADMIN."
+ORDER BY
+ d.end_time
+LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Found some (normally one...
// Determine min_users
define('__RALLYE_MAX_USERS', RALLYE_DETERMINE_MIN_USERS($min_users));
- if ($min_prices == 0) {
- // Rallye ends without user limitation
- define('__RALLYE_MIN_PRICES', getMessage('RALLYE_END_NO_PRICE_LIMITATION'));
- } else {
- // Rallye ends when X members are totally in your exchange
- define('__RALLYE_MIN_PRICES', getMessage('RALLYE_END_PRICES_1') . ' ' . $min_prices . ' ' . getMessage('RALLYE_END_PRICES_2'));
- }
+ // Determine min prices (now in function)
+ define('__RALLYE_MIN_PRICES', RALLYE_DETERMINE_MIN_PRICES());
if ($expired === true) {
define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id));
}
// And load final template
- LOAD_TEMPLATE("guest_rallye_show");
+ LOAD_TEMPLATE('guest_rallye_show');
} else {
// No rallye found so far
- LOAD_TEMPLATE("guest_no_rallyes");
+ LOAD_TEMPLATE('guest_no_rallyes');
}
// Close the div tag
-OUTPUT_HTML("</div>");
+OUTPUT_HTML('</div>');
//
?>