X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fcalendar%2Fday.php;h=983a33174075e812502c2b71be33a61664c75786;hp=2a6a7682aff4cff4f2598a3434f3d5e59175366b;hb=77a1e3d10b0fe8a81bd645e3797d425839592954;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e diff --git a/plugins/calendar/day.php b/plugins/calendar/day.php index 2a6a7682..983a3317 100644 --- a/plugins/calendar/day.php +++ b/plugins/calendar/day.php @@ -1,59 +1,44 @@ - * * Displays the day page (day view). * - * $Id$ + * @copyright 2002-2022 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ * @package plugins * @subpackage calendar */ -/** @ignore */ -define('SM_PATH','../../'); +/** + * Include the SquirrelMail initialization file. + */ +require('../../include/init.php'); -/* Calender plugin required files. */ -require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); -require_once(SM_PATH . 'plugins/calendar/functions.php'); +/* date_intl() */ +include_once(SM_PATH . 'functions/date.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'); +/* Calendar plugin required files. */ +include_once(SM_PATH . 'plugins/calendar/calendar_data.php'); +include_once(SM_PATH . 'plugins/calendar/functions.php'); /* get globals */ -if (isset($_GET['year'])) { - $year = $_GET['year']; +if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) { + unset($year); } -elseif (isset($_POST['year'])) { - $year = $_POST['year']; +if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) { + unset($month); } -if (isset($_GET['month'])) { - $month = $_GET['month']; +if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) { + unset($day); } -elseif (isset($_POST['month'])) { - $month = $_POST['month']; -} -if (isset($_GET['day'])) { - $day = $_GET['day']; -} -elseif (isset($_POST['day'])) { - $day = $_POST['day']; -} - /* got 'em */ -//displays head of day calendar view +/** + * displays head of day calendar view + * @return void + * @access private + */ function day_header() { global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day, $prev_date, $next_month, $next_day, $next_year, $next_date; @@ -75,7 +60,11 @@ function day_header() { ); } -//events for specific day are inserted into "daily" array +/** + * events for specific day are inserted into "daily" array + * @return void + * @access private + */ function initialize_events() { global $daily_events, $calendardata, $month, $day, $year; @@ -91,62 +80,71 @@ function initialize_events() { $cdate = $month . $day . $year; if (isset($calendardata[$cdate])){ - while ( $calfoo = each($calendardata[$cdate])){ - $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']]; + foreach ($calendardata[$cdate] as $key => $value){ + $daily_events[$key] = $calendardata[$cdate][$key]; } } } -//main loop for displaying daily events +/** + * main loop for displaying daily events + * @return void + * @access private + */ function display_events() { global $daily_events, $month, $day, $year, $color; ksort($daily_events,SORT_STRING); $eo=0; - while ($calfoo = each($daily_events)){ + foreach ($daily_events as $key => $value) { if ($eo==0){ $eo=4; } else { $eo=0; } - $ehour = substr($calfoo['key'],0,2); - $eminute = substr($calfoo['key'],2,2); - if (!is_array($calfoo['value'])){ + $ehour = substr($key,0,2); + $eminute = substr($key,2,2); + if (!is_array($value)){ echo html_tag( 'tr', html_tag( 'td', $ehour . ':' . $eminute, 'left' ) . html_tag( 'td', ' ', 'left' ) . html_tag( 'td', - "". + "". _("ADD") . "" , 'center' ) , '', $color[$eo]); } else { - $calbar=$calfoo['value']; + $calbar=$value; if ($calbar['length']!=0){ - $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar['length'],0,1,1,0)); + $elength = '-'.date_intl(_("H:i"),mktime($ehour,$eminute+$calbar['length'],0,1,1,0)); } else { $elength=''; } echo html_tag( 'tr', '', '', $color[$eo] ) . - html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) . + html_tag( 'td', date_intl(_("H:i"),mktime($ehour,$eminute,0,1,1,0)) . $elength, 'left' ) . html_tag( 'td', '', 'left' ) . '['; - echo ($calbar['priority']==1) ? "$calbar[title]" : "$calbar[title]"; - echo"] $calbar[message] " . + echo ($calbar['priority']==1) ? + "".sm_encode_html_special_chars($calbar['title']).'' : + sm_encode_html_special_chars($calbar['title']); + echo']
'.nl2br(sm_encode_html_special_chars($calbar['message'])).'
' . html_tag( 'td', "\n" . - "". + "". _("EDIT") . " | \n" . - "" . + "" . _("DEL") . '' . "\n" , 'center' ); + } } } - - -} +/* end of day functions */ if ($month <= 0){ $month = date( 'm'); @@ -171,7 +169,7 @@ $calself=basename($PHP_SELF); $daily_events = array(); -displayPageHeader($color, 'None'); +displayPageHeader($color); calendar_header(); readcalendardata(); day_header(); @@ -179,4 +177,4 @@ initialize_events(); display_events(); ?> - \ No newline at end of file +