@@ -125,8 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | if($scheme === 'mailto') { |
127 | 127 | $regexp = '^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$'; |
128 | - } |
|
129 | - else { |
|
128 | + } else { |
|
130 | 129 | $regexp = '^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$'; |
131 | 130 | } |
132 | 131 | |
@@ -173,8 +172,7 @@ discard block |
||
173 | 172 | return false; |
174 | 173 | } |
175 | 174 | $value = "$value"; |
176 | - } |
|
177 | - else if(!is_string($value)) { |
|
175 | + } else if(!is_string($value)) { |
|
178 | 176 | return false; |
179 | 177 | } |
180 | 178 | |
@@ -364,8 +362,7 @@ discard block |
||
364 | 362 | if(rfc2445_is_valid_value($parts[1], RFC2445_TYPE_DATE_TIME)) { |
365 | 363 | // It has to be after the start time, so |
366 | 364 | return ($parts[1] > $parts[0]); |
367 | - } |
|
368 | - else if(rfc2445_is_valid_value($parts[1], RFC2445_TYPE_DURATION)) { |
|
365 | + } else if(rfc2445_is_valid_value($parts[1], RFC2445_TYPE_DURATION)) { |
|
369 | 366 | // The period MUST NOT be negative |
370 | 367 | return ($parts[1]{0} != '-'); |
371 | 368 | } |
@@ -453,8 +450,7 @@ discard block |
||
453 | 450 | if(!(substr($vars['UNTIL'], -1) == 'Z')) { |
454 | 451 | return false; |
455 | 452 | } |
456 | - } |
|
457 | - else if(!rfc2445_is_valid_value($vars['UNTIL'], RFC2445_TYPE_DATE_TIME)) { |
|
453 | + } else if(!rfc2445_is_valid_value($vars['UNTIL'], RFC2445_TYPE_DATE_TIME)) { |
|
458 | 454 | return false; |
459 | 455 | } |
460 | 456 | } |
@@ -691,8 +687,7 @@ discard block |
||
691 | 687 | return false; |
692 | 688 | } |
693 | 689 | $value = "$value"; |
694 | - } |
|
695 | - else if(!is_string($value)) { |
|
690 | + } else if(!is_string($value)) { |
|
696 | 691 | return false; |
697 | 692 | } |
698 | 693 | |
@@ -717,12 +712,10 @@ discard block |
||
717 | 712 | if(is_int($value)) { |
718 | 713 | if($value >= 0) { |
719 | 714 | $value = "+$value"; |
720 | - } |
|
721 | - else { |
|
715 | + } else { |
|
722 | 716 | $value = "$value"; |
723 | 717 | } |
724 | - } |
|
725 | - else if(!is_string($value)) { |
|
718 | + } else if(!is_string($value)) { |
|
726 | 719 | return false; |
727 | 720 | } |
728 | 721 |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | if(is_array($value)) { |
63 | 63 | if(!$this->val_multi) { |
64 | 64 | return false; |
65 | - } |
|
66 | - else { |
|
65 | + } else { |
|
67 | 66 | foreach($value as $oneval) { |
68 | 67 | if(!rfc2445_is_valid_value($oneval, $this->val_type)) { |
69 | 68 | return false; |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | $value[$key] = rfc2445_do_value_formatting($item, $this->val_type); |
97 | 96 | } |
98 | 97 | $this->value = implode(',', $value); |
99 | - } |
|
100 | - else { |
|
98 | + } else { |
|
101 | 99 | $this->value = rfc2445_do_value_formatting($value, $this->val_type); |
102 | 100 | } |
103 | 101 | |
@@ -148,8 +146,7 @@ discard block |
||
148 | 146 | foreach($value as $key => $element) { |
149 | 147 | $value[$key] = iCalendar_parameter::do_value_formatting($name, $element); |
150 | 148 | } |
151 | - } |
|
152 | - else { |
|
149 | + } else { |
|
153 | 150 | $value = iCalendar_parameter::do_value_formatting($name, $value); |
154 | 151 | } |
155 | 152 | |
@@ -180,9 +177,7 @@ discard block |
||
180 | 177 | } |
181 | 178 | } |
182 | 179 | return $this->parameters[$name]; |
183 | - } |
|
184 | - |
|
185 | - else { |
|
180 | + } else { |
|
186 | 181 | if(substr($this->parameters[$name], 0, 1) == '"') { |
187 | 182 | return substr($this->parameters[$name], 1, strlen($this->parameters[$name]) - 2); |
188 | 183 | } |
@@ -200,8 +195,7 @@ discard block |
||
200 | 195 | $string .= ';'.$name.'='; |
201 | 196 | if(is_array($value)) { |
202 | 197 | $string .= implode(',', $value); |
203 | - } |
|
204 | - else { |
|
198 | + } else { |
|
205 | 199 | $string .= $value; |
206 | 200 | } |
207 | 201 | } |
@@ -1212,8 +1206,7 @@ discard block |
||
1212 | 1206 | if(($i & 1) == 1 && $parts[0]{$i} != '.') { |
1213 | 1207 | // Even-indexed chars must be periods |
1214 | 1208 | return false; |
1215 | - } |
|
1216 | - else if(($i & 1) == 0 && ($parts[0]{$i} < '0' || $parts[0]{$i} > '9')) { |
|
1209 | + } else if(($i & 1) == 0 && ($parts[0]{$i} < '0' || $parts[0]{$i} > '9')) { |
|
1217 | 1210 | // Odd-indexed chars must be numbers |
1218 | 1211 | return false; |
1219 | 1212 | } |
@@ -89,8 +89,10 @@ discard block |
||
89 | 89 | |
90 | 90 | // set calendar path, or just use current directory...make sure there's a trailing slash |
91 | 91 | if (isset($phpiCal_config->calendar_path) && $phpiCal_config->calendar_path != '') { |
92 | - if (substr($phpiCal_config->calendar_path, -1, 1) !='/') $calendar_path = $calendar_path.'/'; |
|
93 | -} else { |
|
92 | + if (substr($phpiCal_config->calendar_path, -1, 1) !='/') { |
|
93 | + $calendar_path = $calendar_path.'/'; |
|
94 | + } |
|
95 | + } else { |
|
94 | 96 | $calendar_path = ''; |
95 | 97 | } |
96 | 98 | |
@@ -137,7 +139,7 @@ discard block |
||
137 | 139 | // remove calendar file |
138 | 140 | if(!unlink($calendar_file)){ |
139 | 141 | logmsg('unable to delete the calendar file'); |
140 | - }else{ |
|
142 | + } else{ |
|
141 | 143 | logmsg('deleted'); |
142 | 144 | } |
143 | 145 | break; |
@@ -151,7 +153,7 @@ discard block |
||
151 | 153 | $data .= fgets($datain,4096); |
152 | 154 | } |
153 | 155 | @fclose($datain); |
154 | - }else{ |
|
156 | + } else{ |
|
155 | 157 | logmsg('unable to read input data'); |
156 | 158 | } |
157 | 159 | if(isset($data)){ |
@@ -193,11 +195,11 @@ discard block |
||
193 | 195 | if($dataout = fopen($calendar_path.$calendar_name.'.ics','w+')){ |
194 | 196 | fputs($dataout, $data, strlen($data) ); |
195 | 197 | @fclose($dataout); |
196 | - }else{ |
|
198 | + } else{ |
|
197 | 199 | logmsg( 'could not open file '.$calendar_path.$calendar_name.'.ics' ); |
198 | 200 | } |
199 | 201 | |
200 | - }else { |
|
202 | + } else { |
|
201 | 203 | logmsg('PUT ERROR - No data supplied.'); |
202 | 204 | } |
203 | 205 | break; |
@@ -230,10 +232,11 @@ discard block |
||
230 | 232 | global $logfile; |
231 | 233 | |
232 | 234 | if(defined('PHPICALENDAR_LOG_PUBLISHING') && PHPICALENDAR_LOG_PUBLISHING == 1) { |
233 | - if( $_SERVER['PHP_AUTH_USER'] ) |
|
234 | - $user = $_SERVER['PHP_AUTH_USER']; |
|
235 | - else |
|
236 | - $user = $_SERVER['REMOTE_USER']; |
|
235 | + if( $_SERVER['PHP_AUTH_USER'] ) { |
|
236 | + $user = $_SERVER['PHP_AUTH_USER']; |
|
237 | + } else { |
|
238 | + $user = $_SERVER['REMOTE_USER']; |
|
239 | + } |
|
237 | 240 | |
238 | 241 | $logline = date('Y-m-d H:i:s ') . $_SERVER['REMOTE_ADDR'] . ' ' . $user . ' ' . $str . "\n"; |
239 | 242 |
@@ -20,20 +20,26 @@ |
||
20 | 20 | $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time)); |
21 | 21 | $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time)); |
22 | 22 | $sidebar_date = localizeDate($dateFormat_week_list, $unix_time); |
23 | -if (!isset($style_select)) $style_select = ''; |
|
23 | +if (!isset($style_select)) { |
|
24 | + $style_select = ''; |
|
25 | +} |
|
24 | 26 | |
25 | 27 | // find out next month |
26 | 28 | $next_month_month = ($this_month+1 == '13') ? '1' : ($this_month+1); |
27 | 29 | $next_month_day = $this_day; |
28 | 30 | $next_month_year = ($next_month_month == '1') ? ($this_year+1) : $this_year; |
29 | -while (!checkdate($next_month_month,$next_month_day,$next_month_year)) $next_month_day--; |
|
31 | +while (!checkdate($next_month_month,$next_month_day,$next_month_year)) { |
|
32 | + $next_month_day--; |
|
33 | +} |
|
30 | 34 | $next_month_time = mktime(0,0,0,$next_month_month,$next_month_day,$next_month_year); |
31 | 35 | |
32 | 36 | // find out last month |
33 | 37 | $prev_month_month = ($this_month-1 == '0') ? '12' : ($this_month-1); |
34 | 38 | $prev_month_day = $this_day; |
35 | 39 | $prev_month_year = ($prev_month_month == '12') ? ($this_year-1) : $this_year; |
36 | -while (!checkdate($prev_month_month,$prev_month_day,$prev_month_year)) $prev_month_day--; |
|
40 | +while (!checkdate($prev_month_month,$prev_month_day,$prev_month_year)) { |
|
41 | + $prev_month_day--; |
|
42 | +} |
|
37 | 43 | $prev_month_time = mktime(0,0,0,$prev_month_month,$prev_month_day,$prev_month_year); |
38 | 44 | |
39 | 45 | $next_month = date("Ymd", $next_month_time); |
@@ -150,20 +150,23 @@ discard block |
||
150 | 150 | throw new Pest_Curl_Init($this->processError(curl_error($curl), 'curl')); |
151 | 151 | } |
152 | 152 | |
153 | - foreach ($opts as $opt => $val) |
|
154 | - curl_setopt($curl, $opt, $val); |
|
153 | + foreach ($opts as $opt => $val) { |
|
154 | + curl_setopt($curl, $opt, $val); |
|
155 | + } |
|
155 | 156 | |
156 | 157 | $this->last_request = array( |
157 | 158 | 'url' => $url |
158 | 159 | ); |
159 | 160 | |
160 | - if (isset($opts[CURLOPT_CUSTOMREQUEST])) |
|
161 | - $this->last_request['method'] = $opts[CURLOPT_CUSTOMREQUEST]; |
|
162 | - else |
|
163 | - $this->last_request['method'] = 'GET'; |
|
161 | + if (isset($opts[CURLOPT_CUSTOMREQUEST])) { |
|
162 | + $this->last_request['method'] = $opts[CURLOPT_CUSTOMREQUEST]; |
|
163 | + } else { |
|
164 | + $this->last_request['method'] = 'GET'; |
|
165 | + } |
|
164 | 166 | |
165 | - if (isset($opts[CURLOPT_POSTFIELDS])) |
|
166 | - $this->last_request['data'] = $opts[CURLOPT_POSTFIELDS]; |
|
167 | + if (isset($opts[CURLOPT_POSTFIELDS])) { |
|
168 | + $this->last_request['data'] = $opts[CURLOPT_POSTFIELDS]; |
|
169 | + } |
|
167 | 170 | |
168 | 171 | return $curl; |
169 | 172 | } |
@@ -261,14 +264,16 @@ discard block |
||
261 | 264 | */ |
262 | 265 | protected function checkLastResponseForError() |
263 | 266 | { |
264 | - if (!$this->throw_exceptions) |
|
265 | - return; |
|
267 | + if (!$this->throw_exceptions) { |
|
268 | + return; |
|
269 | + } |
|
266 | 270 | |
267 | 271 | $meta = $this->last_response['meta']; |
268 | 272 | $body = $this->last_response['body']; |
269 | 273 | |
270 | - if ($meta === false) |
|
271 | - return; |
|
274 | + if ($meta === false) { |
|
275 | + return; |
|
276 | + } |
|
272 | 277 | |
273 | 278 | $err = null; |
274 | 279 | switch ($meta['http_code']) { |
@@ -302,10 +307,11 @@ discard block |
||
302 | 307 | throw new Pest_InvalidRecord($this->processError($body)); |
303 | 308 | break; |
304 | 309 | default: |
305 | - if ($meta['http_code'] >= 400 && $meta['http_code'] <= 499) |
|
306 | - throw new Pest_ClientError($this->processError($body)); |
|
307 | - elseif ($meta['http_code'] >= 500 && $meta['http_code'] <= 599) |
|
308 | - throw new Pest_ServerError($this->processError($body)); elseif (!isset($meta['http_code']) || $meta['http_code'] >= 600) { |
|
310 | + if ($meta['http_code'] >= 400 && $meta['http_code'] <= 499) { |
|
311 | + throw new Pest_ClientError($this->processError($body)); |
|
312 | + } elseif ($meta['http_code'] >= 500 && $meta['http_code'] <= 599) { |
|
313 | + throw new Pest_ServerError($this->processError($body)); |
|
314 | + } elseif (!isset($meta['http_code']) || $meta['http_code'] >= 600) { |
|
309 | 315 | throw new Pest_UnknownResponse($this->processError($body)); |
310 | 316 | } |
311 | 317 | } |
@@ -356,7 +362,9 @@ discard block |
||
356 | 362 | |
357 | 363 | $curl_opts = $this->curl_opts; |
358 | 364 | $curl_opts[CURLOPT_CUSTOMREQUEST] = 'POST'; |
359 | - if (!is_array($data)) $headers[] = 'Content-Length: ' . strlen($data); |
|
365 | + if (!is_array($data)) { |
|
366 | + $headers[] = 'Content-Length: ' . strlen($data); |
|
367 | + } |
|
360 | 368 | $curl_opts[CURLOPT_HTTPHEADER] = $this->prepHeaders($headers); |
361 | 369 | $curl_opts[CURLOPT_POSTFIELDS] = $data; |
362 | 370 | |
@@ -405,7 +413,9 @@ discard block |
||
405 | 413 | |
406 | 414 | $curl_opts = $this->curl_opts; |
407 | 415 | $curl_opts[CURLOPT_CUSTOMREQUEST] = 'PUT'; |
408 | - if (!is_array($data)) $headers[] = 'Content-Length: ' . strlen($data); |
|
416 | + if (!is_array($data)) { |
|
417 | + $headers[] = 'Content-Length: ' . strlen($data); |
|
418 | + } |
|
409 | 419 | $curl_opts[CURLOPT_HTTPHEADER] = $this->prepHeaders($headers); |
410 | 420 | $curl_opts[CURLOPT_POSTFIELDS] = $data; |
411 | 421 | |
@@ -456,7 +466,9 @@ discard block |
||
456 | 466 | |
457 | 467 | $curl_opts = $this->curl_opts; |
458 | 468 | $curl_opts[CURLOPT_CUSTOMREQUEST] = 'DELETE'; |
459 | - if (!is_array($data)) $headers[] = 'Content-Length: ' . strlen($data); |
|
469 | + if (!is_array($data)) { |
|
470 | + $headers[] = 'Content-Length: ' . strlen($data); |
|
471 | + } |
|
460 | 472 | $curl_opts[CURLOPT_HTTPHEADER] = $this->prepHeaders($headers); |
461 | 473 | $curl_opts[CURLOPT_POSTFIELDS] = $data; |
462 | 474 |
@@ -246,7 +246,9 @@ |
||
246 | 246 | /* if we already have the event cached in its current form, just update |
247 | 247 | the timestamp */ |
248 | 248 | $eventCache = $eventCacheResponse->fetch_assoc(); |
249 | - if (DEBUGGING & DEBUGGING_MYSQL) displayError($eventCache); |
|
249 | + if (DEBUGGING & DEBUGGING_MYSQL) { |
|
250 | + displayError($eventCache); |
|
251 | + } |
|
250 | 252 | if ($eventCache) { |
251 | 253 | mysqlQuery(" |
252 | 254 | UPDATE `events` |