Exemplo n.º 1
0
include "../header.php";
// Setup revision control
$revisions = new revisionControlSystem('objects', 'revisions', 'ID', 'modifiedTime');
$selectedProjects = NULL;
$parentObject = NULL;
$permissions = TRUE;
try {
    $error = FALSE;
    if (objects::validID() === FALSE) {
        throw new Exception("ObjectID Provided is invalid.");
    }
    if (forms::validID() === FALSE) {
        throw new Exception("No Form ID Provided.");
    }
    if (mfcsPerms::isEditor($engine->cleanGet['MYSQL']['formID']) === FALSE) {
        $permissions = FALSE;
        throw new Exception("Permission Denied to view objects created with this form.");
    }
    if (isset($engine->cleanGet['MYSQL']['parentID']) && objects::validID(TRUE, $engine->cleanGet['MYSQL']['parentID']) === FALSE) {
        throw new Exception("ParentID Provided is invalid.");
    }
    // if an object ID is provided make sure the object is from this form
    if (!isnull($engine->cleanGet['MYSQL']['objectID']) && !objects::checkObjectInForm($engine->cleanGet['MYSQL']['formID'], $engine->cleanGet['MYSQL']['objectID'])) {
        throw new Exception("Object not from this form.");
    }
    if (($form = forms::get($engine->cleanGet['MYSQL']['formID'])) === FALSE) {
        throw new Exception("Error retrieving form.");
    }
    if (forms::isProductionReady($engine->cleanGet['MYSQL']['formID']) === FALSE) {
        $permissions = FALSE;
Exemplo n.º 2
0
<?php

include "../../header.php";
// Setup revision control
$revisions = revisions::create();
###############################################################################################################
try {
    if (!isset($engine->cleanGet['MYSQL']['objectID']) || !validate::integer($engine->cleanGet['MYSQL']['objectID'])) {
        throw new Exception('No Object ID Provided.');
    }
    $objectID = $engine->cleanGet['MYSQL']['objectID'];
    $object = objects::get($objectID);
    $form = forms::get($object['formID']);
    $fields = $form['fields'];
    if (mfcsPerms::isEditor($form['ID']) === FALSE) {
        throw new Exception("Permission Denied to view objects created with this form.");
    }
    log::insert("Data Entry: Revision: View Page", $objectID);
    ###############################################################################################################
    // Catch a form submition (which would be a revision being reverted to)
    if (isset($engine->cleanPost['MYSQL']['revisionID'])) {
        log::insert("Data Entry: Revision: Revert", $objectID);
        // @TODO this should use revert2Revision() method instead of this ...
        $revisionID = $revisions->getRevisionID($engine->cleanGet['MYSQL']['objectID'], $engine->cleanPost['MYSQL']['revisionID']);
        if (($revision = $revisions->getMetadataForID($revisionID)) === FALSE) {
            throw new Exception('Could not load revision.');
        }
        if (objects::update($engine->cleanGet['MYSQL']['objectID'], $revision['formID'], decodeFields($revision['data']), $revision['metadata'], $revision['parentID']) !== FALSE) {
            // Reload the object - To refresh the data
            $object = objects::get($objectID, TRUE);
        } else {