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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
45 // Add description as navigation point
46 addMenuDescription('guest', __FILE__);
48 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
49 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('rallye'));
54 outputHtml('<div align="center">');
56 // Check for possible running rallyes
57 $ADD = " AND d.is_active='Y'";
58 if (isAdmin()) $ADD = '';
60 $result = SQL_QUERY("SELECT
61 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
63 `{?_MYSQL_PREFIX?}_rallye_data` AS d
65 `{?_MYSQL_PREFIX?}_admins` AS a
69 d.notified='Y'" . $ADD . "
72 LIMIT 1", __FILE__, __LINE__);
74 if (SQL_NUMROWS($result) == 1) {
75 // Found some (normally one...
76 list($id, $adminId, $login, $title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
81 $content['extras'] = getMessage('RALLYE_HAS_EXPIRED');
83 } elseif (time() >= ($end - getConfig('ONE_DAY'))) {
84 // Rallye will expire in less one day!
85 $content['extras'] = getMessage('RALLYE_EXPIRE_ONE_DAY');
87 $content['extras'] = '<a href="{%url=modules.php?module=index&what=register%}">{--RALLYE_REGISTER_NOW--}</a>';
90 // Set admin line (currently set to impressum, later to contact form)
91 // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&what=impressum&admin=' . $adminId . '%}">' . $login . '</a>';
94 $content['title'] = $title;
96 // Handle description...
97 if ((empty($descr)) && (!empty($templ))) {
98 // Use description from template
99 $content['descr'] = loadTemplate('rallye_' . $templ, true);
101 // Use description from database
102 $content['descr'] = $descr;
105 // Set start and end time
106 $content['start'] = generateDateTime($start, 1);
107 $content['end'] = generateDateTime($end , 1);
109 // Determine min_users
110 $content['min_users'] = determineReferalRallyeMinimumUsers($min_users);
112 // Determine min prices (now in function)
113 $content['min_prices'] = determineReferalRallyeMinimumPrices($min_prices);
115 if ($expired === true) {
116 $content['prices'] = addReferalRallyeWinners($id);
117 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
118 $content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
120 $content['prices'] = addReferalRallyePrices($id, 'html');
121 $content['top_users'] = addReferalRallyeTopUsers($id, getMemberId());
122 $content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
125 // And load final template
126 loadTemplate('guest_rallye_show', false, $content);
128 // No rallye found so far
129 loadTemplate('guest_no_rallyes');
133 outputHtml('</div>');