} elseif (isset($_REQUEST['searchbycacheid'])) { $options['searchtype'] = 'bycacheid'; $options['cacheid'] = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : 0; if (!is_numeric($options['cacheid'])) { $options['cacheid'] = 0; } } elseif (isset($_REQUEST['searchbywp'])) { $options['searchtype'] = 'bywp'; $options['wp'] = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : ''; } elseif (isset($_REQUEST['searchbynofilter'])) { $options['searchtype'] = 'bynofilter'; } elseif (isset($_REQUEST['searchbylist'])) { $options['searchtype'] = 'bylist'; $options['listid'] = isset($_REQUEST['listid']) ? $_REQUEST['listid'] + 0 : 0; $list = new cachelist($options['listid']); if (!$list->exist() || !$list->isMyList() && $list->getVisibility() == 0) { $tpl->redirect("cachelists.php"); } $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID } elseif (isset($_REQUEST['searchall'])) { if (!$login->logged_in()) { // This operation is very expensive and therefore available only // for logged-in users. $tpl->error(ERROR_LOGIN_REQUIRED); } else { $options['searchtype'] = 'all'; } } else { if (isset($_REQUEST['showresult'])) { $tpl->error('unknown search option');
$result = $list->addCachesByWPs($list_caches); $tpl->assign('invalid_waypoints', $result === true ? false : implode(", ", $result)); } if ($watch) { $list->watch(true); } } } } // open an 'edit list' form if (isset($_REQUEST['edit'])) { $list = new cachelist($_REQUEST['edit'] + 0); if ($list->exist() && $list->getUserId() == $login->userid) { $edit_list = true; $list_name = $list->getName(); $list_visibility = $list->getVisibility(); $watch = $list->isWatchedByMe(); $desctext = $list->getDescription(); $descMode = $list->getDescHtmledit() ? 3 : 2; $list_caches = ''; } } // switch between HTML and Wysiwyg editor mode if ($switchDescMode) { if (isset($_REQUEST['listid'])) { // switching editor mode while editing existing list $list = new cachelist($_REQUEST['listid'] + 0); if ($list->exist() && $list->getUserId() == $login->userid) { $edit_list = true; $tpl->assign('show_editor', true); }