Completed
Push — master ( 7721c2...c2fee6 )
by Gordon
02:30
created
code/model/Comment.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
 				_t('Comment.ParentComment_Title', 'This comment is a reply to the below')
571 571
 			));
572 572
 			// Created date
573
-            // FIXME - the method setName in DatetimeField is not chainable, hence
574
-            // the lack of chaining here
575
-            $createdField = $parent
576
-                    ->obj('Created')
577
-                    ->scaffoldFormField($parent->fieldLabel('Created'));
578
-            $createdField->setName('ParentComment_Created');
579
-            $createdField->setValue($parent->Created);
580
-            $createdField->performReadonlyTransformation();
581
-            $fields->push($createdField);
573
+			// FIXME - the method setName in DatetimeField is not chainable, hence
574
+			// the lack of chaining here
575
+			$createdField = $parent
576
+					->obj('Created')
577
+					->scaffoldFormField($parent->fieldLabel('Created'));
578
+			$createdField->setName('ParentComment_Created');
579
+			$createdField->setValue($parent->Created);
580
+			$createdField->performReadonlyTransformation();
581
+			$fields->push($createdField);
582 582
 
583 583
 			// Name (could be member or string value)
584 584
 			$fields->push(
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function getHtmlPurifierService() {
622 622
 		$config = HTMLPurifier_Config::createDefault();
623
-        $allowedElements = $this->getOption('html_allowed_elements');
624
-        $config->set('HTML.AllowedElements', $allowedElements);
623
+		$allowedElements = $this->getOption('html_allowed_elements');
624
+		$config->set('HTML.AllowedElements', $allowedElements);
625 625
 
626
-        // This injector cannot be set unless the 'p' element is allowed
627
-        if (in_array('p', $allowedElements)) {
628
-            $config->set('AutoFormat.AutoParagraph', true);
629
-        }
626
+		// This injector cannot be set unless the 'p' element is allowed
627
+		if (in_array('p', $allowedElements)) {
628
+			$config->set('AutoFormat.AutoParagraph', true);
629
+		}
630 630
 
631 631
 		$config->set('AutoFormat.Linkify', true);
632 632
 		$config->set('URI.DisableExternalResources', true);
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			|| ($this->getOption('frontend_moderation') && $parent->canModerateComments())
717 717
 		);
718 718
 		if (!$showUnmoderated) {
719
-		    $list = $list->filter('Moderated', 1);
719
+			$list = $list->filter('Moderated', 1);
720 720
 		}
721 721
 
722 722
 		$this->extend('updateReplies', $list);
Please login to merge, or discard this patch.
code/controllers/CommentingController.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		if(!$comment->getSecurityToken()->checkRequest($this->request)) return $this->httpError(400);
244 244
 
245 245
 		$comment->markSpam();
246
-        return $this->renderChangedCommentState($comment);
246
+		return $this->renderChangedCommentState($comment);
247 247
 	}
248 248
 
249 249
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		if(!$comment->getSecurityToken()->checkRequest($this->request)) return $this->httpError(400);
259 259
 
260 260
 		$comment->markApproved();
261
-        return $this->renderChangedCommentState($comment);
261
+		return $this->renderChangedCommentState($comment);
262 262
 	}
263 263
 
264 264
 	/**
@@ -273,36 +273,36 @@  discard block
 block discarded – undo
273 273
 		if(!$comment->getSecurityToken()->checkRequest($this->request)) return $this->httpError(400);
274 274
 
275 275
 		$comment->markApproved();
276
-        return $this->renderChangedCommentState($comment);
276
+		return $this->renderChangedCommentState($comment);
277 277
 	}
278 278
 
279
-    /**
280
-     * Redirect back to referer if available, ensuring that only site URLs
281
-     * are allowed to avoid phishing.  If it's an AJAX request render the
282
-     * comment in it's new state
283
-     */
284
-    private function renderChangedCommentState($comment) {
285
-        $referer = $this->request->getHeader('Referer');
286
-
287
-        // Render comment using AJAX
288
-        if ($this->request->isAjax()) {
289
-            return $comment->renderWith('CommentsInterface_singlecomment');
290
-        } else {
291
-            // Redirect to either the comment or start of the page
292
-            if (empty($referer)) {
293
-                return $this->redirectBack();
294
-            } else {
295
-                // Redirect to the comment, but check for phishing
296
-                $url = $referer . '#comment-' . $comment->ID;
297
-                // absolute redirection URLs not located on this site may cause phishing
298
-                if(Director::is_site_url($url)) {
299
-                    return $this->redirect($url);
300
-                } else {
301
-                    return false;
302
-                }
303
-            }
304
-        }
305
-    }
279
+	/**
280
+	 * Redirect back to referer if available, ensuring that only site URLs
281
+	 * are allowed to avoid phishing.  If it's an AJAX request render the
282
+	 * comment in it's new state
283
+	 */
284
+	private function renderChangedCommentState($comment) {
285
+		$referer = $this->request->getHeader('Referer');
286
+
287
+		// Render comment using AJAX
288
+		if ($this->request->isAjax()) {
289
+			return $comment->renderWith('CommentsInterface_singlecomment');
290
+		} else {
291
+			// Redirect to either the comment or start of the page
292
+			if (empty($referer)) {
293
+				return $this->redirectBack();
294
+			} else {
295
+				// Redirect to the comment, but check for phishing
296
+				$url = $referer . '#comment-' . $comment->ID;
297
+				// absolute redirection URLs not located on this site may cause phishing
298
+				if(Director::is_site_url($url)) {
299
+					return $this->redirect($url);
300
+				} else {
301
+					return false;
302
+				}
303
+			}
304
+		}
305
+	}
306 306
 
307 307
 	/**
308 308
 	 * Returns the comment referenced in the URL (by ID). Permission checking
Please login to merge, or discard this patch.