Completed
Branch master (c3ca5f)
by Seth
04:51
created
phpicalendar/functions/template.php 1 patch
Braces   +85 added lines, -47 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
 							$event_start 	= $new_val2['event_start'];
98 98
 							$event_end 		= $new_val2['event_end'];
99
-							if (isset($new_val2['display_end'])) $event_end = $new_val2['display_end'];
99
+							if (isset($new_val2['display_end'])) {
100
+								$event_end = $new_val2['display_end'];
101
+							}
100 102
 							if ($cal_time == -1) {
101 103
 								$event_start = $lang['l_all_day'];
102 104
 								$event_start2 = '';
@@ -105,7 +107,9 @@  discard block
 block discarded – undo
105 107
 								$event_start 	= date ($timeFormat, strtotime ($event_start));
106 108
 								$event_end 		= date ($timeFormat, strtotime ($event_end));
107 109
 								$event_start 	= $event_start .' - '.$event_end;
108
-								if (date('Ymd', $new_val2['start_unixtime']) != date('Ymd', $new_val2['end_unixtime'])) $event_start .= ' '.localizeDate($dateFormat_day, $new_val2['end_unixtime']);
110
+								if (date('Ymd', $new_val2['start_unixtime']) != date('Ymd', $new_val2['end_unixtime'])) {
111
+									$event_start .= ' '.localizeDate($dateFormat_day, $new_val2['end_unixtime']);
112
+								}
109 113
 							}
110 114
 						}
111 115
 
@@ -124,7 +128,9 @@  discard block
 block discarded – undo
124 128
 						$events_tmp	= $loop_event;
125 129
 					}
126 130
 				}
127
-				if ($day_events == 0) continue;
131
+				if ($day_events == 0) {
132
+					continue;
133
+				}
128 134
 				$day_tmp  = str_replace('{DAYOFMONTH}', $dayofmonth, $day_tmp);
129 135
 				$final   .= $day_tmp.$some_events;
130 136
 				unset ($day_tmp);
@@ -168,7 +174,9 @@  discard block
 block discarded – undo
168 174
 					$location 		= sanitizeForWeb(stripslashes(urldecode($val['location'])));
169 175
 					$event_start 	= $val['event_start'];
170 176
 					$event_end 		= $val['event_end'];
171
-					if (isset($val['display_end'])) $event_end = $val['display_end'];
177
+					if (isset($val['display_end'])) {
178
+						$event_end = $val['display_end'];
179
+					}
172 180
 					if (!$val['event_start']) {
173 181
 						$event_start = $lang['l_all_day'];
174 182
 						$event_start2 = '';
@@ -185,7 +193,7 @@  discard block
 block discarded – undo
185 193
 				}
186 194
 					if (!isset($val['exceptions'])) {
187 195
 					$events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', '', $events_tmp);
188
-				}else{
196
+				} else{
189 197
 					$some_exceptions = '';
190 198
 					foreach ($val['exceptions'] as $except_val){
191 199
 						$except_tmp	= $loop_except;
@@ -206,13 +214,13 @@  discard block
 block discarded – undo
206 214
 						#is there a recur in the exception?
207 215
 						if (!$except_val['recur']) {
208 216
 							$except_tmp = preg_replace('!<\!-- switch except_recur on -->.*<\!-- switch except_recur off -->!Uis', '', $except_tmp);
209
-						}else{
217
+						} else{
210 218
 							$except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp);
211 219
 						}
212 220
 						#is there a description in the exception?
213 221
 						if (!$except_val['description']) {
214 222
 							$except_tmp = preg_replace('!<\!-- switch except_description on -->.*<\!-- switch except_description off -->!Uis', '', $except_tmp);
215
-						}else{
223
+						} else{
216 224
 							$except_description = stripslashes(urldecode($except_val['description']));
217 225
 							$except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp);
218 226
 						}
@@ -227,7 +235,7 @@  discard block
 block discarded – undo
