diff options
-rw-r--r-- | phpBB/adm/style/simple_footer.html | 1 | ||||
-rw-r--r-- | phpBB/adm/style/simple_header.html | 1 | ||||
-rwxr-xr-x | phpBB/bin/phpbbcli.php | 1 | ||||
-rw-r--r-- | phpBB/config/console.yml | 11 | ||||
-rw-r--r-- | phpBB/docs/events.md | 8 | ||||
-rw-r--r-- | phpBB/feed.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 4 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 15 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/cache/purge.php | 62 | ||||
-rw-r--r-- | phpBB/phpbb/feed/forum.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/feed/topic.php | 7 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_body.html | 8 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/simple_header.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/viewtopic_body.html | 3 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/colours.css | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/content.css | 16 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/simple_header.html | 5 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/viewtopic_body.html | 1 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 2 | ||||
-rw-r--r-- | tests/functional/feed_test.php | 21 | ||||
-rw-r--r-- | tests/functional/ucp_allow_pm_test.php | 70 |
21 files changed, 216 insertions, 33 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/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index 02d6b88943..dd5c8fa774 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -21,6 +21,7 @@ require($phpbb_root_path . 'includes/startup.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 3d57c257dd..1340d9c0d7 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -1,4 +1,15 @@ services: + console.command.cache.purge: + class: phpbb\console\command\cache\purge + arguments: + - @cache.driver + - @dbal.conn + - @auth + - @log + - @user + tags: + - { name: console.command } + console.command.config.delete: class: phpbb\console\command\config\delete arguments: 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/feed.php b/phpBB/feed.php index 0c4cc32fdb..db0ed5364e 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -100,6 +100,8 @@ while ($row = $feed->get_item()) $published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0; $updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0; + $display_attachments = ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false; + $item_row = array( 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '', 'published' => ($published > 0) ? $phpbb_feed_helper->format_date($published) : '', @@ -108,7 +110,7 @@ while ($row = $feed->get_item()) 'title' => censor_text($title), 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '', 'category_name' => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', - 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ((isset($row['post_attachment']) && $row['post_attachment']) ? $feed->get_attachments($row['post_id']) : array()))), + 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))), 'statistics' => '', ); 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&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/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php new file mode 100644 index 0000000000..017bdc5144 --- /dev/null +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -0,0 +1,62 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ +namespace phpbb\console\command\cache; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class purge extends \phpbb\console\command\command +{ + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\log\log */ + protected $log; + + /** @var \phpbb\user */ + protected $user; + + function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user) + { + $this->cache = $cache; + $this->db = $db; + $this->auth = $auth; + $this->log = $log; + $this->user = $user; + $this->user->add_lang(array('acp/common')); + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cache:purge') + ->setDescription('Purge the cache.') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->cache->purge(); + + // Clear permissions + $this->auth->acl_clear_prefetch(); + phpbb_cache_moderators($this->db, $this->cache, $this->auth); + + $this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array()); + + $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS')); + } +} diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 8e6490923d..e35ec4baa4 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -132,6 +132,7 @@ class forum extends \phpbb\feed\post_base parent::adjust_item($item_row, $row); $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; + $item_row['forum_id'] = $this->forum_id; } function get_item() diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index fb49aa65cc..10b0f4f645 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -105,6 +105,13 @@ class topic extends \phpbb\feed\post_base return true; } + function adjust_item(&$item_row, &$row) + { + parent::adjust_item($item_row, $row); + + $item_row['forum_id'] = $this->forum_id; + } + function get_item() { return ($row = parent::get_item()) ? array_merge($this->topic_data, $row) : $row; 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"> </th> - <th class="info"> </th> - <th class="joined"> </th> - <!-- IF U_SORT_ACTIVE --><th class="active"> </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 db752d7068..b66c841d7c 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -32,7 +32,7 @@ ul.topiclist dt, ul.topiclist dd { ul.topiclist dt { width: 100%; - margin-right: -410px; + margin-right: -440px; font-size: 1.1em; } @@ -49,7 +49,7 @@ ul.topiclist.two-columns dt { } ul.topiclist dt .list-inner { - margin-right: 410px; + margin-right: 440px; padding-left: 5px; padding-right: 5px; } @@ -119,11 +119,11 @@ li.header dt, li.header dd { li.header dt { font-weight: bold; width: 100%; - margin-right: -410px; + margin-right: -440px; } li.header dt .list-inner { - margin-right: 410px; + margin-right: 440px; } li.header dd { @@ -181,6 +181,10 @@ dd.posts, dd.topics, dd.views, dd.extra, dd.mark { font-size: 1.2em; } +dd.posts, dd.topics, dd.views { + width: 95px; +} + /* List in forum description */ dl.icon dt ol, dl.icon dt ul { @@ -731,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/feed_test.php b/tests/functional/feed_test.php index b6287bf10f..86d3930a7b 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -1195,7 +1195,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_create_missing_attachment_post() { - $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->login(); $this->load_ids(array( 'forums' => array( @@ -1216,7 +1215,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case public function test_feeds_missing_attachment_admin() { - $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418'); $this->load_ids(array( 'forums' => array( 'Feeds #1', @@ -1252,7 +1250,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'overall' => array( array( - 'nb_entries' => 13, + 'nb_entries' => 12, 'contents' => array( 1 => 'Attachment #0', ), @@ -1260,12 +1258,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], - 'displayed' => false, + 'displayed' => true, ), ), ), @@ -1273,12 +1271,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_new' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'attachments' => array( 1 => array( // First entry array( // First attachment to fetch 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], - 'displayed' => false, + 'displayed' => true, ), ), ), @@ -1286,7 +1284,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), 'topics_active' => array( array( - 'nb_entries' => 9, + 'nb_entries' => 8, 'contents' => array( 1 => 'Attachment #0', ), @@ -1396,13 +1394,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case if ($attachment['displayed']) { $this->assertContains($url, $content, "Tested feed : 'feed.php{$params}'"); - // $this->assertNotContains($string, $content, "Tested feed : 'feed.php{$params}'"); + $this->assertNotContains($string, $content, "Tested feed : 'feed.php{$params}'"); } else { - // Disabled until PHPBB3-12421 is fixed and merged - // $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'"); - // $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'"); + $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'"); + $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'"); } } } 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); + } +} |