2023-01-13 04:08:12 -08:00
|
|
|
<?php
|
|
|
|
require "misc/header.php";
|
|
|
|
|
|
|
|
$config = require "config.php";
|
|
|
|
require "misc/tools.php";
|
2023-08-21 15:28:02 -07:00
|
|
|
require "misc/engine_request.php";
|
2023-01-13 04:08:12 -08:00
|
|
|
?>
|
2022-03-04 01:36:31 -08:00
|
|
|
|
2022-09-03 10:45:47 -07:00
|
|
|
<title>
|
|
|
|
<?php
|
2023-08-21 15:28:02 -07:00
|
|
|
$query = trim($_REQUEST["q"]);
|
|
|
|
echo $query;
|
2023-08-02 07:18:21 -07:00
|
|
|
?> - LibreY</title>
|
2022-02-25 01:42:32 -08:00
|
|
|
</head>
|
2022-02-17 12:14:56 -08:00
|
|
|
<body>
|
2022-07-15 06:50:23 -07:00
|
|
|
<form class="sub-search-container" method="get" autocomplete="off">
|
2023-08-02 07:28:24 -07:00
|
|
|
<h1 class="logomobile"><a class="no-decoration" href="./">Libre<span class="Y">Y</span></a></h1>
|
2022-08-28 11:41:33 -07:00
|
|
|
<input type="text" name="q"
|
2022-02-17 12:14:56 -08:00
|
|
|
<?php
|
2022-02-19 12:40:56 -08:00
|
|
|
if (1 > strlen($query) || strlen($query) > 256)
|
2022-02-17 12:14:56 -08:00
|
|
|
{
|
2022-04-21 02:02:32 -07:00
|
|
|
header("Location: ./");
|
2022-02-17 12:14:56 -08:00
|
|
|
die();
|
2022-08-28 11:41:33 -07:00
|
|
|
}
|
|
|
|
|
2023-08-18 17:54:48 -07:00
|
|
|
echo "value=\"" . htmlspecialchars($query) . "\"";
|
2022-02-17 12:14:56 -08:00
|
|
|
?>
|
|
|
|
>
|
|
|
|
<br>
|
|
|
|
<?php
|
2022-10-29 05:41:05 -07:00
|
|
|
$type = isset($_REQUEST["t"]) ? (int) $_REQUEST["t"] : 0;
|
|
|
|
echo "<button class=\"hide\" name=\"t\" value=\"$type\"/></button>";
|
2022-02-17 12:14:56 -08:00
|
|
|
?>
|
2022-05-19 03:46:39 -07:00
|
|
|
<button type="submit" class="hide"></button>
|
2022-02-24 13:29:10 -08:00
|
|
|
<input type="hidden" name="p" value="0">
|
|
|
|
<div class="sub-search-button-wrapper">
|
2023-01-06 11:19:30 -08:00
|
|
|
<?php
|
2023-01-13 00:31:48 -08:00
|
|
|
$categories = array("general", "images", "videos", "torrents", "tor");
|
|
|
|
|
|
|
|
foreach ($categories as $category)
|
|
|
|
{
|
|
|
|
$category_index = array_search($category, $categories);
|
2023-01-13 04:08:12 -08:00
|
|
|
|
|
|
|
if (($config->disable_bittorent_search && $category_index == 3) ||
|
|
|
|
($config->disable_hidden_service_search && $category_index ==4))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2023-08-07 14:42:45 -07:00
|
|
|
echo "<a " . (($category_index == $type) ? "class=\"active\" " : "") . "href=\"./search.php?q=" . $query . "&p=0&t=" . $category_index . "\"><img src=\"static/images/" . $category . "_result.png\" alt=\"" . $category . " result\" />" . ucfirst($category) . "</a>";
|
2023-01-13 00:31:48 -08:00
|
|
|
}
|
2023-01-06 11:19:30 -08:00
|
|
|
?>
|
2022-02-17 12:14:56 -08:00
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
</form>
|
|
|
|
|
2022-02-20 09:11:15 -08:00
|
|
|
<?php
|
2022-02-21 13:00:59 -08:00
|
|
|
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
|
2022-03-04 01:36:31 -08:00
|
|
|
$start_time = microtime(true);
|
2022-02-20 13:57:23 -08:00
|
|
|
|
2023-08-21 13:55:24 -07:00
|
|
|
$mh = curl_multi_init();
|
|
|
|
$search_category = init_search($type, $query, $page, $mh, $config);
|
|
|
|
|
|
|
|
$running = null;
|
|
|
|
|
|
|
|
do {
|
|
|
|
curl_multi_exec($mh, $running);
|
|
|
|
} while ($running);
|
|
|
|
|
|
|
|
$results = $search_category->get_results($query, $page);
|
|
|
|
print_elapsed_time($start_time);
|
|
|
|
$search_category->print_results($results);
|
2022-02-25 01:42:32 -08:00
|
|
|
|
2022-09-03 10:45:47 -07:00
|
|
|
if (2 > $type)
|
2022-02-21 13:00:59 -08:00
|
|
|
{
|
2022-02-24 13:29:10 -08:00
|
|
|
echo "<div class=\"next-page-button-wrapper\">";
|
2022-02-20 13:57:23 -08:00
|
|
|
|
2022-08-28 11:41:33 -07:00
|
|
|
if ($page != 0)
|
2022-02-21 13:00:59 -08:00
|
|
|
{
|
2022-08-28 11:41:33 -07:00
|
|
|
print_next_page_button("<<", 0, $query, $type);
|
2022-02-25 01:42:32 -08:00
|
|
|
print_next_page_button("<", $page - 10, $query, $type);
|
2022-02-21 13:00:59 -08:00
|
|
|
}
|
2022-08-28 11:41:33 -07:00
|
|
|
|
2022-02-21 13:00:59 -08:00
|
|
|
for ($i=$page / 10; $page / 10 + 10 > $i; $i++)
|
2022-02-25 01:42:32 -08:00
|
|
|
print_next_page_button($i + 1, $i * 10, $query, $type);
|
2022-02-20 13:57:23 -08:00
|
|
|
|
2022-02-25 01:42:32 -08:00
|
|
|
print_next_page_button(">", $page + 10, $query, $type);
|
2022-02-20 13:57:23 -08:00
|
|
|
|
2022-12-28 02:20:38 -08:00
|
|
|
echo "</div>";
|
2022-02-20 09:11:15 -08:00
|
|
|
}
|
|
|
|
?>
|
2022-02-17 12:14:56 -08:00
|
|
|
|
2022-05-15 01:34:46 -07:00
|
|
|
<?php require "misc/footer.php"; ?>
|