Completed
Branch master (de1ee7)
by Jacob
05:01
created
controller/waterfalls/LogTagListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
27 27
 		$alias = URLDecode::getPiece(3);
28 28
 		$this->tag = LogTagCollector::getTag($alias);
29 29
 		
30
-		if(!$this->tag)
31
-			$this->eject();
30
+		if(!$this->tag) {
31
+					$this->eject();
32
+		}
32 33
 		
33 34
 		parent::__construct();
34 35
 	}
Please login to merge, or discard this patch.
controller/waterfalls/PeriodListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@
 block discarded – undo
26 26
 		$alias = URLDecode::getPiece(2);
27 27
 		$this->period = PeriodCollector::getByAlias($alias);
28 28
 		
29
-		if(!$this->period)
30
-			$this->eject();
29
+		if(!$this->period) {
30
+					$this->eject();
31
+		}
31 32
 		
32 33
 		parent::__construct();
33 34
 	}
Please login to merge, or discard this patch.
controller/waterfalls/SearchListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
27 27
 	protected function get_page_number()
28 28
 	{
29 29
 		$page = URLDecode::getPiece(2);
30
-		if(isset($page) && is_numeric($page))
31
-			return $page;
30
+		if(isset($page) && is_numeric($page)) {
31
+					return $page;
32
+		}
32 33
 		return 1;
33 34
 	}
34 35
 
Please login to merge, or discard this patch.
controller/waterfalls/WatercourseListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
 		$path = URLDecode::getPiece(1);
30 30
 		$this->watercourse = WatercourseCollector::getByAlias($path);
31 31
 		
32
-		if(!$this->watercourse)
33
-			$this->eject();
32
+		if(!$this->watercourse) {
33
+					$this->eject();
34
+		}
34 35
 	
35 36
 		parent::__construct();
36 37
 	}
Please login to merge, or discard this patch.
controller/waterfalls/WaterfallController.class.inc.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $album = array();
114 114
         
115
-        if($this->waterfall->album == 0)
116
-            return $album;
115
+        if($this->waterfall->album == 0) {
116
+                    return $album;
117
+        }
117 118
         
118 119
         $photo_list = AlbumCollector::getPhotoListForAlbum($this->waterfall->album);
119 120
         foreach($photo_list as $photo)
@@ -122,10 +123,11 @@  discard block
 block discarded – undo
122 123
             $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name);
123 124
             $photo_array['description'] = $photo->description;
124 125
             
125
-            if($photo->height < $photo->width)
126
-                list($height, $width) = array(75, 100);
127
-            else
128
-                list($height, $width) = array(100, 75);
126
+            if($photo->height < $photo->width) {
127
+                            list($height, $width) = array(75, 100);
128
+            } else {
129
+                            list($height, $width) = array(100, 75);
130
+            }
129 131
             
130 132
             $photo_array['image_node'] = sprintf(
131 133
                 self::$THUMB_IMAGE_NODE,
Please login to merge, or discard this patch.
module/form/CommentSubmitModule.class.inc.php 1 patch
Braces   +48 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,16 +26,20 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function activate()
28 28
 	{
29
-		if(!Request::hasPost())
30
-			return false;
31
-		if(!Request::getPost('submit') == 'Submit Comment')
32
-			return false;
29
+		if(!Request::hasPost()) {
30
+					return false;
31
+		}
32
+		if(!Request::getPost('submit') == 'Submit Comment') {
33
+					return false;
34
+		}
33 35
 		
34 36
 		$errors = $this->fetch_errors();
35
-		if(count($errors) > 0)
36
-			return $errors;
37
-		if(Request::getPost('catch') !== '')
38
-			return false;
37
+		if(count($errors) > 0) {
38
+					return $errors;
39
+		}
40
+		if(Request::getPost('catch') !== '') {
41
+					return false;
42
+		}
39 43
 		
40 44
 		$page_id = $this->save_comment_page();
41 45
 		$commenter_id = $this->save_commenter();
@@ -50,18 +54,24 @@  discard block
 block discarded – undo
50 54
 	private function fetch_errors()
51 55
 	{
52 56
 		$errors = array();
53
-		if(!Validate::checkRequest('post', 'name', 'name'))
54
-			$errors['name'] = 'You must include a valid name';
55
-		if(!Validate::checkRequest('post', 'email', 'email'))
56
-			$errors['email'] = 'You must include a valid email';
57
-		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
58
-			$errors['website'] = 'Please enter a valid website';
59
-		if(!Validate::checkRequest('post', 'comment', 'string'))
60
-			$errors['comment'] = 'You must enter a comment';
61
-		if(Request::getPost('notify') && Request::getPost('notify') != 'check')
62
-			$errors['notify'] = 'You entered an invalid notify request';
63
-		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
64
-			$errors['reply'] = 'You entered an invalid reply request';
57
+		if(!Validate::checkRequest('post', 'name', 'name')) {
58
+					$errors['name'] = 'You must include a valid name';
59
+		}
60
+		if(!Validate::checkRequest('post', 'email', 'email')) {
61
+					$errors['email'] = 'You must include a valid email';
62
+		}
63
+		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) {
64
+					$errors['website'] = 'Please enter a valid website';
65
+		}
66
+		if(!Validate::checkRequest('post', 'comment', 'string')) {
67
+					$errors['comment'] = 'You must enter a comment';
68
+		}
69
+		if(Request::getPost('notify') && Request::getPost('notify') != 'check') {
70
+					$errors['notify'] = 'You entered an invalid notify request';
71
+		}
72
+		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) {
73
+					$errors['reply'] = 'You entered an invalid reply request';
74
+		}
65 75
 		
66 76
 		return $errors;
67 77
 	}
