Completed
Push — master ( 2684cd...5325e1 )
by Jacob
08:52
created
utility/Header.class.inc.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 			'Cache-Control: no-cache',
11 11
 			'Content-Language: en',
12 12
 			'Content-Type: application/json',
13
-			'Expires: ' . self::get_date(time() - 1),
14
-			'Last-Modified: ' . self::get_date(),
13
+			'Expires: '.self::get_date(time() - 1),
14
+			'Last-Modified: '.self::get_date(),
15 15
 			'X-Powered-By: jacobemerick.com');
16 16
 		self::send($array);
17 17
 	}
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 			'Cache-Control: no-cache',
24 24
 			'Content-Language: en',
25 25
 			'Content-Type: text/html',
26
-			'Expires: ' . self::get_date(time() - 1),
27
-			'Last-Modified: ' . self::get_date(),
26
+			'Expires: '.self::get_date(time() - 1),
27
+			'Last-Modified: '.self::get_date(),
28 28
 			'X-Powered-By: jacobemerick.com');
29 29
 		self::send($array);
30 30
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 			'Cache-Control: no-cache',
43 43
 			'Content-Language: en',
44 44
 			'Content-Type: text/html',
45
-			'Expires: ' . self::get_date(time() - 1),
46
-			'Last-Modified: ' . self::get_date(),
45
+			'Expires: '.self::get_date(time() - 1),
46
+			'Last-Modified: '.self::get_date(),
47 47
 			'X-Powered-By: jacobemerick.com');
48 48
 		self::send($array);
49 49
 	}
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 			'Cache-Control: no-cache',
56 56
 			'Content-Language: en',
57 57
 			'Content-Type: text/html',
58
-			'Expires: ' . self::get_date(time() - 1),
59
-			'Last-Modified: ' . self::get_date(),
58
+			'Expires: '.self::get_date(time() - 1),
59
+			'Last-Modified: '.self::get_date(),
60 60
 			'X-Powered-By: jacobemerick.com');
61 61
 		self::send($array);
62 62
 	}
63 63
 
64 64
 	private static function send($array, $gzip = true)
65 65
 	{
66
-		if($gzip)
66
+		if ($gzip)
67 67
 			self::start_gzipping();
68 68
 		
69
-		foreach($array as $row)
69
+		foreach ($array as $row)
70 70
 		{
71 71
 			header($row, TRUE);
72 72
 		}
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
 	private static function get_date($timestamp = false)
76 76
 	{
77
-		if($timestamp == 0)
77
+		if ($timestamp == 0)
78 78
 			$timestamp = time();
79 79
 		return gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
80 80
 	}
81 81
 
82 82
 	private static function start_gzipping()
83 83
 	{
84
-		if(!ob_start('ob_gzhandler'))
84
+		if (!ob_start('ob_gzhandler'))
85 85
             ob_start();
86 86
 	}
87 87
 
Please login to merge, or discard this patch.
utility/content/ImperialUnitContent.class.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
         
27 27
         switch ($type) {
28 28
             case 'full miles' :
29
-                $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles';
29
+                $this->content = number_format(round($number / (12 * 3 * 1760))).' miles';
30 30
                 break;
31 31
             case 'tenth miles' :
32
-                $this->content = round($number / (12 * 3 * 1760), 1) . ' miles';
32
+                $this->content = round($number / (12 * 3 * 1760), 1).' miles';
33 33
                 break;
34 34
             case 'yards' :
35
-                $this->content = number_format(round($number / (12 * 3))) . ' yards';
35
+                $this->content = number_format(round($number / (12 * 3))).' yards';
36 36
                 break;
37 37
             case 'feet' :
38
-                $this->content = number_format(round($number / 12)) . "'";
38
+                $this->content = number_format(round($number / 12))."'";
39 39
                 break;
40 40
             case 'inches' :
41 41
                 $feet = floor($number / 12);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 }
50 50
                 
51 51
                 $this->content = '';
52
-                $this->content .= number_format($feet) . "'";
52
+                $this->content .= number_format($feet)."'";
53 53
                 if (isset($inches) && $inches > 0) {
54 54
                     $this->content .= " {$inches}\"";
55 55
                 }
Please login to merge, or discard this patch.
utility/content/CleanCommentContent.class.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER);
42 42
 		
43
-		if($match_count < 1)
43
+		if ($match_count < 1)
44 44
 			return;
45 45
 		
