2022-03-11 06:04:36 -03:00
|
|
|
<?php require "misc/header.php"; ?>
|
2022-03-04 06:36:31 -03:00
|
|
|
|
2022-09-03 13:45:47 -04:00
|
|
|
<title>
|
|
|
|
<?php
|
|
|
|
$query = htmlspecialchars(trim($_REQUEST["q"]));
|
|
|
|
echo $query;
|
|
|
|
?> - LibreX</title>
|
2022-02-25 06:42:32 -03:00
|
|
|
</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-09-16 05:23:57 -03:00
|
|
|
<h1 class="logomobile"><a class="no-decoration" href="./">Libre<span class="X">X</span></a></h1>
|
2022-08-28 14:41:33 -04:00
|
|
|
<input type="text" name="q"
|
2022-02-17 17:14:56 -03:00
|
|
|
<?php
|
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-08-28 14:41:33 -04:00
|
|
|
}
|
|
|
|
|
2022-02-19 17:40:56 -03:00
|
|
|
echo "value=\"$query\"";
|
2022-02-17 17:14:56 -03:00
|
|
|
?>
|
|
|
|
>
|
|
|
|
<br>
|
|
|
|
<?php
|
2022-10-25 08:02:01 -03:00
|
|
|
foreach($_REQUEST as $key=>$value)
|
|
|
|
{
|
|
|
|
if ($key != "q" && $key != "p" && $key != "t")
|
|
|
|
{
|
2022-12-03 10:52:31 -03:00
|
|
|
echo "<input type=\"hidden\" name=\"" . htmlspecialchars($key) . "\" value=\"" . htmlspecialchars($value) . "\"/>";
|
2022-10-25 08:02:01 -03:00
|
|
|
}
|
|
|
|
}
|
2022-10-29 09:41:05 -03:00
|
|
|
|
|
|
|
$type = isset($_REQUEST["t"]) ? (int) $_REQUEST["t"] : 0;
|
|
|
|
echo "<button class=\"hide\" name=\"t\" 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-10-25 08:02:01 -03:00
|
|
|
<button name="t" value="0"><img src="static/images/text_result.png" alt="text result" />General</button>
|
|
|
|
<button name="t" value="1"><img src="static/images/image_result.png" alt="image result" />Images</button>
|
|
|
|
<button name="t" value="2"><img src="static/images/video_result.png" alt="video result" />Videos</button>
|
|
|
|
<button name="t" value="3"><img src="static/images/torrent_result.png" alt="torrent result" />Torrents</button>
|
2022-12-02 05:41:12 -03:00
|
|
|
<button name="t" value="4"><img src="static/images/tor_result.png" alt="tor result" />Tor</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
|
|
|
|
2022-10-29 09:41:05 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
|
2022-08-28 14:41:33 -04:00
|
|
|
|
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-09-16 05:23:57 -03:00
|
|
|
$query_parts = explode(" ", $query);
|
|
|
|
$last_word_query = end($query_parts);
|
|
|
|
if (substr($query, 0, 1) == "!" || substr($last_word_query, 0, 1) == "!")
|
2022-07-08 15:52:26 -04:00
|
|
|
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-12-24 14:07:53 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-12-28 07:20:38 -03:00
|
|
|
print_text_results($results);
|
2022-02-21 18:00:59 -03:00
|
|
|
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-12-24 14:07:53 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-12-28 07:20:38 -03:00
|
|
|
print_image_results($results);
|
2022-02-21 18:00:59 -03:00
|
|
|
break;
|
2022-02-25 06:42:32 -03:00
|
|
|
|
2022-02-21 18:00:59 -03:00
|
|
|
case 2:
|
2022-09-03 13:45:47 -04:00
|
|
|
require "engines/brave/video.php";
|
|
|
|
$results = get_video_results($query_encoded);
|
2022-12-24 14:07:53 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-12-28 07:20:38 -03:00
|
|
|
print_video_results($results);
|
2022-02-21 18:00:59 -03:00
|
|
|
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-12-24 14:07:53 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-12-28 07:20:38 -03:00
|
|
|
print_merged_torrent_results($results);
|
2022-02-25 06:42:32 -03:00
|
|
|
}
|
2022-11-20 15:00:45 -03:00
|
|
|
break;
|
2022-08-28 14:41:33 -04:00
|
|
|
|
2022-11-20 15:00:45 -03:00
|
|
|
case 4:
|
|
|
|
if ($config->disable_hidden_service_search)
|
|
|
|
echo "<p class=\"text-result-container\">The host disabled this feature! :C</p>";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
require "engines/ahmia/hidden_service.php";
|
|
|
|
$results = get_hidden_service_results($query_encoded);
|
2022-12-24 14:07:53 -03:00
|
|
|
print_elapsed_time($start_time);
|
2022-12-28 07:20:38 -03:00
|
|
|
print_hidden_service_results($results);
|
2022-11-20 15:00:45 -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-09-03 13:45:47 -04:00
|
|
|
if (2 > $type)
|
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-08-28 14:41:33 -04:00
|
|
|
if ($page != 0)
|
2022-02-21 18:00:59 -03:00
|
|
|
{
|
2022-08-28 14:41:33 -04:00
|
|
|
print_next_page_button("<<", 0, $query, $type);
|
2022-02-25 06:42:32 -03:00
|
|
|
print_next_page_button("<", $page - 10, $query, $type);
|
2022-02-21 18:00:59 -03:00
|
|
|
}
|
2022-08-28 14:41:33 -04:00
|
|
|
|
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-12-28 07:20:38 -03:00
|
|
|
echo "</div>";
|
2022-02-20 14:11:15 -03:00
|
|
|
}
|
|
|
|
?>
|
2022-02-17 17:14:56 -03:00
|
|
|
|
2022-05-15 04:34:46 -04:00
|
|
|
<?php require "misc/footer.php"; ?>
|