@@ -69,8 +79,9 @@  discard block
 block discarded – undo
69 79
 	private function save_comment_page()
70 80
 	{
71 81
 		$page_result = CommentCollector::getCommentPageByURL($this->path, $this->site);
72
-		if($page_result !== null)
73
-			return $page_result->id;
82
+		if($page_result !== null) {
83
+					return $page_result->id;
84
+		}
74 85
 		
75 86
 		$query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')";
76 87
 		$query = sprintf($query, $this->site, $this->path);
@@ -85,8 +96,9 @@  discard block
 block discarded – undo
85 96
 			'name' => Request::getPost('name'),
86 97
 			'email' => Request::getPost('email'));
87 98
 		
88
-		if(Request::getPost('website') != '')
89
-			$cookie_value['website'] = Request::getPost('website');
99
+		if(Request::getPost('website') != '') {
100
+					$cookie_value['website'] = Request::getPost('website');
101
+		}
90 102
 		
91 103
 		$cookie_value = json_encode($cookie_value);
92 104
 		
@@ -95,8 +107,9 @@  discard block
 block discarded – undo
95 107
 			->save();
96 108
 		
97 109
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
98
-		if($commenter_result !== null)
99
-			return $commenter_result->id;
110
+		if($commenter_result !== null) {
111
+					return $commenter_result->id;
112
+		}
100 113
 		
101 114
 		$query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')";
102 115
 		
@@ -112,8 +125,9 @@  discard block
 block discarded – undo
112 125
 	private function save_comment()
