From 548cc2c10b56cc9e5c71c2f87356947939abe888 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 15 Nov 2006 15:35:50 +0000 Subject: - fixes for the following bugs: #5326 #5318 #5304 #5290 #5288 #5278 #5276 #5272 #5266 - also fixed the "Call-time pass-by-reference" bug #5252 - within this step changed the normalize calls to require references. - added captcha size variables to the class scope (suggestion was posted at area51) git-svn-id: file:///svn/phpbb/trunk@6584 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 91a818d454..8119dc35f4 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -614,6 +614,10 @@ else if (!function_exists('htmlspecialchars_decode')) { + /** + * A wrapper for htmlspecialchars_decode + * @ignore + */ function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) { return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); @@ -2493,14 +2497,14 @@ function extension_allowed($forum_id, $extension, &$extensions) /** * Little helper for the build_hidden_fields function */ -function _build_hidden_fields($key, $value, $specialchar) +function _build_hidden_fields($key, $value, $specialchar, $stripslashes) { $hidden_fields = ''; if (!is_array($value)) { - $key = ($specialchar) ? htmlspecialchars($key) : $key; - $value = ($specialchar) ? htmlspecialchars($value) : $value; + $value = ($stripslashes) ? stripslashes($value) : $value; + $value = ($specialchar) ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : $value; $hidden_fields .= '' . "\n"; } @@ -2508,7 +2512,10 @@ function _build_hidden_fields($key, $value, $specialchar) { foreach ($value as $_key => $_value) { - $hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar); + $_key = ($stripslashes) ? stripslashes($_key) : $key; + $_key = ($specialchar) ? htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') : $_key; + + $hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar, $stripslashes); } } @@ -2517,14 +2524,23 @@ function _build_hidden_fields($key, $value, $specialchar) /** * Build simple hidden fields from array +* +* @param array $field_ary an array of values to build the hidden field from +* @param bool $specialchar if true, keys and values get specialchared +* @param bool $stripslashes if true, keys and values get stripslashed +* +* @return string the hidden fields */ -function build_hidden_fields($field_ary, $specialchar = false) +function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = false) { $s_hidden_fields = ''; foreach ($field_ary as $name => $vars) { - $s_hidden_fields .= _build_hidden_fields($name, $vars, $specialchar); + $name = ($stripslashes) ? stripslashes($name) : $name; + $name = ($specialchar) ? htmlspecialchars($name, ENT_COMPAT, 'UTF-8') : $name; + + $s_hidden_fields .= _build_hidden_fields($name, $vars, $specialchar, $stripslashes); } return $s_hidden_fields; @@ -2773,6 +2789,12 @@ function phpbb_checkdnsrr($host, $type = '') @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); + // If output is empty, the nslookup failed + if (empty($output)) + { + return NULL; + } + foreach ($output as $line) { if (!trim($line)) @@ -3344,7 +3366,8 @@ function page_footer($run_cron = true) } $template->assign_vars(array( - 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', + 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", '', true, $user->session_id) : '') ); @@ -3385,7 +3408,7 @@ function page_footer($run_cron = true) if ($cron_type) { - $template->assign_var('RUN_CRON_TASK', 'cron'); + $template->assign_var('RUN_CRON_TASK', 'cron'); } } -- cgit v1.2.1 From c9cd0e1d914b779dfc6cb491b240d48fe2d4c9b0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 16 Nov 2006 16:51:19 +0000 Subject: ok, change from doing the same logic all over again we call a function to do it for us. Also allow template designers to choose which method to use by just adding a fully compiled username string (profile link + user colour). This commit may introduce problems. git-svn-id: file:///svn/phpbb/trunk@6589 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8119dc35f4..8021e0c6c2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2766,6 +2766,65 @@ function truncate_string($string, $max_length = 60, $allow_reply = true) return $string; } +/** +* Get username details for placing into templates. +* +* @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour) or full (for obtaining a html string representing a coloured link to the users profile). +* @param int $user_id The users id +* @param string $username The users name +* @param string $username_colour The users colour +* @param string $guest_username optional field to specify the guest username. It will be used in favor of the GUEST language variable then. +* +* @return string A string consisting of what is wanted based on $mode. +*/ +function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false) +{ + global $phpbb_root_path, $phpEx, $user; + + $full_string = $profile_url = ''; + $username_colour = ($username_colour) ? '#' . $username_colour : ''; + + if ($guest_username === false) + { + $username = ($username) ? $username : $user->lang['GUEST']; + } + else + { + $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + } + + // Only show the link if not anonymous + if ($user_id && $user_id != ANONYMOUS) + { + $profile_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . (int) $user_id); + $full_string = '' . $username . ''; + } + else + { + $profile_url = ''; + $full_string = ($username_colour) ? '' . $username . '' : $username; + } + + switch ($mode) + { + case 'profile': + return $profile_url; + break; + + case 'username': + return $username; + break; + + case 'colour': + return $username_colour; + break; + + case 'full': + default: + return $full_string; + break; + } +} /** * Wrapper for php's checkdnsrr function. -- cgit v1.2.1 From d9387842ac7c41d4c92ccf7d797fed214ed38de8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Nov 2006 19:37:57 +0000 Subject: adjust some comments to work with phpdocumentor. :) git-svn-id: file:///svn/phpbb/trunk@6595 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8021e0c6c2..6b87e9acf9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -153,7 +153,7 @@ function gen_rand_string($num_chars = 8) /** * Return unique id -* @param $extra additional entropy +* @param string $extra additional entropy */ function unique_id($extra = 'c') { @@ -401,9 +401,9 @@ if (!function_exists('stripos')) * Find position of first occurrence of a case-insensitive string * * @param string $haystack is the string to search in - * @param string needle is the string to search for + * @param string $needle is the string to search for * - * @return Returns the numeric position of the first occurrence of needle in the haystack string. Unlike strpos(), stripos() is case-insensitive. + * @return mixed Returns the numeric position of the first occurrence of needle in the haystack string. Unlike strpos(), stripos() is case-insensitive. * Note that the needle may be a string of one or more characters. * If needle is not found, stripos() will return boolean FALSE. */ -- cgit v1.2.1 From f589ce3a842fb88a6b38fde7b1080a991e044706 Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 17 Nov 2006 21:51:16 +0000 Subject: #5376 - removed some unneeded globals git-svn-id: file:///svn/phpbb/trunk@6597 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6b87e9acf9..f76f918451 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -237,7 +237,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, */ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false) { - global $config, $auth, $template, $user, $db, $phpEx; + global $config, $auth, $template, $user, $db; if (!$config['load_jumpbox']) { @@ -679,7 +679,7 @@ function style_select($default = '', $all = false) */ function tz_select($default = '', $truncate = false) { - global $sys_timezone, $user; + global $user; $tz_select = ''; foreach ($user->lang['tz_zones'] as $offset => $zone) -- cgit v1.2.1 From e264a62b731d29389ba0a4a3548070e259e373c0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 18 Nov 2006 16:27:35 +0000 Subject: - a handful of mcp fixed, the most important one is the change for check_ids() - it is now supporting ids from more than one forum too, making it possible to use some mcp features as designed initially. We really need to get our moderator team testing the mcp extensively. - fixed some other tiny glitches - if a forum category with subforums get changed to a link type forum give options of what to do with the subforums (#5334) - other bugfixes git-svn-id: file:///svn/phpbb/trunk@6601 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f76f918451..a9c5c5263d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2512,7 +2512,7 @@ function _build_hidden_fields($key, $value, $specialchar, $stripslashes) { foreach ($value as $_key => $_value) { - $_key = ($stripslashes) ? stripslashes($_key) : $key; + $_key = ($stripslashes) ? stripslashes($_key) : $_key; $_key = ($specialchar) ? htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') : $_key; $hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar, $stripslashes); @@ -3085,7 +3085,7 @@ function page_header($page_title = '', $display_online_list = true) // Specify escape character for MSSQL if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') { - $reading_sql .= " ESCAPE '\\'"; + $reading_sql .= " ESCAPE '\\' "; } } -- cgit v1.2.1 From 174d43d5327c039c41142667291054162a53906c Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 19 Nov 2006 15:23:19 +0000 Subject: #5446 - slight opti thrown in :D git-svn-id: file:///svn/phpbb/trunk@6611 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a9c5c5263d..467727a9bc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2362,19 +2362,19 @@ function make_clickable($text, $server_url = false) // Be sure to not let the matches cross over. ;) // relative urls for this board - $magic_url_match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; + $magic_url_match[] = '#(^|[\n\t (])(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; $magic_url_replace[] = "'\$1' . preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\\1', '\$3') . ''"; // matches a xxxx://aaaaa.bbb.cccc. ... - $magic_url_match[] = '#(^|[\n ]|\()([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; + $magic_url_match[] = '#(^|[\n\t (])([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing - $magic_url_match[] = '#(^|[\n ]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; + $magic_url_match[] = '#(^|[\n\t (])(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. - $magic_url_match[] = '/(^|[\n ]|\()(' . get_preg_expression('email') . ')/ie'; + $magic_url_match[] = '/(^|[\n\t )])(' . get_preg_expression('email') . ')/ie'; $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr('\$2', 0, 39) . ' ... ' . substr('\$2', -10) : '\$2') . ''"; } -- cgit v1.2.1 From 6a082426840164a3c8187559dddf3ab777b958fa Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 19 Nov 2006 21:00:48 +0000 Subject: some tiny fixes. git-svn-id: file:///svn/phpbb/trunk@6614 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 467727a9bc..d350ab3bb3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -502,7 +502,7 @@ if (!function_exists('realpath')) else if (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME'])) { // Warning: If chdir() has been used this will lie! - // @todo This has some problems sometime (CLI can create them easily) + // Warning: This has some problems sometime (CLI can create them easily) $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($_SERVER['SCRIPT_FILENAME'])) . '/' . $path; $absolute = true; $path_prefix = ''; @@ -2907,9 +2907,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline) return; } - /** - * @todo Think about removing the if-condition within the final product, since we no longer enable DEBUG by default and we will maybe adjust the error reporting level - */ if (defined('DEBUG')) { if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) -- cgit v1.2.1 From ab9ec8064acb25d09d6d0edb93ecbe3b59541010 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 21 Nov 2006 18:15:53 +0000 Subject: - fixing a bunch of bugs - moved the install trigger error to sessions and also disabled it for those having DEBUG_EXTRA enabled. i hope not having introduced too many new bugs. git-svn-id: file:///svn/phpbb/trunk@6628 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d350ab3bb3..4ebcec38d5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2433,8 +2433,8 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_ include("{$phpbb_root_path}includes/functions_display.$phpEx"); } - $attachments = display_attachments($forum_id, NULL, $attachments, $update_count, false, true); - $tpl_size = sizeof($attachments); + $attachment_tpl = display_attachments($forum_id, NULL, $attachments, $update_count, false, true); + $tpl_size = sizeof($attachment_tpl); $unset_tpl = array(); @@ -2447,7 +2447,7 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_ $index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; $replace['from'][] = $matches[0][$num]; - $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); + $replace['to'][] = (isset($attachment_tpl[$index])) ? $attachment_tpl[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); $unset_tpl[] = $index; } -- cgit v1.2.1 From 3b42f4297e1ab3eff66f05409f8c74ad37d9f13d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 21 Nov 2006 18:20:02 +0000 Subject: decrease the barrier for E_ALL error reporting and email traces from DEBUG_EXTRA to DEBUG git-svn-id: file:///svn/phpbb/trunk@6629 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4ebcec38d5..dac39e5940 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2901,24 +2901,21 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // Check the error reporting level and return if the error level does not match // Additionally do not display notices if we suppress them via @ - // If DEBUG_EXTRA is defined the default level is E_ALL - if (($errno & ((defined('DEBUG_EXTRA') && error_reporting()) ? E_ALL : error_reporting())) == 0) + // If DEBUG is defined the default level is E_ALL + if (($errno & ((defined('DEBUG') && error_reporting()) ? E_ALL : error_reporting())) == 0) { return; } - if (defined('DEBUG')) + if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { - if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) - { - // remove complete path to installation, with the risk of changing backslashes meant to be there - $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); - $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); + // remove complete path to installation, with the risk of changing backslashes meant to be there + $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); + $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); - echo '[phpBB Debug] PHP Notice: in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
' . "\n"; - } + echo '[phpBB Debug] PHP Notice: in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
' . "\n"; } - + break; case E_USER_ERROR: -- cgit v1.2.1 From d529f78adb85698c9382ad29e4583f309eaf850a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 24 Nov 2006 14:59:26 +0000 Subject: rather large update, most important things done: - implemented provided patch/diff file for bug #5350 (Highway of Life) with some tiny changes and alterations - more username/colour changes/fixes - added a note about PM rule-dependant message removals so the user is not wondering too much if he can't remember his rules. :) - some column changes to fix unicode issues - bugfixes git-svn-id: file:///svn/phpbb/trunk@6650 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index dac39e5940..001702a39e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1865,7 +1865,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa } } - // The result parameter is always an array, holding the relevant informations... + // The result parameter is always an array, holding the relevant information... if ($result['status'] == LOGIN_SUCCESS) { $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx"); @@ -2676,7 +2676,7 @@ function get_backtrace() $trace['file'] = substr($trace['file'], 1); $args = array(); - // If include/require/include_once is not called, do not show arguments - they may contain sensible informations + // If include/require/include_once is not called, do not show arguments - they may contain sensible information if (!in_array($trace['function'], array('include', 'require', 'include_once'))) { unset($trace['args']); @@ -2773,11 +2773,12 @@ function truncate_string($string, $max_length = 60, $allow_reply = true) * @param int $user_id The users id * @param string $username The users name * @param string $username_colour The users colour -* @param string $guest_username optional field to specify the guest username. It will be used in favor of the GUEST language variable then. +* @param string $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. +* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} * * @return string A string consisting of what is wanted based on $mode. */ -function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false) +function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) { global $phpbb_root_path, $phpEx, $user; @@ -2796,7 +2797,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Only show the link if not anonymous if ($user_id && $user_id != ANONYMOUS) { - $profile_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . (int) $user_id); + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile'); + $profile_url .= '&u=' . (int) $user_id; $full_string = '' . $username . ''; } else @@ -3116,7 +3118,7 @@ function page_header($page_title = '', $display_online_list = true) $reading_sql . ((!$config['load_online_guests']) ? ' AND s.session_user_id <> ' . ANONYMOUS : '') . ' AND u.user_id = s.session_user_id - ORDER BY u.username ASC, s.session_ip ASC'; + ORDER BY u.username_clean ASC, s.session_ip ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) -- cgit v1.2.1 From 6583f90b8d082096ebd9cfc0588730dd36efb077 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 26 Nov 2006 14:55:18 +0000 Subject: - bug fixes for #5618, #5588 and #5584 - remove messenger->reset() calls (they are already performed on sending) git-svn-id: file:///svn/phpbb/trunk@6660 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 001702a39e..bf1883e96f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2433,8 +2433,8 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_ include("{$phpbb_root_path}includes/functions_display.$phpEx"); } - $attachment_tpl = display_attachments($forum_id, NULL, $attachments, $update_count, false, true); - $tpl_size = sizeof($attachment_tpl); + $attachments = display_attachments($forum_id, NULL, $attachments, $update_count, false, true); + $tpl_size = sizeof($attachments); $unset_tpl = array(); @@ -2447,7 +2447,7 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_ $index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; $replace['from'][] = $matches[0][$num]; - $replace['to'][] = (isset($attachment_tpl[$index])) ? $attachment_tpl[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); + $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); $unset_tpl[] = $index; } -- cgit v1.2.1 From 61e2a3f5c1d43fd64e283e0fe79beee92f605999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Mon, 27 Nov 2006 12:45:26 +0000 Subject: #4892 git-svn-id: file:///svn/phpbb/trunk@6667 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bf1883e96f..59c3d240ce 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -686,13 +686,17 @@ function tz_select($default = '', $truncate = false) { if ($truncate) { - $zone = (utf8_strlen($zone) > 70) ? utf8_substr($zone, 0, 70) . '...' : $zone; + $zone_trunc = truncate_string($zone, 50, false, "..."); + } + else + { + $zone_trunc = $zone; } if (is_numeric($offset)) { $selected = ($offset == $default) ? ' selected="selected"' : ''; - $tz_select .= ''; + $tz_select .= ''; } } @@ -2737,11 +2741,12 @@ function get_preg_expression($mode) * Truncates string while retaining special characters if going over the max length * The default max length is 60 at the moment */ -function truncate_string($string, $max_length = 60, $allow_reply = true) +function truncate_string($string, $max_length = 60, $allow_reply = true, $append = '') { $chars = array(); $strip_reply = false; + $stripped = false; if ($allow_reply && strpos($string, 'Re: ') === 0) { $strip_reply = true; @@ -2756,12 +2761,18 @@ function truncate_string($string, $max_length = 60, $allow_reply = true) { // Cut off the last elements from the array $string = implode('', array_slice($chars, 0, $max_length)); + $stripped = true; } if ($strip_reply) { $string = 'Re: ' . $string; } + + if ($append != '' && $stripped) + { + $string = $string . $append; + } return $string; } -- cgit v1.2.1 From 883bfbf981a58c357a8dd1d0c6754488971f7cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Mon, 27 Nov 2006 12:56:35 +0000 Subject: blah .. git-svn-id: file:///svn/phpbb/trunk@6669 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 59c3d240ce..614b5bbc64 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -686,7 +686,7 @@ function tz_select($default = '', $truncate = false) { if ($truncate) { - $zone_trunc = truncate_string($zone, 50, false, "..."); + $zone_trunc = truncate_string($zone, 50, false, '...'); } else { -- cgit v1.2.1 From 688ef7560a4c785ab5191ca2ff589c9361c459f6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Nov 2006 16:05:23 +0000 Subject: Using a different approach for the data updates (same as the schema updates) git-svn-id: file:///svn/phpbb/trunk@6671 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 614b5bbc64..5d12f9684c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -687,7 +687,7 @@ function tz_select($default = '', $truncate = false) if ($truncate) { $zone_trunc = truncate_string($zone, 50, false, '...'); - } + } else { $zone_trunc = $zone; -- cgit v1.2.1 From 1f118ba2ae02dd1bf3ff1d3be06245b03a561180 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Nov 2006 19:32:18 +0000 Subject: #5610 git-svn-id: file:///svn/phpbb/trunk@6674 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5d12f9684c..5c2b524fcf 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2101,7 +2101,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po function get_context($text, $words, $length = 400) { // first replace all whitespaces with single spaces - $text = preg_replace('/\s+/', ' ', $text); + $text = preg_replace('/\s+/u', ' ', $text); $word_indizes = array(); if (sizeof($words)) -- cgit v1.2.1 From 1f8818d85d8b95d95cb62967f171c99c0735af9e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Nov 2006 21:33:49 +0000 Subject: better layed out... git-svn-id: file:///svn/phpbb/trunk@6677 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5c2b524fcf..9c8163bd14 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2810,12 +2810,10 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', { $profile_url = ($custom_profile_url !== false) ? $custom_profile_url : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile'); $profile_url .= '&u=' . (int) $user_id; - $full_string = '' . $username . ''; } else { $profile_url = ''; - $full_string = ($username_colour) ? '' . $username . '' : $username; } switch ($mode) @@ -2834,7 +2832,26 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', case 'full': default: - return $full_string; + + $tpl = ''; + if (!$profile_url && !$username_colour) + { + $tpl = '{USERNAME}'; + } + else if (!$profile_url && $username_colour) + { + $tpl = '{USERNAME}'; + } + else if ($profile_url && !$username_colour) + { + $tpl = '{USERNAME}'; + } + else if ($profile_url && $username_colour) + { + $tpl = '{USERNAME}'; + } + + return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), $tpl); break; } } -- cgit v1.2.1