Completed
Push — master ( b1edf3...c330e2 )
by Jacob
03:28
created
controller/ajax/SubmitCommentController.class.inc.php 1 patch
Braces   +34 added lines, -26 removed lines patch added patch discarded remove patch
@@ -14,20 +14,27 @@  discard block
 block discarded – undo
14 14
 
15 15
 	protected function set_data()
16 16
 	{
17
-		if(!Validate::checkRequest('post', 'name', 'name'))
18
-			return $this->fail_response('You must include a valid name.');
19
-		if(!Validate::checkRequest('post', 'email', 'email'))
20
-			return $this->fail_response('You must include a valid email.');
21
-		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
22
-			return $this->fail_response('Please include a valid website.');
23
-		if(!Validate::checkRequest('post', 'comment', 'string'))
24
-			return $this->fail_response('You must enter a comment.');
25
-		if(!Validate::checkRequest('post', 'save', 'boolean'))
26
-			return $this->fail_response('You entered an invalid save request.');
27
-		if(!Validate::checkRequest('post', 'notify', 'boolean'))
28
-			return $this->fail_response('You entered an invalid notify request.');
29
-		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
30
-			return $this->fail_response('You entered an invalid reply value.');
17
+		if(!Validate::checkRequest('post', 'name', 'name')) {
18
+					return $this->fail_response('You must include a valid name.');
19
+		}
20
+		if(!Validate::checkRequest('post', 'email', 'email')) {
21
+					return $this->fail_response('You must include a valid email.');
22
+		}
23
+		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) {
24
+					return $this->fail_response('Please include a valid website.');
25
+		}
26
+		if(!Validate::checkRequest('post', 'comment', 'string')) {
27
+					return $this->fail_response('You must enter a comment.');
28
+		}
29
+		if(!Validate::checkRequest('post', 'save', 'boolean')) {
30
+					return $this->fail_response('You entered an invalid save request.');
31
+		}
32
+		if(!Validate::checkRequest('post', 'notify', 'boolean')) {
33
+					return $this->fail_response('You entered an invalid notify request.');
34
+		}
35
+		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) {
36
+					return $this->fail_response('You entered an invalid reply value.');
37
+		}
31 38
 		
32 39
 		$referer_url = Request::getServer('HTTP_REFERER');
33 40
 		$url = explode('/', $referer_url);
@@ -35,8 +42,9 @@  discard block
 block discarded – undo
35 42
 		$url = array_pop($url);
36 43
 		$post = PostCollector::getPostByURI($url);
37 44
 		
38
-		if($post === null)
39
-			return $this->fail_response('There seems to be a problem with this page.', 'error');
45
+		if($post === null) {
46
+					return $this->fail_response('There seems to be a problem with this page.', 'error');
47
+		}
40 48
 		
41 49
 		$commentpage_result = CommentCollector::getCommentPageByURL($post->path, 2);
42 50
 		if($commentpage_result === null)
@@ -49,9 +57,9 @@  discard block
 block discarded – undo
49 57
 			$query = sprintf($query, $site_id, $url);
50 58
 			Database::execute($query);
51 59
 			$commentpage_id = Database::lastInsertID();
52
-		}
53
-		else
54
-			$commentpage_id = $commentpage_result->id;
60
+		} else {
61
+					$commentpage_id = $commentpage_result->id;
62
+		}
55 63
 		
56 64
 		$save = (Request::getPost('save') == 'true') ? 1 : 0;
57 65
 		
@@ -67,8 +75,7 @@  discard block
 block discarded – undo
67 75
 			$query = sprintf($query, $name, $email, $website, $save);
68 76
 			Database::execute($query);
69 77
 			$commenter_id = Database::lastInsertID();
70
-		}
71
-		else
78
+		} else
72 79
 		{
73 80
 			if($commenter_result->save !== $save)
74 81
 			{
@@ -90,9 +97,9 @@  discard block
 block discarded – undo
90 97
 			$query = sprintf($query, $body);
91 98
 			Database::execute($query);
92 99
 			$comment_id = Database::lastInsertID();
93
-		}
94
-		else
95
-			$comment_id = $comment_result->id;
100
+		} else {
101
+					$comment_id = $comment_result->id;
102
+		}
96 103
 		