227 235
 				if (!$val['recur']) {
228 236
 					$events_tmp = preg_replace('!<\!-- switch recur on -->.*<\!-- switch recur off -->!Uis', '', $events_tmp);
229 237
 					$events_tmp = str_replace('{L_STARTING_ON}', '', $events_tmp);
230
-				}else{
238
+				} else{
231 239
 					$events_tmp = str_replace('{RECUR}', $val['recur'], $events_tmp);
232 240
 				}
233 241
 
@@ -296,7 +304,9 @@  discard block
 block discarded – undo
296 304
 		foreach ($weekarray as $i=>$get_date){
297 305
 			if (isset($master_array[$get_date]['-1']) && is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1'])){
298 306
 				foreach ($master_array[$get_date]['-1'] as $uid => $allday){
299
-					if (!array_key_exists($uid, $allday_uids)) $allday_uids[$uid] = $get_date;
307
+					if (!array_key_exists($uid, $allday_uids)) {
308
+						$allday_uids[$uid] = $get_date;
309
+					}
300 310
 					$allday_uid_dates[$uid][] = $get_date;
301 311
 				}
302 312
 			}
@@ -310,7 +320,9 @@  discard block
 block discarded – undo
310 320
 				$colspan  = 0;
311 321
 				$replace  .= $loop_begin; # <td>
312 322
 
313
-				if ($weekarray[$day] == $getdate) $replace = str_replace('{TODAY}', 'rowToday', $replace);
323
+				if ($weekarray[$day] == $getdate) {
324
+					$replace = str_replace('{TODAY}', 'rowToday', $replace);
325
+				}
314 326
 				$replace 	= str_replace('{TODAY}', 'rowOff', $replace);
315 327
 
316 328
 				if(array_search($weekarray[$day], $allday_uids)){
@@ -329,7 +341,7 @@  discard block
 block discarded – undo
329 341
 					$replace		= str_replace('{NOBORDER}', ' style="border-top: none;"', $replace);
330 342
 					$replace		.= $loop_tmp;
331 343
 					$replace		.= $loop_end;
332
-				}else{
344
+				} else{
333 345
 					$replace		= str_replace('{NOBORDER}', '', $replace);
334 346
 					$colspan		= $nbrGridCols[$weekarray[$day]];
335 347
 					$replace		.= $loop_end;
@@ -355,7 +367,7 @@  discard block
 block discarded – undo
355 367
 				$row1 = 'rowToday';
356 368
 				$row2 = 'rowOn';
357 369
 				$row3 = 'rowToday';
358
-			}else{
370
+			} else{
359 371
 				$row1 = 'rowOff';
360 372
 				$row2 = 'rowOn';
361 373
 				$row3 = 'rowOff';
@@ -405,7 +417,9 @@  discard block
 block discarded – undo
405 417
 				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
406 418
 			} else {
407 419
 				$even_row = '';
408
-				if (ereg('([0-9]{1,2}):30', $key)) $even_row = '3';
420
+				if (ereg('([0-9]{1,2}):30', $key)) {
421
+					$even_row = '3';
422
+				}
409 423
 				# empty row for each gridLength, to the right of times and left of first weekday
410 424
 				$weekdisplay .= '<tr>';
411 425
 				$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
@@ -420,7 +434,9 @@  discard block
 block discarded – undo
420 434
 					foreach($master_array[$thisday] as $time_key => $time_arr) {
421 435
 						if ((int)$time_key <= (int)$cal_time && is_array($time_arr) && $time_key != '-1') {
422 436
 							foreach($time_arr as $uid => $event_tmp) {
423
-								if ((int)$event_tmp['display_end'] > (int)$cal_time) $this_time_arr[$uid] = $event_tmp;
437
+								if ((int)$event_tmp['display_end'] > (int)$cal_time) {
438
+									$this_time_arr[$uid] = $event_tmp;
439
+								}
424 440
 							}
425 441
 						}
426 442
 					}
@@ -450,7 +466,9 @@  discard block
 block discarded – undo
450 466
 				if (empty($event_length[$thisday])) {
451 467
 					# no events
452 468
 					$tclass = $class;
453
-					if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
469
+					if ($thisday == $getdate) {
470
+						$tclass = ' class="weekborder'.$even_row.' weektoday"';
471
+					}
454 472
 					$drawWidth = 1;
455 473
 					$weekdisplay .= '<td colspan="' . $nbrGridCols[$thisday] . '"' . $tclass . '>&nbsp;</td>'."\n";
456 474
 				} else {
@@ -465,7 +483,9 @@  discard block
 block discarded – undo
465 483
 							case 'begin':
466 484
 								if ($ended_counter) {
467 485
 									$tclass = $class;
468
-									if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
486
+									if ($thisday == $getdate) {
487
+										$tclass = ' class="weekborder'.$even_row.' weektoday"';
488
+									}
469 489
 									$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
470 490
 									$ended_counter = 0;
471 491
 								}
@@ -478,7 +498,9 @@  discard block
 block discarded – undo
478 498
  								$event_recur = $this_time_arr[$uid]['recur'];
479 499
 								$event_calno = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
480 500
 								$confirmed = '';
481
-						  		if (is_array($event_recur)) $confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
501
+						  		if (is_array($event_recur)) {
502
+						  			$confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
503
+						  		}
482 504
 								if ($event_status != '') {
483 505
 						  			$confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
484 506
 						  		}
@@ -487,11 +509,9 @@  discard block
 block discarded – undo
487 509
 								if ($event_date_start != $event_date_end) {
488 510
 									if ($thisday == $event_date_start) {
489 511
 										$confirmed .= '<img src="images/longevent_start.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
490
-									}
491
-									else if ($thisday == $event_date_end) {
512
+									} else if ($thisday == $event_date_end) {
492 513
 										$confirmed .= '<img src="images/longevent_end.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
493
-									}
494
-									else {
514
+									} else {
495 515
 										$confirmed .= '<img src="images/longevent_mid.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
496 516
 									}
497 517
 								}
@@ -512,7 +532,9 @@  discard block
 block discarded – undo
512 532
 							case 'started':
513 533
 								if ($ended_counter) {
514 534
 									$tclass = $class;
515
-									if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
535
+									if ($thisday == $getdate) {
536
+										$tclass = ' class="weekborder'.$even_row.' weektoday"';
537
+									}
516 538
 									$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
517 539
 									$ended_counter = 0;
518 540
 								}
@@ -532,7 +554,9 @@  discard block
 block discarded – undo
532 554
 					//fill empty space on the right
533 555
 					if ($emptyWidth > 0) {
534 556
 						$tclass = $class;
535
-						if ($thisday == $getdate) $tclass = ' class="weekborder'.$even_row.' weektoday"';
557
+						if ($thisday == $getdate) {
558
+							$tclass = ' class="weekborder'.$even_row.' weektoday"';
559
+						}
536 560
 						$weekdisplay .= '<td colspan="' . $emptyWidth . '"'.$tclass.'>&nbsp;</td>'."\n";
537 561
 					}
538 562
 					while (isset($event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]['state']) && $event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]['state'] == 'ended') {
@@ -723,18 +747,20 @@  discard block
 block discarded – undo
723 747
  						  $event_status = strtolower($this_time_arr[$uid]['status']);
724 748
 						  $event_calno  = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
725 749
 						  $confirmed = '';
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
-						  if ($event_status != '') $confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
750
+						  if (is_array($event_recur)) {
751
+						  	$confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
752
+						  }
753
+						  if ($event_status != '') {
754
+						  	$confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
755
+						  }
728 756
 						  $event_date_start = date('Ymd', $this_time_arr[$uid]['start_unixtime']);
729 757
 						  $event_date_end   = date('Ymd', $this_time_arr[$uid]['end_unixtime']);
730 758
 						  if ($event_date_start != $event_date_end) {
731 759
 							  if ($getdate == $event_date_start) {
732 760
 								  $confirmed .= '<img src="images/longevent_start.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
733
-							  }
734
-							  else if ($getdate == $event_date_end) {
761
+							  } else if ($getdate == $event_date_end) {
735 762
 								  $confirmed .= '<img src="images/longevent_end.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
736
-							  }
737
-							  else {
763
+							  } else {
738 764
 								  $confirmed .= '<img src="images/longevent_mid.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
739 765
 							  }
740 766
 						  }
@@ -981,7 +1007,10 @@  discard block
 block discarded – undo
981 1007
 		$whole_month 		= TRUE;
982 1008
 
983 1009
 		do {
984
-			if ($i == 0) $middle .= $startweek; $i++;
1010
+			if ($i == 0) {
1011
+				$middle .= $startweek;
1012
+			}
1013
+			$i++;
985 1014
 			#$temp_middle			= $loop_md;
986 1015
 			$switch					= array('ALLDAY' => '', 'CAL' => $cal, 'MINICAL_VIEW' => $minical_view);
987 1016
 			$check_month 			= date ('m', $start_day);
@@ -1000,12 +1029,15 @@  discard block
 block discarded – undo
1000 1029
 				if ($type != 'small') {
1001 1030
 					foreach ($master_array[$daylink] as $cal_time => $event_times) {
1002 1031
 						foreach ($event_times as $uid => $val) {
1003
-							if (!isset($val['calnumber'])) continue;
1032
+							if (!isset($val['calnumber'])) {
1033
+								continue;
1034
+							}
1004 1035
 
1005 1036
 							if (($phpiCal_config->month_locations == 'yes') && isset($val['location']) && !empty($val['location'])) {
1006 1037
 								$location = '<br /><span style="font-size: 95%">' . sanitizeForWeb(stripslashes(urldecode($val['location']))) . '</span>';
1038
+							} else {
1039
+								$location = '';
1007 1040
 							}
1008
-							else $location = '';
1009 1041
 
1010 1042
 							$event_calno 	= $val['calnumber'];
1011 1043
 							$event_calno	= (($event_calno - 1) % $unique_colors) + 1;
@@ -1050,7 +1082,9 @@  discard block
 block discarded – undo
1050 1082
 				$i = 0;
1051 1083
 				$middle .= $endweek;
1052 1084
 				$checkagain = date ('m', $start_day);
1053
-				if ($checkagain != $minical_month) $whole_month = FALSE;
1085
+				if ($checkagain != $minical_month) {
1086
+					$whole_month = FALSE;
1087
+				}
1054 1088
 			}
1055 1089
 		} while ($whole_month == TRUE);
1056 1090
 
@@ -1091,7 +1125,9 @@  discard block
 block discarded – undo
1091 1125
 				#	$switch['START_DATE'] 	= localizeDate ($dateFormat_week_list, $u_start);
1092 1126
 					$start_date 	= localizeDate ($dateFormat_week_list, $u_start);
1093 1127
 					foreach ($event_times as $uid => $val) {
1094
-						if (isset($seen_events[$uid]) && @$val['spans_day'] == 1) continue;
1128
+						if (isset($seen_events[$uid]) && @$val['spans_day'] == 1) {
1129
+							continue;
1130
+						}
1095 1131
 						$seen_events[$uid] = 1;
1096 1132
 						$switch['CAL'] 			= $cal;
1097 1133
 						$switch['START_DATE'] 	= $start_date;
@@ -1138,7 +1174,9 @@  discard block
 block discarded – undo
1138 1174
 		if (!file_exists($file)){
1139 1175
 			#look for it in default if not found
1140 1176
 			$file = str_replace('templates/'.$phpiCal_config->template,'templates/default',$file);
1141
-			if (!file_exists($file)) die('Template file '.$file.' not found.');
1177
+			if (!file_exists($file)) {
1178
+				die('Template file '.$file.' not found.');
1179
+			}
1142 1180
 		}
1143 1181
 		$this->page = join('', file($file));
1144 1182
 		return;
@@ -1163,28 +1201,29 @@  discard block
 block discarded – undo
1163 1201
 	}
1164 1202
 
1165 1203
 	function replace_tags($tags = array()) {
1166
-		if (sizeof($tags) > 0)
1167
-			foreach ($tags as $tag => $data) {
1204
+		if (sizeof($tags) > 0) {
1205
+					foreach ($tags as $tag => $data) {
1168 1206
 
1169 1207
 				// This removes any unfilled tags
1170 1208
 				if (!$data) {
1171 1209
 					$this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->.*<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page);
1210
+		}
1172 1211
 				}
1173 1212
 
1174 1213
 				// This replaces any tags
1175 1214
 				$this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page);
1176
-			}
1177
-
1178
-		else
1179
-			die('No tags designated for replacement.');
1215
+			} else {
1216
+					die('No tags designated for replacement.');
1217
+		}
1180 1218
 		}
1181 1219
 
1182 1220
 	function replace_files($tags = array()) {
1183
-		if (sizeof($tags) > 0)
1184
-			foreach ($tags as $tag => $data) {
1221
+		if (sizeof($tags) > 0) {
1222
+					foreach ($tags as $tag => $data) {
1185 1223
 
1186 1224
 				// This opens up another template and parses it as well.
1187 1225
 				$data = $this->parse($data);
1226
+		}
1188 1227
 
1189 1228
 				// This removes any unfilled tags
1190 1229
 				if (!$data) {
@@ -1193,10 +1232,9 @@  discard block
 block discarded – undo
1193 1232
 
1194 1233
 				// This replaces any tags
1195 1234
 				$this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page);
1196
-			}
1197
-
1198
-		else
1199
-			die('No tags designated for replacement.');
1235
+			} else {
1236
+					die('No tags designated for replacement.');
1237
+		}
1200 1238
 		}
1201 1239
 
1202 1240
 	function output() {
Please login to merge, or discard this patch.
phpicalendar/index.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('BASE')) define('BASE', './');
2
+if (!defined('BASE')) {
3
+	define('BASE', './');
4
+}
3 5
 include_once(BASE.'functions/init.inc.php');
4 6
 
5 7
 if ($phpiCal_config->printview_default == 'yes') {
Please login to merge, or discard this patch.
phpicalendar/search.php 1 patch
Braces   +46 added lines, -17 removed lines patch added patch discarded remove patch
@@ -98,7 +98,9 @@  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 == ' ') {
102
+		return array(false,$and_arr,$or_arr,$not_arr);
103
+	}
102 104
 
103 105
 	// clean up search string
104 106
 	$search_str = trim($search_str);
@@ -176,10 +178,14 @@  discard block
 block discarded – undo
176 178
 	$or_arr = $needle_arr[2];
177 179
 	$not_arr = $needle_arr[3];
178 180
 
179
-	if (!$needle_arr[0]) return false;
181
+	if (!$needle_arr[0]) {
182
+		return false;
183
+	}
180 184
 	if ((sizeof($and_arr) == 0) &&
181 185
 		(sizeof($or_arr) == 0) &&
182
-		(sizeof($not_arr) == 0)) return false;
186
+		(sizeof($not_arr) == 0)) {
187
+		return false;
188
+	}
183 189
 
184 190
 	// compare lowercase versions of the strings
185 191
 	$haystack = strtolower($haystack);
@@ -213,7 +219,9 @@  discard block
 block discarded – undo
213 219
 				break;
214 220
 			}
