X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fcalendar%2Fday.php;h=40e4a4dfcc776e366cd2082cf64fec32f6e36c4b;hp=44d60447772660dbcedb09b9dba429a7c69d075f;hb=876fdb605dcb48b44b5c0a3a6f2f106c941e5c20;hpb=d61a01d48fa9d58a7fdd5a99e7943b7dcaa94178 diff --git a/plugins/calendar/day.php b/plugins/calendar/day.php index 44d60447..40e4a4df 100644 --- a/plugins/calendar/day.php +++ b/plugins/calendar/day.php @@ -1,41 +1,70 @@ - * Licensed under the GNU GPL. For full terms see the file COPYING. - * - * Displays the day page (day view). + +/** + * Displays the day page (day view). * - * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + * @copyright © 2002-2007 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('..'); -require_once('../src/validate.php'); -require_once('../functions/strings.php'); -require_once('../functions/date.php'); -require_once('../config/config.php'); -require_once('../functions/page_header.php'); -require_once('../src/load_prefs.php'); - -//displays head of day calendar view +/** + * 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('year',$year,SQ_FORM) || ! is_numeric($year)) { + unset($year); +} +if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) { + unset($month); +} +if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) { + unset($day); +} +/* got 'em */ + +/** + * 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; - echo " " . - " \n" . - " \n" . - " \n" . - " \n"; + echo html_tag( 'tr', '', '', $color[0] ) . "\n". + html_tag( 'td', '', 'left' ) . + html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" . + html_tag( 'tr', + html_tag( 'th', + "< ". + date_intl('D',$prev_date)."", + 'left' ) . + html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) , + '', '', 'width="75%"' ) . + html_tag( 'th', + "". + date_intl('D',$next_date)." >" , + 'right' ) + ); } -//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; @@ -52,12 +81,16 @@ function initialize_events() { if (isset($calendardata[$cdate])){ while ( $calfoo = each($calendardata[$cdate])){ - $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo[key]]; + $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['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; @@ -70,36 +103,48 @@ function display_events() { $eo=0; } - $ehour = substr($calfoo[key],0,2); - $eminute = substr($calfoo[key],2,2); - if (!is_array($calfoo[value])){ - echo " \n" . - " \n" . - " \n"; + $ehour = substr($calfoo['key'],0,2); + $eminute = substr($calfoo['key'],2,2); + if (!is_array($calfoo['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]; - if ($calbar[length]!=0){ - $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar[length],0,1,1,0)); + $calbar=$calfoo['value']; + if ($calbar['length']!=0){ + $elength = '-'.date_intl(_("H:i"),mktime($ehour,$eminute+$calbar['length'],0,1,1,0)); } else { $elength=''; } - echo " \n" . - " \n" . - " \n"; + echo html_tag( 'tr', '', '', $color[$eo] ) . + html_tag( 'td', date_intl(_("H:i"),mktime($ehour,$eminute,0,1,1,0)) . $elength, 'left' ) . + html_tag( 'td', '', 'left' ) . '['; + echo ($calbar['priority']==1) ? + "".htmlspecialchars($calbar['title']).'' : + htmlspecialchars($calbar['title']); + echo']
'.nl2br(htmlspecialchars($calbar['message'])).'
' . + html_tag( 'td', + "\n" . + "". + _("EDIT") . " | \n" . + "" . + _("DEL") . '' . + "\n" , + 'center' ); + } } - $i++; -} - - } +/* end of day functions */ if ($month <= 0){ $month = date( 'm'); @@ -124,14 +169,12 @@ $calself=basename($PHP_SELF); $daily_events = array(); -displayPageHeader($color, 'None'); +displayPageHeader($color); calendar_header(); readcalendardata(); day_header(); initialize_events(); display_events(); - - ?>
< ". - date_intl('D',$prev_date)."" . - date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) . "". - date_intl('D',$next_date)." >
$ehour:$eminute ". - _("ADD") . "
$ehour:$eminute$elength["; - echo ($calbar[priority]==1) ? "$calbar[title]" : "$calbar[title]"; - echo"] $calbar[message] \n" . - "". - _("EDIT") . " | \n" . - "" . - _("DEL") . '' . - "