aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-08-18 22:31:25 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-08-18 22:31:25 +0200
commit38c65da553c83e787d8a8adc1d40d789713579c4 (patch)
tree3aff0778b74cfbf328991aa83af50e9d07aff4e6 /phpBB/includes/functions_admin.php
parentf84460c710f528724fac68278361af7fe18e458c (diff)
parent9589fbffe4cdad9fa35df2597c21fc0753ed1d52 (diff)
downloadforums-38c65da553c83e787d8a8adc1d40d789713579c4.tar
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.gz
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.bz2
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.xz
forums-38c65da553c83e787d8a8adc1d40d789713579c4.zip
Merge branch 'develop' into feature/request-class
* develop: (157 commits) [ticket/10316] Resolve inconsistent move topic behavior [ticket/9297] Add network to class name of unit tests. [ticket/9297] Fix typo in localhost. [ticket/9297] Rename test class to reflect its contents. [ticket/9297] Adjust comment - IPv6 is needed for IPv6 connections to work. [ticket/9297] Fix markTestSkipped call in setUpBeforeClass. [ticket/9608] Remove use of references in topic_review [ticket/9297] Skip FTP PASV/EPSV test if FTP connection fails. [ticket/9297] Separate ipv4 and ipv6 tests into separate functions. [ticket/9297] Update copyright year of unit test file. [feature/template-engine] Delete _get_locator function. [feature/template-engine] Clean up template locator usage in bbcode. [ticket/9297] Make EPSV unit tests work without IPv6. [ticket/9297] Unit tests for ftp_fsock PASV and EPSV. [ticket/9297] Add support for Extended Passive Mode (EPSV) in ftp_fsock class. [ticket/10312] Un-check the shadow option while moving. [feature/template-engine] Need to call set_template on template. [feature/template-engine] Update installer for template engine changes. [feature/template-engine] Dependency inject locator into template. [feature/template-engine] Delete useless code from set_template. ... Conflicts: phpBB/includes/functions.php
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 ee59d77cdb..71f8ab572e 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2596,6 +2596,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
@@ -2743,21 +2768,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;
}
/**
@@ -2889,6 +2900,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;