-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
79 lines (65 loc) · 2.76 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once "misc/header.php";
require_once "misc/tools.php";
require_once "misc/search_engine.php";
$opts = load_opts();
function print_page_buttons($type, $query, $page) {
if ($type > 1)
return;
echo "<div class=\"next-page-button-wrapper\">";
if ($page != 0)
{
print_next_page_button("<<", 0, $query, $type);
print_next_page_button("<", $page - 10, $query, $type);
}
for ($i=$page / 10; $page / 10 + 10 > $i; $i++)
print_next_page_button($i + 1, $i * 10, $query, $type);
print_next_page_button(">", $page + 10, $query, $type);
echo "</div>";
}
?>
<title>
<?php
echo $opts->query;
?> - YuruSearch</title>
</head>
<body>
<form class="sub-search-container" method="get" autocomplete="off">
<h1 class="logomobile"><a class="no-decoration" href="./">Yuru<span class="Y">Search</span></a></h1>
<input type="text" name="q"
<?php
if (1 > strlen($opts->query) || strlen($opts->query) > 256)
{
header("Location: ./");
die();
}
echo "value=\"" . htmlspecialchars($opts->query) . "\"";
?>
>
<br>
<?php
echo "<button class=\"hide\" name=\"t\" value=\"$opts->type\"/></button>";
?>
<button type="submit" class="hide"></button>
<input type="hidden" name="p" value="0">
<div class="sub-search-button-wrapper">
<?php
$categories = array("general", "images", "videos", "torrents", "tor", "maps");
foreach ($categories as $category)
{
$category_index = array_search($category, $categories);
if (($opts->disable_bittorrent_search && $category_index == 3) ||
($opts->disable_hidden_service_search && $category_index ==4))
{
continue;
}
echo "<a " . (($category_index == $opts->type) ? "class=\"active\" " : "") . "href=\"./search.php?q=" . urlencode($opts->query) . "&p=0&t=" . $category_index . "\"><img src=\"static/images/" . $category . "_result.png\" alt=\"" . $category . " result\" />" . TEXTS["category_$category"] . "</a>";
}
?>
</div>
</form>
<?php
fetch_search_results($opts, true);
print_page_buttons($opts->type, $opts->query, $opts->page);
?>
<?php require_once "misc/footer.php"; ?>