diff options
author | Jim Wigginton <terrafrost@phpbb.com> | 2009-08-21 21:47:19 +0000 |
---|---|---|
committer | Jim Wigginton <terrafrost@phpbb.com> | 2009-08-21 21:47:19 +0000 |
commit | 69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2 (patch) | |
tree | 6e613c5e9d1d2cffee1f877daa47fbdf1d2bccef /phpBB/includes/functions_admin.php | |
parent | a3c00e88d919a7b352635d869d068e163288b143 (diff) | |
download | forums-69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2.tar forums-69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2.tar.gz forums-69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2.tar.bz2 forums-69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2.tar.xz forums-69aa05376bd6cd04e23b6edcfe0d44e9e5f5f7e2.zip |
- replaced the drop down menu log filter thing with log searching
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10041 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 2f8670a147..d84216701a 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -338,13 +338,12 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm return false; } - // Check if source forum exists + // Check if source forums exists $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $src_forum_id; $result = $db->sql_query($sql); $src_forum_name = $db->sql_fetchfield('forum_name'); - $db->sql_freeresult($result); // Source forum doesn't exist if (empty($src_forum_name)) @@ -358,7 +357,6 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); $result = $db->sql_query($sql); - $dest_forum_ids = $dest_forum_names = array(); while ($row = $db->sql_fetchrow($result)) { $dest_forum_ids[] = (int) $row['forum_id']; @@ -2497,7 +2495,7 @@ function cache_moderators() /** * View log */ -function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $log_operation = '') +function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '') { global $db, $user, $auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; @@ -2548,12 +2546,40 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id return; } + $keywords = preg_split('#[\s+\-|*()]+#u', utf8_strtolower(preg_quote($keywords, '#')), 0, PREG_SPLIT_NO_EMPTY); + $sql_keywords = ''; + + if (!empty($keywords)) + { + $keywords_pattern = '#' . implode('|', $keywords) . '#ui'; + for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) + { + $keywords[$i] = $db->sql_like_expression($db->any_char . $keywords[$i] . $db->any_char); + } + + $operations = array(); + foreach ($user->lang as $key=>$value) + { + if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value)) + { + $operations[] = $key; + } + } + + $sql_keywords = 'AND ('; + if (!empty($operations)) + { + $sql_keywords.= $db->sql_in_set('l.log_operation', $operations) . ' OR '; + } + $sql_keywords.= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')'; + } + $sql = "SELECT l.*, u.username, u.username_clean, u.user_colour FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u WHERE l.log_type = $log_type AND u.user_id = l.user_id - " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . - (!empty($log_operation) ? " AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " + " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . " + $sql_keywords $sql_forum ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); @@ -2718,8 +2744,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $sql = 'SELECT COUNT(l.log_id) AS total_entries FROM ' . LOG_TABLE . " l WHERE l.log_type = $log_type - AND l.log_time >= $limit_days " . - (!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " + AND l.log_time >= $limit_days + $sql_keywords $sql_forum"; $result = $db->sql_query($sql); $log_count = (int) $db->sql_fetchfield('total_entries'); |