function associateEditor()
{
    $class = $_REQUEST['with'];
    if (!class_exists($class)) {
        return false;
    }
    if ($obj = associateID('edit', OVERRIDE)) {
        $editors = $obj->editable;
        if (!in_array($class, array_keys($editors)) || !$obj) {
            return false;
        }
        if (!$class::canEdit($obj) || !$obj->mayI($editors[$class])) {
            errorPage(401);
        }
        return new $class($obj);
    } else {
        return false;
    }
}
Exemple #2
0
 */
include '../lib/init.php';
/* Output buffering */
if ($_REQUEST->raw('disable_ob') != 1) {
    ob_start("contentSize");
    //ob_start('ob_gzhandler');
    ob_start("ob_iconv_handler");
    ob_start("outputBufferFilter");
}
/**
 * Detect requested object and load it
 */
$association_type = 'default';
$CURRENT = false;
$EDIT = false;
if ($_REQUEST['id'] && ($CURRENT = associateID())) {
    $association_type = 'id';
} elseif ($_REQUEST['edit'] && ($CURRENT = associateEditor())) {
    $association_type = 'edit';
    $EDIT = $CURRENT->ID;
} elseif (($domain = associateSubdomain()) && ($CURRENT = @$Controller->{$domain}(READ))) {
    $association_type = 'subdomain';
} elseif (!$_REQUEST['id'] && ($CURRENT = $Controller->frontpage(READ))) {
} else {
    errorPage(404);
}
$PAGE = $CURRENT;
$ID = $CURRENT->ID;
if (!$_REQUEST['id']) {
    $_REQUEST['id'] = $ID;
}