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 * 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')) {
42 } elseif (!isMember()) {
43 redirectToIndexMemberOnlyModule();
46 // Add description as navigation point
47 addMenuDescription('member', __FILE__);
49 if ((!isExtensionActive('rallye')) && (!isAdmin())) {
50 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('rallye'));
54 // Check for possible running rallyes
55 $ADD = " AND d.is_active='Y'";
56 if (isAdmin()) $ADD = '';
58 $result = SQL_QUERY("SELECT
59 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
61 `{?_MYSQL_PREFIX?}_rallye_data` AS d
63 `{?_MYSQL_PREFIX?}_admins` AS a
67 d.notified='Y'".$ADD."
70 LIMIT 1", __FILE__, __LINE__);
72 if (SQL_NUMROWS($result) == 1) {
73 // Found some (normally one...
74 $content = SQL_FETCHARRAY($result);
77 if ($content['end_time'] < time()) {
79 $content['extras'] = getMessage('RALLYE_HAS_EXPIRED');
81 } elseif (time() >= ($content['end_time'] - getConfig('ONE_DAY'))) {
82 // Rallye will expire in less one day!
83 $content['extras'] = getMessage('RALLYE_EXPIRE_ONE_DAY');
85 // Link to referal links page
86 $content['extras'] = '<a href="{%url=modules.php?module=login&what=reflinks%}">{--RALLYE_GET_REFLINK--}</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=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
92 // Handle description...
93 if ((empty($content['descr'])) && (!empty($content['template']))) {
94 // Use description from template
95 $content['descr'] = loadTemplate('rallye_' . $content['template'], true);
98 // Determine min_users/prices
99 $content['min_users'] = determineReferalRallyeMinimumUsers($content['min_users']);
100 $content['min_prices'] = determineReferalRallyeMinimumPrices($content['min_prices']);
102 // Set start and end time
103 $content['start'] = generateDateTime($content['start_time'], 1);
104 $content['end'] = generateDateTime($content['end_time'] , 1);
106 if ($expired === true) {
107 $content['prices'] = addReferalRallyeWinners($content['id']);
108 $content['top_users'] = '<div align="center" class="big">' . $content['extras'] . '</div>';
109 $content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
111 $content['prices'] = addReferalRallyePrices($content['id'], 'html');
112 $content['top_users'] = addReferalRallyeTopUsers($content['id'], getMemberId());
113 $content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
116 // And load final template
117 loadTemplate('guest_rallye_show', false, $content);
119 // No rallye found so far
120 loadTemplate('guest_no_rallyes');
124 SQL_FREERESULT($result);