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)  

event_edit.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 /* form functions */
21 include_once(SM_PATH . 'functions/forms.php');
22 
23 /* Calendar plugin required files. */
24 include_once(SM_PATH . 'plugins/calendar/calendar_data.php');
25 include_once(SM_PATH . 'plugins/calendar/functions.php');
26 
27 /* get globals */
28 
29 sqGetGlobalVar('updated',$updated,SQ_POST);
30 
31 /* get date values and make sure that they are numeric */
32 if (! sqGetGlobalVar('event_year',$event_year,SQ_POST) || ! is_numeric($event_year)) {
33  unset($event_year);
34 }
35 if (! sqGetGlobalVar('event_month',$event_month,SQ_POST) || ! is_numeric($event_month)) {
36  unset($event_month);
37 }
38 if (! sqGetGlobalVar('event_day',$event_day,SQ_POST) || ! is_numeric($event_day)) {
39  unset($event_day);
40 }
41 if (! sqGetGlobalVar('event_hour',$event_hour,SQ_POST) || ! is_numeric($event_hour)) {
42  unset($event_hour);
43 }
44 if (! sqGetGlobalVar('event_minute',$event_minute,SQ_POST) || ! is_numeric($event_minute)) {
45  unset($event_minute);
46 }
47 if (! sqGetGlobalVar('event_length',$event_length,SQ_POST) || ! is_numeric($event_length)) {
48  unset($event_length);
49 }
50 sqGetGlobalVar('event_title',$event_title,SQ_POST);
51 sqGetGlobalVar('event_text',$event_text,SQ_POST);
52 sqGetGlobalVar('send',$send,SQ_POST);
53 
54 if (! sqGetGlobalVar('event_priority',$event_priority,SQ_POST) || ! is_numeric($event_priority)) {
55  unset($event_priority);
56 }
57 
58 sqGetGlobalVar('confirmed',$confirmed,SQ_POST);
59 
60 if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) {
61  unset($year);
62 }
63 if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) {
64  unset($month);
65 }
66 if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) {
67  unset($day);
68 }
69 if (! sqGetGlobalVar('hour',$hour,SQ_FORM) || ! is_numeric($hour)) {
70  unset($hour);
71 }
72 if (! sqGetGlobalVar('minute',$minute,SQ_FORM) || ! is_numeric($minute)) {
73  unset($minute);
74 }
75 /* got 'em */
76 
82 function update_event_form() {
83  global $color, $editor_size, $year, $day, $month, $hour, $minute, $calendardata;
84 
85  $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
86  $tab = ' ';
87  echo "\n<form name=\"eventupdate\" action=\"event_edit.php\" method=\"post\">\n".
88  $tab . addHidden('year',$year).
89  $tab . addHidden('month',$month).
90  $tab . addHidden('day',$day).
91  $tab . addHidden('hour',$hour).
92  $tab . addHidden('minute',$minute).
93  $tab . addHidden('updated','yes').
94  html_tag( 'tr' ) .
95  html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
96  html_tag( 'td', '', 'left', $color[4] ) .
97  " <select name=\"event_year\">\n";
98  select_option_year($year);
99  echo " </select>\n" .
100  " &nbsp;&nbsp;\n" .
101  " <select name=\"event_month\">\n";
102  select_option_month($month);
103  echo " </select>\n".
104  " &nbsp;&nbsp;\n".
105  " <select name=\"event_day\">\n";
106  select_option_day($day);
107  echo " </select>\n".
108  " </td></tr>\n".
109  html_tag( 'tr' ) .
110  html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
111  html_tag( 'td', '', 'left', $color[4] ) .
112  " <select name=\"event_hour\">\n";
113  select_option_hour($hour);
114  echo " </select>\n".
115  " &nbsp;:&nbsp;\n".
116  " <select name=\"event_minute\">\n";
117  select_option_minute($minute);
118  echo " </select>\n".
119  " </td></tr>\n".
120  html_tag( 'tr' ) .
121  html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
122  html_tag( 'td', '', 'left', $color[4] ) .
123  " <select name=\"event_length\">\n";
124  select_option_length($tmparray['length']);
125  echo " </select>\n".
126  " </td></tr>\n".
127  html_tag( 'tr' ) .
128  html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
129  html_tag( 'td', '', 'left', $color[4] ) .
130  " <select name=\"event_priority\">\n";
131  select_option_priority($tmparray['priority']);
132  echo " </select>\n".
133  " </td></tr>\n".
134  html_tag( 'tr' ) .
135  html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
136  html_tag( 'td', addInput('event_title',$tmparray['title'],30,50), 'left', $color[4]) .
137  "\n</tr>\n".
138  html_tag( 'tr' ) .
139  html_tag( 'td', addTextArea('event_text',$tmparray['message'],$editor_size,5),
140  'left', $color[4], 'colspan="2"' ) .
141  '</tr>' . html_tag( 'tr' ) .
142  html_tag( 'td', addSubmit(_("Update Event"),'send'), 'left', $color[4], 'colspan="2"' ) .
143  "</tr></form>\n";
144 }
145 
151 function confirm_update() {
152  global $calself, $year, $month, $day, $hour, $minute, $calendardata,
153  $color, $event_year, $event_month, $event_day, $event_hour,
154  $event_minute, $event_length, $event_priority, $event_title, $event_text;
155 
156  $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
157  $tab = ' ';
158 
159  echo html_tag( 'table',
160  html_tag( 'tr',
161  html_tag( 'th', _("Do you really want to change this event from:") . "<br />\n", '', $color[4], 'colspan="2"' ) ."\n"
162  ) .
163  html_tag( 'tr',
164  html_tag( 'td', _("Date:") , 'right', $color[4] ) ."\n" .
165  html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$month,$day,$year)), 'left', $color[4] ) ."\n"
166  ) .
167  html_tag( 'tr',
168  html_tag( 'td', _("Time:") , 'right', $color[4] ) ."\n" .
169  html_tag( 'td', date_intl(_("H:i"),mktime($hour,$minute,0,$month,$day,$year)) , 'left', $color[4] ) ."\n"
170  ) .
171  html_tag( 'tr',
172  html_tag( 'td', _("Priority:") , 'right', $color[4] ) ."\n" .
173  html_tag( 'td', $tmparray['priority'] , 'left', $color[4] ) ."\n"
174  ) .
175  html_tag( 'tr',
176  html_tag( 'td', _("Title:") , 'right', $color[4] ) ."\n" .
177  html_tag( 'td', htmlspecialchars($tmparray['title']) , 'left', $color[4] ) ."\n"
178  ) .
179  html_tag( 'tr',
180  html_tag( 'td', _("Message:") , 'right', $color[4] ) ."\n" .
181  html_tag( 'td', nl2br(htmlspecialchars($tmparray['message'])) , 'left', $color[4] ) ."\n"
182  ) .
183  html_tag( 'tr',
184  html_tag( 'th', _("to:") . "<br />\n", '', $color[4], 'colspan="2"' ) ."\n"
185  ) .
186 
187  html_tag( 'tr',
188  html_tag( 'td', _("Date:") , 'right', $color[4] ) ."\n" .
189  html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$event_month,$event_day,$event_year)), 'left', $color[4] ) ."\n"
190  ) .
191  html_tag( 'tr',
192  html_tag( 'td', _("Time:") , 'right', $color[4] ) ."\n" .
193  html_tag( 'td', date_intl(_("H:i"),mktime($event_hour,$event_minute,0,$event_month,$event_day,$event_year)), 'left', $color[4] ) ."\n"
194  ) .
195  html_tag( 'tr',
196  html_tag( 'td', _("Priority:") , 'right', $color[4] ) ."\n" .
197  html_tag( 'td', $event_priority , 'left', $color[4] ) ."\n"
198  ) .
199  html_tag( 'tr',
200  html_tag( 'td', _("Title:") , 'right', $color[4] ) ."\n" .
201  html_tag( 'td', htmlspecialchars($event_title) , 'left', $color[4] ) ."\n"
202  ) .
203  html_tag( 'tr',
204  html_tag( 'td', _("Message:") , 'right', $color[4] ) ."\n" .
205  html_tag( 'td', nl2br(htmlspecialchars($event_text)) , 'left', $color[4] ) ."\n"
206  ) .
207  html_tag( 'tr',
208  html_tag( 'td',
209  "<form name=\"updateevent\" method=\"post\" action=\"$calself\">\n".
210  $tab . addHidden('year',$year).
211  $tab . addHidden('month',$month).
212  $tab . addHidden('day',$day).
213  $tab . addHidden('hour',$hour).
214  $tab . addHidden('minute',$minute).
215  $tab . addHidden('event_year',$event_year).
216  $tab . addHidden('event_month',$event_month).
217  $tab . addHidden('event_day',$event_day).
218  $tab . addHidden('event_hour',$event_hour).
219  $tab . addHidden('event_minute',$event_minute).
220  $tab . addHidden('event_priority',$event_priority).
221  $tab . addHidden('event_length',$event_length).
222  $tab . addHidden('event_title',$event_title).
223  $tab . addHidden('event_text',$event_text).
224  $tab . addHidden('updated','yes').
225  $tab . addHidden('confirmed','yes').
226  $tab . addSubmit(_("Yes")).
227  "</form>\n" ,
228  'right', $color[4] ) ."\n" .
229  html_tag( 'td',
230  "<form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n".
231  $tab . addHidden('year',$year).
232  $tab . addHidden('month',$month).
233  $tab . addHidden('day',$day).
234  $tab . addSubmit(_("No")).
235  "</form>\n" ,
236  'left', $color[4] ) ."\n"
237  ) ,
238  '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
239 }
240 
241 if ($month <= 0){
242  $month = date( 'm' );
243 }
244 if ($year <= 0){
245  $year = date( 'Y' );
246 }
247 if ($day <= 0){
248  $day = date( 'd' );
249 }
250 if ($hour <= 0){
251  $hour = '08';
252 }
253 
254 $calself=basename($PHP_SELF);
255 
256 displayPageHeader($color, 'None');
257 //load calendar menu
259 
260 echo html_tag( 'tr', '', '', $color[0] ) .
261  html_tag( 'td', '', 'left' ) .
262  html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
263  html_tag( 'tr' ) .
264  html_tag( 'td',
265  date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
266  'left', '', 'colspan="2"' );
267 if (!isset($updated)){
268  //get changes to event
271 } else {
272  if (!isset($confirmed)){
273  //confirm changes
275  confirm_update();
276  } else {
277  update_event("$month$day$year", "$hour$minute");
278  echo html_tag( 'tr',
279  html_tag( 'td', _("Event updated!"), 'left' )
280  ) . "\n";
281  echo html_tag( 'tr',
282  html_tag( 'td',
283  "<a href=\"day.php?year=$year&amp;month=$month&amp;day=$day\">" .
284  _("Day View") ."</a>",
285  'left' )
286  ) . "\n";
287 
288  $fixdate = date( 'mdY', mktime(0, 0, 0, $event_month, $event_day, $event_year));
289  //if event has been moved to different year then act accordingly
290  if ($year==$event_year){
291  $calendardata["$fixdate"]["$event_hour$event_minute"] = array('length' => $event_length,
292  'priority' => $event_priority,
293  'title' => $event_title,
294  'message' => $event_text);
296  } else {
298  $year=$event_year;
299  $calendardata = array();
301  $calendardata["$fixdate"]["$event_hour$event_minute"] = array('length' => $event_length,
302  'priority' => $event_priority,
303  'title' => $event_title,
304  'message' => $event_text);
306  }
307  }
308 }
309 
310 ?>
311 </table></td></tr></table>
312 </body></html>
writecalendardata
writecalendardata()
Definition: calendar_data.php:100
update_event_form
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)) if(! sqGetGlobalVar('hour', $hour, SQ_FORM)||! is_numeric($hour)) if(! sqGetGlobalVar('minute', $minute, SQ_FORM)||! is_numeric($minute)) update_event_form()
Definition: event_edit.php:82
html_tag
html_tag( $tag, $val='', $align='', $bgcolor='', $xtra='')
Definition: html.php:27
addTextArea
addTextArea($name, $text='', $cols=40, $rows=10, $attr='')
Definition: forms.php:125
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
html
Definition: html.class.php:18
date_intl
date_intl( $date_format, $stamp)
Definition: date.php:286
addInput
addInput($name, $value='', $size=0, $maxlength=0, $extra_attributes='')
Definition: forms.php:65
$calendardata
$calendardata
Definition: calendar_data.php:18
select_option_minute
select_option_minute($selected)
Definition: functions.php:74
select_option_month
select_option_month($selected)
Definition: functions.php:160
select_option_length
select_option_length($selected)
Definition: functions.php:41
select_option_day
select_option_day($selected)
Definition: functions.php:180
$PHP_SELF
$PHP_SELF
Definition: strings.php:1458
update_event
update_event($date, $time)
Definition: calendar_data.php:164
select_option_priority
select_option_priority($selected)
Definition: functions.php:122
addSubmit
addSubmit($value, $name=null, $extra_attributes='')
Definition: forms.php:112
select_option_hour
select_option_hour($selected)
Definition: functions.php:105
addHidden
addHidden($name, $value)
Definition: forms.php:58
SM_PATH
const SM_PATH
Definition: event_edit.php:14
SQ_POST
const SQ_POST
Definition: global.php:17
$editor_size
if($left_size=='') $editor_size
Definition: load_prefs.php:144
calendar_header
calendar_header()
Definition: functions.php:17
_
_($str)
Definition: gettext.php:160
readcalendardata
readcalendardata()
Definition: calendar_data.php:67
select_option_year
select_option_year($selected)
Definition: functions.php:144
$calself
if($month<=0) if($year<=0) if($day<=0) if($hour<=0) $calself
Definition: event_edit.php:254
SQ_FORM
const SQ_FORM
Definition: global.php:21
$color
$color
Definition: load_prefs.php:28
confirm_update
confirm_update()
Definition: event_edit.php:151