X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fcalendar%2Fcalendar.php;h=956f4b29d8134280195af4825fc9dbebe8c38f22;hb=202bcbcc2b67c7c153db1b09b608b62beeba0496;hp=8cc4b25d9db427c112b2d1cb43d4d52a624ad228;hpb=4b4abf93a9624311afef0c385023724ee46a2b60;p=squirrelmail.git
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 8cc4b25d..956f4b29 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1,13 +1,9 @@
- *
* Displays the main calendar page (month view).
*
- * @copyright © 2002-2005 The SquirrelMail Project Team
+ * @copyright © 2002-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
@@ -15,43 +11,31 @@
*/
/**
-*/
-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');
+ * Include the SquirrelMail initialization file.
+ */
+require('../../include/init.php');
-/* get globals */
+/* load date_intl() */
+include_once(SM_PATH . 'functions/date.php');
-// undo rg = on effects
-if (isset($month)) unset($month);
-if (isset($year)) unset($year);
+/* 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']) && is_numeric($_GET['month'])) {
- $month = $_GET['month'];
-}
-if (isset($_GET['year']) && is_numeric($_GET['year'])) {
- $year = $_GET['year'];
-}
-if (isset($_POST['year']) && is_numeric($_POST['year'])) {
- $year = $_POST['year'];
+/* get globals */
+if (! sqgetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) {
+ unset($month);
}
-if (isset($_POST['month']) && is_numeric($_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, $color;
@@ -97,7 +81,11 @@ 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, $color, $calendardata, $todayis;
@@ -124,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;
@@ -139,7 +132,11 @@ 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;