diff options
| author | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
|---|---|---|
| committer | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
| commit | 2c69095a1edf7474073451285238659d0f62ce3f (patch) | |
| tree | 5dee476605402c66dc2853d0836b29f6aedae62b /search.php | |
| parent | e9a61e2fbbd930eaa80d6a5f33420cedc59d748c (diff) | |
PHP8.1 fixes from Rector
Diffstat (limited to 'search.php')
| -rw-r--r-- | search.php | 28 |
1 files changed, 8 insertions, 20 deletions
@@ -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]); |
