From d7c5f502b4e0ef87a1d4a8d9a4fc16c79b3a5dc1 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 13 Feb 2008 16:28:37 +0000 Subject: Fixing converter bugs. #21215 #18575 #18435 #16565 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8379 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index ed35be3db7..477dd787a1 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1282,7 +1282,7 @@ function restore_config($schema) // Most are... if (is_string($config_value)) { - $config_value = utf8_htmlspecialchars($config_value); + $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, false); } set_config($config_name, $config_value); -- cgit v1.2.1 From 11f27bee84447bf769e10fc7d099bb34209e9c2d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 21 Jun 2008 16:05:02 +0000 Subject: further checks on maximum storage length git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8667 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 477dd787a1..b6af76e8f6 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -148,7 +148,7 @@ function auto_id($pad = 0) { return $convert_row['max_id'] + $pad; } - + return $auto_id + $pad; } @@ -280,7 +280,7 @@ function get_config_value($config_name) { $convert_config = get_config(); } - + if (!isset($convert_config[$config_name])) { return false; @@ -669,12 +669,12 @@ function import_avatar($source, $use_target = false, $user_id = false) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); } - + if ($use_target === false && $user_id !== false) { $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); } - + $result = _import_check('avatar_path', $source, $use_target); return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1); @@ -946,7 +946,7 @@ function get_remote_avatar_dim($src, $axis) unset($remote_avatar_cache); return $retval; } - + $url_info = @parse_url($src); if (empty($url_info['host'])) { @@ -962,19 +962,19 @@ function get_remote_avatar_dim($src, $axis) case 'ftp': $port = 21; break; - + case 'https': $port = 443; break; - + default: $port = 80; } } - + $timeout = @ini_get('default_socket_timeout'); @ini_set('default_socket_timeout', 2); - + // We're just trying to reach the server to avoid timeouts $fp = @fsockopen($host, $port, $errno, $errstr, 1); if ($fp) @@ -982,11 +982,11 @@ function get_remote_avatar_dim($src, $axis) $remote_avatar_cache[$src] = @getimagesize($src); fclose($fp); } - + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; $default = array($default_x, $default_y); - + if (empty($remote_avatar_cache[$src]) || empty($remote_avatar_cache[$src][0]) || empty($remote_avatar_cache[$src][1])) { $remote_avatar_cache[$src] = $default; @@ -1002,7 +1002,7 @@ function get_remote_avatar_dim($src, $axis) $remote_avatar_cache[$src][1] = (int)($remote_avatar_cache[$src][1] * $ratio); } } - + @ini_set('default_socket_timeout', $timeout); return $remote_avatar_cache[$src][$axis]; } @@ -1112,7 +1112,7 @@ function words_unique(&$words) function add_user_group($group_id, $user_id, $group_leader=false) { global $convert, $phpbb_root_path, $config, $user, $db; - + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'group_id' => $group_id, 'user_id' => $user_id, @@ -1282,7 +1282,7 @@ function restore_config($schema) // Most are... if (is_string($config_value)) { - $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, false); + $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false); } set_config($config_name, $config_value); @@ -2443,7 +2443,7 @@ function get_smiley_display() function fill_dateformat($user_dateformat) { global $config; - + return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat); } -- cgit v1.2.1 From 5c4870fcce2f2a71b74166947939461bea90eac2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 2 Sep 2008 06:36:24 +0000 Subject: Fix one design failure in phpBB3. Do not count non-approved posts to the user_posts. Before, a user was able to circumvent basically any protection based on post counts. At the same time implement the queue_trigger feature. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8805 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index b6af76e8f6..b41c47ec81 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1744,6 +1744,7 @@ function sync_post_count($offset, $limit) $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id FROM ' . POSTS_TABLE . ' WHERE post_postcount = 1 + AND post_approved = 1 GROUP BY poster_id ORDER BY poster_id'; $result = $db->sql_query_limit($sql, $limit, $offset); -- cgit v1.2.1 From 5f7e847b57e78744d7559daddd53f107458d43cd Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 18 Sep 2008 14:26:56 +0000 Subject: Prevent integer overflow - Bug #19895 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8876 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index b41c47ec81..2213df7d0f 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1952,7 +1952,7 @@ function update_dynamic_config() FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 0'; $result = $db->sql_query($sql); - set_config('upload_dir_size', (int) $db->sql_fetchfield('stat'), true); + set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true); $db->sql_freeresult($result); /** -- cgit v1.2.1 From 433de350c0fa2e1e09c23e6f5f29f118222d2df8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 20 Jun 2009 18:45:16 +0000 Subject: - [Feature] New "Newly Registered Users" group for assigning permissions to newly registered users. They will be removed from this group once they reach a defineable amount of posts. - [Feature] Ability to define if the "Newly Registered Users" group will be assigned as the default group to newly registered users. As a coincidence also Bug #46535 got fixed. Additionally the error message displayed with trigger_error() if accessing the private message tab in the ucp is now displayed inline in addition to a slightly different message for newly registered users to let them know that access permissions may be lifted over time. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9636 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 2213df7d0f..f6710ded30 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1698,7 +1698,8 @@ function add_default_groups() 'REGISTERED_COPPA' => array('', 0, 0), 'GLOBAL_MODERATORS' => array('00AA00', 1, 0), 'ADMINISTRATORS' => array('AA0000', 1, 1), - 'BOTS' => array('9E8DA7', 0, 0) + 'BOTS' => array('9E8DA7', 0, 0), + 'NEWLY_REGISTERED' => array('', 0, 0), ); $sql = 'SELECT * -- cgit v1.2.1 From 2958890439f29b9cf45997c52c8cfa57e0f16bc8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:28:50 +0000 Subject: Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9905 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index f6710ded30..82ec114c09 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -551,7 +551,7 @@ function _import_check($config_var, $source, $use_target) ); // copy file will prepend $phpBB_root_path - $target = $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target); + $target = $config[$config_var] . '/' . utf8_basename(($use_target === false) ? $source : $use_target); if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) { @@ -567,11 +567,11 @@ function _import_check($config_var, $source, $use_target) if ($result['copied']) { - $result['target'] = basename($target); + $result['target'] = utf8_basename($target); } else { - $result['target'] = ($use_target !== false) ? $result['orig_source'] : basename($target); + $result['target'] = ($use_target !== false) ? $result['orig_source'] : utf8_basename($target); } return $result; @@ -600,7 +600,7 @@ function import_attachment($source, $use_target = false) { $thumb_dir = $convert->convertor['thumbnails'][0]; $thumb_prefix = $convert->convertor['thumbnails'][1]; - $thumb_source = $thumb_dir . $thumb_prefix . basename($result['source']); + $thumb_source = $thumb_dir . $thumb_prefix . utf8_basename($result['source']); if (strpos($thumb_source, $convert->convertor['upload_path']) !== 0) { @@ -2257,7 +2257,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour if (substr($trg, -1) == '/') { - $trg .= basename($src); + $trg .= utf8_basename($src); } $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); $trg_path = $trg; -- cgit v1.2.1 From 99c608e88c267e0fa7517da196e1701ba163c26a Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 4 Feb 2010 00:40:19 +0000 Subject: Bug #57265 - Convertors cannot read configuration files git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10473 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 82ec114c09..8a1d07c8e5 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1232,6 +1232,11 @@ function get_config() $convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__); } + if (isset($convert->config_schema['array_name'])) + { + unset($convert->config_schema['array_name']); + } + $convert_config = extract_variables_from_file($filename); if (!empty($convert->config_schema['array_name'])) { @@ -1264,6 +1269,7 @@ function restore_config($schema) global $db, $config; $convert_config = get_config(); + foreach ($schema['settings'] as $config_name => $src) { if (preg_match('/(.*)\((.*)\)/', $src, $m)) @@ -1274,8 +1280,16 @@ function restore_config($schema) } else { - $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; - } + if ($schema['table_format'] != 'file' || empty($schema['array_name'])) + { + $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; + } + else if (!empty($schema['array_name'])) + { + $src_ary = $schema['array_name']; + $config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : ''; + } + } if ($config_value !== '') { -- cgit v1.2.1 From 1802b9ff9286a7fc24493e71b3432816cbdbfcd8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 11 Feb 2010 00:02:51 +0000 Subject: Support for Microsoft's Native SQL Server Driver for PHP - Patch by Chris Pucci at Microsoft [Bug #57055] If you are using SQL Server, please try to test this new dbal so we can safely include it in 3.0.8. If you want to try it on a current phpBB version you can apply the latest version of the patch to your board which you can find attached to the bug tracker ticket (look in the comments for the latest version, the one in the ticket itself is outdated): http://www.phpbb.com/bugs/phpbb3/ticket.php?ticket_id=57055 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10489 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 8a1d07c8e5..8b3c6ea8db 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1643,6 +1643,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) case 'mssql': case 'sqlite': + case 'mssqlnative': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); break; -- cgit v1.2.1 From 30b83896a1718400307de7d531c16a152c0f6668 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 01:17:30 +0000 Subject: Fix Bug #57755 - Make user_email_hash() function independent from system's architecture. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10499 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_convert.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 8b3c6ea8db..0fdae9b274 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -205,10 +205,12 @@ function get_group_id($group_name) /** * Generate the email hash stored in the users table +* +* Note: Deprecated, calls should directly go to phpbb_email_hash() */ function gen_email_hash($email) { - return (crc32(strtolower($email)) . strlen($email)); + return phpbb_email_hash($email); } /** -- cgit v1.2.1