2 /************************************************************************
3 * MXChange v0.2.1 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 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
44 // Add description as navigation point
45 addMenuDescription('guest', __FILE__);
47 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
48 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('rallye'));
53 outputHtml("<div align=\"center\">");
55 // Check for possible running rallyes
56 $ADMIN = " AND d.is_active='Y'";
57 if (isAdmin()) $ADMIN = '';
59 $result = SQL_QUERY("SELECT
60 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
62 `{?_MYSQL_PREFIX?}_rallye_data` AS d
64 `{?_MYSQL_PREFIX?}_admins` AS a
68 d.notified='Y'".$ADMIN."
71 LIMIT 1", __FILE__, __LINE__);
73 if (SQL_NUMROWS($result) == 1) {
74 // Found some (normally one...
75 list($id, $adminId, $login, $title, $descr, $templ, $start, $end, $min_users, $min_prices) = SQL_FETCHROW($result);
80 $content['extras'] = getMessage('RALLYE_HAS_EXPIRED');
82 } elseif (time() >= ($end - getConfig('ONE_DAY'))) {
83 // Rallye will expire in less one day!
84 $content['extras'] = getMessage('RALLYE_EXPIRE_ONE_DAY');
86 $content['extras'] = "<a href=\"{?URL?}/modules.php?module=index&what=register\">{--RALLYE_REGISTER_NOW--}</a>";
89 // Set admin line (currently set to impressum, later to contact form)
90 // @TODO Reactivate this: $content['admin'] = "<a href=\"{?URL?}/modules.php?module=index&what=impressum&admin=".$adminId."\">".$login."</a>";
93 $content['title'] = $title;
95 // Handle description...
96 if ((empty($descr)) && (!empty($templ))) {
97 // Use description from template
98 $content['descr'] = loadTemplate('rallye_' . $templ, true);
100 // Use description from database
101 $content['descr'] = $descr;
104 // Set start and end time
105 $content['start'] = generateDateTime($start, 1);
106 $content['end'] = generateDateTime($end , 1);
108 // Determine min_users
109 $content['min_users'] = determineReferalRallyeMinimumUsers($min_users);
111 // Determine min prices (now in function)
112 $content['min_prices'] = determineReferalRallyeMinimumPrices();
114 if ($expired === true) {
115 $content['prices'] = addReferalRallyeWinners($id);
116 $content['top_users'] = "<div align=\"center\" class=\"big\">".$content['extras']."</div>";
117 $content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
119 $content['prices'] = addReferalRallyePrices($id, 'html');
120 $content['top_users'] = addReferalRallyeTopUsers($id, getUserId());
121 $content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
124 // And load final template
125 loadTemplate('guest_rallye_show', false, $content);
127 // No rallye found so far
128 loadTemplate('guest_no_rallyes');
132 outputHtml('</div>');