Happy New Year
[squirrelmail.git] / plugins / calendar / day.php
index 58cdcd1abe884222724b80abce24d88c8a1e99b4..983a33174075e812502c2b71be33a61664c75786 100644 (file)
@@ -3,18 +3,18 @@
 /**
  * Displays the day page (day view).
  *
- * @copyright © 2002-2006 The SquirrelMail Project Team
+ * @copyright 2002-2022 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
  * @subpackage calendar
  */
 
-/** @ignore */
-define('SM_PATH','../../');
+/**
+ * Include the SquirrelMail initialization file.
+ */
+require('../../include/init.php');
 
-/* SquirrelMail required files. */
-include_once(SM_PATH . 'include/validate.php');
 /* date_intl() */
 include_once(SM_PATH . 'functions/date.php');
 
@@ -80,8 +80,8 @@ function initialize_events() {
     $cdate = $month . $day . $year;
 
     if (isset($calendardata[$cdate])){
-        while ( $calfoo = each($calendardata[$cdate])){
-            $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
+        foreach ($calendardata[$cdate] as $key => $value){
+            $daily_events[$key] = $calendardata[$cdate][$key];
         }
     }
 }
@@ -96,47 +96,47 @@ function display_events() {
 
     ksort($daily_events,SORT_STRING);
     $eo=0;
-    while ($calfoo = each($daily_events)){
+    foreach ($daily_events as $key => $value) {
         if ($eo==0){
             $eo=4;
         } else {
             $eo=0;
         }
 
-        $ehour = substr($calfoo['key'],0,2);
-        $eminute = substr($calfoo['key'],2,2);
-        if (!is_array($calfoo['value'])){
+        $ehour = substr($key,0,2);
+        $eminute = substr($key,2,2);
+        if (!is_array($value)){
             echo html_tag( 'tr',
                        html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
                        html_tag( 'td', ' ', 'left' ) .
                        html_tag( 'td',
                            "<font size=\"-1\"><a href=\"event_create.php?year=$year&amp;month=$month&amp;day=$day&amp;hour="
-                           .substr($calfoo['key'],0,2)."\">".
+                           .substr($key,0,2)."\">".
                            _("ADD") . "</a></font>" ,
                        'center' ) ,
                    '', $color[$eo]);
 
         } else {
-            $calbar=$calfoo['value'];
+            $calbar=$value;
             if ($calbar['length']!=0){
-                $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar['length'],0,1,1,0));
+                $elength = '-'.date_intl(_("H:i"),mktime($ehour,$eminute+$calbar['length'],0,1,1,0));
             } else {
                 $elength='';
             }
             echo html_tag( 'tr', '', '', $color[$eo] ) .
-                        html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
+                        html_tag( 'td', date_intl(_("H:i"),mktime($ehour,$eminute,0,1,1,0)) . $elength, 'left' ) .
                         html_tag( 'td', '', 'left' ) . '[';
-                            echo ($calbar['priority']==1) ? 
-                                "<font color=\"$color[1]\">".htmlspecialchars($calbar['title']).'</font>' : 
-                                htmlspecialchars($calbar['title']);
-                            echo'] <div style="margin-left:10px">'.nl2br(htmlspecialchars($calbar['message'])).'</div>' .
+                            echo ($calbar['priority']==1) ?
+                                "<font color=\"$color[1]\">".sm_encode_html_special_chars($calbar['title']).'</font>' :
+                                sm_encode_html_special_chars($calbar['title']);
+                            echo'] <div style="margin-left:10px">'.nl2br(sm_encode_html_special_chars($calbar['message'])).'</div>' .
                         html_tag( 'td',
                             "<font size=\"-1\"><nobr>\n" .
                             "<a href=\"event_edit.php?year=$year&amp;month=$month&amp;day=$day&amp;hour=".
-                            substr($calfoo['key'],0,2)."&amp;minute=".substr($calfoo['key'],2,2)."\">".
+                            substr($key,0,2)."&amp;minute=".substr($key,2,2)."\">".
                             _("EDIT") . "</a>&nbsp;|&nbsp;\n" .
                             "<a href=\"event_delete.php?dyear=$year&amp;dmonth=$month&amp;dday=$day&amp;dhour=".
-                            substr($calfoo['key'],0,2)."&amp;dminute=".substr($calfoo['key'],2,2).
+                            substr($key,0,2)."&amp;dminute=".substr($key,2,2).
                             "&amp;year=$year&amp;month=$month&amp;day=$day\">" .
                             _("DEL") . '</a>' .
                             "</nobr></font>\n" ,
@@ -169,7 +169,7 @@ $calself=basename($PHP_SELF);
 
 $daily_events = array();
 
-displayPageHeader($color, 'None');
+displayPageHeader($color);
 calendar_header();
 readcalendardata();
 day_header();
@@ -177,4 +177,4 @@ initialize_events();
 display_events();
 ?>
 </table></td></tr></table>
-</body></html>
\ No newline at end of file
+</body></html>