$categoryId = array(); if (isset($_GET["cat"])) { $categoryId = explode(",", $_GET["cat"]); } else { $categoryId[] = -1; } $limit = 100; if (isset($_GET["limit"]) && is_numeric($_GET["limit"]) && $_GET["limit"] < 100) { $limit = $_GET["limit"]; } $offset = 0; if (isset($_GET["offset"]) && is_numeric($_GET["offset"])) { $offset = $_GET["offset"]; } if (isset($_GET["q"])) { $reldata = $releases->search($_GET["q"], $categoryId, $offset, $limit, "", $maxage, $catexclusions); } else { $orderby = array(); $orderby[0] = "postdate"; $orderby[1] = "asc"; $totrows = $releases->getBrowseCount($categoryId, $maxage, $catexclusions); $reldata = $releases->getBrowseRange($categoryId, $offset, $limit, "", $maxage, $catexclusions); if ($totrows > 0 && count($reldata)) { $reldata[0]["_totalrows"] = $totrows; } } if ($outputtype == "xml") { $page->smarty->assign('offset', $offset); $page->smarty->assign('releases', $reldata); header("Content-type: text/xml"); echo trim($page->smarty->fetch('apiresult.tpl'));
$categoryId[] = -1; } $groupName = array(); if (isset($_GET["group"])) { $groupName = explode(",", $_GET["group"]); } $limit = 100; if (isset($_GET["limit"]) && is_numeric($_GET["limit"]) && $_GET["limit"] < 100) { $limit = $_GET["limit"]; } $offset = 0; if (isset($_GET["offset"]) && is_numeric($_GET["offset"])) { $offset = $_GET["offset"]; } if (isset($_GET["q"])) { $reldata = $releases->search($_GET["q"], $categoryId, $offset, $limit, $sort, $maxage, $catexclusions, $groupName, $minsize, $maxsize); } else { $orderby = array(); $orderby[0] = "post\tdate"; $orderby[1] = "asc"; $totrows = $releases->getBrowseCount($categoryId, $maxage, $catexclusions, $groupName); $reldata = $releases->getBrowseRange($categoryId, $offset, $limit, "", $maxage, $catexclusions, $groupName); if ($totrows > 0 && count($reldata)) { $reldata[0]["_totalrows"] = $totrows; } } $page->smarty->assign('offset', $offset); $page->smarty->assign('releases', $reldata); $page->smarty->assign('rsshead', $page->smarty->fetch('rssheader.tpl')); $output = trim($page->smarty->fetch('apiresult.tpl')); if ($outputtype == "xml") {
$categoryId = array(); if (isset($_REQUEST["t"])) { $categoryId = explode(",", $_REQUEST["t"]); } else { $categoryId[] = -1; } foreach ($ordering as $ordertype) { $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . implode(',', $categoryId) . "&ob=" . $ordertype); } $page->smarty->assign('category', $categoryId); $page->smarty->assign('pagerquerybase', WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . implode(',', $categoryId) . "&ob=" . $orderby . "&offset="); $page->smarty->assign('search', $searchStr); if (isset($_REQUEST['subject'])) { $page->smarty->assign('subject', $_REQUEST['subject']); } $results = $releases->search($searchStr, -1, -1, -1, $categoryId, -1, -1, 0, 0, -1, -1, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); } $page->smarty->assign('lastvisit', $page->userdata['lastlogin']); if (sizeof($results) > 0) { $totalRows = $results[0]['_totalrows']; } else { $totalRows = 0; } $page->smarty->assign('pagertotalitems', $totalRows); $page->smarty->assign('pageroffset', $offset); $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); $page->smarty->assign('pagerquerysuffix', "#results"); $pager = $page->smarty->fetch("pager.tpl"); $page->smarty->assign('pager', $pager); } if (isset($_REQUEST["subject"]) && !isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["id"])) {
$searchString = (string) $_REQUEST["subject"]; $page->smarty->assign('subject', $searchString); break; case isset($_REQUEST["id"]): $searchString = (string) $_REQUEST["id"]; $page->smarty->assign('search', $searchString); break; } $categoryID[] = -1; if (isset($_REQUEST['t'])) { $categoryID = explode(',', $_REQUEST['t']); } foreach ($releases->getBrowseOrdering() as $orderType) { $page->smarty->assign("orderby{$orderType}", WWW_TOP . '/search/' . htmlentities($searchString) . '?t=' . implode(',', $categoryID) . "&ob={$orderType}"); } $results = $releases->search($searchString, -1, -1, -1, -1, -1, 0, 0, -1, -1, $offset, ITEMS_PER_PAGE, $orderBy, -1, $page->userdata["categoryexclusions"], "basic", $categoryID); $page->smarty->assign(['lastvisit' => $page->userdata['lastlogin'], 'pagertotalitems' => count($results) > 0 ? $results[0]['_totalrows'] : 0, 'pageroffset' => $offset, 'pageritemsperpage' => ITEMS_PER_PAGE, 'pagerquerysuffix' => "#results", 'pagerquerybase' => WWW_TOP . "/search/" . htmlentities($searchString) . "?t=" . implode(',', $categoryID) . "&ob={$orderBy}&offset=", 'category' => $categoryID]); } $searchVars = ['searchadvr' => '', 'searchadvsubject' => '', 'searchadvposter' => '', 'searchadvdaysnew' => '', 'searchadvdaysold' => '', 'searchadvgroups' => '', 'searchadvcat' => '', 'searchadvsizefrom' => '', 'searchadvsizeto' => '', 'searchadvhasnfo' => '', 'searchadvhascomments' => '']; foreach ($searchVars as $searchVarKey => $searchVar) { $searchVars[$searchVarKey] = isset($_REQUEST[$searchVarKey]) ? (string) $_REQUEST[$searchVarKey] : ''; } $searchVars['selectedgroup'] = $searchVars['searchadvgroups']; $searchVars['selectedcat'] = $searchVars['searchadvcat']; $searchVars['selectedsizefrom'] = $searchVars['searchadvsizefrom']; $searchVars['selectedsizeto'] = $searchVars['searchadvsizeto']; foreach ($searchVars as $searchVarKey => $searchVar) { $page->smarty->assign($searchVarKey, $searchVars[$searchVarKey]); } if (isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["id"]) && !isset($_REQUEST["subject"]) && $searchType != "basic") { $orderByString = '';
$userAnidb = $_GET["anidb"] == 0 ? -1 : $_GET["anidb"] + 0; } $userCat = isset($_GET['t']) ? $_GET['t'] == 0 ? -1 : $_GET['t'] : -1; $userNum = isset($_GET["num"]) && is_numeric($_GET['num']) ? abs($_GET['num']) : 100; $userAirDate = isset($_GET["airdate"]) && is_numeric($_GET['airdate']) ? abs($_GET["airdate"]) : -1; $page->smarty->assign(['dl' => isset($_GET['dl']) && $_GET['dl'] == '1' ? '1' : '0', 'del' => isset($_GET['del']) && $_GET['del'] == '1' ? '1' : '0', 'uid' => $uid, 'rsstoken' => $rssToken]); if ($userCat == -3) { $relData = $releases->getShowsRss($userNum, $uid, $page->users->getCategoryExclusion($uid), $userAirDate); } elseif ($userCat == -4) { $relData = $releases->getMyMoviesRss($userNum, $uid, $page->users->getCategoryExclusion($uid)); } else { $relData = $releases->getRss(explode(',', $userCat), $userNum, $uid, $userRage, $userAnidb, $userAirDate); } $userfilter = -1; if (isset($_GET["uFilter"])) { $userfilter = $_GET["uFilter"]; } if ($userfilter != -1) { $catexclusions = $page->users->getCategoryExclusion($uid); $page->title = "Search results:" . $userfilter; $categoryId = array(); $categoryId[] = -1; if (isset($_REQUEST['t'])) { $categoryId = explode(',', $_REQUEST['t']); } $relData = $releases->search($userfilter, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, 0, 250, 'posted_desc', -1, $catexclusions, "basic", $categoryId); } $page->smarty->assign('releases', $relData); header("Content-type: text/xml"); echo trim($page->smarty->fetch('rss.tpl')); }
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; if ($searchtype == "basic") { $searchStr = (string) $_REQUEST["id"]; $categoryId = array(); if (isset($_REQUEST["t"])) { $categoryId = explode(",", $_REQUEST["t"]); } else { $categoryId[] = -1; } foreach ($ordering as $ordertype) { $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . implode(',', $categoryId) . "&ob=" . $ordertype); } $page->smarty->assign('category', $categoryId); $page->smarty->assign('pagerquerybase', WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . implode(',', $categoryId) . "&ob=" . $orderby . "&offset="); $page->smarty->assign('search', $searchStr); $results = $releases->search($searchStr, $categoryId, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]); } else { $searchReleaseName = (string) $_REQUEST["searchadvr"]; $searchFileName = (string) $_REQUEST["searchadvf"]; $searchPoster = (string) $_REQUEST["searchadvposter"]; $searchGroups = (string) $_REQUEST["searchadvgroups"]; $searchCat = (string) $_REQUEST["searchadvcat"]; $searchSizeFrom = (string) $_REQUEST["searchadvsizefrom"]; $searchSizeTo = (string) $_REQUEST["searchadvsizeto"]; $page->smarty->assign('searchadvr', $searchReleaseName); $page->smarty->assign('searchadvf', $searchFileName); $page->smarty->assign('searchadvposter', $searchPoster); $page->smarty->assign('selectedgroup', $searchGroups); $page->smarty->assign('selectedcat', $searchCat); $page->smarty->assign('selectedsizefrom', $searchSizeFrom); $page->smarty->assign('selectedsizeto', $searchSizeTo);
$releases = new \Releases(['Settings' => $page->settings]); $page->smarty->assign('extended', isset($_GET['extended']) && $_GET['extended'] == 1 ? '1' : '0'); $page->smarty->assign('del', isset($_GET['del']) && $_GET['del'] == 1 ? '1' : '0'); // Output is either json or xml. $outputXML = isset($_GET['o']) && $_GET['o'] == 'json' ? false : true; switch ($function) { // Search releases. case 's': verifyEmptyParameter('q'); $maxAge = maxAge(); $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash); $categoryID = categoryid(); $limit = limit(); $offset = offset(); if (isset($_GET['q'])) { $relData = $releases->search($_GET['q'], -1, -1, -1, -1, -1, 0, 0, -1, -1, $offset, $limit, '', $maxAge, $catExclusions, "basic", $categoryID); } else { $totalRows = $releases->getBrowseCount($categoryID, $maxAge, $catExclusions); $relData = $releases->getBrowseRange($categoryID, $offset, $limit, '', $maxAge, $catExclusions); if ($totalRows > 0 && count($relData) > 0) { $relData[0]['_totalrows'] = $totalRows; } } printOutput($relData, $outputXML, $page, $offset); break; // Search tv releases. // Search tv releases. case 'tv': verifyEmptyParameter('q'); verifyEmptyParameter('rid'); verifyEmptyParameter('season');