diff options
-rw-r--r-- | phpBB/includes/functions_compatibility.php | 7 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 4 | ||||
-rw-r--r-- | phpBB/memberlist.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php | 5 | ||||
-rw-r--r-- | tests/functional/memberlist_test.php | 28 |
5 files changed, 42 insertions, 8 deletions
diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index fbb1f0e03d..43952ae57a 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -101,18 +101,21 @@ function phpbb_clean_path($path) } else if (!$phpbb_path_helper) { + global $phpbb_root_path, $phpEx; + // The container is not yet loaded, use a new instance if (!class_exists('\phpbb\path_helper')) { - global $phpbb_root_path, $phpEx; require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); } + $request = new phpbb\request\request(); $phpbb_path_helper = new phpbb\path_helper( new phpbb\symfony_request( - new phpbb\request\request() + $request ), new phpbb\filesystem(), + $request, $phpbb_root_path, $phpEx ); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 745eb20c77..48c34ecfe6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1491,7 +1491,7 @@ function phpbb_get_user_rank($user_data, $user_posts) /** * Prepare profile data */ -function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false) +function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true) { global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher; @@ -1559,7 +1559,7 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl } // Can this user receive a Private Message? - $can_receive_pm = ( + $can_receive_pm = $check_can_receive_pm && ( // They must be a "normal" user $data['user_type'] != USER_IGNORE && diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index e3ac8dad51..4f31178ffb 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1089,9 +1089,9 @@ switch ($mode) { $user_rank_data = phpbb_get_user_rank($group_row, false); - if ($rank_img) + if ($user_rank_data['img']) { - $rank_img .= '<br />'; + $user_rank_data['img'] .= '<br />'; } } @@ -1427,7 +1427,7 @@ switch ($mode) $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array(); } - $memberrow = array_merge(phpbb_show_profile($row), array( + $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( 'ROW_NUMBER' => $i + ($start + 1), 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php index f593c32181..2cc7786046 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php @@ -55,6 +55,9 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration public function hash_old_passwords() { + global $phpbb_container; + + $passwords_manager = $phpbb_container->get('passwords.manager'); $sql = 'SELECT user_id, user_password FROM ' . $this->table_prefix . 'users WHERE user_pass_convert = 1'; @@ -65,7 +68,7 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration if (strlen($row['user_password']) == 32) { $sql_ary = array( - 'user_password' => phpbb_hash($row['user_password']), + 'user_password' => '$CP$' . $passwords_manager->hash($row['user_password'], 'passwords.driver.salted_md5'), ); $this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']); diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index c76ba6e37d..1da5c39401 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -106,4 +106,32 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case $this->assertContains('admin', $crawler->eq(0)->text()); $this->assertNotContains('admin', $crawler->eq(1)->text()); } + + public function test_group_rank() + { + copy(__DIR__ . '/fixtures/files/valid.jpg', __DIR__ . '/../../phpBB/images/ranks/valid.jpg'); + + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/groups', 'acp/posting')); + + // Set a group rank to the registered users + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_groups&mode=manage&action=edit&g=2"); + $form = $crawler->selectButton('Submit')->form(); + $form['group_rank']->select('1'); + $crawler = self::submit($form); + $this->assertContainsLang('GROUP_UPDATED', $crawler->filter('.successbox')->text()); + + // Set a rank image for site_admin + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_ranks&mode=ranks&action=edit&id=1"); + $form = $crawler->selectButton('Submit')->form(); + $form['rank_image']->select('valid.jpg'); + $crawler = self::submit($form); + $this->assertContainsLang('RANK_UPDATED', $crawler->filter('.successbox')->text()); + + $crawler = self::request('GET', 'memberlist.php?mode=group&g=2'); + $this->assertContains('memberlist-test-user', $crawler->text()); + + unlink(__DIR__ . '/../../phpBB/images/ranks/valid.jpg'); + } } |