$cacheid = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] + 0 : 0;
if (!$cacheid) {
    $tpl->redirect('index.php');
}
$tpl->assign('cacheid', $cacheid);
if (isset($_REQUEST['cancel'])) {
    $tpl->redirect('viewcache.php?cacheid=' . $cacheid);
}
$newlist_name = isset($_REQUEST['newlist_name']) ? trim($_REQUEST['newlist_name']) : false;
$newlist_public = isset($_REQUEST['newlist_public']);
$newlist_watch = isset($_REQUEST['newlist_watch']);
if (isset($_REQUEST['save']) && isset($_REQUEST['listid'])) {
    $listid = $_REQUEST['listid'] + 0;
    if ($listid == 0) {
        $cachelist = new cachelist(ID_NEW, $login->userid);
        $name_error = $cachelist->setNameAndVisibility($newlist_name, $newlist_public ? 2 : 0);
        if ($name_error) {
            $tpl->assign('name_error', $name_error);
        } else {
            $cachelist->setNode($opt['logic']['node']['id']);
            if ($cachelist->save()) {
                $cachelist->addCacheByID($cacheid);
                if ($newlist_watch) {
                    $cachelist->watch(true);
                }
            }
            $tpl->redirect('viewcache.php?cacheid=' . $cacheid);
        }
    } else {
        $cachelist = new cachelist($listid);
        if ($cachelist->exist()) {
Beispiel #2
0
        $list = new cachelist($_REQUEST['listid'] + 0);
        if ($list->exist() && $list->getUserId() == $login->userid) {
            $edit_list = true;
            $tpl->assign('show_editor', true);
        }
    } else {
        // switching desc mode while creating new list
        $tpl->assign('newlist_mode', true);
        $tpl->assign('show_editor', true);
    }
}
// save data entered in the 'edit list' form
if (isset($_REQUEST['save']) && isset($_REQUEST['listid'])) {
    $list = new cachelist($_REQUEST['listid'] + 0);
    if ($list->exist() && $list->getUserId() == $login->userid) {
        $name_error = $list->setNameAndVisibility($list_name, $list_visibility);
        if ($name_error) {
            $edit_list = true;
        }
        $list->setDescription($desctext, $descMode == 3);
        $list->save();
        $list->watch($watch);
        if ($list_caches != '') {
            $result = $list->addCachesByWPs($list_caches);
            $tpl->assign('invalid_waypoints', $result === true ? false : implode(", ", $result));
            $list_caches = '';
        }
        foreach ($_REQUEST as $key => $value) {
            if (substr($key, 0, 7) == 'remove_') {
                $list->removeCacheById(substr($key, 7));
            }