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')) {
43 } elseif (!isMember()) {
44 redirectToIndexMemberOnlyModule();
47 // Add description as navigation point
48 addMenuDescription('member', __FILE__);
50 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
51 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('rallye'));
55 // Check for possible running rallyes
56 $ADD = " AND d.is_active='Y'";
57 if (isAdmin()) $ADD = '';
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'" . $ADD . "
71 LIMIT 1", __FILE__, __LINE__);
73 if (SQL_NUMROWS($result) == 1) {
74 // Found some (normally one...
75 $content = SQL_FETCHARRAY($result);
78 if ($content['end_time'] < time()) {
80 $content['extras'] = getMessage('RALLYE_HAS_EXPIRED');
82 } elseif (time() >= ($content['end_time'] - getConfig('ONE_DAY'))) {
83 // Rallye will expire in less one day!
84 $content['extras'] = getMessage('RALLYE_EXPIRE_ONE_DAY');
86 // Link to referal links page
87 $content['extras'] = '<a href="{%url=modules.php?module=login&what=reflinks%}">{--RALLYE_GET_REFLINK--}</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=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
93 // Handle description...
94 if ((empty($content['descr'])) && (!empty($content['template']))) {
95 // Use description from template
96 $content['descr'] = loadTemplate('rallye_' . $content['template'], true);
99 // Determine min_users/prices
100 $content['min_users'] = determineReferalRallyeMinimumUsers($content['min_users']);
101 $content['min_prices'] = determineReferalRallyeMinimumPrices($content['min_prices']);
103 // Set start and end time
104 $content['start'] = generateDateTime($content['start_time'], 1);
105 $content['end'] = generateDateTime($content['end_time'] , 1);
107 if ($expired === true) {
108 $content['prices'] = addReferalRallyeWinners($content['id']);
109 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
110 $content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
112 $content['prices'] = addReferalRallyePrices($content['id'], 'html');
113 $content['top_users'] = addReferalRallyeTopUsers($content['id'], getMemberId());
114 $content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
117 // And load final template
118 loadTemplate('guest_rallye_show', false, $content);
120 // No rallye found so far
121 loadTemplate('guest_no_rallyes');
125 SQL_FREERESULT($result);