Getting ready for 1.4.0 RC1
[squirrelmail.git] / plugins / calendar / calendar.php
index fa27c48f201542ef66d4d27c67441413cb5d3efb..4d4d9ba2a031ef792ed8a911460c7931d7676175 100644 (file)
@@ -1,26 +1,47 @@
 <?php
-/*
+
+/**
+ * calendar.php
  *
- *  calendar.php
+ * Copyright (c) 2002-2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
- *  Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
- *  Licensed under the GNU GPL. For full terms see the file COPYING.
+ * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
  *
- *  Displays the main calendar page (month view).
+ * Displays the main calendar page (month view).
  *
  * $Id$
  */
+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');
+
+/* get globals */
 
-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');
-require_once('../functions/html.php');
+if (isset($_GET['month'])) {
+    $month = $_GET['month'];
+}
+if (isset($_GET['year'])) {
+    $year = $_GET['year'];
+}
+if (isset($_POST['year'])) {
+    $year = $_POST['year'];
+}
+if (isset($_POST['month'])) {
+    $month = $_POST['month'];
+}
+/* got 'em */
 
 //display upper part of month calendar view
 function startcalendar() {
@@ -40,19 +61,19 @@ function startcalendar() {
                    html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
                        html_tag( 'tr', "\n".
                             html_tag( 'th',
-                                "<a href=\"$self?year=".($year-1)."&month=$month\">&lt;&lt;&nbsp;".($year-1)."</a>"
+                                "<a href=\"$self?year=".($year-1)."&amp;month=$month\">&lt;&lt;&nbsp;".($year-1)."</a>"
                             ) . "\n".
                             html_tag( 'th',
-                                "<a href=\"$self?year=$prev_year&month=$prev_month\">&lt;&nbsp;" .
+                                "<a href=\"$self?year=$prev_year&amp;month=$prev_month\">&lt;&nbsp;" .
                                 date_intl( 'M', $prev_date). "</a>"
                             ) . "\n".
                             html_tag( 'th', date_intl( 'F Y', $act_date ), '', $color[0], 'colspan="3"') .
                             html_tag( 'th',
-                                "<a href=\"$self?year=$next_year&month=$next_month\">" .
+                                "<a href=\"$self?year=$next_year&amp;month=$next_month\">" .
                                 date_intl( 'M', $next_date) . "&nbsp;&gt;</a>"
                             ) . "\n".
                             html_tag( 'th',
-                                "<a href=\"$self?year=".($year+1)."&month=$month\">".($year+1)."&nbsp;&gt;&gt;</a>"
+                                "<a href=\"$self?year=".($year+1)."&amp;month=$month\">".($year+1)."&nbsp;&gt;&gt;</a>"
                             )
                        ) . "\n".
                        html_tag( 'tr',
@@ -84,7 +105,7 @@ function drawmonthview() {
                 echo html_tag( 'td', '', 'left', $color[4], 'height="50" valign="top"' ) ."\n".
                      html_tag( 'div', '', 'right' );
                 echo(($cdate==$todayis) ? "<font size=-1 color=$color[1]>[ " . _("TODAY") . " ] " : "<font size=-1>");
-                echo "<a href=day.php?year=$year&month=$month&day=";
+                echo "<a href=day.php?year=$year&amp;month=$month&amp;day=";
                 echo(($aday<10) ? "0" : "");
                 echo "$aday>$aday</a></font></div>";
             } else {
@@ -95,7 +116,7 @@ function drawmonthview() {
                 $i=0;
                 while ($calfoo = each($calendardata[$cdate])) {
                     $calbar = $calendardata[$cdate][$calfoo['key']];
-                    echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT><br>\n" : "$calbar[title]<br>\n";
+                    echo ($calbar['priority']==1) ? "<a href=\"#\" style=\"text-decoration:none; color: $color[1]\" title=\"$calbar[message]\">$calbar[title]</a><br>\n" : "<a href=\"#\" style=\"text-decoration:none; color: $color[6]\" title=\"$calbar[message]\">$calbar[title]</a><br>\n";
                     $i=$i+1;
                     if($i==2){
                         break;
@@ -150,4 +171,4 @@ drawmonthview();
 endcalendar();
 
 ?>
-</body></html>
\ No newline at end of file
+</body></html>