215 221
 		}
216
-		if ($is_false) return false;
222
+		if ($is_false) {
223
+			return false;
224
+		}
217 225
 	}
218 226
 	// if we haven't returned false, then we return true
219 227
        # echo "return true<br>";
@@ -235,9 +243,13 @@  discard block
 block discarded – undo
235 243
 		$freq = $format_recur_lang[$freq][$tmp];
236 244
 	}
237 245
 
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
-	else							$for = '';
246
+	if		(isset($arr['COUNT'])) {
247
+		$for = str_replace('%int%',$arr['COUNT'],$format_recur_lang['count']);
248
+	} elseif	(isset($arr['UNTIL'])) {
249
+		$for = str_replace('%date%',$arr['UNTIL'], $format_recur_lang['until']);
250
+	} else {
251
+		$for = '';
252
+	}
241 253
 
242 254
 	$print = $format_recur_lang['start'];
243 255
 	$print = str_replace('%int%', $int, $print);
@@ -248,8 +260,11 @@  discard block
 block discarded – undo
248 260
 		$list = '';
249 261
 		$last = count($arr['BYMONTH']) - 1;
250 262
 		foreach ($arr['BYMONTH'] as $key => $month) {
251
-			if ($key == $last)	$list .= $monthsofyear_lang[($month-1)];
252
-			else 				$list .= $monthsofyear_lang[($month-1)].$d;
263
+			if ($key == $last) {
264
+				$list .= $monthsofyear_lang[($month-1)];
265
+			} else {
266
+				$list .= $monthsofyear_lang[($month-1)].$d;
267
+			}
253 268
 		}
