MINOR Using raw2sql in CMSMain->delete()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@85984 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-09-09 23:47:56 +00:00
parent 244fc8d64a
commit 61776f1e74

View File

@ -621,9 +621,11 @@ JS;
* Delete the current page from draft stage.
* @see deletefromlive()
*/
public function delete($urlParams, $form) {
$id = $_REQUEST['ID'];
$record = DataObject::get_one("SiteTree", "\"SiteTree\".\"ID\" = $id");
public function delete($data, $form) {
$record = DataObject::get_one(
"SiteTree",
sprintf("\"SiteTree\".\"ID\" = %d", Convert::raw2sql($data['ID']))
);
if($record && !$record->canDelete()) return Security::permissionFailure();
// save ID and delete record