@@ -1,5 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('BASE')) define('BASE', './'); |
|
| 2 | +if (!defined('BASE')) { |
|
| 3 | + define('BASE', './'); |
|
| 4 | +} |
|
| 3 | 5 | $current_view ='print'; |
| 4 | 6 | require_once(BASE.'functions/date_functions.php'); |
| 5 | 7 | require_once(BASE.'functions/init.inc.php'); |
@@ -9,7 +11,9 @@ discard block |
||
| 9 | 11 | $events_week = 0; |
| 10 | 12 | $unix_time = strtotime($getdate); |
| 11 | 13 | $printview = $phpiCal_config->default_view; |
| 12 | -if (isset($_GET['printview'])) $printview = $_GET['printview']; |
|
| 14 | +if (isset($_GET['printview'])) { |
|
| 15 | + $printview = $_GET['printview']; |
|
| 16 | +} |
|
| 13 | 17 | |
| 14 | 18 | if ($printview == 'day') { |
| 15 | 19 | $display_date = localizeDate ($dateFormat_day, strtotime($getdate)); |
@@ -33,10 +33,12 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | //set the range of days to return based on the view chosen |
| 35 | 35 | $rssview = $phpiCal_config->default_view; |
| 36 | -if (isset($_GET['rssview'])) $rssview = $_GET['rssview']; |
|
| 36 | +if (isset($_GET['rssview'])) { |
|
| 37 | + $rssview = $_GET['rssview']; |
|
| 38 | +} |
|
| 37 | 39 | if (isset($_GET['getdate']) && $_GET['getdate'] !=''){ |
| 38 | 40 | $getdate = $_GET['getdate']; |
| 39 | -}else{ |
|
| 41 | +} else{ |
|
| 40 | 42 | $getdate = date("Ymd"); |
| 41 | 43 | } |
| 42 | 44 | # for all views, $fromdate is the first day to be shown and $todate should be the last day. |
@@ -70,7 +72,7 @@ discard block |
||
| 70 | 72 | case 'year': |
| 71 | 73 | if(isset($_GET['year'])){ |
| 72 | 74 | $theyear = $_GET['year']; |
| 73 | - }else{ |
|
| 75 | + } else{ |
|
| 74 | 76 | $theyear = substr($getdate,0,4); |
| 75 | 77 | } |
| 76 | 78 | $fromdate = ($theyear*10000)+101; |
@@ -90,7 +92,7 @@ discard block |
||
| 90 | 92 | case 'range': |
| 91 | 93 | if(isset($_GET['from'])){ |
| 92 | 94 | $fromdate = $_GET['from']; |
| 93 | - }else{ |
|
| 95 | + } else{ |
|
| 94 | 96 | $fromdate = $getdate; |
| 95 | 97 | } |
| 96 | 98 | $todate = $_GET['to']; |
@@ -122,8 +124,10 @@ discard block |
||
| 122 | 124 | //get filemtime from master array |
| 123 | 125 | $filemod = 0; #default to start of unix era, overwrite with most recent mtime from master array |
| 124 | 126 | foreach ($master_array['-4'] as $calinfo){ |
| 125 | - if ($calinfo['mtime'] > $filemod) $filemod = $calinfo['mtime']; |
|
| 126 | -} |
|
| 127 | + if ($calinfo['mtime'] > $filemod) { |
|
| 128 | + $filemod = $calinfo['mtime']; |
|
| 129 | + } |
|
| 130 | + } |
|
| 127 | 131 | $filemodtime = date("r", $filemod); |
| 128 | 132 | |
| 129 | 133 | //send relevant headers |
@@ -169,11 +173,11 @@ discard block |
||
| 169 | 173 | if (isset($uid_arr[$uid])){ |
| 170 | 174 | $uid_arr[$uid] .= "+$dayofweek" ; |
| 171 | 175 | continue; |
| 172 | - }else{ |
|
| 176 | + } else{ |
|
| 173 | 177 | $uid_arr[$uid] = "$dayofweek" ; |
| 174 | 178 | } |
| 175 | 179 | $event_start = $lang['l_all_day']; |
| 176 | - }else{ |
|
| 180 | + } else{ |
|
| 177 | 181 | $event_start = @$val["event_start"]; |
| 178 | 182 | $event_start = date ($timeFormat, @strtotime ("$event_start")); |
| 179 | 183 | } |
@@ -194,11 +198,13 @@ discard block |
||
| 194 | 198 | if (isset($rss_link_to_event) && $rss_link_to_event == 'yes'){ |
| 195 | 199 | $event_data = urlencode(serialize($val)); |
| 196 | 200 | $rss_link = $phpiCal_config->default_path."/includes/event.php?getdate=$thisdate&cal=$cal&event_data=$event_data"; |
| 197 | - }else{ |
|
| 201 | + } else{ |
|
| 198 | 202 | $rss_link = ($phpiCal_config->default_path."/day.php?getdate=$thisdate&cal=$urlcal"); |
| 199 | 203 | |
| 200 | 204 | } |
| 201 | - if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; |
|
| 205 | + if (isset($cpath) && $cpath !='') { |
|
| 206 | + $rss_link.="&cpath=$cpath"; |
|
| 207 | + } |
|
| 202 | 208 | $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); |
| 203 | 209 | $rss_list .= rss_li($rss_link,$uid); |
| 204 | 210 | $rss_items .= rss_item(); |
@@ -209,7 +215,9 @@ discard block |
||
| 209 | 215 | $thistime = $thistime+(60*60*24); # echo "$thisdate: ".strtotime($thisdate)."->$thistime<br>\n"; |
| 210 | 216 | $i++; |
| 211 | 217 | } while ($i <= $numdays); |
| 212 | -if (($events_count < 1) && ($i == $numdays)) $rss_items = rss_noitems(); |
|
| 218 | +if (($events_count < 1) && ($i == $numdays)) { |
|
| 219 | + $rss_items = rss_noitems(); |
|
| 220 | +} |
|
| 213 | 221 | |
| 214 | 222 | $rss_list = enclose_items($rss_list); |
| 215 | 223 | $rss .= $rss_list.$rss_items.rss_close(); |
@@ -20,7 +20,9 @@ |
||
| 20 | 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 !='') { |
|
| 24 | + $rss_link.="?cpath=$cpath"; |
|
| 25 | + } |
|
| 24 | 26 | $rss .= '<link>'.htmlspecialchars("$phpiCal_config->default_path").'</link>'."\n"; |
| 25 | 27 | $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; |
| 26 | 28 | $rss .= '<language>'.$rss_language.'</language>'."\n"; |
@@ -20,7 +20,9 @@ |
||
| 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"; |
|
| 23 | + if (isset($cpath) && $cpath !='') { |
|
| 24 | + $rss_link.="?cpath=$cpath"; |
|
| 25 | + } |
|
| 24 | 26 | $rss .='">'."\n"; |
| 25 | 27 | |
| 26 | 28 | $rss .= '<title>'.$cal_displayname; |
@@ -39,7 +39,9 @@ |
||
| 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"; |
|
| 42 | + if (isset($cpath) && $cpath !='') { |
|
| 43 | + $rss_link.="?cpath=$cpath"; |
|
| 44 | + } |
|
| 43 | 45 | $rss .='</link>'."\n"; |
| 44 | 46 | $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; |
| 45 | 47 | $rss .= '<language>'.$rss_language.'</language>'."\n"; |
@@ -2,7 +2,9 @@ discard block |
||
| 2 | 2 | # require php 5 |
| 3 | 3 | $php_started = getmicrotime(); |
| 4 | 4 | # define BASE |
| 5 | -if (!defined('BASE')) define('BASE', './'); |
|
| 5 | +if (!defined('BASE')) { |
|
| 6 | + define('BASE', './'); |
|
| 7 | +} |
|
| 6 | 8 | if (phpversion() < '5.1'){ |
| 7 | 9 | die (phpversion()." detected. php 5.1 or higher required for this version.\n\n" ); |
| 8 | 10 | } |
@@ -17,12 +19,17 @@ discard block |
||
| 17 | 19 | |
| 18 | 20 | // Grab the action (login or logout). |
| 19 | 21 | $action = ''; |
| 20 | -if (isset($_GET['action'])) $action = $_GET['action']; |
|
| 21 | -else if (isset($_POST['action'])) $action = $_POST['action']; |
|
| 22 | +if (isset($_GET['action'])) { |
|
| 23 | + $action = $_GET['action']; |
|
| 24 | +} else if (isset($_POST['action'])) { |
|
| 25 | + $action = $_POST['action']; |
|
| 26 | +} |
|
| 22 | 27 | |
| 23 | 28 | // Login and/or logout. |
| 24 | 29 | list($username, $password, $invalid_login) = user_login(); |
| 25 | -if ($action != 'login') $invalid_login = false; |
|
| 30 | +if ($action != 'login') { |
|
| 31 | + $invalid_login = false; |
|
| 32 | +} |
|
| 26 | 33 | if ($action == 'logout' || $invalid_login) { |
| 27 | 34 | list($username, $password) = user_logout(); |
| 28 | 35 | } |
@@ -37,8 +44,9 @@ discard block |
||
| 37 | 44 | if (isset($_GET['cal']) && $_GET['cal'] !='') { |
| 38 | 45 | // If the cal value is not an array, split it into an array on |
| 39 | 46 | // commas. |
| 40 | - if (!is_array($_GET['cal'])) |
|
| 41 | - $_GET['cal'] = explode(',', $_GET['cal']); |
|
| 47 | + if (!is_array($_GET['cal'])) { |
|
| 48 | + $_GET['cal'] = explode(',', $_GET['cal']); |
|
| 49 | + } |
|
| 42 | 50 | |
| 43 | 51 | // Grab the calendar filenames off the cal value array. |
| 44 | 52 | $cal_filenames = $_GET['cal']; |
@@ -61,7 +69,9 @@ discard block |
||
| 61 | 69 | foreach ($cal_filenames as $cal_filename) { |
| 62 | 70 | # substitute for md5-obscured list_webcals |
| 63 | 71 | foreach ($list_webcals as $tmp_cal){ |
| 64 | - if($cal_filename == md5($phpiCal_config->salt.$tmp_cal)) $cal_filename = $tmp_cal; |
|
| 72 | + if($cal_filename == md5($phpiCal_config->salt.$tmp_cal)) { |
|
| 73 | + $cal_filename = $tmp_cal; |
|
| 74 | + } |
|
| 65 | 75 | } |
| 66 | 76 | // If the calendar identifier begins with a web protocol, this is a web |
| 67 | 77 | // calendar. |
@@ -143,7 +153,9 @@ discard block |
||
| 143 | 153 | if (count($local_cals) == 1) { |
| 144 | 154 | $filename = $local_cals[0]; |
| 145 | 155 | $add_cpath = ''; |
| 146 | - if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/"; |
|
| 156 | + if (isset($cpath) && $cpath !='') { |
|
| 157 | + $add_cpath = "$cpath/"; |
|
| 158 | + } |
|
| 147 | 159 | |
| 148 | 160 | if (($phpiCal_config->download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) { |
| 149 | 161 | $subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename; |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | $i = 1; |
| 19 | 19 | if (is_array($master_array['-3'])) { |
| 20 | 20 | foreach ($master_array['-3'] as $key => $val) { |
| 21 | - if ($i > $phpiCal_config->unique_colors) $i = 1; |
|
| 21 | + if ($i > $phpiCal_config->unique_colors) { |
|
| 22 | + $i = 1; |
|
| 23 | + } |
|
| 22 | 24 | $val = str_replace ("\,", ",", $val); |
| 23 | 25 | $return .= '<img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />'; |
| 24 | 26 | $i++; |
@@ -90,11 +90,15 @@ discard block |
||
| 90 | 90 | switch ($key){ |
| 91 | 91 | case 'action': |
| 92 | 92 | $actions = array('login','logout','addupdate','delete'); |
| 93 | - if (!in_array($val,$actions)) $val = ''; |
|
| 93 | + if (!in_array($val,$actions)) { |
|
| 94 | + $val = ''; |
|
| 95 | + } |
|
| 94 | 96 | break; |
| 95 | 97 | case 'date': |
| 96 | 98 | case 'time': |
| 97 | - if (!is_numeric($val)) $val = ''; |
|
| 99 | + if (!is_numeric($val)) { |
|
| 100 | + $val = ''; |
|
| 101 | + } |
|
| 98 | 102 | break; |
| 99 | 103 | default: |
| 100 | 104 | $val = recursiveSanitize($val); |
@@ -108,7 +112,7 @@ discard block |
||
| 108 | 112 | if (!is_array($val)){ |
| 109 | 113 | $val = strip_tags($val); |
| 110 | 114 | $_GET['cal'] = strip_tags($val); |
| 111 | - }else{ |
|
| 115 | + } else{ |
|
| 112 | 116 | unset ($_GET['cal']); |
| 113 | 117 | foreach($val as $cal){ |
| 114 | 118 | $_GET['cal'][]= strip_tags($cal); |
@@ -116,18 +120,24 @@ discard block |
||
| 116 | 120 | } |
| 117 | 121 | break; |
| 118 | 122 | case 'getdate': |
| 119 | - if (!is_numeric($val)) $val = ''; |
|
| 123 | + if (!is_numeric($val)) { |
|
| 124 | + $val = ''; |
|
| 125 | + } |
|
| 120 | 126 | break; |
| 121 | 127 | default: |
| 122 | 128 | $val = recursiveSanitize($val); |
| 123 | 129 | } |
| 124 | - if ($key != 'cal') $_GET[$key] = $val; |
|
| 130 | + if ($key != 'cal') { |
|
| 131 | + $_GET[$key] = $val; |
|
| 132 | + } |
|
| 125 | 133 | |
| 126 | 134 | } |
| 127 | 135 | foreach ($_COOKIE as $key=>$val){ |
| 128 | 136 | switch ($key){ |
| 129 | 137 | case 'time': |
| 130 | - if (!is_numeric($val)) $val = ''; |
|
| 138 | + if (!is_numeric($val)) { |
|
| 139 | + $val = ''; |
|
| 140 | + } |
|
| 131 | 141 | break; |
| 132 | 142 | default: |
| 133 | 143 | $val = recursiveSanitize($val); |
@@ -27,27 +27,27 @@ |
||
| 27 | 27 | $end_year++; |
| 28 | 28 | } |
| 29 | 29 | switch ($current_view){ |
| 30 | - case 'month': |
|
| 31 | - case 'week': |
|
| 32 | - case 'day': |
|
| 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)); |
|
| 36 | - break; |
|
| 37 | - case 'admin': |
|
| 38 | - case 'error': |
|
| 39 | - case 'preferences': |
|
| 40 | - case 'rss_index': |
|
| 41 | - $mArray_begin = time(); |
|
| 42 | - $mArray_end = time(); |
|
| 43 | - break; |
|
| 44 | - case 'search': |
|
| 45 | - $mArray_begin = mktime (0,0,0,1,1,1970); |
|
| 46 | - $mArray_end = mktime (0,0,0,1,31,2030); |
|
| 47 | - break; |
|
| 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)); |
|
| 30 | + case 'month': |
|
| 31 | + case 'week': |
|
| 32 | + case 'day': |
|
| 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)); |
|
| 36 | + break; |
|
| 37 | + case 'admin': |
|
| 38 | + case 'error': |
|
| 39 | + case 'preferences': |
|
| 40 | + case 'rss_index': |
|
| 41 | + $mArray_begin = time(); |
|
| 42 | + $mArray_end = time(); |
|
| 43 | + break; |
|
| 44 | + case 'search': |
|
| 45 | + $mArray_begin = mktime (0,0,0,1,1,1970); |
|
| 46 | + $mArray_end = mktime (0,0,0,1,31,2030); |
|
| 47 | + break; |
|
| 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)); |
|
| 51 | 51 | } |
| 52 | 52 | if ($phpiCal_config->save_parsed_cals == 'yes') { |
| 53 | 53 | $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); |