예제 #1
0
파일: auth.php 프로젝트: rafsoaken/piewiki
function pieRequireSuperuser()
{
    pieRequireUser();
    if (!pieIsSuperuser($GLOBALS['pie']['user'])) {
        header("HTTP/1.0 403 Forbidden");
        pieHead("browse");
        pieError("RequireSuperuser");
    }
}
예제 #2
0
        $pref->write($user, 'realname', pieGetOption(@$_REQUEST['realname']));
    }
    if ($_REQUEST['mail']) {
        $pref->write($user, 'mail', pieGetOption(@$_REQUEST['mail']));
    }
    if ($_REQUEST['cols']) {
        $pref->write($user, 'cols', intval(@$_REQUEST['cols']));
    }
    if ($_REQUEST['rows']) {
        $pref->write($user, 'rows', intval(@$_REQUEST['rows']));
    }
    pieLog("user");
    pieNotice("UpdateSuccessful");
} else {
    // Display the form.
    $data = array('user' => htmlspecialchars($user), 'admin' => "—", 'registered' => 0, 'cols' => 80, 'rows' => 20);
    $map = new MapFile();
    $data['lastlogin'] = date($GLOBALS['pie']['time_format'], $map->read($GLOBALS['pie']['run_path'] . "/user/login.map", $user));
    $data['updated'] = date($GLOBALS['pie']['time_format'], $pref->read($user, 'stamp'));
    $data['registered'] = date($GLOBALS['pie']['time_format'], $pref->read($user, 'registered'));
    if (pieIsSuperuser($user)) {
        $data['admin'] = "√";
    }
    foreach (array('realname', 'mail', 'cols', 'rows') as $i) {
        if (($val = $pref->read($user, $i)) !== false) {
            $data[$i] = $val;
        }
    }
    pieNotice("PreferencesForm", $data);
}
pieTail();
예제 #3
0
    // Check for referers.
    if (($referers = pieRefererList($target, $context)) === false) {
        pieError("RefererError");
    }
    if (count($referers)) {
        // There are pages linking to the target.
        pieError("RefererNotice");
    }
    // Check for co-authors.
    foreach ($history as $stamp => $info) {
        if ($info['author'] == $GLOBALS['pie']['user']) {
            continue;
        }
        // We are trying to affect an other author's work
        // ... which is only suitable for admins.
        if (!pieIsSuperuser($GLOBALS['pie']['user'])) {
            pieError("AuthorDiffers", array('action' => "{$context}history"));
        }
    }
    // Ask user for acknowledgement to delete the page.
    pieError("AskApproval");
}
// Delete the resource:
if (!$object->delete($target)) {
    pieError("DeleteError");
}
if ($context == "page") {
    // Do what is to be done with pages.
    if ($object->meta['type'] != "alias") {
        // Delete the cache, if available.
        $cache = new Cache();