From 0d75cfc914fdb19a7d8a1d99750c116f6cdc11f4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 2 Mar 2003 15:51:07 +0000 Subject: [PATCH] fixed bug #1463, #1154 and #1465, moved mozilla navigation bar (see comment), changed url bbcode parsing (some backports from 2.2) git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3583 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 22 ------------ phpBB/includes/bbcode.php | 36 +++++++++---------- phpBB/includes/functions.php | 24 +++++++++++++ phpBB/includes/functions_search.php | 2 +- phpBB/includes/page_header.php | 5 +++ .../email/coppa_welcome_inactive.tpl | 2 +- phpBB/modcp.php | 9 +++-- 7 files changed, 56 insertions(+), 44 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index 81f85003d7..2427ca8f2a 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -123,28 +123,6 @@ include($phpbb_root_path . 'includes/auth.'.$phpEx); include($phpbb_root_path . 'includes/functions.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); -// -// Mozilla navigation bar -// Default items that should be valid on all pages. -// Defined here and not in page_header.php so they can be redefined in the code -// -$nav_links['top'] = array ( - 'url' => append_sid($phpbb_root_dir."index.".$phpEx), - 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']) -); -$nav_links['search'] = array ( - 'url' => append_sid($phpbb_root_dir."search.".$phpEx), - 'title' => $lang['Search'] -); -$nav_links['help'] = array ( - 'url' => append_sid($phpbb_root_dir."faq.".$phpEx), - 'title' => $lang['FAQ'] -); -$nav_links['author'] = array ( - 'url' => append_sid($phpbb_root_dir."memberlist.".$phpEx), - 'title' => $lang['Memberlist'] -); - // // Obtain and encode users IP // diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 774f99cde2..dde1566446 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -95,17 +95,17 @@ function prepare_bbcode_template($bbcode_tpl) $bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']); // We do URLs in several different ways.. - $bbcode_tpl['url1'] = str_replace('{URL}', '\1\2', $bbcode_tpl['url']); - $bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\1\2', $bbcode_tpl['url1']); + $bbcode_tpl['url1'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); + $bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url1']); $bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']); - $bbcode_tpl['url3'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']); - $bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\6', $bbcode_tpl['url3']); + $bbcode_tpl['url3'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); + $bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url3']); $bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); - $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\5', $bbcode_tpl['url4']); + $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url4']); $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']); @@ -197,24 +197,24 @@ function bbencode_second_pass($text, $uid) $patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si"; $replacements[] = $bbcode_tpl['img']; - // [url]xxxx://www.phpbb.com[/url] code.. - $patterns[] = "#\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]#is"; - $replacements[] = $bbcode_tpl['url1']; + // matches a [url]xxxx://www.phpbb.com[/url] code.. + $patterns[] = '#\[url\]([\w]+?://.*?[^\t\n\r<"]*)\[/url\]#ie'; + $replacements[] = "'" . $bbcode_tpl['url1'] . "'"; // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). - $patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\[/url\]#si"; - $replacements[] = $bbcode_tpl['url2']; + $patterns[] = '#\[url\]((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r<"]*)?)\[/url\]#ie'; + $replacements[] = "'" . $bbcode_tpl['url2'] . "'"; // [url=xxxx://www.phpbb.com]phpBB[/url] code.. - $patterns[] = "#\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]#si"; - $replacements[] = $bbcode_tpl['url3']; + $patterns[] = '#\[url=([\w]+?://.*?[^\t\n\r<"]*)\](.*?)\[/url\]#ie'; + $replacements[] = "'" . $bbcode_tpl['url3'] . "'"; // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). - $patterns[] = "#\[url=(([\w\-]+\.)*?[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#si"; - $replacements[] = $bbcode_tpl['url4']; + $patterns[] = '#\[url=((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r<"]*)?)\](.*?)\[/url\]#ie'; + $replacements[] = "'" . $bbcode_tpl['url4'] . "'"; // [email]user@domain.tld[/email] code.. - $patterns[] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; + $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; $replacements[] = $bbcode_tpl['email']; $text = preg_replace($patterns, $replacements, $text); @@ -621,17 +621,17 @@ function make_clickable($text) // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, comma, double quote or < - $ret = preg_replace("#([\t\r\n ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1\2://\3', $ret); + $ret = preg_replace('#(^|[\n ])([\w]+?://.*?[^\t\n\r<"]*)#ie', "'\\1\\2'", $ret); // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" // zzzz is optional.. will contain everything up to the first space, newline, // comma, double quote or <. - $ret = preg_replace("#([\t\r\n ])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1\2.\3', $ret); + $ret = preg_replace('#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r<"]*)?)#ie', "'\\1\\2'", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". - $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1\\2@\\3", $ret); + $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1\\2@\\3", $ret); // Remove our padding.. $ret = substr($ret, 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5367d0e429..eeb3fc7787 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -203,6 +203,7 @@ function init_userprefs($userdata) { global $board_config, $theme, $images; global $template, $lang, $phpEx, $phpbb_root_path; + global $nav_links; if ( $userdata['user_id'] != ANONYMOUS ) { @@ -255,6 +256,29 @@ function init_userprefs($userdata) $theme = setup_style($board_config['default_style']); + // + // Mozilla navigation bar + // Default items that should be valid on all pages. + // Defined here to correctly assign the Language Variables + // and be able to change the variables within code. + // + $nav_links['top'] = array ( + 'url' => append_sid($phpbb_root_path . 'index.' . $phpEx), + 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']) + ); + $nav_links['search'] = array ( + 'url' => append_sid($phpbb_root_path . 'search.' . $phpEx), + 'title' => $lang['Search'] + ); + $nav_links['help'] = array ( + 'url' => append_sid($phpbb_root_path . 'faq.' . $phpEx), + 'title' => $lang['FAQ'] + ); + $nav_links['author'] = array ( + 'url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx), + 'title' => $lang['Memberlist'] + ); + return; } diff --git a/phpBB/includes/functions_search.php b/phpBB/includes/functions_search.php index 900dc9f6bd..0785f9ceba 100644 --- a/phpBB/includes/functions_search.php +++ b/phpBB/includes/functions_search.php @@ -430,7 +430,7 @@ function username_search($search_match) $sql = "SELECT username FROM " . USERS_TABLE . " - WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' + WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' AND user_id <> " . ANONYMOUS . " ORDER BY username"; if ( !($result = $db->sql_query($sql)) ) { diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index e0c000a6b4..0bed246c7b 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -312,6 +312,11 @@ else // // Generate HTML required for Mozilla Navigation bar // +if (!isset($nav_links)) +{ + $nav_links = array(); +} + $nav_links_html = ''; $nav_link_proto = '' . "\n"; while( list($nav_item, $nav_array) = @each($nav_links) ) diff --git a/phpBB/language/lang_english/email/coppa_welcome_inactive.tpl b/phpBB/language/lang_english/email/coppa_welcome_inactive.tpl index 97e651a488..5d9b250846 100644 --- a/phpBB/language/lang_english/email/coppa_welcome_inactive.tpl +++ b/phpBB/language/lang_english/email/coppa_welcome_inactive.tpl @@ -44,7 +44,7 @@ Date: _______________ ------------------------------ CUT HERE ------------------------------ -Once the administrator has recived the above form via fax or regular mail your account will be activated. +Once the administrator has received the above form via fax or regular mail your account will be activated. Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account. diff --git a/phpBB/modcp.php b/phpBB/modcp.php index e8a6f5cb8b..7343f09fca 100644 --- a/phpBB/modcp.php +++ b/phpBB/modcp.php @@ -663,15 +663,20 @@ switch( $mode ) $page_title = $lang['Mod_CP']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); + $post_id_sql = ''; + if (isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond'])) { $posts = $HTTP_POST_VARS['post_id_list']; - $post_id_sql = ''; for ($i = 0; $i < count($posts); $i++) { $post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($posts[$i]); } + } + + if ($post_id_sql != '') + { $sql = "SELECT post_id, poster_id, topic_id, post_time FROM " . POSTS_TABLE . " @@ -769,7 +774,7 @@ switch( $mode ) message_die(GENERAL_ERROR, 'Could not get topic/post information', '', __LINE__, __FILE__, $sql); } - $s_hidden_fields = ''; + $s_hidden_fields = ''; if( ( $total_posts = $db->sql_numrows($result) ) > 0 ) {