@@ -10,34 +10,34 @@ discard block |
||
10 | 10 | |
11 | 11 | require(BASE.'rss/rss_common.php'); |
12 | 12 | |
13 | -function rss_top(){ |
|
13 | +function rss_top() { |
|
14 | 14 | global $cal_displayname, $theview, $phpiCal_config, $cpath, $lang, $rss_link, $rss_language; |
15 | - $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
15 | + $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
16 | 16 | $rss .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n"; |
17 | 17 | $rss .= '<rss version="0.91">'."\n"; |
18 | 18 | $rss .= '<channel>'."\n"; |
19 | 19 | $rss .= '<title>'.$cal_displayname; |
20 | - if ($theview !=""){$rss .= ' - '.$theview;} |
|
20 | + if ($theview != "") {$rss .= ' - '.$theview; } |
|
21 | 21 | $rss .= "</title>\n"; |
22 | 22 | |
23 | - if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; |
|
23 | + if (isset($cpath) && $cpath != '') $rss_link .= "?cpath=$cpath"; |
|
24 | 24 | $rss .= '<link>'.htmlspecialchars("$phpiCal_config->default_path").'</link>'."\n"; |
25 | 25 | $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; |
26 | 26 | $rss .= '<language>'.$rss_language.'</language>'."\n"; |
27 | - $rss .= '<copyright>Copyright '.date("Y").', '.htmlspecialchars ("$default_path").'</copyright>'."\n"; |
|
27 | + $rss .= '<copyright>Copyright '.date("Y").', '.htmlspecialchars("$default_path").'</copyright>'."\n"; |
|
28 | 28 | return $rss; |
29 | 29 | } |
30 | 30 | |
31 | -function rss_li($rss_link, $uid){ |
|
31 | +function rss_li($rss_link, $uid) { |
|
32 | 32 | $return = ""; |
33 | 33 | } |
34 | 34 | |
35 | -function enclose_items($rss_items){ |
|
35 | +function enclose_items($rss_items) { |
|
36 | 36 | return $rss_items; |
37 | 37 | } |
38 | 38 | |
39 | -function rss_item(){ |
|
40 | - global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val; |
|
39 | +function rss_item() { |
|
40 | + global $uid, $event_start, $rss_title, $rss_link, $dayofweek, $event_text, $rss_description, $val; |
|
41 | 41 | $rss = '<item>'."\n"; |
42 | 42 | $rss .= '<uid>'.$uid.'</uid>'."\n"; |
43 | 43 | $rss .= '<event_start>'.$event_start.'</event_start>'."\n"; |
@@ -53,24 +53,24 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $rss .= '<link>'.$rss_link.'</link>'."\n"; |
55 | 55 | $rss .= '<description>'.$rss_description.'</description>'."\n"; |
56 | - if (isset($val['location']) && $val['location'] !=''){ |
|
57 | - $location = str_replace('&','&',$val['location']); |
|
58 | - $location = str_replace('&amp;','&',$location); |
|
56 | + if (isset($val['location']) && $val['location'] != '') { |
|
57 | + $location = str_replace('&', '&', $val['location']); |
|
58 | + $location = str_replace('&amp;', '&', $location); |
|
59 | 59 | $rss .= '<location>'.$location."</location>\n"; |
60 | 60 | } |
61 | 61 | $rss .= '</item>'."\n"; |
62 | 62 | return $rss; |
63 | 63 | } |
64 | -function rss_noitems(){ |
|
64 | +function rss_noitems() { |
|
65 | 65 | global $default_path; |
66 | 66 | $rss .= '<item>'."\n"; |
67 | 67 | $rss .= '<title>No events found</title>'."\n"; |
68 | - $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; |
|
68 | + $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; |
|
69 | 69 | $rss .= '</item>'."\n"; |
70 | 70 | return $rss; |
71 | 71 | } |
72 | 72 | |
73 | -function rss_close(){ |
|
73 | +function rss_close() { |
|
74 | 74 | return "</channel>\n</rss>\n"; |
75 | 75 | } |
76 | 76 | ?> |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | |
9 | 9 | define('BASE', '../'); |
10 | 10 | require(BASE.'rss/rss_common.php'); |
11 | -function rss_top(){ |
|
11 | +function rss_top() { |
|
12 | 12 | global $cal_displayname, $theview, $phpiCal_config, $cpath, $lang, $rss_link, $rss_language; |
13 | - $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
13 | + $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
14 | 14 | |
15 | 15 | /* Use 1.0 and strip encoding, use rss_language */ |
16 | - $rss .= '<rdf:RDF |
|
16 | + $rss .= '<rdf:RDF |
|
17 | 17 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
18 | 18 | xmlns:ev="http://purl.org/rss/1.0/modules/event/" |
19 | 19 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
20 | 20 | xmlns="http://purl.org/rss/1.0/">'."\n"; |
21 | 21 | |
22 | 22 | $rss .= '<channel rdf:about="'.$phpiCal_config->default_path.'/rss/rss.php/'; |
23 | - if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; |
|
24 | - $rss .='">'."\n"; |
|
23 | + if (isset($cpath) && $cpath != '') $rss_link .= "?cpath=$cpath"; |
|
24 | + $rss .= '">'."\n"; |
|
25 | 25 | |
26 | 26 | $rss .= '<title>'.$cal_displayname; |
27 | - if ($theview !=""){$rss .= ' - '.$theview;} |
|
27 | + if ($theview != "") {$rss .= ' - '.$theview; } |
|
28 | 28 | $rss .= "</title>\n"; |
29 | 29 | |
30 | 30 | $rss .= '<link>'.htmlspecialchars("$phpiCal_config->default_path").'</link>'."\n"; |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | #$rss .= '<language>'.$rss_language.'</language>'."\n"; |
33 | 33 | return $rss; |
34 | 34 | } |
35 | -function rss_li($rss_link, $uid){ |
|
35 | +function rss_li($rss_link, $uid) { |
|
36 | 36 | return '<rdf:li rdf:resource="'.$rss_link.'&uid='.$uid.'/" />'."\n"; |
37 | 37 | } |
38 | 38 | |
39 | -function enclose_items($rss_items){ |
|
39 | +function enclose_items($rss_items) { |
|
40 | 40 | return "<items>\n<rdf:Seq>\n".$rss_items."</rdf:Seq>\n</items>\n</channel>\n"; |
41 | 41 | } |
42 | 42 | |
43 | -function rss_item(){ |
|
44 | - global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val; |
|
43 | +function rss_item() { |
|
44 | + global $uid, $event_start, $rss_title, $rss_link, $dayofweek, $event_text, $rss_description, $val; |
|
45 | 45 | $rss_item = '<item rdf:about="'.$rss_link.'&uid='.urlencode($uid).'/">'."\n"; |
46 | 46 | |
47 | 47 | /* Create guid, and use uid to make link unique */ |
@@ -53,24 +53,24 @@ discard block |
||
53 | 53 | |
54 | 54 | $rss_item .= '<link>'.$rss_link.'</link>'."\n"; |
55 | 55 | $rss_item .= '<description>'.$rss_description.'</description>'."\n"; |
56 | - if (isset($val['location']) && $val['location'] !=''){ |
|
57 | - $location = str_replace('&','&',$val['location']); |
|
58 | - $location = str_replace('&amp;','&',$location); |
|
56 | + if (isset($val['location']) && $val['location'] != '') { |
|
57 | + $location = str_replace('&', '&', $val['location']); |
|
58 | + $location = str_replace('&amp;', '&', $location); |
|
59 | 59 | $rss_item .= '<ev:location>'.$location."</ev:location>\n"; |
60 | 60 | } |
61 | 61 | $rss_item .= '</item>'."\n"; |
62 | 62 | return $rss_item; |
63 | 63 | } |
64 | 64 | |
65 | -function rss_noitems(){ |
|
65 | +function rss_noitems() { |
|
66 | 66 | $rss_item = '<item rdf:about="'.$default_path."\">\n"; |
67 | 67 | $rss_item .= '<title>No events found</title>'."\n"; |
68 | - $rss_item .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; |
|
68 | + $rss_item .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; |
|
69 | 69 | $rss_item .= '</item>'."\n"; |
70 | 70 | return $rss_item; |
71 | 71 | } |
72 | 72 | |
73 | -function rss_close(){ |
|
73 | +function rss_close() { |
|
74 | 74 | return "</rdf:RDF>\n"; |
75 | 75 | } |
76 | 76 | ?> |
@@ -23,39 +23,39 @@ discard block |
||
23 | 23 | |
24 | 24 | define('BASE', '../'); |
25 | 25 | require(BASE.'rss/rss_common.php'); |
26 | -function rss_top(){ |
|
26 | +function rss_top() { |
|
27 | 27 | global $cal_displayname, $theview, $phpiCal_config, $cpath, $lang, $rss_link, $rss_language; |
28 | 28 | |
29 | - $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
29 | + $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; |
|
30 | 30 | /* Use 2.0 and strip encoding, use rss_language */ |
31 | 31 | $rss .= '<rss version="2.0"'."\n"; |
32 | - $rss .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
32 | + $rss .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
33 | 33 | xmlns:ev="http://purl.org/rss/1.0/modules/event/" '. |
34 | 34 | # 'xmlns:atom="http://www.w3.org/2005/Atom"'. |
35 | 35 | 'xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n"; |
36 | 36 | $rss .= '<channel>'."\n"; |
37 | 37 | $rss .= '<title>'.$cal_displayname; |
38 | - if ($theview !=""){$rss .= ' - '.$theview;} |
|
38 | + if ($theview != "") {$rss .= ' - '.$theview; } |
|
39 | 39 | $rss .= "</title>\n"; |
40 | 40 | |
41 | 41 | $rss .= '<link>'.$phpiCal_config->default_path.'/rss/rss2.0.php/'; |
42 | - if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; |
|
43 | - $rss .='</link>'."\n"; |
|
42 | + if (isset($cpath) && $cpath != '') $rss_link .= "?cpath=$cpath"; |
|
43 | + $rss .= '</link>'."\n"; |
|
44 | 44 | $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; |
45 | 45 | $rss .= '<language>'.$rss_language.'</language>'."\n"; |
46 | 46 | return $rss; |
47 | 47 | } |
48 | 48 | |
49 | -function rss_li($rss_link, $uid){ |
|
49 | +function rss_li($rss_link, $uid) { |
|
50 | 50 | $return = ""; |
51 | 51 | } |
52 | 52 | |
53 | -function enclose_items($rss_items){ |
|
53 | +function enclose_items($rss_items) { |
|
54 | 54 | return $rss_items; |
55 | 55 | } |
56 | 56 | |
57 | -function rss_item(){ |
|
58 | - global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val, $thisdate; |
|
57 | +function rss_item() { |
|
58 | + global $uid, $event_start, $rss_title, $rss_link, $dayofweek, $event_text, $rss_description, $val, $thisdate; |
|
59 | 59 | $rss = '<item>'."\n"; |
60 | 60 | /* Create guid, and use uid to make link unique */ |
61 | 61 | $rss .= '<guid isPermaLink="false">'.$rss_link.'&uid='.$uid.'</guid>'."\n"; |
@@ -66,25 +66,25 @@ discard block |
||
66 | 66 | |
67 | 67 | $rss .= '<link>'.$rss_link.'</link>'."\n"; |
68 | 68 | $rss .= '<description>'.$rss_description.'</description>'."\n"; |
69 | - if (isset($val['location']) && $val['location'] !=''){ |
|
70 | - $location = str_replace('&','&',$val['location']); |
|
71 | - $location = str_replace('&amp;','&',$location); |
|
69 | + if (isset($val['location']) && $val['location'] != '') { |
|
70 | + $location = str_replace('&', '&', $val['location']); |
|
71 | + $location = str_replace('&amp;', '&', $location); |
|
72 | 72 | $rss .= '<ev:location>'.$location."</ev:location>\n"; |
73 | 73 | } |
74 | 74 | $rss .= '</item>'."\n"; |
75 | 75 | return $rss; |
76 | 76 | } |
77 | 77 | |
78 | -function rss_noitems(){ |
|
78 | +function rss_noitems() { |
|
79 | 79 | $rss = '<item>'."\n"; |
80 | 80 | $rss .= '<guid isPermaLink="false">'.$default_path.'&uid='.$thisdate.'</guid>'."\n"; |
81 | 81 | $rss .= '<title>No events found</title>'."\n"; |
82 | - $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; |
|
82 | + $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; |
|
83 | 83 | $rss .= '</item>'."\n"; |
84 | 84 | return $rss; |
85 | 85 | } |
86 | 86 | |
87 | -function rss_close(){ |
|
87 | +function rss_close() { |
|
88 | 88 | global $rss_link; |
89 | 89 | return "\n". |
90 | 90 | # "<atom:link href=\"$rss_link\" rel=\"self\" type=\"application/rss+xml\" />\n". |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | $php_started = getmicrotime(); |
4 | 4 | # define BASE |
5 | 5 | if (!defined('BASE')) define('BASE', './'); |
6 | -if (phpversion() < '5.1'){ |
|
7 | - die (phpversion()." detected. php 5.1 or higher required for this version.\n\n" ); |
|
6 | +if (phpversion() < '5.1') { |
|
7 | + die (phpversion()." detected. php 5.1 or higher required for this version.\n\n"); |
|
8 | 8 | } |
9 | 9 | include_once(BASE.'functions/init/sanitize.php'); |
10 | 10 | include_once(BASE.'functions/init/set_error_reporting.php'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // Pull the calendars off the GET line if provided. The $cal_filename |
35 | 35 | // is always an array, because this makes it easier to deal with below. |
36 | 36 | $cal_filenames = array(); |
37 | -if (isset($_GET['cal']) && $_GET['cal'] !='') { |
|
37 | +if (isset($_GET['cal']) && $_GET['cal'] != '') { |
|
38 | 38 | // If the cal value is not an array, split it into an array on |
39 | 39 | // commas. |
40 | 40 | if (!is_array($_GET['cal'])) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // Grab the calendar filenames off the cal value array. |
44 | 44 | $cal_filenames = $_GET['cal']; |
45 | 45 | } elseif ($phpiCal_config->default_cal != '') { |
46 | - $cal_filenames = explode(',',$phpiCal_config->default_cal); |
|
46 | + $cal_filenames = explode(',', $phpiCal_config->default_cal); |
|
47 | 47 | } else { |
48 | 48 | $cal_filenames[0] = $phpiCal_config->ALL_CALENDARS_COMBINED; |
49 | 49 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $all_calendars_combined = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED); |
52 | 52 | |
53 | 53 | //load cal_filenames if $ALL_CALENDARS_COMBINED |
54 | -if ($cal_filenames[0] == $phpiCal_config->ALL_CALENDARS_COMBINED){ |
|
54 | +if ($cal_filenames[0] == $phpiCal_config->ALL_CALENDARS_COMBINED) { |
|
55 | 55 | $cal_filenames = $all_calendars_combined; |
56 | 56 | } |
57 | 57 | // Separate the calendar identifiers into web calendars and local |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $local_cals = array(); |
61 | 61 | foreach ($cal_filenames as $cal_filename) { |
62 | 62 | # substitute for md5-obscured list_webcals |
63 | - foreach ($list_webcals as $tmp_cal){ |
|
64 | - if($cal_filename == md5($phpiCal_config->salt.$tmp_cal)) $cal_filename = $tmp_cal; |
|
63 | + foreach ($list_webcals as $tmp_cal) { |
|
64 | + if ($cal_filename == md5($phpiCal_config->salt.$tmp_cal)) $cal_filename = $tmp_cal; |
|
65 | 65 | } |
66 | 66 | // If the calendar identifier begins with a web protocol, this is a web |
67 | 67 | // calendar. |
68 | 68 | $cal_filename = urldecode($cal_filename); #need to decode for substr statements to identify webcals |
69 | - $cal_filename = str_replace(' ','%20', $cal_filename); #need to reencode blank spaces for matching with $list_webcals |
|
69 | + $cal_filename = str_replace(' ', '%20', $cal_filename); #need to reencode blank spaces for matching with $list_webcals |
|
70 | 70 | if (substr($cal_filename, 0, 7) == 'http://' || |
71 | 71 | substr($cal_filename, 0, 8) == 'https://' || |
72 | 72 | substr($cal_filename, 0, 9) == 'webcal://') |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // Otherwise it is a local calendar. |
80 | 80 | else { |
81 | 81 | // Check blacklisted. |
82 | - if (in_array($cal_filename, $blacklisted_cals) && $cal_filename !='') { |
|
82 | + if (in_array($cal_filename, $blacklisted_cals) && $cal_filename != '') { |
|
83 | 83 | exit(error($lang['l_error_restrictedcal'], $cal_filename)); |
84 | 84 | } |
85 | 85 | $local_cals[] = urldecode(str_replace(".ics", '', basename($cal_filename))); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | # $cal_displaynames[] = substr(str_replace('32', ' ', basename($web_cal)), 0, -4); |
120 | 120 | $cal_displaynames[] = substr(basename($web_cal), 0, -4); |
121 | 121 | |
122 | - if(in_array($web_cal, $list_webcals)){ |
|
122 | + if (in_array($web_cal, $list_webcals)) { |
|
123 | 123 | $web_cal = md5($phpiCal_config->salt.$web_cal); |
124 | 124 | } |
125 | 125 | $cals[] = urlencode($web_cal); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | if (count($local_cals) == 1) { |
144 | 144 | $filename = $local_cals[0]; |
145 | 145 | $add_cpath = ''; |
146 | - if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/"; |
|
146 | + if (isset($cpath) && $cpath != '') $add_cpath = "$cpath/"; |
|
147 | 147 | |
148 | 148 | if (($phpiCal_config->download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) { |
149 | 149 | $subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $rss_powered = ($phpiCal_config->enable_rss == 'yes') ? 'yes' : ''; |
178 | 178 | |
179 | 179 | function getmicrotime() { |
180 | - list($usec, $sec) = explode(' ',microtime()); |
|
180 | + list($usec, $sec) = explode(' ', microtime()); |
|
181 | 181 | return ((float)$usec + (float)$sec); |
182 | 182 | } |
183 | 183 |
@@ -381,7 +381,7 @@ |
||
381 | 381 | $tz_array['Europe/Zaporozhye'] = array('+0200', '+0300'); |
382 | 382 | $tz_array['Europe/Zurich'] = array('+0100', '+0200'); |
383 | 383 | $tz_array['GB'] = array('+0000', '+0100'); |
384 | -$tz_array['GMT'] = array('+0000', '+0000'); |
|
384 | +$tz_array['GMT'] = array('+0000', '+0000'); |
|
385 | 385 | $tz_array['GB-Eire'] = array('+0000', '+0100'); |
386 | 386 | $tz_array['HST'] = array('-1000', '-1000'); |
387 | 387 | $tz_array['Hongkong'] = array('+0800', '+0800'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | if (is_array($master_array['-3'])) { |
20 | 20 | foreach ($master_array['-3'] as $key => $val) { |
21 | 21 | if ($i > $phpiCal_config->unique_colors) $i = 1; |
22 | - $val = str_replace ("\,", ",", $val); |
|
22 | + $val = str_replace("\,", ",", $val); |
|
23 | 23 | $return .= '<img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />'; |
24 | 24 | $i++; |
25 | 25 | } |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | |
30 | 30 | function list_months() { |
31 | 31 | global $getdate, $this_year, $cal, $dateFormat_month; |
32 | - $month_time = strtotime("$this_year-01-01"); |
|
33 | - $getdate_month = date("m", strtotime($getdate)); |
|
32 | + $month_time = strtotime("$this_year-01-01"); |
|
33 | + $getdate_month = date("m", strtotime($getdate)); |
|
34 | 34 | $return = ''; |
35 | - for ($i=0; $i<12; $i++) { |
|
36 | - $monthdate = date ("Ymd", $month_time); |
|
37 | - $month_month = date("m", $month_time); |
|
38 | - $select_month = localizeDate($dateFormat_month, $month_time); |
|
35 | + for ($i = 0; $i < 12; $i++) { |
|
36 | + $monthdate = date("Ymd", $month_time); |
|
37 | + $month_month = date("m", $month_time); |
|
38 | + $select_month = localizeDate($dateFormat_month, $month_time); |
|
39 | 39 | if ($month_month == $getdate_month) { |
40 | 40 | $return .= "<option value=\"month.php?cal=$cal&getdate=$monthdate\" selected=\"selected\">$select_month</option>\n"; |
41 | 41 | } else { |
42 | 42 | $return .= "<option value=\"month.php?cal=$cal&getdate=$monthdate\">$select_month</option>\n"; |
43 | 43 | } |
44 | - $month_time = strtotime ("+1 month", $month_time); |
|
44 | + $month_time = strtotime("+1 month", $month_time); |
|
45 | 45 | } |
46 | 46 | return $return; |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | global $getdate, $this_year, $cal, $phpiCal_config; |
52 | 52 | $year_time = strtotime($getdate); |
53 | 53 | $return = ''; |
54 | - for ($i=0; $i < $phpiCal_config->num_years; $i++) { |
|
54 | + for ($i = 0; $i < $phpiCal_config->num_years; $i++) { |
|
55 | 55 | $offset = $phpiCal_config->num_years - $i; |
56 | 56 | $prev_time = strtotime("-$offset year", $year_time); |
57 | 57 | $prev_date = date("Ymd", $prev_time); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $getdate_year = date("Y", $year_time); |
64 | 64 | $return .= "<option value=\"year.php?cal=$cal&getdate=$getdate_date\" selected=\"selected\">$getdate_year</option>\n"; |
65 | 65 | |
66 | - for ($i=0; $i < $phpiCal_config->num_years; $i++) { |
|
66 | + for ($i = 0; $i < $phpiCal_config->num_years; $i++) { |
|
67 | 67 | $offset = $i + 1; |
68 | 68 | $next_time = strtotime("+$offset year", $year_time); |
69 | 69 | $next_date = date("Ymd", $next_time); |
70 | 70 | $next_year = date("Y", $next_time); |
71 | - $return .= "<option value=\"year.php?cal=$cal&getdate=$next_date\">$next_year</option>\n"; |
|
71 | + $return .= "<option value=\"year.php?cal=$cal&getdate=$next_date\">$next_year</option>\n"; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $return; |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | |
78 | 78 | function list_weeks() { |
79 | 79 | global $getdate, $this_year, $cal, $dateFormat_week_jump, $phpiCal_config; |
80 | - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); |
|
81 | - $this_day = $day_array2[3]; |
|
80 | + ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); |
|
81 | + $this_day = $day_array2[3]; |
|
82 | 82 | $this_month = $day_array2[2]; |
83 | 83 | $this_year = $day_array2[1]; |
84 | 84 | $check_week = strtotime($getdate); |
85 | - $start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("$this_year-01-01")), $phpiCal_config->week_start_day)); |
|
86 | - $end_week_time = $start_week_time + (6 * 25 * 60 * 60); |
|
85 | + $start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("$this_year-01-01")), $phpiCal_config->week_start_day)); |
|
86 | + $end_week_time = $start_week_time + (6*25*60*60); |
|
87 | 87 | $return = ''; |
88 | 88 | |
89 | 89 | do { |
90 | - $weekdate = date ("Ymd", $start_week_time); |
|
90 | + $weekdate = date("Ymd", $start_week_time); |
|
91 | 91 | $select_week1 = localizeDate($dateFormat_week_jump, $start_week_time); |
92 | 92 | $select_week2 = localizeDate($dateFormat_week_jump, $end_week_time); |
93 | 93 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | } else { |
97 | 97 | $return .= "<option value=\"week.php?cal=$cal&getdate=$weekdate\">$select_week1 - $select_week2</option>\n"; |
98 | 98 | } |
99 | - $start_week_time = strtotime ("+1 week", $start_week_time); |
|
100 | - $end_week_time = $start_week_time + (6 * 25 * 60 * 60); |
|
99 | + $start_week_time = strtotime("+1 week", $start_week_time); |
|
100 | + $end_week_time = $start_week_time + (6*25*60*60); |
|
101 | 101 | } while (date("Y", $start_week_time) <= $this_year); |
102 | 102 | |
103 | 103 | return $return; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $words = str_word_count($string, 2); |
43 | 43 | $last_word = array_slice($words, $count, 1, true); |
44 | 44 | $pos = key($last_word); |
45 | - $string = substr($string, 0, $pos) . '...'; |
|
45 | + $string = substr($string, 0, $pos).'...'; |
|
46 | 46 | } |
47 | 47 | return $string; |
48 | 48 | } |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | $_SERVER = &$HTTP_SERVER_VARS; |
73 | 73 | } |
74 | 74 | |
75 | -foreach ($_REQUEST as $key=>$val){ |
|
76 | - switch ($key){ |
|
75 | +foreach ($_REQUEST as $key=>$val) { |
|
76 | + switch ($key) { |
|
77 | 77 | case 'event_data': |
78 | 78 | # modify this to allow or disallow different HTML tags in event popups |
79 | 79 | $allowed = "<p><br><b><i><em><a><img><div><span><ul><ol><li><h1><h2><h3><h4><h5><h6><hr><em><strong><small><table><tr><td><th>"; |
80 | - $val = strip_tags($val,$allowed); |
|
80 | + $val = strip_tags($val, $allowed); |
|
81 | 81 | break; |
82 | 82 | default: |
83 | 83 | # cpath |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | $_REQUEST[$key] = $val; |
88 | 88 | } |
89 | -foreach ($_POST as $key=>$val){ |
|
90 | - switch ($key){ |
|
89 | +foreach ($_POST as $key=>$val) { |
|
90 | + switch ($key) { |
|
91 | 91 | case 'action': |
92 | - $actions = array('login','logout','addupdate','delete'); |
|
93 | - if (!in_array($val,$actions)) $val = ''; |
|
92 | + $actions = array('login', 'logout', 'addupdate', 'delete'); |
|
93 | + if (!in_array($val, $actions)) $val = ''; |
|
94 | 94 | break; |
95 | 95 | case 'date': |
96 | 96 | case 'time': |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | $_POST[$key] = $val; |
103 | 103 | |
104 | 104 | } |
105 | -foreach ($_GET as $key=>$val){ |
|
106 | - switch ($key){ |
|
105 | +foreach ($_GET as $key=>$val) { |
|
106 | + switch ($key) { |
|
107 | 107 | case 'cal': |
108 | - if (!is_array($val)){ |
|
108 | + if (!is_array($val)) { |
|
109 | 109 | $val = strip_tags($val); |
110 | 110 | $_GET['cal'] = strip_tags($val); |
111 | - }else{ |
|
111 | + } else { |
|
112 | 112 | unset ($_GET['cal']); |
113 | - foreach($val as $cal){ |
|
114 | - $_GET['cal'][]= strip_tags($cal); |
|
113 | + foreach ($val as $cal) { |
|
114 | + $_GET['cal'][] = strip_tags($cal); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | break; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if ($key != 'cal') $_GET[$key] = $val; |
125 | 125 | |
126 | 126 | } |
127 | -foreach ($_COOKIE as $key=>$val){ |
|
128 | - switch ($key){ |
|
127 | +foreach ($_COOKIE as $key=>$val) { |
|
128 | + switch ($key) { |
|
129 | 129 | case 'time': |
130 | 130 | if (!is_numeric($val)) $val = ''; |
131 | 131 | break; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); |
|
10 | +preg_match("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); |
|
11 | 11 | $this_day = $day_array2[3]; |
12 | 12 | $this_month = $day_array2[2]; |
13 | 13 | $this_year = $day_array2[1]; |
@@ -18,21 +18,21 @@ discard block |
||
18 | 18 | $start_year = $this_year; |
19 | 19 | $end_month = $this_month + 1; |
20 | 20 | $end_year = $this_year; |
21 | -if ($this_month == 1){ |
|
21 | +if ($this_month == 1) { |
|
22 | 22 | $start_month = 12; |
23 | 23 | $start_year--; |
24 | 24 | } |
25 | -if ($this_month == 12){ |
|
25 | +if ($this_month == 12) { |
|
26 | 26 | $end_month = 1; |
27 | 27 | $end_year++; |
28 | 28 | } |
29 | -switch ($current_view){ |
|
29 | +switch ($current_view) { |
|
30 | 30 | case 'month': |
31 | 31 | case 'week': |
32 | 32 | case 'day': |
33 | 33 | case 'print': |
34 | - $mArray_begin = mktime (0,0,0,$start_month,1,($start_year)); |
|
35 | - $mArray_end = mktime (0,0,0,$end_month,31,($end_year)); |
|
34 | + $mArray_begin = mktime(0, 0, 0, $start_month, 1, ($start_year)); |
|
35 | + $mArray_end = mktime(0, 0, 0, $end_month, 31, ($end_year)); |
|
36 | 36 | break; |
37 | 37 | case 'admin': |
38 | 38 | case 'error': |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | $mArray_end = time(); |
43 | 43 | break; |
44 | 44 | case 'search': |
45 | - $mArray_begin = mktime (0,0,0,1,1,1970); |
|
46 | - $mArray_end = mktime (0,0,0,1,31,2030); |
|
45 | + $mArray_begin = mktime(0, 0, 0, 1, 1, 1970); |
|
46 | + $mArray_end = mktime(0, 0, 0, 1, 31, 2030); |
|
47 | 47 | break; |
48 | 48 | default: |
49 | - $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); |
|
50 | - $mArray_end = mktime (0,0,0,1,31,($this_year + 1)); |
|
49 | + $mArray_begin = mktime(0, 0, 0, 12, 21, ($this_year - 1)); |
|
50 | + $mArray_end = mktime(0, 0, 0, 1, 31, ($this_year + 1)); |
|
51 | 51 | } |
52 | 52 | if ($phpiCal_config->save_parsed_cals == 'yes') { |
53 | - $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); |
|
54 | - $mArray_end = mktime (0,0,0,1,31,($this_year + 1)); |
|
53 | + $mArray_begin = mktime(0, 0, 0, 12, 21, ($this_year - 1)); |
|
54 | + $mArray_end = mktime(0, 0, 0, 1, 31, ($this_year + 1)); |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Pull in the configuration and some functions. |
3 | 3 | include_once(BASE.'default_config.php'); |
4 | -if (is_file(BASE.'config.inc.php')){ |
|
4 | +if (is_file(BASE.'config.inc.php')) { |
|
5 | 5 | include(BASE.'config.inc.php'); |
6 | - foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value); |
|
6 | + foreach ($configs as $key=>$value) $phpiCal_config->setProperty($key, $value); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | # adjust gridlength to allowed values |
10 | 10 | $g = $phpiCal_config->gridLength; |
11 | -if (!in_array($g,array(1,2,3,4,10,12,15,20,30,60)) && $g < 11){ |
|
11 | +if (!in_array($g, array(1, 2, 3, 4, 10, 12, 15, 20, 30, 60)) && $g < 11) { |
|
12 | 12 | $g = 10; |
13 | -}elseif($g < 13){ |
|
13 | +}elseif ($g < 13) { |
|
14 | 14 | $g = 12; |
15 | -}elseif($g < 17){ |
|
15 | +}elseif ($g < 17) { |
|
16 | 16 | $g = 15; |
17 | -}elseif($g < 25){ |
|
17 | +}elseif ($g < 25) { |
|
18 | 18 | $g = 20; |
19 | -}elseif($g < 45){ |
|
19 | +}elseif ($g < 45) { |
|
20 | 20 | $g = 30; |
21 | -}else{ |
|
21 | +} else { |
|
22 | 22 | $g = 60; |
23 | 23 | } |
24 | 24 | $phpiCal_config->setProperty('gridLength', $g); |
25 | 25 | |
26 | 26 | |
27 | 27 | if ($phpiCal_config->cookie_uri == '') { |
28 | - $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')) ); |
|
28 | + $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/'))); |
|
29 | 29 | if ($phpiCal_config->cookie_uri == 'localhost') $phpiCal_config->setProperty('cookie_uri', ''); |
30 | 30 | } |
31 | 31 | $cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path); |
32 | 32 | if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset']) && $current_view != 'rss') { |
33 | 33 | $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name])); |
34 | - if (isset($phpicalendar['cookie_language'])) $phpiCal_config->setProperty('language', $phpicalendar['cookie_language']); |
|
35 | - if (isset($phpicalendar['cookie_calendar'])) $phpiCal_config->setProperty('default_cal', $phpicalendar['cookie_calendar']); |
|
36 | - if (isset($phpicalendar['cookie_cpath']) && strpos($phpicalendar['cookie_cpath'],'../') === false) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']); |
|
37 | - if (isset($phpicalendar['cookie_view'])) $phpiCal_config->setProperty('default_view', $phpicalendar['cookie_view']); |
|
38 | - if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ |
|
39 | - $phpiCal_config->setProperty('template', $phpicalendar['cookie_style']); |
|
34 | + if (isset($phpicalendar['cookie_language'])) $phpiCal_config->setProperty('language', $phpicalendar['cookie_language']); |
|
35 | + if (isset($phpicalendar['cookie_calendar'])) $phpiCal_config->setProperty('default_cal', $phpicalendar['cookie_calendar']); |
|
36 | + if (isset($phpicalendar['cookie_cpath']) && strpos($phpicalendar['cookie_cpath'], '../') === false) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']); |
|
37 | + if (isset($phpicalendar['cookie_view'])) $phpiCal_config->setProperty('default_view', $phpicalendar['cookie_view']); |
|
38 | + if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')) { |
|
39 | + $phpiCal_config->setProperty('template', $phpicalendar['cookie_style']); |
|
40 | 40 | } |
41 | - if (isset($phpicalendar['cookie_startday'])) $phpiCal_config->setProperty('week_start_day', $phpicalendar['cookie_startday']); |
|
42 | - if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); |
|
43 | - if (isset($phpicalendar['cookie_endtime'])) $phpiCal_config->setProperty('day_end', $phpicalendar['cookie_endtime']); |
|
44 | - if (isset($phpicalendar['cookie_timezone'])) $phpiCal_config->setProperty('timezone', $phpicalendar['cookie_timezone']); |
|
41 | + if (isset($phpicalendar['cookie_startday'])) $phpiCal_config->setProperty('week_start_day', $phpicalendar['cookie_startday']); |
|
42 | + if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); |
|
43 | + if (isset($phpicalendar['cookie_endtime'])) $phpiCal_config->setProperty('day_end', $phpicalendar['cookie_endtime']); |
|
44 | + if (isset($phpicalendar['cookie_timezone'])) $phpiCal_config->setProperty('timezone', $phpicalendar['cookie_timezone']); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | # language support |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | include_once($lang_file); |
55 | 55 | } |
56 | 56 | |
57 | -if (isset($phpicalendar['cookie_timeformat']) && $phpicalendar['cookie_timeformat'] !=''){ |
|
57 | +if (isset($phpicalendar['cookie_timeformat']) && $phpicalendar['cookie_timeformat'] != '') { |
|
58 | 58 | $timeFormat = urldecode($phpicalendar['cookie_timeformat']); |
59 | - switch($timeFormat){ |
|
59 | + switch ($timeFormat) { |
|
60 | 60 | case 'h:i': |
61 | 61 | case 'h:i A': |
62 | 62 | $timeFormat_small = 'h:i'; |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $template = $phpiCal_config->template; |
74 | 74 | |
75 | 75 | $fillTime = $phpiCal_config->day_start; |
76 | -$day_array = array (); |
|
76 | +$day_array = array(); |
|
77 | 77 | |
78 | 78 | while ($fillTime < $phpiCal_config->day_end) { |
79 | - array_push ($day_array, $fillTime); |
|
80 | - preg_match ('/([0-9]{2})([0-9]{2})/', $fillTime, $dTime); |
|
79 | + array_push($day_array, $fillTime); |
|
80 | + preg_match('/([0-9]{2})([0-9]{2})/', $fillTime, $dTime); |
|
81 | 81 | $fill_h = $dTime[1]; |
82 | 82 | $fill_min = $dTime[2]; |
83 | 83 | $fill_min = sprintf('%02d', $fill_min + $phpiCal_config->gridLength); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $fill_h = sprintf('%02d', ($fill_h + 1)); |
86 | 86 | $fill_min = '00'; |
87 | 87 | } |
88 | - $fillTime = $fill_h . $fill_min; |
|
88 | + $fillTime = $fill_h.$fill_min; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | if (!isset($current_view)) $current_view = $phpiCal_config->default_view; |