mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Merge branch 'master' into hotfix/notices_in_admin_attach
# Conflicts: # library/attach_mod/includes/functions_admin.php
This commit is contained in:
commit
7023e386ac
7 changed files with 66 additions and 100 deletions
|
@ -190,25 +190,9 @@ function search_attachments($order_by, &$total_rows)
|
|||
|
||||
$where_sql = [];
|
||||
|
||||
$search_vars = [
|
||||
'search_keyword_fname',
|
||||
'search_keyword_comment',
|
||||
'search_author',
|
||||
'search_size_smaller',
|
||||
'search_size_greater',
|
||||
'search_count_smaller',
|
||||
'search_count_greater',
|
||||
'search_days_greater',
|
||||
'search_forum',
|
||||
];
|
||||
|
||||
for ($i = 0; $i < sizeof($search_vars); $i++) {
|
||||
$var = $search_vars[$i];
|
||||
$$var = get_var($var, null);
|
||||
}
|
||||
|
||||
// Author name search
|
||||
if (isset($search_author)) {
|
||||
$search_author = get_var('search_author', '');
|
||||
if ($search_author) {
|
||||
// Bring in line with 2.0.x expected username
|
||||
$search_author = addslashes(html_entity_decode($search_author));
|
||||
$search_author = stripslashes(clean_username($search_author));
|
||||
|
@ -237,41 +221,45 @@ function search_attachments($order_by, &$total_rows)
|
|||
}
|
||||
|
||||
// Search Keyword
|
||||
if (isset($search_keyword_fname)) {
|
||||
$search_keyword_fname = get_var('search_keyword_fname', '');
|
||||
if ($search_keyword_fname) {
|
||||
$match_word = str_replace('*', '%', $search_keyword_fname);
|
||||
$where_sql[] = " (a.real_filename LIKE '" . attach_mod_sql_escape($match_word) . "') ";
|
||||
}
|
||||
|
||||
if (isset($search_keyword_comment)) {
|
||||
$search_keyword_comment = get_var('search_keyword_comment', '');
|
||||
if ($search_keyword_comment) {
|
||||
$match_word = str_replace('*', '%', $search_keyword_comment);
|
||||
$where_sql[] = " (a.comment LIKE '" . attach_mod_sql_escape($match_word) . "') ";
|
||||
}
|
||||
|
||||
// Search Download Count
|
||||
if (isset($search_count_smaller) || isset($search_count_greater)) {
|
||||
if (!is_null($search_count_smaller)) {
|
||||
$where_sql[] = ' (a.download_count < ' . (int)$search_count_smaller . ') ';
|
||||
} elseif (!is_null($search_count_greater)) {
|
||||
$where_sql[] = ' (a.download_count > ' . (int)$search_count_greater . ') ';
|
||||
}
|
||||
$search_count_smaller = get_var('search_count_smaller', '');
|
||||
$search_count_greater = get_var('search_count_greater', '');
|
||||
if ($search_count_smaller != '') {
|
||||
$where_sql[] = ' (a.download_count < ' . (int)$search_count_smaller . ') ';
|
||||
} elseif ($search_count_greater != '') {
|
||||
$where_sql[] = ' (a.download_count > ' . (int)$search_count_greater . ') ';
|
||||
}
|
||||
|
||||
// Search Filesize
|
||||
if (isset($search_size_smaller) || isset($search_size_greater)) {
|
||||
if (!is_null($search_size_smaller)) {
|
||||
$where_sql[] = ' (a.filesize < ' . (int)$search_size_smaller . ') ';
|
||||
} elseif (!is_null($search_size_greater)) {
|
||||
$where_sql[] = ' (a.filesize > ' . (int)$search_size_greater . ') ';
|
||||
}
|
||||
$search_size_smaller = get_var('search_size_smaller', '');
|
||||
$search_size_greater = get_var('search_size_greater', '');
|
||||
if ($search_size_smaller != '') {
|
||||
$where_sql[] = ' (a.filesize < ' . (int)$search_size_smaller . ') ';
|
||||
} elseif ($search_size_greater != '') {
|
||||
$where_sql[] = ' (a.filesize > ' . (int)$search_size_greater . ') ';
|
||||
}
|
||||
|
||||
// Search Attachment Time
|
||||
if (isset($search_days_greater)) {
|
||||
$search_days_greater = get_var('search_days_greater', '');
|
||||
if ($search_days_greater) {
|
||||
$where_sql[] = ' (a.filetime < ' . (TIMENOW - ((int)$search_days_greater * 86400)) . ') ';
|
||||
}
|
||||
|
||||
// Search Forum
|
||||
if (isset($search_forum)) {
|
||||
$search_forum = get_var('search_forum', '');
|
||||
if ($search_forum) {
|
||||
$where_sql[] = ' (p.forum_id = ' . intval($search_forum) . ') ';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue