2022-03-11 06:04:36 -03:00
|
|
|
<?php require "misc/header.php"; ?>
|
2022-03-04 06:36:31 -03:00
|
|
|
|
2022-02-25 06:42:32 -03:00
|
|
|
<title> <?php echo $_REQUEST["q"]; ?> - LibreX</title>
|
|
|
|
</head>
|
2022-02-17 17:14:56 -03:00
|
|
|
<body>
|
2022-07-15 09:50:23 -04:00
|
|
|
<form class="sub-search-container" method="get" autocomplete="off">
|
2022-08-14 22:16:08 -04:00
|
|
|
<h1 class="logomobile"><a class="noDecoration" href="#">Libre<span class="X">X</span></a></h1>
|
2022-04-28 04:18:09 -04:00
|
|
|
<a href="./"><img class="logo" src="static/images/librex.png" alt="librex logo"></a>
|
2022-02-17 17:14:56 -03:00
|
|
|
<input type="text" name="q"
|
|
|
|
<?php
|
2022-05-15 04:34:46 -04:00
|
|
|
$query = htmlspecialchars(trim($_REQUEST["q"]));
|
2022-04-21 05:02:32 -04:00
|
|
|
$query_encoded = urlencode($query);
|
2022-02-17 17:14:56 -03:00
|
|
|
|
2022-02-19 17:40:56 -03:00
|
|
|
if (1 > strlen($query) || strlen($query) > 256)
|
2022-02-17 17:14:56 -03:00
|
|
|
{
|
2022-04-21 05:02:32 -04:00
|
|
|
header("Location: ./");
|
2022-02-17 17:14:56 -03:00
|
|
|
die();
|
2022-02-19 17:40:56 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "value=\"$query\"";
|
2022-02-17 17:14:56 -03:00
|
|
|
?>
|
|
|
|
>
|
|
|
|
<br>
|
|
|
|
<?php
|
2022-03-09 09:18:24 -03:00
|
|
|
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
|
2022-07-15 09:50:23 -04:00
|
|
|
echo "<button class=\"hide\" name=\"type\" value=\"$type\"/></button>";
|
2022-02-17 17:14:56 -03:00
|
|
|
?>
|
2022-05-19 06:46:39 -04:00
|
|
|
<button type="submit" class="hide"></button>
|
2022-02-24 18:29:10 -03:00
|
|
|
<input type="hidden" name="p" value="0">
|
|
|
|
<div class="sub-search-button-wrapper">
|
2022-08-13 02:47:02 -04:00
|
|
|
<button name="type" value="0"><i class="material-icons-round">manage_search</i>General</button>
|
|
|
|
<button name="type" value="1"><i class="material-icons-round">image_search</i>Images</button>
|
|
|
|
<button name="type" value="2"><i class="material-icons-round">movie</i>Videos</button>
|
|
|
|
<button name="type" value="3"><i class="material-icons-round">share</i>Torrents</button>
|
2022-02-17 17:14:56 -03:00
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
</form>
|
|
|
|
|
2022-02-20 14:11:15 -03:00
|
|
|
<?php
|
2022-03-11 06:04:36 -03:00
|
|
|
$config = require "config.php";
|
|
|
|
require "misc/tools.php";
|
2022-02-21 18:00:59 -03:00
|
|
|
|
|
|
|
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
|
2022-03-04 06:36:31 -03:00
|
|
|
|
|
|
|
$start_time = microtime(true);
|
2022-02-21 18:00:59 -03:00
|
|
|
switch ($type)
|
2022-02-20 18:57:23 -03:00
|
|
|
{
|
2022-02-21 18:00:59 -03:00
|
|
|
case 0:
|
2022-07-08 15:52:26 -04:00
|
|
|
if (substr($query, 0, 1) == "!")
|
|
|
|
check_ddg_bang($query);
|
2022-02-25 06:42:32 -03:00
|
|
|
require "engines/google/text.php";
|
2022-03-01 13:28:37 -03:00
|
|
|
$results = get_text_results($query, $page);
|
2022-03-04 06:36:31 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-02-21 18:00:59 -03:00
|
|
|
print_text_results($results);
|
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
case 1:
|
2022-07-08 15:52:26 -04:00
|
|
|
require "engines/qwant/image.php";
|
|
|
|
$results = get_image_results($query_encoded, $page);
|
2022-03-04 06:36:31 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-02-21 18:00:59 -03:00
|
|
|
print_image_results($results);
|
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
case 2:
|
2022-02-25 06:42:32 -03:00
|
|
|
require "engines/google/video.php";
|
|
|
|
$results = get_video_results($query_encoded, $page);
|
2022-03-04 06:36:31 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-02-21 18:00:59 -03:00
|
|
|
print_video_results($results);
|
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-02-24 18:29:10 -03:00
|
|
|
case 3:
|
2022-03-11 06:04:36 -03:00
|
|
|
if ($config->disable_bittorent_search)
|
2022-02-25 06:42:32 -03:00
|
|
|
echo "<p class=\"text-result-container\">The host disabled this feature! :C</p>";
|
|
|
|
else
|
|
|
|
{
|
2022-02-25 16:26:15 -03:00
|
|
|
require "engines/bittorrent/merge.php";
|
|
|
|
$results = get_merged_torrent_results($query_encoded);
|
2022-03-04 06:36:31 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-02-25 16:26:15 -03:00
|
|
|
print_merged_torrent_results($results);
|
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
}
|
|
|
|
|
2022-02-24 18:29:10 -03:00
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
default:
|
2022-02-25 06:42:32 -03:00
|
|
|
require "engines/google/text.php";
|
|
|
|
$results = get_text_results($query_encoded, $page);
|
2022-02-21 18:00:59 -03:00
|
|
|
print_text_results($results);
|
2022-03-04 06:36:31 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-02-21 18:00:59 -03:00
|
|
|
break;
|
|
|
|
}
|
2022-02-20 18:57:23 -03:00
|
|
|
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-07-08 15:52:26 -04:00
|
|
|
if ($type != 3)
|
2022-02-21 18:00:59 -03:00
|
|
|
{
|
2022-02-24 18:29:10 -03:00
|
|
|
echo "<div class=\"next-page-button-wrapper\">";
|
2022-02-20 18:57:23 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
if ($page != 0)
|
|
|
|
{
|
2022-02-25 06:42:32 -03:00
|
|
|
print_next_page_button("<<", 0, $query, $type);
|
|
|
|
print_next_page_button("<", $page - 10, $query, $type);
|
2022-02-21 18:00:59 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
for ($i=$page / 10; $page / 10 + 10 > $i; $i++)
|
2022-02-25 06:42:32 -03:00
|
|
|
print_next_page_button($i + 1, $i * 10, $query, $type);
|
2022-02-20 18:57:23 -03:00
|
|
|
|
2022-02-25 06:42:32 -03:00
|
|
|
print_next_page_button(">", $page + 10, $query, $type);
|
2022-02-20 18:57:23 -03:00
|
|
|
|
2022-02-20 14:11:15 -03:00
|
|
|
echo "</div>";
|
|
|
|
}
|
|
|
|
?>
|
2022-02-17 17:14:56 -03:00
|
|
|
|
2022-05-15 04:34:46 -04:00
|
|
|
<?php require "misc/footer.php"; ?>
|