Completed
Push — master ( b87f8b...ec3686 )
by Jacob
08:20 queued 01:59
created
router/WaterfallRouter.class.inc.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 Loader::load('collector', array(
4
-    'waterfall/LogCollector',
5
-    'waterfall/WaterfallCollector'));
4
+	'waterfall/LogCollector',
5
+	'waterfall/WaterfallCollector'));
6 6
 Loader::load('router', 'Router');
7 7
 
8 8
 class WaterfallRouter extends Router
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 			(object) array(
27 27
 				'pattern' => '@^/falls/results(/?)$@',
28 28
 				'replace' => '/falls/'),
29
-            (object) array(
30
-                'pattern' => '@^/log(/?)$@',
31
-                'replace' => '/journal/'),
32
-            (object) array(
33
-                'pattern' => '@^/log/(\d+)(/?)$@',
34
-                'replace' => '/journal/$1'),
35
-            (object) array(
36
-                'pattern' => '@^/map/([^/]+)(/?)$@',
37
-                'replace' => '/map/'),
29
+			(object) array(
30
+				'pattern' => '@^/log(/?)$@',
31
+				'replace' => '/journal/'),
32
+			(object) array(
33
+				'pattern' => '@^/log/(\d+)(/?)$@',
34
+				'replace' => '/journal/$1'),
35
+			(object) array(
36
+				'pattern' => '@^/map/([^/]+)(/?)$@',
37
+				'replace' => '/map/'),
38 38
 			(object) array(
39 39
 				'pattern' => '@^/about/([a-z]*)(/?)$@',
40 40
 				'replace' => '/about/'),
@@ -73,57 +73,57 @@  discard block
 block discarded – undo
73 73
 
74 74
 	protected function check_for_special_redirect($uri)
75 75
 	{
76
-        if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) {
77
-            $alias = $matches[1];
78
-            $alias = str_replace("'", '', $alias);
79
-            $alias .= '-falls';
80
-            $result = WaterfallCollector::getByOldAlias($alias);
81
-            if ($result !== null) {
82
-                return "/{$result->watercourse_alias}/{$result->alias}/";
83
-            } else {
84
-                Loader::loadNew('controller', '/Error404Controller')->activate();
85
-            }
86
-        }
76
+		if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) {
77
+			$alias = $matches[1];
78
+			$alias = str_replace("'", '', $alias);
79
+			$alias .= '-falls';
80
+			$result = WaterfallCollector::getByOldAlias($alias);
81
+			if ($result !== null) {
82
+				return "/{$result->watercourse_alias}/{$result->alias}/";
83
+			} else {
84
+				Loader::loadNew('controller', '/Error404Controller')->activate();
85
+			}
86
+		}
87 87
         
88
-        if (preg_match('@^/photos/([a-z\'-]+)-([^/]+)(/?)$@', $uri, $matches)) {
89
-            $alias = $matches[1];
90
-            $alias = explode('-', $alias);
91
-            array_pop($alias);
92
-            $alias = implode('-', $alias);
93
-            $alias = str_replace("'", '', $alias);
94
-            $alias .= '-falls';
95
-            $result = WaterfallCollector::getByOldAlias($alias);
96
-            if ($result !== null) {
97
-                return "/{$result->watercourse_alias}/{$result->alias}/";
98
-            } else {
99
-                Loader::loadNew('controller', '/Error404Controller')->activate();
100
-            }
101
-        }
88
+		if (preg_match('@^/photos/([a-z\'-]+)-([^/]+)(/?)$@', $uri, $matches)) {
89
+			$alias = $matches[1];
90
+			$alias = explode('-', $alias);
91
+			array_pop($alias);
92
+			$alias = implode('-', $alias);
93
+			$alias = str_replace("'", '', $alias);
94
+			$alias .= '-falls';
95
+			$result = WaterfallCollector::getByOldAlias($alias);
96
+			if ($result !== null) {
97
+				return "/{$result->watercourse_alias}/{$result->alias}/";
98
+			} else {
99
+				Loader::loadNew('controller', '/Error404Controller')->activate();
100
+			}
101
+		}
102 102
         
