aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build_helper.php2
-rw-r--r--phpBB/adm/index.php2
-rw-r--r--phpBB/adm/style/acp_forums.html4
-rw-r--r--phpBB/adm/style/acp_users_overview.html8
-rw-r--r--phpBB/includes/auth/auth_ldap.php2
-rw-r--r--phpBB/includes/functions.php16
-rw-r--r--phpBB/includes/functions_profile_fields.php14
-rw-r--r--phpBB/includes/message_parser.php11
-rw-r--r--phpBB/language/en/ucp.php1
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html5
-rw-r--r--phpBB/styles/prosilver/theme/colours.css2
-rw-r--r--phpBB/styles/prosilver/theme/cp.css12
-rw-r--r--phpBB/styles/prosilver/theme/links.css6
-rw-r--r--phpBB/styles/subsilver2/template/searchbox.html2
-rw-r--r--phpBB/viewforum.php9
-rw-r--r--phpBB/viewtopic.php12
-rw-r--r--tests/bbcode/url_bbcode_test.php63
-rw-r--r--tests/mock_user.php20
-rw-r--r--tests/profile/custom_test.php55
-rw-r--r--tests/profile/fixtures/profile_fields.xml31
22 files changed, 247 insertions, 36 deletions
diff --git a/build/build_helper.php b/build/build_helper.php
index 94fc0ff3b5..2d9b86b3c3 100644
--- a/build/build_helper.php
+++ b/build/build_helper.php
@@ -177,7 +177,7 @@ class build_package
}
// Is binary?
- if (preg_match('/^Binary files ' . $package_name . '\/(.*) and [a-z0-9_-]+\/\1 differ/i', $line, $match))
+ if (preg_match('/^Binary files ' . $package_name . '\/(.*) and [a-z0-9._-]+\/\1 differ/i', $line, $match))
{
$binary[] = trim($match[1]);
}
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 74e51a8696..68508bc353 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -276,7 +276,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
- $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />';
+ $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
break;
case 'dimension':
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 9201736085..8577c08860 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -166,11 +166,11 @@
</dl>
<dl>
<dt><label for="forum_password">{L_FORUM_PASSWORD}:</label><br /><span>{L_FORUM_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" id="forum_password" name="forum_password" value="<!-- IF S_FORUM_PASSWORD_SET -->&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;<!-- ENDIF -->" /></dd>
+ <dd><input type="password" id="forum_password" name="forum_password" value="<!-- IF S_FORUM_PASSWORD_SET -->&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;<!-- ENDIF -->" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="forum_password_confirm">{L_FORUM_PASSWORD_CONFIRM}:</label><br /><span>{L_FORUM_PASSWORD_CONFIRM_EXPLAIN}</span></dt>
- <dd><input type="password" id="forum_password_confirm" name="forum_password_confirm" value="<!-- IF S_FORUM_PASSWORD_SET -->&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;<!-- ENDIF -->" /></dd>
+ <dd><input type="password" id="forum_password_confirm" name="forum_password_confirm" value="<!-- IF S_FORUM_PASSWORD_SET -->&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;<!-- ENDIF -->" autocomplete="off" /></dd>
</dl>
<!-- IF S_FORUM_PASSWORD_SET -->
<dl>
diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html
index 911dcad293..9237e45daf 100644
--- a/phpBB/adm/style/acp_users_overview.html
+++ b/phpBB/adm/style/acp_users_overview.html
@@ -43,19 +43,19 @@
</dl>
<dl>
<dt><label for="user_email">{L_EMAIL}:</label></dt>
- <dd><input class="text medium" type="text" id="user_email" name="user_email" value="{USER_EMAIL}" /></dd>
+ <dd><input class="text medium" type="text" id="user_email" name="user_email" value="{USER_EMAIL}" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="email_confirm">{L_CONFIRM_EMAIL}:</label><br /><span>{L_CONFIRM_EMAIL_EXPLAIN}</span></dt>
- <dd><input class="text medium" type="text" id="email_confirm" name="email_confirm" value="" /></dd>
+ <dd><input class="text medium" type="text" id="email_confirm" name="email_confirm" value="" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="new_password">{L_NEW_PASSWORD}:</label><br /><span>{L_CHANGE_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" id="new_password" name="new_password" value="" /></dd>
+ <dd><input type="password" id="new_password" name="new_password" value="" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}:</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" id="password_confirm" name="password_confirm" value="" /></dd>
+ <dd><input type="password" id="password_confirm" name="password_confirm" value="" autocomplete="off" /></dd>
</dl>
<p class="quick">
diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php
index e8c957aaa3..5dfa74ddab 100644
--- a/phpBB/includes/auth/auth_ldap.php
+++ b/phpBB/includes/auth/auth_ldap.php
@@ -335,7 +335,7 @@ function acp_ldap(&$new)
</dl>
<dl>
<dt><label for="ldap_password">' . $user->lang['LDAP_PASSWORD'] . ':</label><br /><span>' . $user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt>
- <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" /></dd>
+ <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" autocomplete="off" /></dd>
</dl>
';
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index c48eb6d102..b8d9e0b92e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3464,7 +3464,7 @@ function get_preg_expression($mode)
* Depends on whether installed PHP version supports unicode properties
*
* @param string $word word template to be replaced
-* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode
+* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode
*
* @return string $preg_expr regex to use with word censor
*/
@@ -3574,7 +3574,7 @@ function phpbb_checkdnsrr($host, $type = 'MX')
// but until 5.3.3 it only works for MX records
// See: http://bugs.php.net/bug.php?id=51844
- // Call checkdnsrr() if
+ // Call checkdnsrr() if
// we're looking for an MX record or
// we're not on Windows or
// we're running a PHP version where #51844 has been fixed
@@ -3594,7 +3594,7 @@ function phpbb_checkdnsrr($host, $type = 'MX')
// dns_get_record() is available since PHP 5; since PHP 5.3 also on Windows,
// but on Windows it does not work reliable for AAAA records before PHP 5.3.1
- // Call dns_get_record() if
+ // Call dns_get_record() if
// we're not looking for an AAAA record or
// we're not on Windows or
// we're running a PHP version where AAAA lookups work reliable
@@ -3624,7 +3624,7 @@ function phpbb_checkdnsrr($host, $type = 'MX')
foreach ($resultset as $result)
{
if (
- isset($result['host']) && $result['host'] == $host &&
+ isset($result['host']) && $result['host'] == $host &&
isset($result['type']) && $result['type'] == $type
)
{
@@ -4452,6 +4452,12 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
}
+ $s_search_hidden_fields = array();
+ if ($_SID)
+ {
+ $s_search_hidden_fields['sid'] = $_SID;
+ }
+
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
@@ -4541,6 +4547,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'S_LOAD_UNREADS' => ($config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered'])) ? true : false,
+ 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
+
'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme',
'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template',
'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template',
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index 78fe049f40..1eae2a9ad6 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -149,7 +149,18 @@ class custom_profile
case FIELD_DROPDOWN:
$field_value = (int) $field_value;
-
+
+ // retrieve option lang data if necessary
+ if (!isset($this->options_lang[$field_data['field_id']]) || !isset($this->options_lang[$field_data['field_id']][$field_data['lang_id']]) || !sizeof($this->options_lang[$file_data['field_id']][$field_data['lang_id']]))
+ {
+ $this->get_option_lang($field_data['field_id'], $field_data['lang_id'], FIELD_DROPDOWN, false);
+ }
+
+ if (!isset($this->options_lang[$field_data['field_id']][$field_data['lang_id']][$field_value]))
+ {
+ return 'FIELD_INVALID_VALUE';
+ }
+
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
@@ -302,6 +313,7 @@ class custom_profile
switch ($cp_result)
{
case 'FIELD_INVALID_DATE':
+ case 'FIELD_INVALID_VALUE':
case 'FIELD_REQUIRED':
$error = sprintf($user->lang[$cp_result], $row['lang_name']);
break;
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 6951dcf820..a134fab5d3 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -102,20 +102,22 @@ class bbcode_firstpass extends bbcode
/**
* Init bbcode data for later parsing
*/
- function bbcode_init()
+ function bbcode_init($allow_custom_bbcode = true)
{
static $rowset;
// This array holds all bbcode data. BBCodes will be processed in this
// order, so it is important to keep [code] in first position and
// [quote] in second position.
+ // To parse multiline URL we enable dotall option setting only for URL text
+ // but not for link itself, thus [url][/url] is not affected.
$this->bbcodes = array(
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")),
'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#uise' => "\$this->bbcode_italic('\$1')")),
- 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#uiUe' => "\$this->validate_url('\$2', '\$3')")),
+ 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiUe' => "\$this->validate_url('\$2', ('\$3') ? '\$3' : '\$4')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#uiUe' => "\$this->bbcode_img('\$1')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uise' => "\$this->bbcode_color('\$1', '\$2')")),
@@ -133,6 +135,11 @@ class bbcode_firstpass extends bbcode
$this->parsed_items[$tag] = 0;
}
+ if (!$allow_custom_bbcode)
+ {
+ return;
+ }
+
if (!is_array($rowset))
{
global $db;
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index ad7c1ccbff..c1e3c06c43 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -195,6 +195,7 @@ $lang = array_merge($lang, array(
'FIELD_INVALID_CHARS_ALPHA_ONLY' => 'The field “%s” has invalid characters, only alphanumeric characters are allowed.',
'FIELD_INVALID_CHARS_SPACERS_ONLY' => 'The field “%s” has invalid characters, only alphanumeric, space or -+_[] characters are allowed.',
'FIELD_INVALID_DATE' => 'The field “%s” has an invalid date.',
+ 'FIELD_INVALID_VALUE' => 'The field “%s” has an invalid value.',
'FOE_MESSAGE' => 'Message from foe',
'FOES_EXPLAIN' => 'Foes are users which will be ignored by default. Posts by these users will not be fully visible. Personal messages from foes are still permitted. Please note that you cannot ignore moderators or administrators.',
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 71634c9094..e13c49b59a 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -113,7 +113,7 @@
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
<div id="search-box">
- <form action="{U_SEARCH}" method="post" id="search">
+ <form action="{U_SEARCH}" method="get" id="search">
<fieldset>
<input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" />
<input class="button2" value="{L_SEARCH}" type="submit" /><br />
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index f4e80fd625..6a789074b1 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -45,11 +45,11 @@
<!-- IF S_DISPLAY_SEARCHBOX -->
<div class="search-box">
- <form method="post" id="forum-search" action="{S_SEARCHBOX_ACTION}">
+ <form method="get" id="forum-search" action="{S_SEARCHBOX_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="text" name="keywords" id="search_keywords" size="20" value="{L_SEARCH_FORUM}" onclick="if (this.value == '{LA_SEARCH_FORUM}') this.value = '';" onblur="if (this.value == '') this.value = '{LA_SEARCH_FORUM}';" />
<input class="button2" type="submit" value="{L_SEARCH}" />
- <input type="hidden" value="{FORUM_ID}" name="fid[]" />
+ {S_SEARCH_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 24c57b9a7e..98e1988d10 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -38,12 +38,11 @@
<!-- IF S_DISPLAY_SEARCHBOX -->
<div class="search-box">
- <form method="post" id="topic-search" action="{S_SEARCHBOX_ACTION}">
+ <form method="get" id="topic-search" action="{S_SEARCHBOX_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="text" name="keywords" id="search_keywords" size="20" value="{L_SEARCH_TOPIC}" onclick="if(this.value=='{LA_SEARCH_TOPIC}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_TOPIC}';" />
<input class="button2" type="submit" value="{L_SEARCH}" />
- <input type="hidden" value="{TOPIC_ID}" name="t" />
- <input type="hidden" value="msgonly" name="sf" />
+ {S_SEARCH_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index f7747ba73c..e98ce237bc 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -298,7 +298,7 @@ a.topictitle:active {
.postlink:visited {
color: #5D8FBD;
- border-bottom-color: #666666;
+ border-bottom-color: #5D8FBD;
}
.postlink:active {
diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css
index 1e0edc616f..b574b0ae1f 100644
--- a/phpBB/styles/prosilver/theme/cp.css
+++ b/phpBB/styles/prosilver/theme/cp.css
@@ -393,13 +393,11 @@ ol.def-rules li {
/* PM marking colours */
.pmlist li.bg1 {
- border: solid 3px transparent;
- border-width: 0 3px;
+ padding: 0 3px;
}
.pmlist li.bg2 {
- border: solid 3px transparent;
- border-width: 0 3px;
+ padding: 0 3px;
}
.pmlist li.pm_message_reported_colour, .pm_message_reported_colour {
@@ -408,21 +406,25 @@ ol.def-rules li {
}
.pmlist li.pm_marked_colour, .pm_marked_colour {
+ padding: 0;
border: solid 3px #ffffff;
border-width: 0 3px;
}
.pmlist li.pm_replied_colour, .pm_replied_colour {
+ padding: 0;
border: solid 3px #c2c2c2;
- border-width: 0 3px;
+ border-width: 0 3px;
}
.pmlist li.pm_friend_colour, .pm_friend_colour {
+ padding: 0;
border: solid 3px #bdbdbd;
border-width: 0 3px;
}
.pmlist li.pm_foe_colour, .pm_foe_colour {
+ padding: 0;
border: solid 3px #000000;
border-width: 0 3px;
}
diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css
index a406114054..1f6c2af550 100644
--- a/phpBB/styles/prosilver/theme/links.css
+++ b/phpBB/styles/prosilver/theme/links.css
@@ -87,11 +87,7 @@ a.topictitle:active {
padding-bottom: 0;
}
-.postlink:visited {
- color: #bdbdbd;
- border-bottom-style: dotted;
- border-bottom-color: #666666;
-}
+/* .postlink:visited { color: #bdbdbd; } */
.postlink:active {
color: #d2d2d2;
diff --git a/phpBB/styles/subsilver2/template/searchbox.html b/phpBB/styles/subsilver2/template/searchbox.html
index cb0bb5ba73..09b87a15d8 100644
--- a/phpBB/styles/subsilver2/template/searchbox.html
+++ b/phpBB/styles/subsilver2/template/searchbox.html
@@ -1 +1 @@
-<form method="post" name="search" action="{S_SEARCHBOX_ACTION}"><span class="gensmall">{L_SEARCH_FOR}:</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="{L_GO}" /></form>
+<form method="get" name="search" action="{S_SEARCHBOX_ACTION}"><span class="gensmall">{L_SEARCH_FOR}:</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="{L_GO}" />{S_SEARCH_HIDDEN_FIELDS}</form>
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 9cfa93f880..fff5be69d3 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -267,6 +267,12 @@ $post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LO
// Display active topics?
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false;
+$s_search_hidden_fields = array('fid' => $forum_id);
+if ($_SID)
+{
+ $s_search_hidden_fields['sid'] = $_SID;
+}
+
$template->assign_vars(array(
'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '',
@@ -304,7 +310,8 @@ $template->assign_vars(array(
'S_WATCHING_FORUM' => $s_watching_forum['is_watching'],
'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&amp;start=$start")),
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
- 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'fid[]=' . $forum_id),
+ 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"),
+ 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
'S_VIEWFORUM' => true,
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 53da7f539f..e4c02a88fb 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -585,6 +585,15 @@ $server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/';
// Replace naughty words in title
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
+$s_search_hidden_fields = array(
+ 't' => $topic_id,
+ 'sf' => 'msgonly',
+);
+if ($_SID)
+{
+ $s_search_hidden_fields['sid'] = $_SID;
+}
+
// Send vars to template
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
@@ -636,7 +645,8 @@ $template->assign_vars(array(
'S_VIEWTOPIC' => true,
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
- 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 't=' . $topic_id),
+ 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"),
+ 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php
new file mode 100644
index 0000000000..cd85dbd0d9
--- /dev/null
+++ b/tests/bbcode/url_bbcode_test.php
@@ -0,0 +1,63 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php';
+require_once dirname(__FILE__) . '/../mock_user.php';
+
+class phpbb_url_bbcode_test extends phpbb_test_case
+{
+ public function url_bbcode_test_data()
+ {
+ return array(
+ array(
+ 'url only',
+ '[url]http://www.phpbb.com/community/[/url]',
+ '[url:]http&#58;//www&#46;phpbb&#46;com/community/[/url:]'
+ ),
+ array(
+ 'url with title',
+ '[url=http://www.phpbb.com/community/]One line URL text[/url]',
+ '[url=http&#58;//www&#46;phpbb&#46;com/community/:]One line URL text[/url:]'
+ ),
+ array(
+ 'url with multiline title',
+ "[url=http://www.phpbb.com/community/]Multiline\x0AURL\x0Atext[/url]",
+ "[url=http&#58;//www&#46;phpbb&#46;com/community/:]Multiline\x0AURL\x0Atext[/url:]"
+ ),
+ array(
+ 'unclosed url with multiline',
+ "test [url] test \x0A test [url=http://www.phpbb.com/]test[/url] test",
+ "test [url] test \x0A test [url=http&#58;//www&#46;phpbb&#46;com/:]test[/url:] test"
+ ),
+ array(
+ 'unclosed url with multiline and title',
+ "test [url=http://www.phpbb.com/]test \x0A [url]http://phpbb.com[/url] test",
+ "test [url=http&#58;//www&#46;phpbb&#46;com/:]test \x0A [url]http://phpbb.com[/url:] test"
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider url_bbcode_test_data
+ */
+ public function test_url($description, $message, $expected)
+ {
+ global $user;
+ $user = new phpbb_mock_user;
+
+ $bbcode = new bbcode_firstpass();
+ $bbcode->message = $message;
+ $bbcode->bbcode_init(false);
+ $bbcode->parse_bbcode();
+ $this->assertEquals($expected, $bbcode->message);
+ }
+}
diff --git a/tests/mock_user.php b/tests/mock_user.php
new file mode 100644
index 0000000000..74d31c4c4a
--- /dev/null
+++ b/tests/mock_user.php
@@ -0,0 +1,20 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* Mock user class.
+* This class is used when tests invoke phpBB code expecting to have a global
+* user object, to avoid instantiating the actual user object.
+* It has a minimum amount of functionality, just to make tests work.
+*/
+class phpbb_mock_user
+{
+ public $host = "testhost";
+ public $page = array('root_script_path' => '/');
+}
diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php
new file mode 100644
index 0000000000..0e0a851243
--- /dev/null
+++ b/tests/profile/custom_test.php
@@ -0,0 +1,55 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_profile_fields.php';
+
+class phpbb_profile_custom_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/profile_fields.xml');
+ }
+
+ static public function dropdownFields()
+ {
+ return array(
+ // note, there is an offset of 1 between option_id (0-indexed)
+ // in the database and values (1-indexed) to avoid problems with
+ // transmitting 0 in an HTML form
+ // required, value, expected
+ array(1, '0', 'FIELD_INVALID_VALUE', 'Required field should throw error for out-of-range value'),
+ array(1, '1', 'FIELD_REQUIRED', 'Required field should throw error for default value'),
+ array(1, '2', false, 'Required field should accept non-default value'),
+ array(0, '0', 'FIELD_INVALID_VALUE', 'Optional field should throw error for out-of-range value'),
+ array(0, '1', false, 'Optional field should accept default value'),
+ array(0, '2', false, 'Optional field should accept non-default value'),
+ );
+ }
+
+ /**
+ * @dataProvider dropdownFields
+ */
+ public function test_dropdown_validate($field_required, $field_value, $expected, $description)
+ {
+ global $db;
+ $db = $this->new_dbal();
+
+ $field_data = array(
+ 'field_id' => 1,
+ 'lang_id' => 1,
+ 'field_novalue' => 1,
+ 'field_required' => $field_required,
+ );
+
+ $cp = new custom_profile;
+ $result = $cp->validate_profile_field(FIELD_DROPDOWN, &$field_value, $field_data);
+
+ $this->assertEquals($expected, $result, $description);
+ }
+}
diff --git a/tests/profile/fixtures/profile_fields.xml b/tests/profile/fixtures/profile_fields.xml
new file mode 100644
index 0000000000..0b2929f625
--- /dev/null
+++ b/tests/profile/fixtures/profile_fields.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_profile_fields_lang">
+ <column>field_id</column>
+ <column>lang_id</column>
+ <column>option_id</column>
+ <column>field_type</column>
+ <column>lang_value</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>5</value>
+ <value>Default Option</value>
+ </row>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>5</value>
+ <value>First Alternative</value>
+ </row>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>2</value>
+ <value>5</value>
+ <value>Third Alternative</value>
+ </row>
+ </table>
+</dataset>