254 269
 		$print .= '<br />'."\n";
255 270
 		$print .= str_replace('%list%', $list, $format_recur_lang['bymonth']);
@@ -257,14 +272,21 @@  discard block
 block discarded – undo
257 272
 
258 273
 	if (isset($arr['BYMONTHDAY'])) {
259 274
 		$list = '';
260
-		if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') unset($arr['BYMONTHDAY'][$last]);
275
+		if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') {
276
+			unset($arr['BYMONTHDAY'][$last]);
277
+		}
261 278
 		$last = count($arr['BYMONTHDAY']) - 1;
262 279
 		foreach ($arr['BYMONTHDAY'] as $key => $day) {
263 280
 			ereg('(-{0,1})([0-9]{1,2})',$day,$regs);
264 281
 			list($junk,$sign,$day) = $regs;
265
-			if ($sign != '')	$list .= $sign;
266
-			if ($key == $last)	$list .= $day;
267
-			else				$list .= $day.$d;
282
+			if ($sign != '') {
283
+				$list .= $sign;
284
+			}
285
+			if ($key == $last) {
286
+				$list .= $day;
287
+			} else {
288
+				$list .= $day.$d;
289
+			}
268 290
 		}
269 291
 		$print .= '<br />'."\n";
270 292
 		$print .= str_replace('%list%', $list, $format_recur_lang['bymonthday']);
