-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 06/29/2004 *\r
- * ================ Last change: 08/22/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : what-add_rallye.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Add new rallye *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Neue Ref-Rallye einfuegen *\r
- * -------------------------------------------------------------------- *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003 - 2007 by Roland Haeder *\r
- * For more information visit: http://www.mxchange.org *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or *\r
- * (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU General Public License *\r
- * along with this program; if not, write to the Free Software *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *\r
- * MA 02110-1301 USA *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
-{\r
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
- require($INC);\r
-}\r
-// Add description as navigation point\r
-ADD_DESCR("admin", basename(__FILE__));\r
-\r
-if (isset($_POST['ok']))\r
-{\r
- // Generate timestamps\r
- $START = mktime($_POST['start_hour'], $_POST['start_min'], $_POST['start_sec'], $_POST['start_month'], $_POST['start_day'], $_POST['start_year']);\r
- $END = mktime($_POST['end_hour'] , $_POST['end_min'] , $_POST['end_sec'] , $_POST['end_month'] , $_POST['end_day'] , $_POST['end_year'] );\r
-\r
- // Is there already a rallye running?\r
- $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",\r
- array($START, $START, $START, $END), __FILE__, __LINE__);\r
-\r
- if (SQL_NUMROWS($result) == 0)\r
- {\r
- // Ok, start and end time did not overlap\r
- $result = 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)\r
-VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\r
- array(\r
- GET_ADMIN_ID($_COOKIE['admin_login']),\r
- $_POST['title'],\r
- $_POST['descr'],\r
- $_POST['template'],\r
- $START,\r
- $END,\r
- $_POST['auto_add'],\r
- $_POST['active'],\r
- $_POST['notify'],\r
-), __FILE__, __LINE__);\r
-\r
- // Load ID\r
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_data WHERE start_time='%s' AND end_time='%s' AND title='%s' LIMIT 1",\r
- array($START, $END, $_POST['title']), __FILE__, __LINE__);\r
- list($id) = SQL_FETCHROW($result);\r
- SQL_FREERESULT($result);\r
-\r
- if (!empty($id))\r
- {\r
- // Reload to prices...\r
- LOAD_URL(URL."/modules.php?module=admin&what=config_rallye_prices&rallye=".$id);\r
- }\r
- else\r
- {\r
- // Problem detected...\r
- LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_PROBLEM_CREATE);\r
- }\r
- }\r
- else\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Overlapping detected\r
- LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_OVERLAP_TIMES);\r
- }\r
-}\r
-\r
-// Prepare some constants for the template\r
-define('_AUTO_ADD_OPTIONS', ADD_OPTION_LINES("/ARRAY/", array('Y', 'N'), array(YES, NO )));\r
-define('_ACTIVE_OPTIONS' , ADD_OPTION_LINES("/ARRAY/", array('N', 'Y'), array(NO , YES)));\r
-define('_NOTIFY_OPTIONS' , ADD_OPTION_LINES("/ARRAY/", array('Y', 'N'), array(YES, NO )));\r
-\r
-// Starting day\r
-define('_START_SEC' , ADD_SELECTION("sec" , "0" , "start"));\r
-define('_START_MIN' , ADD_SELECTION("min" , "0" , "start"));\r
-define('_START_HOUR' , ADD_SELECTION("hour" , date("G", time()), "start"));\r
-define('_START_DAY' , ADD_SELECTION("day" , date("d", time()), "start"));\r
-define('_START_MONTH', ADD_SELECTION("month", date("m", time()), "start"));\r
-define('_START_YEAR' , ADD_SELECTION("year" , date("Y", time()), "start"));\r
-\r
-// Calcualte ending date\r
-$D = date("d", time() + (ONE_DAY * 7));\r
-$M = date("m", time() + (ONE_DAY * 7));\r
-$Y = date("Y", time() + (ONE_DAY * 7));\r
-\r
-// Ending day\r
-define('_END_SEC' , ADD_SELECTION("sec" , "0" , "end"));\r
-define('_END_MIN' , ADD_SELECTION("min" , "0" , "end"));\r
-define('_END_HOUR' , ADD_SELECTION("hour" , date("G", time()), "end"));\r
-define('_END_DAY' , ADD_SELECTION("day" , $D , "end"));\r
-define('_END_MONTH', ADD_SELECTION("month", $M , "end"));\r
-define('_END_YEAR' , ADD_SELECTION("year" , $Y , "end"));\r
-\r
-// Transfer (maybe found) templates into constant for the template\r
-define ('_TEMPLATES', RALLYE_TEMPLATE_SELECTION());\r
-\r
-// Load template\r
-LOAD_TEMPLATE("admin_add_rallye");\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 06/29/2004 *
+ * ================ Last change: 08/22/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : what-add_rallye.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Add new rallye *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Neue Ref-Rallye einfuegen *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
+{
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+}
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+if (isset($_POST['ok']))
+{
+ // Generate timestamps
+ $START = mktime($_POST['start_hour'], $_POST['start_min'], $_POST['start_sec'], $_POST['start_month'], $_POST['start_day'], $_POST['start_year']);
+ $END = mktime($_POST['end_hour'] , $_POST['end_min'] , $_POST['end_sec'] , $_POST['end_month'] , $_POST['end_day'] , $_POST['end_year'] );
+
+ // Is there already a rallye running?
+ $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",
+ array($START, $START, $START, $END), __FILE__, __LINE__);
+
+ if (SQL_NUMROWS($result) == 0)
+ {
+ // Ok, start and end time did not overlap
+ $result = 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)
+VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
+ array(
+ GET_ADMIN_ID($_COOKIE['admin_login']),
+ $_POST['title'],
+ $_POST['descr'],
+ $_POST['template'],
+ $START,
+ $END,
+ $_POST['auto_add'],
+ $_POST['active'],
+ $_POST['notify'],
+), __FILE__, __LINE__);
+
+ // Load ID
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_data WHERE start_time='%s' AND end_time='%s' AND title='%s' LIMIT 1",
+ array($START, $END, $_POST['title']), __FILE__, __LINE__);
+ list($id) = SQL_FETCHROW($result);
+ SQL_FREERESULT($result);
+
+ if (!empty($id))
+ {
+ // Reload to prices...
+ LOAD_URL(URL."/modules.php?module=admin&what=config_rallye_prices&rallye=".$id);
+ }
+ else
+ {
+ // Problem detected...
+ LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_PROBLEM_CREATE);
+ }
+ }
+ else
+ {
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Overlapping detected
+ LOAD_TEMPLATE("admin_settings_saved", false, RALLYE_OVERLAP_TIMES);
+ }
+}
+
+// Prepare some constants for the template
+define('_AUTO_ADD_OPTIONS', ADD_OPTION_LINES("/ARRAY/", array('Y', 'N'), array(YES, NO )));
+define('_ACTIVE_OPTIONS' , ADD_OPTION_LINES("/ARRAY/", array('N', 'Y'), array(NO , YES)));
+define('_NOTIFY_OPTIONS' , ADD_OPTION_LINES("/ARRAY/", array('Y', 'N'), array(YES, NO )));
+
+// Starting day
+define('_START_SEC' , ADD_SELECTION("sec" , "0" , "start"));
+define('_START_MIN' , ADD_SELECTION("min" , "0" , "start"));
+define('_START_HOUR' , ADD_SELECTION("hour" , date("G", time()), "start"));
+define('_START_DAY' , ADD_SELECTION("day" , date("d", time()), "start"));
+define('_START_MONTH', ADD_SELECTION("month", date("m", time()), "start"));
+define('_START_YEAR' , ADD_SELECTION("year" , date("Y", time()), "start"));
+
+// Calcualte ending date
+$D = date("d", time() + (ONE_DAY * 7));
+$M = date("m", time() + (ONE_DAY * 7));
+$Y = date("Y", time() + (ONE_DAY * 7));
+
+// Ending day
+define('_END_SEC' , ADD_SELECTION("sec" , "0" , "end"));
+define('_END_MIN' , ADD_SELECTION("min" , "0" , "end"));
+define('_END_HOUR' , ADD_SELECTION("hour" , date("G", time()), "end"));
+define('_END_DAY' , ADD_SELECTION("day" , $D , "end"));
+define('_END_MONTH', ADD_SELECTION("month", $M , "end"));
+define('_END_YEAR' , ADD_SELECTION("year" , $Y , "end"));
+
+// Transfer (maybe found) templates into constant for the template
+define ('_TEMPLATES', RALLYE_TEMPLATE_SELECTION());
+
+// Load template
+LOAD_TEMPLATE("admin_add_rallye");
+
+//
+?>