97 104
 		$query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter_id`,`comment_id`,`reply`,`notify`,`commentpage_id`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
98 105
 		
@@ -114,8 +121,9 @@  discard block
 block discarded – undo
114 121
 		
115 122
 		foreach($notification_result as $notification_row)
116 123
 		{
117
-			if($notification_row->email == $email)
118
-				continue;
124
+			if($notification_row->email == $email) {
125
+							continue;
126
+			}
119 127
 			
120 128
 			$email_recipient_array[$notification_row->email] = array(
121 129
 				'email' => $notification_row->email,
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 1 patch
Braces   +76 added lines, -57 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 			'date' => date('Y')));
41 41
 		
42 42
 		Loader::loadInstance('utility', 'Database');
43
-		if(Database::isConnected() === false)
44
-			$this->unavailable();
43
+		if(Database::isConnected() === false) {
44
+					$this->unavailable();
45
+		}
45 46
 	}
46 47
 
47 48
 	protected function get_domain_container()
@@ -97,8 +98,9 @@  discard block
 block discarded – undo
97 98
 				$post->title = "Blogged about {$category}: <a href=\"{$row->url}\">{$row->title}</a>.";
98 99
 				$post->comments = $row->comments;
99 100
 				
100
-				if($format == 'full')
101
-					$post->image = Content::instance('FetchFirstPhoto', $row->body)->activate(false, 'standard');
101
+				if($format == 'full') {
102
+									$post->image = Content::instance('FetchFirstPhoto', $row->body)->activate(false, 'standard');
103
+				}
102 104
 			break;
103 105
 			case 'book' :
104 106
 				$row = BookCollector::getRow($raw_post->type_id);
@@ -106,8 +108,9 @@  discard block
 block discarded – undo
106 108
 				$post->type = 'book';
107 109
 				$post->title = "Just finished reading {$row->title} by {$row->author}.";
108 110
 				
109
-				if($format == 'full')
110
-					$post->image = "<img alt=\"{$row->title} by {$row->author}\" src=\"{$row->image}\" />";
111
+				if($format == 'full') {
112
+									$post->image = "<img alt=\"{$row->title} by {$row->author}\" src=\"{$row->image}\" />";
113
+				}
111 114
 			break;
112 115
 			case 'distance' :
113 116
 				$row = DistanceCollector::getRow($raw_post->type_id);
@@ -116,16 +119,16 @@  discard block
 block discarded – undo
116 119
 				if($row->type == 'running')
117 120
 				{
118 121
 					$post->title = "Ran {$row->distance} miles and felt {$row->felt}.";
119
-					if(strlen($row->message) > 0)
120
-						$post->title .= " Afterwards, I was all like '{$row->message}'.";
121
-				}
122
-				else if($row->type == 'hiking')
122
+					if(strlen($row->message) > 0) {
123
+											$post->title .= " Afterwards, I was all like '{$row->message}'.";
124
+					}
125
+				} else if($row->type == 'hiking')
123 126
 				{
124 127
 					$post->title = "Hiked {$row->distance} miles and felt {$row->felt}.";
125
-					if(strlen($row->title) > 0)
126
-						$post->title .= " I was hiking up around the {$row->title} area.";
127
-				}
128
-                else if ($row->type == 'walking') {
128
+					if(strlen($row->title) > 0) {
129
+											$post->title .= " I was hiking up around the {$row->title} area.";
130
+					}
131
+				} else if ($row->type == 'walking') {
129 132
                     $post->title = "Walked {$row->distance} miles and felt {$row->felt}.";
130 133
                 }
131 134
 			break;
@@ -140,10 +143,11 @@  discard block
 block discarded – undo
140 143
 				
141 144
 				$post->type = 'twitter';
142 145
 				
143
-				if($format == 'full')
144
-					$post->title = $row->text_formatted_full;
145
-				else
146
-					$post->title = $row->text_formatted;
146
+				if($format == 'full') {
147
+									$post->title = $row->text_formatted_full;
148
+				} else {
149
+									$post->title = $row->text_formatted;
150
+				}
147 151
 				
148 152
 				$post->retweets = ($row->is_retweet == 0) ? $row->retweets : 0;
149 153
 				$post->favorites = ($row->is_retweet == 0) ? $row->favorites : 0;
@@ -153,13 +157,15 @@  discard block
 block discarded – undo
153 157
 				
154 158
 				$post->type = 'youtube';
155 159
 				
156
-				if($format == 'full')
157
-					$post->title = "Favorited {$row->title} by {$row->author} on YouTube.";
158
-				else
159
-					$post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row->video_id}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row->content}\">{$row->title}</a> by {$row->author} on YouTube.";
160
+				if($format == 'full') {
161
+									$post->title = "Favorited {$row->title} by {$row->author} on YouTube.";
162
+				} else {
163
+									$post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row->video_id}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row->content}\">{$row->title}</a> by {$row->author} on YouTube.";
164
+				}
160 165
 				
161
-				if($format == 'full')
162
-					$post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row->video_id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>";
166
+				if($format == 'full') {
167
+									$post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row->video_id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>";
168
+				}
163 169
 			break;
164 170
 		}
165 171
 		
@@ -188,10 +194,11 @@  discard block
 block discarded – undo
188 194
 		Loader::load('view', '/Head', $this->data_array['head']);
189 195
 		foreach($this->body_view_array as $view)
190 196
 		{
191
-			if(substr($view, 0, 1) == '/')
192
-				Loader::load('view', $view, $this->data_array['body']);
193
-			else
194
-				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
197
+			if(substr($view, 0, 1) == '/') {
198
+							Loader::load('view', $view, $this->data_array['body']);
199
+			} else {
200
+							Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
201
+			}
195 202
 		}
196 203
         
197 204
         if (URLDecode::getSite() == 'waterfalls') {
@@ -200,8 +207,9 @@  discard block
 block discarded – undo
200 207
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
201 208
         }
202 209
 		
203
-		if($view == '/404' || $view == '/503')
204
-			exit;
210
+		if($view == '/404' || $view == '/503') {
211
+					exit;
212
+		}
205 213
 	}
206 214
 
207 215
 	protected function set_header_method($method)
@@ -261,11 +269,13 @@  discard block
 block discarded – undo
261 269
 		
262 270
 		$js_array = array();
263 271
 		
264
-		if(count($this->js_array) > 0)
265
-			$js_array = array_merge($js_array, $this->js_array);
272
+		if(count($this->js_array) > 0) {
273
+					$js_array = array_merge($js_array, $this->js_array);
274
+		}
266 275
 		
267
-		if(count($js_array) > 0)
268
-			$js_array = Asset::getJS($js_array);
276
+		if(count($js_array) > 0) {
277
+					$js_array = Asset::getJS($js_array);
278
+		}
269 279
 		
270 280
 		$this->set_head('css_link_array', $css_array);
271 281
 		$this->set_head('js_link_array', $js_array);
@@ -278,14 +288,16 @@  discard block
 block discarded – undo
278 288
 
279 289
 	protected function eject()
280 290
 	{
281
-		if(get_class($this) !== 'Error404Controller')
282
-			Loader::loadNew('controller', '/Error404Controller')->activate();
291
+		if(get_class($this) !== 'Error404Controller') {
292
+					Loader::loadNew('controller', '/Error404Controller')->activate();
293
+		}
283 294
 	}
284 295
 
285 296
 	protected function unavailable()
286 297
 	{
287
-		if(get_class($this) !== 'Error503Controller')
288
-			Loader::loadNew('controller', '/Error503Controller')->activate();
298
+		if(get_class($this) !== 'Error503Controller') {
299
+					Loader::loadNew('controller', '/Error503Controller')->activate();
300
+		}
289 301
 	}
290 302
 
291 303
 	protected function redirect($uri, $method = 301)
@@ -293,12 +305,14 @@  discard block
 block discarded – undo
293 305
 		switch($method)
294 306
 		{
295 307
 			case 301 :
296
-				if(get_class($this) !== 'Error301Controller')
297
-					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
308
+				if(get_class($this) !== 'Error301Controller') {
309
+									Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
310
+				}
298 311
 				break;
299 312
 			case 303 :
300
-				if(get_class($this) !== 'Error303Controller')
301
-					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
313
+				if(get_class($this) !== 'Error303Controller') {
314
+									Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
315
+				}
302 316
 				break;
303 317
 		}
304 318
 	}
@@ -345,18 +359,19 @@  discard block
 block discarded – undo
345 359
 			$comment_object->url = $comment->url;
346 360
 			$comment_object->trusted = $comment->trusted;
347 361
 			
348
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
349
-				$comment_object->errors = $this->comment_errors;
350
-			else
351
-				$comment_object->errors = array();
362
+			if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
363
+							$comment_object->errors = $this->comment_errors;
364
+			} else {
365
+							$comment_object->errors = array();
366
+			}
352 367
 			
353 368
 			if($comment->reply == 0)
354 369
 			{
355 370
 				$comment_object->replies = array();
356 371
 				$comment_array[$comment->id] = $comment_object;
357
-			}
358
-			else
359
-				$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
372
+			} else {
373
+							$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
374
+			}
360 375
 		}
361 376
 		
362 377
 		$comment_count = CommentCollector::getCommentCountForURL($site, $path);
@@ -381,22 +396,26 @@  discard block
 block discarded – undo
381 396
 		$commenter->website = '';
382 397
 		
383 398
 		$commenter_cookie = Cookie::instance('Commenter');
384
-		if(!$commenter_cookie->exists())
385
-			return $commenter;
399
+		if(!$commenter_cookie->exists()) {
400
+					return $commenter;
401
+		}
386 402
 		
387 403
 		$commenter_cookie_value = $commenter_cookie->getValue();
388 404
 		$commenter_cookie_value = json_decode($commenter_cookie_value);
389 405
 		
390
-		if($commenter_cookie_value === NULL)
391
-			return $commenter;
406
+		if($commenter_cookie_value === NULL) {
407
+					return $commenter;
408
+		}
392 409
 		
393
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
394
-			return $commenter;
410
+		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
411
+					return $commenter;
412
+		}
395 413
 		
396 414
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
397 415
 		
398
-		if($commenter_object === NULL)
399
-			return $commenter;
416
+		if($commenter_object === NULL) {
417
+					return $commenter;
418
+		}
400 419
 		
401 420
 		$commenter->id = $commenter_object->id;
402 421
 		$commenter->name = $commenter_object->name;
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.
controller/waterfalls/CountyListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@
 block discarded – undo
28 28
 		$path = URLDecode::getPiece(1);
29 29
 		$this->county = CountyCollector::getByAlias($path);
30 30
 		
31
-		if(!$this->county)
32
-			$this->eject();
31
+		if(!$this->county) {
32
+					$this->eject();
33
+		}
33 34
 		
34 35
 		parent::__construct();
35 36
 	}
Please login to merge, or discard this patch.
controller/waterfalls/LogController.class.inc.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
         $log_path = URLDecode::getPiece(2);
26 26
         
27 27
         $this->log = LogCollector::getByAlias($log_path);
28
-        if(!$this->log)
29
-            $this->eject();
28
+        if(!$this->log) {
29
+                    $this->eject();
30
+        }
30 31
 
31 32
         $this->parent_navigation_item = 'journal';
32 33
         
@@ -182,8 +183,9 @@  discard block
 block discarded – undo
182 183
     {
183 184
         $album = array();
184 185
         
185
-        if($this->log->album == 0)
186
-            return $album;
186
+        if($this->log->album == 0) {
187
+                    return $album;
188
+        }
187 189
         
188 190
         $photo_list = AlbumCollector::getPhotoListForAlbum($this->log->album);
189 191
         foreach($photo_list as $photo)
@@ -192,10 +194,11 @@  discard block
 block discarded – undo
192 194
             $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name);
193 195
             $photo_array['description'] = $photo->description;
194 196
             
195
-            if($photo->height < $photo->width)
196
-                list($height, $width) = array(75, 100);
197
-            else
198
-                list($height, $width) = array(100, 75);
197
+            if($photo->height < $photo->width) {
198
+                            list($height, $width) = array(75, 100);
199
+            } else {
200
+                            list($height, $width) = array(100, 75);
201
+            }
199 202
             
200 203
             if ($photo->description == '') {
201 204
                 Debugger::logMessage("No description for {$photo->category}/{$photo->name}");
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/ContactController.class.inc.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,17 +33,21 @@
 block discarded – undo
33 33
 
34 34
 	private function process_form()
35 35
 	{
36
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
37
-			return (object) array('display' => 'normal');
36
+		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
37
+					return (object) array('display' => 'normal');
38
+		}
38 39
 		
39 40
 		Loader::load('utility', 'Validate');
40 41
 		$error_result = array();
41
-		if(!Validate::checkRequest('post', 'name', 'string'))
42
-			$error_result['name'] = 'please enter your name';
43
-		if(!Validate::checkRequest('post', 'email', 'string'))
44
-			$error_result['email'] = 'please enter a valid email';
45
-		if(!Validate::checkRequest('post', 'message', 'string'))
46
-			$error_result['message'] = 'please write a message';
42
+		if(!Validate::checkRequest('post', 'name', 'string')) {
43
+					$error_result['name'] = 'please enter your name';
44
+		}
45
+		if(!Validate::checkRequest('post', 'email', 'string')) {
46
+					$error_result['email'] = 'please enter a valid email';
47
+		}
48
+		if(!Validate::checkRequest('post', 'message', 'string')) {
49
+					$error_result['message'] = 'please write a message';
50
+		}
47 51
 		
48 52
 		$values = (object) array(
49 53
 			'name' => Request::getPost('name'),
Please login to merge, or discard this patch.
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.