From bf70b7e7bc5d096e16acb30362602f76dd5c166b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 07:01:06 +0000 Subject: [PATCH] MINOR phpDoc for BlogEntry BUGFIX Unncessary use of Convert::raw2sql() in BlogEntry_Controller->unpublishPost() for making an integer SQL safe, just use (int) instead to cast it --- code/BlogEntry.php | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 6d1c2a3..6889862 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -1,12 +1,9 @@ ID); + function unpublishPost() { + if(!Permission::check('ADMIN')) { + Security::permissionFailure( + $this, + 'Unpublishing blogs is an administrator task. Please log in.' + ); + } else { + $SQL_id = (int) $this->ID; - $page = DataObject::get_by_id("SiteTree", $SQL_id); + $page = DataObject::get_by_id('SiteTree', $SQL_id); $page->deleteFromStage('Live'); $page->flushCache(); - $page = DataObject::get_by_id("SiteTree", $SQL_id); - $page->Status = "Unpublished"; + $page = DataObject::get_by_id('SiteTree', $SQL_id); + $page->Status = 'Unpublished'; Director::redirect($this->getParent()->Link()); } } } - -?> +?> \ No newline at end of file