These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /*************************************************************************** |
||
3 | * for license information see LICENSE.md |
||
4 | ***************************************************************************/ |
||
5 | |||
6 | require __DIR__ . '/lib2/web.inc.php'; |
||
7 | |||
8 | $tpl->name = 'addtolist'; |
||
9 | $tpl->menuitem = MNU_CACHES_ADDTOLIST; |
||
10 | |||
11 | $login->verify(); |
||
12 | if ($login->userid == 0) { |
||
13 | $tpl->redirect_login(); |
||
14 | } |
||
15 | |||
16 | $cacheId = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] + 0 : 0; |
||
17 | if (!$cacheId) { |
||
18 | $tpl->redirect('index.php'); |
||
19 | } |
||
20 | $tpl->assign('cacheid', $cacheId); |
||
21 | |||
22 | if (isset($_REQUEST['cancel'])) { |
||
23 | $tpl->redirect('viewcache.php?cacheid=' . $cacheId); |
||
24 | } |
||
25 | |||
26 | $newListName = isset($_REQUEST['newlist_name']) ? trim($_REQUEST['newlist_name']) : false; |
||
27 | if ($newListName === $translate->t('New cache list', '', __FILE__, __LINE__)) { |
||
28 | $newListName = false; |
||
29 | } |
||
30 | $newListPublic = isset($_REQUEST['newlist_public']); |
||
31 | $newListWatch = isset($_REQUEST['newlist_watch']); |
||
32 | $default_list = isset($_REQUEST['listid']) ? (int)$_REQUEST['listid'] : cachelist::getMyLastAddedToListId(); |
||
33 | |||
34 | if (isset($_REQUEST['save'], $_REQUEST['listid'])) { |
||
35 | $listId = (int) $_REQUEST['listid']; |
||
36 | if ($listId === 0) { |
||
37 | $cacheList = new cachelist(ID_NEW, $login->userid); |
||
38 | $name_error = $cacheList->setNameAndVisibility($newListName, $newListPublic ? 2 : 0); |
||
39 | if ($name_error) { |
||
40 | $tpl->assign('name_error', $name_error); |
||
41 | } else { |
||
42 | $cacheList->setNode($opt['logic']['node']['id']); |
||
43 | if ($cacheList->save()) { |
||
44 | $cacheList->addCacheByID($cacheId); |
||
45 | if ($newListWatch) { |
||
46 | $cacheList->watch(true); |
||
47 | } |
||
48 | } |
||
49 | $tpl->redirect('viewcache.php?cacheid=' . $cacheId); |
||
50 | } |
||
51 | } else { |
||
52 | $cacheList = new cachelist($listId); |
||
53 | if ($cacheList->exist()) { |
||
54 | $cacheList->addCacheByID($cacheId); |
||
55 | } |
||
56 | $tpl->redirect('viewcache.php?cacheid=' . $cacheId); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | $tpl->assign('cachename', sql_value("SELECT `name` FROM `caches` WHERE `cache_id`='&1'", '', $cacheId)); |
||
0 ignored issues
–
show
|
|||
61 | $tpl->assign('cachelists', cachelist::getMyLists()); |
||
62 | $tpl->assign('default_list', $default_list); |
||
63 | $tpl->assign('newlist_name', $newListName); |
||
64 | $tpl->assign('newlist_public', $newListPublic); |
||
65 | $tpl->assign('newlist_watch', $newListWatch); |
||
66 | $tpl->display(); |
||
67 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.