aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build_helper.php2
-rw-r--r--phpBB/adm/index.php6
-rw-r--r--phpBB/adm/style/acp_forums.html4
-rw-r--r--phpBB/adm/style/acp_users_overview.html8
-rw-r--r--phpBB/includes/acp/acp_board.php13
-rw-r--r--phpBB/includes/auth/auth_ldap.php2
-rw-r--r--phpBB/includes/captcha/captcha_gd.php2
-rw-r--r--phpBB/includes/functions.php32
-rw-r--r--phpBB/includes/functions_profile_fields.php14
-rw-r--r--phpBB/includes/session.php6
-rw-r--r--phpBB/includes/ucp/ucp_pm.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php31
-rw-r--r--phpBB/language/en/acp/board.php10
-rw-r--r--phpBB/language/en/ucp.php2
-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/styles/subsilver2/template/viewtopic_body.html2
-rw-r--r--phpBB/viewforum.php9
-rw-r--r--phpBB/viewtopic.php12
-rw-r--r--tests/profile/custom_test.php55
-rw-r--r--tests/profile/fixtures/profile_fields.xml31
-rw-r--r--tests/random/mt_rand.php46
27 files changed, 271 insertions, 53 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 dd8f4c279d..68508bc353 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -237,7 +237,7 @@ function build_select($option_ary, $option_default = false)
/**
* Build radio fields in acp pages
*/
-function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = false)
+function h_radio($name, $input_ary, $input_default = false, $id = false, $key = false, $separator = '')
{
global $user;
@@ -246,7 +246,7 @@ function h_radio($name, &$input_ary, $input_default = false, $id = false, $key =
foreach ($input_ary as $value => $title)
{
$selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : '';
- $html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>';
+ $html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>' . $separator;
$id_assigned = true;
}
@@ -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/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index a5e80e1f6d..d38c4d58ba 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -769,13 +769,20 @@ class acp_board
{
global $user, $config;
- $radio_ary = array(USER_ACTIVATION_DISABLE => 'ACC_DISABLE', USER_ACTIVATION_NONE => 'ACC_NONE');
+ $radio_ary = array(
+ USER_ACTIVATION_DISABLE => 'ACC_DISABLE',
+ USER_ACTIVATION_NONE => 'ACC_NONE',
+ );
+
if ($config['email_enable'])
{
- $radio_ary += array(USER_ACTIVATION_SELF => 'ACC_USER', USER_ACTIVATION_ADMIN => 'ACC_ADMIN');
+ $radio_ary[USER_ACTIVATION_SELF] = 'ACC_USER';
+ $radio_ary[USER_ACTIVATION_ADMIN] = 'ACC_ADMIN';
}
- return h_radio('config[require_activation]', $radio_ary, $value, $key);
+ $radio_text = h_radio('config[require_activation]', $radio_ary, $value, 'require_activation', $key, '<br />');
+
+ return $radio_text;
}
/**
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/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index 5f24618aab..ecdad43978 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -77,7 +77,7 @@ class captcha
{
$denom = ($code_len - $i);
$denom = max(1.3, $denom);
- $offset[$i] = mt_rand(0, (1.5 * $width_avail) / $denom);
+ $offset[$i] = phpbb_mt_rand(0, (int) round((1.5 * $width_avail) / $denom));
$width_avail -= $offset[$i];
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 2d9d2c225f..b8d9e0b92e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -250,6 +250,22 @@ function unique_id($extra = 'c')
}
/**
+* Wrapper for mt_rand() which allows swapping $min and $max parameters.
+*
+* PHP does not allow us to swap the order of the arguments for mt_rand() anymore.
+* (since PHP 5.3.4, see http://bugs.php.net/46587)
+*
+* @param int $min Lowest value to be returned
+* @param int $max Highest value to be returned
+*
+* @return int Random integer between $min and $max (or $max and $min)
+*/
+function phpbb_mt_rand($min, $max)
+{
+ return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max);
+}
+
+/**
* Return formatted string for filesizes
*
* @param int $value filesize in bytes
@@ -3448,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
*/
@@ -3558,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
@@ -3578,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
@@ -3608,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
)
{
@@ -4436,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'],
@@ -4525,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/session.php b/phpBB/includes/session.php
index d803f8d799..2181375dc1 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1238,6 +1238,12 @@ class session
$ip = $this->ip;
}
+ // Neither Spamhaus nor Spamcop supports IPv6 addresses.
+ if (strpos($ip, ':') !== false)
+ {
+ return false;
+ }
+
$dnsbl_check = array(
'sbl.spamhaus.org' => 'http://www.spamhaus.org/query/bl?ip=',
);
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index e1c51170db..c675928a5b 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -115,7 +115,7 @@ class ucp_pm
case 'compose':
$action = request_var('action', 'post');
- get_folder($user->data['user_id']);
+ $user_folders = get_folder($user->data['user_id']);
if (!$auth->acl_get('u_sendpm'))
{
@@ -130,7 +130,7 @@ class ucp_pm
}
include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx);
- compose_pm($id, $mode, $action);
+ compose_pm($id, $mode, $action, $user_folders);
$tpl_file = 'posting_body';
break;
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b596e72c41..05243e3d7a 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -20,7 +20,7 @@ if (!defined('IN_PHPBB'))
* Compose private message
* Called from ucp_pm with mode == 'compose'
*/
-function compose_pm($id, $mode, $action)
+function compose_pm($id, $mode, $action, $user_folders = array())
{
global $template, $db, $auth, $user;
global $phpbb_root_path, $phpEx, $config;
@@ -135,6 +135,7 @@ function compose_pm($id, $mode, $action)
}
$sql = '';
+ $folder_id = 0;
// What is all this following SQL for? Well, we need to know
// some basic information in all cases before we do anything.
@@ -398,7 +399,7 @@ function compose_pm($id, $mode, $action)
unset($message_text);
$s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=$mode&amp;action=$action", true, $user->session_id);
- $s_action .= ($msg_id) ? "&amp;p=$msg_id" : '';
+ $s_action .= (($folder_id) ? "&amp;f=$folder_id" : '') . (($msg_id) ? "&amp;p=$msg_id" : '');
// Delete triggered ?
if ($action == 'delete')
@@ -741,10 +742,30 @@ function compose_pm($id, $mode, $action)
$msg_id = submit_pm($action, $subject, $pm_data);
$return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=view&amp;p=' . $msg_id);
- $return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=outbox');
- meta_refresh(3, $return_message_url);
+ $inbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox');
+ $outbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=outbox');
+
+ $folder_url = '';
+ if (($folder_id > 0) && isset($user_folders[$folder_id]))
+ {
+ $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=' . $folder_id);
+ }
+
+ $return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url;
+ $return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX';
+
- $message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']);
+ $message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>');
+
+ $last_click_type = 'CLICK_RETURN_FOLDER';
+ if ($folder_url)
+ {
+ $message .= '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $folder_url . '">', '</a>', $user_folders[$folder_id]['folder_name']);
+ $last_click_type = 'CLICK_GOTO_FOLDER';
+ }
+ $message .= '<br /><br />' . sprintf($user->lang[$last_click_type], '<a href="' . $return_box_url . '">', '</a>', $user->lang[$return_box_lang]);
+
+ meta_refresh(3, $return_message_url);
trigger_error($message);
}
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 5293b835d6..10e4aa7b6b 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -208,16 +208,16 @@ $lang = array_merge($lang, array(
'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.',
'ACC_ACTIVATION' => 'Account activation',
- 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations.',
+ 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide e-mail” must be enabled in order to use user or admin activation.',
'NEW_MEMBER_POST_LIMIT' => 'New member post limit',
'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the <em>Newly Registered Users</em> group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. <strong>A value of 0 disables this feature.</strong>',
'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default',
'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes, and a new member post limit is specified, newly registered users will not only be put into the <em>Newly Registered Users</em> group, but this group will also be their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.',
- 'ACC_ADMIN' => 'By Admin',
- 'ACC_DISABLE' => 'Disable',
- 'ACC_NONE' => 'None',
- 'ACC_USER' => 'By User',
+ 'ACC_ADMIN' => 'By admin',
+ 'ACC_DISABLE' => 'Disable registration',
+ 'ACC_NONE' => 'No activation (immediate access)',
+ 'ACC_USER' => 'By user (e-mail verification)',
// 'ACC_USER_ADMIN' => 'User + Admin',
'ALLOW_EMAIL_REUSE' => 'Allow e-mail address re-use',
'ALLOW_EMAIL_REUSE_EXPLAIN' => 'Different users can register with the same e-mail address.',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 02b8a282d9..c1e3c06c43 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -119,6 +119,7 @@ $lang = array_merge($lang, array(
'CANNOT_REMOVE_FOLDER' => 'This folder cannot be removed.',
'CHANGE_DEFAULT_GROUP' => 'Change default group',
'CHANGE_PASSWORD' => 'Change password',
+ 'CLICK_GOTO_FOLDER' => '%1$sGo to your “%3$s” folder%2$s',
'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s” folder%2$s',
'CONFIRMATION' => 'Confirmation of registration',
'CONFIRM_CHANGES' => 'Confirm changes',
@@ -194,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 51fff0735a..05ddc48123 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -114,7 +114,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/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index bba00ce685..630871af61 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -150,7 +150,7 @@
<!-- IF postrow.POST_ICON_IMG -->
<td><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" title="" /></td>
<!-- ENDIF -->
- <td class="gensmall" width="100%"><div style="float: {S_CONTENT_FLOW_BEGIN};">&nbsp;<b>{L_POST_SUBJECT}:</b> {postrow.POST_SUBJECT}</div><div style="float: {S_CONTENT_FLOW_END};"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><b>{L_POSTED}:</b> {postrow.POST_DATE}&nbsp;</div></td>
+ <td class="gensmall" width="100%"><div style="float: {S_CONTENT_FLOW_BEGIN};">&nbsp;<b>{L_POST_SUBJECT}:</b> <a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></div><div style="float: {S_CONTENT_FLOW_END};"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><b>{L_POSTED}:</b> {postrow.POST_DATE}&nbsp;</div></td>
</tr>
</table>
</td>
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/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>
diff --git a/tests/random/mt_rand.php b/tests/random/mt_rand.php
new file mode 100644
index 0000000000..d6502c4e80
--- /dev/null
+++ b/tests/random/mt_rand.php
@@ -0,0 +1,46 @@
+<?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.php';
+
+class phpbb_random_mt_rand_test extends phpbb_test_case
+{
+ public function test_max_equals_min()
+ {
+ $result = phpbb_mt_rand(42, 42);
+ $this->assertEquals(42, $result);
+ }
+
+ public function test_max_equals_min_negative()
+ {
+ $result = phpbb_mt_rand(-42, -42);
+ $this->assertEquals(-42, $result);
+ }
+
+ public function test_max_greater_min()
+ {
+ $result = phpbb_mt_rand(3, 4);
+ $this->assertGreaterThanOrEqual(3, $result);
+ $this->assertLessThanOrEqual(4, $result);
+ }
+
+ public function test_min_greater_max()
+ {
+ $result = phpbb_mt_rand(4, 3);
+ $this->assertGreaterThanOrEqual(3, $result);
+ $this->assertLessThanOrEqual(4, $result);
+ }
+
+ public function test_min_greater_max_negative()
+ {
+ $result = phpbb_mt_rand(-3, -4);
+ $this->assertGreaterThanOrEqual(-4, $result);
+ $this->assertLessThanOrEqual(-3, $result);
+ }
+}