From: Roland Häder Date: Sun, 26 Jul 2009 14:50:52 +0000 (+0000) Subject: Rewritten to use functions, query updated to a 'join' X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f123b06b1ce325b4956d9f3b9ac01c84bcc8d605;p=mailer.git Rewritten to use functions, query updated to a 'join' --- diff --git a/inc/modules/guest/what-rallyes.php b/inc/modules/guest/what-rallyes.php index afcb5b9913..c6a235ad38 100644 --- a/inc/modules/guest/what-rallyes.php +++ b/inc/modules/guest/what-rallyes.php @@ -55,10 +55,19 @@ OUTPUT_HTML("
"); $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... @@ -97,13 +106,8 @@ if (SQL_NUMROWS($result) == 1) { // 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)); @@ -116,14 +120,14 @@ if (SQL_NUMROWS($result) == 1) { } // 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("
"); +OUTPUT_HTML(''); // ?>