mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 23:50:11 +01:00
Enable search page for 8chan
This commit is contained in:
parent
18524e4810
commit
7e8823d538
@ -612,17 +612,27 @@ function hasPermission($action = null, $board = null, $_mod = null) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function listBoards() {
|
function listBoards($just_uri = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$just_uri ? $cache_name = 'all_boards_uri' : $cache_name = 'all_boards';
|
||||||
|
|
||||||
if ($config['cache']['enabled'] && ($boards = cache::get('all_boards')))
|
if ($config['cache']['enabled'] && ($boards = cache::get($cache_name)))
|
||||||
return $boards;
|
return $boards;
|
||||||
|
|
||||||
$query = query("SELECT ``boards``.`uri` uri, ``boards``.`title` title, ``boards``.`subtitle` subtitle, ``board_create``.`time` time FROM ``boards`` LEFT JOIN ``board_create`` ON ``boards``.`uri` = ``board_create``.`uri` ORDER BY ``boards``.`uri`") or error(db_error());
|
if (!$just_uri) {
|
||||||
$boards = $query->fetchAll();
|
$query = query("SELECT ``boards``.`uri` uri, ``boards``.`title` title, ``boards``.`subtitle` subtitle, ``board_create``.`time` time FROM ``boards`` LEFT JOIN ``board_create`` ON ``boards``.`uri` = ``board_create``.`uri` ORDER BY ``boards``.`uri`") or error(db_error());
|
||||||
|
$boards = $query->fetchAll();
|
||||||
|
} else {
|
||||||
|
$boards = array();
|
||||||
|
$query = query("SELECT `uri` FROM ``boards``") or error(db_error());
|
||||||
|
while ($board = $query->fetchColumn()) {
|
||||||
|
$boards[] = $board;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['cache']['enabled'])
|
if ($config['cache']['enabled'])
|
||||||
cache::set('all_boards', $boards);
|
cache::set($cache_name, $boards);
|
||||||
|
|
||||||
return $boards;
|
return $boards;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,11 @@
|
|||||||
$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'];
|
||||||
|
|
||||||
$boards = $config['search']['boards'];
|
if (isset($config['search']['boards'])) {
|
||||||
|
$boards = $config['search']['boards'];
|
||||||
|
} else {
|
||||||
|
$boards = listBoards(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
$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));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user