113 126
 	{
114 127
 		$comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
115
-		if($comment_result !== null)
116
-			return $comment_result->id;
128
+		if($comment_result !== null) {
129
+					return $comment_result->id;
130
+		}
117 131
 		
118 132
 		$query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')";
119 133
 		
@@ -133,8 +147,9 @@  discard block
 block discarded – undo
133 147
 		$query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
134 148
 		
135 149
 		$reply = Database::escape(Request::getPost('type'));
136
-		if($reply == 'new')
137
-			$reply = 0;
150
+		if($reply == 'new') {
151
+					$reply = 0;
152
+		}
138 153
 		// else check to make sure value is legit
139 154
 		
140 155
 		$notify = (Request::getPost('notify') == 'check') ? 1 : 0;
@@ -163,8 +178,9 @@  discard block
 block discarded – undo
163 178
 			
164 179
 			foreach($notification_result as $notification_row)
165 180
 			{
166
-				if($notification_row->email == Request::getPost('email'))
167
-					continue;
181
+				if($notification_row->email == Request::getPost('email')) {
182
+									continue;
183
+				}
168 184
 				
169 185
 				$email_recipient_array[$notification_row->email] = array(
170 186
 					'email' => $notification_row->email,
Please login to merge, or discard this patch.
router/BlogRouter.class.inc.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@
 block discarded – undo
57 57
 			
58 58
 			Loader::load('utility', 'Content');
59 59
 			$uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate();
60
-		}
61
-		else
60
+		} else
62 61
 		{
63 62
 			$post_uri = URLDecode::getPiece(1);
64 63
 			if($post_uri !== null)
Please login to merge, or discard this patch.
router/Router.class.inc.php 1 patch
Braces   +63 added lines, -42 removed lines patch added patch discarded remove patch
@@ -19,24 +19,33 @@  discard block
 block discarded – undo
19 19
 
20 20
 	private static function get_router_name()
21 21
 	{
22
-		if(Request::isAJAX())
23
-			return 'AJAXRouter';
24
-		if(URLDecode::getURI() == '/robots.txt')
25
-			return 'RobotRouter';
26
-		if(URLDecode::getURI() == '/sitemap.xml')
27
-			return 'SitemapRouter';
28
-		if(URLDecode::getURI() == '/rss/')
29
-			return 'RSSRouter';
30
-		if(URLDecode::getExtension() == 'css')
31
-			return 'StyleRouter';
32
-		if(URLDecode::getExtension() == 'js')
33
-			return 'ScriptRouter';
34
-		if(URLDecode::getExtension() == 'ico')
35
-			return 'ImageRouter';
36
-		if(URLDecode::getExtension() == 'jpg')
37
-			return 'ImageRouter';
38
-		if(URLDecode::getExtension() == 'png')
39
-			return 'ImageRouter';
22
+		if(Request::isAJAX()) {
23
+					return 'AJAXRouter';
24
+		}
25
+		if(URLDecode::getURI() == '/robots.txt') {
26
+					return 'RobotRouter';
27
+		}
28
+		if(URLDecode::getURI() == '/sitemap.xml') {
29
+					return 'SitemapRouter';
30
+		}
31
+		if(URLDecode::getURI() == '/rss/') {
32
+					return 'RSSRouter';
33
+		}
34
+		if(URLDecode::getExtension() == 'css') {
35
+					return 'StyleRouter';
36
+		}
37
+		if(URLDecode::getExtension() == 'js') {
38
+					return 'ScriptRouter';
39
+		}
40
+		if(URLDecode::getExtension() == 'ico') {
41
+					return 'ImageRouter';
42
+		}
43
+		if(URLDecode::getExtension() == 'jpg') {
44
+					return 'ImageRouter';
45
+		}
46
+		if(URLDecode::getExtension() == 'png') {
47
+					return 'ImageRouter';
48
+		}
40 49
 		
41 50
 		switch(URLDecode::getSite())
42 51
 		{
@@ -93,19 +102,22 @@  discard block
 block discarded – undo
93 102
 		
94 103
 		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
95 104
 		
96
-		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
97
-			$redirect_uri .= '/';
105
+		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') {
106
+					$redirect_uri .= '/';
107
+		}
98 108
 		
99 109
         if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
100 110
             $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri;
101 111
         }
102 112
         
103
-		if($redirect_uri == URLDecode::getURI())
104
-			return;
113
+		if($redirect_uri == URLDecode::getURI()) {
114
+					return;
115
+		}
105 116
 		
106 117
 		$controller_check = $redirect_uri;
107
-		if(substr($redirect_uri, 0, 4) == 'http')
108
-			$controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
118
+		if(substr($redirect_uri, 0, 4) == 'http') {
119
+					$controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
120
+		}
109 121
 		
110 122
 		$controller = $this->get_controller($controller_check);
111 123
 		if($controller == '/Error404Controller')
@@ -154,11 +166,13 @@  discard block
 block discarded – undo
154 166
 	{
155 167
 		foreach($this->get_direct_array() as $check)
156 168
 		{
157
-			if($uri == $check->match)
158
-				return "{$this->get_primary_folder()}/{$check->controller}";
169
+			if($uri == $check->match) {
170
+							return "{$this->get_primary_folder()}/{$check->controller}";
171
+			}
159 172
 			
160
-			if(preg_match("@^{$check->match}$@", $uri))
161
-				return "{$this->get_primary_folder()}/{$check->controller}";
173
+			if(preg_match("@^{$check->match}$@", $uri)) {
174
+							return "{$this->get_primary_folder()}/{$check->controller}";
175
+			}
162 176
 		}
163 177
 		
164 178
 		return '/Error404Controller';
@@ -166,23 +180,30 @@  discard block
 block discarded – undo
166 180
 
167 181
 	final private function get_primary_folder()
168 182
 	{
169
-		if(Request::isAjax())
170
-			return 'ajax';
171
-		if(URLDecode::getURI() == '/robots.txt')
172
-			return 'robot';
173
-		if(URLDecode::getURI() == '/sitemap.xml')
174
-			return 'sitemap';
175
-		if(URLDecode::getURI() == '/rss/')
176
-			return 'rss';
177
-		if(URLDecode::getExtension() == 'css')
178
-			return 'styles';
179
-		if(URLDecode::getExtension() == 'js')
180
-			return 'scripts';
183
+		if(Request::isAjax()) {
184
+					return 'ajax';
185
+		}
186
+		if(URLDecode::getURI() == '/robots.txt') {
187
+					return 'robot';
188
+		}
189
+		if(URLDecode::getURI() == '/sitemap.xml') {
190
+					return 'sitemap';
191
+		}
192
+		if(URLDecode::getURI() == '/rss/') {
193
+					return 'rss';
194
+		}
195
+		if(URLDecode::getExtension() == 'css') {
196
+					return 'styles';
197
+		}
198
+		if(URLDecode::getExtension() == 'js') {
199
+					return 'scripts';
200
+		}
181 201
 		if(
182 202
 			URLDecode::getExtension() == 'jpg' ||
183 203
 			URLDecode::getExtension() == 'ico' ||
184
-			URLDecode::getExtension() == 'png')
185
-			return 'images';
204
+			URLDecode::getExtension() == 'png') {
205
+					return 'images';
206
+		}
186 207
 		
187 208
 		return URLDecode::getSite();
188 209
 	}
Please login to merge, or discard this patch.
utility/Asset.class.inc.php 1 patch
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -103,12 +103,13 @@  discard block
 block discarded – undo
103 103
 
104 104
 	private static function process_complex_pieces($type, $array)
105 105
 	{
106
-		if(in_array(404, $array))
107
-			$site = '404';
108
-		else if(in_array(503, $array))
109
-			$site = '503';
110
-		else
111
-			$site = strtolower(URLDecode::getSite());
106
+		if(in_array(404, $array)) {
107
+					$site = '404';
108
+		} else if(in_array(503, $array)) {
109
+					$site = '503';
110
+		} else {
111
+					$site = strtolower(URLDecode::getSite());
112
+		}
112 113
 		
113 114
 		$final_path = self::get_final_path($type, $site);
114 115
 		
@@ -133,11 +134,13 @@  discard block
 block discarded – undo
133 134
 		{
134 135
 			$piece_path = self::get_piece_path($type, $file);
135 136
 			$contents .= file_get_contents($piece_path);
136
-			if(filemtime($final_path) < filemtime($piece_path))
137
-				$create_new = true;
137
+			if(filemtime($final_path) < filemtime($piece_path)) {
138
+							$create_new = true;
139
+			}
140
+		}
141
+		if($create_new) {
142
+					return self::make_final_file($type, $contents, $file_name, true);
138 143
 		}
139
-		if($create_new)
140
-			return self::make_final_file($type, $contents, $file_name, true);
141 144
 		
142 145
 		return self::get_final_link($type, $file_name);
143 146
 	}
@@ -147,8 +150,9 @@  discard block
 block discarded – undo
147 150
 		$path = Loader::getRoot() . "/{$type}/final/{$file}*";
148 151
 		
149 152
 		$files = glob($path); 
150
-		if(count($files) > 0)
151
-			return $files[0];
153
+		if(count($files) > 0) {
154
+					return $files[0];
155
+		}
152 156
 		return;
153 157
 	}
154 158
 
@@ -157,8 +161,9 @@  discard block
 block discarded – undo
157 161
 		$path = Loader::getRoot() . "/{$type}/piece/{$file}*";
158 162
 		
159 163
 		$files = glob($path);
160
-		if(count($files) > 0)
161
-			return $files[0];
164
+		if(count($files) > 0) {
165
+					return $files[0];
166
+		}
162 167
 		return;
163 168
 	}
164 169
 
@@ -174,9 +179,9 @@  discard block
 block discarded – undo
174 179
 				$version = substr($version, 2, strpos($version, '.') - 2);
175 180
 				$version++;
176 181
 				$file_name = substr($file_name, 0, strpos($file_name, '-v'));
182
+			} else {
183
+							$version = 2;
177 184
 			}
178
-			else
179
-				$version = 2;
180 185
 			$file_name .= "-v{$version}";
181 186
 		}
182 187
 		
@@ -193,8 +198,9 @@  discard block
 block discarded – undo
193 198
 		}
194 199
 		
195 200
 		file_put_contents($path, $contents);
196
-		if($exists)
197
-			unlink($old_file);
201
+		if($exists) {
202
+					unlink($old_file);
203
+		}
198 204
 		Debugger::logMessage("New {$type} file created - {$file_name}.");
199 205
 		return self::get_final_link($type, $file_name);
200 206
 	}
Please login to merge, or discard this patch.