]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-add_rallye.php
- Rewrites to use more the userid than the actual email address when sending
[mailer.git] / inc / modules / admin / what-add_rallye.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 06/29/2004 *
4  * ===================                          Last change: 08/22/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-add_rallye.php                              *
8  * -------------------------------------------------------------------- *
9  * Short description : Add new rallye                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Neue Ref-Rallye einfuegen                        *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 if (isFormSent()) {
47         // Generate timestamps
48         $START = mktime(postRequestParameter('start_hour'), postRequestParameter('start_min'), postRequestParameter('start_sec'), postRequestParameter('start_month'), postRequestParameter('start_day'), postRequestParameter('start_year'));
49         $END   = mktime(postRequestParameter('end_hour')  , postRequestParameter('end_min')  , postRequestParameter('end_sec')  , postRequestParameter('end_month')  , postRequestParameter('end_day')  , postRequestParameter('end_year')  );
50
51         // Is there already a rallye running?
52         $result = SQL_QUERY_ESC("SELECT `id`, `admin_id` FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE (`start_time` <= %s AND `end_time` >= %s) OR (`start_time` >= %s AND `start_time` <= %s) LIMIT 1",
53                 array($START, $START, $START, $END), __FILE__, __LINE__);
54
55         if (SQL_HASZERONUMS($result)) {
56                 // Ok, start and end time did not overlap
57                 SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_data` (`admin_id`, `title`, `descr`, template, `start_time`, `end_time`, `auto_add_new_user`, `is_active`, `send_notify`)
58 VALUES (%s,'%s','%s','%s',%s,%s,'%s','%s','%s')",
59                         array(
60                                 getCurrentAdminId(),
61                                 postRequestParameter('title'),
62                                 postRequestParameter('descr'),
63                                 postRequestParameter('template'),
64                                 $START,
65                                 $END,
66                                 postRequestParameter('auto_add'),
67                                 postRequestParameter('active'),
68                                 postRequestParameter('notify'),
69                         ), __FILE__, __LINE__);
70
71                 // Load id
72                 $id = SQL_INSERTID();
73
74                 if (!empty($id)) {
75                         // Reload to prices...
76                         redirectToUrl('modules.php?module=admin&amp;what=config_rallye_prices&amp;rallye='.$id);
77                 } else {
78                         // Problem detected...
79                         displayMessage('{--RALLYE_PROBLEM_CREATE--}');
80                 }
81         } else {
82                 // Free memory
83                 SQL_FREERESULT($result);
84
85                 // Overlapping detected
86                 displayMessage('{--RALLYE_OVERLAP_TIMES--}');
87         }
88 } // END - if
89
90 // Prepare some constants for the template
91 $content['auto_add_options'] = generateOptionList('/ARRAY/', array('Y','N'), array('{--YES--}', '{--NO--}' ));
92 $content['active_options']   = generateOptionList('/ARRAY/', array('N','Y'), array('{--NO--}' , '{--YES--}'));
93 $content['notify_options']   = generateOptionList('/ARRAY/', array('Y','N'), array('{--YES--}', '{--NO--}' ));
94
95 // Starting day
96 $content['start_sec']   = addSelectionBox('sec'  , 0                   , 'start');
97 $content['start_min']   = addSelectionBox('min'  , 0                   , 'start');
98 $content['start_hour']  = addSelectionBox('hour' , getShortHour()      , 'start');
99 $content['start_day']   = addSelectionBox('day'  , getDay()            , 'start');
100 $content['start_month'] = addSelectionBox('month', getMonth()          , 'start');
101 $content['start_year']  = addSelectionBox('year' , getYear()           , 'start');
102
103 // Ending timestamp
104 $endingStamp = time() + (getOneDay() * 7);
105
106 // Ending day
107 $content['end_sec']   = addSelectionBox('sec'  , 0                     , 'end');
108 $content['end_min']   = addSelectionBox('min'  , 0                     , 'end');
109 $content['end_hour']  = addSelectionBox('hour' , getShortHour()        , 'end');
110 $content['end_day']   = addSelectionBox('day'  , getDay($endingStamp)  , 'end');
111 $content['end_month'] = addSelectionBox('month', getMonth($endingStamp), 'end');
112 $content['end_year']  = addSelectionBox('year' , getYear($endingStamp) , 'end');
113
114 // Transfer (maybe found) templates into constant for the template
115 $content['templates_selection'] = addReferalRallyeTemplateSelection();
116
117 // Load template
118 loadTemplate('admin_add_rallye', false, $content);
119
120 // [EOF]
121 ?>