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 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
38 // Add description as navigation point
39 addYouAreHereLink('guest', __FILE__);
41 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
42 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=rallye%}');
47 outputHtml('<div align="center">');
49 // Check for possible running rallyes
50 $ADD = " AND `d`.`is_active`='Y'";
51 if (isAdmin()) $ADD = '';
53 $result = sqlQuery("SELECT
65 `{?_MYSQL_PREFIX?}_rallye_data` AS `d`
67 `{?_MYSQL_PREFIX?}_admins` AS `a`
69 `d`.`admin_id`=`a`.`id`
75 LIMIT 1", __FILE__, __LINE__);
77 if (sqlNumRows($result) == 1) {
78 // Found some (normally one...
79 $content = sqlFetchArray($result);
82 if (($content['end_time'] < time()) && (getTotalConfirmedUser() >= $content['min_users']) && (getTotalRallyeWinners($content['id']) >= $content['min_prices'])) {
84 $content['extras'] = '{--RALLYE_HAS_EXPIRED--}';
86 } elseif (time() >= ($content['end_time'] - getOneDay())) {
87 // Rallye will expire in less one day!
88 $content['extras'] = '{--RALLYE_EXPIRE_ONE_DAY--}';
90 $content['extras'] = '<a href="{%url=modules.php?module=index&what=register%}">{--RALLYE_REGISTER_NOW--}</a>';
93 // Set admin line (currently set to impressum, later to contact form)
94 // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&what=impressum&id=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
96 // Handle description...
97 if ((empty($content['descr'])) && (!empty($content['template']))) {
98 // Use description from template
99 $content['descr'] = '{%template,LoadTemplate=rallye_' . $content['template'] . '%}';
102 // Set start and end time
103 $content['start_time'] = generateDateTime($content['start_time'], 1);
104 $content['end_time'] = generateDateTime($content['end_time'] , 1);
106 if ($expired === TRUE) {
107 $content['prices'] = addReferralRallyeWinners('guest', $content['id']);
108 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
109 $content['can_win_this'] = '{--RALLYE_OUR_WINNERS_ARE--}';
111 $content['prices'] = addReferralRallyePrices($content['id'], 'html');
112 $content['top_users'] = addReferralRallyeTopUsers('guest', $content['id'], getMemberId());
113 $content['can_win_this'] = '{--RALLYE_YOU_CAN_WIN--}';
116 // And load final template
117 loadTemplate('guest_show_rallye', FALSE, $content);
119 // No rallye found so far
120 loadTemplate('guest_rallye_404');
124 outputHtml('</div>');