From 1d00ea3de4d730384647c8da52cb1b83d5fffb17 Mon Sep 17 00:00:00 2001 From: Vitalychez Date: Sat, 20 Dec 2014 03:37:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20log=5Fusername?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Удаление log_username и чистка admin_log.php --- admin/admin_log.php | 57 ++++++++++------------------------ install/sql/mysql.sql | 1 - library/includes/functions.php | 3 -- 3 files changed, 16 insertions(+), 45 deletions(-) diff --git a/admin/admin_log.php b/admin/admin_log.php index 2e53c4099..5c457b62b 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -135,9 +135,6 @@ if ($var =& $_REQUEST[$topic_key]) $url = ($topic_csv) ? url_arg($url, $topic_key, $topic_csv) : $url; } -// Order -$order_val = 'log_time'; - // Sort $sort_val = $def_sort; @@ -188,42 +185,20 @@ if ($var =& $_REQUEST[$title_match_key]) // // SQL // -$select = "SELECT *"; +$where = " WHERE l.log_time BETWEEN '$time_start_val' AND '$time_end_val'"; +$where .= ($type_csv) ? " AND l.log_type_id IN($type_csv)" : ''; +$where .= ($user_csv) ? " AND l.log_user_id IN($user_csv)" : ''; +$where .= ($forum_csv) ? " AND l.log_forum_id IN($forum_csv)" : ''; +$where .= ($topic_csv) ? " AND l.log_topic_id IN($topic_csv)" : ''; +$where .= ($title_match_sql) ? " AND MATCH (l.log_topic_title) AGAINST ('$title_match_sql' IN BOOLEAN MODE)" : ''; -$from = "FROM ". BB_LOG; - -$where = " - WHERE log_time BETWEEN $time_start_val AND $time_end_val -"; -$where .= ($type_csv) ? " - AND log_type_id IN($type_csv) -" : ''; -$where .= ($user_csv) ? " - AND log_user_id IN($user_csv) -" : ''; -$where .= ($forum_csv) ? " - AND log_forum_id IN($forum_csv) -" : ''; -$where .= ($topic_csv) ? " - AND log_topic_id IN($topic_csv) -" : ''; -$where .= ($title_match_sql) ? " - AND MATCH (log_topic_title) AGAINST ('$title_match_sql' IN BOOLEAN MODE) -" : ''; - -$order = "ORDER BY $order_val"; - -$sort = $sort_val; - -$limit = "LIMIT $start, ". ($per_page + 1); - -$sql = " - $select - $from +$sql = "SELECT l.*, u.* + FROM ". BB_LOG ." l + LEFT JOIN ". BB_USERS ." u ON(u.user_id = l.log_user_id) $where - $order - $sort - $limit + ORDER BY l.log_time + $sort_val + LIMIT $start, ". ($per_page + 1)." "; $log_rowset = DB()->fetch_rowset($sql); @@ -302,7 +277,7 @@ if ($log_rowset) 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'USER_ID' => $row['log_user_id'], - 'USERNAME' => $row['log_username'], + 'USERNAME' => profile_url($row), 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_IP' => decode_ip($row['log_user_ip']), @@ -351,12 +326,12 @@ if ($log_rowset) $filter['forums'][$forum_name] = true; } // Users - if ($user_csv && empty($filter['users'][$row['log_username']])) + if ($user_csv && empty($filter['users'])) { $template->assign_block_vars('users', array( - 'USERNAME' => $row['log_username'], + 'USERNAME' => profile_url($row), )); - $filter['users'][$row['log_username']] = true; + $filter['users'] = true; } } diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index e4aa55ddc..1973d8723 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -666,7 +666,6 @@ DROP TABLE IF EXISTS `bb_log`; CREATE TABLE IF NOT EXISTS `bb_log` ( `log_type_id` mediumint(8) unsigned NOT NULL DEFAULT '0', `log_user_id` mediumint(9) NOT NULL DEFAULT '0', - `log_username` varchar(25) NOT NULL DEFAULT '', `log_user_ip` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `log_forum_id` smallint(5) unsigned NOT NULL DEFAULT '0', `log_forum_id_new` smallint(5) unsigned NOT NULL DEFAULT '0', diff --git a/library/includes/functions.php b/library/includes/functions.php index 39e1b0faa..72f7be5c8 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -1936,20 +1936,17 @@ class log_action if (!empty($userdata)) { $user_id = $userdata['user_id']; - $username = $userdata['username']; $session_ip = $userdata['session_ip']; } else { $user_id = ''; - $username = defined('IN_CRON') ? 'cron' : CLIENT_IP; $session_ip = ''; } $sql_ary = array( 'log_type_id' => (int) $this->log_type["$type_name"], 'log_user_id' => (int) $user_id, - 'log_username' => (string) $username, 'log_user_ip' => (string) $session_ip, 'log_forum_id' => (int) $forum_id, 'log_forum_id_new' => (int) $forum_id_new,