X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fcalendar%2Fcalendar.php;h=dae2a87df7b8a3ca9c60d5d01ec5166135262dce;hb=7af343f176b34839e17d03e5f2ea9dc45b56f6d2;hp=881cd9d692437f053da250daea8f387be27dbf45;hpb=5d01bcce7dbbe60726b95a3b292d1a0f051831dd;p=squirrelmail.git diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 881cd9d6..dae2a87d 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -1,51 +1,43 @@ - * * Displays the main calendar page (month view). * - * $Id$ + * @copyright © 2002-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage calendar */ -define('SM_PATH','../../'); -/* Calender plugin required files. */ -require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); -require_once(SM_PATH . 'plugins/calendar/functions.php'); +/** + * Include the SquirrelMail initialization file. + */ +require('../../include/init.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'); +/* load date_intl() */ +include_once(SM_PATH . 'functions/date.php'); -/* get globals */ +/* Calendar plugin required files. */ +include_once(SM_PATH . 'plugins/calendar/calendar_data.php'); +include_once(SM_PATH . 'plugins/calendar/functions.php'); -if (isset($_GET['month'])) { - $month = $_GET['month']; -} -if (isset($_GET['year'])) { - $year = $_GET['year']; -} -if (isset($_POST['year'])) { - $year = $_POST['year']; +/* get globals */ +if (! sqgetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) { + unset($month); } -if (isset($_POST['month'])) { - $month = $_POST['month']; +if (! sqgetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) { + unset($year); } /* got 'em */ -//display upper part of month calendar view +/** + * display upper part of month calendar view + * @return void + * @access private + */ 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); @@ -89,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)); @@ -104,7 +100,7 @@ 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(($cdate==$todayis) ? '[ ' . _("TODAY") . " ] " : ''); echo "$aday"; @@ -116,8 +112,13 @@ function drawmonthview() { $i=0; while ($calfoo = each($calendardata[$cdate])) { $calbar = $calendardata[$cdate][$calfoo['key']]; - $title = '['. $calfoo['key']. '] ' .$calbar['message']; - 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; @@ -131,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; 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"; } @@ -172,4 +177,4 @@ drawmonthview(); endcalendar(); ?> - + \ No newline at end of file