<?php
/************************************************************************
- * MXChange v0.2.1 Start: 07/24/2004 *
- * ================ Last change: 08/09/2004 *
+ * Mailer v0.2.1-FINAL Start: 07/24/2004 *
+ * =================== Last change: 08/09/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-del_holiday.php *
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Urlaubsschaltungen entfernen *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
}
// Add description as navigation point
-ADD_DESCR("admin", __FILE__);
-
-// Check for selected holidays
-$SUM = 0;
-if (isset($_POST['sel'])) $SUM = SELECTION_COUNT($_POST['sel']);
+addMenuDescription('admin', __FILE__);
// Shall I delete selected holidays???
-if ($SUM > 0)
-{
+if (ifPostContainsSelections()) {
// Delete multiple holiday requests (for list_holiday)
- $cnt = 0;
- foreach ($_POST['sel'] as $id => $sel)
- {
+ $cnt = '0';
+ foreach (postRequestParameter('sel') as $id => $sel) {
// Get the userid
- $result = SQL_QUERY_ESC("SELECT userid, holiday_start, holiday_end
-FROM `{!MYSQL_PREFIX!}_user_holidays`
-WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ $result = SQL_QUERY_ESC("SELECT
+ `userid`, `holiday_start`, `holiday_end`
+FROM
+ `{?_MYSQL_PREFIX?}_user_holidays`
+WHERE
+ `id`=%s
+LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Load data and free memory
- list($uid, $start, $end) = SQL_FETCHROW($result);
+ list($userid, $start, $end) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Update user's account
- SQL_QUERY_ESC("UPDATE `{!MYSQL_PREFIX!}_user_data`
-SET holiday_active='N', holiday_activated='0'
-WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
+SET
+ `holiday_active`='N',
+ `holiday_activated`=0
+WHERE
+ `userid`=%s
+LIMIT 1", array(bigintval($userid)), __FILE__, __LINE__);
// Remove holiday
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!MYSQL_PREFIX!}_user_holidays`
-WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+ `{?_MYSQL_PREFIX?}_user_holidays`
+WHERE
+ `id`=%s
+LIMIT 1", array(bigintval($id)), __FILE__, __LINE__);
// Prepare loaded data for the
$content = array(
- 'start' => MAKE_DATETIME($start, "3"),
- 'end' => MAKE_DATETIME($end , "3")
+ 'start' => generateDateTime($start, 3),
+ 'end' => generateDateTime($end , 3)
);
// Send email to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
- SEND_EMAIL($uid, HOLIDAY_ADMIN_REMOVED_SUBJ, $msg);
+ $message = loadEmailTemplate('member_holiday_removed', $content, $userid);
+ sendEmail($userid, '{--ADMIN_HOLIDAY_REMOVED_SUBJECT--}', $message);
$cnt++;
}
}
- LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ADMIN_MULTI_DEL_1.$cnt.HOLIDAY_ADMIN_MULTI_DEL_2);
-}
- elseif (!empty($_GET['u_id']))
-{
+ loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_HOLIDAY_MULTI_DEL', $cnt));
+} elseif (isGetRequestParameterSet('userid')) {
// Set default message
- $MSG = HOLIDAY_ADMIN_SINGLE_404;
+ $message = '{--ADMIN_HOLIDAY_SINGLE_404--}';
// Fetch data
- $result_load = SQL_QUERY_ESC("SELECT holiday_start AS start, holiday_end AS end
-FROM `{!MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_load) == 1)
- {
+ $result_load = SQL_QUERY_ESC("SELECT
+ `holiday_start` AS start, `holiday_end` AS end
+FROM
+ `{?_MYSQL_PREFIX?}_user_holidays`
+WHERE
+ `userid`=%s
+LIMIT 1",
+ array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_load) == 1) {
// Load data
$content = SQL_FETCHARRAY($result_load);
- // Free some memory
- unset($content[0]);
- unset($content[1]);
-
// Delete one holiday request (for task)
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+ `{?_MYSQL_PREFIX?}_user_holidays`
+WHERE
+ `userid`=%s
+LIMIT 1", array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
// Send email to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $_GET['u_id']);
- SEND_EMAIL($_GET['u_id'], HOLIDAY_ADMIN_REMOVED_SUBJ, $msg);
+ $message = loadEmailTemplate('member_holiday_removed', $content, getRequestParameter('userid'));
+ sendEmail(getRequestParameter('userid'), '{--ADMIN_HOLIDAY_REMOVED_SUBJECT--}', $message);
// Set message
- $MSG = HOLIDAY_ADMIN_SINGLE_DELETED;
- }
+ $message = '{--ADMIN_HOLIDAY_SINGLE_DELETED--}';
+ } // END - if
// Free memory
SQL_FREERESULT($result_load);
// Output message
- LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
-}
- else
-{
+ loadTemplate('admin_settings_saved', false, $message);
+} else {
// Please call me over other scripts... ;)
- LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_NO_DIRECT_CALL);
+ loadTemplate('admin_settings_saved', false, '{--HOLIDAY_NO_DIRECT_CALL--}');
}
-//
+
+// [EOF]
?>