@@ -277,10 +299,17 @@  discard block
 block discarded – undo
277 299
 			ereg('([-\+]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs);
278 300
 			list($junk,$sign,$day_num,$day_txt) = $regs;
279 301
 			$num = two2threeCharDays($day_txt,false);
280
-			if ($sign != '')	$list .= $sign;
281
-			if ($day_num != '')	$list .= $day_num.' ';
282
-			if ($key == $last)	$list .= $daysofweek_lang[$num];
283
-			else				$list .= $daysofweek_lang[$num].$d;
302
+			if ($sign != '') {
303
+				$list .= $sign;
304
+			}
305
+			if ($day_num != '') {
306
+				$list .= $day_num.' ';
307
+			}
308
+			if ($key == $last) {
309
+				$list .= $daysofweek_lang[$num];
310
+			} else {
311
+				$list .= $daysofweek_lang[$num].$d;
312
+			}
284 313
 		}
285 314
 		$print .= '<br />'."\n";
286 315
 		$print .= str_replace('%list%', $list, $format_recur_lang['byday']);
Please login to merge, or discard this patch.
phpicalendar/day.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 $current_view = 'day';
3
-if (!defined('BASE')) define('BASE', './');
3
+if (!defined('BASE')) {
4
+	define('BASE', './');
5
+}
4 6
 require_once(BASE.'functions/init.inc.php');
