summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-07-29 23:17:37 -0400
committerczaks <marcin@6irc.net>2013-07-29 23:17:37 -0400
commit793042ee6ccd2fd1770c68ed55bfb1f58f2bf185 (patch)
tree12bf0428a870e33b5a7fffe60f220306df246ca0
parent9a27feca018802bc974dc2542d4afd94e5f9e523 (diff)
parent54714595f7ce2cdbd88de1c536e0ddc97ca71529 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: js/inline-expanding.js
-rw-r--r--inc/mod/pages.php16
-rw-r--r--js/inline-expanding.js18
-rw-r--r--templates/mod/search_results.html2
3 files changed, 26 insertions, 10 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index edb14c6d..eb218951 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -174,6 +174,11 @@ function mod_search_redirect() {
$query = str_replace('_', '%5F', $query);
$query = str_replace('+', '_', $query);
+ if ($query === '') {
+ header('Location: ?/', true, $config['redirect_http']);
+ return;
+ }
+
header('Location: ?/search/' . $_POST['type'] . '/' . $query, true, $config['redirect_http']);
} else {
header('Location: ?/', true, $config['redirect_http']);
@@ -225,7 +230,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) {
// Which `field` to search?
if ($type == 'posts')
- $sql_field = 'body_nomarkup';
+ $sql_field = array('body_nomarkup', 'filename', 'subject', 'filehash', 'ip', 'name', 'trip');
if ($type == 'IP_notes')
$sql_field = 'body';
if ($type == 'bans')
@@ -239,7 +244,14 @@ function mod_search($type, $search_query_escaped, $page_no = 1) {
if (!empty($sql_like))
$sql_like .= ' AND ';
$phrase = preg_replace('/^\'(.+)\'$/', '\'%$1%\'', $phrase);
- $sql_like .= '`' . $sql_field . '` LIKE ' . $phrase . ' ESCAPE \'!\'';
+ if (is_array($sql_field)) {
+ foreach ($sql_field as $field) {
+ $sql_like .= '`' . $field . '` LIKE ' . $phrase . ' ESCAPE \'!\' OR';
+ }
+ $sql_like = preg_replace('/ OR$/', '', $sql_like);
+ } else {
+ $sql_like .= '`' . $sql_field . '` LIKE ' . $phrase . ' ESCAPE \'!\'';
+ }
}
diff --git a/js/inline-expanding.js b/js/inline-expanding.js
index 0f7b7229..24c67c36 100644
--- a/js/inline-expanding.js
+++ b/js/inline-expanding.js
@@ -6,7 +6,7 @@
* Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org>
*
* Usage:
- * $config['additional_javascript'][] = 'js/jquery.min.js';
+ * // $config['additional_javascript'][] = 'js/jquery.min.js';
* $config['additional_javascript'][] = 'js/inline-expanding.js';
*
*/
@@ -52,11 +52,15 @@ onready(function(){
}
}
- $('div[id^="thread_"]').each(inline_expand_post);
-
- // allow to work with auto-reload.js, etc.
- $(document).bind('new_post', function(e, post) {
- inline_expand_post.call(post);
- });
+ if (window.jQuery) {
+ $('div[id^="thread_"]').each(inline_expand_post);
+
+ // allow to work with auto-reload.js, etc.
+ $(document).bind('new_post', function(e, post) {
+ inline_expand_post.call(post);
+ });
+ } else {
+ inline_expand_post.call(document);
+ }
});
diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html
index fbad0381..0c87f75f 100644
--- a/templates/mod/search_results.html
+++ b/templates/mod/search_results.html
@@ -246,7 +246,7 @@
</td>
<td style="max-width:200px">
{% if post.file %}
- <small>{{ post.file }} ({{ post.filesize | filesize }})</small>
+ <small>{{ post.filename }} ({{ post.filesize | filesize }})</small>
{% else %}
&ndash;
{% endif %}