aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_php_info.php2
-rw-r--r--phpBB/includes/auth/auth_ldap.php4
-rw-r--r--phpBB/includes/functions_install.php2
-rw-r--r--phpBB/includes/functions_privmsgs.php2
-rw-r--r--phpBB/includes/functions_upload.php31
-rw-r--r--phpBB/includes/functions_user.php28
-rw-r--r--phpBB/includes/mcp/mcp_post.php1
7 files changed, 55 insertions, 15 deletions
diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php
index 7dd345971a..88e2ac3f8d 100644
--- a/phpBB/includes/acp/acp_php_info.php
+++ b/phpBB/includes/acp/acp_php_info.php
@@ -47,7 +47,7 @@ class acp_php_info
// for this was nabbed from the PHP annotated manual
preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
- if (empty($phpinfo) || empty($output))
+ if (empty($phpinfo) || empty($output[1][0]))
{
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
}
diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php
index eebf147d48..63796a474b 100644
--- a/phpBB/includes/auth/auth_ldap.php
+++ b/phpBB/includes/auth/auth_ldap.php
@@ -282,7 +282,7 @@ function ldap_user_filter($username)
{
global $config;
- $filter = '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')';
+ $filter = '(' . $config['ldap_uid'] . '=' . phpbb_ldap_escape(htmlspecialchars_decode($username)) . ')';
if ($config['ldap_user_filter'])
{
$_filter = ($config['ldap_user_filter'][0] == '(' && substr($config['ldap_user_filter'], -1) == ')') ? $config['ldap_user_filter'] : "({$config['ldap_user_filter']})";
@@ -294,7 +294,7 @@ function ldap_user_filter($username)
/**
* Escapes an LDAP AttributeValue
*/
-function ldap_escape($string)
+function phpbb_ldap_escape($string)
{
return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
}
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 47f4eac627..21dd8bfebe 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -309,7 +309,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();
- $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
+ $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);
}
else
{
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index b08d6e7f5c..c99f40d453 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -208,7 +208,7 @@ function get_folder($user_id, $folder_id = false)
);
}
- if ($folder_id !== false && !isset($folder[$folder_id]))
+ if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id]))
{
trigger_error('UNKNOWN_FOLDER');
}
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 73ac1df2d2..69f10911ec 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -466,6 +466,9 @@ class fileupload
var $max_height = 0;
var $error_prefix = '';
+ /** @var int Timeout for remote upload */
+ var $upload_timeout = 6;
+
/**
* Init file upload class.
*
@@ -795,13 +798,28 @@ class fileupload
fputs($fsock, "HOST: " . $host . "\r\n");
fputs($fsock, "Connection: close\r\n\r\n");
+ // Set a proper timeout for the socket
+ socket_set_timeout($fsock, $this->upload_timeout);
+
$get_info = false;
$data = '';
- while (!@feof($fsock))
+ $length = false;
+ $timer_stop = time() + $this->upload_timeout;
+
+ while ((!$length || $filesize < $length) && !@feof($fsock))
{
if ($get_info)
{
- $block = @fread($fsock, 1024);
+ if ($length)
+ {
+ // Don't attempt to read past end of file if server indicated length
+ $block = @fread($fsock, min($length - $filesize, 1024));
+ }
+ else
+ {
+ $block = @fread($fsock, 1024);
+ }
+
$filesize += strlen($block);
if ($remote_max_filesize && $filesize > $remote_max_filesize)
@@ -847,6 +865,15 @@ class fileupload
}
}
}
+
+ $stream_meta_data = stream_get_meta_data($fsock);
+
+ // Cancel upload if we exceed timeout
+ if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
+ {
+ $file = new fileerror($user->lang[$this->error_prefix . 'REMOTE_UPLOAD_TIMEOUT']);
+ return $file;
+ }
}
@fclose($fsock);
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index ea8b0a4640..abb057df5b 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -329,11 +329,16 @@ function user_add($user_row, $cp_data = false)
}
/**
-* Remove User
-*/
+ * Remove User
+ *
+ * @param string $mode 'retain' or 'remove'
+ * @param int $user_id
+ * @param mixed $post_username
+ * @return bool
+ */
function user_delete($mode, $user_id, $post_username = false)
{
- global $cache, $config, $db, $user, $auth;
+ global $cache, $config, $db, $user;
global $phpbb_root_path, $phpEx;
$sql = 'SELECT *
@@ -439,11 +444,6 @@ function user_delete($mode, $user_id, $post_username = false)
WHERE poster_id = $user_id";
$db->sql_query($sql);
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_edit_user = ' . ANONYMOUS . "
- WHERE post_edit_user = $user_id";
- $db->sql_query($sql);
-
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_poster = ' . ANONYMOUS . ", topic_first_poster_name = '" . $db->sql_escape($post_username) . "', topic_first_poster_colour = ''
WHERE topic_poster = $user_id";
@@ -501,6 +501,18 @@ function user_delete($mode, $user_id, $post_username = false)
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
+ // Change user_id to anonymous for posts edited by this user
+ $sql = 'UPDATE ' . POSTS_TABLE . '
+ SET post_edit_user = ' . ANONYMOUS . '
+ WHERE post_edit_user = ' . $user_id;
+ $db->sql_query($sql);
+
+ // Change user_id to anonymous for pms edited by this user
+ $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
+ SET message_edit_user = ' . ANONYMOUS . '
+ WHERE message_edit_user = ' . $user_id;
+ $db->sql_query($sql);
+
// Delete user log entries about this user
$sql = 'DELETE FROM ' . LOG_TABLE . '
WHERE reportee_id = ' . $user_id;
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index ba45037a18..df5dc27996 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -157,6 +157,7 @@ function mcp_post_details($id, $mode, $action)
if (sizeof($attachments))
{
+ $user->add_lang('viewtopic');
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
}