5 7
 header("Content-Type: text/html; charset=$phpiCal_config->charset");
6 8
 if (isset($_GET['jumpto_day'])) {
Please login to merge, or discard this patch.
phpicalendar/includes/event.php 1 patch
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,13 +19,17 @@  discard block
 block discarded – undo
19 19
 	$start = localizeDate($dateFormat_week, $event['start_unixtime']);
20 20
 	$end   = localizeDate($dateFormat_week, ($event['end_unixtime'] - 60));
21 21
 	$event_times = $lang['l_all_day']." $start";
22
-	if ($start != $end) $event_times = "$start - $end";
23
-} else {
22
+	if ($start != $end) {
23
+		$event_times = "$start - $end";
24
+	}
25
+	} else {
24 26
 	$start = date($timeFormat, $event['start_unixtime']);
25 27
 	$end   = date($timeFormat, $event['end_unixtime']);
26 28
 	$event_times = "$start";
27
-	if ($start != $end) $event_times = "$start - $end";
28
-}
29
+	if ($start != $end) {
30
+		$event_times = "$start - $end";
31
+	}
32
+	}
29 33
 
30 34
 $event['event_text']  = sanitizeForWeb(urldecode($event['event_text']));
31 35
 $event['description'] = sanitizeForWeb(urldecode($event['description']));