103
-        if (preg_match('@/log/([a-z]+-\d{2}-\d{4})(/?)$@', $uri, $matches)) {
104
-            $date = $matches[1];
105
-            $date = explode('-', $date);
106
-            $date = mktime(0, 0, 0, date('n', strtotime($date[0])), $date[1], $date[2]);
107
-            $date = date('Y-m-d', $date);
108
-            $result = LogCollector::getByDate($date);
109
-            if ($result !== null) {
110
-                return "/journal/{$result->alias}/";
111
-            } else {
112
-                Loader::loadNew('controller', '/Error404Controller')->activate();
113
-            }
114
-        }
103
+		if (preg_match('@/log/([a-z]+-\d{2}-\d{4})(/?)$@', $uri, $matches)) {
104
+			$date = $matches[1];
105
+			$date = explode('-', $date);
106
+			$date = mktime(0, 0, 0, date('n', strtotime($date[0])), $date[1], $date[2]);
107
+			$date = date('Y-m-d', $date);
108
+			$result = LogCollector::getByDate($date);
109
+			if ($result !== null) {
110
+				return "/journal/{$result->alias}/";
111
+			} else {
112
+				Loader::loadNew('controller', '/Error404Controller')->activate();
113
+			}
114
+		}
115 115
         
116
-        if (preg_match('@/map/([a-z\'-]+)(/?)$@', $uri, $matches)) {
117
-            $alias = $matches[1];
118
-            $alias = str_replace("'", '', $alias);
119
-            $alias .= '-falls';
120
-            $result = WaterfallCollector::getByOldAlias($alias);
121
-            if ($result !== null) {
122
-                return "/map/#{$result->watercourse_alias}/{$result->alias}";
123
-            } else {
124
-                Loader::loadNew('controller', '/Error404Controller')->activate();
125
-            }
126
-        }
116
+		if (preg_match('@/map/([a-z\'-]+)(/?)$@', $uri, $matches)) {
117
+			$alias = $matches[1];
118
+			$alias = str_replace("'", '', $alias);
119
+			$alias .= '-falls';
120
+			$result = WaterfallCollector::getByOldAlias($alias);
121
+			if ($result !== null) {
122
+				return "/map/#{$result->watercourse_alias}/{$result->alias}";
123
+			} else {
124
+				Loader::loadNew('controller', '/Error404Controller')->activate();
125
+			}
126
+		}
127 127
         
128 128
 		return $uri;
129 129
 	}
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			(object) array(
165 165
 				'match' => '/map/',
166 166
 				'controller' => 'MapController'),
167
-            (object) array(
168
-                'match' => '/map/#[a-z-/]+',
169
-                'controller' => 'MapController'),
167
+			(object) array(
168
+				'match' => '/map/#[a-z-/]+',
169
+				'controller' => 'MapController'),
170 170
 			(object) array(
171 171
 				'match' => '/journal/',
172 172
 				'controller' => 'LogListController'),
Please login to merge, or discard this patch.
router/mymap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
 	)
21 21
 );
22 22
 
23
-Router::route($redirect,$direct);
23
+Router::route($redirect, $direct);
24 24
 