46
-		foreach($matches as $match)
46
+		foreach ($matches as $match)
47 47
 		{
48 48
 			$full_match = array_shift($match);
49 49
 			$placeholder = $this->create_placeholder($full_match);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	private function create_placeholder($text)
58 58
 	{
59
-		return md5($text . rand());
59
+		return md5($text.rand());
60 60
 	}
61 61
 
62 62
 	private function create_full_match_pattern($text)
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		$match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER);
81 81
 		
82
-		if($match_count < 1)
82
+		if ($match_count < 1)
83 83
 			return;
84 84
 		
85
-		foreach($matches as $match)
85
+		foreach ($matches as $match)
86 86
 		{
87 87
 			$full_match = array_shift($match);
88 88
 			$full_match_pattern = $this->create_full_match_pattern($full_match);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	private function replace_element_patterns()
101 101
 	{
102
-		foreach($this->replacement_array as $key => $replace)
102
+		foreach ($this->replacement_array as $key => $replace)
103 103
 		{
104 104
 			$this->content = str_replace($key, $replace, $this->content);
105 105
 		}
Please login to merge, or discard this patch.
utility/content/SmartTrimContent.class.inc.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 	protected function execute()
28 28
 	{
29 29
 		$args = func_get_args();
30
-		if(count($args) < 1)
30
+		if (count($args) < 1)
31 31
 		{
32 32
 			trigger_error('Someone called SmartTrimContent w/o defining a length... bad!');
33 33
 			return;
34 34
 		}
35 35
 		
36
-		if(count($args) == 2)
36
+		if (count($args) == 2)
37 37
 			$etc = $args[1];
38 38
 		else
39 39
 			$etc = self::$ETC;
40 40
 		
41 41
 		$length = $args[0];
42 42
 		
43
-		if($length < strlen($this->content))
43
+		if ($length < strlen($this->content))
44 44
 			$this->trim_string($length);
45 45
         else
46 46
             $etc = '';
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		
55 55
 		$last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET);
56 56
 		$last_left_bracket_position = strripos($content, self::$LEFT_BRACKET);
57
-		if($last_left_bracket_position > $last_right_bracket_position)
57
+		if ($last_left_bracket_position > $last_right_bracket_position)
58 58
 			$content = substr($content, 0, $last_left_bracket_position);
59 59
 		$content = trim($content);
60 60
 		
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 		$content = current($content);
74 74
 		
75 75
 		$max_length = $length;
76
-		foreach($matches[0] as $match)
76
+		foreach ($matches[0] as $match)
77 77
 		{
78 78
 			$max_length += strlen($match[0]);
79
-			if($max_length <= $match[1])
79
+			if ($max_length <= $match[1])
80 80
 				break;
81 81
 			
82
-			$content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]);
82
+			$content = substr($content, 0, $match[1]).$match[0].substr($content, $match[1]);
83 83
 		}
84 84
 		
85
-		if(substr($content, -7) == '</p><p>')
85
+		if (substr($content, -7) == '</p><p>')
86 86
 			$content = substr($content, 0, -7);
87 87
 		
88 88
 		return $content;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		$tags_preg = $this->get_tags_preg(self::$EXCLUDE_TAGS);
95 95
 		preg_match_all($tags_preg, $content, $matches, PREG_OFFSET_CAPTURE);
96 96
 		
