Completed
Branch master (c3ca5f)
by Seth
04:51
created
phpicalendar/functions/userauth_functions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	}
55 55
 
56 56
 	// Look for a login cookie.
57
-	if ($phpiCal_config->login_cookies == 'yes' && isset($_COOKIE['phpicalendar_login'])){
57
+	if ($phpiCal_config->login_cookies == 'yes' && isset($_COOKIE['phpicalendar_login'])) {
58 58
 		$login_cookie = unserialize(stripslashes($_COOKIE['phpicalendar_login']));
59
-		if (isset($login_cookie['username']) &&	isset($login_cookie['password'])){
59
+		if (isset($login_cookie['username']) && isset($login_cookie['password'])) {
60 60
 			$username = $login_cookie['username'];
61 61
 			$password = $login_cookie['password'];
62 62
 		}
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	if ($phpiCal_config->login_cookies != 'yes') {
67 67
 		if (!session_id()) {
68 68
 			session_start();
69
-			setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
69
+			setcookie(session_name(), session_id(), time() + (60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
70 70
 		}
71
-		if (isset($_SESSION['username'], $_SESSION['password'])){
71
+		if (isset($_SESSION['username'], $_SESSION['password'])) {
72 72
 			$username = $_SESSION['username'];
73 73
 			$password = $_SESSION['password'];
74 74
 		}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 #		$password = $_GET['password'];
82 82
 #	} else
83 83
 
84
-	if (isset($_POST['username'], $_POST['password'])){
84
+	if (isset($_POST['username'], $_POST['password'])) {
85 85
 		$username = $_POST['username'];
86 86
 		$password = $_POST['password'];
87 87
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	// Set the login cookie or session authentication values.
97 97
 	if ($phpiCal_config->login_cookies == 'yes' && empty($_COOKIE['phpicalendar_login'])) {
98 98
 		$the_cookie = serialize(array('username' => $username, 'password' => $password));
99
-		setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
99
+		setcookie('phpicalendar_login', $the_cookie, time() + (60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
100 100
 	} else {
101 101
 		$_SESSION['username'] = $username;
102 102
 		$_SESSION['password'] = $password;
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 
116 116
 	// Clear the login cookie or session authentication values.
117 117
 	if ($phpiCal_config->login_cookies == 'yes') {
118
-		setcookie('phpicalendar_login', '', time()-(60*60*24*7), '/', $phpiCal_config->cookie_uri, 0);
118
+		setcookie('phpicalendar_login', '', time() - (60*60*24*7), '/', $phpiCal_config->cookie_uri, 0);
119 119
 		unset($_COOKIE['phpicalendar_login']);
120 120
 	} else {
121 121
 		// Check if the session has already been started.
122 122
 		if (!session_id()) {
123 123
 			session_start();
124
-			setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
124
+			setcookie(session_name(), session_id(), time() + (60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0);
125 125
 		}
126 126
 
127 127
 		// Clear the session authentication values.
Please login to merge, or discard this patch.
phpicalendar/functions/draw_functions.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,76 +1,76 @@
 block discarded – undo
1 1
 <?php
2 2
 # drawEventTimes returns starttime and endtime and event length for drawing into a grid
3
-function drawEventTimes ($start, $end, $long_event = FALSE) {
3
+function drawEventTimes($start, $end, $long_event = FALSE) {
4 4
 	global  $phpiCal_config;
5 5
 	$sta_h = $sta_min = $end_h = $end_min = "00";
6 6
 	$gridLength = $phpiCal_config->gridLength;
7
-	if (preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time)){
7
+	if (preg_match('/([0-9]{2})([0-9]{2})/', $start, $time)) {
8 8
 		$sta_h   = $time[1];
9 9
 		$sta_min = $time[2];
10 10
 	}
11
-	$sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength);
11
+	$sta_min = sprintf("%02d", floor($sta_min/$gridLength)*$gridLength);
12 12
 	if ($sta_min == 60) {
13 13
 		$sta_h = sprintf("%02d", ($sta_h + 1));
14 14
 		$sta_min = "00";
15 15
 	}
16 16
 	
17
-	if (preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time)){
17
+	if (preg_match('/([0-9]{2})([0-9]{2})/', $end, $time)) {
18 18
 		$end_h   = $time[1];
19 19
 		$end_min = $time[2];
20 20
 	}
21
-	$end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength);
21
+	$end_min = sprintf("%02d", floor($end_min/$gridLength)*$gridLength);
22 22
 	if ($end_min == 60) {
23 23
 		$end_h = sprintf("%02d", ($end_h + 1));
24 24
 		$end_min = "00";
25 25
 	}
26 26
 	
27
-	if ((!$long_event) && (($sta_h . $sta_min) == ($end_h . $end_min))) {
27
+	if ((!$long_event) && (($sta_h.$sta_min) == ($end_h.$end_min))) {
28 28
 		$end_min += $gridLength;
29 29
 		if ($end_min == 60) {
30 30
 			$end_h = sprintf("%02d", ($end_h + 1));
31 31
 			$end_min = "00";
32 32
 		}
33 33
 	}
34
-	$draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min);
34
+	$draw_len = ($end_h*60 + $end_min) - ($sta_h*60 + $sta_min);
35 35
 
36
-	return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len);
36
+	return array("draw_start" => ($sta_h.$sta_min), "draw_end" => ($end_h.$end_min), "draw_length" => $draw_len);
37 37
 }
38 38
 
39 39
 // word wrap function that returns specified number of lines
40 40
 // when lines is 0, it returns the entire string as wordwrap() does it
41
-function word_wrap($str, $length, $lines=0) {
41
+function word_wrap($str, $length, $lines = 0) {
42 42
 	if ($lines > 0) {
43
-		$len = $length * $lines;
43
+		$len = $length*$lines;
44 44
 		//if ($len < strlen($str)) {
45 45
 		// $str = substr($str,0,$len).'...';
46 46
 		//}
47
-		$rstr=bite_str($str,0,$len+1);
47
+		$rstr = bite_str($str, 0, $len + 1);
48 48
 	}
49 49
 	return $rstr;
50 50
 }
51 51
 
52 52
 // String intercept By Bleakwind
53 53
 // utf-8:$byte=3 | gb2312:$byte=2 | big5:$byte=2
54
-function bite_str($string, $start, $len, $byte=3){
54
+function bite_str($string, $start, $len, $byte = 3) {
55 55
 	$str = "";
56 56
 	$count = 0;
57 57
 	$str_len = strlen($string);
58
-	for ($i=0; $i<$str_len; $i++) {
59
-		if (($count+1-$start)>$len) {
58
+	for ($i = 0; $i < $str_len; $i++) {
59
+		if (($count + 1 - $start) > $len) {
60 60
 			$str .= "...";
61 61
 			break;
62
-		} elseif ((ord(substr($string,$i,1)) <= 128) && ($count < $start)){
62
+		} elseif ((ord(substr($string, $i, 1)) <= 128) && ($count < $start)) {
63 63
 			$count++;
64
-		} elseif ((ord(substr($string,$i,1)) > 128) && ($count < $start)){
65
-			$count = $count+2;
66
-			$i = $i+$byte-1;
67
-		} elseif ((ord(substr($string,$i,1)) <= 128) && ($count >= $start)){
68
-			$str .= substr($string,$i,1);
64
+		} elseif ((ord(substr($string, $i, 1)) > 128) && ($count < $start)) {
65
+			$count = $count + 2;
66
+			$i = $i + $byte - 1;
67
+		} elseif ((ord(substr($string, $i, 1)) <= 128) && ($count >= $start)) {
68
+			$str .= substr($string, $i, 1);
69 69
 			$count++;
70
-		} elseif ((ord(substr($string,$i,1)) > 128) && ($count >= $start)){
71
-			$str .= substr($string,$i,$byte);
72
-			$count = $count+2;
73
-			$i = $i+$byte-1;
70
+		} elseif ((ord(substr($string, $i, 1)) > 128) && ($count >= $start)) {
71
+			$str .= substr($string, $i, $byte);
72
+			$count = $count + 2;
73
+			$i = $i + $byte - 1;
74 74
 		}
75 75
 	}
76 76
 	return $str;
Please login to merge, or discard this patch.
phpicalendar/functions/ical_parser.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 if ($phpiCal_config->save_parsed_cals == 'yes') {
14 14
 	sort($cal_filelist);
15 15
 	$filename = sha1(implode(',', $cal_filelist));
16
-	$parsedcal = $phpiCal_config->tmp_dir . '/parsedcal-' . $filename . '-' . $this_year;
16
+	$parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.$filename.'-'.$this_year;
17 17
 	if (file_exists($parsedcal)) {
18 18
 		$fd = fopen($parsedcal, 'r');
19 19
 		$contents = fread($fd, filesize($parsedcal));
20 20
 		fclose($fd);
21 21
 		$master_array = unserialize($contents);
22
-		$y=0;
22
+		$y = 0;
23 23
 		// Check the calendars' last-modified time to determine if any need to be re-parsed
24 24
 		if (count($master_array['-4']) == count($cal_filelist)) {
25 25
 			foreach ($master_array['-4'] as $temp_array) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 					 */
35 35
 					$realcal_mtime = filemtime($fname);
36 36
 				}
37
-				else if ((time() - $mtime) >= $phpiCal_config->webcal_hours * 60 * 60) {
37
+				else if ((time() - $mtime) >= $phpiCal_config->webcal_hours*60*60) {
38 38
 					/*
39 39
 					 * We limit remote file mtime checks based on the magic webcal_hours config variable
40 40
 					 * This allows highly volatile web calendars to be cached for a period of time before
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			}
55 55
 
56 56
 			foreach ($master_array['-3'] as $temp_array) {
57
-				if (isset($temp_array) && $temp_array !='') $caldisplaynames[] = $temp_array;
57
+				if (isset($temp_array) && $temp_array != '') $caldisplaynames[] = $temp_array;
58 58
 			}
59 59
 
60 60
 			// And the $y magic number is used here to determine if all calendars are up-to-date
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 }
77 77
 
78 78
 if ($parse_file) {
79
-	$overlap_array = array ();
79
+	$overlap_array = array();
80 80
 	$uid_counter = 0;
81 81
 }
82 82
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		// Set default calendar name - can be overridden by X-WR-CALNAME
126 126
 		$calendar_name = $cal_filename;
127
-		$master_array['calendar_name'] 	= $calendar_name;
127
+		$master_array['calendar_name'] = $calendar_name;
128 128
 
129 129
 		// read file in line by line
130 130
 		// XXX end line is skipped because of the 1-line readahead
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 			$nextline = ereg_replace("[\r\n]", '', $nextline);
135 135
 			#handle continuation lines that start with either a space or a tab (MS Outlook)
136 136
 			while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) {
137
-				$line = $line . substr($nextline, 1);
137
+				$line = $line.substr($nextline, 1);
138 138
 				$nextline = fgets($ifile, 1024);
139 139
 				$nextline = ereg_replace("[\r\n]", '', $nextline);
140 140
 			}
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
 
174 174
 					$except_dates 	= array();
175 175
 					$except_times 	= array();
176
-					$rrule_array 	= array();
176
+					$rrule_array = array();
177 177
 					$byday  	 	= array();
178 178
 					$bymonth	 	= array();
179 179
 					$bymonthday 	= array();
180 180
 					$byyearday  	= array();
181 181
 					$bysetpos   	= array();
182 182
 					$first_duration = TRUE;
183
-					$count 			= 1000000;
183
+					$count = 1000000;
184 184
 					$valarm_set 	= FALSE;
185
-					$attendee		= array();
186
-					$organizer		= array();
185
+					$attendee = array();
186
+					$organizer = array();
187 187
 
188 188
 					break;
189 189
 				case 'END:VFREEBUSY':
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 						}
214 214
 					}
215 215
 
216
-					$master_array['-2']["$vtodo_sort"]["$uid"] = array (
216
+					$master_array['-2']["$vtodo_sort"]["$uid"] = array(
217 217
 						'start_date' => $start_date,
218 218
 						'start_time' => $start_time,
219 219
 						'vtodo_text' => $summary,
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
 
262 262
 				default:
263 263
 					unset ($field, $data, $prop_pos, $property);
264
-					if (ereg ("([^:]+):(.*)", $line, $line)){
264
+					if (ereg("([^:]+):(.*)", $line, $line)) {
265 265
 					$field = $line[1];
266 266
 					$data = $line[2];
267 267
 					$property = strtoupper($field);
268
-					$prop_pos = strpos($property,';');
269
-					if ($prop_pos !== false) $property = substr($property,0,$prop_pos);
268
+					$prop_pos = strpos($property, ';');
269
+					if ($prop_pos !== false) $property = substr($property, 0, $prop_pos);
270 270
 
271 271
 					switch ($property) {
272 272
 						// Start VTODO Parsing
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 							$start_time = $datetime[2];
313 313
 							$allday_start = $datetime[3];
314 314
 							$start_tz = $datetime[4];
315
-							preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs);
316
-							$vevent_start_date = $regs[1] . $regs[2] . $regs[3];
315
+							preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs);
316
+							$vevent_start_date = $regs[1].$regs[2].$regs[3];
317 317
 							$day_offset = dayCompare($start_date, $vevent_start_date);
318 318
 							#echo date("Ymd Hi", $start_unixtime)." $start_date $start_time $vevent_start_date $day_offset<br>";
319 319
 							break;
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
 							foreach ($data as $exdata) {
332 332
 								$exdata = str_replace('T', '', $exdata);
333 333
 								$exdata = str_replace('Z', '', $exdata);
334
-								preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $exdata, $regs);
335
-								$except_dates[] = $regs[1] . $regs[2] . $regs[3];
334
+								preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $exdata, $regs);
335
+								$except_dates[] = $regs[1].$regs[2].$regs[3];
336 336
 								// Added for Evolution, since they dont think they need to tell me which time to exclude.
337 337
 								if ($regs[4] == '' && isset($start_time) && $start_time != '') {
338 338
 									$except_times[] = $start_time;
339 339
 								} else {
340
-									$except_times[] = $regs[4] . $regs[5];
340
+									$except_times[] = $regs[4].$regs[5];
341 341
 								}
342 342
 							}
343 343
 							break;
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 
367 367
 						case 'RECURRENCE-ID':
368 368
 							$parts = explode(';', $field);
369
-							foreach($parts as $part) {
370
-								$eachval = split('=',$part);
369
+							foreach ($parts as $part) {
370
+								$eachval = split('=', $part);
371 371
 								if ($eachval[0] == 'RECURRENCE-ID') {
372 372
 									// do nothing
373 373
 								} elseif ($eachval[0] == 'TZID') {
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 
385 385
 							$data = str_replace('T', '', $data);
386 386
 							$data = str_replace('Z', '', $data);
387
-							ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs);
388
-							$recurrence_id['date'] = $regs[1] . $regs[2] . $regs[3];
389
-							$recurrence_id['time'] = $regs[4] . $regs[5];
387
+							ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs);
388
+							$recurrence_id['date'] = $regs[1].$regs[2].$regs[3];
389
+							$recurrence_id['time'] = $regs[4].$regs[5];
390 390
 
391 391
 							$recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]);
392 392
 
@@ -422,21 +422,21 @@  discard block
 block discarded – undo
422 422
 							break;
423 423
 						case 'DURATION':
424 424
 							if (($first_duration == TRUE) && (!stristr($field, '=DURATION'))) {
425
-								ereg ('^P([0-9]{1,2}[W])?([0-9]{1,3}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration);
425
+								ereg('^P([0-9]{1,2}[W])?([0-9]{1,3}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration);
426 426
 								$weeks 			= str_replace('W', '', $duration[1]);
427
-								$days 			= str_replace('D', '', $duration[2]);
427
+								$days = str_replace('D', '', $duration[2]);
428 428
 								$hours 			= str_replace('H', '', $duration[4]);
429 429
 								$minutes 		= str_replace('M', '', $duration[5]);
430 430
 								$seconds 		= str_replace('S', '', $duration[6]);
431
-								$the_duration 	= ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds);
431
+								$the_duration = ($weeks*60*60*24*7) + ($days*60*60*24) + ($hours*60*60) + ($minutes*60) + ($seconds);
432 432
 								$first_duration = FALSE;
433 433
 							}
434 434
 							break;
435 435
 						case 'RRULE':
436
-							$data = str_replace ('RRULE:', '', $data);
437
-							$rrule = split (';', $data);
436
+							$data = str_replace('RRULE:', '', $data);
437
+							$rrule = split(';', $data);
438 438
 							foreach ($rrule as $recur) {
439
-								ereg ('(.*)=(.*)', $recur, $regs);
439
+								ereg('(.*)=(.*)', $recur, $regs);
440 440
 								$rrule_array[$regs[1]] = $regs[2];
441 441
 							}
442 442
 							break;
@@ -444,19 +444,19 @@  discard block
 block discarded – undo
444 444
 							$email		= preg_match('/mailto:(.*)/i', $data, $matches1);
445 445
 							$name		= preg_match('/CN=([^;]*)/i', $field, $matches2);
446 446
 							$rsvp 		= preg_match('/RSVP=([^;]*)/i', $field, $matches3);
447
-							$partstat	= preg_match('/PARTSTAT=([^;]*)/i', $field, $matches4);
447
+							$partstat = preg_match('/PARTSTAT=([^;]*)/i', $field, $matches4);
448 448
 							$role		= preg_match('/ROLE=([^;]*)/i', $field, $matches5);
449 449
 
450
-							$email		= ($email ? $matches1[1] : '');
450
+							$email = ($email ? $matches1[1] : '');
451 451
 							$name		= ($name ? $matches2[1] : $email);
452 452
 							$rsvp		= ($rsvp ? $matches3[1] : '');
453
-							$partstat	= ($partstat ? $matches4[1] : '');
453
+							$partstat = ($partstat ? $matches4[1] : '');
454 454
 							$role		= ($role ? $matches5[1] : '');
455 455
 
456 456
 							// Emergency fallback
457 457
 							if (empty($name) && empty($email)) $name = $data;
458 458
 
459
-							$attendee[] = array ('name'     => stripslashes($name),
459
+							$attendee[] = array('name'     => stripslashes($name),
460 460
 												 'email'    => stripslashes($email),
461 461
 									        	 'RSVP'     => stripslashes($rsvp),
462 462
 									        	 'PARTSTAT' => stripslashes($partstat),
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 							// Emergency fallback
474 474
 							if (empty($name) && empty($email)) $name = $data;
475 475
 
476
-							$organizer[] = array ('name' => stripslashes($name), 'email' => stripslashes($email));
476
+							$organizer[] = array('name' => stripslashes($name), 'email' => stripslashes($email));
477 477
 							break;
478 478
 						case 'LOCATION':
479 479
 							$data = str_replace('$', '&#36;', $data);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 							$url = $data;
486 486
 							break;
487 487
 						default:
488
-							if(strpos(':',$data) > 1) $other .= $data;
488
+							if (strpos(':', $data) > 1) $other .= $data;
489 489
 					}
490 490
 				}
491 491
 			}
Please login to merge, or discard this patch.
phpicalendar/functions/is_daylight.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,22 +2,22 @@  discard block
 block discarded – undo
2 2
 /* 	values are offset in hhmm (not seconds!) relative to GMT
3 3
 	case The first value is for standard, and the second value is for daylight
4 4
 */
5
-function is_daylight($time, $timezone){
5
+function is_daylight($time, $timezone) {
6 6
 	global $tz_array, $summary;
7 7
 	# default to std time, overwrite if daylight.
8 8
 	$dlst = 0;
9 9
 	# Subtract the offset for std time.  This will be slightly off in some cases, but will be closer than using nothing (?).
10 10
 	$time = $time - calcOffset($tz_array[$timezone][0]);
11 11
 	$year = date("Y", $time);
12
-	$month = date("m",$time);
13
-	$day = date("d",$time);
14
-	$hour = date("H",$time);
12
+	$month = date("m", $time);
13
+	$day = date("d", $time);
14
+	$hour = date("H", $time);
15 15
 	
16
-	if(isset($tz_array[$timezone]['dt_start'][$year]) && isset($tz_array[$timezone]['st_start'][$year])){
17
-		$start	= $tz_array[$timezone]['dt_start'][$year];
18
-		$end 	= $tz_array[$timezone]['st_start'][$year];	
19
-	}else{
20
-		switch ($timezone){
16
+	if (isset($tz_array[$timezone]['dt_start'][$year]) && isset($tz_array[$timezone]['st_start'][$year])) {
17
+		$start = $tz_array[$timezone]['dt_start'][$year];
18
+		$end = $tz_array[$timezone]['st_start'][$year];	
19
+	} else {
20
+		switch ($timezone) {
21 21
 			case 'US/Samoa':                     # array('-1100', '-1100');
22 22
 			case 'America/Adak':                 # array('-1000', '-0900');
23 23
 			case 'America/Atka':    
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 			case 'Canada/Newfoundland':
81 81
 			case 'America/Godthab':              # array('-0300', '-0200');
82 82
 			case 'America/Miquelon':   
83
-				if ($year < 2007){
84
-					$start 	= strtotime("+1 Sun",strtotime($year."0331"));
85
-					$end 	= strtotime("-1 Sun",strtotime($year."1101"));
86
-				}else{
87
-					$start 	= strtotime("+2 Sun",strtotime($year."0300"));
88
-					$end 	= strtotime("+1 Sun",strtotime($year."1031"));
83
+				if ($year < 2007) {
84
+					$start 	= strtotime("+1 Sun", strtotime($year."0331"));
85
+					$end 	= strtotime("-1 Sun", strtotime($year."1101"));
86
+				} else {
87
+					$start 	= strtotime("+2 Sun", strtotime($year."0300"));
88
+					$end 	= strtotime("+1 Sun", strtotime($year."1031"));
89 89
 				}
90 90
 				break;
91 91
 			case 'America/Havana':          
92 92
 			case 'Cuba':                   
93
-				$start 	= strtotime("+3 Sun",strtotime($year."0300"));
94
-				$end 	= strtotime("-1 Sun",strtotime($year."1101"));	
93
+				$start = strtotime("+3 Sun", strtotime($year."0300"));
94
+				$end = strtotime("-1 Sun", strtotime($year."1101"));	
95 95
 				break;
96 96
 			case 'America/Cancun':     
97 97
 			case 'America/Chihuahua':       
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 			case 'Mexico/BajaNorte': 
105 105
 			case 'Mexico/General':          
106 106
 			case 'America/Mazatlan':        
107
-				$start 	= strtotime("+1 Sun",strtotime($year."0331"));
108
-				$end 	= strtotime("-1 Sun",strtotime($year."1101"));
107
+				$start = strtotime("+1 Sun", strtotime($year."0331"));
108
+				$end = strtotime("-1 Sun", strtotime($year."1101"));
109 109
 				break;
110 110
 			case 'Chile/EasterIsland':           # array('-0500', '-0600');
111 111
 			case 'Pacific/Easter':        
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 			case 'Europe/Uzhgorod':   
191 191
 			case 'Europe/Zaporozhye': 
192 192
 			case 'EET':               
193
-				$start 	= strtotime("-1 Sun",strtotime($year."0401"));
194
-				$end 	= strtotime("-1 Sun",strtotime($year."1101"));	
193
+				$start = strtotime("-1 Sun", strtotime($year."0401"));
194
+				$end = strtotime("-1 Sun", strtotime($year."1101"));	
195 195
 				break;
196 196
 			case 'Africa/Windhoek':       	     # array('+0200', '+0100');
197 197
 		
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 				$dlst = date('I', $time);
288 288
 		}
289 289
 	}
290
-	if (isset($start,$end) && $time >= $start && $time < $end) $dlst = 1;
290
+	if (isset($start, $end) && $time >= $start && $time < $end) $dlst = 1;
291 291
 	#echo "$summary $dlst <br>";
292 292
 
293 293
 	return $dlst;
Please login to merge, or discard this patch.
phpicalendar/functions/parse/parse_tzs.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	$nextline = ereg_replace("[\r\n]", '', $nextline);
16 16
 	#handle continuation lines that start with either a space or a tab (MS Outlook)
17 17
 	while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) { 
18
-		$line = $line . substr($nextline, 1);
18
+		$line = $line.substr($nextline, 1);
19 19
 		$nextline = fgets($ifile, 1024);
20 20
 		$nextline = ereg_replace("[\r\n]", '', $nextline);
21 21
 	}
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 			break;
57 57
 		default:
58 58
 			unset ($field, $data, $prop_pos, $property);
59
-			if (ereg ('([^:]+):(.*)', $line, $line)){
59
+			if (ereg('([^:]+):(.*)', $line, $line)) {
60 60
 				$field = $line[1];
61 61
 				$data = $line[2];				
62 62
 				$property = strtoupper($field);
63
-				$prop_pos = strpos($property,';');
64
-				if ($prop_pos !== false) $property = substr($property,0,$prop_pos);
63
+				$prop_pos = strpos($property, ';');
64
+				if ($prop_pos !== false) $property = substr($property, 0, $prop_pos);
65 65
 				switch ($property) {		
66 66
 					case 'TZID':
67 67
 						$tz_id = $data;
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 						$offset_to = $data;
74 74
 						break;
75 75
 					case 'DTSTART':
76
-						if($is_std || $is_daylight){
76
+						if ($is_std || $is_daylight) {
77 77
 							$datetime = extractDateTime($data, $property, $field); 
78 78
 							$start_unixtime = $datetime[0];
79 79
 							$start_date = $datetime[1];
80
-							$year = substr($start_date,0,4);
81
-							if($is_std) $begin_std[$year] = $data;
82
-							if($is_daylight) $begin_daylight[$year] = $data;
80
+							$year = substr($start_date, 0, 4);
81
+							if ($is_std) $begin_std[$year] = $data;
82
+							if ($is_daylight) $begin_daylight[$year] = $data;
83 83
 						}
84 84
 						break;
85 85
 					case 'TZNAME':
86
-						if($is_std) $st_name = $data;
87
-						if($is_daylight) $dt_name = $data;
86
+						if ($is_std) $st_name = $data;
87
+						if ($is_daylight) $dt_name = $data;
88 88
 						break;
89 89
 				}
90 90
 			}	
Please login to merge, or discard this patch.
phpicalendar/functions/parse/end_vevent.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 // CLASS support
16 16
 if (isset($class)) {
17 17
 	if ($class == 'PRIVATE') {
18
-		$summary ='**PRIVATE**';
19
-		$description ='**PRIVATE**';
18
+		$summary = '**PRIVATE**';
19
+		$description = '**PRIVATE**';
20 20
 	} elseif ($class == 'CONFIDENTIAL') {
21
-		$summary ='**CONFIDENTIAL**';
22
-		$description ='**CONFIDENTIAL**';
21
+		$summary = '**CONFIDENTIAL**';
22
+		$description = '**CONFIDENTIAL**';
23 23
 	}
24 24
 }
25 25
 
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	$uid = $uid_counter;
29 29
 	$uid_counter++;
30 30
 	$uid_valid = false;
31
-}elseif(in_array($uid, $uid_list)) {
31
+}elseif (in_array($uid, $uid_list)) {
32 32
 	# UID seen before. If sequence is the default, bump it.
33 33
 	if ($sequence == 0) $sequence++;
34
-}else{
34
+} else {
35 35
 	$uid_valid = true;
36 36
 }
37 37
 $uid_list[] = $uid;
38 38
 
39 39
 # Handle DURATION
40 40
 if (!isset($end_unixtime)) {
41
-	if(!isset($the_duration)) $the_duration = 0;
42
-	$end_unixtime 	= $start_unixtime + $the_duration;
43
-	$end_time 	= date ('Hi', $end_unixtime);
41
+	if (!isset($the_duration)) $the_duration = 0;
42
+	$end_unixtime = $start_unixtime + $the_duration;
43
+	$end_time = date('Hi', $end_unixtime);
44 44
 }
45 45
 # at this point $end_unixtime should be set
46 46
 # adjust event start and end times
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 }
54 54
 # look for events that span more than one day
55
-if (isset($start_unixtime,$end_unixtime) && date('Ymd',$start_unixtime) < date('Ymd',$end_unixtime)) {
55
+if (isset($start_unixtime, $end_unixtime) && date('Ymd', $start_unixtime) < date('Ymd', $end_unixtime)) {
56 56
 	$spans_day = true;
57 57
 	$bleed_check = (($start_unixtime - $end_unixtime) <= (60*60*24)) ? '-1' : '0';
58 58
 } else {
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 }
62 62
 
63 63
 $length = $end_unixtime - $start_unixtime;
64
-if ($length < 0){ 
64
+if ($length < 0) { 
65 65
 	$length = 0;
66 66
 	$end_time = $start_time;
67 67
 }
68 68
 # get hour and minute adjusted to allowed grid times
69 69
 $drawKey = drawEventTimes($start_time, $end_time, ($length >= (60*60*24)));
70
-preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3);
71
-preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4);
70
+preg_match('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3);
71
+preg_match('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4);
72 72
 $hour = $time3[1];
73 73
 $minute = $time3[2];
74 74
 $end_hour = $time4[1];
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
 $freq_type = 'none';
105 105
 # Load $rrule_array
106 106
 foreach ($rrule_array as $key => $val) {
107
-	switch($key) {
107
+	switch ($key) {
108 108
 		case 'FREQ':
109 109
 			switch ($val) {
110
-				case 'YEARLY':		$freq_type = 'year';	break;
111
-				case 'MONTHLY':		$freq_type = 'month';	break;
112
-				case 'WEEKLY':		$freq_type = 'week';	break;
113
-				case 'DAILY':		$freq_type = 'day';		break;
114
-				case 'HOURLY':		$freq_type = 'hour';	break;
115
-				case 'MINUTELY':	$freq_type = 'minute';	break;
116
-				case 'SECONDLY':	$freq_type = 'second';	break;
110
+				case 'YEARLY':		$freq_type = 'year'; break;
111
+				case 'MONTHLY':		$freq_type = 'month'; break;
112
+				case 'WEEKLY':		$freq_type = 'week'; break;
113
+				case 'DAILY':		$freq_type = 'day'; break;
114
+				case 'HOURLY':		$freq_type = 'hour'; break;
115
+				case 'MINUTELY':	$freq_type = 'minute'; break;
116
+				case 'SECONDLY':	$freq_type = 'second'; break;
117 117
 			}
118 118
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = strtolower($val);
119 119
 			break;
@@ -123,51 +123,51 @@  discard block
 block discarded – undo
123 123
 			break;
124 124
 		case 'UNTIL':
125 125
 			# UNTIL must be in UTC
126
-			$until = date("YmdHis",strtotime($val)); 
127
-			ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
128
-			$until_unixtime = mktime($regs[4],@$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]);
129
-			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until);
126
+			$until = date("YmdHis", strtotime($val)); 
127
+			ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
128
+			$until_unixtime = mktime($regs[4], @$regs[5], @$regs[6], $regs[2], $regs[3], $regs[1]);
129
+			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week, $until);
130 130
 			break;
131 131
 		case 'INTERVAL':
132
-			if ($val > 0){
132
+			if ($val > 0) {
133 133
 			$interval = $val;
134 134
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $interval;
135 135
 			}
136 136
 			break;
137 137
 		case 'BYSECOND':
138
-			$bysecond = split (',', $val);
138
+			$bysecond = split(',', $val);
139 139
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond;
140 140
 			break;
141 141
 		case 'BYMINUTE':
142
-			$byminute = split (',', $val);
142
+			$byminute = split(',', $val);
143 143
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute;
144 144
 			break;
145 145
 		case 'BYHOUR':
146
-			$byhour = split (',', $val);
146
+			$byhour = split(',', $val);
147 147
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour;
148 148
 			break;
149 149
 		case 'BYDAY':
150
-			$byday = split (',', $val);
150
+			$byday = split(',', $val);
151 151
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday;
152 152
 			break;
153 153
 		case 'BYMONTHDAY':
154
-			$bymonthday = split (',', $val);
154
+			$bymonthday = split(',', $val);
155 155
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday;
156 156
 			break;					
157 157
 		case 'BYYEARDAY':
158
-			$byyearday = split (',', $val);
158
+			$byyearday = split(',', $val);
159 159
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday;
160 160
 			break;
161 161
 		case 'BYWEEKNO':
162
-			$byweekno = split (',', $val);
162
+			$byweekno = split(',', $val);
163 163
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno;
164 164
 			break;
165 165
 		case 'BYMONTH':
166
-			$bymonth = split (',', $val);
166
+			$bymonth = split(',', $val);
167 167
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth;
168 168
 			break;
169 169
 		case 'BYSETPOS':
170
-			$bysetpos = split (',', $val);
170
+			$bysetpos = split(',', $val);
171 171
 			$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos;
172 172
 			break;
173 173
 		case 'WKST':
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 }
179 179
 # convert wkst to a 3 char day for strtotime to work		
180 180
 $wkst3char = two2threeCharDays($wkst);
181
-if($current_view == 'search') $freq_type = 'none'; 
181
+if ($current_view == 'search') $freq_type = 'none'; 
182 182
 # $recur is the recurrence info that goes into the master array for this VEVENT
183
-$recur ='';
183
+$recur = '';
184 184
 if (isset($recur_array[($start_date)][($hour.$minute)][$uid]['recur'])) $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur']; 
185 185
 
186 186
 /* ============================ Load $recur_data ============================
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
 	!isset($rrule_array['FREQ']) 	- only iterate once, set the end_range_unixtime to the end_date_unixtime
203 203
 Note that start_range_unixtime and end_range_unixtime are not the same as start_date_unixtime and end_date_unixtime */
204 204
 
205
-$end_range_unixtime = $mArray_end+60*60*24;
205
+$end_range_unixtime = $mArray_end + 60*60*24;
206 206
 $start_date_unixtime = strtotime($start_date);
207 207
 $next_range_unixtime = $start_date_unixtime;
208 208
 
209 209
 # conditions where we don't need to iterate over the whole range
210 210
 # 	if repeating without limit, and steps are by 1, don't go back before the mArray beginning.
211
-if($count == 1000000 && $interval == 1 && $mArray_begin > $next_range_unixtime) $next_range_unixtime = $mArray_begin;
211
+if ($count == 1000000 && $interval == 1 && $mArray_begin > $next_range_unixtime) $next_range_unixtime = $mArray_begin;
212 212
 
213 213
 # 	if the beginning of our range is less than the start of the item, we may as well set the range to start at start_time
214 214
 if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime;
215 215
 
216 216
 # 	stop at the until limit if set
217
-if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime;else $until_unixtime = $mArray_end;
217
+if (isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; else $until_unixtime = $mArray_end;
218 218
 
219 219
 # 	more adjustments
220
-switch ($freq_type){
220
+switch ($freq_type) {
221 221
 	case 'week':
222 222
 		# need to get the first value of $next_range_unixtime onto the right day of the week
223 223
 		$next_range_unixtime = strtotime("this ".date("D", $start_date_unixtime), $next_range_unixtime);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 }
229 229
 
230 230
 #nonrepeating events can stop at the first instance
231
-if(!isset($rrule_array['FREQ']) && isset($end_date)){ 
231
+if (!isset($rrule_array['FREQ']) && isset($end_date)) { 
232 232
 	$end_range_unixtime = strtotime($end_date);
233 233
 	$count = 1;
234 234
 }
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 while ($next_range_unixtime <= $end_range_unixtime && $count > 0) {
242 242
 	$year = date("Y", $next_range_unixtime); 
243 243
 	$month = date('m', $next_range_unixtime); 
244
-	$time = mktime(12,0,0,$month,date("d",$start_unixtime),$year);
245
-	switch ($freq_type){
244
+	$time = mktime(12, 0, 0, $month, date("d", $start_unixtime), $year);
245
+	switch ($freq_type) {
246 246
 		case 'day':
247 247
 			add_recur($next_range_unixtime);
248 248
 			break;
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 			add_recur(expand_byday($next_range_unixtime));
251 251
 			break;
252 252
 		case 'month':
253
-			if(!empty($bymonthday)) $time = mktime(12,0,0,$month,1,$year);
254
-			$times = expand_bymonthday(array($time));#echo "\n $month exp bymonthday";dump_times($times);
255
-			foreach($times as $time){ 
253
+			if (!empty($bymonthday)) $time = mktime(12, 0, 0, $month, 1, $year);
254
+			$times = expand_bymonthday(array($time)); #echo "\n $month exp bymonthday";dump_times($times);
255
+			foreach ($times as $time) { 
256 256
 				add_recur(expand_byday($time));
257 257
 			}
258 258
 			break;
259 259
 		case 'year':
260
-			$times = expand_bymonth($time);      #echo "exp bymonth";dump_times($times);
261
-			$times = expand_byweekno($times);    #echo "exp byweekno";dump_times($times);
262
-			$times = expand_byyearday($times);   #echo "exp byyearday";dump_times($times);
263
-			$times = expand_bymonthday($times);  #echo "\nexp bymonthday";dump_times($times);
264
-			foreach($times as $time){ 
260
+			$times = expand_bymonth($time); #echo "exp bymonth";dump_times($times);
261
+			$times = expand_byweekno($times); #echo "exp byweekno";dump_times($times);
262
+			$times = expand_byyearday($times); #echo "exp byyearday";dump_times($times);
263
+			$times = expand_bymonthday($times); #echo "\nexp bymonthday";dump_times($times);
264
+			foreach ($times as $time) { 
265 265
 				add_recur(expand_byday($time));
266 266
 			}
267 267
 			break;
@@ -284,22 +284,22 @@  discard block
 block discarded – undo
284 284
 $hour and $minute are the values from the start_time, rounded to the nearest grid time.
285 285
 
286 286
 */
287
-$recur_data_hour = @substr($start_time,0,2);
288
-$recur_data_minute = @substr($start_time,2,2);
289
-if (isset($allday_start) && $allday_start != ''){
287
+$recur_data_hour = @substr($start_time, 0, 2);
288
+$recur_data_minute = @substr($start_time, 2, 2);
289
+if (isset($allday_start) && $allday_start != '') {
290 290
 	$recur_data_hour = '00';
291 291
 	$recur_data_minute = '00';
292 292
 }
293
-foreach($recur_data as $recur_data_unixtime) {
293
+foreach ($recur_data as $recur_data_unixtime) {
294 294
 	$recur_data_year 	= date('Y', $recur_data_unixtime);
295
-	$recur_data_month 	= date('m', $recur_data_unixtime);
296
-	$recur_data_day 	= date('d', $recur_data_unixtime);
295
+	$recur_data_month = date('m', $recur_data_unixtime);
296
+	$recur_data_day = date('d', $recur_data_unixtime);
297 297
 	$recur_data_date 	= $recur_data_year.$recur_data_month.$recur_data_day;
298 298
 	
299 299
 	# initialize the loop range	to the recur date + grid time
300
-	$next_range_unixtime = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year);
300
+	$next_range_unixtime = mktime($recur_data_hour, $recur_data_minute, 0, $recur_data_month, $recur_data_day, $recur_data_year);
301 301
 	$end_range_unixtime = $next_range_unixtime + $length;
302
-	$end_date_tmp = date("Ymd",$end_range_unixtime);
302
+	$end_date_tmp = date("Ymd", $end_range_unixtime);
303 303
 	#echo "<pre>$summary ".date("Ymd H:i:s",$next_range_unixtime)." ".date("Ymd H:i:s",$end_range_unixtime)."\n";
304 304
 
305 305
 	# default the time_key to -1 for allday events, overwrite as needed
@@ -308,31 +308,31 @@  discard block
 block discarded – undo
308 308
 	$start_unixtime_tmp = strtotime($recur_data_date.$start_time);
309 309
 	$end_unixtime_tmp = strtotime($end_date_tmp.$end_time);
310 310
 	while (date("Ymd", $next_range_unixtime) <= $end_date_tmp) {
311
-		$this_date_tmp = date('Ymd',$next_range_unixtime);	
312
-		$next_range_unixtime = strtotime('+1 day',$next_range_unixtime);
311
+		$this_date_tmp = date('Ymd', $next_range_unixtime);	
312
+		$next_range_unixtime = strtotime('+1 day', $next_range_unixtime);
313 313
 		
314 314
 		if (!isset($allday_start) || $allday_start == '') $time_key = $hour.$minute;
315 315
 		$display_end_tmp = $end_hour.$end_minute;
316
-		if($time_key > -1){
316
+		if ($time_key > -1) {
317 317
 			# the day is not the first day of the recurrence
318 318
 			if ($this_date_tmp > $recur_data_date) $time_key = '0000';
319 319
 			# the day is not the last day of the recurrence
320 320
 			if ($this_date_tmp < $end_date_tmp) $display_end_tmp = '2400';
321 321
 		}
322
-		if($this_date_tmp == $end_date_tmp && ($end_time == '0000')) continue;
323
-		if(!isset($master_array[$this_date_tmp][$time_key][$uid]['sequence']) || 
324
-			$sequence >  $master_array[$this_date_tmp][$time_key][$uid]['sequence']
325
-			){
326
-			$master_array[$this_date_tmp][$time_key][$uid] = array (
327
-				'event_start' => $start_time,                	# hhmm
328
-				'event_end' => $end_time,                    	# hhmm
329
-				'display_start' => $time_key,                   # hhmm
330
-				'display_end' => $display_end_tmp,            	# hhmm
331
-				'start_unixtime' => $start_unixtime_tmp,      	# start unixtime for this recurrence
332
-				'end_unixtime' => $end_unixtime_tmp,          	# end unixtime for this recurrence
333
-				'event_text' => $summary,                    	#
334
-				'event_length' => $length,                    	# length in seconds
335
-				'event_overlap' => 0,                        	# checkOverlap modifies this
322
+		if ($this_date_tmp == $end_date_tmp && ($end_time == '0000')) continue;
323
+		if (!isset($master_array[$this_date_tmp][$time_key][$uid]['sequence']) || 
324
+			$sequence > $master_array[$this_date_tmp][$time_key][$uid]['sequence']
325
+			) {
326
+			$master_array[$this_date_tmp][$time_key][$uid] = array(
327
+				'event_start' => $start_time, # hhmm
328
+				'event_end' => $end_time, # hhmm
329
+				'display_start' => $time_key, # hhmm
330
+				'display_end' => $display_end_tmp, # hhmm
331
+				'start_unixtime' => $start_unixtime_tmp, # start unixtime for this recurrence
332
+				'end_unixtime' => $end_unixtime_tmp, # end unixtime for this recurrence
333
+				'event_text' => $summary, #
334
+				'event_length' => $length, # length in seconds
335
+				'event_overlap' => 0, # checkOverlap modifies this
336 336
 				'description' => $description, 
337 337
 				'status' => $status, 
338 338
 				'class' => $class, 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 				'recur' => $recur
352 352
 				);
353 353
 		}
354
-		if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid);
354
+		if ($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid);
355 355
 	}
356 356
 } # end foreach recur_data 
357 357
 unset($recur_data);
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 // Added for version 0.9.5 modified in 2.22 remove anything that doesn't have an event_start
362 362
 if (is_array($except_dates)) {
363 363
 	foreach ($except_dates as $key => $value) {
364
-		if (isset ($master_array[$value])){
365
-			foreach ($master_array[$value] as $time => $value2){
366
-				if (!isset($value2[$uid]['event_start'])){
364
+		if (isset ($master_array[$value])) {
365
+			foreach ($master_array[$value] as $time => $value2) {
366
+				if (!isset($value2[$uid]['event_start'])) {
367 367
 					unset($master_array[$value][$time][$uid]);
368 368
 				}
369 369
 			}
Please login to merge, or discard this patch.
phpicalendar/functions/parse/recur_functions.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 function add_recur($times, $freq = '') {
12 12
 	global $recur_data;
13
-	global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime,$until_unixtime, $day_offset, $current_view;
13
+	global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime, $end_range_unixtime, $until_unixtime, $day_offset, $current_view;
14 14
 	if (!is_array($times)) $times = array($times);
15 15
 	/*	BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS	*/
16 16
 #dump_times($times);
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 		// Why are we arbitrarily setting the time to noon?
32 32
 		$date = date('Ymd', $time);
33
-		$time = strtotime($date . ' 12:00:00');
33
+		$time = strtotime($date.' 12:00:00');
34 34
 		$until_date = date('Ymd', $until_unixtime);
35
-		$until_unixtime = strtotime($until_date . ' 12:00:00');
35
+		$until_unixtime = strtotime($until_date.' 12:00:00');
36 36
 
37 37
 		# day offset fixes shifts across day boundaries due to time diffs.
38 38
 		# These are already fixed for the initial instance, but need to be fixed for recurrences
39
-		if (date('Ymd', $time) != $start_date) $time = $time + ($day_offset * 24 * 60 * 60);
39
+		if (date('Ymd', $time) != $start_date) $time = $time + ($day_offset*24*60*60);
40 40
 		if ((isset($time)) &&
41 41
 			(!in_array($time, $recur_data)) &&
42 42
 			(!in_array($date, $except_dates)) &&
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	if ($freq_type != 'year') return $times;
80 80
 	if (empty($byweekno)) return $times;
81 81
 	$total_weeks = date('W', mktime(12, 0, 0, 12, 24, $year)) + 1;
82
-	$w1_start = strtotime('this ' . $wkst3char, mktime(12, 0, 0, 1, 1, $year));
82
+	$w1_start = strtotime('this '.$wkst3char, mktime(12, 0, 0, 1, 1, $year));
83 83
 	foreach ($byweekno as $weekno) {
84 84
 		if ($weekno < 0) {
85 85
 			$weekno = $weekno + $total_weeks;
86 86
 		}
87
-		$new_times[] = strtotime('+' . (($weekno - 1) * 7) . ' days', $w1_start);
87
+		$new_times[] = strtotime('+'.(($weekno - 1)*7).' days', $w1_start);
88 88
 	}
89 89
 	#dump_times($new_times);
90 90
 	return $new_times;
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 function expand_byyearday($times) {
94 94
 	global $byyearday, $year;
95 95
 	if (empty($byyearday)) return $times;
96
-	$py = $year-1;
97
-	$ny = $year+1;
96
+	$py = $year - 1;
97
+	$ny = $year + 1;
98 98
 	$new_times = array();
99
-	foreach ($times as $time){
99
+	foreach ($times as $time) {
100 100
 		foreach ($byyearday as $yearday) {
101 101
 			if ($yearday > 0) {
102
-				$day = strtotime('+' . $yearday . ' days Dec 31, ' . $py);
102
+				$day = strtotime('+'.$yearday.' days Dec 31, '.$py);
103 103
 			}
104 104
 			else {
105
-				$day = strtotime('Jan 1 ' . $ny . ' ' . $yearday . ' days');
105
+				$day = strtotime('Jan 1 '.$ny.' '.$yearday.' days');
106 106
 			}
107 107
 			if (date('Y', $day == $year)) $new_times[] = $day;
108 108
 		}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 }
128 128
 
129 129
 function expand_byday($time) {
130
-	global $freq_type, $byday, $bymonth,$byweekno, $wkst3char, $year, $month, $start_unixtime, $summary;
130
+	global $freq_type, $byday, $bymonth, $byweekno, $wkst3char, $year, $month, $start_unixtime, $summary;
131 131
 	if (empty($byday)) return array($time);
132 132
 	$times = array();
133 133
 	$the_sunday = dateOfWeek(date('Ymd', $time), $wkst3char);
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 				[2] => 4 number
139 139
 				[3] => TH day abbr
140 140
 		*/
141
-		ereg ('([-\+]{0,1})?([0-9]+)?([A-Z]{2})', $day, $byday_arr);
141
+		ereg('([-\+]{0,1})?([0-9]+)?([A-Z]{2})', $day, $byday_arr);
142 142
 		$on_day = two2threeCharDays($byday_arr[3]);
143 143
 		switch ($freq_type) {
144 144
 			case 'week':
145 145
 				#need to find the first day of the appropriate week.
146
-				$next_date_time = strtotime('this ' . $on_day, strtotime($the_sunday)) + (12 * 60 * 60);
146
+				$next_date_time = strtotime('this '.$on_day, strtotime($the_sunday)) + (12*60*60);
147 147
 				$times[] = $next_date_time;
148 148
 				break;
149 149
 			case 'month':
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 			case 'year':
153 153
 				if (empty($byweekno)) {
154 154
 					$week_arr = array(1, 2, 3, 4, 5);
155
-					if(isset($byday_arr[2]) && $byday_arr[2] !='') $week_arr = array($byday_arr[2]);
156
-					$month_start = strtotime(date('Ym01', $time)) - (24 * 60 * 60);
157
-					$month_end = strtotime(date('Ymt', $time)) + (36 * 60 * 60);
155
+					if (isset($byday_arr[2]) && $byday_arr[2] != '') $week_arr = array($byday_arr[2]);
156
+					$month_start = strtotime(date('Ym01', $time)) - (24*60*60);
157
+					$month_end = strtotime(date('Ymt', $time)) + (36*60*60);
158 158
 					if ($freq_type == 'year' && empty($bymonth)) {
159 159
 						$month_start = mktime(12, 0, 0, 1, 0, $year);
160 160
 						$month_end   = mktime(12, 0, 0, 1, 1, $year + 1);
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 					$month_start_day = strtolower(date('D', $month_start));
163 163
 					foreach ($week_arr as $week) {
164 164
 						if ($byday_arr[1] == '-') {
165
-							$next_date_time = strtotime($byday_arr[1] . $week . $on_day, $month_end);
165
+							$next_date_time = strtotime($byday_arr[1].$week.$on_day, $month_end);
166 166
 						}
167 167
 						else {
168 168
 							# we need this special offset in case the event day coincides with the month start day
169 169
 							# eg: month starts on a Sunday, our event is the Nth Sunday of the month... without this
170 170
 							# special offset, the event will be added to the (N+1)th Sunday of the month
171
-							$special_offset = ($month_start_day == $on_day) ? (24 * 60 * 60) : 0;
172
-							$next_date_time = strtotime($byday_arr[1] . $week . $on_day, ($month_start + $special_offset));
171
+							$special_offset = ($month_start_day == $on_day) ? (24*60*60) : 0;
172
+							$next_date_time = strtotime($byday_arr[1].$week.$on_day, ($month_start + $special_offset));
173 173
 						}
174 174
 						# check that we're still in the same month
175 175
 						if (date('m', $next_date_time) == date('m', $time)) $times[] = $next_date_time;
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 				}
178 178
 				else {
179 179
 					# byweekno should act like freq_type = week
180
-					$next_date_time = strtotime('this ' . $on_day, strtotime($the_sunday)) + (12 * 60 * 60);
180
+					$next_date_time = strtotime('this '.$on_day, strtotime($the_sunday)) + (12*60*60);
181 181
 					$times[] = $next_date_time;
182 182
 				}
183 183
 				break;
184 184
 			default:
185 185
 				$month_start = strtotime(date('Ym01', $time));
186
-				$next_date_time = strtotime($byday_arr[1] . $byday_arr[2] . $on_day, $month_start);
186
+				$next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $month_start);
187 187
 				break;
188 188
 		}
189 189
 	}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				[2] => 4 number
255 255
 				[3] => TH day abbr
256 256
 		*/
257
-		ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr);
257
+		ereg('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr);
258 258
 		$byday3[] = two2threeCharDays($byday_arr[3]);
259 259
 	}
260 260
 	$new_times = array();
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 # for diagnostics
279 279
 function dump_times($times) {
280 280
 	global $summary;
281
-	echo '<pre>' . $summary . ' times:';
281
+	echo '<pre>'.$summary.' times:';
282 282
 	#var_dump($times);
283 283
 	foreach ($times as $time) {
284
-		echo "\ndate:" . date('Y-m-d H:i:s', $time);
284
+		echo "\ndate:".date('Y-m-d H:i:s', $time);
285 285
 	}
286 286
 	echo '</pre>';
287 287
 }
Please login to merge, or discard this patch.
phpicalendar/functions/calendar_functions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	// This array keeps track of paths we need to search.
41 41
 	$search_paths = array($phpiCal_config->calendar_path);
42 42
 	// Add web calendars.
43
-	if ($cal_filename_local[0] == $phpiCal_config->ALL_CALENDARS_COMBINED || $admin)	{
43
+	if ($cal_filename_local[0] == $phpiCal_config->ALL_CALENDARS_COMBINED || $admin) {
44 44
 		if (!isset($http_user) && !$admin) {
45 45
 			foreach ($list_webcals as $file) {
46 46
 				// Make sure the URL ends with .ics.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 // is not printed out by this function.
190 190
 //
191 191
 // $cals	= The calendars (entire path, e.g. from availableCalendars).
192
-function display_ical_list($cals, $pick=FALSE) {
192
+function display_ical_list($cals, $pick = FALSE) {
193 193
 	global $cal, $current_view, $getdate, $lang, $calendar_lang, $all_cal_comb_lang, $cal_filelist, $cal_displaynames, $list_webcals, $phpiCal_config, $master_array;
194 194
 	// Print each calendar option.
195 195
 	$return = '';
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			(substr($cal_tmp, 0, 8) == 'https://') ||
210 210
 			(substr($cal_tmp, 0, 9) == 'webcal://')) {
211 211
 			$cal_tmp2 = str_replace('webcal://', 'http://', $cal_tmp);
212
-			$cal_tmp2 = str_replace('https://',  'http://', $cal_tmp2);
212
+			$cal_tmp2 = str_replace('https://', 'http://', $cal_tmp2);
213 213
 			$num = 1;
214 214
 			foreach ($master_array[-4] as $master_cal) {
215 215
 				if ($master_cal['filename'] == $cal_tmp2) {
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
 			while (!feof($ifile)) {
227 227
 				$line = fgets($ifile, 1024);
228 228
 				$line = trim($line);
229
-				if (ereg ("([^:]+):(.*)", $line, $regs)){
229
+				if (ereg("([^:]+):(.*)", $line, $regs)) {
230 230
 					$field = $regs[1];
231 231
 					$data = $regs[2];
232 232
 					$property = $field;
233
-					$prop_pos = strpos($property,';');
234
-					if ($prop_pos !== false) $property = substr($property,0,$prop_pos);
233
+					$prop_pos = strpos($property, ';');
234
+					if ($prop_pos !== false) $property = substr($property, 0, $prop_pos);
235 235
 					$property = strtoupper($property);
236
-					if ($property == "X-WR-CALNAME"){
236
+					if ($property == "X-WR-CALNAME") {
237 237
 						$cal_displayname_tmp = stripslashes($data);
238 238
 						break;
239 239
 					}
240 240
 				}	
241 241
 				#stop reading if we find an event or timezone before there's a name
242
-				if ($line == "BEGIN:VTIMEZONE" ||$line == "BEGIN:VEVENT") break;
242
+				if ($line == "BEGIN:VTIMEZONE" || $line == "BEGIN:VEVENT") break;
243 243
 			}
244 244
 			@fclose($ifile);
245 245
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 
268 268
 		// Encode the calendar path.
269 269
 		$cal_encoded_tmp = urlencode($cal_tmp);
270
-		if(in_array($cal_tmp, $list_webcals)){
271
-			$cal_encoded_tmp = md5($phpiCal_config->salt.$cal_tmp);;
270
+		if (in_array($cal_tmp, $list_webcals)) {
271
+			$cal_encoded_tmp = md5($phpiCal_config->salt.$cal_tmp); ;
272 272
 		}
273 273
 
274 274
 		// Try to detect unselected calendars
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		// The submitted calendar will be encoded, and always use http://
280 280
 		// if it is a webcal. So that is how we perform the comparison when
281 281
 		// trying to figure out if this is the selected calendar.
282
-		if($pick) {
282
+		if ($pick) {
283 283
 			if (in_array($cal_encoded_tmp, explode(",", $cal)) || count($cals) == count(explode(",", $cal))) {
284 284
 				$return .= "<option value=\"$cal_encoded_tmp\" selected=\"selected\">$cal_displayname_tmp</option>\n";
285 285
 			} else {
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 	// option to open all (non-web) calenders together
298 298
 	if (!$pick) {
299 299
 		if ($all_cals || $cal == $phpiCal_config->ALL_CALENDARS_COMBINED) {
300
-			$return .=  "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>";
300
+			$return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>";
301 301
 		} else {
302
-			$return .=  "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
302
+			$return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
303 303
 		}
304 304
 	}
305 305
 
Please login to merge, or discard this patch.
phpicalendar/functions/admin_functions.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Is the user logged in
3 3
 //
4 4
 // returns boolean is the user logged in
5
-function is_loggedin () {
5
+function is_loggedin() {
6 6
 	global $_SESSION;
7 7
 	if (!isset($_SESSION['phpical_loggedin']) || $_SESSION['phpical_loggedin'] == FALSE) {
8 8
 		return FALSE;
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 // arg0: string username
17 17
 // arg1: string password
18 18
 // returns boolean was the login successful
19
-function login ($username, $password) {
19
+function login($username, $password) {
20 20
 	global $_SESSION;
21 21
 	global $phpiCal_config;
22 22
 	
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // arg0: string username
47 47
 // arg1: string password
48 48
 // returns boolean was login successful
49
-function login_ftp ($username, $password) {
49
+function login_ftp($username, $password) {
50 50
 	global $phpiCal_config;
51 51
 	
52 52
 	// set up basic connection
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 // arg0: string username
72 72
 // arg1: string password
73 73
 // returns boolean was login successful
74
-function login_internal ($username, $password) {
74
+function login_internal($username, $password) {
75 75
 	global $phpiCal_config;
76 76
 	
77 77
 	if ($phpiCal_config->auth_internal_username == $username && $phpiCal_config->auth_internal_password == $password)
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 //
85 85
 // arg0: string calendar file - not the full path
86 86
 // returns boolean was delete successful
87
-function delete_cal ($filename) {
87
+function delete_cal($filename) {
88 88
 	global $_SESSION;
89 89
 	global $phpiCal_config;
90 90
 	global $calendar_path;
91 91
 	echo $filename;
92 92
 	
93 93
 	if ($phpiCal_config->auth_method == 'ftp') {
94
-		$filename = get_ftp_calendar_path() . "/" . $filename;
94
+		$filename = get_ftp_calendar_path()."/".$filename;
95 95
 		
96 96
 		// set up basic connection
97 97
 		$conn_id = @ftp_connect($phpiCal_config->ftp_server); 
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 		$delete = unlink($filename); 
120 120
 		clearstatcache();
121 121
 		if (@file_exists($filename)) { 
122
-			$filesys = eregi_replace("/","\\", $filename); 
122
+			$filesys = eregi_replace("/", "\\", $filename); 
123 123
 			$delete = system("rm -f $filesys");
124 124
 			clearstatcache();
125 125
 			if (@file_exists($filename)) { 
126
-				$delete = chmod ($filename, 0775); 
126
+				$delete = chmod($filename, 0775); 
127 127
 				$delete = unlink($filename); 
128 128
 				$delete = system("del $filesys");
129 129
 			}
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 // arg0: string full path to calendar file
146 146
 // arg1: string destination filename
147 147
 // returns boolean was copy successful
148
-function copy_cal ($source, $destination) {
148
+function copy_cal($source, $destination) {
149 149
 	global $_SESSION;
150 150
 	global $phpiCal_config;
151 151
 	global $calendar_path;
152 152
 	
153 153
 	if ($phpiCal_config->auth_method == 'ftp') {
154
-		$destination = get_ftp_calendar_path() . "/" . basename($destination);
155
-		$destination = str_replace ("\\", "/", realpath($destination));
154
+		$destination = get_ftp_calendar_path()."/".basename($destination);
155
+		$destination = str_replace("\\", "/", realpath($destination));
156 156
 		
157 157
 		// set up basic connection
158 158
 		$conn_id = ftp_connect($phpiCal_config->ftp_server); 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		return TRUE;
178 178
 	}
179 179
 	else {
180
-		$destination = $calendar_path . "/" . basename($destination);
180
+		$destination = $calendar_path."/".basename($destination);
181 181
 		
182 182
 		if (check_php_version('4.0.3')) {
183 183
 			return move_uploaded_file($source, $destination);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	if ($phpiCal_config->ftp_calendar_path != '')
201 201
 		return $phpiCal_config->ftp_calendar_path;
202 202
 	else {
203
-		return str_replace ("\\", "/", realpath($calendar_path));
203
+		return str_replace("\\", "/", realpath($calendar_path));
204 204
 	}
205 205
 }
206 206
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 // return boolean true if $version is >= current php version
211 211
 function check_php_version($version) {
212 212
 	// intval used for version like "4.0.4pl1"
213
-	$testVer=intval(str_replace(".", "",$version));
214
-	$curVer=intval(str_replace(".", "",phpversion()));
215
-	if( $curVer < $testVer )
213
+	$testVer = intval(str_replace(".", "", $version));
214
+	$curVer = intval(str_replace(".", "", phpversion()));
215
+	if ($curVer < $testVer)
216 216
 		return FALSE;
217 217
 	return TRUE;
218 218
 }
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 //
222 222
 // arg0: string filename
223 223
 // returns boolean is the uploaded a file
224
-function is_uploaded_file_v4 ($filename) {
224
+function is_uploaded_file_v4($filename) {
225 225
     if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
226 226
         $tmp_file = dirname(tempnam('', ''));
227 227
     }
228
-    $tmp_file .= '/' . basename($filename);
228
+    $tmp_file .= '/'.basename($filename);
229 229
     // For Windows compat
230
-    $filename = str_replace ("\\", "/", $filename);
231
-    $tmp_file = str_replace ("\\", "/", $tmp_file);
230
+    $filename = str_replace("\\", "/", $filename);
231
+    $tmp_file = str_replace("\\", "/", $tmp_file);
232 232
     // User might have trailing slash in php.ini... 
233 233
     return (ereg_replace('/+', '/', $tmp_file) == $filename);
234 234
 }
@@ -237,24 +237,24 @@  discard block
 block discarded – undo
237 237
 //
238 238
 // arg0: array error number from $_FILES[file]['error']
239 239
 // returns string error message
240
-function get_upload_error ($upload_error) {
240
+function get_upload_error($upload_error) {
241 241
 	global $php_error_lang;
242 242
 	global $upload_error_lang;
243 243
 	global $upload_error_gen_lang;
244 244
 	
245 245
 	if (isset($upload_error)) {
246 246
 		// This is only available in PHP >= 4.2.0
247
-		$error = $php_error_lang . " ";
248
-		switch($upload_error) {
247
+		$error = $php_error_lang." ";
248
+		switch ($upload_error) {
249 249
 			case 0: //no error; possible file attack!
250 250
 			case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
251 251
 			case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
252 252
 			case 3: //uploaded file was only partially uploaded
253 253
 			case 4: //no file was uploaded
254
-				$error = $error . $upload_error . ": " . $upload_error_lang[$upload_error];
254
+				$error = $error.$upload_error.": ".$upload_error_lang[$upload_error];
255 255
 				break;
256 256
 			default: //a default error, just in case!  :)
257
-				$error = $error . $upload_error . ": " . $upload_error_gen_lang;
257
+				$error = $error.$upload_error.": ".$upload_error_gen_lang;
258 258
 				break;
259 259
 		}
260 260
 	}
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
 //
270 270
 // arg0: string filename
271 271
 // returns booloean does the filename end in .ics
272
-function is_uploaded_ics ($filename) {
272
+function is_uploaded_ics($filename) {
273 273
 	// Check the file extension for .ics. Can also check the the mime type, but it's not reliable so why bother...
274
-	if(preg_match("/.ics$/i", $filename)) {
274
+	if (preg_match("/.ics$/i", $filename)) {
275 275
 		return TRUE;
276 276
 	}
277 277
 	else {
Please login to merge, or discard this patch.