-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
186 lines (161 loc) · 6.88 KB
/
index.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="<?php require_once 'config.php'; echo $language; ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php require_once 'config.php'; echo $description; ?>">
<!-- <meta name="author" content=""> -->
<?php require_once 'config.php';
if($can_track) {
echo "<meta name=\"robots\" content=\"index, follow\">";
}
else {
echo "<meta name=\"robots\" content=\"noindex, nofollow, noarchive\">";
}
?>
<title><?php require_once 'config.php'; echo $title; ?></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/spectre.css/0.5.8/spectre.min.css">
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/spectre.css/0.5.8/spectre-exp.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/spectre.css/0.5.8/spectre-icons.min.css"> -->
<link rel="stylesheet" href="css/main.css">
</head>
<body class="container grid-xl">
<header>
<nav class="navbar">
<section class="navbar-section">
<?php require_once 'config.php';
require_once 'xdcc.php';
//test if bot is get + if website else show main
/* A variable is considered empty
* if it does not exist
* if its value equals FALSE
* else the var exists AND has a non-empty, non-zero value.
*/
echo "<p>";
if (isset($_GET['bot'])) {
$b = returnObject(getBotList(), urldecode($_GET['bot']));
if ($b !== null) {
if (!empty($b->getWebsite())) {
echo "<a href=\"{$b->getWebsite()}\" class=\"btn\" title=\"{$lang[$language]['Bot_website']} {$b->getName()}\">{$lang[$language]['website']}</a>";
}
if (!empty($b->getIRC())) {
echo "<a href=\"{$b->getIRC()}\" class=\"btn\" title=\"{$lang[$language]['Bot_irc']} {$b->getName()}\">{$lang[$language]['IRC']}</a>";
}
}
}
else {
if (!empty($website_link)) {
echo "<a href=\"$website_link\" class=\"btn\" title=\"{$lang[$language]['website']}\">$website_label</a>";
}
if (!empty($irc_link)) {
echo "<a href=\"$irc_link\" class=\"btn\" title=\"{$lang[$language]['IRC']}\">$irc_label</a>";
}
}
echo "</p>";
?>
</section>
<section class="navbar-center">
<h1><?php require_once 'config.php'; echo $title; ?></h1>
</section>
<section class="navbar-section">
<form name="searchform">
<fieldset class="input-group input-inline">
<input type="text" name="search" class="form-input" placeholder="<?php require_once 'config.php'; echo $lang[$language]['Search_on']; ?>" <?php if(!empty($_GET['search'])) echo "value=\"{$_GET['search']}\"";?> required/>
<select name="bot" class="form-select">
<option value=""><?php require_once 'config.php'; echo $lang[$language]['ALL_BOTS']; ?></option>
<?php require_once 'xdcc.php';
$bots = getBotList();
foreach($bots as $bot) {
if (!empty($_GET['bot']) && $bot->getName() === urldecode($_GET['bot'])) {
echo "<option value=\"{$bot->getName()}\" selected>{$bot->getName()}</option>";
}
else {
echo "<option value=\"{$bot->getName()}\">{$bot->getName()}</option>";
}
}
?>
</select>
<input type="submit" class="btn btn-primary input-group-btn" value="Search"/>
</fieldset>
</form>
</section>
</nav>
</header>
<section class="columns">
<div class="column col-3 col-md-12">
<div class="panel">
<div class="panel-header">
<h2 class="panel-title"><?php require_once 'config.php'; echo $lang[$language]['Bots']; ?></h2>
<?php require_once 'xdcc.php';
$bots = getBotList();
echo "<ul class=\"panel-body\">";
foreach($bots as &$bot) {
echo "<li class=\"tile tile-centered\"><a class=\"tile-content\" href=\"?bot=" . urlencode($bot->getName()) . "\" title=\"{$bot->getName()}\"><div class=\"tile-title\">{$bot->getName()}</div></a></li>";
}
echo "</ul>";
?>
</div>
</div>
<?php require_once 'config.php';
if ($bookmark) {
echo "<div class=\"panel\">
<div class=\"panel-header\">
<h2 class=\"panel-title\">{$lang[$language]['Bookmarks']}</h2>";
require_once 'xdcc.php';
$bookmarks = getBookmarkList();
echo "<ul class=\"panel-body\">";
foreach($bookmarks as &$b) {
echo "<li class=\"tile tile-centered\"><a class=\"tile-content\" href=\"?search=" . urlencode($b->getStringSearch()) . "&bot=" . urlencode($b->getBotSearch()) . "\" title=\"{$b->getName()}\"><div class=\"tile-title\">{$b->getName()}</div></a></li>";
}
echo "</ul>
</div>
</div>";
}
?>
</div>
<div class="column col-8 col-md-12 col-ml-auto">
<h2><?php require_once 'config.php'; if(!empty($_GET['bot'])) echo " — {$lang[$language]['Bot:']} <code>" . htmlspecialchars($_GET['bot']) . "</code>" . " <a href=\"syndication.php?bot=" . urlencode($_GET['bot']) . "\"> <img class=\"icon\" src=\"img/Feed_icon.svg\"></a>"; if(isset($_GET['search'])) echo " — {$lang[$language]['Search:']} <code>" . htmlspecialchars($_GET['search']) . "</code>"; ?></h2>
<div><?php
require_once 'config.php';
if (!isset($_GET['bot']) && !isset($_GET['search'])) { //if none set, show an error
echo "<div class=\"\">{$lang[$language]['choose_bot']}</div>";
}
else if (empty($_GET['bot'])) { //if bot is empty, search in all bot
echo searchBotsList($_GET['search']);
}
else { //if bot, show all the list OR show the search on a bot
require_once 'xdcc.php';
echo '<table class="table" id="filelist">';
$xml = haveXMLContent(searchBotXMLContent(getBotList(), urldecode($_GET['bot'])));
if (!$xml || !$xml->packlist->pack)
echo "<thead><tr id=\"trmain\"><th>{$lang[$language]['Fail_load_XML']}</th></tr><thead>";
else {
echo "<thead><tr id=\"trmain\">";
echo "<th class=\"text-center\">{$lang[$language]['Pack']}</th>";
echo "<th class=\"text-center\">{$lang[$language]['Size']}</th>";
echo "<th class=\"text-center\">{$lang[$language]['File']}</th>";
echo "</tr><thead>";
echo searchBotList($xml, $_GET['bot'], empty($_GET['search']) ? null : $_GET['search']);
}
echo "</table>";
}
?>
</div>
</div>
</section>
<footer class="text-center">
<?php require_once 'config.php';
echo $lang[$language]['Powered']; ?> <a href="https://github.com/Kcchouette/XDCC-simple"> XDCC Simple</a> — <a href="admin.php"><?php require_once 'config.php';
echo $lang[$language]['Admin_page']; ?></a>
</footer>
<script type="text/javascript">
function paste(bot, pack){
<?php
require_once 'config.php';
echo "window.prompt(\"{$lang[$language]['Paste_windows']}\", \"/msg \" + bot + \" xdcc send #\" + pack);";
?>
}
</script>
</body>
</html>