X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fcalendar%2Fcalendar.php;h=03516bdaf0ec5fba2d1a0bfea7076a8aa6468ea7;hp=524b9dd289cea2368c25d862a97e16b7a9232f26;hb=1e532e26cb164aba478840773ca0b68ebb92a148;hpb=8d6a115b0ef06dbcf9b149ba2509208f09b3a2ab;ds=sidebyside diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 524b9dd2..03516bda 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -1,35 +1,43 @@ - * * Displays the main calendar page (month view). * - * $Id$ + * @copyright © 2002-2009 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage calendar + */ + +/** + * Include the SquirrelMail initialization file. + */ +require('../../include/init.php'); + +/* load 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); +} +/* got 'em */ + +/** + * display upper part of month calendar view + * @return void + * @access private */ -define('SM_PATH','../../'); - -/* Calender plugin required files. */ -require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); -require_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'); - -//display upper part of month calendar view function startcalendar() { - global $year, $month, $day, $color; + global $year, $month, $color; $prev_date = mktime(0, 0, 0, $month - 1, 1, $year); $act_date = mktime(0, 0, 0, $month, 1, $year); @@ -45,19 +53,19 @@ function startcalendar() { html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) . html_tag( 'tr', "\n". html_tag( 'th', - "<< ".($year-1)."" + "<< ".($year-1)."" ) . "\n". html_tag( 'th', - "< " . + "< " . date_intl( 'M', $prev_date). "" ) . "\n". html_tag( 'th', date_intl( 'F Y', $act_date ), '', $color[0], 'colspan="3"') . html_tag( 'th', - "" . + "" . date_intl( 'M', $next_date) . " >" ) . "\n". html_tag( 'th', - "".($year+1)." >>" + "".($year+1)." >>" ) ) . "\n". html_tag( 'tr', @@ -73,9 +81,13 @@ function startcalendar() { '', $color[0] ) ."\n"; } -//main logic for month view of calendar +/** + * main logic for month view of calendar + * @return void + * @access private + */ function drawmonthview() { - global $year, $month, $day, $color, $calendardata, $todayis; + global $year, $month, $color, $calendardata, $todayis; $aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year)); $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year)); @@ -88,8 +100,8 @@ function drawmonthview() { if ( $aday <= $days_in_month && $aday > 0){ echo html_tag( 'td', '', 'left', $color[4], 'height="50" valign="top"' ) ."\n". html_tag( 'div', '', 'right' ); - echo(($cdate==$todayis) ? "[ " . _("TODAY") . " ] " : ""); - echo "[ ' . _("TODAY") . " ] " : ''); + echo "$aday"; } else { @@ -100,7 +112,13 @@ function drawmonthview() { $i=0; while ($calfoo = each($calendardata[$cdate])) { $calbar = $calendardata[$cdate][$calfoo['key']]; - echo ($calbar['priority']==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; + // FIXME: how to display multiline task + $title = '['. $calfoo['key']. '] ' . + str_replace(array("\r","\n"),array(' ',' '),htmlspecialchars($calbar['message'])); + // FIXME: link to nowhere + echo "".htmlspecialchars($calbar['title'])."
\n"; $i=$i+1; if($i==2){ break; @@ -114,23 +132,27 @@ function drawmonthview() { } } -//end of monthly view and form to jump to any month and year +/** + * end of monthly view and form to jump to any month and year + * @return void + * @access private + */ function endcalendar() { - global $year, $month, $day, $color; + global $year, $month; echo html_tag( 'tr' ) ."\n" . html_tag( 'td', '', 'left', '', 'colspan="7"' ) ."\n" . - "
\n". - " \n"; select_option_year($year); - echo " \n". - " \n". + " \n". - ' \n". - "
\n". - " \n". - "\n"; + echo " \n". + ' \n". + " \n". + " \n". + "\n"; } @@ -147,7 +169,7 @@ if( !isset($day) || $day <= 0){ $todayis = date( 'mdY' ); $calself=basename($PHP_SELF); -displayPageHeader($color, 'None'); +displayPageHeader($color); calendar_header(); readcalendardata(); startcalendar();