25 25
 ?>
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
utility/CronController.class.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 		{
27 27
 			//if(!$this->time_to_run($frequency))
28 28
 			//	continue;
29
-            if ($cron != 'TwitterCron') continue;
29
+			if ($cron != 'TwitterCron') continue;
30 30
 			
31 31
 			Loader::load('utility', "cron/{$cron}");
32 32
 			$reflection = new ReflectionClass($cron);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function activate()
24 24
 	{
25
-		foreach(self::$CRON_ARRAY as $cron => $frequency)
25
+		foreach (self::$CRON_ARRAY as $cron => $frequency)
26 26
 		{
27 27
 			//if(!$this->time_to_run($frequency))
28 28
 			//	continue;
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 		$operator = explode(' ', $frequency);
50 50
 		list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator;
51 51
 		
52
-		foreach($time as $key => $value)
52
+		foreach ($time as $key => $value)
53 53
 		{
54
-			if($value == '*')
54
+			if ($value == '*')
55 55
 				continue;
56
-			if(stristr($value, '/'))
56
+			if (stristr($value, '/'))
57 57
 			{
58 58
 				$value = substr($value, 2);
59
-				if($cur[$key] % $value == 0)
59
+				if ($cur[$key] % $value == 0)
60 60
 					continue;
61 61
 				else
62 62
 					return;
63 63
 			}
64
-			if($cur[$key] == $value)
64
+			if ($cur[$key] == $value)
65 65
 				continue;
66 66
 			return;
67 67
 		}
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		{
27 27
 			//if(!$this->time_to_run($frequency))
28 28
 			//	continue;
29
-            if ($cron != 'TwitterCron') continue;
29
+            if ($cron != 'TwitterCron') {
30
+            	continue;
31
+            }
30 32
 			
31 33
 			Loader::load('utility', "cron/{$cron}");
32 34
 			$reflection = new ReflectionClass($cron);
@@ -51,18 +53,21 @@  discard block
 block discarded – undo
51 53
 		
52 54
 		foreach($time as $key => $value)
53 55
 		{
54
-			if($value == '*')
55
-				continue;
56
+			if($value == '*') {
57
+							continue;
58
+			}
56 59
 			if(stristr($value, '/'))
57 60
 			{
58 61
 				$value = substr($value, 2);
59
-				if($cur[$key] % $value == 0)
60
-					continue;
61
-				else
62
-					return;
62
+				if($cur[$key] % $value == 0) {
63
+									continue;
64
+				} else {
65
+									return;
66
+				}
67
+			}
68
+			if($cur[$key] == $value) {
69
+							continue;
63 70
 			}
64
-			if($cur[$key] == $value)
65
-				continue;
66 71
 			return;
67 72
 		}
68 73
 		return true;
Please login to merge, or discard this patch.
utility/Database.class.inc.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 
17 17
 	private function __construct($write_params, $read_params)
18 18
 	{
19
-        $this->write_connection = $this->connect(
20
-            $write_params->host,
21
-            $write_params->user,
22
-            $write_params->password
23
-        );
24
-
25
-        $this->read_connection = $this->connect(
26
-            $read_params->host,
27
-            $read_params->user,
28
-            $read_params->password
29
-        );
19
+		$this->write_connection = $this->connect(
20
+			$write_params->host,
21
+			$write_params->user,
22
+			$write_params->password
23
+		);
24
+
25
+		$this->read_connection = $this->connect(
26
+			$read_params->host,
27
+			$read_params->user,
28
+			$read_params->password
29
+		);
30 30
 
31 31
 		return $this;
32 32
 	}
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	public static function instance()
46 46
 	{
47 47
 		if(!isset(self::$instance)) {
48
-            global $config;
49
-            self::$instance = new Database(
50
-                $config->database->master,
51
-                $config->database->slave
52
-            );
53
-        }
48
+			global $config;
49
+			self::$instance = new Database(
50
+				$config->database->master,
51
+				$config->database->slave
52
+			);
53
+		}
54 54
 
55 55
 		return self::$instance;
56 56
 	}
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$mysqli = new mysqli($host, $username, $password);
37 37
 		
38 38
 		$has_connection_error = $mysqli->connect_error;
39
-		if(isset($has_connection_error))
39
+		if (isset($has_connection_error))
40 40
 			$this->has_connection_error = true;
41 41
 		
42 42
 		return $mysqli;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public static function instance()
46 46
 	{
47
-		if(!isset(self::$instance)) {
47
+		if (!isset(self::$instance)) {
48 48
             global $config;
49 49
             self::$instance = new Database(
50 50
                 $config->database->master,
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	public static function select($query)
64 64
 	{
65 65
 		$start = microtime(true);
66
-		if($result = self::instance()->read_connection->query($query))
66
+		if ($result = self::instance()->read_connection->query($query))
67 67
 		{
68 68
 			self::instance()->log_query($query, $start);
69 69
 			$array = array();
70
-			while($row = $result->fetch_object())
70
+			while ($row = $result->fetch_object())
71 71
 				$array[] = $row;
72 72
 			$result->close();
73 73
 			return $array;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public static function selectRow($query)
80 80
 	{
81 81
 		$result = self::select($query);
82
-		if(is_array($result))
82
+		if (is_array($result))
83 83
 			return array_pop($result);
84 84
 		return false;
85 85
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	public static function execute($query)
88 88
 	{
89 89
 		$start = microtime(true);
90
-		if(self::instance()->write_connection->query($query))
90
+		if (self::instance()->write_connection->query($query))
91 91
 		{
92 92
 			self::instance()->log_query($query, $start);
93 93
 			return true;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	public static function lastInsertID()
100 100
 	{
101 101
 		$id = self::instance()->write_connection->insert_id;
102
-		if($id == 0)
102
+		if ($id == 0)
103 103
 			return false;
104 104
 		return $id;
105 105
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	private function gather_query_data()
120 120
 	{
121 121
 		$query_data = array();
122
-		foreach($this->query_log as $query)
122
+		foreach ($this->query_log as $query)
123 123
 		{
124 124
 			$query = self::explain($query);
125 125
 			$query_data[] = $query;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	{
132 132
 		$sql = 'EXPLAIN ' . $query['sql'];
133 133
 		
134
-		if($result = self::instance()->read_connection->query($sql))
134
+		if ($result = self::instance()->read_connection->query($sql))
135 135
 		{
136 136
 			$row = $result->fetch_assoc();
137 137
 			$query['explain'] = $row;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 		$mysqli = new mysqli($host, $username, $password);
37 37
 		
38 38
 		$has_connection_error = $mysqli->connect_error;
39
-		if(isset($has_connection_error))
40
-			$this->has_connection_error = true;
39
+		if(isset($has_connection_error)) {
40
+					$this->has_connection_error = true;
41
+		}
41 42
 		
42 43
 		return $mysqli;
43 44
 	}
@@ -67,8 +68,9 @@  discard block
 block discarded – undo
67 68
 		{
68 69
 			self::instance()->log_query($query, $start);
69 70
 			$array = array();
70
-			while($row = $result->fetch_object())
71
-				$array[] = $row;
71
+			while($row = $result->fetch_object()) {
72
+							$array[] = $row;
73
+			}
72 74
 			$result->close();
73 75
 			return $array;
74 76
 		}
@@ -79,8 +81,9 @@  discard block
 block discarded – undo
79 81
 	public static function selectRow($query)
80 82
 	{
81 83
 		$result = self::select($query);
82
-		if(is_array($result))
83
-			return array_pop($result);
84
+		if(is_array($result)) {
85
+					return array_pop($result);
86
+		}
84 87
 		return false;
85 88
 	}
86 89
 
@@ -99,8 +102,9 @@  discard block
 block discarded – undo
99 102
 	public static function lastInsertID()
100 103
 	{
101 104
 		$id = self::instance()->write_connection->insert_id;
102
-		if($id == 0)
103
-			return false;
105
+		if($id == 0) {
106
+					return false;
107
+		}
104 108
 		return $id;
105 109
 	}
106 110
 
Please login to merge, or discard this patch.
utility/Environment.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 	public function __construct($user_agent = null)
11 11
 	{
12
-		if(!isset($user_agent))
12
+		if (!isset($user_agent))
13 13
 			$user_agent = Request::getServer('HTTP_USER_AGENT');
14 14
 		$this->user_agent = $user_agent;
15 15
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@
 block discarded – undo
9 9
 
10 10
 	public function __construct($user_agent = null)
11 11
 	{
12
-		if(!isset($user_agent))
13
-			$user_agent = Request::getServer('HTTP_USER_AGENT');
12
+		if(!isset($user_agent)) {
13
+					$user_agent = Request::getServer('HTTP_USER_AGENT');
14
+		}
14 15
 		$this->user_agent = $user_agent;
15 16
 	}
16 17
 
Please login to merge, or discard this patch.
utility/ImageOld.class.inc.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function setSize($size)
54 54
 	{
55
-		if($this->get_version() > 1)
55
+		if ($this->get_version() > 1)
56 56
 			$position = strrpos($this->file, '-v');
57 57
 		else
58 58
 			$position = strrpos($this->file, '.');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 	public function getDimensions()
64 64
 	{
65
-		if(!$this->isValid())
65
+		if (!$this->isValid())
66 66
 			return false;
67 67
 		$imageinfo = getimagesize($this->getInternalPath());
68 68
 		return array($imageinfo[0], $imageinfo[1]);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 	private function get_image($image)
87 87
 	{
88
-		if(preg_match(self::$VERSION_PREG_MATCH, $image))
88
+		if (preg_match(self::$VERSION_PREG_MATCH, $image))
89 89
 			return preg_replace(self::$VERSION_PREG_MATCH, '', $image);
90 90
 		else
91 91
 			return $image;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	private function get_file($image)
101 101
 	{
102
-		if($this->get_version() > 1)
102
+		if ($this->get_version() > 1)
103 103
 		{
104 104
 			$position = strrpos($image, '.');
105 105
 			return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position);
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	private $version;
112 112
 	private function get_version()
113 113
 	{
114
-		if(!$this->version)
114
+		if (!$this->version)
115 115
 		{
116
-			$path = Loader::getRoot() .'/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*';
116
+			$path = Loader::getRoot() . '/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*';
117 117
 			$files = glob($path);
118
-			if(count($files) > 0)
118
+			if (count($files) > 0)
119 119
 			{
120 120
 				preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches);
121
-				if(count($matches))
121
+				if (count($matches))
122 122
 					$this->version = $matches[1];
123 123
 				else
124 124
 					$this->version = 1;
Please login to merge, or discard this patch.
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -52,18 +52,20 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function setSize($size)
54 54
 	{
55
-		if($this->get_version() > 1)
56
-			$position = strrpos($this->file, '-v');
57
-		else
58
-			$position = strrpos($this->file, '.');
55
+		if($this->get_version() > 1) {
56
+					$position = strrpos($this->file, '-v');
57
+		} else {
58
+					$position = strrpos($this->file, '.');
59
+		}
59 60
 		
60 61
 		$this->file = substr($this->file, 0, $position) . '-s' . $size . substr($this->file, $position);
61 62
 	}
62 63
 
63 64
 	public function getDimensions()
64 65
 	{
65
-		if(!$this->isValid())
66
-			return false;
66
+		if(!$this->isValid()) {
67
+					return false;
68
+		}
67 69
 		$imageinfo = getimagesize($this->getInternalPath());
68 70
 		return array($imageinfo[0], $imageinfo[1]);
69 71
 	}
@@ -85,10 +87,11 @@  discard block
 block discarded – undo
85 87
 
86 88
 	private function get_image($image)
87 89
 	{
88
-		if(preg_match(self::$VERSION_PREG_MATCH, $image))
89
-			return preg_replace(self::$VERSION_PREG_MATCH, '', $image);
90
-		else
91
-			return $image;
90
+		if(preg_match(self::$VERSION_PREG_MATCH, $image)) {
91
+					return preg_replace(self::$VERSION_PREG_MATCH, '', $image);
92
+		} else {
93
+					return $image;
94
+		}
92 95
 	}
93 96
 
94 97
 	private function get_image_meta($image)
@@ -103,9 +106,9 @@  discard block
 block discarded – undo
103 106
 		{
104 107
 			$position = strrpos($image, '.');
105 108
 			return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position);
109
+		} else {
110
+					return $image;
106 111
 		}
107
-		else
108
-			return $image;
109 112
 	}
110 113
 
111 114
 	private $version;
@@ -118,10 +121,11 @@  discard block
 block discarded – undo
118 121
 			if(count($files) > 0)
119 122
 			{
120 123
 				preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches);
121
-				if(count($matches))
122
-					$this->version = $matches[1];
123
-				else
124
-					$this->version = 1;
124
+				if(count($matches)) {
125
+									$this->version = $matches[1];
126
+				} else {
127
+									$this->version = 1;
128
+				}
125 129
 			}
126 130
 		}
127 131
 		return $this->version;
Please login to merge, or discard this patch.
utility/Search.class.inc.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
 	public function perform()
40 40
 	{
41 41
 		$weighted_array = array();
42
-		foreach($this->result as $row)
42
+		foreach ($this->result as $row)
43 43
 		{
44 44
 			$weight = $this->get_search_weight($row);
45
-			if($weight > 0)
45
+			if ($weight > 0)
46 46
 				$weighted_array[$row->id] = $weight;
47 47
 		}
48 48
 		arsort($weighted_array);
49 49
 		
50 50
 		$final_array = array();
51
-		foreach($weighted_array as $id => $weight)
51
+		foreach ($weighted_array as $id => $weight)
52 52
 		{
53
-			foreach($this->result as $row)
53
+			foreach ($this->result as $row)
54 54
 			{
55
-				if($row->id == $id)
55
+				if ($row->id == $id)
56 56
 					$final_array[] = $row;
57 57
 			}
58 58
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	private function get_search_weight($row)
63 63
 	{
64 64
 		$weight = 0;
65
-		foreach($this->weight as $weight_array)
65
+		foreach ($this->weight as $weight_array)
66 66
 		{
67 67
 			$text = $row->{$weight_array['field']};
68 68
 			$weight += $weight_array['weight'] * substr_count(strtolower($text), strtolower($this->query));
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@  discard block
 block discarded – undo
42 42
 		foreach($this->result as $row)
43 43
 		{
44 44
 			$weight = $this->get_search_weight($row);
45
-			if($weight > 0)
46
-				$weighted_array[$row->id] = $weight;
45
+			if($weight > 0) {
46
+							$weighted_array[$row->id] = $weight;
47
+			}
47 48
 		}
48 49
 		arsort($weighted_array);
49 50
 		
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
 		{
53 54
 			foreach($this->result as $row)
54 55
 			{
55
-				if($row->id == $id)
56
-					$final_array[] = $row;
56
+				if($row->id == $id) {
57
+									$final_array[] = $row;
58
+				}
57 59
 			}
58 60
 		}
59 61
 		return $final_array;
Please login to merge, or discard this patch.
utility/Visitor.class.inc.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public static function instance()
28 28
 	{
29
-		if(!isset(self::$instance))
29
+		if (!isset(self::$instance))
30 30
 			self::$instance = new Visitor();
31 31
 		return self::$instance;
32 32
 	}
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	public static function getBrowser()
36 36
 	{
37 37
 		Loader::load('utility', 'environment/BrowserEnvironment');
38
-		if(!isset(self::instance()->browser))
38
+		if (!isset(self::instance()->browser))
39 39
 			self::instance()->browser = new BrowserEnvironment();
40 40
 		return self::instance()->browser;
41 41
 	}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	public static function getPlatform()
45 45
 	{
46 46
 		Loader::load('utility', 'environment/PlatformEnvironment');
47
-		if(!isset(self::instance()->platform))
47
+		if (!isset(self::instance()->platform))
48 48
 			self::instance()->platform = new PlatformEnvironment();
49 49
 		return self::instance()->platform;
50 50
 	}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	public static function getIP()
54 54
 	{
55 55
 		Loader::load('utility', 'Request');
56
-		if(!isset(self::instance()->ip_address))
56
+		if (!isset(self::instance()->ip_address))
57 57
 			self::instance()->ip_address = Request::getServer('REMOTE_ADDR');
58 58
 		return self::instance()->ip_address;
59 59
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		Loader::loadInstance('utility', 'Database');
80 80
 		
81 81
 		$query = $this->get_tracking_query();
82
-		if(Database::execute($query) == true)
82
+		if (Database::execute($query) == true)
83 83
 		{
84 84
 			$this->raw_visit_log_id = Database::lastInsertID();
85 85
 			return true;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		
95 95
 		$columns = '`';
96 96
 		$values = "'";
97
-		foreach(self::$tracking_field_array as $field_column => $server_array_key)
97
+		foreach (self::$tracking_field_array as $field_column => $server_array_key)
98 98
 		{
99 99
 			$value = Request::getServer($server_array_key);
100 100
 			$value = Database::escape($value);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			$values .= "{$value}','";
104 104
 		}
105 105
 		
106
-		if(Request::hasPost())
106
+		if (Request::hasPost())
107 107
 		{
108 108
 			$value = Request::getPost();
109 109
 			$value = serialize($value);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 	private function track_response_error($code)
123 123
 	{
124
-		if(isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0)
124
+		if (isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0)
125 125
 		{
126 126
 			$query = "UPDATE `jpemeric_stat`.`raw_visit_log` SET `code` = '{$code}' WHERE `id` = '{$this->raw_visit_log_id}' LIMIT 1";
127 127
 			return Database::execute($query);
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public static function instance()
28 28
 	{
29
-		if(!isset(self::$instance))
30
-			self::$instance = new Visitor();
29
+		if(!isset(self::$instance)) {
30
+					self::$instance = new Visitor();
31
+		}
31 32
 		return self::$instance;
32 33
 	}
33 34
 
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 	public static function getBrowser()
36 37
 	{
37 38
 		Loader::load('utility', 'environment/BrowserEnvironment');
38
-		if(!isset(self::instance()->browser))
39
-			self::instance()->browser = new BrowserEnvironment();
39
+		if(!isset(self::instance()->browser)) {
40
+					self::instance()->browser = new BrowserEnvironment();
41
+		}
40 42
 		return self::instance()->browser;
41 43
 	}
42 44
 
@@ -44,8 +46,9 @@  discard block
 block discarded – undo
44 46
 	public static function getPlatform()
45 47
 	{
46 48
 		Loader::load('utility', 'environment/PlatformEnvironment');
47
-		if(!isset(self::instance()->platform))
48
-			self::instance()->platform = new PlatformEnvironment();
49
+		if(!isset(self::instance()->platform)) {
50
+					self::instance()->platform = new PlatformEnvironment();
51
+		}
49 52
 		return self::instance()->platform;
50 53
 	}
51 54
 
@@ -53,8 +56,9 @@  discard block
 block discarded – undo
53 56
 	public static function getIP()
54 57
 	{
55 58
 		Loader::load('utility', 'Request');
56
-		if(!isset(self::instance()->ip_address))
57
-			self::instance()->ip_address = Request::getServer('REMOTE_ADDR');
59
+		if(!isset(self::instance()->ip_address)) {
60
+					self::instance()->ip_address = Request::getServer('REMOTE_ADDR');
61
+		}
58 62
 		return self::instance()->ip_address;
59 63
 	}
60 64
 
Please login to merge, or discard this patch.
utility/content/AcceptableContent.class.inc.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 	protected function execute()
10 10
 	{
11 11
 		$is_acceptable = true;
12
-		foreach($this->getUnacceptableWords() as $unacceptableWord)
12
+		foreach ($this->getUnacceptableWords() as $unacceptableWord)
13 13
 		{
14
-			if(stristr($unacceptableWord->word, $this->content))
14
+			if (stristr($unacceptableWord->word, $this->content))
15 15
 				$is_acceptable = false;
16 16
 		}
17 17
 		return $is_acceptable;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	private $unacceptableWords;
21 21
 	private function getUnacceptableWords()
22 22
 	{
23
-		if(!$this->unacceptableWords)
23
+		if (!$this->unacceptableWords)
24 24
 			$this->unacceptableWords = UnacceptableWordCollector::getWords();
25 25
 		return $this->unacceptableWords;
26 26
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
 		$is_acceptable = true;
12 12
 		foreach($this->getUnacceptableWords() as $unacceptableWord)
13 13
 		{
14
-			if(stristr($unacceptableWord->word, $this->content))
15
-				$is_acceptable = false;
14
+			if(stristr($unacceptableWord->word, $this->content)) {
15
+							$is_acceptable = false;
16
+			}
16 17
 		}
17 18
 		return $is_acceptable;
18 19
 	}
@@ -20,8 +21,9 @@  discard block
 block discarded – undo
20 21
 	private $unacceptableWords;
21 22
 	private function getUnacceptableWords()
22 23
 	{
23
-		if(!$this->unacceptableWords)
24
-			$this->unacceptableWords = UnacceptableWordCollector::getWords();
24
+		if(!$this->unacceptableWords) {
25
+					$this->unacceptableWords = UnacceptableWordCollector::getWords();
26
+		}
25 27
 		return $this->unacceptableWords;
26 28
 	}
27 29
 
Please login to merge, or discard this patch.