summaryrefslogtreecommitdiff
path: root/search.php
diff options
context:
space:
mode:
Diffstat (limited to 'search.php')
-rw-r--r--search.php28
1 files changed, 8 insertions, 20 deletions
diff --git a/search.php b/search.php
index 394aa3ff..e05bda63 100644
--- a/search.php
+++ b/search.php
@@ -15,7 +15,7 @@
$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', ['boards' => $boards, 'board' => $_GET['board'] ?? false, 'search' => isset($_GET['search']) ? str_replace('"', '"', (string) utf8tohtml($_GET['search'])) : false]);
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
$phrase = $_GET['search'];
@@ -50,14 +50,14 @@
openBoard($_GET['board']);
- $filters = Array();
+ $filters = [];
function search_filters($m) {
global $filters;
$name = $m[2];
- $value = isset($m[4]) ? $m[4] : $m[3];
+ $value = $m[4] ?? $m[3];
- if(!in_array($name, array('id', 'thread', 'subject', 'name'))) {
+ if(!in_array($name, ['id', 'thread', 'subject', 'name'])) {
// unknown filter
return $m[0];
}
@@ -72,11 +72,7 @@
if(!preg_match('/[^*^\s]/', $phrase) && empty($filters)) {
_syslog(LOG_WARNING, 'Query too broad.');
$body .= '<p class="unimportant" style="text-align:center">(Query too broad.)</p>';
- echo Element('page.html', Array(
- 'config'=>$config,
- 'title'=>'Search',
- 'body'=>$body,
- ));
+ echo Element('page.html', ['config'=>$config, 'title'=>'Search', 'body'=>$body]);
exit;
}
@@ -93,7 +89,7 @@
$phrase = str_replace('`', '!`', $phrase);
$like = '';
- $match = Array();
+ $match = [];
// Find exact phrases
if(preg_match_all('/"(.+?)"/', $phrase, $m)) {
@@ -133,11 +129,7 @@
if($query->rowCount() == $search_limit) {
_syslog(LOG_WARNING, 'Query too broad.');
$body .= '<p class="unimportant" style="text-align:center">('._('Query too broad.').')</p>';
- echo Element('page.html', Array(
- 'config'=>$config,
- 'title'=>'Search',
- 'body'=>$body,
- ));
+ echo Element('page.html', ['config'=>$config, 'title'=>'Search', 'body'=>$body]);
exit;
}
@@ -167,8 +159,4 @@
$body .= '<p style="text-align:center" class="unimportant">('._('No results.').')</p>';
}
- echo Element('page.html', Array(
- 'config'=>$config,
- 'title'=>_('Search'),
- 'body'=>'' . $body
- ));
+ echo Element('page.html', ['config'=>$config, 'title'=>_('Search'), 'body'=>'' . $body]);