Completed
Branch master (c3ca5f)
by Seth
04:51
created
phpicalendar/functions/template.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 			$filelist = availableCalendars('', '', '', true);
25 25
 			foreach ($filelist as $file) {
26 26
 				if ($column > $COLUMNS_TO_PRINT) {
27
-					$delete_table 	.= '</tr>';
28
-					$column 	= 1;
27
+					$delete_table .= '</tr>';
28
+					$column = 1;
29 29
 				}
30 30
 				if ($column == 1) {
31 31
 					$delete_table .= '<tr>';
@@ -59,35 +59,35 @@  discard block
 block discarded – undo
59 59
 		preg_match('!<\!-- loop events on -->(.*)<\!-- loop events off -->!Uis', $this->page, $match1);
60 60
 		preg_match('!<\!-- switch some_events on -->(.*)<\!-- loop events on -->!Uis', $this->page, $match3);
61 61
 		$loop_event		= trim($match1[1]);
62
-		$loop_day 		= trim($match3[1]);
63
-		$parse_month 	= date ('Ym', strtotime($getdate));
64
-		$parse_year 	= date ('Y', strtotime($getdate));
62
+		$loop_day = trim($match3[1]);
63
+		$parse_month = date('Ym', strtotime($getdate));
64
+		$parse_year 	= date('Y', strtotime($getdate));
65 65
 
66 66
 		$seen_events = array();
67 67
 		$final = '';
68 68
 		$events_week = 0;
69
-		foreach($master_array as $key => $val) {
70
-			preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs);
71
-			if (((@$regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr(@$regs[1],0,4) == $parse_year) && ($printview == 'year'))) {
69
+		foreach ($master_array as $key => $val) {
70
+			preg_match('/([0-9]{6})([0-9]{2})/', $key, $regs);
71
+			if (((@$regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr(@$regs[1], 0, 4) == $parse_year) && ($printview == 'year'))) {
72 72
 				$events_week++;
73
-				$dayofmonth = strtotime ($key);
74
-				$dayofmonth = localizeDate ($dateFormat_day, $dayofmonth);
73
+				$dayofmonth = strtotime($key);
74
+				$dayofmonth = localizeDate($dateFormat_day, $dayofmonth);
75 75
 				$events_tmp = $loop_event;
76
-				$day_tmp	= $loop_day;
76
+				$day_tmp = $loop_day;
77 77
 				$day_events = 0;
78 78
 				// Pull out each day
79 79
 				$some_events = '';
80 80
 				foreach ($val as $cal_time => $new_val) {
81 81
 					foreach ($new_val as $new_key2 => $new_val2) {
82
-						if (isset($seen_events[$new_key2]) && isset($new_val2['spans_day']) && $new_val2['spans_day'] == 1){
82
+						if (isset($seen_events[$new_key2]) && isset($new_val2['spans_day']) && $new_val2['spans_day'] == 1) {
83 83
 							$new_val2['event_text'] .= ' second instance of '.$new_key2;
84 84
 							continue;
85 85
 						}
86 86
 						$seen_events[$new_key2] = 1;
87 87
 						$day_events++;
88 88
 						if (isset($new_val2['event_text'])) {
89
-							$event_text 	= sanitizeForWeb(stripslashes(urldecode($new_val2['event_text'])));
90
-							$location 		= sanitizeForWeb(stripslashes(urldecode($new_val2['location'])));
89
+							$event_text = sanitizeForWeb(stripslashes(urldecode($new_val2['event_text'])));
90
+							$location = sanitizeForWeb(stripslashes(urldecode($new_val2['location'])));
91 91
 							$description 	= sanitizeForWeb(stripslashes(urldecode($new_val2['description'])));
92 92
 							if (!empty($description)) {
93 93
 								$description = ereg_replace('(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&amp;)+[[:alnum:]/])', '<a target="_new" href="\2">\2</a>', $description);
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 							}
96 96
 
97 97
 							$event_start 	= $new_val2['event_start'];
98
-							$event_end 		= $new_val2['event_end'];
98
+							$event_end = $new_val2['event_end'];
99 99
 							if (isset($new_val2['display_end'])) $event_end = $new_val2['display_end'];
100 100
 							if ($cal_time == -1) {
101 101
 								$event_start = $lang['l_all_day'];
102 102
 								$event_start2 = '';
103 103
 								$event_end = '';
104 104
 							} else {
105
-								$event_start 	= date ($timeFormat, strtotime ($event_start));
106
-								$event_end 		= date ($timeFormat, strtotime ($event_end));
107
-								$event_start 	= $event_start .' - '.$event_end;
105
+								$event_start 	= date($timeFormat, strtotime($event_start));
106
+								$event_end = date($timeFormat, strtotime($event_end));
107
+								$event_start 	= $event_start.' - '.$event_end;
108 108
 								if (date('Ymd', $new_val2['start_unixtime']) != date('Ymd', $new_val2['end_unixtime'])) $event_start .= ' '.localizeDate($dateFormat_day, $new_val2['end_unixtime']);
109 109
 							}
110 110
 						}
@@ -149,34 +149,34 @@  discard block
 block discarded – undo
149 149
 		$loop_event		= trim($match1[1]);
150 150
 		$loop_recur 	= trim($match2[1]);
151 151
 		$loop_except 	= trim($match3[1]);
152
-		$parse_month 	= date ('Ym', strtotime($getdate));
152
+		$parse_month 	= date('Ym', strtotime($getdate));
153 153
 
154 154
 		$events_found = 0;
155 155
 		$some_events = '';
156 156
 		$final = '';
157
-		if (isset($the_arr)){
157
+		if (isset($the_arr)) {
158 158
 			// Pull out each event
159
-			foreach($the_arr as $key => $val) {
159
+			foreach ($the_arr as $key => $val) {
160 160
 				$events_found++;
161 161
 				$dayofmonth = strtotime($val['date']);
162
-				$dayofmonth = localizeDate ('%A, %B %e %Y', $dayofmonth);
162
+				$dayofmonth = localizeDate('%A, %B %e %Y', $dayofmonth);
163 163
 				$events_tmp = $loop_event;
164
-				$recur_tmp	= $loop_recur;
164
+				$recur_tmp = $loop_recur;
165 165
 				if ($val['event_text']) {
166
-					$event_text 	= sanitizeForWeb(stripslashes(urldecode($val['event_text'])));
166
+					$event_text = sanitizeForWeb(stripslashes(urldecode($val['event_text'])));
167 167
 					$description 	= sanitizeForWeb(stripslashes(urldecode($val['description'])));
168
-					$location 		= sanitizeForWeb(stripslashes(urldecode($val['location'])));
168
+					$location = sanitizeForWeb(stripslashes(urldecode($val['location'])));
169 169
 					$event_start 	= $val['event_start'];
170
-					$event_end 		= $val['event_end'];
170
+					$event_end = $val['event_end'];
171 171
 					if (isset($val['display_end'])) $event_end = $val['display_end'];
172 172
 					if (!$val['event_start']) {
173 173
 						$event_start = $lang['l_all_day'];
174 174
 						$event_start2 = '';
175 175
 						$event_end = '';
176 176
 					} else {
177
-							$event_start    = date ($timeFormat, strtotime ($event_start));
178
-							$event_end      = date ($timeFormat, strtotime ($event_end));
179
-							$event_start    = $event_start .' - '.$event_end;
177
+							$event_start    = date($timeFormat, strtotime($event_start));
178
+							$event_end      = date($timeFormat, strtotime($event_end));
179
+							$event_start    = $event_start.' - '.$event_end;
180 180
 					}
181 181
 				}
182 182
 
@@ -185,41 +185,41 @@  discard block
 block discarded – undo
185 185
 				}
186 186
 					if (!isset($val['exceptions'])) {
187 187
 					$events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', '', $events_tmp);
188
-				}else{
188
+				} else {
189 189
 					$some_exceptions = '';
190
-					foreach ($val['exceptions'] as $except_val){
191
-						$except_tmp	= $loop_except;
190
+					foreach ($val['exceptions'] as $except_val) {
191
+						$except_tmp = $loop_except;
192 192
 
193 193
 						$except_date = strtotime($except_val['date']);
194
-						$except_date = localizeDate ('%A, %B %e %Y', $except_date);
194
+						$except_date = localizeDate('%A, %B %e %Y', $except_date);
195 195
 						$except_tmp = str_replace('{DAYOFMONTH}', $except_date, $except_tmp);
196 196
 
197
-						$except_event_start    	= date ($timeFormat, strtotime ($except_val['event_start']));
198
-						$except_event_end    	= date ($timeFormat, strtotime ($except_val['event_end']));
199
-						$except_event_start    	= $except_event_start .' - '.$except_event_end;
197
+						$except_event_start    	= date($timeFormat, strtotime($except_val['event_start']));
198
+						$except_event_end = date($timeFormat, strtotime($except_val['event_end']));
199
+						$except_event_start    	= $except_event_start.' - '.$except_event_end;
200 200
 
201 201
 						$except_tmp = str_replace('{EVENT_START}', $except_event_start, $except_tmp);
202 202
 
203
-						$except_event_text 	= sanitizeForWeb(stripslashes(urldecode($except_val['event_text'])));
203
+						$except_event_text = sanitizeForWeb(stripslashes(urldecode($except_val['event_text'])));
204 204
 						$except_tmp = str_replace('{EVENT_TEXT}', $except_event_text, $except_tmp);
205 205
 
206 206
 						#is there a recur in the exception?
207 207
 						if (!$except_val['recur']) {
208 208
 							$except_tmp = preg_replace('!<\!-- switch except_recur on -->.*<\!-- switch except_recur off -->!Uis', '', $except_tmp);
209
-						}else{
209
+						} else {
210 210
 							$except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp);
211 211
 						}
212 212
 						#is there a description in the exception?
213 213
 						if (!$except_val['description']) {
214 214
 							$except_tmp = preg_replace('!<\!-- switch except_description on -->.*<\!-- switch except_description off -->!Uis', '', $except_tmp);
215
-						}else{
215
+						} else {
216 216
 							$except_description = stripslashes(urldecode($except_val['description']));
217 217
 							$except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp);
218 218
 						}
219 219
 						$some_exceptions .= $except_tmp;
220 220
 
221 221
 					}
222
-					$events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', $some_exceptions,$events_tmp );
222
+					$events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', $some_exceptions, $events_tmp);
223 223
 
224 224
 
225 225
 				}
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 				if (!$val['recur']) {
228 228
 					$events_tmp = preg_replace('!<\!-- switch recur on -->.*<\!-- switch recur off -->!Uis', '', $events_tmp);
229 229
 					$events_tmp = str_replace('{L_STARTING_ON}', '', $events_tmp);
230
-				}else{
230
+				} else {
231 231
 					$events_tmp = str_replace('{RECUR}', $val['recur'], $events_tmp);
232 232
 				}
233 233
 
234
-				$search		= array('{EVENT_START}', '{EVENT_TEXT}', '{DESCRIPTION}','{LOCATION}');
234
+				$search		= array('{EVENT_START}', '{EVENT_TEXT}', '{DESCRIPTION}', '{LOCATION}');
235 235
 				$replace	= array($event_start, $event_text, $description, $location);
236 236
 				$events_tmp = str_replace($search, $replace, $events_tmp);
237 237
 				$some_events .= $events_tmp;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 				$some_events  = str_replace('{KEY}', $val['date'], $some_events);
242 242
 				$some_events  = str_replace('{DAYOFMONTH}', $dayofmonth, $some_events);
243
-				$final   .= $some_events;
243
+				$final .= $some_events;
244 244
 				$some_events = '';
245 245
 
246 246
 			}
@@ -259,24 +259,24 @@  discard block
 block discarded – undo
259 259
 		global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat;
260 260
 
261 261
 		// Figure out colspans and initialize weekarray
262
-		$thisdate  	= $start_week_time;
263
-		$swt	   	= $start_week_time;
264
-		for ($i=0;$i < $phpiCal_config->week_length;$i++) {
262
+		$thisdate = $start_week_time;
263
+		$swt = $start_week_time;
264
+		for ($i = 0; $i < $phpiCal_config->week_length; $i++) {
265 265
 			$thisday = date('Ymd', $thisdate);
266 266
 			$nbrGridCols[$thisday] = 1;
267 267
 			if (isset($master_array[$thisday])) {
268
-				foreach($master_array[($thisday)] as $ovlKey => $ovlValue) {
268
+				foreach ($master_array[($thisday)] as $ovlKey => $ovlValue) {
269 269
 					# ovlKey is a time slot; $ovlValue is an array with key=uid
270 270
 					if ($ovlKey != '-1') {
271
-						foreach($ovlValue as $ovl2Value) {
271
+						foreach ($ovlValue as $ovl2Value) {
272 272
 							$nbrGridCols[$thisday] = kgv($nbrGridCols[$thisday], ($ovl2Value['event_overlap'] + 1));
273 273
 						}
274 274
 					}
275 275
 				}
276 276
 			}
277
-			$weekarray[$i] 		= $thisday;
278
-			$event_length[$thisday] = array ();
279
-			$thisdate = ($thisdate + (25 * 60 * 60));
277
+			$weekarray[$i] = $thisday;
278
+			$event_length[$thisday] = array();
279
+			$thisdate = ($thisdate + (25*60*60));
280 280
 		}
281 281
 		#echo "<pre>";print_r($nbrGridCols);
282 282
 		// Replaces the allday events
@@ -285,58 +285,58 @@  discard block
 block discarded – undo
285 285
 		preg_match('!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis', $this->page, $match1);
286 286
 		preg_match('!<\!-- loop alldaysofweek on -->(.*)<\!-- loop allday on -->!Uis', $this->page, $match2);
287 287
 		preg_match('!<\!-- loop allday off -->(.*)<\!-- loop alldaysofweek off -->!Uis', $this->page, $match3);
288
-		$loop_ad 	= trim($match1[1]); # one day cell
288
+		$loop_ad = trim($match1[1]); # one day cell
289 289
 		$loop_begin = trim($match2[1]); # <td>
290
-		$loop_end 	= trim($match3[1]); # </td>
290
+		$loop_end = trim($match3[1]); # </td>
291 291
 		preg_match('!<\!-- loop alldaysofweek off -->(.*)<\!-- loop allday row off -->!Uis', $this->page, $match3);
292
-		$loop_row_end 	= trim($match3[1]); # </tr>
292
+		$loop_row_end = trim($match3[1]); # </tr>
293 293
 		$allday_uids = array();
294 294
 		$allday_uid_dates = array();
295 295
 		$weekreplace = '';
296
-		foreach ($weekarray as $i=>$get_date){
297
-			if (isset($master_array[$get_date]['-1']) && is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1'])){
298
-				foreach ($master_array[$get_date]['-1'] as $uid => $allday){
296
+		foreach ($weekarray as $i=>$get_date) {
297
+			if (isset($master_array[$get_date]['-1']) && is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1'])) {
298
+				foreach ($master_array[$get_date]['-1'] as $uid => $allday) {
299 299
 					if (!array_key_exists($uid, $allday_uids)) $allday_uids[$uid] = $get_date;
300 300
 					$allday_uid_dates[$uid][] = $get_date;
301 301
 				}
302 302
 			}
303 303
 		}
304 304
 		# new allday routine is better for multiday events
305
-		while(!empty($allday_uids)){
305
+		while (!empty($allday_uids)) {
306 306
 			$row = $loop_row_begin;
307 307
 			$day = 0;
308 308
 			$replace = '';
309
-			while ($day < $phpiCal_config->week_length){
310
-				$colspan  = 0;
311
-				$replace  .= $loop_begin; # <td>
309
+			while ($day < $phpiCal_config->week_length) {
310
+				$colspan = 0;
311
+				$replace .= $loop_begin; # <td>
312 312
 
313 313
 				if ($weekarray[$day] == $getdate) $replace = str_replace('{TODAY}', 'rowToday', $replace);
314
-				$replace 	= str_replace('{TODAY}', 'rowOff', $replace);
314
+				$replace = str_replace('{TODAY}', 'rowOff', $replace);
315 315
 
316
-				if(array_search($weekarray[$day], $allday_uids)){
316
+				if (array_search($weekarray[$day], $allday_uids)) {
317 317
 					$uid = array_search($weekarray[$day], $allday_uids);
318 318
 					unset($allday_uids[$uid]);
319 319
 					$allday = $master_array[$weekarray[$day]]['-1'][$uid];
320
-					foreach ($allday_uid_dates[$uid] as $date){
320
+					foreach ($allday_uid_dates[$uid] as $date) {
321 321
 						$colspan += $nbrGridCols[$weekarray[$day]];
322 322
 						$day++;
323 323
 					}
324
-					$event_calno  	= $allday['calnumber'];
325
-					$event_calno	= (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
326
- 					$event 			= openevent($get_date, -1, $uid, $allday, $phpiCal_config->allday_week_lines, (8*$colspan), 'psf');
324
+					$event_calno = $allday['calnumber'];
325
+					$event_calno = (($event_calno - 1)%$phpiCal_config->unique_colors) + 1;
326
+ 					$event = openevent($get_date, -1, $uid, $allday, $phpiCal_config->allday_week_lines, (8*$colspan), 'psf');
327 327
 					$loop_tmp 		= str_replace('{ALLDAY}', $event, $loop_ad);
328 328
 					$loop_tmp 		= str_replace('{CALNO}', $event_calno, $loop_tmp);
329
-					$replace		= str_replace('{NOBORDER}', ' style="border-top: none;"', $replace);
329
+					$replace = str_replace('{NOBORDER}', ' style="border-top: none;"', $replace);
330 330
 					$replace		.= $loop_tmp;
331 331
 					$replace		.= $loop_end;
332
-				}else{
332
+				} else {
333 333
 					$replace		= str_replace('{NOBORDER}', '', $replace);
334 334
 					$colspan		= $nbrGridCols[$weekarray[$day]];
335
-					$replace		.= $loop_end;
335
+					$replace .= $loop_end;
336 336
 					$day++;
337 337
 				}
338 338
 				unset ($ev);
339
-				$replace 	= str_replace('{COLSPAN}', 'colspan="'.$colspan.'"', $replace);
339
+				$replace = str_replace('{COLSPAN}', 'colspan="'.$colspan.'"', $replace);
340 340
 			}
341 341
 			$row .= $replace.' '.$loop_row_end."\n";
342 342
 			$weekreplace .= $row."\n";
@@ -346,26 +346,26 @@  discard block
 block discarded – undo
346 346
 		// Replaces the daysofweek
347 347
 		preg_match('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!Uis', $this->page, $match1);
348 348
 		$loop_dof = trim($match1[1]);
349
-		$start_wt		 	= strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
349
+		$start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
350 350
 		$weekday_loop = '';
351
-		for ($i=0; $i<$phpiCal_config->week_length; $i++) {
351
+		for ($i = 0; $i < $phpiCal_config->week_length; $i++) {
352 352
 			$daylink = date('Ymd', $start_wt);
353 353
 			$weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
354 354
 			if ($daylink == $getdate) {
355 355
 				$row1 = 'rowToday';
356 356
 				$row2 = 'rowOn';
357 357
 				$row3 = 'rowToday';
358
-			}else{
358
+			} else {
359 359
 				$row1 = 'rowOff';
360 360
 				$row2 = 'rowOn';
361 361
 				$row3 = 'rowOff';
362 362
 			}
363
-			$start_wt 		= strtotime('+1 day', $start_wt);
363
+			$start_wt = strtotime('+1 day', $start_wt);
364 364
 			$colspan		= 'colspan="'.$nbrGridCols[$daylink].'"';
365 365
 			$search			= array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}', '{COLSPAN}');
366 366
 			$replace		= array($weekday, $daylink, $row1, $row2, $row3, $colspan);
367
-			$loop_tmp 		= str_replace($search, $replace, $loop_dof);
368
-			$weekday_loop  .= $loop_tmp;
367
+			$loop_tmp = str_replace($search, $replace, $loop_dof);
368
+			$weekday_loop .= $loop_tmp;
369 369
 		}
370 370
 		$this->page = preg_replace('!<\!-- loop daysofweek on -->.*<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page);
371 371
 
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 		$loop_hours = trim($match2[1]);
376 376
 		$loop_event = trim($match3[1]);
377 377
 
378
-		$event_length = array ();
378
+		$event_length = array();
379 379
 		$border = 0;
380
-		preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
380
+		preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
381 381
 		$this_day = $day_array2[3];
382 382
 		$this_month = $day_array2[2];
383 383
 		$this_year = $day_array2[1];
@@ -389,26 +389,26 @@  discard block
 block discarded – undo
389 389
 		foreach ($day_array as $key) {
390 390
 			$cal_time = $key;
391 391
 			preg_match('/([0-9]{2})([0-9]{2})/', $key, $regs_tmp);
392
-			$key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year);
393
-			$key = date ($timeFormat, $key);
392
+			$key = mktime($regs_tmp[1], $regs_tmp[2], 0, $this_month, $this_day, $this_year);
393
+			$key = date($timeFormat, $key);
394 394
 
395 395
 			if (ereg('([0-9]{1,2}):00', $key)) {
396 396
 				$even_row = '2';
397 397
 				# column of times colspan = 4 to cover navigation links at top
398 398
 				$weekdisplay .= '<tr>';
399
-				$weekdisplay .= '<td colspan="4" rowspan="' . (60 / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder2">'.$key.'</td>';
400
-				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
399
+				$weekdisplay .= '<td colspan="4" rowspan="'.(60/$phpiCal_config->gridLength).'" align="center" valign="top" width="60" class="timeborder2">'.$key.'</td>';
400
+				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>';
401 401
 			} elseif ($cal_time == $phpiCal_config->day_start) {
402
-				$size_tmp = 60 - (int)substr($cal_time,2,2);
402
+				$size_tmp = 60 - (int)substr($cal_time, 2, 2);
403 403
 				$weekdisplay .= '<tr>';
404
-				$weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder2">'.$key.' </td>';
405
-				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
404
+				$weekdisplay .= '<td colspan="4" rowspan="'.($size_tmp/$phpiCal_config->gridLength).'" align="center" valign="top" width="60" class="timeborder2">'.$key.' </td>';
405
+				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>';
406 406
 			} else {
407 407
 				$even_row = '';
408 408
 				if (ereg('([0-9]{1,2}):30', $key)) $even_row = '3';
409 409
 				# empty row for each gridLength, to the right of times and left of first weekday
410 410
 				$weekdisplay .= '<tr>';
411
-				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
411
+				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>';
412 412
 			}
413 413
 
414 414
 			/* 	add columns in the $cal_time grid slot for each day
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 				$this_time_arr = array();
418 418
 				if ($phpiCal_config->day_start == $cal_time && isset($master_array[$thisday]) && is_array($master_array[$thisday])) {
419 419
 					# want to pile up all the events before day_start that end in the displayed times
420
-					foreach($master_array[$thisday] as $time_key => $time_arr) {
420
+					foreach ($master_array[$thisday] as $time_key => $time_arr) {
421 421
 						if ((int)$time_key <= (int)$cal_time && is_array($time_arr) && $time_key != '-1') {
422
-							foreach($time_arr as $uid => $event_tmp) {
422
+							foreach ($time_arr as $uid => $event_tmp) {
423 423
 								if ((int)$event_tmp['display_end'] > (int)$cal_time) $this_time_arr[$uid] = $event_tmp;
424 424
 							}
425 425
 						}
@@ -433,17 +433,17 @@  discard block
 block discarded – undo
433 433
 
434 434
 				// go through $this_time_array and fill the event_length array
435 435
 				foreach ($this_time_arr as $eventKey => $loopevent) {
436
-					$drawEvent = drawEventTimes ($cal_time, $loopevent['display_end']);
436
+					$drawEvent = drawEventTimes($cal_time, $loopevent['display_end']);
437 437
 					$j = 0;
438 438
 					while (isset($event_length[$thisday][$j])) {
439 439
 						if ($event_length[$thisday][$j]['state'] == 'ended') {
440
-							$event_length[$thisday][$j] = array ('length' => ($drawEvent['draw_length'] / $phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin');
440
+							$event_length[$thisday][$j] = array('length' => ($drawEvent['draw_length']/$phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin');
441 441
 							break;
442 442
 						}
443 443
 						$j++;
444 444
 					}
445 445
 					if ($j == sizeof(@$event_length[$thisday])) {
446
-						$event_length[$thisday][] = array ('length' => ($drawEvent['draw_length'] / $phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin');
446
+						$event_length[$thisday][] = array('length' => ($drawEvent['draw_length']/$phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin');
447 447
 					}
448 448
 				}
449 449
 				$class = ' class="weekborder'.$even_row.'"';
@@ -452,31 +452,31 @@  discard block
 block discarded – undo
452 452
 					$tclass = $class;
453 453
 					if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
454 454
 					$drawWidth = 1;
455
-					$weekdisplay .= '<td colspan="' . $nbrGridCols[$thisday] . '"' . $tclass . '>&nbsp;</td>'."\n";
455
+					$weekdisplay .= '<td colspan="'.$nbrGridCols[$thisday].'"'.$tclass.'>&nbsp;</td>'."\n";
456 456
 				} else {
457 457
 					# have events
458 458
 					$emptyWidth = $nbrGridCols[$thisday];
459 459
 					// Used to "join" ended events, so the ended case below results in one colspan'd td instead of multiple tds.
460 460
 					$ended_counter = 0;
461
-					foreach($event_length[$thisday] as $i=>$el) {
462
-						$drawWidth = $nbrGridCols[$thisday] / ($el['overlap'] + 1);
461
+					foreach ($event_length[$thisday] as $i=>$el) {
462
+						$drawWidth = $nbrGridCols[$thisday]/($el['overlap'] + 1);
463 463
 						$emptyWidth = $emptyWidth - $drawWidth;
464 464
 						switch ($el['state']) {
465 465
 							case 'begin':
466 466
 								if ($ended_counter) {
467 467
 									$tclass = $class;
468 468
 									if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
469
-									$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
469
+									$weekdisplay .= '<td colspan="'.$ended_counter.'"'.$tclass.'>&nbsp;</td>';
470 470
 									$ended_counter = 0;
471 471
 								}
472 472
 								$event_length[$thisday][$i]['state'] = 'started';
473 473
  								$uid = $event_length[$thisday][$i]['key'];
474 474
  								$event_start 	= $this_time_arr[$uid]['start_unixtime'];
475
-								$event_start 	= date ($timeFormat, $event_start);
476
- 								$event_calno  	= $this_time_arr[$uid]['calnumber'];
475
+								$event_start 	= date($timeFormat, $event_start);
476
+ 								$event_calno = $this_time_arr[$uid]['calnumber'];
477 477
  								$event_status	= strtolower($this_time_arr[$uid]['status']);
478 478
  								$event_recur = $this_time_arr[$uid]['recur'];
479
-								$event_calno = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
479
+								$event_calno = (($event_calno - 1)%$phpiCal_config->unique_colors) + 1;
480 480
 								$confirmed = '';
481 481
 						  		if (is_array($event_recur)) $confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
482 482
 								if ($event_status != '') {
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
 									}
497 497
 								}
498 498
 								$event_temp   = $loop_event;
499
-								$event 		  = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps');
500
-								$weekdisplay .= '<td rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
499
+								$event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps');
500
+								$weekdisplay .= '<td rowspan="'.$event_length[$thisday][$i]['length'].'" colspan="'.$drawWidth.'" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
501 501
 
502 502
 								// Start drawing the event
503 503
 								$event_temp   = str_replace('{EVENT}', $event, $event_temp);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 								if ($ended_counter) {
514 514
 									$tclass = $class;
515 515
 									if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
516
-									$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
516
+									$weekdisplay .= '<td colspan="'.$ended_counter.'"'.$tclass.'>&nbsp;</td>';
517 517
 									$ended_counter = 0;
518 518
 								}
519 519
 								break;
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 					if ($emptyWidth > 0) {
534 534
 						$tclass = $class;
535 535
 						if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
536
-						$weekdisplay .= '<td colspan="' . $emptyWidth . '"'.$tclass.'>&nbsp;</td>'."\n";
536
+						$weekdisplay .= '<td colspan="'.$emptyWidth.'"'.$tclass.'>&nbsp;</td>'."\n";
537 537
 					}
538 538
 					while (isset($event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]['state']) && $event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]['state'] == 'ended') {
539 539
 						array_pop($event_length[$thisday]);
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 			preg_match('!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis', $this->page, $match1);
557 557
 			$loop_ad = trim($match1[1]);
558 558
 			foreach ($master_array[$getdate]['-1'] as $uid => $allday) {
559
-				$event_calno  	= $allday['calnumber'];
560
-				$event_calno	= (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
559
+				$event_calno = $allday['calnumber'];
560
+				$event_calno = (($event_calno - 1)%$phpiCal_config->unique_colors) + 1;
561 561
  				$event 			= openevent($getdate, -1, $uid, $allday);
562 562
 				$loop_tmp 		= str_replace('{ALLDAY}', $event, $loop_ad);
563 563
 				$loop_tmp 		= str_replace('{CALNO}', $event_calno, $loop_tmp);
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 		// Replaces the daysofweek
570 570
 		preg_match('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!Uis', $this->page, $match1);
571 571
 		$loop_dof = trim($match1[1]);
572
-		$start_wt		 	= strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
573
-		$start_day 			= strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
574
-		for ($i=0; $i< $phpiCal_config->week_length; $i++) {
575
-			$day_num 		= date('w', $start_day);
576
-			$daylink		= date('Ymd', $start_wt);
572
+		$start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
573
+		$start_day = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
574
+		for ($i = 0; $i < $phpiCal_config->week_length; $i++) {
575
+			$day_num = date('w', $start_day);
576
+			$daylink = date('Ymd', $start_wt);
577 577
 			if ($current_view == 'day') {
578
-				$weekday 		= $daysofweek_lang[$day_num];
578
+				$weekday = $daysofweek_lang[$day_num];
579 579
 			} else {
580 580
 				$weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
581 581
 			}
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
 				$row2 = 'rowOn';
589 589
 				$row3 = 'rowOff';
590 590
 			}
591
-			$start_day 		= strtotime('+1 day', $start_day);
591
+			$start_day = strtotime('+1 day', $start_day);
592 592
 			$start_wt 		= strtotime('+1 day', $start_wt);
593 593
 			$search			= array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}');
594 594
 			$replace		= array($weekday, $daylink, $row1, $row2, $row3);
595 595
 			$loop_tmp 		= str_replace($search, $replace, $loop_dof);
596
-			$weekday_loop  .= $loop_tmp;
596
+			$weekday_loop .= $loop_tmp;
597 597
 		}
598 598
 		$this->page = preg_replace('!<\!-- loop daysofweek on -->.*<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page);
599 599
 
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 
603 603
 		$nbrGridCols = 1;
604 604
 		if (isset($master_array[($getdate)])) {
605
-			foreach($master_array[($getdate)] as $ovlKey => $ovlValue) {
605
+			foreach ($master_array[($getdate)] as $ovlKey => $ovlValue) {
606 606
 				if ($ovlKey != '-1') {
607
-					foreach($ovlValue as $ovl2Value) {
607
+					foreach ($ovlValue as $ovl2Value) {
608 608
 						$nbrGridCols = kgv($nbrGridCols, ($ovl2Value['event_overlap'] + 1));
609 609
 					}
610 610
 				}
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 		$loop_hours = trim($match2[1]);
616 616
 		$loop_event = trim($match3[1]);
617 617
 
618
-		$event_length = array ();
618
+		$event_length = array();
619 619
 		$border = 0;
620 620
 		preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
621 621
 		$this_day = $day_array2[3];
@@ -624,16 +624,16 @@  discard block
 block discarded – undo
624 624
 		foreach ($day_array as $key) {
625 625
 			preg_match('/([0-9]{2})([0-9]{2})/', $key, $regs_tmp);
626 626
 			$cal_time = $key;
627
-			$key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year);
628
-			$key = date ($timeFormat, $key);
627
+			$key = mktime($regs_tmp[1], $regs_tmp[2], 0, $this_month, $this_day, $this_year);
628
+			$key = date($timeFormat, $key);
629 629
 			unset($this_time_arr);
630 630
 
631 631
 			// add events that overlap $phpiCal_config->day_start instead of cutting them out completely
632 632
 			if (($phpiCal_config->day_start == $cal_time) && (isset($master_array[$getdate]))) {
633
-				foreach($master_array[$getdate] as $time_key => $time_arr) {
633
+				foreach ($master_array[$getdate] as $time_key => $time_arr) {
634 634
 					if ((int)$time_key <= (int)$cal_time) {
635 635
 						if (is_array($time_arr) && $time_key != '-1') {
636
-							foreach($time_arr as $uid => $event_tmp) {
636
+							foreach ($time_arr as $uid => $event_tmp) {
637 637
 								if ((int)$event_tmp['event_end'] > (int)$cal_time) {
638 638
 									$this_time_arr[$uid] = $event_tmp;
639 639
 								}
@@ -653,32 +653,32 @@  discard block
 block discarded – undo
653 653
 			// check for eventstart
654 654
 			if (isset($this_time_arr) && sizeof($this_time_arr) > 0) {
655 655
 				foreach ($this_time_arr as $eventKey => $loopevent) {
656
-					$drawEvent = drawEventTimes ($cal_time, $loopevent['display_end']);
656
+					$drawEvent = drawEventTimes($cal_time, $loopevent['display_end']);
657 657
 					$j = 0;
658 658
 					while (isset($event_length[$j])) {
659 659
 						if ($event_length[$j]['state'] == 'ended') {
660
-							$event_length[$j] = array ('length' => ($drawEvent['draw_length'] / $phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin');
660
+							$event_length[$j] = array('length' => ($drawEvent['draw_length']/$phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin');
661 661
 							break;
662 662
 						}
663 663
 						$j++;
664 664
 					}
665 665
 					if ($j == sizeof($event_length)) {
666
-						array_push ($event_length, array ('length' => ($drawEvent['draw_length'] / $phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin'));
666
+						array_push($event_length, array('length' => ($drawEvent['draw_length']/$phpiCal_config->gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin'));
667 667
 					}
668 668
 				}
669 669
 			}
670 670
 			if (preg_match('/([0-9]{1,2}):00/', $key)) {
671 671
 				$daydisplay .= '<tr>'."\n";
672
-				$daydisplay .= '<td rowspan="' . (60 / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'."\n";
673
-				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'."\n";
674
-			} elseif($cal_time == $phpiCal_config->day_start) {
675
-				$size_tmp = 60 - (int)substr($cal_time,2,2);
672
+				$daydisplay .= '<td rowspan="'.(60/$phpiCal_config->gridLength).'" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'."\n";
673
+				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>'."\n";
674
+			} elseif ($cal_time == $phpiCal_config->day_start) {
675
+				$size_tmp = 60 - (int)substr($cal_time, 2, 2);
676 676
 				$daydisplay .= '<tr>'."\n";
677
-				$daydisplay .= '<td rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'."\n";
678
-				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'."\n";
677
+				$daydisplay .= '<td rowspan="'.($size_tmp/$phpiCal_config->gridLength).'" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'."\n";
678
+				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>'."\n";
679 679
 			} else {
680 680
 				$daydisplay .= '<tr>'."\n";
681
-				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'."\n";
681
+				$daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="'.$phpiCal_config->gridLength.'"></td>'."\n";
682 682
 			}
683 683
 
684 684
 			switch (++$dayborder) {
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
 			}
702 702
 
703 703
 			if (sizeof($event_length) == 0) {
704
-				$daydisplay .= '<td colspan="' . $nbrGridCols . '"' . $class . '>&nbsp;</td>' . "\n";
704
+				$daydisplay .= '<td colspan="'.$nbrGridCols.'"'.$class.'>&nbsp;</td>'."\n";
705 705
 
706 706
 			} else {
707 707
 				$emptyWidth = $nbrGridCols;
708 708
 				// Used to "join" ended events, so the ended case below results in one colspan'd td instead of multiple tds.
709 709
 				$ended_counter = 0;
710
-				for ($i=0;$i<sizeof($event_length);$i++) {
711
-					$drawWidth = $nbrGridCols / ($event_length[$i]['overlap'] + 1);
710
+				for ($i = 0; $i < sizeof($event_length); $i++) {
711
+					$drawWidth = $nbrGridCols/($event_length[$i]['overlap'] + 1);
712 712
 					$emptyWidth = $emptyWidth - $drawWidth;
713 713
 					switch ($event_length[$i]['state']) {
714 714
 						case 'begin':
715 715
 						  if ($ended_counter) {
716
-							$daydisplay .= '<td colspan="' . $ended_counter . '"' . $class . '>&nbsp;</td>';
716
+							$daydisplay .= '<td colspan="'.$ended_counter.'"'.$class.'>&nbsp;</td>';
717 717
 							$ended_counter = 0;
718 718
 						  }
719 719
 						  $event_length[$i]['state'] = 'started';
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
  						  $event_calno  = $this_time_arr[$uid]['calnumber'];
722 722
  						  $event_recur  = $this_time_arr[$uid]['recur'];
723 723
  						  $event_status = strtolower($this_time_arr[$uid]['status']);
724
-						  $event_calno  = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
724
+						  $event_calno = (($event_calno - 1)%$phpiCal_config->unique_colors) + 1;
725 725
 						  $confirmed = '';
726 726
 						  if (is_array($event_recur)) $confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
727 727
 						  if ($event_status != '') $confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
@@ -738,11 +738,11 @@  discard block
 block discarded – undo
738 738
 								  $confirmed .= '<img src="images/longevent_mid.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
739 739
 							  }
740 740
 						  }
741
-						  $daydisplay .= '<td rowspan="' . $event_length[$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_' . $event_calno . '">' . "\n";
741
+						  $daydisplay .= '<td rowspan="'.$event_length[$i]['length'].'" colspan="'.$drawWidth.'" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
742 742
 
743 743
 						  // Start drawing the event
744 744
 						  $event_temp  = $loop_event;
745
-						  $event 	   = openevent($getdate, $cal_time, $uid, $this_time_arr[$uid], 0, 0, 'ps');
745
+						  $event = openevent($getdate, $cal_time, $uid, $this_time_arr[$uid], 0, 0, 'ps');
746 746
 						  $event_temp  = str_replace('{EVENT}', $event, $event_temp);
747 747
 						  $event_temp  = str_replace('{EVENT_START}', date($timeFormat, $this_time_arr[$uid]['start_unixtime']), $event_temp);
748 748
 						  $event_temp  = str_replace('{EVENT_END}', date($timeFormat, $this_time_arr[$uid]['end_unixtime']), $event_temp);
@@ -755,12 +755,12 @@  discard block
 block discarded – undo
755 755
 						  break;
756 756
 						case 'started':
757 757
 							if ($ended_counter) {
758
-								$daydisplay .= '<td colspan="' . $ended_counter . '"' . $class . '>&nbsp;</td>';
758
+								$daydisplay .= '<td colspan="'.$ended_counter.'"'.$class.'>&nbsp;</td>';
759 759
 								$ended_counter = 0;
760 760
 							}
761 761
 							break;
762 762
 						case 'ended':
763
-							$daydisplay .= '<td colspan="' . $drawWidth . '"' . $class . '>&nbsp;</td>' . "\n";
763
+							$daydisplay .= '<td colspan="'.$drawWidth.'"'.$class.'>&nbsp;</td>'."\n";
764 764
 							break;
765 765
 					}
766 766
 					$event_length[$i]['length']--;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 				$emptyWidth += $ended_counter;
774 774
 				//fill empty space on the right
775 775
 				if ($emptyWidth > 0) {
776
-					$daydisplay .= '<td colspan="' . $emptyWidth . '"' . $class . '>&nbsp;</td>' . "\n";
776
+					$daydisplay .= '<td colspan="'.$emptyWidth.'"'.$class.'>&nbsp;</td>'."\n";
777 777
 				}
778 778
 				while (isset($event_length[(sizeof($event_length) - 1)]) && $event_length[(sizeof($event_length) - 1)]['state'] == 'ended') {
779 779
 					array_pop($event_length);
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 		$loop_t_e 	= trim($match2[1]);
798 798
 		$replace_ad	= '';
799 799
 		$replace_e	= '';
800
-		$return_adtmp	= '';
801
-		$return_etmp	= '';
800
+		$return_adtmp = '';
801
+		$return_etmp = '';
802 802
 
803 803
 		if (isset($master_array[$next_day]) && is_array($master_array[$next_day]) && sizeof($master_array[$next_day]) > 0) {
804 804
 			foreach ($master_array[$next_day] as $cal_time => $event_times) {
@@ -843,17 +843,17 @@  discard block
 block discarded – undo
843 843
 					if (isset($val['vtodo_text']) && !empty($val['vtodo_text'])) {
844 844
 						$vtodo_text = sanitizeForWeb(stripslashes(urldecode($val['vtodo_text'])));
845 845
 						if (isset($val['description']) && !empty($val['description'])) {
846
-							$description 	= sanitizeForWeb(stripslashes(urldecode($val['description'])));
846
+							$description = sanitizeForWeb(stripslashes(urldecode($val['description'])));
847 847
 						} else {
848 848
 							$description = '';
849 849
 						}
850 850
 						$completed_date = $val['completed_date'];
851 851
 						$event_calna 	= $val['calname'];
852
-						$status 		= $val['status'];
852
+						$status = $val['status'];
853 853
 						$priority 		= $val['priority'];
854
-						$start_date 	= $val['start_date'];
854
+						$start_date = $val['start_date'];
855 855
 						$due_date 		= $val['due_date'];
856
-						$vtodo_array 	= array(
856
+						$vtodo_array = array(
857 857
 							'cal'			=> $event_calna,
858 858
 							'completed_date'=> $completed_date,
859 859
 							'description'	=> $description,
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 							'start_date'	=> $start_date,
863 863
 							'status'		=> $status,
864 864
 							'vtodo_text' 	=> $vtodo_text);
865
-						$vtodo_array 	= base64_encode(urlencode(serialize($vtodo_array)));
866
-						$todo_text		= str_replace('"', '\\"', $vtodo_text);
865
+						$vtodo_array = base64_encode(urlencode(serialize($vtodo_array)));
866
+						$todo_text = str_replace('"', '\\"', $vtodo_text);
867 867
 						$todo = <<<HEREDOC
868 868
 <script language="Javascript" type="text/javascript">
869 869
 <!--
@@ -874,13 +874,13 @@  discard block
 block discarded – undo
874 874
 
875 875
 HEREDOC;
876 876
 
877
-						$todo .= '<a class="psf" title="' . @$title . '" href="#" onclick="openTodoInfo(' . $todo_popup_data_index . '); return false;">';
877
+						$todo .= '<a class="psf" title="'.@$title.'" href="#" onclick="openTodoInfo('.$todo_popup_data_index.'); return false;">';
878 878
 						$todo_popup_data_index++;
879 879
 						$vtodo_array = $todo;
880 880
 
881 881
 						$vtodo_text 	= word_wrap(str_replace('<br />', ' ', $vtodo_text), 21, $phpiCal_config->tomorrows_events_lines);
882
-						$data 			= array ('{VTODO_TEXT}', '{VTODO_ARRAY}');
883
-						$rep			= array ($vtodo_text, $vtodo_array);
882
+						$data = array('{VTODO_TEXT}', '{VTODO_ARRAY}');
883
+						$rep = array($vtodo_text, $vtodo_array);
884 884
 
885 885
 						// Reset this TODO's category.
886 886
 
@@ -936,16 +936,16 @@  discard block
 block discarded – undo
936 936
 		$t_month[1]			= trim($match4[1]);
937 937
 		$t_month[2] 		= trim($match5[1]);
938 938
 		$startweek 			= trim($match6[1]);
939
-		$endweek 			= trim($match7[1]);
939
+		$endweek = trim($match7[1]);
940 940
 		if ($type != 'medium') {
941 941
 			$fake_getdate_time 	= strtotime($this_year.'-'.$this_month.'-15');
942
-			$fake_getdate_time	= strtotime($offset.' month', $fake_getdate_time);
942
+			$fake_getdate_time = strtotime($offset.' month', $fake_getdate_time);
943 943
 		} else {
944 944
 			$fake_getdate_time 	= strtotime($this_year.'-'.$offset.'-15');
945 945
 		}
946 946
 
947 947
 		$minical_month 		= date('m', $fake_getdate_time);
948
-		$minical_year 		= date('Y', $fake_getdate_time);
948
+		$minical_year = date('Y', $fake_getdate_time);
949 949
 		$first_of_month 	= $minical_year.$minical_month.'01';
950 950
 		$first_of_year 		= $minical_year.'0101';
951 951
 
@@ -954,9 +954,9 @@  discard block
 block discarded – undo
954 954
 		$dateFormat_month_local = str_replace('%Y', '<a class="ps3" href="year.php?cal='.$cal.'&amp;getdate='.$first_of_year.'">%Y</a>', $dateFormat_month_local);
955 955
 
956 956
 		//$start_day 			= strtotime($phpiCal_config->week_start_day);
957
-		$start_day			= strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
958
-		$month_title 		= localizeDate ($dateFormat_month_local, $fake_getdate_time);
959
-		$month_date 		= date ('Ymd', $fake_getdate_time);
957
+		$start_day = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
958
+		$month_title = localizeDate($dateFormat_month_local, $fake_getdate_time);
959
+		$month_date = date('Ymd', $fake_getdate_time);
960 960
 
961 961
 		if ($type == 'small') {
962 962
 			$langtype = $daysofweekreallyshort_lang;
@@ -968,26 +968,26 @@  discard block
 block discarded – undo
968 968
 
969 969
 		$weekday_loop = '';
970 970
 		$middle = '';
971
-		for ($i=0; $i< $phpiCal_config->week_length; $i++) {
971
+		for ($i = 0; $i < $phpiCal_config->week_length; $i++) {
972 972
 			$day_num 		= date('w', $start_day);
973 973
 			$weekday 		= $langtype[$day_num];
974
-			$start_day 		= strtotime('+1 day', $start_day);
975
-			$loop_tmp 		= str_replace('{LOOP_WEEKDAY}', $weekday, $loop_wd);
976
-			$weekday_loop  .= $loop_tmp;
974
+			$start_day = strtotime('+1 day', $start_day);
975
+			$loop_tmp = str_replace('{LOOP_WEEKDAY}', $weekday, $loop_wd);
976
+			$weekday_loop .= $loop_tmp;
977 977
 		}
978 978
 
979
-		$start_day 			= strtotime(dateOfWeek($first_of_month, $phpiCal_config->week_start_day));
980
-		$i 					= 0;
981
-		$whole_month 		= TRUE;
979
+		$start_day = strtotime(dateOfWeek($first_of_month, $phpiCal_config->week_start_day));
980
+		$i = 0;
981
+		$whole_month = TRUE;
982 982
 
983 983
 		do {
984 984
 			if ($i == 0) $middle .= $startweek; $i++;
985 985
 			#$temp_middle			= $loop_md;
986
-			$switch					= array('ALLDAY' => '', 'CAL' => $cal, 'MINICAL_VIEW' => $minical_view);
987
-			$check_month 			= date ('m', $start_day);
988
-			$daylink 				= date ('Ymd', $start_day);
989
-			$switch['DAY']	 		= date ('j', $start_day);
990
-			$switch['DAYLINK'] 		= date ('Ymd', $start_day);
986
+			$switch = array('ALLDAY' => '', 'CAL' => $cal, 'MINICAL_VIEW' => $minical_view);
987
+			$check_month = date('m', $start_day);
988
+			$daylink = date('Ymd', $start_day);
989
+			$switch['DAY'] = date('j', $start_day);
990
+			$switch['DAYLINK'] = date('Ymd', $start_day);
991 991
 			if ($check_month != $minical_month) {
992 992
 				$temp = $t_month[0];
993 993
 			} elseif ($daylink == $getdate) {
@@ -1003,12 +1003,12 @@  discard block
 block discarded – undo
1003 1003
 							if (!isset($val['calnumber'])) continue;
1004 1004
 
1005 1005
 							if (($phpiCal_config->month_locations == 'yes') && isset($val['location']) && !empty($val['location'])) {
1006
-								$location = '<br /><span style="font-size: 95%">' . sanitizeForWeb(stripslashes(urldecode($val['location']))) . '</span>';
1006
+								$location = '<br /><span style="font-size: 95%">'.sanitizeForWeb(stripslashes(urldecode($val['location']))).'</span>';
1007 1007
 							}
1008 1008
 							else $location = '';
1009 1009
 
1010
-							$event_calno 	= $val['calnumber'];
1011
-							$event_calno	= (($event_calno - 1) % $unique_colors) + 1;
1010
+							$event_calno = $val['calnumber'];
1011
+							$event_calno = (($event_calno - 1)%$unique_colors) + 1;
1012 1012
 							if ($cal_time == -1) {
1013 1013
 								if ($type == 'large') {
1014 1014
 									$switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 									$switch['ALLDAY'] = '<img src="templates/'.$phpiCal_config->template.'/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />';
1019 1019
 								}
1020 1020
 							} else {
1021
-								$start2		 = date($timeFormat_small, $val['start_unixtime']);
1021
+								$start2 = date($timeFormat_small, $val['start_unixtime']);
1022 1022
 								if ($type == 'large') {
1023 1023
 									$switch['EVENT'] .= '<div class="V9"><img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
1024 1024
  									$switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', '<span style="font-weight: bold;">'.$start2.'</span> ');
@@ -1045,11 +1045,11 @@  discard block
 block discarded – undo
1045 1045
 			$start_day = strtotime('+1 day', $start_day);
1046 1046
 			if ($i == $phpiCal_config->week_length) {
1047 1047
 				if ($phpiCal_config->week_length != 7) {
1048
-					$start_day = strtotime('+'.(7-$phpiCal_config->week_length).' day', $start_day);
1048
+					$start_day = strtotime('+'.(7 - $phpiCal_config->week_length).' day', $start_day);
1049 1049
 				}
1050 1050
 				$i = 0;
1051 1051
 				$middle .= $endweek;
1052
-				$checkagain = date ('m', $start_day);
1052
+				$checkagain = date('m', $start_day);
1053 1053
 				if ($checkagain != $minical_month) $whole_month = FALSE;
1054 1054
 			}
1055 1055
 		} while ($whole_month == TRUE);
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
 	}
1065 1065
 
1066 1066
 	function nomonthbottom() {
1067
-		$this->page = preg_replace('!<\!-- switch showbottom on -->.*<\!-- switch showbottom off -->!Uis','', $this->page);
1067
+		$this->page = preg_replace('!<\!-- switch showbottom on -->.*<\!-- switch showbottom off -->!Uis', '', $this->page);
1068 1068
 	}
1069 1069
 
1070 1070
 	function nosearch() {
1071
-		$this->page = preg_replace('!<\!-- switch show_search on -->.*<\!-- switch show_search off -->!Uis','', $this->page);
1071
+		$this->page = preg_replace('!<\!-- switch show_search on -->.*<\!-- switch show_search off -->!Uis', '', $this->page);
1072 1072
 	}
1073 1073
 
1074 1074
 	function monthbottom() {
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
 		$m_start = $this_year.$this_month.'01';
1083 1083
 		$u_start = strtotime($m_start);
1084
-		$i=0;
1084
+		$i = 0;
1085 1085
 		$seen_events = array();
1086 1086
 		$middle = '';
1087 1087
 		do {
@@ -1089,25 +1089,25 @@  discard block
 block discarded – undo
1089 1089
 				foreach ($master_array[$m_start] as $cal_time => $event_times) {
1090 1090
 				#	$switch['CAL'] 			= $cal;
1091 1091
 				#	$switch['START_DATE'] 	= localizeDate ($dateFormat_week_list, $u_start);
1092
-					$start_date 	= localizeDate ($dateFormat_week_list, $u_start);
1092
+					$start_date = localizeDate($dateFormat_week_list, $u_start);
1093 1093
 					foreach ($event_times as $uid => $val) {
1094 1094
 						if (isset($seen_events[$uid]) && @$val['spans_day'] == 1) continue;
1095 1095
 						$seen_events[$uid] = 1;
1096
-						$switch['CAL'] 			= $cal;
1097
-						$switch['START_DATE'] 	= $start_date;
1098
-						$switch['CALNAME'] 	= $val['calname'];
1096
+						$switch['CAL'] = $cal;
1097
+						$switch['START_DATE'] = $start_date;
1098
+						$switch['CALNAME'] = $val['calname'];
1099 1099
 						if (!isset($val['event_start'])) {
1100 1100
 							$switch['START_TIME'] 	= $lang['l_all_day'];
1101 1101
 							$switch['EVENT_TEXT'] 	= openevent($m_start, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 15, 'psf');
1102
-							$switch['DESCRIPTION'] 	= sanitizeForWeb(stripslashes(urldecode($val['description'])));
1102
+							$switch['DESCRIPTION'] = sanitizeForWeb(stripslashes(urldecode($val['description'])));
1103 1103
 						} else {
1104 1104
 							$event_start = $val['start_unixtime'];
1105 1105
 							$event_end 	 = (isset($val['display_end'])) ? $val['display_end'] : $val['event_end'];
1106 1106
 							$event_start = date($timeFormat, $val['start_unixtime']);
1107 1107
 							$event_end   = date($timeFormat, $val['end_unixtime']);
1108
-							$switch['START_TIME'] 	= $event_start . ' - ' . $event_end;
1108
+							$switch['START_TIME'] 	= $event_start.' - '.$event_end;
1109 1109
 							$switch['EVENT_TEXT'] 	= openevent($m_start, $cal_time, $uid, $val, 0, 15, 'psf');
1110
-							$switch['DESCRIPTION'] 	= sanitizeForWeb(stripslashes(urldecode($val['description'])));
1110
+							$switch['DESCRIPTION'] = sanitizeForWeb(stripslashes(urldecode($val['description'])));
1111 1111
 						}
1112 1112
 
1113 1113
 						if ($switch['EVENT_TEXT'] != '') {
@@ -1135,9 +1135,9 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 	function Page($file = 'std.tpl') {
1137 1137
 		global $phpiCal_config;
1138
-		if (!file_exists($file)){
1138
+		if (!file_exists($file)) {
1139 1139
 			#look for it in default if not found
1140
-			$file = str_replace('templates/'.$phpiCal_config->template,'templates/default',$file);
1140
+			$file = str_replace('templates/'.$phpiCal_config->template, 'templates/default', $file);
1141 1141
 			if (!file_exists($file)) die('Template file '.$file.' not found.');
1142 1142
 		}
1143 1143
 		$this->page = join('', file($file));
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
 
1147 1147
 	function parse($file) {
1148 1148
 		global $phpiCal_config; $lang;
1149
-		if (basename(dirname($file)) == $phpiCal_config->template || $file =='./functions/event.js'){
1150
-			if (!is_file($file)){
1149
+		if (basename(dirname($file)) == $phpiCal_config->template || $file == './functions/event.js') {
1150
+			if (!is_file($file)) {
1151 1151
 				#look for it in default if not found
1152
-				$file = str_replace('templates/'.$phpiCal_config->template,'templates/default',$file);
1152
+				$file = str_replace('templates/'.$phpiCal_config->template, 'templates/default', $file);
1153 1153
 			}
1154
-			if (!is_file($file)){
1154
+			if (!is_file($file)) {
1155 1155
 				exit(error($lang['l_error_path'], $file));
1156 1156
 			}
1157 1157
 			ob_start();
@@ -1168,11 +1168,11 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 				// This removes any unfilled tags
1170 1170
 				if (!$data) {
1171
-					$this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->.*<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page);
1171
+					$this->page = preg_replace('!<\!-- switch '.$tag.' on -->.*<\!-- switch '.$tag.' off -->!Uis', '', $this->page);
1172 1172
 				}
1173 1173
 
1174 1174
 				// This replaces any tags
1175
-				$this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page);
1175
+				$this->page = str_replace('{'.strtoupper($tag).'}', $data, $this->page);
1176 1176
 			}
1177 1177
 
1178 1178
 		else
@@ -1188,11 +1188,11 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
 				// This removes any unfilled tags
1190 1190
 				if (!$data) {
1191
-					$this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->.*<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page);
1191
+					$this->page = preg_replace('!<\!-- switch '.$tag.' on -->.*<\!-- switch '.$tag.' off -->!Uis', '', $this->page);
1192 1192
 				}
1193 1193
 
1194 1194
 				// This replaces any tags
1195
-				$this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page);
1195
+				$this->page = str_replace('{'.strtoupper($tag).'}', $data, $this->page);
1196 1196
 			}
1197 1197
 
1198 1198
 		else
@@ -1203,22 +1203,22 @@  discard block
 block discarded – undo
1203 1203
 		global $phpiCal_config, $php_started, $lang, $template_started, $cpath;
1204 1204
 
1205 1205
 		// Looks for {MONTH} before sending page out
1206
-		preg_match_all ('!\{MONTH_([A-Z]*)\|?([+|-])([0-9]{1,2})\}!Uis', $this->page, $match);
1206
+		preg_match_all('!\{MONTH_([A-Z]*)\|?([+|-])([0-9]{1,2})\}!Uis', $this->page, $match);
1207 1207
 		if (sizeof($match) > 0) {
1208
-			$i=0;
1208
+			$i = 0;
1209 1209
 			foreach ($match[1] as $key => $val) {
1210 1210
 				if ($match[1][$i] == 'SMALL') {
1211
-					$template_file 	= $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_small.tpl');
1212
-					$type 			= 'small';
1213
-					$offset 		= $match[2][$i].$match[3][$i];
1211
+					$template_file = $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_small.tpl');
1212
+					$type = 'small';
1213
+					$offset = $match[2][$i].$match[3][$i];
1214 1214
 				} elseif ($match[1][$i] == 'MEDIUM') {
1215
-					$template_file 	= $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_medium.tpl');
1216
-					$type 			= 'medium';
1217
-					$offset 		= $match[3][$i];
1215
+					$template_file = $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_medium.tpl');
1216
+					$type = 'medium';
1217
+					$offset = $match[3][$i];
1218 1218
 				} else {
1219
-					$template_file 	= $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_large.tpl');
1220
-					$type 			= 'large';
1221
-					$offset 		= $match[2][$i].$match[3][$i];
1219
+					$template_file = $this->parse(BASE.'templates/'.$phpiCal_config->template.'/month_large.tpl');
1220
+					$type = 'large';
1221
+					$offset = $match[2][$i].$match[3][$i];
1222 1222
 				}
1223 1223
 				$data = $this->draw_month($template_file, $offset, $type);
1224 1224
 				$this->page = str_replace($match[0][$i], $data, $this->page);
@@ -1227,8 +1227,8 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 		$php_ended = @getmicrotime();
1230
-		$generated1 = number_format(($php_ended-$php_started),3);
1231
-		$generated2 = number_format(($php_ended-$template_started),3);
1230
+		$generated1 = number_format(($php_ended - $php_started), 3);
1231
+		$generated2 = number_format(($php_ended - $template_started), 3);
1232 1232
 		$this->page = str_replace('{GENERATED1}', $generated1, $this->page);
1233 1233
 		$this->page = str_replace('{GENERATED2}', $generated2, $this->page);
1234 1234
 		if ($phpiCal_config->enable_rss != 'yes') {
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		} else {
1237 1237
 			$this->page = str_replace('{BASE}', BASE, $this->page);
1238 1238
 		}
1239
-		if ($cpath){
1239
+		if ($cpath) {
1240 1240
 			$this->page = str_replace('&amp;getdate', '&amp;cpath='.$cpath.'&amp;getdate', $this->page);
1241 1241
 		}
1242 1242
 		print($this->page);
Please login to merge, or discard this patch.
phpicalendar/index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
3 3
 include_once(BASE.'functions/init.inc.php');
4 4
 
5 5
 if ($phpiCal_config->printview_default == 'yes') {
6
-	$theview ="print.php";
6
+	$theview = "print.php";
7 7
 } else {
8
-	$check = array ('day', 'week', 'month', 'year');
8
+	$check = array('day', 'week', 'month', 'year');
9 9
 	if (in_array($phpiCal_config->default_view, $check)) {
10
-		$theview = $phpiCal_config->default_view . '.php';
10
+		$theview = $phpiCal_config->default_view.'.php';
11 11
 	} else {
12 12
 		die('illegal view');
13 13
 	}
14 14
 }
15
-if(isset($_GET['cpath'])){
15
+if (isset($_GET['cpath'])) {
16 16
 	$theview .= '?cpath='.$_GET['cpath'];
17 17
 }
18 18
 header("Location: $theview");
Please login to merge, or discard this patch.
phpicalendar/search.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('BASE','./');
3
+define('BASE', './');
4 4
 $current_view = 'search';
5 5
 require_once(BASE.'functions/ical_parser.php');
6 6
 require_once(BASE.'functions/list_functions.php');
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		$formatted_search = $format_search_arr[0];
43 43
 	}
44 44
 	if (isset($master_array) && is_array($master_array)) {
45
-		foreach($master_array as $date_key_tmp => $date_tmp) {
45
+		foreach ($master_array as $date_key_tmp => $date_tmp) {
46 46
 			if (is_array($date_tmp)) {
47
-				foreach($date_tmp as $time_tmp) {
47
+				foreach ($date_tmp as $time_tmp) {
48 48
 					if (is_array($time_tmp)) {
49 49
 						foreach ($time_tmp as $uid_tmp => $event_tmp) {
50 50
 							if (is_array($event_tmp)) {
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 									$results1 = false;
56 56
 									$results2 = false;
57 57
 									if (isset($event_tmp['event_text'])) {
58
-										$results1 = search_boolean($format_search_arr,$event_tmp['event_text']);
58
+										$results1 = search_boolean($format_search_arr, $event_tmp['event_text']);
59 59
 									}
60 60
 
61 61
 									if (!$results1 && isset($event_tmp['description'])) {
62
-										$results2 = search_boolean($format_search_arr,$event_tmp['description']);
62
+										$results2 = search_boolean($format_search_arr, $event_tmp['description']);
63 63
 									}
64 64
 									if ($results1 || $results2) {
65 65
 										$event_tmp['date'] = $date_key_tmp;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 }
86 86
 $search_ended = getmicrotime();
87 87
 
88
-$search_took = number_format(($search_ended-$search_started),3);
88
+$search_took = number_format(($search_ended - $search_started), 3);
89 89
 
90 90
 // takes a boolean search and formats it into an array
91 91
 // use with sister function search_boolean()
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
 	$search_str = strtolower($search_str);
100 100
 
101
-	if ($search_str == ' ') return array(false,$and_arr,$or_arr,$not_arr);
101
+	if ($search_str == ' ') return array(false, $and_arr, $or_arr, $not_arr);
102 102
 
103 103
 	// clean up search string
104 104
 	$search_str = trim($search_str);
105 105
 	$search_str = str_replace(' and ', ' ', $search_str);
106 106
 	$search_str = str_replace(' - ', ' ', $search_str);
107
-	$search_str = ereg_replace('[[:space:]]+',' ', $search_str);
107
+	$search_str = ereg_replace('[[:space:]]+', ' ', $search_str);
108 108
 	$search_str = str_replace(' not ', ' -', $search_str);
109 109
 
110 110
 	// start out with an AND array of all the items
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 	$j = 0;
114 114
 
115 115
 	// build an OR array from the items in AND
116
-	for($i=0;$i<$count;$i++) {
116
+	for ($i = 0; $i < $count; $i++) {
117 117
 		if ($i != 0 && $and_arr[$i] == 'or') {
118 118
 			while ($and_arr[$i] == 'or') {
119
-				$or_arr[$j][] = $and_arr[$i-1];
120
-				array_splice($and_arr,$i-1,2);
119
+				$or_arr[$j][] = $and_arr[$i - 1];
120
+				array_splice($and_arr, $i - 1, 2);
121 121
  				$i--;
122 122
 			}
123 123
 			if (isset($and_arr[$i])) {
124 124
 				$or_arr[$j][] = $and_arr[$i];
125
-				array_splice($and_arr,$i,1);
125
+				array_splice($and_arr, $i, 1);
126 126
 			}
127 127
 			$or_str_arr[$j] = implode('</b> OR <b>', $or_arr[$j]);
128 128
 			$j++;
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	}
131 131
 
132 132
 	// build a NOT array from the items in AND
133
-	foreach($and_arr as $key => $val) {
134
-		if (substr($val,0,1) == '-') {
135
-			$not_arr[] = substr($val,1);
136
-			array_splice($and_arr,$key,1);
137
-		} elseif(substr($val,0,1) == '+') {
138
-			$and_arr[] = substr($val,1);
139
-			array_splice($and_arr,$key,1);
133
+	foreach ($and_arr as $key => $val) {
134
+		if (substr($val, 0, 1) == '-') {
135
+			$not_arr[] = substr($val, 1);
136
+			array_splice($and_arr, $key, 1);
137
+		} elseif (substr($val, 0, 1) == '+') {
138
+			$and_arr[] = substr($val, 1);
139
+			array_splice($and_arr, $key, 1);
140 140
 		}
141 141
 	}
142 142
 
@@ -185,30 +185,30 @@  discard block
 block discarded – undo
185 185
 	$haystack = strtolower($haystack);
186 186
 
187 187
 	// check against the NOT
188
-	foreach($not_arr as $s) {
189
-		if (is_string(strstr($haystack,$s)) == true) {
188
+	foreach ($not_arr as $s) {
189
+		if (is_string(strstr($haystack, $s)) == true) {
190 190
 			return false;
191 191
 		}
192 192
 	}
193 193
 
194 194
 	// check against the AND
195
-	foreach($and_arr as $s) {
195
+	foreach ($and_arr as $s) {
196 196
 			#echo "haystack: $haystack<br>needle: $s<br>";
197
-		if (is_string(strstr($haystack,$s)) == false) {
197
+		if (is_string(strstr($haystack, $s)) == false) {
198 198
 			return false;
199 199
 		}
200 200
 	}
201 201
 
202 202
 	// check against the OR
203
-	foreach($or_arr as $or) {
203
+	foreach ($or_arr as $or) {
204 204
 		$is_false = true;
205
-		foreach($or as $s) {
206
-			if (substr($s,0,1) == '-') {
207
-				if (is_string(strstr($haystack,substr($s,1))) == false) {
205
+		foreach ($or as $s) {
206
+			if (substr($s, 0, 1) == '-') {
207
+				if (is_string(strstr($haystack, substr($s, 1))) == false) {
208 208
 					$is_false = false;
209 209
 					break;
210 210
 				}
211
-			} elseif (is_string(strstr($haystack,$s)) == true) {
211
+			} elseif (is_string(strstr($haystack, $s)) == true) {
212 212
 				$is_false = false;
213 213
 				break;
214 214
 			}
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 		$freq = $format_recur_lang[$freq][$tmp];
236 236
 	}
237 237
 
238
-	if		(isset($arr['COUNT']))	$for = str_replace('%int%',$arr['COUNT'],$format_recur_lang['count']);
239
-	elseif	(isset($arr['UNTIL']))	$for = str_replace('%date%',$arr['UNTIL'], $format_recur_lang['until']);
238
+	if (isset($arr['COUNT']))	$for = str_replace('%int%', $arr['COUNT'], $format_recur_lang['count']);
239
+	elseif (isset($arr['UNTIL']))	$for = str_replace('%date%', $arr['UNTIL'], $format_recur_lang['until']);
240 240
 	else							$for = '';
241 241
 
242 242
 	$print = $format_recur_lang['start'];
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 		$list = '';
249 249
 		$last = count($arr['BYMONTH']) - 1;
250 250
 		foreach ($arr['BYMONTH'] as $key => $month) {
251
-			if ($key == $last)	$list .= $monthsofyear_lang[($month-1)];
252
-			else 				$list .= $monthsofyear_lang[($month-1)].$d;
251
+			if ($key == $last)	$list .= $monthsofyear_lang[($month - 1)];
252
+			else 				$list .= $monthsofyear_lang[($month - 1)].$d;
253 253
 		}
254 254
 		$print .= '<br />'."\n";
255 255
 		$print .= str_replace('%list%', $list, $format_recur_lang['bymonth']);
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 		if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') unset($arr['BYMONTHDAY'][$last]);
261 261
 		$last = count($arr['BYMONTHDAY']) - 1;
262 262
 		foreach ($arr['BYMONTHDAY'] as $key => $day) {
263
-			ereg('(-{0,1})([0-9]{1,2})',$day,$regs);
264
-			list($junk,$sign,$day) = $regs;
263
+			ereg('(-{0,1})([0-9]{1,2})', $day, $regs);
264
+			list($junk, $sign, $day) = $regs;
265 265
 			if ($sign != '')	$list .= $sign;
266 266
 			if ($key == $last)	$list .= $day;
267 267
 			else				$list .= $day.$d;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 		$list = '';
275 275
 		$last = count($arr['BYDAY']) - 1;
276 276
 		foreach ($arr['BYDAY'] as $key => $day) {
277
-			ereg('([-\+]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs);
278
-			list($junk,$sign,$day_num,$day_txt) = $regs;
279
-			$num = two2threeCharDays($day_txt,false);
277
+			ereg('([-\+]{0,1})([0-9]{0,1})([A-Z]{2})', $day, $regs);
278
+			list($junk, $sign, $day_num, $day_txt) = $regs;
279
+			$num = two2threeCharDays($day_txt, false);
280 280
 			if ($sign != '')	$list .= $sign;
281 281
 			if ($day_num != '')	$list .= $day_num.' ';
282 282
 			if ($key == $last)	$list .= $daysofweek_lang[$num];
Please login to merge, or discard this patch.
phpicalendar/day.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 $weekstart 		= 1;
28 28
 $unix_time 		= strtotime($getdate);
29
-$today_today 	= date('Ymd', time() + $phpiCal_config->second_offset);  
30
-$next_day		= date('Ymd', strtotime("+1 day",  $unix_time));
31
-$prev_day 		= date('Ymd', strtotime("-1 day",  $unix_time));
29
+$today_today = date('Ymd', time() + $phpiCal_config->second_offset);  
30
+$next_day = date('Ymd', strtotime("+1 day", $unix_time));
31
+$prev_day = date('Ymd', strtotime("-1 day", $unix_time));
32 32
 
33 33
 $display_date = localizeDate($dateFormat_day, $unix_time);
34 34
 $sidebar_date = localizeDate($dateFormat_week_list, $unix_time);
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 // select for calendars
39
-$available		= availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED);
39
+$available = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED);
40 40
 $list_icals 	= display_ical_list($available);
41 41
 $list_years 	= list_years();
42
-$list_months 	= list_months();
42
+$list_months = list_months();
43 43
 $list_weeks 	= list_weeks();
44 44
 $list_jumps 	= list_jumps();
45 45
 $list_calcolors = list_calcolors();
Please login to merge, or discard this patch.
phpicalendar/default_config.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class Configs{
2
+class Configs {
3 3
 	private static $instance;
4
-	private function __construct(){
4
+	private function __construct() {
5 5
 		$this->phpicalendar_version = '2.4';
6 6
 	// Configuration file for PHP iCalendar 2.4
7 7
 	//
@@ -10,88 +10,88 @@  discard block
 block discarded – undo
10 10
 #=================Initialize global variables=================================
11 11
 // Define some magic strings.
12 12
 		$this->ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
13
-		$this->template 				= 'default';		// Template support
14
-		$this->default_view 			= 'day';			// Default view for calendars = 'day', 'week', 'month', 'year'
15
-		$this->minical_view 			= 'current';		// Where do the mini-calendars go when clicked? = 'day', 'week', 'month', 'current'
16
-		$this->default_cal 				= $this->ALL_CALENDARS_COMBINED;		// Exact filename of calendar without .ics. Or set to $this->ALL_CALENDARS_COMBINED to open all calenders combined into one.
17
-		$this->language 				= 'English';		// Language support - 'English', 'Polish', 'German', 'French', 'Dutch', 'Danish', 'Italian', 'Japanese', 'Norwegian', 'Spanish', 'Swedish', 'Portuguese', 'Catalan', 'Traditional_Chinese', 'Esperanto', 'Korean'
18
-		$this->week_start_day 			= 'Sunday';			// Day of the week your week starts on
19
-		$this->week_length				= '7';				// Number of days to display in the week view
20
-		$this->day_start 				= '0600';			// Start time for day grid
21
-		$this->day_end					= '2000';			// End time for day grid
22
-		$this->gridLength 				= '15';				// Grid distance in minutes for day view, multiples of 15 preferred
23
-		$this->num_years 				= '1';				// Number of years (up and back) to display in 'Jump to'
24
-		$this->month_event_lines 		= '0';				// Number of lines to wrap each event title in month view, 0 means display all lines.
25
-		$this->tomorrows_events_lines 	= '1';				// Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines.
26
-		$this->allday_week_lines 		= '1';				// Number of lines to wrap each event title in all-day events in week view, 0 means display all lines.
27
-		$this->week_events_lines 		= '1';				// Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines.
28
-		$this->timezone 				= '';				// Set timezone. Read TIMEZONES file for more information
29
-		$this->calendar_path 			= '';				// Leave this blank on most installs, place your full FILE SYSTEM PATH to calendars if they are outside the phpicalendar folder.
30
-		$this->second_offset			= '';				// The time in seconds between your time and your server's time.
31
-		$this->bleed_time				= '-1';				// This allows events past midnight to just be displayed on the starting date, only good up to 24 hours. Range from '0000' to '2359', or '-1' for no bleed time.
32
-		$this->cookie_uri				= ''; 				// The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar -- AUTO SETTING -- Only set if you are having cookie issues.
33
-		$this->download_uri				= ''; 				// The HTTP URL to your calendars directory, ie. http://www.example.com/phpicalendar/calendars -- AUTO SETTING -- Only set if you are having subscribe issues.
34
-		$this->default_path				= ''; 				// The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar
35
-		$this->cpath	     			= ''; 				// optional subdirectory
36
-		$this->charset					= 'UTF-8';			// Character set your calendar is in, suggested UTF-8, or iso-8859-1 for most languages.
13
+		$this->template = 'default'; // Template support
14
+		$this->default_view 			= 'day'; // Default view for calendars = 'day', 'week', 'month', 'year'
15
+		$this->minical_view 			= 'current'; // Where do the mini-calendars go when clicked? = 'day', 'week', 'month', 'current'
16
+		$this->default_cal 				= $this->ALL_CALENDARS_COMBINED; // Exact filename of calendar without .ics. Or set to $this->ALL_CALENDARS_COMBINED to open all calenders combined into one.
17
+		$this->language = 'English'; // Language support - 'English', 'Polish', 'German', 'French', 'Dutch', 'Danish', 'Italian', 'Japanese', 'Norwegian', 'Spanish', 'Swedish', 'Portuguese', 'Catalan', 'Traditional_Chinese', 'Esperanto', 'Korean'
18
+		$this->week_start_day = 'Sunday'; // Day of the week your week starts on
19
+		$this->week_length				= '7'; // Number of days to display in the week view
20
+		$this->day_start 				= '0600'; // Start time for day grid
21
+		$this->day_end = '2000'; // End time for day grid
22
+		$this->gridLength 				= '15'; // Grid distance in minutes for day view, multiples of 15 preferred
23
+		$this->num_years 				= '1'; // Number of years (up and back) to display in 'Jump to'
24
+		$this->month_event_lines 		= '0'; // Number of lines to wrap each event title in month view, 0 means display all lines.
25
+		$this->tomorrows_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines.
26
+		$this->allday_week_lines 		= '1'; // Number of lines to wrap each event title in all-day events in week view, 0 means display all lines.
27
+		$this->week_events_lines 		= '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines.
28
+		$this->timezone = ''; // Set timezone. Read TIMEZONES file for more information
29
+		$this->calendar_path = ''; // Leave this blank on most installs, place your full FILE SYSTEM PATH to calendars if they are outside the phpicalendar folder.
30
+		$this->second_offset			= ''; // The time in seconds between your time and your server's time.
31
+		$this->bleed_time				= '-1'; // This allows events past midnight to just be displayed on the starting date, only good up to 24 hours. Range from '0000' to '2359', or '-1' for no bleed time.
32
+		$this->cookie_uri				= ''; // The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar -- AUTO SETTING -- Only set if you are having cookie issues.
33
+		$this->download_uri				= ''; // The HTTP URL to your calendars directory, ie. http://www.example.com/phpicalendar/calendars -- AUTO SETTING -- Only set if you are having subscribe issues.
34
+		$this->default_path				= ''; // The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar
35
+		$this->cpath	     			= ''; // optional subdirectory
36
+		$this->charset = 'UTF-8'; // Character set your calendar is in, suggested UTF-8, or iso-8859-1 for most languages.
37 37
 
38 38
 		// Yes/No questions --- 'yes' means Yes, anything else means no. 'yes' must be lowercase.
39
-		$this->allow_webcals 			= 'no';				// Allow http:// and webcal:// prefixed URLs to be used as the $this->cal for remote viewing of "subscribe-able" calendars. This does not have to be enabled to allow specific ones below.
40
-		$this->month_locations  		= 'yes';			// Display location in the month view.
41
-		$this->this_months_events 		= 'yes';			// Display "This month's events" at the bottom off the month page.
42
-		$this->enable_rss				= 'yes';			// Enable RSS access to your calendars (good thing).
43
-		$this->rss_link_to_event		= '';				// Set to yes to have links in the feed popup an event window.  Default is to link to day.php
44
-		$this->show_search				= 'no';			// Show the search box in the sidebar.
45
-		$this->allow_preferences		= 'yes';			// Allow visitors to change various preferences via cookies.
46
-		$this->printview_default		= 'no';				// Set print view as the default view. day, week, and month only supported views for $this->default_view (listed well above).
47
-		$this->show_todos				= 'yes';			// Show your todo list on the side of day and week view.
48
-		$this->show_completed			= 'yes';				// Show completed todos on your todo list.
49
-		$this->event_download			= 'no';				// Show completed todos on your todo list.
50
-		$this->allow_login				= 'no';				// Set to yes to prompt for login to unlock calendars.
51
-		$this->login_cookies			= 'no';			// Set to yes to store authentication information via (unencrypted) cookies. Set to no to use sessions.
52
-		$this->support_ical				= 'no';			// Set to yes to support the Apple iCal calendar database structure.
53
-		$this->recursive_path			= 'no';			// Set to yes to recurse into subdirectories of the calendar path.
39
+		$this->allow_webcals = 'no'; // Allow http:// and webcal:// prefixed URLs to be used as the $this->cal for remote viewing of "subscribe-able" calendars. This does not have to be enabled to allow specific ones below.
40
+		$this->month_locations  		= 'yes'; // Display location in the month view.
41
+		$this->this_months_events = 'yes'; // Display "This month's events" at the bottom off the month page.
42
+		$this->enable_rss = 'yes'; // Enable RSS access to your calendars (good thing).
43
+		$this->rss_link_to_event		= ''; // Set to yes to have links in the feed popup an event window.  Default is to link to day.php
44
+		$this->show_search = 'no'; // Show the search box in the sidebar.
45
+		$this->allow_preferences		= 'yes'; // Allow visitors to change various preferences via cookies.
46
+		$this->printview_default		= 'no'; // Set print view as the default view. day, week, and month only supported views for $this->default_view (listed well above).
47
+		$this->show_todos = 'yes'; // Show your todo list on the side of day and week view.
48
+		$this->show_completed			= 'yes'; // Show completed todos on your todo list.
49
+		$this->event_download			= 'no'; // Show completed todos on your todo list.
50
+		$this->allow_login = 'no'; // Set to yes to prompt for login to unlock calendars.
51
+		$this->login_cookies			= 'no'; // Set to yes to store authentication information via (unencrypted) cookies. Set to no to use sessions.
52
+		$this->support_ical				= 'no'; // Set to yes to support the Apple iCal calendar database structure.
53
+		$this->recursive_path = 'no'; // Set to yes to recurse into subdirectories of the calendar path.
54 54
 
55 55
 		// Calendar Caching (decreases page load times)
56
-		$this->save_parsed_cals 		= 'no';				// Saves a copy of the cal in /tmp after it's been parsed. Improves performance.
57
-		$this->tmp_dir					= '/tmp';			// The temporary directory on your system (/tmp is fine for UNIXes including Mac OS X). Any php-writable folder works.
58
-		$this->webcal_hours				= '24';				// Number of hours to cache webcals. Setting to '0' will always re-parse webcals if they've been modified.
56
+		$this->save_parsed_cals = 'no'; // Saves a copy of the cal in /tmp after it's been parsed. Improves performance.
57
+		$this->tmp_dir = '/tmp'; // The temporary directory on your system (/tmp is fine for UNIXes including Mac OS X). Any php-writable folder works.
58
+		$this->webcal_hours = '24'; // Number of hours to cache webcals. Setting to '0' will always re-parse webcals if they've been modified.
59 59
 
60 60
 		// Webdav style publishing
61
-		$this->phpicalendar_publishing 	= '0';				// Set to '1' to enable remote webdav style publish. See 'calendars/publish.php' for complete information;
61
+		$this->phpicalendar_publishing = '0'; // Set to '1' to enable remote webdav style publish. See 'calendars/publish.php' for complete information;
62 62
 
63 63
 		// Administration settings (/admin/)
64
-		$this->allow_admin				= 'no';			// Set to yes to allow the admin page - remember to change the default password if using 'internal' as the $this->auth_method
65
-		$this->auth_method				= 'internal';			// Valid values are: 'ftp', 'internal', or 'none'. 'ftp' uses the ftp server's username and password as well as ftp commands to delete and copy files. 'internal' uses $this->auth_internal_username and $this->auth_internal_password defined below - CHANGE the password. 'none' uses NO authentication - meant to be used with another form of authentication such as http basic.
66
-		$this->auth_internal_username	= 'admin';			// Only used if $this->auth_method='internal'. The username for the administrator.
67
-		$this->auth_internal_password	= 'admin';			// Only used if $this->auth_method='internal'. The password for the administrator.
68
-		$this->ftp_server				= 'localhost';		// Only used if $this->auth_method='ftp'. The ftp server name. 'localhost' will work for most servers.
69
-		$this->ftp_port					= '21';				// Only used if $this->auth_method='ftp'. The ftp port. '21' is the default for ftp servers.
70
-		$this->ftp_calendar_path		= '';				// Only used if $this->auth_method='ftp'. The full path to the calendar directory on the ftp server. If = '', will attempt to deduce the path based on $this->calendar_path, but may not be accurate depending on ftp server config.
71
-		$this->salt                     = '';
64
+		$this->allow_admin				= 'no'; // Set to yes to allow the admin page - remember to change the default password if using 'internal' as the $this->auth_method
65
+		$this->auth_method				= 'internal'; // Valid values are: 'ftp', 'internal', or 'none'. 'ftp' uses the ftp server's username and password as well as ftp commands to delete and copy files. 'internal' uses $this->auth_internal_username and $this->auth_internal_password defined below - CHANGE the password. 'none' uses NO authentication - meant to be used with another form of authentication such as http basic.
66
+		$this->auth_internal_username	= 'admin'; // Only used if $this->auth_method='internal'. The username for the administrator.
67
+		$this->auth_internal_password	= 'admin'; // Only used if $this->auth_method='internal'. The password for the administrator.
68
+		$this->ftp_server = 'localhost'; // Only used if $this->auth_method='ftp'. The ftp server name. 'localhost' will work for most servers.
69
+		$this->ftp_port = '21'; // Only used if $this->auth_method='ftp'. The ftp port. '21' is the default for ftp servers.
70
+		$this->ftp_calendar_path = ''; // Only used if $this->auth_method='ftp'. The full path to the calendar directory on the ftp server. If = '', will attempt to deduce the path based on $this->calendar_path, but may not be accurate depending on ftp server config.
71
+		$this->salt = '';
72 72
 		// Calendar colors
73 73
 		//
74 74
 		// You can increase the number of unique colors by adding additional images (monthdot_n.gif)
75 75
 		// and in the css file (default.css) classes .alldaybg_n, .eventbg_n and .eventbg2_n
76 76
 		// Colors will repeat from the beginning for calendars past $this->unique_colors (7 by default), with no limit.
77
-		$this->unique_colors			= '7';
77
+		$this->unique_colors = '7';
78 78
 
79 79
 		return true;
80 80
 	}
81 81
 
82
-	public static function getInstance(){
83
-		if (empty(self::$instance)){
82
+	public static function getInstance() {
83
+		if (empty(self::$instance)) {
84 84
 			self::$instance = new Configs;
85 85
 		}
86 86
 		return self::$instance;
87 87
 	}
88 88
 
89 89
 	# val can be an array
90
-	public function setProperty($key,$val){
90
+	public function setProperty($key, $val) {
91 91
 		$this->$key = $val;
92 92
 		return;
93 93
 	}
94
-	public function getProperty($key){
94
+	public function getProperty($key) {
95 95
 		return $this->$key;
96 96
 	}
97 97
 }
Please login to merge, or discard this patch.
phpicalendar/includes/event.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 # information for the popup is sent via $_POST by a javascript snippet in 
9 9
 # in function openevent() from functions/date_functions.php
10 10
 # character encoding has been problematic with popups.
11
-$event			= unserialize(stripslashes($_POST['event_data']));
12
-$organizer 		= unserialize($event['organizer']);
13
-$attendee 		= unserialize($event['attendee']);
14
-$uid    		= stripslashes($_POST['uid']);
11
+$event = unserialize(stripslashes($_POST['event_data']));
12
+$organizer = unserialize($event['organizer']);
13
+$attendee = unserialize($event['attendee']);
14
+$uid = stripslashes($_POST['uid']);
15 15
 
16 16
 // Format event time
17 17
 // All day
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 if (isset($organizer) && is_array($organizer)) {
39
-	$i=0;
39
+	$i = 0;
40 40
 	$organizers = array();
41 41
 	foreach ($organizer as $val) {
42 42
 		if (!empty($organizer[$i]["email"])) {
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 		$i++;
48 48
 	}
49
-	$organizer = implode(', ',$organizers);
49
+	$organizer = implode(', ', $organizers);
50 50
 }
51 51
 if (isset($attendee) && is_array($attendee)) {
52
-	$i=0;
52
+	$i = 0;
53 53
 	$attendees = array();
54 54
 	foreach ($attendee as $val) {
55 55
 		if (!empty($attendee[$i]["email"])) {
@@ -59,36 +59,36 @@  discard block
 block discarded – undo
59 59
 		}
60 60
 		$i++;
61 61
 	}
62
-	$attendee = implode(', ',$attendees);
62
+	$attendee = implode(', ', $attendees);
63 63
 }
64 64
 if (isset($event['location'])) $event['location'] = stripslashes($event['location']);
65 65
 if (sizeof($attendee) == 0) $attendee = '';
66 66
 if (sizeof($organizer) == 0) $organizer = '';
67 67
 if ($event['url'] != '') $event['url'] = '<a href="'.$event['url'].'" target="_blank">'.$event['url'].'</a>';
68 68
 
69
-switch ($event['status']){
69
+switch ($event['status']) {
70 70
 	case 'CONFIRMED':
71
-		$event['status'] =	$lang['l_status_confirmed'] ; 
71
+		$event['status'] = $lang['l_status_confirmed']; 
72 72
 		break;
73 73
 	case 'CANCELLED':
74
-		$event['status'] =	$lang['l_status_cancelled'] ; 
74
+		$event['status'] = $lang['l_status_cancelled']; 
75 75
 		break;
76 76
 	case 'TENTATIVE':
77
-		$event['status'] =	$lang['l_status_tentative'] ; 
77
+		$event['status'] = $lang['l_status_tentative']; 
78 78
 		break;
79 79
 	default:	
80
-		$event['status'] =	'' ; 
80
+		$event['status'] = ''; 
81 81
 }
82 82
 
83 83
 $event_download = '';
84
-if($phpiCal_config->event_download == 'yes') $event_download = "
84
+if ($phpiCal_config->event_download == 'yes') $event_download = "
85 85
 <form action='' method='post'>
86 86
 <input type=hidden name='event_data' value = '".$_POST['event_data']."' />
87 87
 <input type=hidden name='uid' value = '".$_POST['uid']."' />
88 88
 <input type='submit' name='submit' value='".$lang['l_download_event']."' />
89 89
 <form>";
90 90
 
91
-if (isset($_POST['submit'])){
91
+if (isset($_POST['submit'])) {
92 92
 header("Content-Type: text/calendar; charset=utf-8; name=$uid");
93 93
 header("Content-Disposition: attachment; filename=$uid");
94 94
 echo 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 UID:$uid
100 100
 SUMMARY:".$event['event_text']."
101 101
 CATEGORIES:".$event['calname']."
102
-DTSTART;TZID=".$event['timezone'].":".date("Ymd\THis",$event['start_unixtime'])."
103
-DTEND;TZID=".$event['timezone'].":".date("Ymd\THis",$event['start_unixtime'])."
102
+DTSTART;TZID=".$event['timezone'].":".date("Ymd\THis", $event['start_unixtime'])."
103
+DTEND;TZID=".$event['timezone'].":".date("Ymd\THis", $event['start_unixtime'])."
104 104
 CLASS:".$event['class']."
105 105
 ".$event['other']."
106 106
 SEQUENCE:1
Please login to merge, or discard this patch.
phpicalendar/includes/todo.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
10 10
 // Set the variables from the array
11 11
 $vtodo_text		= (isset($vtodo_array['vtodo_text'])) ? $vtodo_array['vtodo_text'] : ('');
12 12
 $description	= (isset($vtodo_array['description'])) ? $vtodo_array['description'] : ('');
13
-$completed_date	= (isset($vtodo_array['completed_date'])) ? localizeDate ($dateFormat_day, strtotime($vtodo_array['completed_date'])) : ('');
14
-$status			= (isset($vtodo_array['status'])) ? $vtodo_array['status'] : ('');
13
+$completed_date	= (isset($vtodo_array['completed_date'])) ? localizeDate($dateFormat_day, strtotime($vtodo_array['completed_date'])) : ('');
14
+$status = (isset($vtodo_array['status'])) ? $vtodo_array['status'] : ('');
15 15
 $calendar_name  = (isset($vtodo_array['cal'])) ? $vtodo_array['cal'] : ('');
16
-$start_date 	= (isset($vtodo_array['start_date'])) ? localizeDate ($dateFormat_day, strtotime($vtodo_array['start_date'])) : ('');
17
-$due_date 		= (isset($vtodo_array['due_date'])) ? localizeDate ($dateFormat_day, strtotime($vtodo_array['due_date'])) : ('');
16
+$start_date = (isset($vtodo_array['start_date'])) ? localizeDate($dateFormat_day, strtotime($vtodo_array['start_date'])) : ('');
17
+$due_date 		= (isset($vtodo_array['due_date'])) ? localizeDate($dateFormat_day, strtotime($vtodo_array['due_date'])) : ('');
18 18
 $priority 		= (isset($vtodo_array['priority'])) ? $vtodo_array['priority'] : ('');
19 19
 
20 20
 $cal_title_full = $calendar_name.' '.$lang['l_calendar'];
21 21
 $description	= ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\0">\0</a>', $description);
22
-$vtodo_text		= ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>',$vtodo_text);
22
+$vtodo_text		= ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\0">\0</a>', $vtodo_text);
23 23
 
24 24
 
25 25
 if ((!isset($status) || $status == "COMPLETED") && isset($completed_date)) {
26
-	$status = $lang['l_completed_date'] . ' ' . $completed_date;
26
+	$status = $lang['l_completed_date'].' '.$completed_date;
27 27
 } elseif ($status == "COMPLETED") {
28 28
 	$status = $lang['l_completed'];
29 29
 } else {
Please login to merge, or discard this patch.
phpicalendar/config.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 #     'language'             => 'English',
52 52
 #     'default_cal'          => 'US Holidays',	   // Exact filename of calendar without .ics.
53 53
 #     'template'             => 'green',           // Template support: change this to have a different "skin" for your installation.     
54
-    'default_view'         => 'year',           // Default view for calendars'     => 'day', 'week', 'month', 'year'
54
+    'default_view'         => 'year', // Default view for calendars'     => 'day', 'week', 'month', 'year'
55 55
 #      'printview_default'    => 'yes',	           // Set print view as the default view. Uses'default_view (listed above).
56 56
 #     'gridLength'           => 10,                // Grid size in day and week views. Allowed values are 1,2,3,4,10,12,15,20,30,60. Default is 15
57 57
 #     'minical_view'         => 'current',	       // Where do the mini-calendars go when clicked?'     => 'day', 'week', 'month', 'current'
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 these arrays provide extra calendar options.
112 112
 
113 113
 */
114
-$locked_map['user1:pass'] = array('');             // Map username:password accounts to locked calendars that should be
115
-$locked_map['user2:pass'] = array('');             // unlocked if logged in. Calendar names should be the same as what is
116
-$locked_map['user3:pass'] = array('');             // listed in the $locked_cals, again without the .ics suffix.
117
-$locked_map['user4:pass'] = array('');             // Example: $locked_map['username:password'] = array('Locked1', 'Locked2');
114
+$locked_map['user1:pass'] = array(''); // Map username:password accounts to locked calendars that should be
115
+$locked_map['user2:pass'] = array(''); // unlocked if logged in. Calendar names should be the same as what is
116
+$locked_map['user3:pass'] = array(''); // listed in the $locked_cals, again without the .ics suffix.
117
+$locked_map['user4:pass'] = array(''); // Example: $locked_map['username:password'] = array('Locked1', 'Locked2');
118 118
 // add more lines as necessary
119 119
 
120
-$apache_map['user1'] = array('');                  // Map HTTP authenticated users to specific calendars. Users listed here and
121
-$apache_map['user2'] = array('');                  // authenticated via HTTP will not see the public calendars, and will not be
122
-$apache_map['user3'] = array('');                  // given any login/logout options. Calendar names not include the .ics suffix.
123
-$apache_map['user4'] = array('');                  // Example: $apache_map['username'] = array('Calendar1', 'Calendar2');
120
+$apache_map['user1'] = array(''); // Map HTTP authenticated users to specific calendars. Users listed here and
121
+$apache_map['user2'] = array(''); // authenticated via HTTP will not see the public calendars, and will not be
122
+$apache_map['user3'] = array(''); // given any login/logout options. Calendar names not include the .ics suffix.
123
+$apache_map['user4'] = array(''); // Example: $apache_map['username'] = array('Calendar1', 'Calendar2');
Please login to merge, or discard this patch.
phpicalendar/error.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('BASE')) define('BASE','./');
2
+if (!defined('BASE')) define('BASE', './');
3 3
 require_once(BASE.'functions/template.php');
4 4
 
5 5
 
6
-function error($error_msg='There was an error processing the request.', $file='NONE', $error_base='') {
6
+function error($error_msg = 'There was an error processing the request.', $file = 'NONE', $error_base = '') {
7 7
 	global $getdate, $rss_powered, $lang, $phpiCal_config, $cal;
8 8
 	if (!isset($template))					$template = $phpiCal_config->template;
9 9
 		
10
-	$error_calendar 	= sprintf($lang['l_error_calendar'], print_r($file,true));
10
+	$error_calendar 	= sprintf($lang['l_error_calendar'], print_r($file, true));
11 11
 	$current_view 		= 'error';
12 12
 	$display_date 		= $lang['l_error_title'];
13 13
 	$calendar_name 		= $lang['l_error_title'];
14 14
 	
15 15
 	$default_path = $phpiCal_config->default_path;
16 16
 	if (empty($phpiCal_config->default_path)) {
17
-		if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on' ) {
18
-			$default_path = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/rss/'));
17
+		if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') {
18
+			$default_path = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
19 19
 		} else {
20
-			$default_path = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/rss/'));
20
+			$default_path = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
21 21
 		}
22 22
 	}
23 23
 	$page = new Page(BASE.'templates/'.$template.'/error.tpl');
Please login to merge, or discard this patch.