Completed
Branch master (de1ee7)
by Jacob
05:01
created
utility/Request.class.inc.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@
 block discarded – undo
34 34
 		return false;
35 35
 	}
36 36
 
37
+	/**
38
+	 * @param string $key
39
+	 */
37 40
 	static function getGet($key = null)
38 41
 	{
39 42
 		if($key)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 	static function getServer($key = null)
20 20
 	{
21
-		if($key)
21
+		if ($key)
22 22
 		{
23
-			if(isset(self::$server[$key]))
23
+			if (isset(self::$server[$key]))
24 24
 				return self::$server[$key];
25 25
 			return false;
26 26
 		}
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 
30 30
 	static function isAjax()
31 31
 	{
32
-		if(self::getServer(self::$AJAX_REQUEST))
32
+		if (self::getServer(self::$AJAX_REQUEST))
33 33
 			return true;
34 34
 		return false;
35 35
 	}
36 36
 
37 37
 	static function getGet($key = null)
38 38
 	{
39
-		if($key)
39
+		if ($key)
40 40
 		{
41
-			if(isset(self::$get[$key]))
41
+			if (isset(self::$get[$key]))
42 42
 				return self::$get[$key];
43 43
 			return false;
44 44
 		}
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 	static function getPost($key = null)
49 49
 	{
50
-		if($key)
50
+		if ($key)
51 51
 		{
52
-			if(isset(self::$post[$key]))
52
+			if (isset(self::$post[$key]))
53 53
 				return self::$post[$key];
54 54
 			return false;
55 55
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 	{
21 21
 		if($key)
22 22
 		{
23
-			if(isset(self::$server[$key]))
24
-				return self::$server[$key];
23
+			if(isset(self::$server[$key])) {
24
+							return self::$server[$key];
25
+			}
25 26
 			return false;
26 27
 		}
27 28
 		return self::$server;
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
 	static function isAjax()
31 32
 	{
32
-		if(self::getServer(self::$AJAX_REQUEST))
33
-			return true;
33
+		if(self::getServer(self::$AJAX_REQUEST)) {
34
+					return true;
35
+		}
34 36
 		return false;
35 37
 	}
36 38
 
@@ -38,8 +40,9 @@  discard block
 block discarded – undo
38 40
 	{
39 41
 		if($key)
40 42
 		{
41
-			if(isset(self::$get[$key]))
42
-				return self::$get[$key];
43
+			if(isset(self::$get[$key])) {
44
+							return self::$get[$key];
45
+			}
43 46
 			return false;
44 47
 		}
45 48
 		return self::$get;
@@ -49,8 +52,9 @@  discard block
 block discarded – undo
49 52
 	{
50 53
 		if($key)
51 54
 		{
52
-			if(isset(self::$post[$key]))
53
-				return self::$post[$key];
55
+			if(isset(self::$post[$key])) {
56
+							return self::$post[$key];
57
+			}
54 58
 			return false;
55 59
 		}
56 60
 		return self::$post;
Please login to merge, or discard this patch.
utility/URLDecode.class.inc.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@  discard block
 block discarded – undo
38 38
 		self::$array['pieces'] = (array) $uri_array;
39 39
 	}
40 40
 
41
+	/**
42
+	 * @return string
43
+	 */
41 44
 	static function getSite()
42 45
 	{
43 46
 		return self::$array['site'];
@@ -66,6 +69,9 @@  discard block
 block discarded – undo
66 69
 		return substr($file, strrpos($file, '.') + 1);;
67 70
 	}
68 71
 
72
+	/**
73
+	 * @param integer $piece
74
+	 */
69 75
 	static function getPiece($piece = null)
70 76
 	{
71 77
 		if(!$piece)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	static private function form_url_array($host, $uri)
16 16
 	{
17 17
 		$uri = substr($uri, 1);
18
-		if(strpos($uri, '?'))
18
+		if (strpos($uri, '?'))
19 19
 			$uri = substr($uri, 0, strpos($uri, '?'));
20 20
 		$uri_array = explode('/', $uri);
21 21
 		
22
-		if(!Loader::isLive())
22
+		if (!Loader::isLive())
23 23
 			$host = substr($host, strpos($host, '.') + 1);
24 24
 		
25 25
 		self::$array['host'] = $host;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/';
34 34
 		self::$array['uri'] = '/' . implode('/', $uri_array);
35 35
 		
36
-		if(end($uri_array) == '')
36
+		if (end($uri_array) == '')
37 37
 			$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
38 38
 		self::$array['pieces'] = (array) $uri_array;
39 39
 	}
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 	static function getExtension()
62 62
 	{
63 63
 		$file = self::getPiece(-1);
64
-		if(substr($file, -1) == '/')
64
+		if (substr($file, -1) == '/')
65 65
 			return false;
66
-		return substr($file, strrpos($file, '.') + 1);;
66
+		return substr($file, strrpos($file, '.') + 1); ;
67 67
 	}
68 68
 
69 69
 	static function getPiece($piece = null)
70 70
 	{
71
-		if(!$piece)
71
+		if (!$piece)
72 72
 			return self::$array['pieces'];
73 73
 		
74
-		if($piece == -1)
74
+		if ($piece == -1)
75 75
 			return end(self::$array['pieces']);
76 76
 		
77 77
 		$piece = $piece - 1;
78
-		if(array_key_exists($piece, self::$array['pieces']))
78
+		if (array_key_exists($piece, self::$array['pieces']))
79 79
 			return self::$array['pieces'][$piece];
80 80
 		return;
81 81
 	}
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,12 +15,14 @@  discard block
 block discarded – undo
15 15
 	static private function form_url_array($host, $uri)
16 16
 	{
17 17
 		$uri = substr($uri, 1);
18
-		if(strpos($uri, '?'))
19
-			$uri = substr($uri, 0, strpos($uri, '?'));
18
+		if(strpos($uri, '?')) {
19
+					$uri = substr($uri, 0, strpos($uri, '?'));
20
+		}
20 21
 		$uri_array = explode('/', $uri);
21 22
 		
22
-		if(!Loader::isLive())
23
-			$host = substr($host, strpos($host, '.') + 1);
23
+		if(!Loader::isLive()) {
24
+					$host = substr($host, strpos($host, '.') + 1);
25
+		}
24 26
 		
25 27
 		self::$array['host'] = $host;
26 28
 		
@@ -33,8 +35,9 @@  discard block
 block discarded – undo
33 35
 		self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/';
34 36
 		self::$array['uri'] = '/' . implode('/', $uri_array);
35 37
 		
36
-		if(end($uri_array) == '')
37
-			$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
38
+		if(end($uri_array) == '') {
39
+					$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
40
+		}
38 41
 		self::$array['pieces'] = (array) $uri_array;
39 42
 	}
40 43
 
@@ -61,22 +64,26 @@  discard block
 block discarded – undo
61 64
 	static function getExtension()
62 65
 	{
63 66
 		$file = self::getPiece(-1);
64
-		if(substr($file, -1) == '/')
65
-			return false;
67
+		if(substr($file, -1) == '/') {
68
+					return false;
69
+		}
66 70
 		return substr($file, strrpos($file, '.') + 1);;
67 71
 	}
68 72
 
69 73
 	static function getPiece($piece = null)
70 74
 	{
71
-		if(!$piece)
72
-			return self::$array['pieces'];
75
+		if(!$piece) {
76
+					return self::$array['pieces'];
77
+		}
73 78
 		
74
-		if($piece == -1)
75
-			return end(self::$array['pieces']);
79
+		if($piece == -1) {
80
+					return end(self::$array['pieces']);
81
+		}
76 82
 		
77 83
 		$piece = $piece - 1;
78
-		if(array_key_exists($piece, self::$array['pieces']))
79
-			return self::$array['pieces'][$piece];
84
+		if(array_key_exists($piece, self::$array['pieces'])) {
85
+					return self::$array['pieces'][$piece];
86
+		}
80 87
 		return;
81 88
 	}
82 89
 
Please login to merge, or discard this patch.
utility/Validate.class.inc.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -72,6 +72,11 @@
 block discarded – undo
72 72
 		return $matches[0] == $string;
73 73
 	}
74 74
 
75
+	/**
76
+	 * @param string $type
77
+	 * @param string $key
78
+	 * @param string $validation
79
+	 */
75 80
 	public static function checkRequest($type, $key, $validation, $strict = false)
76 81
 	{
77 82
 		switch($type)
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@  discard block
 block discarded – undo
11 11
 
12 12
 	public static function isBoolean($value, $strict = false)
13 13
 	{
14
-		if($strict && ($value === true || $value === false))
14
+		if ($strict && ($value === true || $value === false))
15 15
 			return true;
16
-		if(!$strict && ((bool) $value === true || (bool) $value === false))
16
+		if (!$strict && ((bool) $value === true || (bool) $value === false))
17 17
 			return true;
18 18
 		return false;
19 19
 	}
20 20
 
21 21
 	public static function isDate($value)
22 22
 	{
23
-		if(strtotime($value) !== -1)
23
+		if (strtotime($value) !== -1)
24 24
 			return true;
25
-		if(date('y', $value) !== false)
25
+		if (date('y', $value) !== false)
26 26
 			return true;
27 27
 		return false;
28 28
 	}
29 29
 
30 30
 	public static function isInteger($value, $strict = false)
31 31
 	{
32
-		if($strict)
32
+		if ($strict)
33 33
 			return is_int($value);
34 34
 		return (int) $value == $value;
35 35
 	}
36 36
 
37 37
 	public static function isIP($value)
38 38
 	{
39
-		if(self::isInteger(ip2long($value)))
39
+		if (self::isInteger(ip2long($value)))
40 40
 			return true;
41 41
 		return false;
42 42
 	}
43 43
 
44 44
 	public static function isString($value, $strict = false)
45 45
 	{
46
-		if($strict)
46
+		if ($strict)
47 47
 			return is_string($value);
48 48
 		return (string) $value == $value;
49 49
 	}
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	private static function check_value($pattern, $string)
68 68
 	{
69 69
 		preg_match($pattern, $string, $matches);
70
-		if(empty($matches))
70
+		if (empty($matches))
71 71
 			return false;
72 72
 		return $matches[0] == $string;
73 73
 	}
74 74
 
75 75
 	public static function checkRequest($type, $key, $validation, $strict = false)
76 76
 	{
77
-		switch($type)
77
+		switch ($type)
78 78
 		{
79 79
 			case 'server':
80 80
 				$value = Request::getServer($key);
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 			break;
85 85
 		}
86 86
 		
87
-		if($value == false)
87
+		if ($value == false)
88 88
 			return false;
89 89
 		
90
-		switch($validation)
90
+		switch ($validation)
91 91
 		{
92 92
 			case 'boolean':
93 93
 				return self::isBoolean($value, $strict);
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,40 +11,47 @@  discard block
 block discarded – undo
11 11
 
12 12
 	public static function isBoolean($value, $strict = false)
13 13
 	{
14
-		if($strict && ($value === true || $value === false))
15
-			return true;
16
-		if(!$strict && ((bool) $value === true || (bool) $value === false))
17
-			return true;
14
+		if($strict && ($value === true || $value === false)) {
15
+					return true;
16
+		}
17
+		if(!$strict && ((bool) $value === true || (bool) $value === false)) {
18
+					return true;
19
+		}
18 20
 		return false;
19 21
 	}
20 22
 
21 23
 	public static function isDate($value)
22 24
 	{
23
-		if(strtotime($value) !== -1)
24
-			return true;
25
-		if(date('y', $value) !== false)
26
-			return true;
25
+		if(strtotime($value) !== -1) {
26
+					return true;
27
+		}
28
+		if(date('y', $value) !== false) {
29
+					return true;
30
+		}
27 31
 		return false;
28 32
 	}
29 33
 
30 34
 	public static function isInteger($value, $strict = false)
31 35
 	{
32
-		if($strict)
33
-			return is_int($value);
36
+		if($strict) {
37
+					return is_int($value);
38
+		}
34 39
 		return (int) $value == $value;
35 40
 	}
36 41
 
37 42
 	public static function isIP($value)
38 43
 	{
39
-		if(self::isInteger(ip2long($value)))
40
-			return true;
44
+		if(self::isInteger(ip2long($value))) {
45
+					return true;
46
+		}
41 47
 		return false;
42 48
 	}
43 49
 
44 50
 	public static function isString($value, $strict = false)
45 51
 	{
46
-		if($strict)
47
-			return is_string($value);
52
+		if($strict) {
53
+					return is_string($value);
54
+		}
48 55
 		return (string) $value == $value;
49 56
 	}
50 57
 
@@ -67,8 +74,9 @@  discard block
 block discarded – undo
67 74
 	private static function check_value($pattern, $string)
68 75
 	{
69 76
 		preg_match($pattern, $string, $matches);
70
-		if(empty($matches))
71
-			return false;
77
+		if(empty($matches)) {
78
+					return false;
79
+		}
72 80
 		return $matches[0] == $string;
73 81
 	}
74 82
 
@@ -84,8 +92,9 @@  discard block
 block discarded – undo
84 92
 			break;
85 93
 		}
86 94
 		
87
-		if($value == false)
88
-			return false;
95
+		if($value == false) {
96
+					return false;
97
+		}
89 98
 		
90 99
 		switch($validation)
91 100
 		{
Please login to merge, or discard this patch.
bootstrap.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $handle = @fopen($configuration_path, 'r');
9 9
 if ($handle === false) {
10
-    throw new RuntimeException("Could not load configuration");
10
+	throw new RuntimeException("Could not load configuration");
11 11
 }
12 12
 $configuration = fread($handle, filesize($configuration_path));
13 13
 fclose($handle);
@@ -15,34 +15,34 @@  discard block
 block discarded – undo
15 15
 $configuration = json_decode($configuration);
16 16
 $last_json_error = json_last_error();
17 17
 if ($last_json_error !== JSON_ERROR_NONE) {
18
-    throw new RuntimeException("Could not parse configuration - JSON error detected");
18
+	throw new RuntimeException("Could not parse configuration - JSON error detected");
19 19
 }
20 20
 
21 21
 // configure the db connections holder
22 22
 $db_connections = new Aura\Sql\ConnectionLocator();
23 23
 $db_connections->setDefault(function () use ($configuration) {
24
-    $connection = $configuration->database->slave;
25
-    return new Aura\Sql\ExtendedPdo(
26
-        "mysql:host={$connection->host}",
27
-        $connection->user,
28
-        $connection->password
29
-    );
24
+	$connection = $configuration->database->slave;
25
+	return new Aura\Sql\ExtendedPdo(
26
+		"mysql:host={$connection->host}",
27
+		$connection->user,
28
+		$connection->password
29
+	);
30 30
 });
31 31
 $db_connections->setWrite('master', function () use ($configuration) {
32
-    $connection = $configuration->database->master;
33
-    return new Aura\Sql\ExtendedPdo(
34
-        "mysql:host={$connection->host}",
35
-        $connection->user,
36
-        $connection->password
37
-    );
32
+	$connection = $configuration->database->master;
33
+	return new Aura\Sql\ExtendedPdo(
34
+		"mysql:host={$connection->host}",
35
+		$connection->user,
36
+		$connection->password
37
+	);
38 38
 });
39 39
 $db_connections->setRead('slave', function () use ($configuration) {
40
-    $connection = $configuration->database->slave;
41
-    return new Aura\Sql\ExtendedPdo(
42
-        "mysql:host={$connection->host}",
43
-        $connection->user,
44
-        $connection->password
45
-    );
40
+	$connection = $configuration->database->slave;
41
+	return new Aura\Sql\ExtendedPdo(
42
+		"mysql:host={$connection->host}",
43
+		$connection->user,
44
+		$connection->password
45
+	);
46 46
 });
47 47
 
48 48
 // setup the service locator
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 // configure the db connections holder
22 22
 $db_connections = new Aura\Sql\ConnectionLocator();
23
-$db_connections->setDefault(function () use ($configuration) {
23
+$db_connections->setDefault(function() use ($configuration) {
24 24
     $connection = $configuration->database->slave;
25 25
     return new Aura\Sql\ExtendedPdo(
26 26
         "mysql:host={$connection->host}",
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $connection->password
29 29
     );
30 30
 });
31
-$db_connections->setWrite('master', function () use ($configuration) {
31
+$db_connections->setWrite('master', function() use ($configuration) {
32 32
     $connection = $configuration->database->master;
33 33
     return new Aura\Sql\ExtendedPdo(
34 34
         "mysql:host={$connection->host}",
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $connection->password
37 37
     );
38 38
 });
39
-$db_connections->setRead('slave', function () use ($configuration) {
39
+$db_connections->setRead('slave', function() use ($configuration) {
40 40
     $connection = $configuration->database->slave;
41 41
     return new Aura\Sql\ExtendedPdo(
42 42
         "mysql:host={$connection->host}",
Please login to merge, or discard this patch.
collector/waterfall/WatercourseCollector.class.inc.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -153,9 +153,9 @@
 block discarded – undo
153 153
 		return self::run_query($query);
154 154
 	}
155 155
 
156
-    public static function getParentWatercourse($watercourse)
157
-    {
158
-    }
156
+	public static function getParentWatercourse($watercourse)
157
+	{
158
+	}
159 159
 
160 160
 	public static function getLogCountForWatercourse($watercourse)
161 161
 	{
Please login to merge, or discard this patch.
controller/AJAXController.class.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
 	protected function set_response($message, $type = 'internal')
30 30
 	{
31
-		switch($type)
31
+		switch ($type)
32 32
 		{
33 33
 			case 'internal' :
34 34
 				$this->response['internal'] = $message;
Please login to merge, or discard this patch.
controller/Error404Controller.class.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		Loader::load('collector', 'SiteCollector');
36 36
 		$site_result = SiteCollector::getSitesForMenu();
37 37
 		
38
-		foreach($site_result as $site)
38
+		foreach ($site_result as $site)
39 39
 		{
40 40
 			$site_array[] = array(
41 41
 				'url' => $site->url,
Please login to merge, or discard this patch.
controller/SitemapController.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
 	protected function addURL($loc, $lastmod = false, $changefreq = 'monthly', $priority = .5)
24 24
 	{
25
-		if(!$lastmod)
25
+		if (!$lastmod)
26 26
 			$lastmod = $this->default_lastmod;
27 27
 		
28 28
 		$url = $this->xml->addChild('url');
Please login to merge, or discard this 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 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 
15 15
 	protected function set_data()
16 16
 	{
17
-		if(!Validate::checkRequest('post', 'name', 'name'))
17
+		if (!Validate::checkRequest('post', 'name', 'name'))
18 18
 			return $this->fail_response('You must include a valid name.');
19
-		if(!Validate::checkRequest('post', 'email', 'email'))
19
+		if (!Validate::checkRequest('post', 'email', 'email'))
20 20
 			return $this->fail_response('You must include a valid email.');
21
-		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
21
+		if (Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
22 22
 			return $this->fail_response('Please include a valid website.');
23
-		if(!Validate::checkRequest('post', 'comment', 'string'))
23
+		if (!Validate::checkRequest('post', 'comment', 'string'))
24 24
 			return $this->fail_response('You must enter a comment.');
25
-		if(!Validate::checkRequest('post', 'save', 'boolean'))
25
+		if (!Validate::checkRequest('post', 'save', 'boolean'))
26 26
 			return $this->fail_response('You entered an invalid save request.');
27
-		if(!Validate::checkRequest('post', 'notify', 'boolean'))
27
+		if (!Validate::checkRequest('post', 'notify', 'boolean'))
28 28
 			return $this->fail_response('You entered an invalid notify request.');
29
-		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
29
+		if (Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
30 30
 			return $this->fail_response('You entered an invalid reply value.');
31 31
 		
32 32
 		$referer_url = Request::getServer('HTTP_REFERER');
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 		$url = array_pop($url);
36 36
 		$post = PostCollector::getPostByURI($url);
37 37
 		
38
-		if($post === null)
38
+		if ($post === null)
39 39
 			return $this->fail_response('There seems to be a problem with this page.', 'error');
40 40
 		
41 41
 		$commentpage_result = CommentCollector::getCommentPageByURL($post->path, 2);
42
-		if($commentpage_result === null)
42
+		if ($commentpage_result === null)
43 43
 		{
44 44
 			$query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site_id`, `url`) VALUES ('%d', '%s')";
45 45
 			
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$save = (Request::getPost('save') == 'true') ? 1 : 0;
57 57
 		
58 58
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
59
-		if($commenter_result === null)
59
+		if ($commenter_result === null)
60 60
 		{
61 61
 			$query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`,`save`) VALUES ('%s','%s','%s','%s')";
62 62
 			
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 		else
72 72
 		{
73
-			if($commenter_result->save !== $save)
73
+			if ($commenter_result->save !== $save)
74 74
 			{
75 75
 				$query = "UPDATE `jpemeric_comment`.`commenter` SET `save` = '%s' WHERE `id` = '%d'";
76 76
 				
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		}
82 82
 		
83 83
 		$comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
84
-		if($comment_result === null)
84
+		if ($comment_result === null)
85 85
 		{
86 86
 			$query = "INSERT INTO `jpemeric_comment`.`comment` (`body`) VALUES ('%s')";
87 87
 			
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 		
113 113
 		$notification_result = CommentCollector::getNotificationForPage($commentpage_id);
114 114
 		
115
-		foreach($notification_result as $notification_row)
115
+		foreach ($notification_result as $notification_row)
116 116
 		{
117
-			if($notification_row->email == $email)
117
+			if ($notification_row->email == $email)
118 118
 				continue;
119 119
 			
120 120
 			$email_recipient_array[$notification_row->email] = array(
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 		
125 125
 		$message = "Hello!\nThere has been a new post on the post '{$post->title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to {$config->admin_email} if you do would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$referer_url}#comments to see and reply to all the comments on this post.\nThank you!";
126
-		foreach($email_recipient_array as $email_recipient)
126
+		foreach ($email_recipient_array as $email_recipient)
127 127
 		{
128 128
 			$mail = new Mail();
129 129
 			$mail->setToAddress($email_recipient['email'], $email_recipient['name']);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			$mail->send();
133 133
 		}
134 134
 		
135
-		if(Request::getPost('save') == true)
135
+		if (Request::getPost('save') == true)
136 136
 		{
137 137
 			/*
138 138
 			$cookie = new Cookie('jpe_commenter');
Please login to merge, or discard this patch.
Braces   +32 added lines, -24 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();
60
+		} else {
61
+					$commentpage_id = $commentpage_result->id;
52 62
 		}
53
-		else
54
-			$commentpage_id = $commentpage_result->id;
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();
100
+		} else {
101
+					$comment_id = $comment_result->id;
93 102
 		}
94
-		else
95
-			$comment_id = $comment_result->id;
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.