CMS  Version 3.9
revert.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("versioned_content");
3 
4 $class = checkIdentifier($_GET["target"]);
5 $itemID = checkNumeric($_GET["item_id"]);
6 
7 if (!$class || !$itemID)
8 {
9  Fakoli::end("Missing Parameter");
10 }
11 
13 $target->load($itemID);
15 
16 if (!checkRole($adminAccess))
17 {
18  Fakoli::end("Permission Denied");
19 }
20 
21 try
22 {
25 
26  Fakoli::notifyOnNextPage("Draft changes discarded");
27  Fakoli::end("OK");
28 }
29 catch(Exception $e)
30 {
31  Fakoli::end($e->getMessage());
32 }
static deleteDraft($target)
Delete the current draft changes for the specified target (if they exist)
static notifyOnNextPage($message, $blocking=false, $button="OK", $onClick="null")
Schedules a notification message to be displayed to the user at the next full page load.
Definition: core.inc:1223
static getAdminAccessRoles()
Returns the user roles that have access to the admin section.
Definition: core.inc:1074
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static end($message="")
Use this method to terminate execution of a script instead of using the php keywords exit() or die().
Definition: core.inc:1149
static revert($target)
Revert the versioned fields on specified target to the current live values.
$class
Definition: revert.inc:4
$itemID
Definition: revert.inc:5
$adminAccess
Definition: revert.inc:14
if(! $class||! $itemID) $target
Definition: revert.inc:12