mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-18 02:16:03 +01:00
change the search exclusion error to just be a blacklist via server side verification
This commit is contained in:
parent
ad653af082
commit
21cbdfef04
17
search.php
17
search.php
@ -9,27 +9,22 @@
|
|||||||
$queries_per_minutes_all = $config['search']['queries_per_minutes_all'];
|
$queries_per_minutes_all = $config['search']['queries_per_minutes_all'];
|
||||||
$search_limit = $config['search']['search_limit'];
|
$search_limit = $config['search']['search_limit'];
|
||||||
|
|
||||||
|
//Is there a whitelist? Let's list those boards and if not, let's list everything.
|
||||||
if (isset($config['search']['boards'])) {
|
if (isset($config['search']['boards'])) {
|
||||||
$boards = $config['search']['boards'];
|
$boards = $config['search']['boards'];
|
||||||
} else {
|
} else {
|
||||||
$boards = listBoards(TRUE);
|
$boards = listBoards(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Let's remove any disallowed boards from the above list (the blacklist)
|
||||||
|
if (isset($config['search']['disallowed_boards'])) {
|
||||||
|
$boards = array_values(array_diff($boards, $config['search']['disallowed_boards']));
|
||||||
|
}
|
||||||
|
|
||||||
$body = Element('search_form.html', Array('boards' => $boards, 'board' => isset($_GET['board']) ? $_GET['board'] : false, 'search' => isset($_GET['search']) ? str_replace('"', '"', utf8tohtml($_GET['search'])) : false));
|
$body = Element('search_form.html', Array('boards' => $boards, 'board' => isset($_GET['board']) ? $_GET['board'] : false, 'search' => isset($_GET['search']) ? str_replace('"', '"', utf8tohtml($_GET['search'])) : false));
|
||||||
|
|
||||||
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
|
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
|
||||||
|
|
||||||
//Before we do any of that, is this a disallowed board? If so, don't allow people to peer into it.
|
|
||||||
if (in_array($_GET['board'], $config['search']['disallowed_boards'])) {
|
|
||||||
$body .= '<hr/><p class="unimportant" style="text-align:center">('._('Disallowed board.').')</p>';
|
|
||||||
echo Element($config['file_page_template'], Array(
|
|
||||||
'config'=>$config,
|
|
||||||
'title'=>'Search',
|
|
||||||
'body'=>$body,
|
|
||||||
));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$phrase = $_GET['search'];
|
$phrase = $_GET['search'];
|
||||||
$_body = '';
|
$_body = '';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user