예제 #1
0
$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()) {
            $cachelist->addCacheByID($cacheid);
        }
        $tpl->redirect('viewcache.php?cacheid=' . $cacheid);
    }