From e395446f6699e766074c3a2e63715c6086f92b08 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 26 Apr 2008 06:38:48 +0000 Subject: [PATCH] Merged revisions 52296 via svnmerge from http://svn.silverstripe.com/open/modules/cms/branches/2.2.2 ........ r52296 | aoneil | 2008-04-08 12:28:37 +1200 (Tue, 08 Apr 2008) | 2 lines Fix pagecomment links and feeds ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@53496 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- _config.php | 2 + code/sitefeatures/PageComment.php | 119 ++++++++++++++++-------------- 2 files changed, 65 insertions(+), 56 deletions(-) diff --git a/_config.php b/_config.php index a13a758c..a918dae4 100644 --- a/_config.php +++ b/_config.php @@ -17,6 +17,8 @@ Director::addRules(50, array( 'admin/bulkload/$Action/$ID/$OtherID' => 'BulkLoaderAdmin', 'admin/ImageEditor/$Action' => 'ImageEditor', 'admin/$Action/$ID/$OtherID' => 'CMSMain', + 'unsubscribe/$Email/$MailingList' => 'Unsubscribe_Controller', + 'PageComment/$Action/$ID' => 'PageComment_Controller' )); // Built-in modules diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 71709b4d..734b6a17 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -51,20 +51,6 @@ class PageComment extends DataObject { return "PageComment/deletecomment/$this->ID"; } } - function deletecomment() { - if(Permission::check('CMS_ACCESS_CMSMain')) { - $comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']); - if($comment) { - $comment->delete(); - } - } - - if(Director::is_ajax()) { - echo ""; - } else { - Director::redirectBack(); - } - } function SpamLink() { $member = Member::currentUser(); @@ -95,7 +81,69 @@ class PageComment extends DataObject { } } - function approve() { + + function RSSTitle() { + return sprintf( + _t('PageComment.COMMENTBY', "Comment by '%s' on %s", PR_MEDIUM, 'Name, Page Title'), + Convert::raw2xml($this->Name), + $this->Parent()->Title + ); + } + + + + + function PageTitle() { + return $this->Parent()->Title; + } + + static function enableModeration() { + self::$moderate = true; + } + + static function moderationEnabled() { + return self::$moderate; + } + + static function enableBBCode() { + self::$bbcode = true; + } + + static function bbCodeEnabled() { + return self::$bbcode; + } + +} + + +class PageComment_Controller extends Controller { + function rss() { + $parentcheck = isset($_REQUEST['pageid']) ? "ParentID = " . (int) $_REQUEST['pageid'] : "ParentID > 0"; + $comments = DataObject::get("PageComment", "$parentcheck AND IsSpam=0", "Created DESC", "", 10); + if(!isset($comments)) { + $comments = new DataObjectSet(); + } + + $rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name"); + $rss->outputToBrowser(); + } + + function deletecomment() { + if(Permission::check('CMS_ACCESS_CMSMain')) { + $comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']); + if($comment) { + $comment->delete(); + } + } + + if(Director::is_ajax()) { + echo ""; + } else { + Director::redirectBack(); + } + } + + function approve() { if(Permission::check('CMS_ACCESS_CMSMain')) { $comment = DataObject::get_by_id("PageComment", $this->urlParams['ID']); $comment->NeedsModeration = false; @@ -174,47 +222,6 @@ class PageComment extends DataObject { } } } - - function RSSTitle() { - return sprintf( - _t('PageComment.COMMENTBY', "Comment by '%s' on %s", PR_MEDIUM, 'Name, Page Title'), - Convert::raw2xml($this->Name), - $this->Parent()->Title - ); - } - - function rss() { - $parentcheck = isset($_REQUEST['pageid']) ? "ParentID = " . (int) $_REQUEST['pageid'] : "ParentID > 0"; - $comments = DataObject::get("PageComment", "$parentcheck AND IsSpam=0", "Created DESC", "", 10); - if(!isset($comments)) { - $comments = new DataObjectSet(); - } - - $rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name"); - $rss->outputToBrowser(); - } - - - function PageTitle() { - return $this->Parent()->Title; - } - - static function enableModeration() { - self::$moderate = true; - } - - static function moderationEnabled() { - return self::$moderate; - } - - static function enableBBCode() { - self::$bbcode = true; - } - - static function bbCodeEnabled() { - return self::$bbcode; - } - } ?>