From 31c59cad830743127de5f5ed43ed2011f834398e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 17 Nov 2014 23:56:33 +0100 Subject: [ticket/13298] Add missing $db->freeresult(); calls in functions_admin.php PHPBB3-13298 --- phpBB/includes/functions_admin.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index e3e8657afb..5ddaf31cf5 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2512,6 +2512,7 @@ function phpbb_cache_moderators($db, $cache, $auth) { $usernames_ary[$row['user_id']] = $row['username']; } + $db->sql_freeresult($result); foreach ($hold_ary as $user_id => $forum_id_ary) { @@ -2806,6 +2807,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li $users[] = $row; } + $db->sql_freeresult($result); return $offset; } -- cgit v1.2.1 From f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 21 Nov 2014 18:08:22 +0100 Subject: [ticket/13358] Use file_downloader in get_remote_file() get_remote_file() has been marked as deprecated. PHPBB3-13358 --- phpBB/includes/functions_admin.php | 65 +++++--------------------------------- 1 file changed, 8 insertions(+), 57 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5ddaf31cf5..6f95bc13bd 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2982,68 +2982,19 @@ function get_database_size() /** * Retrieve contents from remotely stored file +* +* @deprecated 3.1.2 Use file_downloader instead */ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) { - global $user; - - if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) - { - @fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n"); - @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; - - while (!@feof($fsock)) - { - if ($get_info) - { - $file_info .= @fread($fsock, 1024); - } - else - { - $line = @fgets($fsock, 1024); - if ($line == "\r\n") - { - $get_info = true; - } - else if (stripos($line, '404 not found') !== false) - { - $errstr = $user->lang('FILE_NOT_FOUND', $filename); - return false; - } - } - - $stream_meta_data = stream_get_meta_data($fsock); + global $phpbb_container; - if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) - { - $errstr = $user->lang['FSOCK_TIMEOUT']; - return false; - } - } - @fclose($fsock); - } - else - { - if ($errstr) - { - $errstr = utf8_convert_message($errstr); - return false; - } - else - { - $errstr = $user->lang['FSOCK_DISABLED']; - return false; - } - } + // Get file downloader and assign $errstr and $errno + $file_downloader = $phpbb_container->get('file_downloader') + ->set_error_string($errstr) + ->set_error_number($errno); - return $file_info; + return $file_downloader->get($host, $directory, $filename, $port, $timeout); } /* -- cgit v1.2.1 From 171837eefe2f8e17597629b108e2aa30c0f4055f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 21 Nov 2014 23:16:22 +0100 Subject: [ticket/13358] Do not pass variables by reference PHPBB3-13358 --- phpBB/includes/functions_admin.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 6f95bc13bd..0b9ea23fe7 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2990,11 +2990,13 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port global $phpbb_container; // Get file downloader and assign $errstr and $errno - $file_downloader = $phpbb_container->get('file_downloader') - ->set_error_string($errstr) - ->set_error_number($errno); + $file_downloader = $phpbb_container->get('file_downloader'); - return $file_downloader->get($host, $directory, $filename, $port, $timeout); + $file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout); + $errstr = $file_downloader->get_error_string(); + $errno = $file_downloader->get_error_number(); + + return $file_data; } /* -- cgit v1.2.1 From 9f1493ce732cb57588bb3756419375c53d0ac518 Mon Sep 17 00:00:00 2001 From: omniError Date: Thu, 11 Dec 2014 16:58:29 -0600 Subject: [ticket/13430] Add event core.prune_sql https://tracker.phpbb.com/browse/PHPBB3-13430 PHPBB3-13430 --- phpBB/includes/functions_admin.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 0b9ea23fe7..52d8ffbcf9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2311,7 +2311,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, */ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true) { - global $db; + global $db, $phpbb_dispatcher; if (!is_array($forum_id)) { @@ -2351,6 +2351,21 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; } + /** + * Use this event to modify the SQL that selects topics to be pruned + * + * @event core.prune_sql + * @var string forum_id The forum id + * @var string prune_mode The prune mode + * @var string prune_date The prune date + * @var int prune_flags The prune flags + * @var bool auto_sync Whether or not to perform auto sync + * @var string sql_and SQL text appended to where clause + * @since 3.1.3 + */ + $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); + extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); + $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " -- cgit v1.2.1 From 7b0cabc4165085dc96efd6b0d8b5fe9d10a0c70d Mon Sep 17 00:00:00 2001 From: omniError Date: Fri, 12 Dec 2014 17:39:30 -0600 Subject: [ticket/13430] update event version https://tracker.phpbb.com/browse/PHPBB3-13430 PHPBB3-13430 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 52d8ffbcf9..b016659541 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2361,7 +2361,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync * @var int prune_flags The prune flags * @var bool auto_sync Whether or not to perform auto sync * @var string sql_and SQL text appended to where clause - * @since 3.1.3 + * @since 3.1.3-RC1 */ $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); -- cgit v1.2.1