squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

day.php
Go to the documentation of this file.
1 <?php
2 
14 define('SM_PATH','../../');
15 
16 /* SquirrelMail required files. */
17 include_once(SM_PATH . 'include/validate.php');
18 /* date_intl() */
19 include_once(SM_PATH . 'functions/date.php');
20 
21 /* Calendar plugin required files. */
22 include_once(SM_PATH . 'plugins/calendar/calendar_data.php');
23 include_once(SM_PATH . 'plugins/calendar/functions.php');
24 
25 /* get globals */
26 if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) {
27  unset($year);
28 }
29 if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) {
30  unset($month);
31 }
32 if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) {
33  unset($day);
34 }
35 /* got 'em */
36 
42 function day_header() {
43  global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
45 
46  echo html_tag( 'tr', '', '', $color[0] ) . "\n".
47  html_tag( 'td', '', 'left' ) .
48  html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
49  html_tag( 'tr',
50  html_tag( 'th',
51  "<a href=\"day.php?year=$prev_year&amp;month=$prev_month&amp;day=$prev_day\">&lt;&nbsp;".
52  date_intl('D',$prev_date)."</a>",
53  'left' ) .
54  html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
55  '', '', 'width="75%"' ) .
56  html_tag( 'th',
57  "<a href=\"day.php?year=$next_year&amp;month=$next_month&amp;day=$next_day\">".
58  date_intl('D',$next_date)."&nbsp;&gt;</a>" ,
59  'right' )
60  );
61 }
62 
68 function initialize_events() {
69  global $daily_events, $calendardata, $month, $day, $year;
70 
71  for ($i=7;$i<23;$i++){
72  if ($i<10){
73  $evntime = '0' . $i . '00';
74  } else {
75  $evntime = $i . '00';
76  }
77  $daily_events[$evntime] = 'empty';
78  }
79 
80  $cdate = $month . $day . $year;
81 
82  if (isset($calendardata[$cdate])){
83  while ( $calfoo = each($calendardata[$cdate])){
84  $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
85  }
86  }
87 }
88 
94 function display_events() {
95  global $daily_events, $month, $day, $year, $color;
96 
97  ksort($daily_events,SORT_STRING);
98  $eo=0;
99  while ($calfoo = each($daily_events)){
100  if ($eo==0){
101  $eo=4;
102  } else {
103  $eo=0;
104  }
105 
106  $ehour = substr($calfoo['key'],0,2);
107  $eminute = substr($calfoo['key'],2,2);
108  if (!is_array($calfoo['value'])){
109  echo html_tag( 'tr',
110  html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
111  html_tag( 'td', '&nbsp;', 'left' ) .
112  html_tag( 'td',
113  "<font size=\"-1\"><a href=\"event_create.php?year=$year&amp;month=$month&amp;day=$day&amp;hour="
114  .substr($calfoo['key'],0,2)."\">".
115  _("ADD") . "</a></font>" ,
116  'center' ) ,
117  '', $color[$eo]);
118 
119  } else {
120  $calbar=$calfoo['value'];
121  if ($calbar['length']!=0){
122  $elength = '-'.date_intl(_("H:i"),mktime($ehour,$eminute+$calbar['length'],0,1,1,0));
123  } else {
124  $elength='';
125  }
126  echo html_tag( 'tr', '', '', $color[$eo] ) .
127  html_tag( 'td', date_intl(_("H:i"),mktime($ehour,$eminute,0,1,1,0)) . $elength, 'left' ) .
128  html_tag( 'td', '', 'left' ) . '[';
129  echo ($calbar['priority']==1) ?
130  "<font color=\"$color[1]\">".htmlspecialchars($calbar['title']).'</font>' :
131  htmlspecialchars($calbar['title']);
132  echo'] <div style="margin-left:10px">'.nl2br(htmlspecialchars($calbar['message'])).'</div>' .
133  html_tag( 'td',
134  "<font size=\"-1\"><nobr>\n" .
135  "<a href=\"event_edit.php?year=$year&amp;month=$month&amp;day=$day&amp;hour=".
136  substr($calfoo['key'],0,2)."&amp;minute=".substr($calfoo['key'],2,2)."\">".
137  _("EDIT") . "</a>&nbsp;|&nbsp;\n" .
138  "<a href=\"event_delete.php?dyear=$year&amp;dmonth=$month&amp;dday=$day&amp;dhour=".
139  substr($calfoo['key'],0,2)."&amp;dminute=".substr($calfoo['key'],2,2).
140  "&amp;year=$year&amp;month=$month&amp;day=$day\">" .
141  _("DEL") . '</a>' .
142  "</nobr></font>\n" ,
143  'center' );
144  }
145  }
146 }
147 /* end of day functions */
148 
149 if ($month <= 0){
150  $month = date( 'm');
151 }
152 if ($year <= 0){
153  $year = date( 'Y');
154 }
155 if ($day <= 0){
156  $day = date( 'd');
157 }
158 
159 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
160 $next_date = mktime(0, 0, 0, $month , $day + 1, $year);
161 $prev_day = date ('d',$prev_date);
162 $prev_month = date ('m',$prev_date);
163 $prev_year = date ('Y',$prev_date);
164 $next_day = date ('d',$next_date);
165 $next_month = date ('m',$next_date);
166 $next_year = date ('Y',$next_date);
167 
168 $calself=basename($PHP_SELF);
169 
170 $daily_events = array();
171 
172 displayPageHeader($color, 'None');
175 day_header();
178 ?>
179 </table></td></tr></table>
180 </body></html>
$prev_day
$prev_day
Definition: day.php:161
html_tag
html_tag( $tag, $val='', $align='', $bgcolor='', $xtra='')
Definition: html.php:27
$prev_date
if($month<=0) if($year<=0) if($day<=0) $prev_date
Definition: day.php:159
$prev_month
$prev_month
Definition: day.php:162
day_header
if(! sqGetGlobalVar('year', $year, SQ_FORM)||! is_numeric($year)) if(! sqGetGlobalVar('month', $month, SQ_FORM)||! is_numeric($month)) if(! sqGetGlobalVar('day', $day, SQ_FORM)||! is_numeric($day)) day_header()
Definition: day.php:42
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
html
Definition: html.class.php:18
$next_day
$next_day
Definition: day.php:164
date_intl
date_intl( $date_format, $stamp)
Definition: date.php:286
$calendardata
$calendardata
Definition: calendar_data.php:18
$PHP_SELF
$PHP_SELF
Definition: strings.php:1458
$daily_events
$daily_events
Definition: day.php:170
initialize_events
initialize_events()
Definition: day.php:68
$next_month
$next_month
Definition: day.php:165
calendar_header
calendar_header()
Definition: functions.php:17
_
_($str)
Definition: gettext.php:160
SM_PATH
const SM_PATH
Definition: day.php:14
display_events
display_events()
Definition: day.php:94
$prev_year
$prev_year
Definition: day.php:163
readcalendardata
readcalendardata()
Definition: calendar_data.php:67
SQ_FORM
const SQ_FORM
Definition: global.php:21
$color
$color
Definition: load_prefs.php:28
$calself
$calself
Definition: day.php:168
$next_date
$next_date
Definition: day.php:160
$next_year
$next_year
Definition: day.php:166