X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fcalendar%2Fevent_delete.php;h=ca1c83aebafb73851b6ad49b268c6e523636acc3;hp=cd23d8d72cac3b16339f1d97c007f6937001a921;hb=5d0f90f4cf688a471e7d92893a37f0c8932909db;hpb=aa7fb30cfbfef6ef28ebde963f6312c79122f411 diff --git a/plugins/calendar/event_delete.php b/plugins/calendar/event_delete.php index cd23d8d7..ca1c83ae 100644 --- a/plugins/calendar/event_delete.php +++ b/plugins/calendar/event_delete.php @@ -1,80 +1,107 @@ - * - * Functions to delete a event. - * - * $Id$ + * @copyright 2002-2012 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage calendar */ -require_once('calendar_data.php'); -require_once('functions.php'); -chdir('..'); -define('SM_PATH','../'); +/** + * Include the SquirrelMail initialization file. + */ +require('../../include/init.php'); + +/* date_intl() */ +include_once(SM_PATH . 'functions/date.php'); + +/* Calendar plugin required files. */ +include_once(SM_PATH . 'plugins/calendar/calendar_data.php'); +include_once(SM_PATH . 'plugins/calendar/functions.php'); + +/* get globals */ +if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) { + unset($month); +} +if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) { + unset($year); +} +if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) { + unset($day); +} +if (! sqGetGlobalVar('dyear',$dyear,SQ_FORM) || ! is_numeric($dyear)) { + unset($dyear); +} +if (! sqGetGlobalVar('dmonth',$dmonth,SQ_FORM) || ! is_numeric($dmonth)) { + unset($dmonth); +} +if (! sqGetGlobalVar('dday',$dday,SQ_FORM) || ! is_numeric($dday)) { + unset($dday); +} +if (! sqGetGlobalVar('dhour',$dhour,SQ_FORM) || ! is_numeric($dhour)) { + unset($dhour); +} +if (! sqGetGlobalVar('dminute',$dminute,SQ_FORM) || ! is_numeric($dminute)) { + unset($dminute); +} +sqGetGlobalVar('confirmed',$confirmed,SQ_POST); -/* 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'); +/* 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"]; echo html_tag( 'table', html_tag( 'tr', - html_tag( 'th', _("Do you really want to delete this event?") . '
', '', $color[4], 'colspan="2"' ) + html_tag( 'th', _("Do you really want to delete this event?") . '
', '', $color[4], 'colspan="2"' ) ) . 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', - "
\n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n". - " \n". - ' \n". - "
\n" , + "
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + ' \n". + "
\n" , 'right', $color[4] ) . html_tag( 'td', - "
\n". - " \n". - " \n". - " \n". - ' \n". - "
\n" , + "
\n". + " \n". + " \n". + " \n". + ' \n". + "
\n" , 'left', $color[4] ) ) , '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' ); @@ -92,7 +119,7 @@ if ($day <= 0){ $calself=basename($PHP_SELF); -displayPageHeader($color, 'None'); +displayPageHeader($color); //load calendar menu calendar_header(); @@ -105,15 +132,15 @@ echo html_tag( 'tr', '', '', $color[0] ) . if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){ if (isset($confirmed)){ delete_event("$dmonth$dday$dyear", "$dhour$dminute"); - echo '

' . _("Event deleted!") . "
\n"; - echo "" . + echo '

' . _("Event deleted!") . "
\n"; + echo "
" . _("Day View") . "\n"; } else { readcalendardata(); confirm_deletion(); } } else { - echo '
' . _("Nothing to delete!"); + echo '
' . _("Nothing to delete!"); } ?>