Completed
Push — master ( c330e2...cf0c7a )
by Jacob
03:58
created
utility/Debugger.class.inc.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public static function instance()
26 26
 	{
27
-		if(!isset(self::$instance))
28
-			self::$instance = new Debugger();
27
+		if(!isset(self::$instance)) {
28
+					self::$instance = new Debugger();
29
+		}
29 30
 		return self::$instance;
30 31
 	}
31 32
 
@@ -52,12 +53,15 @@  discard block
 block discarded – undo
52 53
 
53 54
 	public static function internal_error($code, $string, $file = null, $line = null, $context = null)
54 55
 	{
55
-		if($file == null)
56
-			$file = self::$UNKNOWN_ERROR_FILE;
57
-		if($line == null)
58
-			$line = self::$UNKNOWN_ERROR_LINE;
59
-		if($context == null)
60
-			$context = self::$UNKNOWN_ERROR_CONTEXT;
56
+		if($file == null) {
57
+					$file = self::$UNKNOWN_ERROR_FILE;
58
+		}
59
+		if($line == null) {
60
+					$line = self::$UNKNOWN_ERROR_LINE;
61
+		}
62
+		if($context == null) {
63
+					$context = self::$UNKNOWN_ERROR_CONTEXT;
64
+		}
61 65
 		
62 66
 		self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}");
63 67
 		
@@ -68,8 +72,9 @@  discard block
 block discarded – undo
68 72
 	{
69 73
 		$error = error_get_last();
70 74
 		
71
-		if(isset($error))
72
-			self::internal_error($error['type'], $error['message'], $error['file'], $error['line']);
75
+		if(isset($error)) {
76
+					self::internal_error($error['type'], $error['message'], $error['file'], $error['line']);
77
+		}
73 78
 		
74 79
 		self::display();
75 80
 		return true;
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.
collector/comment/CommentCollector.class.inc.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,10 +163,11 @@
 block discarded – undo
163 163
 	{
164 164
 		$path = self::escape($path);
165 165
 		
166
-		if($commenter != 0)
167
-			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168
-		else
169
-			$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
166
+		if($commenter != 0) {
167
+					$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168
+		} else {
169
+					$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
170
+		}
170 171
 		
171 172
 		$query = "
172 173
 			SELECT
Please login to merge, or discard this patch.
controller/sitemap/PortfolioSitemapController.class.inc.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
 		
19 19
 		foreach($pieces as $piece)
20 20
 		{
21
-			if($piece->category == 1)
22
-				$this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
23
-			else
24
-				$this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
21
+			if($piece->category == 1) {
22
+							$this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
23
+			} else {
24
+							$this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
25
+			}
25 26
 		}
26 27
 	}
27 28
 
Please login to merge, or discard this patch.
controller/RobotController.class.inc.php 1 patch
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		$entry = new stdclass();
29 29
 		$entry->agent = self::$ALL_ROBOTS;
30
-		if($url)
31
-			$entry->allow = $url;
32
-		else
30
+		if($url) {
31
+					$entry->allow = $url;
32
+		} else
33 33
 		{
34 34
 			$entry->disallow = '';
35 35
 			$entry->allow = self::$ALL_URL;
@@ -42,10 +42,11 @@  discard block
 block discarded – undo
42 42
 	{
43 43
 		$entry = new stdclass();
44 44
 		$entry->agent = self::$ALL_ROBOTS;
45
-		if($url)
46
-			$entry->disallow = $url;
47
-		else
48
-			$entry->disallow = self::$ALL_URL;
45
+		if($url) {
46
+					$entry->disallow = $url;
47
+		} else {
48
+					$entry->disallow = self::$ALL_URL;
49
+		}
49 50
 		
50 51
 		$this->entries[] = $entry;
51 52
 	}
@@ -57,12 +58,15 @@  discard block
 block discarded – undo
57 58
 		
58 59
 		foreach($this->entries as $key => $entry)
59 60
 		{
60
-			if($key == 0)
61
-				echo "User-agent: {$entry->agent}\n";
62
-			if(isset($entry->disallow) && $entry->disallow != '')
63
-				echo "Disallow: {$entry->disallow}\n";
64
-			if(isset($entry->allow))
65
-				echo "Allow: {$entry->allow}\n";
61
+			if($key == 0) {
62
+							echo "User-agent: {$entry->agent}\n";
63
+			}
64
+			if(isset($entry->disallow) && $entry->disallow != '') {
65
+							echo "Disallow: {$entry->disallow}\n";
66
+			}
67
+			if(isset($entry->allow)) {
68
+							echo "Allow: {$entry->allow}\n";
69
+			}
66 70
 			//echo "\n";
67 71
 		}
68 72
 		
Please login to merge, or discard this patch.
controller/SitemapController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
 
23 23
 	protected function addURL($loc, $lastmod = false, $changefreq = 'monthly', $priority = .5)
24 24
 	{
25
-		if(!$lastmod)
26
-			$lastmod = $this->default_lastmod;
25
+		if(!$lastmod) {
26
+					$lastmod = $this->default_lastmod;
27
+		}
27 28
 		
28 29
 		$url = $this->xml->addChild('url');
29 30
 		
Please login to merge, or discard this patch.
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/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.