Completed
Branch master (c3ca5f)
by Seth
04:51
created
phpicalendar/print.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
phpicalendar/rss/rss_common.php 1 patch
Braces   +19 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,10 +33,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&amp;cal=$cal&amp;event_data=$event_data";
197
-				}else{
201
+				} else{
198 202
 					$rss_link		=  ($phpiCal_config->default_path."/day.php?getdate=$thisdate&amp;cal=$urlcal");
199 203
 	
200 204
 				}
201
-				if (isset($cpath) && $cpath !='') $rss_link.="&amp;cpath=$cpath";
205
+				if (isset($cpath) && $cpath !='') {
206
+					$rss_link.="&amp;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
 block discarded – undo
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();
Please login to merge, or discard this patch.
phpicalendar/rss/rss.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
phpicalendar/rss/rss1.0.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
phpicalendar/rss/rss2.0.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
phpicalendar/functions/init.inc.php 1 patch
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
phpicalendar/functions/list_functions.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@
 block discarded – undo
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++;
Please login to merge, or discard this patch.
phpicalendar/functions/init/sanitize.php 1 patch
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,11 +90,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
phpicalendar/functions/init/configs.php 1 patch
Braces   +41 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,22 +3,24 @@  discard block
 block discarded – undo
3 3
 include_once(BASE.'default_config.php');
4 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);
7
-}
6
+	foreach($configs as $key=>$value) {
7
+		$phpiCal_config->setProperty($key, $value);
8
+	}
9
+	}
8 10
 
9 11
 # adjust gridlength to allowed values
10 12
 $g = $phpiCal_config->gridLength;
11 13
 if (!in_array($g,array(1,2,3,4,10,12,15,20,30,60)) && $g < 11){
12 14
 	$g = 10;
13
-}elseif($g < 13){
15
+} elseif($g < 13){
14 16
 	$g = 12;
15
-}elseif($g < 17){
17
+} elseif($g < 17){
16 18
 	$g = 15;
17
-}elseif($g < 25){
19
+} elseif($g < 25){
18 20
 	$g = 20;
19
-}elseif($g < 45){
21
+} elseif($g < 45){
20 22
 	$g = 30;
21
-}else{
23
+} else{
22 24
 	$g = 60;
23 25
 }
24 26
 $phpiCal_config->setProperty('gridLength', $g);
@@ -26,23 +28,41 @@  discard block
 block discarded – undo
26 28
 
27 29
 if ($phpiCal_config->cookie_uri == '') {
28 30
 	$phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')) );
29
-	if ($phpiCal_config->cookie_uri == 'localhost')	$phpiCal_config->setProperty('cookie_uri', '');
30
-}
31
+	if ($phpiCal_config->cookie_uri == 'localhost') {
32
+		$phpiCal_config->setProperty('cookie_uri', '');
33
+	}
34
+	}
31 35
 $cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path);
32 36
 if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset']) && $current_view != 'rss') {
33 37
 	$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_language'])) {
39
+		$phpiCal_config->setProperty('language', 			$phpicalendar['cookie_language']);
40
+	}
41
+	if (isset($phpicalendar['cookie_calendar'])) {
42
+		$phpiCal_config->setProperty('default_cal', 	$phpicalendar['cookie_calendar']);
43
+	}
44
+	if (isset($phpicalendar['cookie_cpath']) && strpos($phpicalendar['cookie_cpath'],'../') === false) {
45
+		$phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']);
46
+	}
47
+	if (isset($phpicalendar['cookie_view'])) {
48
+		$phpiCal_config->setProperty('default_view', 		$phpicalendar['cookie_view']);
49
+	}
38 50
 	if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ 
39 51
 													$phpiCal_config->setProperty('template', 			$phpicalendar['cookie_style']);
40 52
 	}	
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
-}
53
+	if (isset($phpicalendar['cookie_startday'])) {
54
+		$phpiCal_config->setProperty('week_start_day', 		$phpicalendar['cookie_startday']);
55
+	}
56
+	if (isset($phpicalendar['cookie_time'])) {
57
+		$phpiCal_config->setProperty('day_start', 			$phpicalendar['cookie_time']);
58
+	}
59
+	if (isset($phpicalendar['cookie_endtime'])) {
60
+		$phpiCal_config->setProperty('day_end', 			$phpicalendar['cookie_endtime']);
61
+	}
62
+	if (isset($phpicalendar['cookie_timezone'])) {
63
+		$phpiCal_config->setProperty('timezone', 			$phpicalendar['cookie_timezone']);
64
+	}
65
+	}
46 66
 
47 67
 # language support
48 68
 # default to english and overwrite other strings as available
@@ -88,7 +108,9 @@  discard block
 block discarded – undo
88 108
 	$fillTime = $fill_h . $fill_min;
89 109
 }
90 110
 
91
-if (!isset($current_view)) $current_view = $phpiCal_config->default_view;
111
+if (!isset($current_view)) {
112
+	$current_view = $phpiCal_config->default_view;
113
+}
92 114
 /*
93 115
 $tz_array=array();
94 116
 echo "<pre>xx";
Please login to merge, or discard this patch.