示例#1
0
文件: bookmark.php 项目: btry/glpi
    $_GET["itemtype"] = -1;
} else {
    if (!is_subclass_of($_GET['itemtype'], 'CommonDBTM')) {
        throw new \RuntimeException('Invalid name provided!');
    }
}
if (!isset($_GET["url"])) {
    $_GET["url"] = "";
}
if (!isset($_GET["action"])) {
    $_GET["action"] = "";
}
$bookmark = new Bookmark();
if (isset($_POST["add"])) {
    $bookmark->check(-1, CREATE, $_POST);
    $bookmark->add($_POST);
} else {
    if (isset($_POST["update"])) {
        $bookmark->check($_POST["id"], UPDATE);
        // Right to update the bookmark
        $bookmark->check(-1, CREATE, $_POST);
        // Right when entity change
        $bookmark->update($_POST);
        $_GET["action"] = "";
    } else {
        if ($_GET["action"] == "edit" && isset($_GET['mark_default']) && isset($_GET["id"])) {
            $bookmark->check($_GET["id"], READ);
            if ($_GET["mark_default"] > 0) {
                $bookmark->mark_default($_GET["id"]);
            } else {
                if ($_GET["mark_default"] == 0) {