post search: i18n fix; move from post to get, since this method is more suitable for search

This commit is contained in:
czaks 2013-07-20 20:39:41 -04:00
parent 6c05d73f28
commit faa7cf473f
2 changed files with 7 additions and 7 deletions

View File

@ -11,10 +11,10 @@
$boards = $config['search']['boards'];
$body = Element('search_form.html', Array('boards' => $boards, 'board' => isset($_POST['board']) ? $_POST['board'] : false, 'search' => isset($_POST['search']) ? str_replace('"', '"', utf8tohtml($_POST['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($_POST['search']) && !empty($_POST['search']) && isset($_POST['board']) && in_array($_POST['board'], $boards)) {
$phrase = $_POST['search'];
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
$phrase = $_GET['search'];
$_body = '';
$query = prepare("SELECT COUNT(*) FROM `search_queries` WHERE `ip` = :ip AND `time` > :time");
@ -37,14 +37,14 @@
$query->bindValue(':query', $phrase);
$query->execute() or error(db_error($query));
_syslog(LOG_NOTICE, 'Searched /' . $_POST['board'] . '/ for "' . $phrase . '"');
_syslog(LOG_NOTICE, 'Searched /' . $_GET['board'] . '/ for "' . $phrase . '"');
// Cleanup search queries table
$query = prepare("DELETE FROM `search_queries` WHERE `time` <= :time");
$query->bindValue(':time', time() - ($queries_per_minutes_all[1] * 60));
$query->execute() or error(db_error($query));
openBoard($_POST['board']);
openBoard($_GET['board']);
$filters = Array();

View File

@ -1,9 +1,9 @@
<div class="ban">
<h2>{% trans %}Search{% endtrans %}</h2>
<form style="display:inline" action="" method="post">
<form style="display:inline" action="" method="get">
<p>
<label style="display:inline" for="search">{% trans %}Phrase:{% endtrans %}</label>
<input id="search" name="search" type="text" size="55" value="{{ search }}">
<input id="search" name="search" type="text" size="40" value="{{ search }}">
<select name="board">
<option value="none">{% trans %}Select board{% endtrans %}&hellip;</option>
{% for b in boards %}