Completed
Branch master (c3ca5f)
by Seth
04:51
created
phpicalendar/rss/rss1.0.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,23 +8,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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.'&amp;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.'&amp;uid='.urlencode($uid).'/">'."\n";
46 46
 
47 47
 	/* Create guid, and use uid to make link unique */
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
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('&','&amp;',$val['location']);
58
-		$location		= str_replace('&amp;amp;','&amp;',$location);
56
+	if (isset($val['location']) && $val['location'] != '') {
57
+		$location		= str_replace('&', '&amp;', $val['location']);
58
+		$location		= str_replace('&amp;amp;', '&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
 ?>
Please login to merge, or discard this 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 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,39 +23,39 @@  discard block
 block discarded – undo
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.'&amp;uid='.$uid.'</guid>'."\n";
@@ -66,25 +66,25 @@  discard block
 block discarded – undo
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('&','&amp;',$val['location']);
71
-		$location		= str_replace('&amp;amp;','&amp;',$location);
69
+	if (isset($val['location']) && $val['location'] != '') {
70
+		$location		= str_replace('&', '&amp;', $val['location']);
71
+		$location		= str_replace('&amp;amp;', '&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.'&amp;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".
Please login to merge, or discard this 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 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this 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/timezones.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -381,7 +381,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
phpicalendar/functions/list_functions.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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&amp;getdate=$monthdate\" selected=\"selected\">$select_month</option>\n";
41 41
 		} else {
42 42
 			$return .= "<option value=\"month.php?cal=$cal&amp;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
 block discarded – undo
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
 block discarded – undo
63 63
 	$getdate_year = date("Y", $year_time);
64 64
 	$return .= "<option value=\"year.php?cal=$cal&amp;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&amp;getdate=$next_date\">$next_year</option>\n";
71
+		$return .= "<option value=\"year.php?cal=$cal&amp;getdate=$next_date\">$next_year</option>\n";
72 72
 	}
73 73
 	
74 74
 	return $return;
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
96 96
 		} else {
97 97
 			$return .= "<option value=\"week.php?cal=$cal&amp;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;
Please login to merge, or discard this 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/date_range.php 2 patches
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,27 +27,27 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
phpicalendar/functions/init/configs.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,47 +1,47 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this 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.
phpicalendar/functions/init/cpaths.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 # adjust paths in case they are incorrect
3 3
 if ($phpiCal_config->default_path == '') {
4 4
 	$proto = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' : 'http://');
5
-	$p = str_replace("/rss","",$proto.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['PHP_SELF']) );
5
+	$p = str_replace("/rss", "", $proto.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['PHP_SELF']));
6 6
 	$phpiCal_config->setProperty('default_path', $p);
7 7
 }
8 8
 
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 }
13 13
 $calendar_path = $phpiCal_config->calendar_path;
14 14
 $cpath = ''; #initialize cpath to prevent later undef warnings.
15
-if(isset($_REQUEST['cpath'])&& $_REQUEST['cpath'] !=''){
16
-	$cpath 	= str_replace('..','',$_REQUEST['cpath']);				
17
-	$calendar_path 	.= "/$cpath";				
15
+if (isset($_REQUEST['cpath']) && $_REQUEST['cpath'] != '') {
16
+	$cpath = str_replace('..', '', $_REQUEST['cpath']);				
17
+	$calendar_path .= "/$cpath";				
18 18
 #	$tmp_dir 	.= "/$cpath";				
19
-}elseif(isset($phpiCal_config->default_cpath_check) && $phpiCal_config->default_cpath_check !='' ){
20
-	$cpath 	= str_replace('..','',$default_cpath_check);				
21
-	$calendar_path 	.= "/$cpath";				
19
+}elseif (isset($phpiCal_config->default_cpath_check) && $phpiCal_config->default_cpath_check != '') {
20
+	$cpath = str_replace('..', '', $default_cpath_check);				
21
+	$calendar_path .= "/$cpath";				
22 22
 #	$tmp_dir 	.= "/$cpath";
23 23
 }
24 24
 #these need cpath to be set
25 25
 #set up specific template folder for a particular cpath
26
-if (isset($user_template["$cpath"])){ 
26
+if (isset($user_template["$cpath"])) { 
27 27
   $template = $user_template["$cpath"]; 
28 28
 }
29 29
 #set up specific webcals for a particular cpath
30
-if (isset($more_webcals[$cpath]) && is_array($more_webcals[$cpath])){
30
+if (isset($more_webcals[$cpath]) && is_array($more_webcals[$cpath])) {
31 31
 	foreach ($more_webcals[$cpath] as $wcal)$list_webcals[] = $wcal;
32 32
 }
33
-$phpiCal_config->setProperty('calendar_path',$calendar_path);
34 33
\ No newline at end of file
34
+$phpiCal_config->setProperty('calendar_path', $calendar_path);
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	$cpath 	= str_replace('..','',$_REQUEST['cpath']);				
17 17
 	$calendar_path 	.= "/$cpath";				
18 18
 #	$tmp_dir 	.= "/$cpath";				
19
-}elseif(isset($phpiCal_config->default_cpath_check) && $phpiCal_config->default_cpath_check !='' ){
19
+} elseif(isset($phpiCal_config->default_cpath_check) && $phpiCal_config->default_cpath_check !='' ){
20 20
 	$cpath 	= str_replace('..','',$default_cpath_check);				
21 21
 	$calendar_path 	.= "/$cpath";				
22 22
 #	$tmp_dir 	.= "/$cpath";
@@ -28,6 +28,8 @@  discard block
 block discarded – undo
28 28
 }
29 29
 #set up specific webcals for a particular cpath
30 30
 if (isset($more_webcals[$cpath]) && is_array($more_webcals[$cpath])){
31
-	foreach ($more_webcals[$cpath] as $wcal)$list_webcals[] = $wcal;
32
-}
31
+	foreach ($more_webcals[$cpath] as $wcal) {
32
+		$list_webcals[] = $wcal;
33
+	}
34
+	}
33 35
 $phpiCal_config->setProperty('calendar_path',$calendar_path);
34 36
\ No newline at end of file
Please login to merge, or discard this patch.
phpicalendar/functions/userauth_functions.php 2 patches
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.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 function logout_querys() {
18 18
 	// Make sure the action is logout.
19 19
 	$querys = preg_replace('/action=[^&]+/', 'action=logout', $_SERVER['QUERY_STRING']);
20
-	if ($querys == $_SERVER['QUERY_STRING']) $querys .= '&action=logout';
20
+	if ($querys == $_SERVER['QUERY_STRING']) {
21
+		$querys .= '&action=logout';
22
+	}
21 23
 
22 24
 	// Remove references to the username or password.
23 25
 	$querys = preg_replace('/(username|password)=[^&]+/', '', $querys);
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 	// If not HTTP authenticated, try login via cookies or the web page.
49 51
 	if (isset($_SERVER['PHP_AUTH_USER'])) {
50 52
 		$username = $_SERVER['PHP_AUTH_USER'];
51
-		if (isset($_SERVER['PHP_AUTH_PW'])) $password = $_SERVER['PHP_AUTH_PW'];
53
+		if (isset($_SERVER['PHP_AUTH_PW'])) {
54
+			$password = $_SERVER['PHP_AUTH_PW'];
55
+		}
52 56
 
53 57
 		return array($username, $password, $invalid_login);
54 58
 	}
Please login to merge, or discard this patch.