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 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.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')) {
41 } elseif (!isMember()) {
42 redirectToIndexMemberOnlyModule();
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
48 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
49 displayMessage(generateExtensionInactiveNotInstalledMessage('rallye'));
53 // Check for possible running rallyes
54 $ADD = " AND d.is_active='Y'";
55 if (isAdmin()) $ADD = '';
57 $result = SQL_QUERY("SELECT
58 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
60 `{?_MYSQL_PREFIX?}_rallye_data` AS d
62 `{?_MYSQL_PREFIX?}_admins` AS a
66 d.notified='Y'" . $ADD . "
69 LIMIT 1", __FILE__, __LINE__);
71 if (SQL_NUMROWS($result) == 1) {
72 // Found some (normally one...
73 $content = SQL_FETCHARRAY($result);
76 if ($content['end_time'] < time()) {
78 $content['extras'] = '{--RALLYE_HAS_EXPIRED--}';
80 } elseif (time() >= ($content['end_time'] - getOneDay())) {
81 // Rallye will expire in less one day!
82 $content['extras'] = '{--RALLYE_EXPIRE_ONE_DAY--}';
84 // Link to referal links page
85 $content['extras'] = '<a href="{%url=modules.php?module=login&what=reflinks%}">{--RALLYE_GET_REFERAL_LINK--}</a>';
88 // Set admin line (currently set to impressum, later to contact form)
89 // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&what=impressum&admin=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
91 // Handle description...
92 if ((empty($content['descr'])) && (!empty($content['template']))) {
93 // Use description from template
94 $content['descr'] = loadTemplate('rallye_' . $content['template'], true);
97 // Determine min_users/prices
98 $content['min_users'] = determineReferalRallyeMinimumUsers($content['min_users']);
99 $content['min_prices'] = determineReferalRallyeMinimumPrices($content['min_prices']);
101 // Set start and end time
102 $content['start'] = generateDateTime($content['start_time'], 1);
103 $content['end'] = generateDateTime($content['end_time'] , 1);
105 if ($expired === true) {
106 $content['prices'] = addReferalRallyeWinners($content['id']);
107 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
108 $content['can_win_this'] = '{--RALLYE_OUR_WINNERS_ARE--}';
110 $content['prices'] = addReferalRallyePrices($content['id'], 'html');
111 $content['top_users'] = addReferalRallyeTopUsers($content['id'], getMemberId());
112 $content['can_win_this'] = '{--RALLYE_YOU_CAN_WIN--}';
115 // And load final template
116 loadTemplate('guest_rallye_show', false, $content);
118 // No rallye found so far
119 loadTemplate('guest_no_rallyes');
123 SQL_FREERESULT($result);