Example #1
0
File: view.php Project: rair/yacs
 * @reference
 * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
 */
// common definitions and initial processing
include_once '../shared/global.php';
include_once 'versions.php';
// look for the id
$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Versions::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
    $anchor = Anchors::get($item['anchor']);
}
// you have to own the object to handle versions
if (is_object($anchor) && $anchor->is_owned()) {
    $permitted = TRUE;
} elseif (is_object($anchor) && $anchor->get_type() == 'section' && Sections::is_owned(NULL, $anchor)) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// load the skin, maybe with a variant
load_skin('versions', $anchor);