X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fcalendar%2Fevent_delete.php;h=fd75562917b43087321df189b0b1c56562a4e310;hp=d70060d46c3e0dc4ae011968bb4779d747ec64ba;hb=55e346263751f3100c780b2d3aee268b6fa3232d;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e diff --git a/plugins/calendar/event_delete.php b/plugins/calendar/event_delete.php index d70060d4..fd755629 100644 --- a/plugins/calendar/event_delete.php +++ b/plugins/calendar/event_delete.php @@ -1,93 +1,61 @@ - * * Functions to delete a event. * - * $Id$ + * @copyright 2002-2011 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ * @package plugins * @subpackage calendar */ /** - * @ignore + * Include the SquirrelMail initialization file. */ -define('SM_PATH','../../'); +require('../../include/init.php'); + +/* date_intl() */ +include_once(SM_PATH . 'functions/date.php'); -/* Calender plugin required files. */ -require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); -require_once(SM_PATH . 'plugins/calendar/functions.php'); +/* Calendar plugin required files. */ +include_once(SM_PATH . 'plugins/calendar/calendar_data.php'); +include_once(SM_PATH . 'plugins/calendar/functions.php'); -/* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); -require_once(SM_PATH . 'functions/strings.php'); -require_once(SM_PATH . 'functions/date.php'); -require_once(SM_PATH . 'config/config.php'); -require_once(SM_PATH . 'functions/page_header.php'); -require_once(SM_PATH . 'include/load_prefs.php'); -require_once(SM_PATH . 'functions/html.php'); /* get globals */ -if (isset($_GET['month']) && is_numeric($_GET['month'])) { - $month = $_GET['month']; -} -elseif (isset($_POST['month']) && is_numeric($_GET['month'])) { - $month = $_POST['month']; -} -if (isset($_GET['year']) && is_numeric($_GET['year'])) { - $year = $_GET['year']; -} -elseif (isset($_POST['year']) && is_numeric($_POST['year'])) { - $year = $_POST['year']; -} -if (isset($_GET['day']) && is_numeric($_GET['day'])) { - $day = $_GET['day']; +if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) { + unset($month); } -elseif (isset($_POST['day']) && is_numeric($_POST['day'])) { - $day = $_POST['day']; +if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) { + unset($year); } -if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) { - $dyear = $_GET['dyear']; +if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) { + unset($day); } -elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) { - $dyear = $_POST['dyear']; +if (! sqGetGlobalVar('dyear',$dyear,SQ_FORM) || ! is_numeric($dyear)) { + unset($dyear); } -if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) { - $dmonth = $_GET['dmonth']; +if (! sqGetGlobalVar('dmonth',$dmonth,SQ_FORM) || ! is_numeric($dmonth)) { + unset($dmonth); } -elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) { - $dmonth = $_POST['dmonth']; +if (! sqGetGlobalVar('dday',$dday,SQ_FORM) || ! is_numeric($dday)) { + unset($dday); } -if (isset($_GET['dday']) && is_numeric($_GET['dday'])) { - $dday = $_GET['dday']; +if (! sqGetGlobalVar('dhour',$dhour,SQ_FORM) || ! is_numeric($dhour)) { + unset($dhour); } -elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) { - $dday = $_POST['dday']; -} -if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) { - $dhour = $_GET['dhour']; -} -elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) { - $dhour = $_POST['dhour']; -} -if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) { - $dminute = $_GET['dminute']; -} -elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) { - $dminute = $_POST['dminute']; -} -if (isset($_POST['confirmed'])) { - $confirmed = $_POST['confirmed']; +if (! sqGetGlobalVar('dminute',$dminute,SQ_FORM) || ! is_numeric($dminute)) { + unset($dminute); } +sqGetGlobalVar('confirmed',$confirmed,SQ_POST); + /* got 'em */ -function confirm_deletion() -{ +/** + * Displays confirmation form when event is deleted + * @return void + */ +function confirm_deletion() { global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day; $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"]; @@ -98,19 +66,19 @@ function confirm_deletion() ) . html_tag( 'tr', html_tag( 'td', _("Date:"), 'right', $color[4] ) . - html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] ) + html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$dmonth,$dday,$dyear)), 'left', $color[4] ) ) . html_tag( 'tr', html_tag( 'td', _("Time:"), 'right', $color[4] ) . - html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] ) + html_tag( 'td', date_intl(_("H:i"),mktime($dhour,$dminute,0,$dmonth,$dday,$dyear)), 'left', $color[4] ) ) . html_tag( 'tr', html_tag( 'td', _("Title:"), 'right', $color[4] ) . - html_tag( 'td', $tmparray['title'], 'left', $color[4] ) + html_tag( 'td', htmlspecialchars($tmparray['title']), 'left', $color[4] ) ) . html_tag( 'tr', html_tag( 'td', _("Message:"), 'right', $color[4] ) . - html_tag( 'td', $tmparray['message'], 'left', $color[4] ) + html_tag( 'td', nl2br(htmlspecialchars($tmparray['message'])), 'left', $color[4] ) ) . html_tag( 'tr', html_tag( 'td', @@ -151,7 +119,7 @@ if ($day <= 0){ $calself=basename($PHP_SELF); -displayPageHeader($color, 'None'); +displayPageHeader($color); //load calendar menu calendar_header(); @@ -177,4 +145,4 @@ if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($d ?> - \ No newline at end of file +