aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-01-02 18:53:55 +0100
committerAndreas Fischer <bantu@phpbb.com>2012-01-02 18:53:55 +0100
commit2345be38b682a58f9b5e5429c76db97a0564093d (patch)
treefe39c5f348f86c23f3c9af9011d6d0c1b0c0baf5 /phpBB/includes/functions_admin.php
parentc8da5ad9f42d8ced1aead79a42cc5caee5c5a2ff (diff)
parente14c3f3b77ab07ce97f357a15db5db5101df06c1 (diff)
downloadforums-2345be38b682a58f9b5e5429c76db97a0564093d.tar
forums-2345be38b682a58f9b5e5429c76db97a0564093d.tar.gz
forums-2345be38b682a58f9b5e5429c76db97a0564093d.tar.bz2
forums-2345be38b682a58f9b5e5429c76db97a0564093d.tar.xz
forums-2345be38b682a58f9b5e5429c76db97a0564093d.zip
Merge branch 'prep-release-3.0.10'
* prep-release-3.0.10: (221 commits) [prep-release-3.0.10] Bumping version number for 3.0.10 final. [prep-release-3.0.10] Update Changelog for 3.0.10-RC3 release. [ticket/10531] Disallow deleting of the last style [ticket/8996] Revert initial fix to keep old behaviour on empty selection Part2 [ticket/8996] Revert initial fix to keep old behaviour on empty selection [ticket/10319] Missing hidden fields in search form [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-6632 [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-10408 [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-10485 [prep-release-3.0.10] Bumping version number for 3.0.10-RC3. [ticket/10480] Add a build target for changelog building. [ticket/10480] Add a build script for exporting the changelog from tracker. [ticket/10502] Fix typo in changelog. 'red' should have been 'read'. [prep-release-3.0.10] Remove duplicate ticket PHPBB3-10490 from changelog. [ticket/10501] Fix description of table prefixes [ticket/10503] Debug error "Invalid arguments" when previewing edits [prep-release-3.0.10] Update Changelog for 3.0.10-RC2 release. [ticket/10497] Fix SQL error when guest visits forum with unread topic [prep-release-3.0.10] Bumping version number for 3.0.10-RC2. [ticket/10461] Add a comment explaining the logic here. ...
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php64
1 files changed, 48 insertions, 16 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index cb0cf34e69..526bc16ff0 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2595,6 +2595,35 @@ 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);
+ }
+
+ // $log_count may be false here if false was passed in for it,
+ // because in this case we did not run the COUNT() query above.
+ // If we ran the COUNT() query and it returned zero rows, return;
+ // otherwise query for logs below.
+ 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 +2791,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 +2923,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;
@@ -3113,7 +3134,7 @@ function get_database_size()
/**
* Retrieve contents from remotely stored file
*/
-function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10)
+function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6)
{
global $user;
@@ -3123,6 +3144,9 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
@fputs($fsock, "HOST: $host\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
+ $timer_stop = time() + $timeout;
+ stream_set_timeout($fsock, $timeout);
+
$file_info = '';
$get_info = false;
@@ -3145,6 +3169,14 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
return false;
}
}
+
+ $stream_meta_data = stream_get_meta_data($fsock);
+
+ if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
+ {
+ $errstr = $user->lang['FSOCK_TIMEOUT'];
+ return false;
+ }
}
@fclose($fsock);
}