aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/simple_footer.html1
-rw-r--r--phpBB/adm/style/simple_header.html1
-rw-r--r--phpBB/docs/events.md8
-rw-r--r--phpBB/includes/functions_posting.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php15
-rw-r--r--phpBB/install/database_update.php10
-rw-r--r--phpBB/styles/prosilver/template/memberlist_body.html8
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html3
-rw-r--r--phpBB/styles/prosilver/theme/colours.css4
-rw-r--r--phpBB/styles/prosilver/theme/content.css4
-rw-r--r--phpBB/styles/subsilver2/template/simple_header.html5
-rw-r--r--phpBB/styles/subsilver2/template/viewtopic_body.html1
-rw-r--r--phpBB/viewtopic.php2
-rw-r--r--tests/functional/ucp_allow_pm_test.php70
15 files changed, 123 insertions, 17 deletions
diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html
index c549a2df4e..d3f2f17bc7 100644
--- a/phpBB/adm/style/simple_footer.html
+++ b/phpBB/adm/style/simple_footer.html
@@ -21,6 +21,7 @@
<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
<!-- EVENT acp_simple_footer_after -->
+{$SCRIPTS}
</body>
</html>
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index ae25f28d32..bf8f41cd7a 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -83,6 +83,7 @@ function find_username(url)
// ]]>
</script>
<!-- EVENT acp_simple_header_head_append -->
+{$STYLESHEETS}
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index 18beb1c64a..66b558a665 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -617,6 +617,14 @@ simple_header_body_before
* Since: 3.1.0-b2
* Purpose: Add content to the header body
+simple_header_head_append
+===
+* Locations:
+ + styles/prosilver/template/simple_header.html
+ + styles/subsilver2/template/simple_header.html
+* Since: 3.1.0-b4
+* Purpose: Add asset calls directly before the `</head>` tag
+
topiclist_row_prepend
===
* Locations:
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 547ea69e81..cc46799252 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
function generate_smilies($mode, $forum_id)
{
global $db, $user, $config, $template, $phpbb_dispatcher;
- global $phpEx, $phpbb_root_path, $phpbb_container;
+ global $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_path_helper;
$base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&amp;f=' . $forum_id);
$pagination = $phpbb_container->get('pagination');
@@ -111,7 +111,7 @@ function generate_smilies($mode, $forum_id)
if (sizeof($smilies))
{
- $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
+ $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path();
foreach ($smilies as $row)
{
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 3219771c93..16b3ca8573 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -1226,6 +1226,8 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
// Check for disallowed recipients
if (!empty($address_list['u']))
{
+ $can_ignore_allow_pm = $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_');
+
// Administrator deactivated users check and we need to check their
// PM status (do they want to receive PM's?)
// Only check PM status if not a moderator or admin, since they
@@ -1233,14 +1235,11 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
$sql = 'SELECT user_id, user_allow_pm
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . '
- AND (user_type = ' . USER_INACTIVE . '
- AND user_inactive_reason = ' . INACTIVE_MANUAL . ')';
-
- $can_ignore_allow_pm = ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
- if (!$can_ignore_allow_pm)
- {
- $sql .= ' OR user_allow_pm = 0';
- }
+ AND (
+ (user_type = ' . USER_INACTIVE . '
+ AND user_inactive_reason = ' . INACTIVE_MANUAL . ')
+ ' . ($can_ignore_allow_pm ? '' : ' OR user_allow_pm = 0') . '
+ )';
$result = $db->sql_query($sql);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 6c9eeb6a75..b1bfbc1839 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -115,7 +115,13 @@ request_var('', 0, false, false, $request); // "dependency injection" for a func
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
-$orig_version = $config['version'];
+
+if (!isset($config['version_update_from']))
+{
+ $config->set('version_update_from', $config['version']);
+}
+
+$orig_version = $config['version_update_from'];
$user->add_lang(array('common', 'acp/common', 'install', 'migrator'));
@@ -287,4 +293,6 @@ else
echo $user->lang['COMPLETE_LOGIN_TO_BOARD'];
}
+$config->delete('version_update_from');
+
phpbb_end_update($cache, $config);
diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html
index dd5e27a10e..7623fbe38b 100644
--- a/phpBB/styles/prosilver/template/memberlist_body.html
+++ b/phpBB/styles/prosilver/template/memberlist_body.html
@@ -96,10 +96,10 @@
<!-- IF U_SORT_ACTIVE --><th class="active"><a href="{U_SORT_ACTIVE}#memberlist">{L_LAST_ACTIVE}</a></th><!-- ENDIF -->
<!-- ELSEIF S_SHOW_GROUP -->
<th class="name">{L_GROUP_MEMBERS}</th>
- <th class="posts">&nbsp;</th>
- <th class="info">&nbsp;</th>
- <th class="joined">&nbsp;</th>
- <!-- IF U_SORT_ACTIVE --><th class="active">&nbsp;</th><!-- ENDIF -->
+ <th class="posts">{L_POSTS}</th>
+ <th class="info"><!-- BEGIN custom_fields --><!-- IF not custom_fields.S_FIRST_ROW -->{L_COMMA_SEPARATOR} <!-- ENDIF -->{custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --></th>
+ <th class="joined">{L_JOINED}</th>
+ <!-- IF U_SORT_ACTIVE --><th class="active">{L_LAST_ACTIVE}</th><!-- ENDIF -->
<!-- ENDIF -->
</tr>
</thead>
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index f5e265ac16..48f6cc87da 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -24,6 +24,10 @@
<!-- DEFINE $POPUP = 1 -->
+<!-- EVENT simple_header_head_append -->
+
+{$STYLESHEETS}
+
</head>
<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 6adb690391..1e5700ba69 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -116,7 +116,7 @@
<!-- BEGIN postrow -->
<!-- EVENT viewtopic_body_postrow_post_before -->
<!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF -->
- <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF -->">
+ <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
<div class="inner">
<dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
@@ -131,6 +131,7 @@
<!-- IF postrow.POSTER_POSTS != '' --><dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF -->
<!-- IF postrow.POSTER_JOINED --><dd class="profile-joined"><strong>{L_JOINED}{L_COLON}</strong> {postrow.POSTER_JOINED}</dd><!-- ENDIF -->
+ <!-- IF postrow.POSTER_WARNINGS --><dd class="profile-warnings"><strong>{L_WARNINGS}{L_COLON}</strong> {postrow.POSTER_WARNINGS}</dd><!-- ENDIF -->
<!-- IF postrow.S_PROFILE_FIELD1 -->
<!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. -->
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index 39f28b4774..f43dfcfcce 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -660,6 +660,10 @@ fieldset.polls dd div {
background-image: url("./en/icon_user_online.gif");
}
+dd.profile-warnings {
+ color: #BC2A4D;
+}
+
/*
--------------------------------------------------------------
Colours and backgrounds for buttons.css
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index 11cc51f954..b66c841d7c 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -735,6 +735,10 @@ fieldset.polls dd div {
height: auto !important;
}
+dd.profile-warnings {
+ font-weight: bold;
+}
+
dd.profile-contact {
overflow: visible;
}
diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html
index 37a33415e9..36ac149691 100644
--- a/phpBB/styles/subsilver2/template/simple_header.html
+++ b/phpBB/styles/subsilver2/template/simple_header.html
@@ -9,6 +9,11 @@
<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css" />
<link rel="stylesheet" href="{T_STYLESHEET_LANG_LINK}" type="text/css" />
+
+<!-- EVENT simple_header_head_append -->
+
+{$STYLESHEETS}
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index 6ac4e0ea33..862c1a4d0b 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -204,6 +204,7 @@
<span class="postdetails">
<!-- IF postrow.POSTER_JOINED --><br /><b>{L_JOINED}{L_COLON}</b> {postrow.POSTER_JOINED}<!-- ENDIF -->
<!-- IF postrow.POSTER_POSTS != '' --><br /><b>{L_POSTS}{L_COLON}</b> {postrow.POSTER_POSTS}<!-- ENDIF -->
+ <!-- IF postrow.POSTER_WARNINGS --><br /><b>{L_WARNINGS}{L_COLON}</b> {postrow.POSTER_WARNINGS}<!-- ENDIF -->
<!-- IF postrow.S_PROFILE_FIELD1 -->
<!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. -->
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 84040af2bb..a0cd590e58 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1642,7 +1642,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'POSTER_JOINED' => $user_cache[$poster_id]['joined'],
'POSTER_POSTS' => $user_cache[$poster_id]['posts'],
'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'],
- 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'],
+ 'POSTER_WARNINGS' => $auth->acl_get('m_warn') ? $user_cache[$poster_id]['warnings'] : '',
'POSTER_AGE' => $user_cache[$poster_id]['age'],
'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false),
diff --git a/tests/functional/ucp_allow_pm_test.php b/tests/functional/ucp_allow_pm_test.php
new file mode 100644
index 0000000000..b433ec8e75
--- /dev/null
+++ b/tests/functional/ucp_allow_pm_test.php
@@ -0,0 +1,70 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_ucp_allow_pm_test extends phpbb_functional_test_case
+{
+ static protected $data = array();
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->backupStaticAttributesBlacklist += array(
+ 'phpbb_functional_ucp_allow_pm_test' => array('data'),
+ );
+ }
+
+ // user A sends a PM to user B where B accepts PM
+ public function test_enabled_pm_user_to_user()
+ {
+ // setup
+ $this->create_user('test_ucp_allow_pm_sender');
+ $this->login('test_ucp_allow_pm_sender');
+ self::$data['recipient_id'] = $this->create_user('test_ucp_allow_pm_recipient');
+ self::$data['pm_url'] = "ucp.php?i=pm&mode=compose&u=" . (int) self::$data['recipient_id'] . "&sid={$this->sid}";
+
+ // the actual test
+ $this->set_user_allow_pm(self::$data['recipient_id'], 1);
+ $crawler = self::request('GET', self::$data['pm_url']);
+ $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text());
+ }
+
+ // user A sends a PM to user B where B does not accept PM
+ public function test_disabled_pm_user_to_user()
+ {
+ $this->login('test_ucp_allow_pm_sender');
+ $this->set_user_allow_pm(self::$data['recipient_id'], 0);
+ $crawler = self::request('GET', self::$data['pm_url']);
+ $this->assertContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('.error')->text());
+ }
+
+
+ // An admin sends a PM to user B where B does not accept PM, but cannot
+ // ignore a PM from an admin
+ public function test_disabled_pm_admin_to_user()
+ {
+ $this->login();
+ $crawler = self::request('GET', self::$data['pm_url']);
+ $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text());
+ }
+
+ // enable or disable PM for a user, like from ucp
+ protected function set_user_allow_pm($user_id, $allow)
+ {
+ $db = $this->get_db();
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_allow_pm = " . $allow . "
+ WHERE user_id = " . $user_id;
+ $result = $db->sql_query($sql);
+ $db->sql_freeresult($result);
+ }
+}