@@ -61,10 +65,18 @@  discard block
 block discarded – undo
61 65
 	}
62 66
 	$attendee = implode(', ',$attendees);
63 67
 }
64
-if (isset($event['location'])) $event['location'] = stripslashes($event['location']);
65
-if (sizeof($attendee) == 0) $attendee = '';
66
-if (sizeof($organizer) == 0) $organizer = '';
67
-if ($event['url'] != '') $event['url'] = '<a href="'.$event['url'].'" target="_blank">'.$event['url'].'</a>';
68
+if (isset($event['location'])) {
69
+	$event['location'] = stripslashes($event['location']);
70
+}
71
+if (sizeof($attendee) == 0) {
72
+	$attendee = '';
73
+}
74
+if (sizeof($organizer) == 0) {
75
+	$organizer = '';
76
+}
77
+if ($event['url'] != '') {
78
+	$event['url'] = '<a href="'.$event['url'].'" target="_blank">'.$event['url'].'</a>';
79
+}
68 80
 
69 81
 switch ($event['status']){
70 82
 	case 'CONFIRMED':
@@ -81,12 +93,14 @@  discard block
 block discarded – undo
81 93
 }
82 94
 
83 95
 $event_download = '';
84
-if($phpiCal_config->event_download == 'yes') $event_download = "
96
+if($phpiCal_config->event_download == 'yes') {
97
+	$event_download = "
85 98
 <form action='' method='post'>
86 99
 <input type=hidden name='event_data' value = '".$_POST['event_data']."' />
87 100
 <input type=hidden name='uid' value = '".$_POST['uid']."' />
88 101
 <input type='submit' name='submit' value='".$lang['l_download_event']."' />
89 102
 <form>";
103
+}
90 104
 
91 105
 if (isset($_POST['submit'])){
92 106
 header("Content-Type: text/calendar; charset=utf-8; name=$uid");
Please login to merge, or discard this patch.
phpicalendar/error.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,15 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('BASE')) define('BASE','./');
2
+if (!defined('BASE')) {
3
+	define('BASE','./');
4
+}
3 5
 require_once(BASE.'functions/template.php');
4 6
 
5 7
 
