mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
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:
parent
3e8754e50d
commit
bf70b7e7bc
@ -1,12 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* An individual blog entry page type.
|
||||||
|
*
|
||||||
* @package blog
|
* @package blog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* An individual blog entry page to show a blog entry in full
|
|
||||||
*/
|
|
||||||
class BlogEntry extends Page {
|
class BlogEntry extends Page {
|
||||||
|
|
||||||
static $default_parent = 'BlogHolder';
|
static $default_parent = 'BlogHolder';
|
||||||
@ -185,25 +182,25 @@ class BlogEntry_Controller extends Page_Controller {
|
|||||||
/**
|
/**
|
||||||
* Gets a link to unpublish the blog entry
|
* Gets a link to unpublish the blog entry
|
||||||
*/
|
*/
|
||||||
function unpublishPost(){
|
function unpublishPost() {
|
||||||
if(!Permission::check('ADMIN')){
|
if(!Permission::check('ADMIN')) {
|
||||||
Security::permissionFailure($this,
|
Security::permissionFailure(
|
||||||
"Unpublishing blogs is an administrator task. Please log in.");
|
$this,
|
||||||
}
|
'Unpublishing blogs is an administrator task. Please log in.'
|
||||||
else{
|
);
|
||||||
$SQL_id = Convert::raw2sql($this->ID);
|
} 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->deleteFromStage('Live');
|
||||||
$page->flushCache();
|
$page->flushCache();
|
||||||
|
|
||||||
$page = DataObject::get_by_id("SiteTree", $SQL_id);
|
$page = DataObject::get_by_id('SiteTree', $SQL_id);
|
||||||
$page->Status = "Unpublished";
|
$page->Status = 'Unpublished';
|
||||||
|
|
||||||
Director::redirect($this->getParent()->Link());
|
Director::redirect($this->getParent()->Link());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user