97
-		if(count($matches[1]) % 2 == 1)
97
+		if (count($matches[1]) % 2 == 1)
98 98
 		{
99 99
 			$cut_tag = end($matches[1]);
100 100
 			$cut_tag_position = $cut_tag[1] - 1;
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 		preg_match_all($tags_preg, $content, $matches);
113 113
 		$open_tags = array();
114 114
 		
115
-		foreach($matches[1] as $tag)
115
+		foreach ($matches[1] as $tag)
116 116
 		{
117
-			if(in_array($tag, $open_tags))
117
+			if (in_array($tag, $open_tags))
118 118
 			{
119 119
 				$key = array_search($tag, $open_tags);
120 120
 				unset($open_tags[$key]);
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 		}
125 125
 		
126 126
 		$open_tags = array_reverse($open_tags);
127
-		if(count($open_tags) > 0)
127
+		if (count($open_tags) > 0)
128 128
 		{
129
-			foreach($open_tags as $key => $open_tag)
129
+			foreach ($open_tags as $key => $open_tag)
130 130
 			{
131
-				if($key == count($open_tags) - 1)
131
+				if ($key == count($open_tags) - 1)
132 132
 					$content .= $etc;
133 133
 				$content .= "</{$open_tag}>";
134 134
 			}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	private function get_tags_preg($tag_array)
143 143
 	{
144
-		return '@</?(' . implode('|', $tag_array) . ')@';
144
+		return '@</?('.implode('|', $tag_array).')@';
145 145
 	}
146 146
 
147 147
 }
Please login to merge, or discard this patch.
utility/URLDecode.class.inc.php 1 patch
Spacing   +9 added lines, -9 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;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
     $base .= '/';
42 42
 
43 43
 		self::$array['base'] = $base;
44
-		self::$array['uri'] = '/' . implode('/', $uri_array);
44
+		self::$array['uri'] = '/'.implode('/', $uri_array);
45 45
 		
46
-		if(end($uri_array) == '')
46
+		if (end($uri_array) == '')
47 47
 			$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
48 48
 		self::$array['pieces'] = (array) $uri_array;
49 49
 	}
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
 	static function getExtension()
72 72
 	{
73 73
 		$file = self::getPiece(-1);
74
-		if(substr($file, -1) == '/')
74
+		if (substr($file, -1) == '/')
75 75
 			return false;
76
-		return substr($file, strrpos($file, '.') + 1);;
76
+		return substr($file, strrpos($file, '.') + 1); ;
77 77
 	}
78 78
 
79 79
 	static function getPiece($piece = null)
80 80
 	{
81
-		if(!$piece)
81
+		if (!$piece)
82 82
 			return self::$array['pieces'];
83 83
 		
84
-		if($piece == -1)
84
+		if ($piece == -1)
85 85
 			return end(self::$array['pieces']);
86 86
 		
87 87
 		$piece = $piece - 1;
88
-		if(array_key_exists($piece, self::$array['pieces']))
88
+		if (array_key_exists($piece, self::$array['pieces']))
89 89
 			return self::$array['pieces'][$piece];
90 90
 		return;
91 91
 	}
Please login to merge, or discard this patch.
utility/Loader.class.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public static function instance()
19 19
 	{
20
-		if(!isset(self::$instance))
20
+		if (!isset(self::$instance))
21 21
 			self::$instance = new Loader();
22 22
 		return self::$instance;
23 23
 	}
24 24
 
25 25
 	private function get_root()
26 26
 	{
27
-		if(!isset($this->root))
27
+		if (!isset($this->root))
28 28
 		{
29 29
 			$current_directory = dirname(__FILE__);
30 30
 			$current_directory = substr($current_directory, 0, -7);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	private static function get_extension($type)
54 54
 	{
55
-		switch($type)
55
+		switch ($type)
56 56
 		{
57 57
 			case 'collector' :
58 58
 			case 'controller' :
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public static function load($type, $files, $data = array())
106 106
 	{
107
-		foreach((array) $files as $file)
107
+		foreach ((array) $files as $file)
108 108
 		{
109 109
 			$file_path = self::instance()->get_path($type, $file);
110
-			if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
110
+			if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
111 111
 				continue;
112 112
 			
113 113
 			self::instance()->add_included_file($file_path);
114 114
 			
115
-			switch($type)
115
+			switch ($type)
116 116
 			{
117 117
 				case 'images' :
118 118
 				case 'scripts' :
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		
143 143
 		$reflectionObject = self::create_reflection_class($file);
144 144
 		
145
-		if(
145
+		if (
146 146
 			$reflectionObject->hasMethod('instance') &&
147 147
 			$reflectionObject->getMethod('instance')->isStatic())
148 148
 		{
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		
158 158
 		$reflectionObject = self::create_reflection_class($file);
159 159
 		
160
-		if($reflectionObject->hasMethod('__construct'))
160
+		if ($reflectionObject->hasMethod('__construct'))
161 161
 			return $reflectionObject->newInstanceArgs($data);
162 162
 		else
163 163
 			return $reflectionObject->newInstance();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             if ($site == 'waterfalls' && self::instance()->is_live) {
181 181
                 return "{$protocol}://www.waterfallsofthekeweenaw.com/";
182 182
             } else {
183
-                return $protocol . '://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/';
183
+                return $protocol.'://'.(self::instance()->is_live ? '' : 'dev.').$site.'.jacobemerick.com/';
184 184
             }
185 185
         }
186 186
         return '/';
Please login to merge, or discard this patch.
utility/Database.class.inc.php 1 patch
Spacing   +12 added lines, -12 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,23 +63,23 @@  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;
74 74
 		}
75
-		trigger_error('Could not preform query - ' . $query . ' - ' . self::instance()->read_connection->error);
75
+		trigger_error('Could not preform query - '.$query.' - '.self::instance()->read_connection->error);
76 76
 		return false;
77 77
 	}
78 78
 
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,19 +87,19 @@  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;
94 94
 		}
95
-		trigger_error('Could not preform query - ' . $query . '-' . self::instance()->write_connection->error);
95
+		trigger_error('Could not preform query - '.$query.'-'.self::instance()->write_connection->error);
96 96
 		return false;
97 97
 	}
98 98
 
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;
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 
130 130
 	public static function explain($query)
131 131
 	{
132
-		$sql = 'EXPLAIN ' . $query['sql'];
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.
bootstrap.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 ini_set('display_errors', 0);
6 6
 
7 7
 
8
-require_once __DIR__ . '/vendor/autoload.php';
8
+require_once __DIR__.'/vendor/autoload.php';
9 9
 
10 10
 $container = new Pimple\Container();
11 11
 
12 12
 
13 13
 // load the config for the application
14
-$config_path = __DIR__ . '/config.json';
14
+$config_path = __DIR__.'/config.json';
15 15
 
16 16
 $handle = @fopen($config_path, 'r');
17 17
 if ($handle === false) {
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 
30 30
 // timezones are fun
31 31
 date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration
32
-$container['default_timezone'] = function ($c) {
32
+$container['default_timezone'] = function($c) {
33 33
     return new DateTimeZone('America/Phoenix');
34 34
 };
35 35
 
36 36
 
37 37
 // configure the db connections holder
38 38
 $db_connections = new Aura\Sql\ConnectionLocator();
39
-$db_connections->setDefault(function () use ($config) {
39
+$db_connections->setDefault(function() use ($config) {
40 40
     $connection = $config->database->slave;
41 41
     return new Aura\Sql\ExtendedPdo(
42 42
         "mysql:host={$connection->host}",
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $connection->password
45 45
     );
46 46
 });
47
-$db_connections->setWrite('master', function () use ($config) {
47
+$db_connections->setWrite('master', function() use ($config) {
48 48
     $connection = $config->database->master;
49 49
     return new Aura\Sql\ExtendedPdo(
50 50
         "mysql:host={$connection->host}",
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $connection->password
53 53
     );
54 54
 });
55
-$db_connections->setRead('slave', function () use ($config) {
55
+$db_connections->setRead('slave', function() use ($config) {
56 56
     $connection = $config->database->slave;
57 57
     $pdo = new Aura\Sql\ExtendedPdo(
58 58
         "mysql:host={$connection->host}",
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 
71 71
 
72 72
 // setup mail handler
73
-$container['mail'] = $container->factory(function ($c) {
73
+$container['mail'] = $container->factory(function($c) {
74 74
     return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']);
75 75
 });
76 76
 
77 77
 
78 78
 // setup the logger
79
-$container['setup_logger'] = $container->protect(function ($name) use ($container) {
79
+$container['setup_logger'] = $container->protect(function($name) use ($container) {
80 80
     $logger = new Monolog\Logger($name);
81 81
 
82
-    $logPath = __DIR__ . "/../logs/{$name}.log";
82
+    $logPath = __DIR__."/../logs/{$name}.log";
83 83
     $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO);
84 84
     $streamHandler->setFormatter(
85 85
         new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n")
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 
109 109
 // sets up shutdown function to display profiler
110
-register_shutdown_function(function () use ($container) {
110
+register_shutdown_function(function() use ($container) {
111 111
     if (
112 112
         !isset($_COOKIE['debugger']) ||
113 113
         $_COOKIE['debugger'] != 'display'
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
         ->getRead()
120 120
         ->getProfiler()
121 121
         ->getProfiles();
122
-    $dbProfiles = array_filter($dbProfiles, function ($profile) {
122
+    $dbProfiles = array_filter($dbProfiles, function($profile) {
123 123
         return $profile['function'] == 'perform';
124 124
     });
125
-    $dbProfiles = array_map(function ($profile) {
125
+    $dbProfiles = array_map(function($profile) {
126 126
         return [
127 127
             'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])),
128 128
             'parameters' => $profile['bind_values'],
Please login to merge, or discard this patch.
module/form/CommentSubmitModule.class.inc.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function activate()
28 28
 	{
29
-		if(!Request::hasPost())
29
+		if (!Request::hasPost())
30 30
 			return false;
31
-		if(!Request::getPost('submit') == 'Submit Comment')
31
+		if (!Request::getPost('submit') == 'Submit Comment')
32 32
 			return false;
33 33
 		
34 34
 		$errors = $this->fetch_errors();
35
-		if(count($errors) > 0)
35
+		if (count($errors) > 0)
36 36
 			return $errors;
37
-		if(Request::getPost('catch') !== '')
37
+		if (Request::getPost('catch') !== '')
38 38
 			return false;
39 39
 		
40 40
 		$page_id = $this->save_comment_page();
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
 	private function fetch_errors()
51 51
 	{
52 52
 		$errors = array();
53
-		if(!Validate::checkRequest('post', 'name', 'name'))
53
+		if (!Validate::checkRequest('post', 'name', 'name'))
54 54
 			$errors['name'] = 'You must include a valid name';
55
-		if(!Validate::checkRequest('post', 'email', 'email'))
55
+		if (!Validate::checkRequest('post', 'email', 'email'))
56 56
 			$errors['email'] = 'You must include a valid email';
57
-		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
57
+		if (Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
58 58
 			$errors['website'] = 'Please enter a valid website';
59
-		if(!Validate::checkRequest('post', 'comment', 'string'))
59
+		if (!Validate::checkRequest('post', 'comment', 'string'))
60 60
 			$errors['comment'] = 'You must enter a comment';
61
-		if(Request::getPost('notify') && Request::getPost('notify') != 'check')
61
+		if (Request::getPost('notify') && Request::getPost('notify') != 'check')
62 62
 			$errors['notify'] = 'You entered an invalid notify request';
63
-		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
63
+		if (Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
64 64
 			$errors['reply'] = 'You entered an invalid reply request';
65 65
 		
66 66
 		return $errors;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	private function save_comment_page()
70 70
 	{
71 71
 		$page_result = CommentCollector::getCommentPageByURL($this->path, $this->site);
72
-		if($page_result !== null)
72
+		if ($page_result !== null)
73 73
 			return $page_result->id;
74 74
 		
75 75
 		$query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			'name' => Request::getPost('name'),
86 86
 			'email' => Request::getPost('email'));
87 87
 		
88
-		if(Request::getPost('website') != '')
88
+		if (Request::getPost('website') != '')
89 89
 			$cookie_value['website'] = Request::getPost('website');
90 90
 		
91 91
 		$cookie_value = json_encode($cookie_value);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			->save();
96 96
 		
97 97
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
98
-		if($commenter_result !== null)
98
+		if ($commenter_result !== null)
99 99
 			return $commenter_result->id;
100 100
 		
101 101
 		$query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')";
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	private function save_comment()
113 113
 	{
114 114
 		$comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
115
-		if($comment_result !== null)
115
+		if ($comment_result !== null)
116 116
 			return $comment_result->id;
117 117
 		
118 118
 		$query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')";
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
134 134
 		
135 135
 		$reply = Database::escape(Request::getPost('type'));
136
-		if($reply == 'new')
136
+		if ($reply == 'new')
137 137
 			$reply = 0;
138 138
 		// else check to make sure value is legit
139 139
 		
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 		
153 153
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
154 154
 		
155
-		if($commenter_result->trusted == 1)
155
+		if ($commenter_result->trusted == 1)
156 156
 		{
157 157
 			$notification_result = CommentCollector::getNotificationForPage($page);
158 158
 			
159
-			foreach($notification_result as $notification_row)
159
+			foreach ($notification_result as $notification_row)
160 160
 			{
161
-				if($notification_row->email == Request::getPost('email'))
161
+				if ($notification_row->email == Request::getPost('email'))
162 162
 					continue;
163 163
 				
164 164
 				$email_recipient_array[$notification_row->email] = array(
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
         
172 172
         if ($site == 'blog') {
173 173
             $subject = "New Comment on Jacob Emerick's Blog";
174
-            $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you 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 {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!";
174
+            $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you 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 {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!";
175 175
         } else if ($site == 'waterfalls') {
176 176
             $subject = "New Comment on Waterfalls of the Keweenaw";
177
-            $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you 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 {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!";
177
+            $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you 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 {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!";
178 178
         }
179 179
 
180 180
     global $container;
181 181
 
182
-		foreach($email_recipient_array as $email_recipient)
182
+		foreach ($email_recipient_array as $email_recipient)
183 183
 		{
184 184
       $sent = $container['mail']
185 185
         ->addTo($email_recipient['email'], $email_recipient['name'])
Please login to merge, or discard this patch.