src/Controllers/CommentingController.php
private function renderChangedCommentState($comment)
    {
        $referer = $this->request->getHeader('Referer');

        // Render comment using AJAX
        if ($this->request->isAjax()) {
            return $comment->renderWith('Includes/CommentsInterface_singlecomment');
        }

        // Redirect to either the comment or start of the page
        if (empty($referer)) {
            return $this->redirectBack();
        }

        // Redirect to the comment, but check for phishing
        $url = $referer . '#comment-' . $comment->ID;
        // absolute redirection URLs not located on this site may cause phishing
        if (Director::is_site_url($url)) {
            return $this->redirect($url);
        }

        return false;
    }
private function renderChangedCommentState($comment)
    {
        $referer = $this->request->getHeader('Referer');

        // Render comment using AJAX
        if ($this->request->isAjax()) {
            return $comment->renderWith('Includes/CommentsInterface_singlecomment');
        }

        // Redirect to either the comment or start of the page
        if (empty($referer)) {
            return $this->redirectBack();
        }

        // Redirect to the comment, but check for phishing
        $url = $referer . '#comment-' . $comment->ID;
        // absolute redirection URLs not located on this site may cause phishing
        if (Director::is_site_url($url)) {
            return $this->redirect($url);
        }

        return false;
    }
private function renderChangedCommentState ( $ comment ) { $ referer = $ this -> request -> getHeader ( 'Referer' ) ; // Render comment using AJAX if ( $ this -> request -> isAjax ( ) ) { return $ comment -> renderWith ( 'Includes/CommentsInterface_singlecomment' ) ; } // Redirect to either the comment or start of the page if ( empty ( $ referer ) ) { return $ this -> redirectBack ( ) ; } // Redirect to the comment, but check for phishing $ url = $ referer . '#comment-' . $ comment -> ID ; // absolute redirection URLs not located on this site may cause phishing if ( Director :: is_site_url ( $ url ) ) { return $ this -> redirect ( $ url ) ; } return false ; }
Redirect back to referer if available, ensuring that only site URLs
are allowed to avoid phishing.  If it's an AJAX request render the
comment in it's new state

@param Comment $comment
@return DBHTMLText|HTTPResponse|false
Redirect back to referer if available ensuring that only site URLs are allowed to avoid phishing . If it s an AJAX request render the comment in it s new state