forked from GithubBackups/vichan
Merge pull request #739 from vichan-devel/RealAngeleno-searchexclusion
Allow board exclusion for search
This commit is contained in:
commit
a7cb62349c
@ -1854,6 +1854,9 @@
|
||||
// Boards for searching
|
||||
//$config['search']['boards'] = array('a', 'b', 'c', 'd', 'e');
|
||||
|
||||
// Blacklist boards for searching, basically the opposite of the one above
|
||||
//$config['search']['disallowed_boards'] = array('j', 'z');
|
||||
|
||||
// Enable public logs? 0: NO, 1: YES, 2: YES, but drop names
|
||||
$config['public_logs'] = 0;
|
||||
|
||||
|
@ -9,15 +9,22 @@
|
||||
$queries_per_minutes_all = $config['search']['queries_per_minutes_all'];
|
||||
$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'])) {
|
||||
$boards = $config['search']['boards'];
|
||||
} else {
|
||||
$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));
|
||||
|
||||
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
|
||||
|
||||
$phrase = $_GET['search'];
|
||||
$_body = '';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user