Completed
Push — master ( 6e5f86...94c6c2 )
by Jacob
05:04
created
module/form/CommentSubmitModule.class.inc.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$comment_id = $this->save_comment();
43 43
 		
44 44
 		$comment_meta_id = $this->save_comment_meta($commenter_id, $comment_id, $page_id);
45
-    $comment_service_id = $this->save_to_comment_service(Request::getPost());
45
+	$comment_service_id = $this->save_to_comment_service(Request::getPost());
46 46
 		
47 47
 		$this->send_notifications($page_id);
48 48
 		$this->redirect_to_comment($comment_meta_id);
@@ -168,26 +168,26 @@  discard block
 block discarded – undo
168 168
 			}
169 169
 		}
170 170
         
171
-        $site = URLDecode::getSite();
171
+		$site = URLDecode::getSite();
172 172
         
173
-        if ($site == 'blog') {
174
-            $subject = "New Comment on Jacob Emerick's Blog";
175
-            $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!";
176
-        } else if ($site == 'waterfalls') {
177
-            $subject = "New Comment on Waterfalls of the Keweenaw";
178
-            $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!";
179
-        }
173
+		if ($site == 'blog') {
174
+			$subject = "New Comment on Jacob Emerick's Blog";
175
+			$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!";
176
+		} else if ($site == 'waterfalls') {
177
+			$subject = "New Comment on Waterfalls of the Keweenaw";
178
+			$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!";
179
+		}
180 180
 
181
-    global $container;
181
+	global $container;
182 182
 
183 183
 		foreach($email_recipient_array as $email_recipient)
184 184
 		{
185
-      $sent = $container['mail']
186
-        ->addTo($email_recipient['email'], $email_recipient['name'])
187
-        ->addBCC($container['config']->admin_email)
188
-        ->setSubject($subject)
189
-        ->setPlainMessage($message)
190
-        ->send();		
185
+	  $sent = $container['mail']
186
+		->addTo($email_recipient['email'], $email_recipient['name'])
187
+		->addBCC($container['config']->admin_email)
188
+		->setSubject($subject)
189
+		->setPlainMessage($message)
190
+		->send();		
191 191
 		}
192 192
 	}
193 193
 
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
 		exit;
202 202
 	}
203 203
 
204
-    private function save_to_comment_service(array $data)
205
-    {
206
-        $path = $_SERVER['REQUEST_URI'];
207
-        $path = explode('/', $path);
208
-        $path = array_filter($path);
209
-        $path = array_slice($path, 0, 2);
210
-        $path = implode('/', $path);
211
-
212
-        $body = [
213
-            'commenter' => [
214
-                'name' => $data['name'],
215
-                'email' => $data['email'],
216
-                'website' => $data['website'],
217
-            ],
218
-            'body' => $data['comment'],
219
-            'should_notify' => (isset($data['notify']) && $data['notify'] == 'check'),
220
-            'should_display' => true,
221
-            'domain' => (URLDecode::getSite() == 'blog' ? 'blog.jacobemerick.com' : 'waterfallsofthekeweenaw.com'),
222
-            'path' => $path,
223
-            'url' => $this->full_path,
224
-            'thread' => 'comments',
225
-            'ip_address' => $_SERVER['REMOTE_ADDR'],
226
-            'user_agent' => $_SERVER['HTTP_USER_AGENT'],
227
-            'referrer' => $_SERVER['HTTP_REFERER'],
228
-        ];
229
-
230
-        global $config;
231
-        $configuration = new Jacobemerick\CommentService\Configuration();
232
-        $configuration->setUsername($config->comments->user);
233
-        $configuration->setPassword($config->comments->password);
234
-        $configuration->addDefaultHeader('Content-Type', 'application/json');
235
-        $configuration->setHost($config->comments->host);
236
-        $configuration->setCurlTimeout($config->comments->timeout);
237
-
238
-        $client = new Jacobemerick\CommentService\ApiClient($configuration);
239
-        $api = new Jacobemerick\CommentService\Api\DefaultApi($client);
240
-        $response = $api->createComment($body);
241
-    }
204
+	private function save_to_comment_service(array $data)
205
+	{
206
+		$path = $_SERVER['REQUEST_URI'];
207
+		$path = explode('/', $path);
208
+		$path = array_filter($path);
209
+		$path = array_slice($path, 0, 2);
210
+		$path = implode('/', $path);
211
+
212
+		$body = [
213
+			'commenter' => [
214
+				'name' => $data['name'],
215
+				'email' => $data['email'],
216
+				'website' => $data['website'],
217
+			],
218
+			'body' => $data['comment'],
219
+			'should_notify' => (isset($data['notify']) && $data['notify'] == 'check'),
220
+			'should_display' => true,
221
+			'domain' => (URLDecode::getSite() == 'blog' ? 'blog.jacobemerick.com' : 'waterfallsofthekeweenaw.com'),
222
+			'path' => $path,
223
+			'url' => $this->full_path,
224
+			'thread' => 'comments',
225
+			'ip_address' => $_SERVER['REMOTE_ADDR'],
226
+			'user_agent' => $_SERVER['HTTP_USER_AGENT'],
227
+			'referrer' => $_SERVER['HTTP_REFERER'],
228
+		];
229
+
230
+		global $config;
231
+		$configuration = new Jacobemerick\CommentService\Configuration();
232
+		$configuration->setUsername($config->comments->user);
233
+		$configuration->setPassword($config->comments->password);
234
+		$configuration->addDefaultHeader('Content-Type', 'application/json');
235
+		$configuration->setHost($config->comments->host);
236
+		$configuration->setCurlTimeout($config->comments->timeout);
237
+
238
+		$client = new Jacobemerick\CommentService\ApiClient($configuration);
239
+		$api = new Jacobemerick\CommentService\Api\DefaultApi($client);
240
+		$response = $api->createComment($body);
241
+	}
242 242
 }
Please login to merge, or discard this patch.