Esempio n. 1
0
 function testDefaultConfiguration()
 {
     $expect = new Perms_Reflection_Factory();
     $expect->registerFallback('Perms_Reflection_Object');
     $expect->register('category', 'Perms_Reflection_Category');
     $expect->register('global', 'Perms_Reflection_Global');
     $this->assertEquals($expect, Perms_Reflection_Factory::getDefaultFactory());
 }
if (isset($_REQUEST['referer'])) {
    $smarty->assign('referer', $_REQUEST['referer']);
} else {
    $smarty->assign('referer', '');
}
$_REQUEST['objectId'] = urldecode($_REQUEST['objectId']);
$_REQUEST['objectType'] = urldecode($_REQUEST['objectType']);
$_REQUEST['permType'] = !empty($_REQUEST['permType']) ? urldecode($_REQUEST['permType']) : 'global';
$smarty->assign('objectName', $_REQUEST['objectName']);
$smarty->assign('objectId', $_REQUEST['objectId']);
$smarty->assign('objectType', $_REQUEST['objectType']);
$smarty->assign_by_ref('permType', $_REQUEST['permType']);
if ($_REQUEST['objectType'] == 'wiki') {
    $_REQUEST['objectType'] = 'wiki page';
}
$objectFactory = Perms_Reflection_Factory::getDefaultFactory();
$currentObject = $objectFactory->get($_REQUEST['objectType'], $_REQUEST['objectId']);
$permissionApplier = new Perms_Applier();
$permissionApplier->addObject($currentObject);
if ($restrictions = perms_get_restrictions()) {
    $permissionApplier->restrictPermissions($restrictions);
}
if ($_REQUEST['objectType'] == 'wiki page') {
    global $structlib;
    include_once 'lib/structures/structlib.php';
    $pageInfoTree = $structlib->s_get_structure_pages($structlib->get_struct_ref_id($_REQUEST['objectId']));
    if (count($pageInfoTree) > 1) {
        $smarty->assign('inStructure', 'y');
    }
    // If assign to structure is requested, add subelements to the applier
    if (!empty($_REQUEST['assignstructure']) && $_REQUEST['assignstructure'] == 'on' && !empty($pageInfoTree)) {