6 8
 function error($error_msg='There was an error processing the request.', $file='NONE', $error_base='') {
7 9
 	global $getdate, $rss_powered, $lang, $phpiCal_config, $cal;
8
-	if (!isset($template))					$template = $phpiCal_config->template;
10
+	if (!isset($template)) {
11
+		$template = $phpiCal_config->template;
12
+	}
9 13
 		
10 14
 	$error_calendar 	= sprintf($lang['l_error_calendar'], print_r($file,true));
11 15
 	$current_view 		= 'error';
Please login to merge, or discard this patch.
phpicalendar/preferences.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 
12 12
 $current_view = "preferences";
13 13
 $back_page = BASE.$phpiCal_config->default_view.'.php?cal='.$cal.'&amp;getdate='.$getdate.'&amp;cpath='.$cpath;
14
-if ($phpiCal_config->allow_preferences == 'no') header("Location: $back_page");
14
+if ($phpiCal_config->allow_preferences == 'no') {
15
+	header("Location: $back_page");
16
+}
15 17
 
16 18
 if (isset($_GET['action'])) {
17 19
 	$action = $_GET['action'];
@@ -50,12 +52,15 @@  discard block
 block discarded – undo
50 52
 		setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0);
51 53
 	} else {
52 54
 		setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0);
53
-		if (isset($_POST['cookie_view'])) 
54
-			$phpiCal_config->default_view = $_POST['cookie_view'];
55
-		if (isset($_POST['cookie_style']) && is_dir(BASE.'templates/'.$_POST['cookie_style'].'/')) 
56
-			$phpiCal_config->template = $_POST['cookie_style'];
57
-		if (isset($_POST['cookie_language']) && is_file(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php')) 
58
-			include(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php');
55
+		if (isset($_POST['cookie_view'])) {
56
+					$phpiCal_config->default_view = $_POST['cookie_view'];
57
+		}
58
+		if (isset($_POST['cookie_style']) && is_dir(BASE.'templates/'.$_POST['cookie_style'].'/')) {
59
+					$phpiCal_config->template = $_POST['cookie_style'];
60
+		}
61
+		if (isset($_POST['cookie_language']) && is_file(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php')) {
62
+					include(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php');
63
+		}
59 64
 	}
60 65
 	$_COOKIE[$cookie_name] = $the_cookie;
61 66
     $cpath = $cookie_cpath;
Please login to merge, or discard this patch.
phpicalendar/lib/HTTP/WebDAV/Server.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1300,7 +1300,9 @@
 block discarded – undo
1300 1300
         // does not understand or implement and MUST return a 501
1301 1301
         // (Not Implemented) response in such cases.
1302 1302
         foreach ($_SERVER as $key => $value) {
1303
-            if (strncmp($key, 'HTTP_CONTENT', 11)) continue;
1303
+            if (strncmp($key, 'HTTP_CONTENT', 11)) {
1304
+            	continue;
1305
+            }
1304 1306
             switch ($key) {
1305 1307
             case 'HTTP_CONTENT_ENCODING': // RFC2616 14.11
1306 1308
 
Please login to merge, or discard this patch.
phpicalendar/lib/HTTP/WebDAV/Tools/_parse_proppatch.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
     {
132 132
         if (strstr($name, " ")) {
133 133
             list($ns, $tag) = explode(" ", $name);
134
-            if ($ns == "")
135
-                $this->success = false;
134
+            if ($ns == "") {
135
+                            $this->success = false;
136
+            }
136 137
         } else {
137 138
             $ns = "";
138 139
             $tag = $name;
@@ -175,8 +176,9 @@  discard block
 block discarded – undo
175 176
     {
176 177
         if (strstr($name, " ")) {
177 178
             list($ns, $tag) = explode(" ", $name);
178
-            if ($ns == "")
179
-                $this->success = false;
179
+            if ($ns == "") {
180
+                            $this->success = false;
181
+            }
180 182
         } else {
181 183
             $ns = "";
182 184
             $tag = $name;
Please login to merge, or discard this patch.