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
This commit is contained in:
Sean Harvey 2008-12-10 07:01:06 +00:00
parent 3e8754e50d
commit bf70b7e7bc
1 changed files with 14 additions and 17 deletions

View File

@ -1,12 +1,9 @@
<?php
/**
* An individual blog entry page type.
*
* @package blog
*/
/**
* An individual blog entry page to show a blog entry in full
*/
class BlogEntry extends Page {
static $default_parent = 'BlogHolder';
@ -185,25 +182,25 @@ class BlogEntry_Controller extends Page_Controller {
/**
* Gets a link to unpublish the blog entry
*/
function unpublishPost(){
if(!Permission::check('ADMIN')){
Security::permissionFailure($this,
"Unpublishing blogs is an administrator task. Please log in.");
}
else{
$SQL_id = Convert::raw2sql($this->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());
}
}
}
?>
?>