示例#1
0
<?php

/*
 * This file is part of Infoschool - a web based school intranet.
 * Copyright (C) 2006 Maikel Linke
 */
include 'var.php';
$output->secure();
$item_id = 0;
if (isset($_GET['id'])) {
    $item_id = (int) $_GET['id'];
}
$item = new fs_item($item_id);
if (!$item->right_read()) {
    redirect('./');
}
if ($item->is_file()) {
    $item->send();
} else {
    $item->load_items();
    $content = $item->format();
    $output->out($content);
}
    return $right;
}
$output->secure();
if (!isset($_GET['item'])) {
    redirect('./');
}
$item_id = $_GET['item'];
$item = new fs_item($item_id);
if (!$item->right_rights()) {
    redirect('./');
}
$changed = false;
if (isset($_POST['rights'])) {
    $item->update_rights($_POST['rights']);
    $changed = true;
}
if (isset($_POST['new_rights'])) {
    $item->create_rights($_POST['new_rights']);
    $changed = true;
}
if ($changed) {
    redirect('rights.php?item=' . $item->data['id']);
}
$item->format();
$v = $item->data;
$rights = rights_of($item_id);
$formatted_rights = format_rights($rights);
$v['group'] = $formatted_rights['group'];
$v['person'] = $formatted_rights['person'];
$content = new tmpl('rights.html', $v);
$output->out($content);