aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2011-07-14 04:05:20 +0200
committerJoas Schilling <nickvergessen@gmx.de>2011-07-14 04:05:20 +0200
commit8ebc8ec18277aea45079da3972e1ae0a3eb139ef (patch)
treee174ae4d73b8ef318146d6ad354a625ed456c996 /phpBB/includes/functions_admin.php
parente4707a8be75263e610b00b3d600144e797f576d9 (diff)
downloadforums-8ebc8ec18277aea45079da3972e1ae0a3eb139ef.tar
forums-8ebc8ec18277aea45079da3972e1ae0a3eb139ef.tar.gz
forums-8ebc8ec18277aea45079da3972e1ae0a3eb139ef.tar.bz2
forums-8ebc8ec18277aea45079da3972e1ae0a3eb139ef.tar.xz
forums-8ebc8ec18277aea45079da3972e1ae0a3eb139ef.zip
[ticket/5506] Do not display an empty last page after deleting logs.
The fix is copied from view_inactive_users(). Also add keywords and sort parameters to url for deleting logs and inactive users. And finally save some queries if there are no logs/users to display anyway
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php47
1 files changed, 32 insertions, 15 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index cb0cf34e69..f7e19f3e7d 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2595,6 +2595,31 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
}
+ if ($log_count !== false)
+ {
+ $sql = 'SELECT COUNT(l.log_id) AS total_entries
+ FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
+ WHERE l.log_type = $log_type
+ AND l.user_id = u.user_id
+ AND l.log_time >= $limit_days
+ $sql_keywords
+ $sql_forum";
+ $result = $db->sql_query($sql);
+ $log_count = (int) $db->sql_fetchfield('total_entries');
+ $db->sql_freeresult($result);
+ }
+
+ if ($log_count == 0)
+ {
+ // Save the queries, because there are no logs to display
+ return 0;
+ }
+
+ if ($offset >= $log_count)
+ {
+ $offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
+ }
+
$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
WHERE l.log_type = $log_type
@@ -2762,21 +2787,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
}
}
- if ($log_count !== false)
- {
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
- WHERE l.log_type = $log_type
- AND l.user_id = u.user_id
- AND l.log_time >= $limit_days
- $sql_keywords
- $sql_forum";
- $result = $db->sql_query($sql);
- $log_count = (int) $db->sql_fetchfield('total_entries');
- $db->sql_freeresult($result);
- }
-
- return;
+ return $offset;
}
/**
@@ -2908,6 +2919,12 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
$user_count = (int) $db->sql_fetchfield('user_count');
$db->sql_freeresult($result);
+ if ($user_count == 0)
+ {
+ // Save the queries, because there are no users to display
+ return 0;
+ }
+
if ($offset >= $user_count)
{
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;