2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 06/29/2004 *
4 * =================== Last change: 08/22/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-rallyes.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Ref rallyes *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Ref-Rallyes *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
46 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
47 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=rallye%}');
52 outputHtml('<div align="center">');
54 // Check for possible running rallyes
55 $ADD = " AND d.`is_active`='Y'";
56 if (isAdmin()) $ADD = '';
58 $result = SQL_QUERY("SELECT
70 `{?_MYSQL_PREFIX?}_rallye_data` AS d
72 `{?_MYSQL_PREFIX?}_admins` AS a
80 LIMIT 1", __FILE__, __LINE__);
82 if (SQL_NUMROWS($result) == 1) {
83 // Found some (normally one...
84 $content = SQL_FETCHARRAY($result);
87 if (($content['end_time'] < time()) && (getTotalConfirmedUser() >= $content['min_users']) && (getTotalRallyeWinners($content['id']) >= $content['min_prices'])) {
89 $content['extras'] = '{--RALLYE_HAS_EXPIRED--}';
91 } elseif (time() >= ($content['end_time'] - getOneDay())) {
92 // Rallye will expire in less one day!
93 $content['extras'] = '{--RALLYE_EXPIRE_ONE_DAY--}';
95 $content['extras'] = '<a href="{%url=modules.php?module=index&what=register%}">{--RALLYE_REGISTER_NOW--}</a>';
98 // Set admin line (currently set to impressum, later to contact form)
99 // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&what=impressum&id=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
101 // Handle description...
102 if ((empty($content['descr'])) && (!empty($content['template']))) {
103 // Use description from template
104 $content['descr'] = loadTemplate('rallye_' . $content['template'], TRUE);
107 // Set start and end time
108 $content['start_time'] = generateDateTime($content['start_time'], 1);
109 $content['end_time'] = generateDateTime($content['end_time'] , 1);
111 // Determine min_users
112 $content['min_users'] = determineReferralRallyeMinimumUsers($content['min_users']);
114 // Determine min prices (now in function)
115 $content['min_prices'] = determineReferralRallyeMinimumPrices($content['min_prices']);
117 if ($expired === TRUE) {
118 $content['prices'] = addReferralRallyeWinners('guest', $content['id']);
119 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
120 $content['can_win_this'] = '{--RALLYE_OUR_WINNERS_ARE--}';
122 $content['prices'] = addReferralRallyePrices($content['id'], 'html');
123 $content['top_users'] = addReferralRallyeTopUsers('guest', $content['id'], getMemberId());
124 $content['can_win_this'] = '{--RALLYE_YOU_CAN_WIN--}';
127 // And load final template
128 loadTemplate('guest_show_rallye', FALSE, $content);
130 // No rallye found so far
131 loadTemplate('guest_rallye_404');
135 outputHtml('</div>');