From 0a707dd1ceec36b53ea45889b27051ed8a9a4e4b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 12 May 2013 11:35:46 +0200 Subject: [PATCH 001/284] [ticket/11531] Add basic set of functional tests for new avatar system This currently includes tests for the gravatar, remote avatar, and upload avatar drivers. The local avatar driver is currently not supported. Two tests currently fail and have been marked as incomplete. One failure is due to an issue with Symfony's DomCrawler that exists in Symfony < 2.2. The other one is caused by a bug in the way remote avatars are treated. According to my tests, this bug also exists in phpBB 3.0.11 and has been reported in the tracker: http://tracker.phpbb.com/browse/PHPBB3-11534 PHPBB3-11531 --- tests/functional/avatar_test.php | 210 +++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 tests/functional/avatar_test.php diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php new file mode 100644 index 0000000000..b6dcc16e8a --- /dev/null +++ b/tests/functional/avatar_test.php @@ -0,0 +1,210 @@ +path = __DIR__ . '/fixtures/files/'; + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/board', 'ucp')); + } + + public function test_acp_settings() + { + $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + // Check the default entries we should have + $this->assertContains($this->lang('ALLOW_GRAVATAR'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_gravatar]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + } + + public function test_gravatar_avatar() + { + // Get ACP settings + $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $this->form_content = $form->getValues(); + + // Check if required form elements exist + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContains($this->lang('AVATAR_DRIVER_GRAVATAR_TITLE'), $crawler->filter('#avatar_driver')->text()); + $this->assertContains($this->lang('GRAVATAR_AVATAR_EMAIL'), $crawler->text()); + + // Submit gravatar with correct email and correct size + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test@example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + + // Submit gravatar with correct mail but incorrect size + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test@example.com'); + $form['avatar_gravatar_width']->setValue(120); + $form['avatar_gravatar_height']->setValue(120); + $crawler = $this->client->submit($form); + $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], + $this->form_content['config[avatar_min_width]'], + $this->form_content['config[avatar_min_height]'], + $this->form_content['config[avatar_max_width]'], + $this->form_content['config[avatar_max_height]'], + '120', + '120' + ), $crawler->text()); + + // Submit gravatar with incorrect email and correct size + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test.example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + } + + public function test_upload_avatar() + { + // Check if required form elements exist + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains($this->lang('AVATAR_DRIVER_UPLOAD_TITLE'), $crawler->filter('#avatar_driver')->text()); + $this->assertContains($this->lang('UPLOAD_AVATAR_FILE'), $crawler->text()); + $this->assertContains($this->lang('UPLOAD_AVATAR_URL'), $crawler->text()); + + // Upload remote avatar with correct size and correct link + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and default size = 80px + $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + + // This will fail as the upload avatar currently expects a file that ends with an extension, e.g. .jpg + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and size (s) = 80px + $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('AVATAR_URL_INVALID'), $crawler->text()); + + // Submit gravatar with correct email and correct size + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $this->markTestIncomplete('Test fails due to bug in DomCrawler with Symfony < 2.2: https://github.com/symfony/symfony/issues/4674.'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + $form['avatar_upload_file']->setValue($this->path . 'valid.jpg'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + } + + public function test_remote_avatar() + { + // Get ACP settings + $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $this->form_content = $form->getValues(); + + // Check if required form elements exist + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains($this->lang('AVATAR_DRIVER_REMOTE_TITLE'), $crawler->filter('#avatar_driver')->text()); + $this->assertContains($this->lang('LINK_REMOTE_AVATAR'), $crawler->text()); + $this->assertContains($this->lang('LINK_REMOTE_SIZE'), $crawler->text()); + + // Set remote avatar with correct size and correct link + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_remote'); + // use default gravatar supplied by test@example.com and default size = 80px + $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $form['avatar_remote_width']->setValue(80); + $form['avatar_remote_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + + // Set remote avatar with incorrect size + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_remote'); + // use default gravatar supplied by test@example.com and size (s) = 80px + $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $form['avatar_remote_width']->setValue(120); + $form['avatar_remote_height']->setValue(120); + $crawler = $this->client->submit($form); + $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], + $this->form_content['config[avatar_min_width]'], + $this->form_content['config[avatar_min_height]'], + $this->form_content['config[avatar_max_width]'], + $this->form_content['config[avatar_max_height]'], + '120', + '120' + ), $crawler->text()); + + // Enter correct data in form entries but select incorrect avatar driver + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and size (s) = 80px + $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $form['avatar_remote_width']->setValue(80); + $form['avatar_remote_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('NO_AVATAR_SELECTED'), $crawler->text()); + + /* + * Enter incorrect link to a remote avatar_driver + * Due to the fact that this link to phpbb.com will not serve a 404 error but rather a 404 page, + * the remote avatar will think that this is a properly working avatar. This Bug also exists in + * the current phpBB 3.0.11 release. + */ + $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + $this->markTestIncomplete('Test currently fails because the remote avatar does not seem to check if it is an image'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_remote'); + // use random incorrect link to phpBB.com + $form['avatar_remote_url']->setValue('https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $form['avatar_remote_width']->setValue(80); + $form['avatar_remote_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('NO_AVATAR_SELECTED'), $crawler->text()); + } +} From 9c4d8b3193ca853d67c0098e1627db17f7dd0311 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 13 May 2013 11:57:41 +0200 Subject: [PATCH 002/284] [ticket/11531] Add acp and ucp groups functional tests for avatars The test for the acp and ucp groups settings are currently marked as incomplete due to a bug that causes the settings to not show an error when incorrect data is entered. However, the avatar data is not saved. That means that even though the error treatment seems to correctly work, the user is never informed of the issues with the submitted avatar data. PHPBB3-11531 --- tests/functional/avatar_acp_test.php | 147 +++++++++++++++++++++++++++ tests/functional/avatar_test.php | 46 ++++++++- 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 tests/functional/avatar_acp_test.php diff --git a/tests/functional/avatar_acp_test.php b/tests/functional/avatar_acp_test.php new file mode 100644 index 0000000000..b359212be2 --- /dev/null +++ b/tests/functional/avatar_acp_test.php @@ -0,0 +1,147 @@ +path = __DIR__ . '/fixtures/files/'; + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); + } + + public function test_acp_settings() + { + $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + $this->assert_response_success(); + // Check the default entries we should have + $this->assertContains($this->lang('ALLOW_GRAVATAR'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_gravatar]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + } + + public function test_user_acp_settings() + { + $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); + $this->assert_response_success(); + + // Select "Avatar" in the drop-down menu + $form = $crawler->selectButton($this->lang('GO'))->form(); + $form['mode']->select('avatar'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test@example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('USER_AVATAR_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); + $this->assert_response_success(); + + // Select "Avatar" in the drop-down menu + $form = $crawler->selectButton($this->lang('GO'))->form(); + $form['mode']->select('avatar'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + + // Test uploading a remote avatar + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and default size = 80px + $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('USER_AVATAR_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); + $this->assert_response_success(); + + // Select "Avatar" in the drop-down menu + $form = $crawler->selectButton($this->lang('GO'))->form(); + $form['mode']->select('avatar'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + + // Submit gravatar with incorrect email and correct size + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test.example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + } + + public function test_group_acp_settings() + { + // Test setting group avatar of admin group + $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test@example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + + // Test uploading a remote avatar + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and default size = 80px + $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + + // Submit gravatar with incorrect email and correct size + $this->markTestIncomplete('No error when submitting incorrect acp group settings. This needs to be fixed ASAP.'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test.example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + } +} diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php index b6dcc16e8a..a29fb5ddb9 100644 --- a/tests/functional/avatar_test.php +++ b/tests/functional/avatar_test.php @@ -21,7 +21,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $this->path = __DIR__ . '/fixtures/files/'; $this->login(); $this->admin_login(); - $this->add_lang(array('acp/board', 'ucp')); + $this->add_lang(array('acp/board', 'ucp', 'acp/groups')); } public function test_acp_settings() @@ -207,4 +207,48 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $crawler = $this->client->submit($form); $this->assertContains($this->lang('NO_AVATAR_SELECTED'), $crawler->text()); } + + + public function test_group_ucp_settings() + { + // Test setting group avatar of admin group + $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test@example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + + // Test uploading a remote avatar + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_upload'); + // use default gravatar supplied by test@example.com and default size = 80px + $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + + // Go back to previous page + $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $this->assert_response_success(); + + // Submit gravatar with incorrect email and correct size + $this->markTestIncomplete('No error when submitting incorrect ucp group settings. This needs to be fixed ASAP.'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->select('avatar_driver_gravatar'); + $form['avatar_gravatar_email']->setValue('test.example.com'); + $form['avatar_gravatar_width']->setValue(80); + $form['avatar_gravatar_height']->setValue(80); + $crawler = $this->client->submit($form); + $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + } } From 76453b48ddededb9397e81aea8a75f419fcdc24b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 25 May 2013 18:15:54 +0200 Subject: [PATCH 003/284] [ticket/11531] Use assertContainsLang() where possible PHBB3-11531 --- tests/functional/avatar_acp_test.php | 30 ++++++++-------- tests/functional/avatar_test.php | 52 ++++++++++++++-------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/functional/avatar_acp_test.php b/tests/functional/avatar_acp_test.php index b359212be2..623911fbf1 100644 --- a/tests/functional/avatar_acp_test.php +++ b/tests/functional/avatar_acp_test.php @@ -29,10 +29,10 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); $this->assert_response_success(); // Check the default entries we should have - $this->assertContains($this->lang('ALLOW_GRAVATAR'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); + $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); + $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); + $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); // Now start setting the needed settings $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -41,7 +41,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['config[allow_avatar_remote]']->select(1); $form['config[allow_avatar_remote_upload]']->select(1); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); } public function test_user_acp_settings() @@ -53,7 +53,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -62,7 +62,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('USER_AVATAR_UPDATED'), $crawler->text()); + $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); @@ -72,7 +72,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test uploading a remote avatar $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -80,7 +80,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('USER_AVATAR_UPDATED'), $crawler->text()); + $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); @@ -90,7 +90,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Submit gravatar with incorrect email and correct size $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -99,7 +99,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } public function test_group_acp_settings() @@ -107,7 +107,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case // Test setting group avatar of admin group $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -116,7 +116,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); @@ -128,7 +128,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); @@ -142,6 +142,6 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } } diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php index a29fb5ddb9..e94eb4dcad 100644 --- a/tests/functional/avatar_test.php +++ b/tests/functional/avatar_test.php @@ -29,10 +29,10 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); $this->assert_response_success(); // Check the default entries we should have - $this->assertContains($this->lang('ALLOW_GRAVATAR'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); + $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); + $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); + $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); // Now start setting the needed settings $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -41,7 +41,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['config[allow_avatar_remote]']->select(1); $form['config[allow_avatar_remote_upload]']->select(1); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); } public function test_gravatar_avatar() @@ -55,9 +55,9 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); - $this->assertContains($this->lang('AVATAR_DRIVER_GRAVATAR_TITLE'), $crawler->filter('#avatar_driver')->text()); - $this->assertContains($this->lang('GRAVATAR_AVATAR_EMAIL'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); + $this->assertContainsLang('AVATAR_DRIVER_GRAVATAR_TITLE', $crawler->filter('#avatar_driver')->text()); + $this->assertContainsLang('GRAVATAR_AVATAR_EMAIL', $crawler->text()); // Submit gravatar with correct email and correct size $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -66,7 +66,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // Submit gravatar with correct mail but incorrect size $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); @@ -92,7 +92,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } public function test_upload_avatar() @@ -100,9 +100,9 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('AVATAR_DRIVER_UPLOAD_TITLE'), $crawler->filter('#avatar_driver')->text()); - $this->assertContains($this->lang('UPLOAD_AVATAR_FILE'), $crawler->text()); - $this->assertContains($this->lang('UPLOAD_AVATAR_URL'), $crawler->text()); + $this->assertContainsLang('AVATAR_DRIVER_UPLOAD_TITLE', $crawler->filter('#avatar_driver')->text()); + $this->assertContainsLang('UPLOAD_AVATAR_FILE', $crawler->text()); + $this->assertContainsLang('UPLOAD_AVATAR_URL', $crawler->text()); // Upload remote avatar with correct size and correct link $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -110,7 +110,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // This will fail as the upload avatar currently expects a file that ends with an extension, e.g. .jpg $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); @@ -120,7 +120,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // use default gravatar supplied by test@example.com and size (s) = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('AVATAR_URL_INVALID'), $crawler->text()); + $this->assertContainsLang('AVATAR_URL_INVALID', $crawler->text()); // Submit gravatar with correct email and correct size $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); @@ -130,7 +130,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_driver']->select('avatar_driver_upload'); $form['avatar_upload_file']->setValue($this->path . 'valid.jpg'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); } public function test_remote_avatar() @@ -144,9 +144,9 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('AVATAR_DRIVER_REMOTE_TITLE'), $crawler->filter('#avatar_driver')->text()); - $this->assertContains($this->lang('LINK_REMOTE_AVATAR'), $crawler->text()); - $this->assertContains($this->lang('LINK_REMOTE_SIZE'), $crawler->text()); + $this->assertContainsLang('AVATAR_DRIVER_REMOTE_TITLE', $crawler->filter('#avatar_driver')->text()); + $this->assertContainsLang('LINK_REMOTE_AVATAR', $crawler->text()); + $this->assertContainsLang('LINK_REMOTE_SIZE', $crawler->text()); // Set remote avatar with correct size and correct link $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -156,7 +156,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('PROFILE_UPDATED'), $crawler->text()); + $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // Set remote avatar with incorrect size $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); @@ -187,7 +187,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('NO_AVATAR_SELECTED'), $crawler->text()); + $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); /* * Enter incorrect link to a remote avatar_driver @@ -205,7 +205,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('NO_AVATAR_SELECTED'), $crawler->text()); + $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); } @@ -214,7 +214,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // Test setting group avatar of admin group $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); $this->assert_response_success(); - $this->assertContains($this->lang('AVATAR_TYPE'), $crawler->text()); + $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -223,7 +223,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); @@ -235,7 +235,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text()); + $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); @@ -249,6 +249,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); $crawler = $this->client->submit($form); - $this->assertContains($this->lang('EMAIL_INVALID_EMAIL'), $crawler->text()); + $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } } From 79823b9cafb41f4f9405c6a5bf7e0c46b0aa751b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 25 May 2013 18:17:33 +0200 Subject: [PATCH 004/284] [ticket/11531] Remove incomplete flags for tests after merging PR #1404 Issues should be fixed by the now resolved ticket PHPBB3-11535: http://tracker.phpbb.com/browse/PHPBB3-11535 PHPBB3-11531 --- tests/functional/avatar_acp_test.php | 1 - tests/functional/avatar_test.php | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/functional/avatar_acp_test.php b/tests/functional/avatar_acp_test.php index 623911fbf1..efd0317571 100644 --- a/tests/functional/avatar_acp_test.php +++ b/tests/functional/avatar_acp_test.php @@ -135,7 +135,6 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $this->assert_response_success(); // Submit gravatar with incorrect email and correct size - $this->markTestIncomplete('No error when submitting incorrect acp group settings. This needs to be fixed ASAP.'); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_gravatar'); $form['avatar_gravatar_email']->setValue('test.example.com'); diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php index e94eb4dcad..4f0f6ee5f7 100644 --- a/tests/functional/avatar_test.php +++ b/tests/functional/avatar_test.php @@ -242,7 +242,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $this->assert_response_success(); // Submit gravatar with incorrect email and correct size - $this->markTestIncomplete('No error when submitting incorrect ucp group settings. This needs to be fixed ASAP.'); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_gravatar'); $form['avatar_gravatar_email']->setValue('test.example.com'); From 79dd44061bbfeab64dd2ff7b40541612c219c33c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 25 Jun 2013 00:17:51 +0200 Subject: [PATCH 005/284] [ticket/11531] Add changes for supporting modified testing framework Additionally, the groups avatar is deleted after the avatar tests in the ucp groups page in order to prevent issues with other tests that expect that no avatar has been set for the admin group. PHPBB3-11531 --- tests/functional/avatar_acp_test.php | 27 ++++++--------- tests/functional/avatar_test.php | 49 ++++++++++++---------------- 2 files changed, 31 insertions(+), 45 deletions(-) diff --git a/tests/functional/avatar_acp_test.php b/tests/functional/avatar_acp_test.php index efd0317571..609ccbb477 100644 --- a/tests/functional/avatar_acp_test.php +++ b/tests/functional/avatar_acp_test.php @@ -27,7 +27,6 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case public function test_acp_settings() { $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); // Check the default entries we should have $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); @@ -40,19 +39,18 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['config[allow_avatar_gravatar]']->select(1); $form['config[allow_avatar_remote]']->select(1); $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); } public function test_user_acp_settings() { $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - $this->assert_response_success(); // Select "Avatar" in the drop-down menu $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works @@ -61,17 +59,16 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test@example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - $this->assert_response_success(); // Select "Avatar" in the drop-down menu $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test uploading a remote avatar @@ -79,17 +76,16 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - $this->assert_response_success(); // Select "Avatar" in the drop-down menu $form = $crawler->selectButton($this->lang('GO'))->form(); $form['mode']->select('avatar'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Submit gravatar with incorrect email and correct size @@ -98,7 +94,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test.example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } @@ -106,7 +102,6 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case { // Test setting group avatar of admin group $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works @@ -115,24 +110,22 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test@example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); // Test uploading a remote avatar $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); // Submit gravatar with incorrect email and correct size $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -140,7 +133,7 @@ class phpbb_functional_avatar_acp_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test.example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } } diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php index 4f0f6ee5f7..c96ed46d30 100644 --- a/tests/functional/avatar_test.php +++ b/tests/functional/avatar_test.php @@ -27,7 +27,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case public function test_acp_settings() { $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); // Check the default entries we should have $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); @@ -40,7 +39,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['config[allow_avatar_gravatar]']->select(1); $form['config[allow_avatar_remote]']->select(1); $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); } @@ -48,13 +47,11 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case { // Get ACP settings $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $this->form_content = $form->getValues(); // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); $this->assertContainsLang('AVATAR_DRIVER_GRAVATAR_TITLE', $crawler->filter('#avatar_driver')->text()); $this->assertContainsLang('GRAVATAR_AVATAR_EMAIL', $crawler->text()); @@ -65,7 +62,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test@example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // Submit gravatar with correct mail but incorrect size @@ -75,7 +72,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test@example.com'); $form['avatar_gravatar_width']->setValue(120); $form['avatar_gravatar_height']->setValue(120); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], $this->form_content['config[avatar_min_width]'], $this->form_content['config[avatar_min_height]'], @@ -91,7 +88,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test.example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); } @@ -99,7 +96,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case { // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $this->assertContainsLang('AVATAR_DRIVER_UPLOAD_TITLE', $crawler->filter('#avatar_driver')->text()); $this->assertContainsLang('UPLOAD_AVATAR_FILE', $crawler->text()); $this->assertContainsLang('UPLOAD_AVATAR_URL', $crawler->text()); @@ -109,27 +105,25 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // This will fail as the upload avatar currently expects a file that ends with an extension, e.g. .jpg $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and size (s) = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('AVATAR_URL_INVALID', $crawler->text()); // Submit gravatar with correct email and correct size $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $this->markTestIncomplete('Test fails due to bug in DomCrawler with Symfony < 2.2: https://github.com/symfony/symfony/issues/4674.'); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_upload'); $form['avatar_upload_file']->setValue($this->path . 'valid.jpg'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); } @@ -137,13 +131,11 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case { // Get ACP settings $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $this->form_content = $form->getValues(); // Check if required form elements exist $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $this->assertContainsLang('AVATAR_DRIVER_REMOTE_TITLE', $crawler->filter('#avatar_driver')->text()); $this->assertContainsLang('LINK_REMOTE_AVATAR', $crawler->text()); $this->assertContainsLang('LINK_REMOTE_SIZE', $crawler->text()); @@ -155,19 +147,18 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); // Set remote avatar with incorrect size $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_remote'); // use default gravatar supplied by test@example.com and size (s) = 80px $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $form['avatar_remote_width']->setValue(120); $form['avatar_remote_height']->setValue(120); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], $this->form_content['config[avatar_min_width]'], $this->form_content['config[avatar_min_height]'], @@ -179,14 +170,13 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case // Enter correct data in form entries but select incorrect avatar driver $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and size (s) = 80px $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); /* @@ -196,7 +186,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case * the current phpBB 3.0.11 release. */ $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assert_response_success(); $this->markTestIncomplete('Test currently fails because the remote avatar does not seem to check if it is an image'); $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_remote'); @@ -204,7 +193,7 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_remote_url']->setValue('https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); $form['avatar_remote_width']->setValue(80); $form['avatar_remote_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); } @@ -213,7 +202,6 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case { // Test setting group avatar of admin group $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); // Test if setting a gravatar avatar properly works @@ -222,24 +210,22 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test@example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); // Test uploading a remote avatar $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); $form['avatar_driver']->select('avatar_driver_upload'); // use default gravatar supplied by test@example.com and default size = 80px $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); // Go back to previous page $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assert_response_success(); // Submit gravatar with incorrect email and correct size $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); @@ -247,7 +233,14 @@ class phpbb_functional_avatar_test extends phpbb_functional_test_case $form['avatar_gravatar_email']->setValue('test.example.com'); $form['avatar_gravatar_width']->setValue(80); $form['avatar_gravatar_height']->setValue(80); - $crawler = $this->client->submit($form); + $crawler = self::submit($form); $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); + + // Delete avatar + $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_delete']->tick(); + $crawler = self::submit($form); + $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); } } From 1d9d22cc7676fac14bfe4a5b67537ccfb4f1849d Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 26 Jun 2013 12:43:37 -0700 Subject: [PATCH 006/284] [ticket/11620] Add testable facade for sessions.php Since many functions in session.php have global variables inside the function, this exposes those functions through a testable facade that uses testable_factory's mock global variables to modify global variables used in the functions. This is using the facade pattern to provide a testable "front" to the functions in sessions.php. PHPBB3-11620 --- tests/session/testable_facade.php | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/session/testable_facade.php diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php new file mode 100644 index 0000000000..d4c03ec8d5 --- /dev/null +++ b/tests/session/testable_facade.php @@ -0,0 +1,49 @@ +get_session($db); + global $request; + $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER); + $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER); + $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER); + return phpbb_session::extract_current_page($root_path, phpbb_request_interface::SERVER); + } + + // [To be completed] + // public static function extract_current_hostname() {} + // public static function session_begin($update_session_page = true) {} + // public static function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) {} + // public static function session_kill($new_session = true) {} + // public static function session_gc() {} + // public static function set_cookie($name, $cookiedata, $cookietime) {} + // public static function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) {} + // public static function check_dnsbl($mode, $ip = false) {} + // public static function set_login_key($user_id = false, $key = false, $user_ip = false) {} + // public static function reset_login_keys($user_id = false) {} + // public static function validate_referer($check_script_path = false) {} + // public static function update_session($session_data, $session_id = null) {} + // public static function unset_admin() {} +} + From 19a348e35990511186fc8e987b28b5f8b34c6650 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 26 Jun 2013 12:44:14 -0700 Subject: [PATCH 007/284] [ticket/11620] Add test for test_extract_current_page PHPBB3-11620 --- tests/session/class_functions_test.php | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/session/class_functions_test.php diff --git a/tests/session/class_functions_test.php b/tests/session/class_functions_test.php new file mode 100644 index 0000000000..c4ae5628f1 --- /dev/null +++ b/tests/session/class_functions_test.php @@ -0,0 +1,49 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + } + + public function setUp() + { + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + } + + function test_extract_current_page() + { + $expected_fields = array( + 'page_name' => "index.php", + 'script_path' => "/phpBB/" + ); + + $output = phpbb_session_testable_facade::extract_current_page( + $this->db, + $this->session_factory, + /* Root Path */ "./", + /* PHP Self */ "/phpBB/index.php", + /* Query String*/ "", + /* Request URI */ "/phpBB/" + ); + + foreach($expected_fields as $field => $expected_value) + { + $this->assertSame($expected_value, $output[$field]); + } + } +} From e1d957c3eed77ffb02eaf2c9422f09e71b12f938 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 26 Jun 2013 12:49:05 -0700 Subject: [PATCH 008/284] [ticket/11620] Remove accidental argument from testable_facade. PHPBB3-11620 --- tests/session/testable_facade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index d4c03ec8d5..f85332c94a 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -28,7 +28,7 @@ class phpbb_session_testable_facade $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER); $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER); $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER); - return phpbb_session::extract_current_page($root_path, phpbb_request_interface::SERVER); + return phpbb_session::extract_current_page($root_path); } // [To be completed] From 9f156e995468d322a9b90f188cb31df059b03d82 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Thu, 27 Jun 2013 15:56:19 -0700 Subject: [PATCH 009/284] [ticket/11620] Rename class_functions_test -> extract_page_test Renaming this file because it is going to contain a large data provider, so I'd rather split this test out. PHPBB3-11620 --- .../session/{class_functions_test.php => extract_page_test.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/session/{class_functions_test.php => extract_page_test.php} (93%) diff --git a/tests/session/class_functions_test.php b/tests/session/extract_page_test.php similarity index 93% rename from tests/session/class_functions_test.php rename to tests/session/extract_page_test.php index c4ae5628f1..fca7763bc3 100644 --- a/tests/session/class_functions_test.php +++ b/tests/session/extract_page_test.php @@ -9,7 +9,7 @@ require_once dirname(__FILE__) . '/testable_facade.php'; -class phpbb_session_class_functions_test extends phpbb_database_test_case +class phpbb_session_extract_page_test extends phpbb_database_test_case { public $session_factory; public $db; From 7fd03abcab531d3e989753492ab0cce78549c1a3 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Thu, 27 Jun 2013 15:57:58 -0700 Subject: [PATCH 010/284] [ticket/11620] Add data provider to extract_page These test cases were taken from a live session, more test cases should be added to test specific functionality in this function. PHPBB3-11620 --- tests/session/extract_page_test.php | 105 ++++++++++++++++++++++++---- 1 file changed, 91 insertions(+), 14 deletions(-) diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index fca7763bc3..24fcb98164 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -14,6 +14,88 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case public $session_factory; public $db; + static public function extract_current_page_data() + { + return array( + array( + './', + '/phpBB/index.php', + '', + '/phpBB/', + array( + 'page_name' => 'index.php', + 'page_dir' => '', + 'query_string' => '', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'index.php', + 'forum' => 0 + ) + ) , + array( + './', + '/phpBB/ucp.php', + 'mode=login', + '/phpBB/ucp.php?mode=login', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=login', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=login', + 'forum' => 0 + ) + ) , + array( + './', + '/phpBB/ucp.php', + 'mode=register', + '/phpBB/ucp.php?mode=register', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=register', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=register', + 'forum' => 0 + ) + ) , + array( + './', + '/phpBB/ucp.php', + 'mode=register', + '/phpBB/ucp.php?mode=register', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=register', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=register', + 'forum' => 0 + ) + ) , + array( + './../', + '/phpBB/adm/index.php', + 'sid=e7215d958cdd41a6fc13509bebe53e42', + '/phpBB/adm/index.php?sid=e7215d958cdd41a6fc13509bebe53e42', + array( + 'page_name' => 'index.php', + //'page_dir' => 'adm', + // ^-- Ignored because .. returns different directory in live vs testing + 'query_string' => '', + 'script_path' => '/phpBB/adm/', + 'root_script_path' => '/phpBB/', + //'page' => 'adm/index.php', + 'forum' => 0 + ) + ) + ); + } + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); @@ -25,25 +107,20 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case $this->db = $this->new_dbal(); } - function test_extract_current_page() + /** @dataProvider extract_current_page_data */ + function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected) { - $expected_fields = array( - 'page_name' => "index.php", - 'script_path' => "/phpBB/" - ); - $output = phpbb_session_testable_facade::extract_current_page( $this->db, $this->session_factory, - /* Root Path */ "./", - /* PHP Self */ "/phpBB/index.php", - /* Query String*/ "", - /* Request URI */ "/phpBB/" + $root_path, + $php_self, + $query_string, + $request_uri ); - foreach($expected_fields as $field => $expected_value) - { - $this->assertSame($expected_value, $output[$field]); - } + // This compares the result of the output. + // Any keys that are not in the expected array are overwritten by the output (aka not checked). + $this->assert_array_content_equals(array_merge($output, $expected), $output); } } From b8d9d7b79f98093a5870db2e3b60663ed5069d39 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 1 Jul 2013 00:11:44 -0700 Subject: [PATCH 011/284] [ticket/11620] Add extract_current_hostname Add a tests for extracting the current hostname from session. PHPBB3-11620 --- tests/session/extract_hostname_test.php | 58 +++++++++++++++++++++++++ tests/session/testable_facade.php | 11 ++++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/session/extract_hostname_test.php diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php new file mode 100644 index 0000000000..a126626ae3 --- /dev/null +++ b/tests/session/extract_hostname_test.php @@ -0,0 +1,58 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + } + + public function setUp() + { + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + } + + static public function extract_current_hostname_data() + { + return array ( + // [Input] $host, $server_name_config, $cookie_domain_config, [Expected] $output + // If host is ip use that ipv4 + array("127.0.0.1", "skipped.org", "skipped.org", "127.0.0.1"), + // If no host but server name matches cookie_domain use that + array("", "example.org", "example.org", "example.org"), + // If there is a host uri use that + array("example.org", False, False, "example.org"), + // "best approach" guessing + array("", "example.org", False, "example.org"), + array("", False, "127.0.0.1", "127.0.0.1"), + array("", False, False, php_uname('n')), + ); + } + + /** @dataProvider extract_current_hostname_data */ + function test_extract_current_hostname($host, $server_name_config, $cookie_domain_config, $expected) + { + $output = phpbb_session_testable_facade::extract_current_hostname( + $this->db, + $this->session_factory, + $host, + $server_name_config, + $cookie_domain_config + ); + + $this->assertEquals($expected, $output); + } +} diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index f85332c94a..a4a3d63ed4 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -31,8 +31,17 @@ class phpbb_session_testable_facade return phpbb_session::extract_current_page($root_path); } + public static function extract_current_hostname($db, $session_factory, $host, $server_name_config, $cookie_domain_config) { + $session = $session_factory->get_session($db); + global $config, $request; + $config['server_name'] = $server_name_config; + $config['cookie_domain'] = $cookie_domain_config; + $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER); + $request->overwrite('Host', $host, phpbb_request_interface::SERVER); + // Note: There is a php_uname fallthrough in this method that this function doesn't override + return $session->extract_current_hostname(); + } // [To be completed] - // public static function extract_current_hostname() {} // public static function session_begin($update_session_page = true) {} // public static function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) {} // public static function session_kill($new_session = true) {} From 71fbe74edea4ad2618fbd9161e83ccaabafea9ac Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 1 Jul 2013 15:07:06 -0700 Subject: [PATCH 012/284] [ticket/11620] Fix quotes in extract_hostname_test PHPBB3-11620 --- tests/session/extract_hostname_test.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index a126626ae3..ae12a027f7 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -30,15 +30,15 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case return array ( // [Input] $host, $server_name_config, $cookie_domain_config, [Expected] $output // If host is ip use that ipv4 - array("127.0.0.1", "skipped.org", "skipped.org", "127.0.0.1"), + array('127.0.0.1', 'skipped.org', 'skipped.org', '127.0.0.1'), // If no host but server name matches cookie_domain use that - array("", "example.org", "example.org", "example.org"), + array('', 'example.org', 'example.org', 'example.org'), // If there is a host uri use that - array("example.org", False, False, "example.org"), - // "best approach" guessing - array("", "example.org", False, "example.org"), - array("", False, "127.0.0.1", "127.0.0.1"), - array("", False, False, php_uname('n')), + array('example.org', false, false, 'example.org'), + // 'best approach' guessing + array('', 'example.org', false, 'example.org'), + array('', false, '127.0.0.1', '127.0.0.1'), + array('', false, false, php_uname('n')), ); } From e8facfc735ccc10fd106a169e2508b4c335a0e9e Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 1 Jul 2013 15:09:13 -0700 Subject: [PATCH 013/284] [ticket/11620] Add commas in extract_page_test PHPBB3-11620 --- tests/session/extract_page_test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index 24fcb98164..94ed96c6d2 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -29,7 +29,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case 'script_path' => '/phpBB/', 'root_script_path' => '/phpBB/', 'page' => 'index.php', - 'forum' => 0 + 'forum' => 0, ) ) , array( @@ -44,7 +44,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case 'script_path' => '/phpBB/', 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=login', - 'forum' => 0 + 'forum' => 0, ) ) , array( @@ -59,7 +59,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case 'script_path' => '/phpBB/', 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=register', - 'forum' => 0 + 'forum' => 0, ) ) , array( @@ -74,7 +74,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case 'script_path' => '/phpBB/', 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=register', - 'forum' => 0 + 'forum' => 0, ) ) , array( @@ -90,7 +90,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case 'script_path' => '/phpBB/adm/', 'root_script_path' => '/phpBB/', //'page' => 'adm/index.php', - 'forum' => 0 + 'forum' => 0, ) ) ); From 2f92c903e7f42978e01d09287e93d572f5e302c9 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 1 Jul 2013 15:16:22 -0700 Subject: [PATCH 014/284] [ticket/11620] Make testable_facade non-static, expand. Make the class functions of testable_facade no longer static methods, but a class based one and expand the methods to be filled in, in later commits. PHPBB3-11620 --- tests/session/extract_hostname_test.php | 5 +- tests/session/extract_page_test.php | 7 +- tests/session/testable_facade.php | 145 ++++++++++++++++++++---- 3 files changed, 132 insertions(+), 25 deletions(-) diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index ae12a027f7..6978b5286f 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -13,6 +13,7 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case { public $session_factory; public $db; + public $session_facade; public function getDataSet() { @@ -23,6 +24,8 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case { $this->session_factory = new phpbb_session_testable_factory; $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); } static public function extract_current_hostname_data() @@ -45,7 +48,7 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case /** @dataProvider extract_current_hostname_data */ function test_extract_current_hostname($host, $server_name_config, $cookie_domain_config, $expected) { - $output = phpbb_session_testable_facade::extract_current_hostname( + $output = $this->session_facade->extract_current_hostname( $this->db, $this->session_factory, $host, diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index 94ed96c6d2..f8883dc8c9 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -13,6 +13,7 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case { public $session_factory; public $db; + public $session_facade; static public function extract_current_page_data() { @@ -105,14 +106,14 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case { $this->session_factory = new phpbb_session_testable_factory; $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); } /** @dataProvider extract_current_page_data */ function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected) { - $output = phpbb_session_testable_facade::extract_current_page( - $this->db, - $this->session_factory, + $output = $this->session_facade->extract_current_page( $root_path, $php_self, $query_string, diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index a4a3d63ed4..6d2c1408c9 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -14,16 +14,32 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; * This class exists to expose session.php's functions in a more testable way. * * Since many functions in session.php have global variables inside the function, - * this exposes those functions through a testable facade that uses testable_factory's - * mock global variables to modify global variables used in the functions. + * this exposes those functions through a testable facade that uses + * testable_factory's mock global variables to modify global variables used in + * the functions. * - * This is using the facade pattern to provide a testable "front" to the functions in sessions.php. + * This is using the facade pattern to provide a testable "front" to the + * functions in sessions.php. * */ class phpbb_session_testable_facade { - public static function extract_current_page($db, $session_factory, $root_path, $php_self, $query_string, $request_uri) { - $session_factory->get_session($db); + var $db; + var $session_factory; + + function __construct($db, $session_factory) { + $this->db = $db; + $this->session_factory = $session_factory; + } + + function extract_current_page ( + $root_path, + $php_self, + $query_string, + $request_uri + ) + { + $this->session_factory->get_session($this->db); global $request; $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER); $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER); @@ -31,28 +47,115 @@ class phpbb_session_testable_facade return phpbb_session::extract_current_page($root_path); } - public static function extract_current_hostname($db, $session_factory, $host, $server_name_config, $cookie_domain_config) { - $session = $session_factory->get_session($db); + function extract_current_hostname ( + $host, + $server_name_config, + $cookie_domain_config + ) + { + $session = $this->session_factory->get_session($this->db); global $config, $request; $config['server_name'] = $server_name_config; $config['cookie_domain'] = $cookie_domain_config; $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER); $request->overwrite('Host', $host, phpbb_request_interface::SERVER); - // Note: There is a php_uname fallthrough in this method that this function doesn't override + // Note: There is a php_uname fallthrough in this method + // that this function doesn't override return $session->extract_current_hostname(); } - // [To be completed] - // public static function session_begin($update_session_page = true) {} - // public static function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) {} - // public static function session_kill($new_session = true) {} - // public static function session_gc() {} - // public static function set_cookie($name, $cookiedata, $cookietime) {} - // public static function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) {} - // public static function check_dnsbl($mode, $ip = false) {} - // public static function set_login_key($user_id = false, $key = false, $user_ip = false) {} - // public static function reset_login_keys($user_id = false) {} - // public static function validate_referer($check_script_path = false) {} - // public static function update_session($session_data, $session_id = null) {} - // public static function unset_admin() {} + + + /** This function has a *lot* of dependencies, so instead of naming them all, + * just ask for overrides */ + function session_begin ( + $update_session_page = true, + $config_overrides = array(), + $request_overrides = array() + ) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + $request->merge(phpbb_request_interface::SERVER, $request_overrides); + $config = array_merge($config, $config_overrides); + return $session->session_begin($update_session_page); + } + + function session_create ( + $user_id = false, + $set_admin = false, + $persist_login = false, + $viewonline = true, + $config_overrides = array(), + $request_overrides = array(), + $bot_overrides = array(), + $uri_sid = "" + ) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request, $cache; + $request->merge(phpbb_request_interface::SERVER, $request_overrides); + $config = array_merge($config, $config_overrides); + // Bots + $cache->merge_cache_data(array('_bots' => $bot_overrides)); + // Uri sid + $_GET['sid'] = $uri_sid; + return $session->session_create($user_id, $set_admin, $persist_login, $viewonline); + } + + function session_kill($new_session = true) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function session_gc() + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function set_cookie($name, $cookiedata, $cookietime) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function check_dnsbl($mode, $ip = false) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function set_login_key($user_id = false, $key = false, $user_ip = false) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function reset_login_keys($user_id = false) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + + } + + function validate_referer($check_script_path = false) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + return $session->validate_referer($check_script_path); + } } From 17890a308bbecd295c6ebb92d55fc39e68aae34e Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 1 Jul 2013 16:44:22 -0700 Subject: [PATCH 015/284] [ticket/11620] Add ipv6 test cases and remove extra arguments. PHPBB3-11620 --- tests/session/extract_hostname_test.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index 6978b5286f..cd71f82b17 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -32,8 +32,12 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case { return array ( // [Input] $host, $server_name_config, $cookie_domain_config, [Expected] $output - // If host is ip use that ipv4 + // If host is ip use that + // ipv4 array('127.0.0.1', 'skipped.org', 'skipped.org', '127.0.0.1'), + // ipv6 + array('::1', 'skipped.org', 'skipped.org', ':'), + array('2002::3235:51f9', 'skipped.org', 'skipped.org', '2002::3235'), // If no host but server name matches cookie_domain use that array('', 'example.org', 'example.org', 'example.org'), // If there is a host uri use that @@ -49,8 +53,6 @@ class phpbb_session_extract_hostname_test extends phpbb_database_test_case function test_extract_current_hostname($host, $server_name_config, $cookie_domain_config, $expected) { $output = $this->session_facade->extract_current_hostname( - $this->db, - $this->session_factory, $host, $server_name_config, $cookie_domain_config From 30ebc03d143aaa7e3708b84b93b2e112351e70e5 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 3 Jul 2013 12:26:25 -0700 Subject: [PATCH 016/284] [ticket/11620] Remove unneeded functions from testable facade There are functions listed in testable facade that don't have a lot of dependencies, instead mostly just take the input and perform database functions on them. These can be tested without a testable facade function and so will be removed. PHPBB3-11620 --- tests/session/testable_facade.php | 49 ------------------------------- 1 file changed, 49 deletions(-) diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 6d2c1408c9..02af73174f 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -102,55 +102,6 @@ class phpbb_session_testable_facade return $session->session_create($user_id, $set_admin, $persist_login, $viewonline); } - function session_kill($new_session = true) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function session_gc() - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function set_cookie($name, $cookiedata, $cookietime) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function check_dnsbl($mode, $ip = false) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function set_login_key($user_id = false, $key = false, $user_ip = false) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - - function reset_login_keys($user_id = false) - { - $session = $this->session_factory->get_session($this->db); - global $config, $request; - - } - function validate_referer($check_script_path = false) { $session = $this->session_factory->get_session($this->db); From 290533a14fbcf09caf40c88c30fc39b227f110f0 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 3 Jul 2013 12:28:37 -0700 Subject: [PATCH 017/284] [ticket/11620] Add validate_referrer test Add a test for the validate_referrer function. PHPBB3-11620 --- tests/session/testable_facade.php | 16 ++++- tests/session/validate_referrer_test.php | 80 ++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 tests/session/validate_referrer_test.php diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 02af73174f..886c9b328a 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -102,10 +102,24 @@ class phpbb_session_testable_facade return $session->session_create($user_id, $set_admin, $persist_login, $viewonline); } - function validate_referer($check_script_path = false) + function validate_referer( + $check_script_path, + $referer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path + ) { $session = $this->session_factory->get_session($this->db); global $config, $request; + $session->referer = $referer; + $session->page['root_script_path'] = $root_script_path; + $session->host = $host; + $config['force_server_vars'] = $force_server_vars; + $config['server_name'] = $server_name; + $request->overwrite('SERVER_PORT', $server_port, phpbb_request_interface::SERVER); return $session->validate_referer($check_script_path); } } diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php new file mode 100644 index 0000000000..e5faf8a21f --- /dev/null +++ b/tests/session/validate_referrer_test.php @@ -0,0 +1,80 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + } + + public function setUp() + { + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); + } + + static function referrer_inputs() { + $ex = "example.org"; + $alt = "example.com"; + return array( + // checkpath referrer host forcevars port servername rootpath pass? + // 0 Referrer or host wasn't collected, therefore should validate + array(false, "", $ex, false, 80, $ex, "", true), + array(false, $ex, "", false, 80, $ex, "", true), + // 2 Referrer doesn't match host or server_name + array(false, $alt, $ex, yes, 80, $ex, "", false), + // 3 Everything should check out + array(false, $ex, $ex, false, 80, $ex, "", true), + // 4 Check Script Path + array(true, $ex, $ex, false, 80, $ex, "", true), + array(true, "$ex/foo", $ex, false, 80, $ex, "/foo", true), + array(true, "$ex/bar", $ex, false, 80, $ex, "/foo", false), + // 7 Port (This is not checked unless path is checked) + array(true, "$ex:80/foo", "$ex:80", false, 80, "$ex:80", "/foo", true), + array(true, "$ex:80/bar", "$ex:80", false, 80, "$ex:80", "/foo", false), + array(true, "$ex:79/foo", "$ex:81", false, 81, "$ex:81", "/foo", false), + ); + } + + /** @dataProvider referrer_inputs */ + function test_failing_referrer ( + $check_script_path, + $referrer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path, + $pass_or_fail + ) + { + //Referrer needs http:// because it's going to get stripped in function. + $referrer = ($referrer? 'http://'.$referrer : ''); + $this->assertEquals( + $pass_or_fail, + $this->session_facade->validate_referer( + $check_script_path, + $referrer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path + ), "referrer should" . ($pass_or_fail? "" : "n't") . " be validated"); + } +} From ab1c42babf5fcbc07637940bd50ba4b2d7edca81 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Wed, 3 Jul 2013 12:41:40 -0700 Subject: [PATCH 018/284] [ticket/11620] Add indentation, change quote style. indentation is probably more important than 80 characters per line apparently. Single quotes instead of double per coding guidelines. PHPBB3-11620 --- tests/session/validate_referrer_test.php | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index e5faf8a21f..0636f04072 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -32,22 +32,22 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case $ex = "example.org"; $alt = "example.com"; return array( - // checkpath referrer host forcevars port servername rootpath pass? - // 0 Referrer or host wasn't collected, therefore should validate - array(false, "", $ex, false, 80, $ex, "", true), - array(false, $ex, "", false, 80, $ex, "", true), - // 2 Referrer doesn't match host or server_name - array(false, $alt, $ex, yes, 80, $ex, "", false), - // 3 Everything should check out - array(false, $ex, $ex, false, 80, $ex, "", true), - // 4 Check Script Path - array(true, $ex, $ex, false, 80, $ex, "", true), - array(true, "$ex/foo", $ex, false, 80, $ex, "/foo", true), - array(true, "$ex/bar", $ex, false, 80, $ex, "/foo", false), - // 7 Port (This is not checked unless path is checked) - array(true, "$ex:80/foo", "$ex:80", false, 80, "$ex:80", "/foo", true), - array(true, "$ex:80/bar", "$ex:80", false, 80, "$ex:80", "/foo", false), - array(true, "$ex:79/foo", "$ex:81", false, 81, "$ex:81", "/foo", false), + // checkpath referrer host forcevars port servername rootpath pass? + // 0 Referrer or host wasn't collected, therefore should validate + array(false, '', $ex, false, 80, $ex, '', true), + array(false, $ex, '', false, 80, $ex, '', true), + // 2 Referrer doesn't match host or server_name + array(false, $alt, $ex, yes, 80, $ex, '', false), + // 3 Everything should check out + array(false, $ex, $ex, false, 80, $ex, '', true), + // 4 Check Script Path + array(true, $ex, $ex, false, 80, $ex, '', true), + array(true, "$ex/foo", $ex, false, 80, $ex, "/foo", true), + array(true, "$ex/bar", $ex, false, 80, $ex, "/foo", false), + // 7 Port (This is not checked unless path is checked) + array(true, "$ex:80/foo", "$ex:80", false, 80, "$ex:80", "/foo", true), + array(true, "$ex:80/bar", "$ex:80", false, 80, "$ex:80", "/foo", false), + array(true, "$ex:79/foo", "$ex:81", false, 81, "$ex:81", "/foo", false), ); } @@ -75,6 +75,6 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case $server_port, $server_name, $root_script_path - ), "referrer should" . ($pass_or_fail? "" : "n't") . " be validated"); + ), "referrer should" . ($pass_or_fail? '' : "n't") . " be validated"); } } From 7ef95ce8ac8d189c65c3c3b27f0da9d1ac46877c Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Fri, 5 Jul 2013 11:52:40 -0700 Subject: [PATCH 019/284] [ticket/11620] Fix typo and confusingly named test PHPBB3-11620 --- tests/session/validate_referrer_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index 0636f04072..6774166132 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -37,7 +37,7 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case array(false, '', $ex, false, 80, $ex, '', true), array(false, $ex, '', false, 80, $ex, '', true), // 2 Referrer doesn't match host or server_name - array(false, $alt, $ex, yes, 80, $ex, '', false), + array(false, $alt, $ex, false, 80, $ex, '', false), // 3 Everything should check out array(false, $ex, $ex, false, 80, $ex, '', true), // 4 Check Script Path @@ -52,7 +52,7 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case } /** @dataProvider referrer_inputs */ - function test_failing_referrer ( + function test_referrer_inputs ( $check_script_path, $referrer, $host, From 521d35dd6eaf7a6cd8be1ebd8591e4b2b21fd99f Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Fri, 5 Jul 2013 13:10:27 -0700 Subject: [PATCH 020/284] [ticket/11620] Add create_test with test for bot detection Added a test for the creation of a session with a simple test for detecting whether a bot is present. PHPBB3-11620 --- tests/session/create_test.php | 86 +++++++++++++++++++++++++++++++ tests/session/testable_facade.php | 26 ++++++---- 2 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 tests/session/create_test.php diff --git a/tests/session/create_test.php b/tests/session/create_test.php new file mode 100644 index 0000000000..773b833cf8 --- /dev/null +++ b/tests/session/create_test.php @@ -0,0 +1,86 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + } + + public function setUp() + { + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); + } + + static function bot($bot_agent, $user_id, $bot_ip) + { + return array(array( + 'bot_agent' => $bot_agent, + 'user_id' => $user_id, + 'bot_ip' => $bot_ip + )); + } + + static function create_inputs() { + return array( + array( + false, + false, + false, + false, + array(), + 'user agent', + '127.0.0.1', + self::bot('user agent', 13, '127.0.0.1'), + '', + function ($test, $output) { + $test->assertEquals($output->data['is_bot'], true, "should be a bot"); + } + ) + ); + } + + /** @dataProvider create_inputs */ + function test_session_create ( + $user_id = false, + $set_admin = false, + $persist_login = false, + $viewonline = true, + array $config_overrides = array(), + $user_agent = "", + $ip_address = "", + array $bot_overrides = array(), + $uri_sid = "", + $test_function + ) + { + $output = $this->session_facade->session_create( + $user_id, + $set_admin, + $persist_login, + $viewonline, + $config_overrides, + $user_agent, + $ip_address, + $bot_overrides, + $uri_sid + ); + $test_function($this, $output); + } +} diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 886c9b328a..33175a293b 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -85,21 +85,27 @@ class phpbb_session_testable_facade $set_admin = false, $persist_login = false, $viewonline = true, - $config_overrides = array(), - $request_overrides = array(), - $bot_overrides = array(), + array $config_overrides = array(), + $user_agent, + $ip_address, + array $bot_overrides = array(), $uri_sid = "" ) { - $session = $this->session_factory->get_session($this->db); - global $config, $request, $cache; - $request->merge(phpbb_request_interface::SERVER, $request_overrides); - $config = array_merge($config, $config_overrides); + $this->session_factory->merge_config_data($config_overrides); // Bots - $cache->merge_cache_data(array('_bots' => $bot_overrides)); + $this->session_factory->merge_cache_data(array('_bots' => $bot_overrides)); + global $request; + $session = $this->session_factory->get_session($this->db); + $session->browser = $user_agent; + $session->ip = $ip_address; // Uri sid - $_GET['sid'] = $uri_sid; - return $session->session_create($user_id, $set_admin, $persist_login, $viewonline); + if ($uri_sid) + { + $_GET['sid'] = $uri_sid; + } + $session->session_create($user_id, $set_admin, $persist_login, $viewonline); + return $session; } function validate_referer( From 6f8187f7faadc543f3e43db278cd7239e8cf7ac7 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Fri, 5 Jul 2013 13:49:03 -0700 Subject: [PATCH 021/284] [ticket/11620] Reworked create_test without data provider PHPBB3-11620 --- tests/session/create_test.php | 53 ++++++++--------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 773b833cf8..9d77a26f17 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -37,50 +37,19 @@ class phpbb_session_create_test extends phpbb_database_test_case )); } - static function create_inputs() { - return array( - array( - false, - false, - false, - false, - array(), - 'user agent', - '127.0.0.1', - self::bot('user agent', 13, '127.0.0.1'), - '', - function ($test, $output) { - $test->assertEquals($output->data['is_bot'], true, "should be a bot"); - } - ) - ); - } - - /** @dataProvider create_inputs */ - function test_session_create ( - $user_id = false, - $set_admin = false, - $persist_login = false, - $viewonline = true, - array $config_overrides = array(), - $user_agent = "", - $ip_address = "", - array $bot_overrides = array(), - $uri_sid = "", - $test_function - ) + function test_bot_session () { $output = $this->session_facade->session_create( - $user_id, - $set_admin, - $persist_login, - $viewonline, - $config_overrides, - $user_agent, - $ip_address, - $bot_overrides, - $uri_sid + false, + false, + false, + false, + array(), + 'user agent', + '127.0.0.1', + self::bot('user agent', 13, '127.0.0.1'), + '' ); - $test_function($this, $output); + $this->assertEquals($output->data['is_bot'], true, "should be a bot"); } } From 5cdcb689df37fd7cbaaa1b5475caa830e87be318 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Fri, 5 Jul 2013 14:49:30 -0700 Subject: [PATCH 022/284] [ticket/11620] Implemented a provider mock object. Due to an auth_refactor, there is a new dependency in session.php on phpbb_container and a provider. For purposes of testing, implemented a simple one. PHPBB3-11620 --- tests/mock/provider.php | 23 +++++++++++++++++++++++ tests/session/testable_factory.php | 12 +++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/mock/provider.php diff --git a/tests/mock/provider.php b/tests/mock/provider.php new file mode 100644 index 0000000000..21ef2fc949 --- /dev/null +++ b/tests/mock/provider.php @@ -0,0 +1,23 @@ +request = new phpbb_mock_request( array(), @@ -83,6 +87,12 @@ class phpbb_session_testable_factory $cache = $this->cache = new phpbb_mock_cache($this->get_cache_data()); $SID = $_SID = null; + $phpbb_container = $this->container = new phpbb_mock_container_builder(); + $phpbb_container->set( + 'auth.provider.db', + new phpbb_provider() + ); + $session = new phpbb_mock_session_testable; return $session; } From a1168972ff4d6e5957da08c22437244c92f9696e Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Fri, 5 Jul 2013 15:00:05 -0700 Subject: [PATCH 023/284] [ticket/11620] Added validate_session to provider. PHPBB3-11620 --- tests/mock/provider.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/mock/provider.php b/tests/mock/provider.php index 21ef2fc949..1e7b4bc4ba 100644 --- a/tests/mock/provider.php +++ b/tests/mock/provider.php @@ -12,12 +12,19 @@ * sessions. */ class phpbb_provider { + function autologin() { return array(); } + function kill() { } + + function validate_session($data) + { + return true; + } } From 3999d7ec7cc0860d3f955db9088558f92d1ba497 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 8 Jul 2013 10:28:40 -0700 Subject: [PATCH 024/284] [ticket/11620] More mock provider methods The mock provider object now better matches the interface given for providers. PHPBB3-11620 --- tests/mock/provider.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/tests/mock/provider.php b/tests/mock/provider.php index 1e7b4bc4ba..4d0d6fc84c 100644 --- a/tests/mock/provider.php +++ b/tests/mock/provider.php @@ -10,21 +10,43 @@ /** * Mock provider class with basic functions to help test * sessions. + * + * See interface here: + * includes/auth/provider/interface.php */ class phpbb_provider { + function init() + { + return null; + } + + function login($username, $password) + { + return array( + 'status' => "", + 'error_msg' => "", + 'user_row' => "", + ); + } + function autologin() { return array(); } - function kill() + function acp($new) { - + return array(); } - function validate_session($data) + function logout($data, $new_session) { - return true; + return null; + } + + function validate_session($user) + { + return null; } } From cd1fe789d243e12330a049799818ed7b062ea347 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 8 Jul 2013 16:34:46 -0700 Subject: [PATCH 025/284] [ticket/11620] Minor changes to tests for coding standards PHPBB3-11620 --- tests/session/create_test.php | 6 +++--- tests/session/extract_page_test.php | 26 ++++++++++++------------ tests/session/testable_facade.php | 12 +++++++++-- tests/session/validate_referrer_test.php | 4 ++-- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 9d77a26f17..4a7484321c 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -33,11 +33,11 @@ class phpbb_session_create_test extends phpbb_database_test_case return array(array( 'bot_agent' => $bot_agent, 'user_id' => $user_id, - 'bot_ip' => $bot_ip + 'bot_ip' => $bot_ip, )); } - function test_bot_session () + function test_bot_session() { $output = $this->session_facade->session_create( false, @@ -50,6 +50,6 @@ class phpbb_session_create_test extends phpbb_database_test_case self::bot('user agent', 13, '127.0.0.1'), '' ); - $this->assertEquals($output->data['is_bot'], true, "should be a bot"); + $this->assertEquals($output->data['is_bot'], true, 'should be a bot'); } } diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index f8883dc8c9..c17845526f 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -15,6 +15,19 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case public $db; public $session_facade; + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + } + + public function setUp() + { + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); + } + static public function extract_current_page_data() { return array( @@ -97,19 +110,6 @@ class phpbb_session_extract_page_test extends phpbb_database_test_case ); } - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); - } - - public function setUp() - { - $this->session_factory = new phpbb_session_testable_factory; - $this->db = $this->new_dbal(); - $this->session_facade = - new phpbb_session_testable_facade($this->db, $this->session_factory); - } - /** @dataProvider extract_current_page_data */ function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected) { diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 33175a293b..d28201adc3 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -65,8 +65,16 @@ class phpbb_session_testable_facade } - /** This function has a *lot* of dependencies, so instead of naming them all, - * just ask for overrides */ + /** + * + * This function has a lot of dependencies, so instead of naming them all, + * just ask for overrides + * + * @param update_session_page Boolean of whether to set page of the session + * @param config_overrides An array of overrides for the global config object + * @param request_overrides An array of overrides for the global request object + * @return boolean False if the user is identified, otherwise true. + */ function session_begin ( $update_session_page = true, $config_overrides = array(), diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index 6774166132..1428187f27 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -63,8 +63,8 @@ class phpbb_session_validate_referrer_test extends phpbb_database_test_case $pass_or_fail ) { - //Referrer needs http:// because it's going to get stripped in function. - $referrer = ($referrer? 'http://'.$referrer : ''); + // Referrer needs http:// because it's going to get stripped in function. + $referrer = $referrer ? 'http://'.$referrer : ''; $this->assertEquals( $pass_or_fail, $this->session_facade->validate_referer( From f51721e905af68624df422889f92a069abd7b750 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 8 Jul 2013 16:38:53 -0700 Subject: [PATCH 026/284] [ticket/11620] Rename provider -> mock_auth_provider Rename the class and file name to better match what the class is mocking, as well as implement the interface of that class. PHPBB3-11620 --- tests/mock/{provider.php => auth_provider.php} | 3 ++- tests/session/testable_factory.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename tests/mock/{provider.php => auth_provider.php} (90%) diff --git a/tests/mock/provider.php b/tests/mock/auth_provider.php similarity index 90% rename from tests/mock/provider.php rename to tests/mock/auth_provider.php index 4d0d6fc84c..cca7865fa2 100644 --- a/tests/mock/provider.php +++ b/tests/mock/auth_provider.php @@ -14,7 +14,8 @@ * See interface here: * includes/auth/provider/interface.php */ -class phpbb_provider { +class phpbb_mock_auth_provider implements phpbb_auth_provider_interface +{ function init() { diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index d0d0dabbec..ace968eb43 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -8,7 +8,7 @@ */ require_once dirname(__FILE__) . '/../mock/container_builder.php'; -require_once dirname(__FILE__) . '/../mock/provider.php'; +require_once dirname(__FILE__) . '/../mock/auth_provider.php'; /** * This class exists to setup an instance of phpbb's session class for testing. @@ -90,7 +90,7 @@ class phpbb_session_testable_factory $phpbb_container = $this->container = new phpbb_mock_container_builder(); $phpbb_container->set( 'auth.provider.db', - new phpbb_provider() + new phpbb_mock_auth_provider() ); $session = new phpbb_mock_session_testable; From c96b0b1a47cef409fecc3bd30792e0907a869baa Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 9 Jul 2013 12:03:17 -0700 Subject: [PATCH 027/284] [ticket/11620] Removed unnecessary lines and whitespace PHPBB3-11620 --- tests/mock/auth_provider.php | 7 +------ tests/session/testable_facade.php | 7 +++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index cca7865fa2..9674c573e3 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -8,15 +8,10 @@ */ /** - * Mock provider class with basic functions to help test - * sessions. - * - * See interface here: - * includes/auth/provider/interface.php + * Mock auth provider class with basic functions to help test sessions. */ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface { - function init() { return null; diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index d28201adc3..b9f61b80cb 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -24,8 +24,8 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; */ class phpbb_session_testable_facade { - var $db; - var $session_factory; + protected $db; + protected $session_factory; function __construct($db, $session_factory) { $this->db = $db; @@ -59,12 +59,11 @@ class phpbb_session_testable_facade $config['cookie_domain'] = $cookie_domain_config; $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER); $request->overwrite('Host', $host, phpbb_request_interface::SERVER); - // Note: There is a php_uname fallthrough in this method + // Note: There is a php_uname function used as a fallthrough // that this function doesn't override return $session->extract_current_hostname(); } - /** * * This function has a lot of dependencies, so instead of naming them all, From 1d55709e1336e826aa514ecb84c8c98c52e500c7 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 12:56:00 -0500 Subject: [PATCH 028/284] [ticket/11667] includeasset should be abstract PHPBB3-11667 --- phpBB/includes/template/twig/node/includeasset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php index 5abff10e3f..38c0498492 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -7,7 +7,7 @@ * */ -class phpbb_template_twig_node_includeasset extends Twig_Node +abstract class phpbb_template_twig_node_includeasset extends Twig_Node { /** @var Twig_Environment */ protected $environment; From 41d8bfa974900c9befbde06cc08060eb8a552ec8 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 13:32:40 -0500 Subject: [PATCH 029/284] [ticket/11667] Make functions abstract in includeasset Also comment properly PHPBB3-11667 --- .../includes/template/twig/node/includeasset.php | 15 +++++++++++++++ phpBB/includes/template/twig/node/includecss.php | 14 ++++++++++---- phpBB/includes/template/twig/node/includejs.php | 14 ++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php index 38c0498492..b12d379157 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -62,4 +62,19 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node ->raw("\n');\n") ; } + + /** + * Get the definition name + * + * @return string (e.g. 'SCRIPTS') + */ + abstract public function get_definition_name(); + + /** + * Append the output code for the asset + * + * @param Twig_Compiler A Twig_Compiler instance + * @return null + */ + abstract protected function append_asset(Twig_Compiler $compiler); } diff --git a/phpBB/includes/template/twig/node/includecss.php b/phpBB/includes/template/twig/node/includecss.php index 01fda44aad..450edb3e1e 100644 --- a/phpBB/includes/template/twig/node/includecss.php +++ b/phpBB/includes/template/twig/node/includecss.php @@ -9,16 +9,22 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset { + /** + * Get the definition name + * + * @return string (e.g. 'SCRIPTS') + */ public function get_definition_name() { return 'STYLESHEETS'; } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Append the output code for the asset + * + * @param Twig_Compiler A Twig_Compiler instance + * @return null + */ public function append_asset(Twig_Compiler $compiler) { $compiler diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index fdf2bea3ed..50ab448e0f 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -9,16 +9,22 @@ class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset { + /** + * Get the definition name + * + * @return string (e.g. 'SCRIPTS') + */ public function get_definition_name() { return 'SCRIPTS'; } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Append the output code for the asset + * + * @param Twig_Compiler A Twig_Compiler instance + * @return null + */ protected function append_asset(Twig_Compiler $compiler) { $config = $this->environment->get_phpbb_config(); From 06caac044479c3ff41f48157f40e8cb00e3d5e84 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:48:21 +0200 Subject: [PATCH 030/284] [ticket/11574] Try to load updated service.yml before the default one PHPBB3-11574 --- phpBB/includes/di/extension/core.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/di/extension/core.php b/phpBB/includes/di/extension/core.php index 9c36ba2fc4..d0a3ebdf99 100644 --- a/phpBB/includes/di/extension/core.php +++ b/phpBB/includes/di/extension/core.php @@ -51,8 +51,16 @@ class phpbb_di_extension_core extends Extension */ public function load(array $config, ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); - $loader->load('services.yml'); + if (file_exists($this->root_path . 'install/update/new/config/services.yml')) + { + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'install/update/new/config'))); + $loader->load('services.yml'); + } + else if (file_exists($this->root_path . 'config/services.yml')) + { + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); + $loader->load('services.yml'); + } } /** From 8aca9635f57630b89615d888cc8b92f5ac9b327c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:50:15 +0200 Subject: [PATCH 031/284] [ticket/11574] Find language files in update/new before throwing an error PHPBB3-11574 --- phpBB/includes/user.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phpBB/includes/user.php b/phpBB/includes/user.php index 5530fe3f03..f823e85148 100644 --- a/phpBB/includes/user.php +++ b/phpBB/includes/user.php @@ -590,6 +590,18 @@ class phpbb_user extends phpbb_session $language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx; } + if (!file_exists($language_filename)) + { + // File was not found, try to find it in update directory + $orig_language_filename = $language_filename; + $language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); + if (!file_exists($language_filename)) + { + // Not found either, go back to the original file name + $language_filename = $orig_language_filename; + } + } + if (!file_exists($language_filename)) { global $config; From e12fd2fdda76f629060c517aab9812b8565cc696 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:51:55 +0200 Subject: [PATCH 032/284] [ticket/11574] Require new files in database_update.php and add a class loader PHPBB3-11574 --- phpBB/install/database_update.php | 34 +++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b20ca1e4ea..3341c20058 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -41,6 +41,26 @@ if (!function_exists('phpbb_require_updated')) } } +if (!function_exists('phpbb_include_updated')) +{ + function phpbb_include_updated($path, $optional = false) + { + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } + } +} + function phpbb_end_update($cache, $config) { $cache->purge(); @@ -82,19 +102,21 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +phpbb_require_updated('includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +phpbb_require_updated('includes/functions.' . $phpEx); +phpbb_require_updated('includes/functions_content.' . $phpEx); +phpbb_require_updated('includes/functions_container.' . $phpEx); -require($phpbb_root_path . 'includes/constants.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); +phpbb_require_updated('includes/constants.' . $phpEx); +phpbb_require_updated('includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first +$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/includes/", $phpEx); +$phpbb_class_loader_new->register(); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); $phpbb_class_loader->register(); From f11993c0382d6942a14b37686d2c00dac97a6748 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:54:48 +0200 Subject: [PATCH 033/284] [ticket/11574] Require new files in install/index.php and add a class loader PHPBB3-11574 --- phpBB/install/index.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f745f51974..90cd71d7f3 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -43,6 +43,23 @@ function phpbb_require_updated($path, $optional = false) } } +function phpbb_include_updated($path, $optional = false) +{ + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } +} + phpbb_require_updated('includes/startup.' . $phpEx); // Try to override some limits - maybe it helps some... @@ -78,18 +95,20 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include essential scripts -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +phpbb_require_updated('includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +phpbb_require_updated('includes/functions.' . $phpEx); +phpbb_require_updated('includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); -include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +phpbb_include_updated('includes/functions_admin.' . $phpEx); +phpbb_include_updated('includes/utf/utf_tools.' . $phpEx); +phpbb_require_updated('includes/functions_install.' . $phpEx); // Setup class loader first +$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/includes/", $phpEx); +$phpbb_class_loader_new->register(); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); From deac5f53e3e4131c315c93ce1324899da08d233e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:56:32 +0200 Subject: [PATCH 034/284] [ticket/11574] Load new language files whenever possible PHPBB3-11574 --- phpBB/install/index.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 90cd71d7f3..5494b57610 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -186,11 +186,23 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r } // And finally, load the relevant language files -include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx); +$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); +$new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; +$old_path = $phpbb_root_path . 'language/' . $language . '/'; + +// NOTE: we can not use "phpbb_include_updated" as the files uses vars which would be required +// to be global while loading. +foreach ($load_lang_files as $lang_file) +{ + if (file_exists($new_path . $lang_file . '.' . $phpEx)) + { + include($new_path . $lang_file . '.' . $phpEx); + } + else + { + include($old_path . $lang_file . '.' . $phpEx); + } +} // usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( From 3eaeede32176d8831f12529aa2053123293b67ca Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:57:47 +0200 Subject: [PATCH 035/284] [ticket/11574] Use request object rather then request_var function PHPBB3-11574 --- phpBB/install/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 5494b57610..fd6734cbfb 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -127,7 +127,7 @@ $request = $phpbb_container->get('request'); request_var('', 0, false, false, $request); // "dependency injection" for a function // Try and load an appropriate language if required -$language = basename(request_var('language', '')); +$language = basename($request->variable('language', '')); if ($request->header('Accept-Language') && !$language) { @@ -212,8 +212,8 @@ define('CHMOD_READ', 4); define('CHMOD_WRITE', 2); define('CHMOD_EXECUTE', 1); -$mode = request_var('mode', 'overview'); -$sub = request_var('sub', ''); +$mode = $request->variable('mode', 'overview'); +$sub = $request->variable('sub', ''); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); From fcf343733887d7d42a3060c48b1a009ae0520467 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 13:58:36 +0200 Subject: [PATCH 036/284] [ticket/11574] Add correct language parameter to return links PHPBB3-11574 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 3341c20058..de7f4f202e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -286,7 +286,7 @@ while (!$migrator->finished()) if ((time() - $update_start_time) >= $safe_time_limit) { echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '
'; - echo '' . $user->lang['DATABASE_UPDATE_CONTINUE'] . ''; + echo '' . $user->lang['DATABASE_UPDATE_CONTINUE'] . ''; phpbb_end_update($cache, $config); } @@ -302,7 +302,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '
'; if ($request->variable('type', 0)) { echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '

'; - echo '' . $user->lang['CONTINUE_UPDATE_NOW'] . ''; + echo '' . $user->lang['CONTINUE_UPDATE_NOW'] . ''; } else { From 14ff1ef540f71e765ceeaa53b87ad62e4c8d8a40 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 14:44:49 +0200 Subject: [PATCH 037/284] [ticket/11574] Create phpbb_log object before using it. PHPBB3-11574 --- phpBB/install/install_update.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index df9b6c1c7e..90c56bcdcc 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -509,6 +509,9 @@ class install_update extends module if ($all_up_to_date) { + global $phpbb_log, $phpbb_container; + $phpbb_log = $phpbb_container->get('log'); + // Add database update to log add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version); From 129e393b66125ed6b19cbc0a8defbefabf5cd5ca Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Jun 2013 15:10:03 +0200 Subject: [PATCH 038/284] [ticket/11574] Include vendor into update packages PHPBB3-11574 --- build/package.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/package.php b/build/package.php index 48f42b3572..eef6765af6 100755 --- a/build/package.php +++ b/build/package.php @@ -121,6 +121,7 @@ if (sizeof($package->old_packages)) $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update'); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old'); @@ -256,6 +257,7 @@ $update_info = array( // Copy the install files to their respective locations $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory')); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory')); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory')); // Remove some files chdir($package->get('patch_directory') . '/install'); From fe7823b6685975012d3c033b335d7ed5fa9756d7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 19:26:37 +0200 Subject: [PATCH 039/284] [ticket/11574] Use log object instead of old function PHPBB3-11574 --- phpBB/install/install_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 90c56bcdcc..38d9f66629 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -509,11 +509,11 @@ class install_update extends module if ($all_up_to_date) { - global $phpbb_log, $phpbb_container; + global $phpbb_container; $phpbb_log = $phpbb_container->get('log'); // Add database update to log - add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version)); $db->sql_return_on_error(true); $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); From 3bccd10ccd509ae622cfd23f075fce1d1289888a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 19:35:42 +0200 Subject: [PATCH 040/284] [ticket/11574] Only fall back to install/update versions, when IN_INSTALL ;) PHPBB3-11574 --- phpBB/includes/di/extension/core.php | 3 ++- phpBB/includes/user.php | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/di/extension/core.php b/phpBB/includes/di/extension/core.php index d0a3ebdf99..4e1159e6fd 100644 --- a/phpBB/includes/di/extension/core.php +++ b/phpBB/includes/di/extension/core.php @@ -51,7 +51,8 @@ class phpbb_di_extension_core extends Extension */ public function load(array $config, ContainerBuilder $container) { - if (file_exists($this->root_path . 'install/update/new/config/services.yml')) + // If we are in install, try to use the updated version, when available + if (defined('IN_INSTALL') && file_exists($this->root_path . 'install/update/new/config/services.yml')) { $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'install/update/new/config'))); $loader->load('services.yml'); diff --git a/phpBB/includes/user.php b/phpBB/includes/user.php index f823e85148..f8ff3b8b13 100644 --- a/phpBB/includes/user.php +++ b/phpBB/includes/user.php @@ -590,14 +590,15 @@ class phpbb_user extends phpbb_session $language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx; } - if (!file_exists($language_filename)) + if (defined('IN_INSTALL')) { - // File was not found, try to find it in update directory + // If we are in install, try to use the updated version, when available $orig_language_filename = $language_filename; $language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); + if (!file_exists($language_filename)) { - // Not found either, go back to the original file name + // Not found, go back to the original file name $language_filename = $orig_language_filename; } } From 6c52fae750ed2955b8c0d737e72f101f4d6f2e3a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 15:55:04 +0200 Subject: [PATCH 041/284] [ticket/11574] Include normalizer so it loads form the correct directory PHPBB3-11574 --- phpBB/install/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index fd6734cbfb..4051a5a08b 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -103,6 +103,7 @@ phpbb_require_updated('includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); phpbb_include_updated('includes/functions_admin.' . $phpEx); +phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); phpbb_include_updated('includes/utf/utf_tools.' . $phpEx); phpbb_require_updated('includes/functions_install.' . $phpEx); From 1dea0286a48b4bac6702aad673e13e281690adfb Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 12 Jul 2013 15:40:49 -0400 Subject: [PATCH 042/284] [ticket/11574] Use alternate DI config file for updater PHPBB3-11574 --- phpBB/includes/di/extension/core.php | 23 +++++++---------------- phpBB/includes/functions_container.php | 7 +++++-- phpBB/install/database_update.php | 5 ++++- tests/di/create_container_test.php | 6 +++--- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/phpBB/includes/di/extension/core.php b/phpBB/includes/di/extension/core.php index 4e1159e6fd..9d59a24b7e 100644 --- a/phpBB/includes/di/extension/core.php +++ b/phpBB/includes/di/extension/core.php @@ -26,19 +26,19 @@ use Symfony\Component\Config\FileLocator; class phpbb_di_extension_core extends Extension { /** - * phpBB Root path + * Config path * @var string */ - protected $root_path; + protected $config_path; /** * Constructor * - * @param string $root_path Root path + * @param string $config_path Config path */ - public function __construct($root_path) + public function __construct($config_path) { - $this->root_path = $root_path; + $this->config_path = $config_path; } /** @@ -51,17 +51,8 @@ class phpbb_di_extension_core extends Extension */ public function load(array $config, ContainerBuilder $container) { - // If we are in install, try to use the updated version, when available - if (defined('IN_INSTALL') && file_exists($this->root_path . 'install/update/new/config/services.yml')) - { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'install/update/new/config'))); - $loader->load('services.yml'); - } - else if (file_exists($this->root_path . 'config/services.yml')) - { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); - $loader->load('services.yml'); - } + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path))); + $loader->load('services.yml'); } /** diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index 106b7d75cc..d302b75350 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -53,7 +53,10 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) */ function phpbb_create_install_container($phpbb_root_path, $php_ext) { - $core = new phpbb_di_extension_core($phpbb_root_path); + $other_config_path = $phpbb_root_path . 'install/update/new/config'; + $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config'; + + $core = new phpbb_di_extension_core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); $container->setParameter('core.root_path', $phpbb_root_path); @@ -175,7 +178,7 @@ function phpbb_create_default_container($phpbb_root_path, $php_ext) return phpbb_create_dumped_container_unless_debug( array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ), array( new phpbb_di_pass_collection_pass(), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index de7f4f202e..b0e28958ac 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -121,9 +121,12 @@ $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includ $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) +$other_config_path = $phpbb_root_path . 'install/update/new/config'; +$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path; + $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($config_path), ); $container_passes = array( new phpbb_di_pass_collection_pass(), diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index 6de8803df9..d6a5ec823b 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -17,7 +17,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); @@ -29,7 +29,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_install_container($phpbb_root_path, 'php'); @@ -42,7 +42,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_compiled_container($extensions, array(), $phpbb_root_path, 'php'); From 51ab2c710e91d98bb182dded1e9d5462451151e8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 12 Jul 2013 16:40:20 -0400 Subject: [PATCH 043/284] [ticket/11574] Make install language filename less crazy PHPBB3-11574 --- phpBB/includes/user.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/user.php b/phpBB/includes/user.php index f8ff3b8b13..b39438e315 100644 --- a/phpBB/includes/user.php +++ b/phpBB/includes/user.php @@ -590,17 +590,11 @@ class phpbb_user extends phpbb_session $language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx; } - if (defined('IN_INSTALL')) + // If we are in install, try to use the updated version, when available + $install_language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); + if (defined('IN_INSTALL') && file_exists($install_language_filename)) { - // If we are in install, try to use the updated version, when available - $orig_language_filename = $language_filename; - $language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); - - if (!file_exists($language_filename)) - { - // Not found, go back to the original file name - $language_filename = $orig_language_filename; - } + $language_filename = $install_language_filename; } if (!file_exists($language_filename)) From 31fed4215067ee39e7396f010a06093fe66352ee Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 12:58:04 +0100 Subject: [PATCH 044/284] [ticket/11656] generate_text_for_display on memberlist.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11656 --- phpBB/memberlist.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 7ecf332720..6156e6a292 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -561,17 +561,8 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = censor_text($member['user_sig']); - - if ($member['user_sig_bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(); - $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); - } - - $member['user_sig'] = bbcode_nl2br($member['user_sig']); - $member['user_sig'] = smiley_text($member['user_sig']); + $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], + $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE || OPTION_FLAG_SMILIES, true); } $poster_avatar = phpbb_get_user_avatar($member); From fca4bc53232e22233711a275e252a8006dd89e9a Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 15:55:37 +0100 Subject: [PATCH 045/284] [ticket/11656] Remove line break in function call sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11656 --- phpBB/memberlist.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 6156e6a292..09b9dab5c1 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -561,8 +561,7 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], - $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE || OPTION_FLAG_SMILIES, true); + $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE || OPTION_FLAG_SMILIES, true); } $poster_avatar = phpbb_get_user_avatar($member); From 402d987ccbeacb494f1147cdee047a6cf1f19f7b Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 15:56:55 +0100 Subject: [PATCH 046/284] [ticket/11656] Wrong bitwise OR sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11656 --- phpBB/memberlist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 09b9dab5c1..f8ee82084c 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -561,7 +561,7 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE || OPTION_FLAG_SMILIES, true); + $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE | OPTION_FLAG_SMILIES, true); } $poster_avatar = phpbb_get_user_avatar($member); From b4fcdc51e9df126faf5e9aabcbaa50bb33da0bd0 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 13:49:19 +0100 Subject: [PATCH 047/284] [ticket/11638] generate_text_for_display on viewtopic.php lines: 835-843 sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4dd03202f1..6b789bbb99 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -828,26 +828,15 @@ if (!empty($topic_data['poll_start'])) $poll_total += $poll_option['poll_option_total']; } - if ($poll_info[0]['bbcode_bitfield']) - { - $poll_bbcode = new bbcode(); - } - else - { - $poll_bbcode = false; + $parse_bbcode_flags = OPTION_FLAG_SMILIES; + + if(empty($poll_info[0]['bbcode_bitfield'])){ + $parse_bbcode_flags |= OPTION_FLAG_BBCODE; } for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { - $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']); - - if ($poll_bbcode !== false) - { - $poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']); - } - - $poll_info[$i]['poll_option_text'] = bbcode_nl2br($poll_info[$i]['poll_option_text']); - $poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']); + $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_bbcode_flags, true); } $topic_data['poll_title'] = censor_text($topic_data['poll_title']); From 97054d81f82123f17cd3680326932a8fd021ffa2 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 13:50:44 +0100 Subject: [PATCH 048/284] [ticket/11638] generate_text_for_display on viewtopic.php lines: 846-854 sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6b789bbb99..d295b91f43 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -839,17 +839,9 @@ if (!empty($topic_data['poll_start'])) $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_bbcode_flags, true); } - $topic_data['poll_title'] = censor_text($topic_data['poll_title']); - - if ($poll_bbcode !== false) - { - $poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']); - } - - $topic_data['poll_title'] = bbcode_nl2br($topic_data['poll_title']); - $topic_data['poll_title'] = smiley_text($topic_data['poll_title']); - - unset($poll_bbcode); + $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_bbcode_flags, true); + + unset($parse_bbcode_flags); foreach ($poll_info as $poll_option) { From a58ccdabf30cad5b0373c266fc69368c65cee1a1 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 14:35:22 +0100 Subject: [PATCH 049/284] [ticket/11638] generate_text_for_display on viewtopic.php lines: 1395-1403 sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d295b91f43..34586b1491 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1380,16 +1380,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { - $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); - - if ($user_cache[$poster_id]['sig_bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']); - } - - $user_cache[$poster_id]['sig'] = bbcode_nl2br($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig_parsed'] = true; + $include_bbcode_parse = $user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0; + $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $include_bbcode_parse | OPTION_FLAG_SMILIES, true); } // Parse the message and subject From 713a2ba573ab49d2add2522392b1f91ca3065dea Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 13 Jul 2013 14:35:50 +0100 Subject: [PATCH 050/284] [ticket/11638] generate_text_for_display on viewtopic.php lines: 1403-1417 sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 34586b1491..9274539ab4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1385,16 +1385,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } // Parse the message and subject - $message = censor_text($row['post_text']); - - // Second parse bbcode here - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); if (!empty($attachments[$row['post_id']])) { From 176729ab001300c295695537803f389e175049cf Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 13 Jul 2013 17:50:35 -0500 Subject: [PATCH 051/284] [ticket/11692] Don't update search_type in dev migration if already appended PHPBB3-11692 --- phpBB/includes/db/migration/data/310/dev.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/includes/db/migration/data/310/dev.php index 13b36bbf30..0fc2950987 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/includes/db/migration/data/310/dev.php @@ -82,7 +82,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + array('if', array( + (strpos('phpbb_search_', $this->config['search_type']) !== 0), + array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + )), array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), From d6de892ee40579c45259f8c68ba7eef26accc08b Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 13 Jul 2013 16:47:15 -0400 Subject: [PATCH 052/284] [ticket/11574] Fix various path issues in the updater PHPBB3-11574 --- phpBB/includes/functions_container.php | 26 +++++++++++++++++++++++- phpBB/install/database_update.php | 5 ++--- phpBB/install/install_update.php | 28 ++------------------------ 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index d302b75350..923a8f370b 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -53,7 +53,7 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) */ function phpbb_create_install_container($phpbb_root_path, $php_ext) { - $other_config_path = $phpbb_root_path . 'install/update/new/config'; + $other_config_path = $phpbb_root_path . 'install/update/new/config/'; $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config'; $core = new phpbb_di_extension_core($config_path); @@ -73,6 +73,30 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) return $container; } +/** +* Create updater container +* +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @param array $config_path Path to config directory +* @return ContainerBuilder object (compiled) +*/ +function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) +{ + return phpbb_create_compiled_container( + array( + new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext), + new phpbb_di_extension_core($config_path), + ), + array( + new phpbb_di_pass_collection_pass(), + new phpbb_di_pass_kernel_pass(), + ), + $phpbb_root_path, + $php_ext + ); +} + /** * Create a compiled ContainerBuilder object * diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b0e28958ac..51ffdd3c88 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -121,8 +121,8 @@ $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includ $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) -$other_config_path = $phpbb_root_path . 'install/update/new/config'; -$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path; +$other_config_path = $phpbb_root_path . 'install/update/new/config/'; +$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config'; $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), @@ -130,7 +130,6 @@ $container_extensions = array( ); $container_passes = array( new phpbb_di_pass_collection_pass(), - //new phpbb_di_pass_kernel_pass(), ); $phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 38d9f66629..f9dfaaef50 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -75,7 +75,7 @@ class install_update extends module global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); // Writes into global $cache $cache = $phpbb_container->get('cache'); @@ -125,7 +125,7 @@ class install_update extends module $config['default_lang'] = $language; $user->data['user_lang'] = $language; - $user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + $user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); // Reset the default_lang $config['default_lang'] = $config_default_lang; @@ -302,30 +302,6 @@ class install_update extends module break; case 'update_db': - - // Make sure the database update is valid for the latest version - $valid = false; - $updates_to_version = ''; - - if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx)) - { - include_once($phpbb_root_path . 'install/database_update.' . $phpEx); - - if ($updates_to_version === $this->update_info['version']['to']) - { - $valid = true; - } - } - - // Should not happen at all - if (!$valid) - { - trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); - } - - // Just a precaution - $cache->purge(); - // Redirect the user to the database update script with some explanations... $template->assign_vars(array( 'S_DB_UPDATE' => true, From c96f8936c969b3fd441c179cc4ffa8ea75d8f901 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 13 Jul 2013 18:19:21 -0400 Subject: [PATCH 053/284] [ticket/11574] Fix table prefix in database updater PHPBB3-11574 --- phpBB/install/database_update.php | 3 ++- phpBB/install/index.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 51ffdd3c88..5f2d46c7ad 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -25,7 +25,7 @@ if (!function_exists('phpbb_require_updated')) { function phpbb_require_updated($path, $optional = false) { - global $phpbb_root_path; + global $phpbb_root_path, $table_prefix; $new_path = $phpbb_root_path . 'install/update/new/' . $path; $old_path = $phpbb_root_path . $path; @@ -108,6 +108,7 @@ phpbb_require_updated('includes/functions.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx); phpbb_require_updated('includes/functions_container.' . $phpEx); +require($phpbb_root_path . 'config.' . $phpEx); phpbb_require_updated('includes/constants.' . $phpEx); phpbb_require_updated('includes/utf/utf_tools.' . $phpEx); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 4051a5a08b..055fb72d7c 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -28,7 +28,7 @@ if (version_compare(PHP_VERSION, '5.3.3') < 0) function phpbb_require_updated($path, $optional = false) { - global $phpbb_root_path; + global $phpbb_root_path, $table_prefix; $new_path = $phpbb_root_path . 'install/update/new/' . $path; $old_path = $phpbb_root_path . $path; From e6e2a50062eca8b640822b8f616ea4bb23b23566 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 14 Jul 2013 01:28:49 -0400 Subject: [PATCH 054/284] [ticket/11574] Add trailing slash for consistency PHPBB3-11574 --- phpBB/includes/functions_container.php | 2 +- phpBB/install/database_update.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index 923a8f370b..e22fa9919a 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -54,7 +54,7 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) function phpbb_create_install_container($phpbb_root_path, $php_ext) { $other_config_path = $phpbb_root_path . 'install/update/new/config/'; - $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config'; + $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; $core = new phpbb_di_extension_core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5f2d46c7ad..e0ecc242e1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -123,7 +123,7 @@ $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) $other_config_path = $phpbb_root_path . 'install/update/new/config/'; -$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config'; +$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), From 7030578bbe9e11c18b5becaf8b06e670e3c2e3cd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 01:32:34 -0400 Subject: [PATCH 055/284] [ticket/11698] Moving all autoloadable files to phpbb/ PHPBB3-11698 --- phpBB/common.php | 6 +++--- phpBB/includes/acp/acp_search.php | 2 +- phpBB/install/database_update.php | 6 +++--- phpBB/install/index.php | 4 ++-- phpBB/install/install_install.php | 6 +++--- phpBB/{includes => phpbb}/auth/auth.php | 0 phpBB/{includes => phpbb}/auth/index.htm | 0 phpBB/{includes => phpbb}/auth/provider/apache.php | 0 phpBB/{includes => phpbb}/auth/provider/base.php | 0 phpBB/{includes => phpbb}/auth/provider/db.php | 0 phpBB/{includes => phpbb}/auth/provider/index.htm | 0 phpBB/{includes => phpbb}/auth/provider/interface.php | 0 phpBB/{includes => phpbb}/auth/provider/ldap.php | 0 phpBB/{includes => phpbb}/avatar/driver/driver.php | 0 phpBB/{includes => phpbb}/avatar/driver/gravatar.php | 0 phpBB/{includes => phpbb}/avatar/driver/interface.php | 0 phpBB/{includes => phpbb}/avatar/driver/local.php | 0 phpBB/{includes => phpbb}/avatar/driver/remote.php | 0 phpBB/{includes => phpbb}/avatar/driver/upload.php | 0 phpBB/{includes => phpbb}/avatar/manager.php | 0 phpBB/{includes => phpbb}/cache/driver/apc.php | 0 phpBB/{includes => phpbb}/cache/driver/base.php | 0 .../{includes => phpbb}/cache/driver/eaccelerator.php | 0 phpBB/{includes => phpbb}/cache/driver/file.php | 0 phpBB/{includes => phpbb}/cache/driver/interface.php | 0 phpBB/{includes => phpbb}/cache/driver/memcache.php | 0 phpBB/{includes => phpbb}/cache/driver/memory.php | 0 phpBB/{includes => phpbb}/cache/driver/null.php | 0 phpBB/{includes => phpbb}/cache/driver/redis.php | 0 phpBB/{includes => phpbb}/cache/driver/wincache.php | 0 phpBB/{includes => phpbb}/cache/driver/xcache.php | 0 phpBB/{includes => phpbb}/cache/service.php | 0 phpBB/{includes => phpbb}/class_loader.php | 0 phpBB/{includes => phpbb}/config/config.php | 0 phpBB/{includes => phpbb}/config/db.php | 0 phpBB/{includes => phpbb}/config/db_text.php | 0 phpBB/{includes => phpbb}/content_visibility.php | 0 phpBB/{includes => phpbb}/controller/exception.php | 0 phpBB/{includes => phpbb}/controller/helper.php | 0 phpBB/{includes => phpbb}/controller/provider.php | 0 phpBB/{includes => phpbb}/controller/resolver.php | 0 phpBB/{includes => phpbb}/cron/manager.php | 0 phpBB/{includes => phpbb}/cron/task/base.php | 0 .../cron/task/core/prune_all_forums.php | 0 .../{includes => phpbb}/cron/task/core/prune_forum.php | 0 phpBB/{includes => phpbb}/cron/task/core/queue.php | 0 .../{includes => phpbb}/cron/task/core/tidy_cache.php | 0 .../cron/task/core/tidy_database.php | 0 .../{includes => phpbb}/cron/task/core/tidy_search.php | 7 +------ .../cron/task/core/tidy_sessions.php | 0 .../cron/task/core/tidy_warnings.php | 0 phpBB/{includes => phpbb}/cron/task/parametrized.php | 0 phpBB/{includes => phpbb}/cron/task/task.php | 0 phpBB/{includes => phpbb}/cron/task/wrapper.php | 0 phpBB/{includes => phpbb}/datetime.php | 0 phpBB/{includes => phpbb}/db/driver/driver.php | 0 phpBB/{includes => phpbb}/db/driver/firebird.php | 0 phpBB/{includes => phpbb}/db/driver/mssql.php | 0 phpBB/{includes => phpbb}/db/driver/mssql_base.php | 0 phpBB/{includes => phpbb}/db/driver/mssql_odbc.php | 0 phpBB/{includes => phpbb}/db/driver/mssqlnative.php | 0 phpBB/{includes => phpbb}/db/driver/mysql.php | 0 phpBB/{includes => phpbb}/db/driver/mysql_base.php | 0 phpBB/{includes => phpbb}/db/driver/mysqli.php | 0 phpBB/{includes => phpbb}/db/driver/oracle.php | 0 phpBB/{includes => phpbb}/db/driver/postgres.php | 0 phpBB/{includes => phpbb}/db/driver/sqlite.php | 0 .../db/migration/data/30x/3_0_1.php | 0 .../db/migration/data/30x/3_0_10.php | 0 .../db/migration/data/30x/3_0_10_rc1.php | 0 .../db/migration/data/30x/3_0_10_rc2.php | 0 .../db/migration/data/30x/3_0_10_rc3.php | 0 .../db/migration/data/30x/3_0_11.php | 0 .../db/migration/data/30x/3_0_11_rc1.php | 0 .../db/migration/data/30x/3_0_11_rc2.php | 0 .../db/migration/data/30x/3_0_12_rc1.php | 0 .../db/migration/data/30x/3_0_1_rc1.php | 0 .../db/migration/data/30x/3_0_2.php | 0 .../db/migration/data/30x/3_0_2_rc1.php | 0 .../db/migration/data/30x/3_0_2_rc2.php | 0 .../db/migration/data/30x/3_0_3.php | 0 .../db/migration/data/30x/3_0_3_rc1.php | 0 .../db/migration/data/30x/3_0_4.php | 0 .../db/migration/data/30x/3_0_4_rc1.php | 0 .../db/migration/data/30x/3_0_5.php | 0 .../db/migration/data/30x/3_0_5_rc1.php | 0 .../db/migration/data/30x/3_0_5_rc1part2.php | 0 .../db/migration/data/30x/3_0_6.php | 0 .../db/migration/data/30x/3_0_6_rc1.php | 0 .../db/migration/data/30x/3_0_6_rc2.php | 0 .../db/migration/data/30x/3_0_6_rc3.php | 0 .../db/migration/data/30x/3_0_6_rc4.php | 0 .../db/migration/data/30x/3_0_7.php | 0 .../db/migration/data/30x/3_0_7_pl1.php | 0 .../db/migration/data/30x/3_0_7_rc1.php | 0 .../db/migration/data/30x/3_0_7_rc2.php | 0 .../db/migration/data/30x/3_0_8.php | 0 .../db/migration/data/30x/3_0_8_rc1.php | 0 .../db/migration/data/30x/3_0_9.php | 0 .../db/migration/data/30x/3_0_9_rc1.php | 0 .../db/migration/data/30x/3_0_9_rc2.php | 0 .../db/migration/data/30x/3_0_9_rc3.php | 0 .../db/migration/data/30x/3_0_9_rc4.php | 0 .../db/migration/data/30x/local_url_bbcode.php | 0 .../db/migration/data/310/avatars.php | 0 .../db/migration/data/310/boardindex.php | 0 .../db/migration/data/310/config_db_text.php | 0 .../{includes => phpbb}/db/migration/data/310/dev.php | 0 .../db/migration/data/310/extensions.php | 0 .../db/migration/data/310/forgot_password.php | 0 .../db/migration/data/310/jquery_update.php | 0 .../data/310/notification_options_reconvert.php | 0 .../db/migration/data/310/notifications.php | 0 .../db/migration/data/310/notifications_schema_fix.php | 0 .../db/migration/data/310/reported_posts_display.php | 0 .../db/migration/data/310/signature_module_auth.php | 0 .../db/migration/data/310/softdelete_p1.php | 0 .../db/migration/data/310/softdelete_p2.php | 0 .../db/migration/data/310/style_update_p1.php | 0 .../db/migration/data/310/style_update_p2.php | 0 .../db/migration/data/310/teampage.php | 0 .../db/migration/data/310/timezone.php | 0 .../db/migration/data/310/timezone_p2.php | 0 phpBB/{includes => phpbb}/db/migration/exception.php | 0 phpBB/{includes => phpbb}/db/migration/migration.php | 0 phpBB/{includes => phpbb}/db/migration/tool/config.php | 0 .../db/migration/tool/interface.php | 0 phpBB/{includes => phpbb}/db/migration/tool/module.php | 0 .../db/migration/tool/permission.php | 0 phpBB/{includes => phpbb}/db/migrator.php | 0 phpBB/{includes => phpbb}/db/sql_insert_buffer.php | 0 phpBB/{includes => phpbb}/di/extension/config.php | 0 phpBB/{includes => phpbb}/di/extension/core.php | 0 phpBB/{includes => phpbb}/di/extension/ext.php | 0 phpBB/{includes => phpbb}/di/pass/collection_pass.php | 0 phpBB/{includes => phpbb}/di/pass/kernel_pass.php | 0 phpBB/{includes => phpbb}/di/service_collection.php | 0 phpBB/{includes => phpbb}/error_collector.php | 0 phpBB/{includes => phpbb}/event/data.php | 0 phpBB/{includes => phpbb}/event/dispatcher.php | 0 .../event/extension_subscriber_loader.php | 0 .../event/kernel_exception_subscriber.php | 0 .../event/kernel_request_subscriber.php | 0 .../event/kernel_terminate_subscriber.php | 0 phpBB/{includes => phpbb}/extension/base.php | 0 phpBB/{includes => phpbb}/extension/exception.php | 0 phpBB/{includes => phpbb}/extension/finder.php | 4 ++-- phpBB/{includes => phpbb}/extension/interface.php | 0 phpBB/{includes => phpbb}/extension/manager.php | 0 .../{includes => phpbb}/extension/metadata_manager.php | 0 phpBB/{includes => phpbb}/extension/provider.php | 0 phpBB/{includes => phpbb}/feed/base.php | 0 phpBB/{includes => phpbb}/feed/factory.php | 0 phpBB/{includes => phpbb}/feed/forum.php | 0 phpBB/{includes => phpbb}/feed/forums.php | 0 phpBB/{includes => phpbb}/feed/helper.php | 0 phpBB/{includes => phpbb}/feed/news.php | 0 phpBB/{includes => phpbb}/feed/overall.php | 0 phpBB/{includes => phpbb}/feed/post_base.php | 0 phpBB/{includes => phpbb}/feed/topic.php | 0 phpBB/{includes => phpbb}/feed/topic_base.php | 0 phpBB/{includes => phpbb}/feed/topics.php | 0 phpBB/{includes => phpbb}/feed/topics_active.php | 0 phpBB/{includes => phpbb}/filesystem.php | 0 phpBB/{includes => phpbb}/groupposition/exception.php | 0 phpBB/{includes => phpbb}/groupposition/interface.php | 0 phpBB/{includes => phpbb}/groupposition/legend.php | 0 phpBB/{includes => phpbb}/groupposition/teampage.php | 0 phpBB/{includes => phpbb}/hook/finder.php | 0 phpBB/{includes => phpbb}/json_response.php | 0 phpBB/{includes => phpbb}/lock/db.php | 0 phpBB/{includes => phpbb}/lock/flock.php | 0 phpBB/{includes => phpbb}/log/interface.php | 0 phpBB/{includes => phpbb}/log/log.php | 0 phpBB/{includes => phpbb}/notification/exception.php | 0 phpBB/{includes => phpbb}/notification/manager.php | 0 phpBB/{includes => phpbb}/notification/method/base.php | 0 .../{includes => phpbb}/notification/method/email.php | 0 .../notification/method/interface.php | 0 .../{includes => phpbb}/notification/method/jabber.php | 0 .../notification/method/messenger_base.php | 0 .../notification/type/approve_post.php | 0 .../notification/type/approve_topic.php | 0 phpBB/{includes => phpbb}/notification/type/base.php | 0 .../{includes => phpbb}/notification/type/bookmark.php | 0 .../notification/type/disapprove_post.php | 0 .../notification/type/disapprove_topic.php | 0 .../notification/type/interface.php | 0 phpBB/{includes => phpbb}/notification/type/pm.php | 0 phpBB/{includes => phpbb}/notification/type/post.php | 0 .../notification/type/post_in_queue.php | 0 phpBB/{includes => phpbb}/notification/type/quote.php | 0 .../notification/type/report_pm.php | 0 .../notification/type/report_pm_closed.php | 0 .../notification/type/report_post.php | 0 .../notification/type/report_post_closed.php | 0 phpBB/{includes => phpbb}/notification/type/topic.php | 0 .../notification/type/topic_in_queue.php | 0 phpBB/{includes => phpbb}/php/ini.php | 0 .../request/deactivated_super_global.php | 0 phpBB/{includes => phpbb}/request/interface.php | 0 phpBB/{includes => phpbb}/request/request.php | 0 phpBB/{includes => phpbb}/request/type_cast_helper.php | 0 .../request/type_cast_helper_interface.php | 0 phpBB/{includes => phpbb}/search/base.php | 0 phpBB/{includes => phpbb}/search/fulltext_mysql.php | 0 phpBB/{includes => phpbb}/search/fulltext_native.php | 0 phpBB/{includes => phpbb}/search/fulltext_postgres.php | 0 phpBB/{includes => phpbb}/search/fulltext_sphinx.php | 0 phpBB/{includes => phpbb}/search/index.htm | 0 phpBB/{includes => phpbb}/search/sphinx/config.php | 0 .../search/sphinx/config_comment.php | 0 .../search/sphinx/config_section.php | 0 .../search/sphinx/config_variable.php | 0 phpBB/{includes => phpbb}/session.php | 0 .../style/extension_path_provider.php | 0 phpBB/{includes => phpbb}/style/path_provider.php | 0 .../style/path_provider_interface.php | 0 phpBB/{includes => phpbb}/style/resource_locator.php | 0 phpBB/{includes => phpbb}/style/style.php | 0 phpBB/{includes => phpbb}/template/asset.php | 0 phpBB/{includes => phpbb}/template/context.php | 0 phpBB/{includes => phpbb}/template/locator.php | 0 phpBB/{includes => phpbb}/template/template.php | 0 phpBB/{includes => phpbb}/template/twig/definition.php | 0 .../{includes => phpbb}/template/twig/environment.php | 0 phpBB/{includes => phpbb}/template/twig/extension.php | 0 phpBB/{includes => phpbb}/template/twig/lexer.php | 0 .../{includes => phpbb}/template/twig/node/define.php | 0 phpBB/{includes => phpbb}/template/twig/node/event.php | 0 .../twig/node/expression/binary/equalequal.php | 0 .../twig/node/expression/binary/notequalequal.php | 0 .../{includes => phpbb}/template/twig/node/include.php | 0 .../template/twig/node/includeasset.php | 0 .../template/twig/node/includecss.php | 0 .../template/twig/node/includejs.php | 0 .../template/twig/node/includephp.php | 0 phpBB/{includes => phpbb}/template/twig/node/php.php | 0 .../template/twig/tokenparser/define.php | 0 .../template/twig/tokenparser/event.php | 0 .../template/twig/tokenparser/include.php | 0 .../template/twig/tokenparser/includecss.php | 0 .../template/twig/tokenparser/includejs.php | 0 .../template/twig/tokenparser/includephp.php | 0 .../template/twig/tokenparser/php.php | 0 phpBB/{includes => phpbb}/template/twig/twig.php | 0 phpBB/{includes => phpbb}/tree/interface.php | 0 phpBB/{includes => phpbb}/tree/nestedset.php | 0 phpBB/{includes => phpbb}/tree/nestedset_forum.php | 0 phpBB/{includes => phpbb}/user.php | 0 phpBB/{includes => phpbb}/user_loader.php | 0 phpunit.xml.all | 5 +++-- phpunit.xml.dist | 5 +++-- phpunit.xml.functional | 5 +++-- tests/bootstrap.php | 4 ++-- tests/class_loader/class_loader_test.php | 10 +++++----- tests/class_loader/{includes => phpbb}/class_name.php | 0 tests/class_loader/{includes => phpbb}/dir.php | 0 .../{includes => phpbb}/dir/class_name.php | 0 .../{includes => phpbb}/dir/subdir/class_name.php | 0 tests/class_loader/{includes => phpbb}/dir2/dir2.php | 0 tests/controller/controller_test.php | 2 +- .../controller/{includes => phpbb}/controller/foo.php | 0 tests/datetime/from_format_test.php | 3 --- tests/dbal/migrator_test.php | 2 -- tests/dbal/migrator_tool_config_test.php | 3 --- tests/dbal/migrator_tool_module_test.php | 2 -- tests/dbal/migrator_tool_permission_test.php | 2 -- tests/error_collector_test.php | 1 - tests/extension/finder_test.php | 8 ++++---- .../{includes => phpbb}/default/implementation.php | 0 tests/log/function_view_log_test.php | 1 - tests/upload/fileupload_test.php | 1 + 273 files changed, 37 insertions(+), 52 deletions(-) rename phpBB/{includes => phpbb}/auth/auth.php (100%) rename phpBB/{includes => phpbb}/auth/index.htm (100%) rename phpBB/{includes => phpbb}/auth/provider/apache.php (100%) rename phpBB/{includes => phpbb}/auth/provider/base.php (100%) rename phpBB/{includes => phpbb}/auth/provider/db.php (100%) rename phpBB/{includes => phpbb}/auth/provider/index.htm (100%) rename phpBB/{includes => phpbb}/auth/provider/interface.php (100%) rename phpBB/{includes => phpbb}/auth/provider/ldap.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/driver.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/gravatar.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/interface.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/local.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/remote.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/upload.php (100%) rename phpBB/{includes => phpbb}/avatar/manager.php (100%) rename phpBB/{includes => phpbb}/cache/driver/apc.php (100%) rename phpBB/{includes => phpbb}/cache/driver/base.php (100%) rename phpBB/{includes => phpbb}/cache/driver/eaccelerator.php (100%) rename phpBB/{includes => phpbb}/cache/driver/file.php (100%) rename phpBB/{includes => phpbb}/cache/driver/interface.php (100%) rename phpBB/{includes => phpbb}/cache/driver/memcache.php (100%) rename phpBB/{includes => phpbb}/cache/driver/memory.php (100%) rename phpBB/{includes => phpbb}/cache/driver/null.php (100%) rename phpBB/{includes => phpbb}/cache/driver/redis.php (100%) rename phpBB/{includes => phpbb}/cache/driver/wincache.php (100%) rename phpBB/{includes => phpbb}/cache/driver/xcache.php (100%) rename phpBB/{includes => phpbb}/cache/service.php (100%) rename phpBB/{includes => phpbb}/class_loader.php (100%) rename phpBB/{includes => phpbb}/config/config.php (100%) rename phpBB/{includes => phpbb}/config/db.php (100%) rename phpBB/{includes => phpbb}/config/db_text.php (100%) rename phpBB/{includes => phpbb}/content_visibility.php (100%) rename phpBB/{includes => phpbb}/controller/exception.php (100%) rename phpBB/{includes => phpbb}/controller/helper.php (100%) rename phpBB/{includes => phpbb}/controller/provider.php (100%) rename phpBB/{includes => phpbb}/controller/resolver.php (100%) rename phpBB/{includes => phpbb}/cron/manager.php (100%) rename phpBB/{includes => phpbb}/cron/task/base.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/prune_all_forums.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/prune_forum.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/queue.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_cache.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_database.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_search.php (90%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_sessions.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_warnings.php (100%) rename phpBB/{includes => phpbb}/cron/task/parametrized.php (100%) rename phpBB/{includes => phpbb}/cron/task/task.php (100%) rename phpBB/{includes => phpbb}/cron/task/wrapper.php (100%) rename phpBB/{includes => phpbb}/datetime.php (100%) rename phpBB/{includes => phpbb}/db/driver/driver.php (100%) rename phpBB/{includes => phpbb}/db/driver/firebird.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql_base.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql_odbc.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssqlnative.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysql.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysql_base.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysqli.php (100%) rename phpBB/{includes => phpbb}/db/driver/oracle.php (100%) rename phpBB/{includes => phpbb}/db/driver/postgres.php (100%) rename phpBB/{includes => phpbb}/db/driver/sqlite.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_12_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_1_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_3_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_4_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5_rc1part2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_pl1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_8.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_8_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/local_url_bbcode.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/avatars.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/boardindex.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/config_db_text.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/dev.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/extensions.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/forgot_password.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/jquery_update.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notification_options_reconvert.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notifications.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notifications_schema_fix.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/reported_posts_display.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/signature_module_auth.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/softdelete_p1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/softdelete_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/style_update_p1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/style_update_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/teampage.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/timezone.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/timezone_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/exception.php (100%) rename phpBB/{includes => phpbb}/db/migration/migration.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/config.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/interface.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/module.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/permission.php (100%) rename phpBB/{includes => phpbb}/db/migrator.php (100%) rename phpBB/{includes => phpbb}/db/sql_insert_buffer.php (100%) rename phpBB/{includes => phpbb}/di/extension/config.php (100%) rename phpBB/{includes => phpbb}/di/extension/core.php (100%) rename phpBB/{includes => phpbb}/di/extension/ext.php (100%) rename phpBB/{includes => phpbb}/di/pass/collection_pass.php (100%) rename phpBB/{includes => phpbb}/di/pass/kernel_pass.php (100%) rename phpBB/{includes => phpbb}/di/service_collection.php (100%) rename phpBB/{includes => phpbb}/error_collector.php (100%) rename phpBB/{includes => phpbb}/event/data.php (100%) rename phpBB/{includes => phpbb}/event/dispatcher.php (100%) rename phpBB/{includes => phpbb}/event/extension_subscriber_loader.php (100%) rename phpBB/{includes => phpbb}/event/kernel_exception_subscriber.php (100%) rename phpBB/{includes => phpbb}/event/kernel_request_subscriber.php (100%) rename phpBB/{includes => phpbb}/event/kernel_terminate_subscriber.php (100%) rename phpBB/{includes => phpbb}/extension/base.php (100%) rename phpBB/{includes => phpbb}/extension/exception.php (100%) rename phpBB/{includes => phpbb}/extension/finder.php (99%) rename phpBB/{includes => phpbb}/extension/interface.php (100%) rename phpBB/{includes => phpbb}/extension/manager.php (100%) rename phpBB/{includes => phpbb}/extension/metadata_manager.php (100%) rename phpBB/{includes => phpbb}/extension/provider.php (100%) rename phpBB/{includes => phpbb}/feed/base.php (100%) rename phpBB/{includes => phpbb}/feed/factory.php (100%) rename phpBB/{includes => phpbb}/feed/forum.php (100%) rename phpBB/{includes => phpbb}/feed/forums.php (100%) rename phpBB/{includes => phpbb}/feed/helper.php (100%) rename phpBB/{includes => phpbb}/feed/news.php (100%) rename phpBB/{includes => phpbb}/feed/overall.php (100%) rename phpBB/{includes => phpbb}/feed/post_base.php (100%) rename phpBB/{includes => phpbb}/feed/topic.php (100%) rename phpBB/{includes => phpbb}/feed/topic_base.php (100%) rename phpBB/{includes => phpbb}/feed/topics.php (100%) rename phpBB/{includes => phpbb}/feed/topics_active.php (100%) rename phpBB/{includes => phpbb}/filesystem.php (100%) rename phpBB/{includes => phpbb}/groupposition/exception.php (100%) rename phpBB/{includes => phpbb}/groupposition/interface.php (100%) rename phpBB/{includes => phpbb}/groupposition/legend.php (100%) rename phpBB/{includes => phpbb}/groupposition/teampage.php (100%) rename phpBB/{includes => phpbb}/hook/finder.php (100%) rename phpBB/{includes => phpbb}/json_response.php (100%) rename phpBB/{includes => phpbb}/lock/db.php (100%) rename phpBB/{includes => phpbb}/lock/flock.php (100%) rename phpBB/{includes => phpbb}/log/interface.php (100%) rename phpBB/{includes => phpbb}/log/log.php (100%) rename phpBB/{includes => phpbb}/notification/exception.php (100%) rename phpBB/{includes => phpbb}/notification/manager.php (100%) rename phpBB/{includes => phpbb}/notification/method/base.php (100%) rename phpBB/{includes => phpbb}/notification/method/email.php (100%) rename phpBB/{includes => phpbb}/notification/method/interface.php (100%) rename phpBB/{includes => phpbb}/notification/method/jabber.php (100%) rename phpBB/{includes => phpbb}/notification/method/messenger_base.php (100%) rename phpBB/{includes => phpbb}/notification/type/approve_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/approve_topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/base.php (100%) rename phpBB/{includes => phpbb}/notification/type/bookmark.php (100%) rename phpBB/{includes => phpbb}/notification/type/disapprove_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/disapprove_topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/interface.php (100%) rename phpBB/{includes => phpbb}/notification/type/pm.php (100%) rename phpBB/{includes => phpbb}/notification/type/post.php (100%) rename phpBB/{includes => phpbb}/notification/type/post_in_queue.php (100%) rename phpBB/{includes => phpbb}/notification/type/quote.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_pm.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_pm_closed.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_post_closed.php (100%) rename phpBB/{includes => phpbb}/notification/type/topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/topic_in_queue.php (100%) rename phpBB/{includes => phpbb}/php/ini.php (100%) rename phpBB/{includes => phpbb}/request/deactivated_super_global.php (100%) rename phpBB/{includes => phpbb}/request/interface.php (100%) rename phpBB/{includes => phpbb}/request/request.php (100%) rename phpBB/{includes => phpbb}/request/type_cast_helper.php (100%) rename phpBB/{includes => phpbb}/request/type_cast_helper_interface.php (100%) rename phpBB/{includes => phpbb}/search/base.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_mysql.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_native.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_postgres.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_sphinx.php (100%) rename phpBB/{includes => phpbb}/search/index.htm (100%) rename phpBB/{includes => phpbb}/search/sphinx/config.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_comment.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_section.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_variable.php (100%) rename phpBB/{includes => phpbb}/session.php (100%) rename phpBB/{includes => phpbb}/style/extension_path_provider.php (100%) rename phpBB/{includes => phpbb}/style/path_provider.php (100%) rename phpBB/{includes => phpbb}/style/path_provider_interface.php (100%) rename phpBB/{includes => phpbb}/style/resource_locator.php (100%) rename phpBB/{includes => phpbb}/style/style.php (100%) rename phpBB/{includes => phpbb}/template/asset.php (100%) rename phpBB/{includes => phpbb}/template/context.php (100%) rename phpBB/{includes => phpbb}/template/locator.php (100%) rename phpBB/{includes => phpbb}/template/template.php (100%) rename phpBB/{includes => phpbb}/template/twig/definition.php (100%) rename phpBB/{includes => phpbb}/template/twig/environment.php (100%) rename phpBB/{includes => phpbb}/template/twig/extension.php (100%) rename phpBB/{includes => phpbb}/template/twig/lexer.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/define.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/event.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/expression/binary/equalequal.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/expression/binary/notequalequal.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/include.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includeasset.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includecss.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includejs.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includephp.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/php.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/define.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/event.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/include.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includecss.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includejs.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includephp.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/php.php (100%) rename phpBB/{includes => phpbb}/template/twig/twig.php (100%) rename phpBB/{includes => phpbb}/tree/interface.php (100%) rename phpBB/{includes => phpbb}/tree/nestedset.php (100%) rename phpBB/{includes => phpbb}/tree/nestedset_forum.php (100%) rename phpBB/{includes => phpbb}/user.php (100%) rename phpBB/{includes => phpbb}/user_loader.php (100%) rename tests/class_loader/{includes => phpbb}/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir.php (100%) rename tests/class_loader/{includes => phpbb}/dir/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir/subdir/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir2/dir2.php (100%) rename tests/controller/{includes => phpbb}/controller/foo.php (100%) rename tests/extension/{includes => phpbb}/default/implementation.php (100%) diff --git a/phpBB/common.php b/phpBB/common.php index f6f109c3de..962a1f951f 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -46,7 +46,7 @@ if (!defined('PHPBB_INSTALLED')) $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); // Eliminate . and .. from the path - require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); $phpbb_filesystem = new phpbb_filesystem(); $script_path = $phpbb_filesystem->clean_path($script_path); @@ -71,7 +71,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); @@ -85,7 +85,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 6618e2c3f9..11a2511aee 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -560,7 +560,7 @@ class acp_search return $finder ->extension_suffix('_backend') ->extension_directory('/search') - ->core_path('includes/search/') + ->core_path('phpbb/search/') ->get_classes(); } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b20ca1e4ea..cd6fb7931b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -82,7 +82,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); @@ -95,7 +95,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) @@ -217,7 +217,7 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $finder = $phpbb_extension_manager->get_finder(); $migrations = $finder - ->core_path('includes/db/migration/data/') + ->core_path('phpbb/db/migration/data/') ->get_classes(); $migrator->set_migrations($migrations); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 84a2a023f8..45e5777e36 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -78,7 +78,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include essential scripts -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_container.' . $phpEx); @@ -90,7 +90,7 @@ include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 3d7b6f7c88..ea23c318e3 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1435,7 +1435,7 @@ class install_install extends module $db->sql_return_on_error(true); include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx); + include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx); // We need to fill the config to let internal functions correctly work $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); @@ -1888,7 +1888,7 @@ class install_install extends module /** * Populate migrations for the installation * - * This "installs" all migrations from (root path)/includes/db/migrations/data. + * This "installs" all migrations from (root path)/phpbb/db/migrations/data. * "installs" means it adds all migrations to the migrations table, but does not * perform any of the actions in the migrations. * @@ -1900,7 +1900,7 @@ class install_install extends module $finder = $extension_manager->get_finder(); $migrations = $finder - ->core_path('includes/db/migration/data/') + ->core_path('phpbb/db/migration/data/') ->get_classes(); $migrator->populate_migrations($migrations); } diff --git a/phpBB/includes/auth/auth.php b/phpBB/phpbb/auth/auth.php similarity index 100% rename from phpBB/includes/auth/auth.php rename to phpBB/phpbb/auth/auth.php diff --git a/phpBB/includes/auth/index.htm b/phpBB/phpbb/auth/index.htm similarity index 100% rename from phpBB/includes/auth/index.htm rename to phpBB/phpbb/auth/index.htm diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php similarity index 100% rename from phpBB/includes/auth/provider/apache.php rename to phpBB/phpbb/auth/provider/apache.php diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php similarity index 100% rename from phpBB/includes/auth/provider/base.php rename to phpBB/phpbb/auth/provider/base.php diff --git a/phpBB/includes/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php similarity index 100% rename from phpBB/includes/auth/provider/db.php rename to phpBB/phpbb/auth/provider/db.php diff --git a/phpBB/includes/auth/provider/index.htm b/phpBB/phpbb/auth/provider/index.htm similarity index 100% rename from phpBB/includes/auth/provider/index.htm rename to phpBB/phpbb/auth/provider/index.htm diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php similarity index 100% rename from phpBB/includes/auth/provider/interface.php rename to phpBB/phpbb/auth/provider/interface.php diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php similarity index 100% rename from phpBB/includes/auth/provider/ldap.php rename to phpBB/phpbb/auth/provider/ldap.php diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php similarity index 100% rename from phpBB/includes/avatar/driver/driver.php rename to phpBB/phpbb/avatar/driver/driver.php diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php similarity index 100% rename from phpBB/includes/avatar/driver/gravatar.php rename to phpBB/phpbb/avatar/driver/gravatar.php diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php similarity index 100% rename from phpBB/includes/avatar/driver/interface.php rename to phpBB/phpbb/avatar/driver/interface.php diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php similarity index 100% rename from phpBB/includes/avatar/driver/local.php rename to phpBB/phpbb/avatar/driver/local.php diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php similarity index 100% rename from phpBB/includes/avatar/driver/remote.php rename to phpBB/phpbb/avatar/driver/remote.php diff --git a/phpBB/includes/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php similarity index 100% rename from phpBB/includes/avatar/driver/upload.php rename to phpBB/phpbb/avatar/driver/upload.php diff --git a/phpBB/includes/avatar/manager.php b/phpBB/phpbb/avatar/manager.php similarity index 100% rename from phpBB/includes/avatar/manager.php rename to phpBB/phpbb/avatar/manager.php diff --git a/phpBB/includes/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php similarity index 100% rename from phpBB/includes/cache/driver/apc.php rename to phpBB/phpbb/cache/driver/apc.php diff --git a/phpBB/includes/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php similarity index 100% rename from phpBB/includes/cache/driver/base.php rename to phpBB/phpbb/cache/driver/base.php diff --git a/phpBB/includes/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php similarity index 100% rename from phpBB/includes/cache/driver/eaccelerator.php rename to phpBB/phpbb/cache/driver/eaccelerator.php diff --git a/phpBB/includes/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php similarity index 100% rename from phpBB/includes/cache/driver/file.php rename to phpBB/phpbb/cache/driver/file.php diff --git a/phpBB/includes/cache/driver/interface.php b/phpBB/phpbb/cache/driver/interface.php similarity index 100% rename from phpBB/includes/cache/driver/interface.php rename to phpBB/phpbb/cache/driver/interface.php diff --git a/phpBB/includes/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php similarity index 100% rename from phpBB/includes/cache/driver/memcache.php rename to phpBB/phpbb/cache/driver/memcache.php diff --git a/phpBB/includes/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php similarity index 100% rename from phpBB/includes/cache/driver/memory.php rename to phpBB/phpbb/cache/driver/memory.php diff --git a/phpBB/includes/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php similarity index 100% rename from phpBB/includes/cache/driver/null.php rename to phpBB/phpbb/cache/driver/null.php diff --git a/phpBB/includes/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php similarity index 100% rename from phpBB/includes/cache/driver/redis.php rename to phpBB/phpbb/cache/driver/redis.php diff --git a/phpBB/includes/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php similarity index 100% rename from phpBB/includes/cache/driver/wincache.php rename to phpBB/phpbb/cache/driver/wincache.php diff --git a/phpBB/includes/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php similarity index 100% rename from phpBB/includes/cache/driver/xcache.php rename to phpBB/phpbb/cache/driver/xcache.php diff --git a/phpBB/includes/cache/service.php b/phpBB/phpbb/cache/service.php similarity index 100% rename from phpBB/includes/cache/service.php rename to phpBB/phpbb/cache/service.php diff --git a/phpBB/includes/class_loader.php b/phpBB/phpbb/class_loader.php similarity index 100% rename from phpBB/includes/class_loader.php rename to phpBB/phpbb/class_loader.php diff --git a/phpBB/includes/config/config.php b/phpBB/phpbb/config/config.php similarity index 100% rename from phpBB/includes/config/config.php rename to phpBB/phpbb/config/config.php diff --git a/phpBB/includes/config/db.php b/phpBB/phpbb/config/db.php similarity index 100% rename from phpBB/includes/config/db.php rename to phpBB/phpbb/config/db.php diff --git a/phpBB/includes/config/db_text.php b/phpBB/phpbb/config/db_text.php similarity index 100% rename from phpBB/includes/config/db_text.php rename to phpBB/phpbb/config/db_text.php diff --git a/phpBB/includes/content_visibility.php b/phpBB/phpbb/content_visibility.php similarity index 100% rename from phpBB/includes/content_visibility.php rename to phpBB/phpbb/content_visibility.php diff --git a/phpBB/includes/controller/exception.php b/phpBB/phpbb/controller/exception.php similarity index 100% rename from phpBB/includes/controller/exception.php rename to phpBB/phpbb/controller/exception.php diff --git a/phpBB/includes/controller/helper.php b/phpBB/phpbb/controller/helper.php similarity index 100% rename from phpBB/includes/controller/helper.php rename to phpBB/phpbb/controller/helper.php diff --git a/phpBB/includes/controller/provider.php b/phpBB/phpbb/controller/provider.php similarity index 100% rename from phpBB/includes/controller/provider.php rename to phpBB/phpbb/controller/provider.php diff --git a/phpBB/includes/controller/resolver.php b/phpBB/phpbb/controller/resolver.php similarity index 100% rename from phpBB/includes/controller/resolver.php rename to phpBB/phpbb/controller/resolver.php diff --git a/phpBB/includes/cron/manager.php b/phpBB/phpbb/cron/manager.php similarity index 100% rename from phpBB/includes/cron/manager.php rename to phpBB/phpbb/cron/manager.php diff --git a/phpBB/includes/cron/task/base.php b/phpBB/phpbb/cron/task/base.php similarity index 100% rename from phpBB/includes/cron/task/base.php rename to phpBB/phpbb/cron/task/base.php diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php similarity index 100% rename from phpBB/includes/cron/task/core/prune_all_forums.php rename to phpBB/phpbb/cron/task/core/prune_all_forums.php diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php similarity index 100% rename from phpBB/includes/cron/task/core/prune_forum.php rename to phpBB/phpbb/cron/task/core/prune_forum.php diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php similarity index 100% rename from phpBB/includes/cron/task/core/queue.php rename to phpBB/phpbb/cron/task/core/queue.php diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_cache.php rename to phpBB/phpbb/cron/task/core/tidy_cache.php diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_database.php rename to phpBB/phpbb/cron/task/core/tidy_database.php diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php similarity index 90% rename from phpBB/includes/cron/task/core/tidy_search.php rename to phpBB/phpbb/cron/task/core/tidy_search.php index 3ec25aa021..a3d5b7dbd2 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -61,11 +61,6 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base // Select the search method $search_type = basename($this->config['search_type']); - if (!class_exists($search_type)) - { - include($this->phpbb_root_path . "includes/search/$search_type." . $this->php_ext); - } - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user); @@ -90,7 +85,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base // Select the search method $search_type = basename($this->config['search_type']); - return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->php_ext); + return class_exists($search_type); } /** diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_sessions.php rename to phpBB/phpbb/cron/task/core/tidy_sessions.php diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_warnings.php rename to phpBB/phpbb/cron/task/core/tidy_warnings.php diff --git a/phpBB/includes/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php similarity index 100% rename from phpBB/includes/cron/task/parametrized.php rename to phpBB/phpbb/cron/task/parametrized.php diff --git a/phpBB/includes/cron/task/task.php b/phpBB/phpbb/cron/task/task.php similarity index 100% rename from phpBB/includes/cron/task/task.php rename to phpBB/phpbb/cron/task/task.php diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php similarity index 100% rename from phpBB/includes/cron/task/wrapper.php rename to phpBB/phpbb/cron/task/wrapper.php diff --git a/phpBB/includes/datetime.php b/phpBB/phpbb/datetime.php similarity index 100% rename from phpBB/includes/datetime.php rename to phpBB/phpbb/datetime.php diff --git a/phpBB/includes/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php similarity index 100% rename from phpBB/includes/db/driver/driver.php rename to phpBB/phpbb/db/driver/driver.php diff --git a/phpBB/includes/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php similarity index 100% rename from phpBB/includes/db/driver/firebird.php rename to phpBB/phpbb/db/driver/firebird.php diff --git a/phpBB/includes/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php similarity index 100% rename from phpBB/includes/db/driver/mssql.php rename to phpBB/phpbb/db/driver/mssql.php diff --git a/phpBB/includes/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php similarity index 100% rename from phpBB/includes/db/driver/mssql_base.php rename to phpBB/phpbb/db/driver/mssql_base.php diff --git a/phpBB/includes/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php similarity index 100% rename from phpBB/includes/db/driver/mssql_odbc.php rename to phpBB/phpbb/db/driver/mssql_odbc.php diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php similarity index 100% rename from phpBB/includes/db/driver/mssqlnative.php rename to phpBB/phpbb/db/driver/mssqlnative.php diff --git a/phpBB/includes/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php similarity index 100% rename from phpBB/includes/db/driver/mysql.php rename to phpBB/phpbb/db/driver/mysql.php diff --git a/phpBB/includes/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php similarity index 100% rename from phpBB/includes/db/driver/mysql_base.php rename to phpBB/phpbb/db/driver/mysql_base.php diff --git a/phpBB/includes/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php similarity index 100% rename from phpBB/includes/db/driver/mysqli.php rename to phpBB/phpbb/db/driver/mysqli.php diff --git a/phpBB/includes/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php similarity index 100% rename from phpBB/includes/db/driver/oracle.php rename to phpBB/phpbb/db/driver/oracle.php diff --git a/phpBB/includes/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php similarity index 100% rename from phpBB/includes/db/driver/postgres.php rename to phpBB/phpbb/db/driver/postgres.php diff --git a/phpBB/includes/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php similarity index 100% rename from phpBB/includes/db/driver/sqlite.php rename to phpBB/phpbb/db/driver/sqlite.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_12_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_1_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_3_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_4.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_4_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_pl1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_8.php rename to phpBB/phpbb/db/migration/data/30x/3_0_8.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_8_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/local_url_bbcode.php rename to phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php diff --git a/phpBB/includes/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php similarity index 100% rename from phpBB/includes/db/migration/data/310/avatars.php rename to phpBB/phpbb/db/migration/data/310/avatars.php diff --git a/phpBB/includes/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php similarity index 100% rename from phpBB/includes/db/migration/data/310/boardindex.php rename to phpBB/phpbb/db/migration/data/310/boardindex.php diff --git a/phpBB/includes/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php similarity index 100% rename from phpBB/includes/db/migration/data/310/config_db_text.php rename to phpBB/phpbb/db/migration/data/310/config_db_text.php diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php similarity index 100% rename from phpBB/includes/db/migration/data/310/dev.php rename to phpBB/phpbb/db/migration/data/310/dev.php diff --git a/phpBB/includes/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php similarity index 100% rename from phpBB/includes/db/migration/data/310/extensions.php rename to phpBB/phpbb/db/migration/data/310/extensions.php diff --git a/phpBB/includes/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php similarity index 100% rename from phpBB/includes/db/migration/data/310/forgot_password.php rename to phpBB/phpbb/db/migration/data/310/forgot_password.php diff --git a/phpBB/includes/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php similarity index 100% rename from phpBB/includes/db/migration/data/310/jquery_update.php rename to phpBB/phpbb/db/migration/data/310/jquery_update.php diff --git a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notification_options_reconvert.php rename to phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notifications.php rename to phpBB/phpbb/db/migration/data/310/notifications.php diff --git a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notifications_schema_fix.php rename to phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php diff --git a/phpBB/includes/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php similarity index 100% rename from phpBB/includes/db/migration/data/310/reported_posts_display.php rename to phpBB/phpbb/db/migration/data/310/reported_posts_display.php diff --git a/phpBB/includes/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php similarity index 100% rename from phpBB/includes/db/migration/data/310/signature_module_auth.php rename to phpBB/phpbb/db/migration/data/310/signature_module_auth.php diff --git a/phpBB/includes/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php similarity index 100% rename from phpBB/includes/db/migration/data/310/softdelete_p1.php rename to phpBB/phpbb/db/migration/data/310/softdelete_p1.php diff --git a/phpBB/includes/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/softdelete_p2.php rename to phpBB/phpbb/db/migration/data/310/softdelete_p2.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php similarity index 100% rename from phpBB/includes/db/migration/data/310/style_update_p1.php rename to phpBB/phpbb/db/migration/data/310/style_update_p1.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/style_update_p2.php rename to phpBB/phpbb/db/migration/data/310/style_update_p2.php diff --git a/phpBB/includes/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php similarity index 100% rename from phpBB/includes/db/migration/data/310/teampage.php rename to phpBB/phpbb/db/migration/data/310/teampage.php diff --git a/phpBB/includes/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php similarity index 100% rename from phpBB/includes/db/migration/data/310/timezone.php rename to phpBB/phpbb/db/migration/data/310/timezone.php diff --git a/phpBB/includes/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/timezone_p2.php rename to phpBB/phpbb/db/migration/data/310/timezone_p2.php diff --git a/phpBB/includes/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php similarity index 100% rename from phpBB/includes/db/migration/exception.php rename to phpBB/phpbb/db/migration/exception.php diff --git a/phpBB/includes/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php similarity index 100% rename from phpBB/includes/db/migration/migration.php rename to phpBB/phpbb/db/migration/migration.php diff --git a/phpBB/includes/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php similarity index 100% rename from phpBB/includes/db/migration/tool/config.php rename to phpBB/phpbb/db/migration/tool/config.php diff --git a/phpBB/includes/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/interface.php similarity index 100% rename from phpBB/includes/db/migration/tool/interface.php rename to phpBB/phpbb/db/migration/tool/interface.php diff --git a/phpBB/includes/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php similarity index 100% rename from phpBB/includes/db/migration/tool/module.php rename to phpBB/phpbb/db/migration/tool/module.php diff --git a/phpBB/includes/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php similarity index 100% rename from phpBB/includes/db/migration/tool/permission.php rename to phpBB/phpbb/db/migration/tool/permission.php diff --git a/phpBB/includes/db/migrator.php b/phpBB/phpbb/db/migrator.php similarity index 100% rename from phpBB/includes/db/migrator.php rename to phpBB/phpbb/db/migrator.php diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php similarity index 100% rename from phpBB/includes/db/sql_insert_buffer.php rename to phpBB/phpbb/db/sql_insert_buffer.php diff --git a/phpBB/includes/di/extension/config.php b/phpBB/phpbb/di/extension/config.php similarity index 100% rename from phpBB/includes/di/extension/config.php rename to phpBB/phpbb/di/extension/config.php diff --git a/phpBB/includes/di/extension/core.php b/phpBB/phpbb/di/extension/core.php similarity index 100% rename from phpBB/includes/di/extension/core.php rename to phpBB/phpbb/di/extension/core.php diff --git a/phpBB/includes/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php similarity index 100% rename from phpBB/includes/di/extension/ext.php rename to phpBB/phpbb/di/extension/ext.php diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php similarity index 100% rename from phpBB/includes/di/pass/collection_pass.php rename to phpBB/phpbb/di/pass/collection_pass.php diff --git a/phpBB/includes/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php similarity index 100% rename from phpBB/includes/di/pass/kernel_pass.php rename to phpBB/phpbb/di/pass/kernel_pass.php diff --git a/phpBB/includes/di/service_collection.php b/phpBB/phpbb/di/service_collection.php similarity index 100% rename from phpBB/includes/di/service_collection.php rename to phpBB/phpbb/di/service_collection.php diff --git a/phpBB/includes/error_collector.php b/phpBB/phpbb/error_collector.php similarity index 100% rename from phpBB/includes/error_collector.php rename to phpBB/phpbb/error_collector.php diff --git a/phpBB/includes/event/data.php b/phpBB/phpbb/event/data.php similarity index 100% rename from phpBB/includes/event/data.php rename to phpBB/phpbb/event/data.php diff --git a/phpBB/includes/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php similarity index 100% rename from phpBB/includes/event/dispatcher.php rename to phpBB/phpbb/event/dispatcher.php diff --git a/phpBB/includes/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php similarity index 100% rename from phpBB/includes/event/extension_subscriber_loader.php rename to phpBB/phpbb/event/extension_subscriber_loader.php diff --git a/phpBB/includes/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_exception_subscriber.php rename to phpBB/phpbb/event/kernel_exception_subscriber.php diff --git a/phpBB/includes/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_request_subscriber.php rename to phpBB/phpbb/event/kernel_request_subscriber.php diff --git a/phpBB/includes/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_terminate_subscriber.php rename to phpBB/phpbb/event/kernel_terminate_subscriber.php diff --git a/phpBB/includes/extension/base.php b/phpBB/phpbb/extension/base.php similarity index 100% rename from phpBB/includes/extension/base.php rename to phpBB/phpbb/extension/base.php diff --git a/phpBB/includes/extension/exception.php b/phpBB/phpbb/extension/exception.php similarity index 100% rename from phpBB/includes/extension/exception.php rename to phpBB/phpbb/extension/exception.php diff --git a/phpBB/includes/extension/finder.php b/phpBB/phpbb/extension/finder.php similarity index 99% rename from phpBB/includes/extension/finder.php rename to phpBB/phpbb/extension/finder.php index 49bb2a514f..155a41cda5 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -275,7 +275,7 @@ class phpbb_extension_finder $classes = array(); foreach ($files as $file => $ext_name) { - $file = preg_replace('#^includes/#', '', $file); + $file = preg_replace('#^(phpbb|includes)/#', '', $file); $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); } @@ -377,7 +377,7 @@ class phpbb_extension_finder return $files; } - + /** * Finds all file system entries matching the configured options for one * specific extension diff --git a/phpBB/includes/extension/interface.php b/phpBB/phpbb/extension/interface.php similarity index 100% rename from phpBB/includes/extension/interface.php rename to phpBB/phpbb/extension/interface.php diff --git a/phpBB/includes/extension/manager.php b/phpBB/phpbb/extension/manager.php similarity index 100% rename from phpBB/includes/extension/manager.php rename to phpBB/phpbb/extension/manager.php diff --git a/phpBB/includes/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php similarity index 100% rename from phpBB/includes/extension/metadata_manager.php rename to phpBB/phpbb/extension/metadata_manager.php diff --git a/phpBB/includes/extension/provider.php b/phpBB/phpbb/extension/provider.php similarity index 100% rename from phpBB/includes/extension/provider.php rename to phpBB/phpbb/extension/provider.php diff --git a/phpBB/includes/feed/base.php b/phpBB/phpbb/feed/base.php similarity index 100% rename from phpBB/includes/feed/base.php rename to phpBB/phpbb/feed/base.php diff --git a/phpBB/includes/feed/factory.php b/phpBB/phpbb/feed/factory.php similarity index 100% rename from phpBB/includes/feed/factory.php rename to phpBB/phpbb/feed/factory.php diff --git a/phpBB/includes/feed/forum.php b/phpBB/phpbb/feed/forum.php similarity index 100% rename from phpBB/includes/feed/forum.php rename to phpBB/phpbb/feed/forum.php diff --git a/phpBB/includes/feed/forums.php b/phpBB/phpbb/feed/forums.php similarity index 100% rename from phpBB/includes/feed/forums.php rename to phpBB/phpbb/feed/forums.php diff --git a/phpBB/includes/feed/helper.php b/phpBB/phpbb/feed/helper.php similarity index 100% rename from phpBB/includes/feed/helper.php rename to phpBB/phpbb/feed/helper.php diff --git a/phpBB/includes/feed/news.php b/phpBB/phpbb/feed/news.php similarity index 100% rename from phpBB/includes/feed/news.php rename to phpBB/phpbb/feed/news.php diff --git a/phpBB/includes/feed/overall.php b/phpBB/phpbb/feed/overall.php similarity index 100% rename from phpBB/includes/feed/overall.php rename to phpBB/phpbb/feed/overall.php diff --git a/phpBB/includes/feed/post_base.php b/phpBB/phpbb/feed/post_base.php similarity index 100% rename from phpBB/includes/feed/post_base.php rename to phpBB/phpbb/feed/post_base.php diff --git a/phpBB/includes/feed/topic.php b/phpBB/phpbb/feed/topic.php similarity index 100% rename from phpBB/includes/feed/topic.php rename to phpBB/phpbb/feed/topic.php diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php similarity index 100% rename from phpBB/includes/feed/topic_base.php rename to phpBB/phpbb/feed/topic_base.php diff --git a/phpBB/includes/feed/topics.php b/phpBB/phpbb/feed/topics.php similarity index 100% rename from phpBB/includes/feed/topics.php rename to phpBB/phpbb/feed/topics.php diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php similarity index 100% rename from phpBB/includes/feed/topics_active.php rename to phpBB/phpbb/feed/topics_active.php diff --git a/phpBB/includes/filesystem.php b/phpBB/phpbb/filesystem.php similarity index 100% rename from phpBB/includes/filesystem.php rename to phpBB/phpbb/filesystem.php diff --git a/phpBB/includes/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php similarity index 100% rename from phpBB/includes/groupposition/exception.php rename to phpBB/phpbb/groupposition/exception.php diff --git a/phpBB/includes/groupposition/interface.php b/phpBB/phpbb/groupposition/interface.php similarity index 100% rename from phpBB/includes/groupposition/interface.php rename to phpBB/phpbb/groupposition/interface.php diff --git a/phpBB/includes/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php similarity index 100% rename from phpBB/includes/groupposition/legend.php rename to phpBB/phpbb/groupposition/legend.php diff --git a/phpBB/includes/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php similarity index 100% rename from phpBB/includes/groupposition/teampage.php rename to phpBB/phpbb/groupposition/teampage.php diff --git a/phpBB/includes/hook/finder.php b/phpBB/phpbb/hook/finder.php similarity index 100% rename from phpBB/includes/hook/finder.php rename to phpBB/phpbb/hook/finder.php diff --git a/phpBB/includes/json_response.php b/phpBB/phpbb/json_response.php similarity index 100% rename from phpBB/includes/json_response.php rename to phpBB/phpbb/json_response.php diff --git a/phpBB/includes/lock/db.php b/phpBB/phpbb/lock/db.php similarity index 100% rename from phpBB/includes/lock/db.php rename to phpBB/phpbb/lock/db.php diff --git a/phpBB/includes/lock/flock.php b/phpBB/phpbb/lock/flock.php similarity index 100% rename from phpBB/includes/lock/flock.php rename to phpBB/phpbb/lock/flock.php diff --git a/phpBB/includes/log/interface.php b/phpBB/phpbb/log/interface.php similarity index 100% rename from phpBB/includes/log/interface.php rename to phpBB/phpbb/log/interface.php diff --git a/phpBB/includes/log/log.php b/phpBB/phpbb/log/log.php similarity index 100% rename from phpBB/includes/log/log.php rename to phpBB/phpbb/log/log.php diff --git a/phpBB/includes/notification/exception.php b/phpBB/phpbb/notification/exception.php similarity index 100% rename from phpBB/includes/notification/exception.php rename to phpBB/phpbb/notification/exception.php diff --git a/phpBB/includes/notification/manager.php b/phpBB/phpbb/notification/manager.php similarity index 100% rename from phpBB/includes/notification/manager.php rename to phpBB/phpbb/notification/manager.php diff --git a/phpBB/includes/notification/method/base.php b/phpBB/phpbb/notification/method/base.php similarity index 100% rename from phpBB/includes/notification/method/base.php rename to phpBB/phpbb/notification/method/base.php diff --git a/phpBB/includes/notification/method/email.php b/phpBB/phpbb/notification/method/email.php similarity index 100% rename from phpBB/includes/notification/method/email.php rename to phpBB/phpbb/notification/method/email.php diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/phpbb/notification/method/interface.php similarity index 100% rename from phpBB/includes/notification/method/interface.php rename to phpBB/phpbb/notification/method/interface.php diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php similarity index 100% rename from phpBB/includes/notification/method/jabber.php rename to phpBB/phpbb/notification/method/jabber.php diff --git a/phpBB/includes/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php similarity index 100% rename from phpBB/includes/notification/method/messenger_base.php rename to phpBB/phpbb/notification/method/messenger_base.php diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php similarity index 100% rename from phpBB/includes/notification/type/approve_post.php rename to phpBB/phpbb/notification/type/approve_post.php diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php similarity index 100% rename from phpBB/includes/notification/type/approve_topic.php rename to phpBB/phpbb/notification/type/approve_topic.php diff --git a/phpBB/includes/notification/type/base.php b/phpBB/phpbb/notification/type/base.php similarity index 100% rename from phpBB/includes/notification/type/base.php rename to phpBB/phpbb/notification/type/base.php diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php similarity index 100% rename from phpBB/includes/notification/type/bookmark.php rename to phpBB/phpbb/notification/type/bookmark.php diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php similarity index 100% rename from phpBB/includes/notification/type/disapprove_post.php rename to phpBB/phpbb/notification/type/disapprove_post.php diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php similarity index 100% rename from phpBB/includes/notification/type/disapprove_topic.php rename to phpBB/phpbb/notification/type/disapprove_topic.php diff --git a/phpBB/includes/notification/type/interface.php b/phpBB/phpbb/notification/type/interface.php similarity index 100% rename from phpBB/includes/notification/type/interface.php rename to phpBB/phpbb/notification/type/interface.php diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php similarity index 100% rename from phpBB/includes/notification/type/pm.php rename to phpBB/phpbb/notification/type/pm.php diff --git a/phpBB/includes/notification/type/post.php b/phpBB/phpbb/notification/type/post.php similarity index 100% rename from phpBB/includes/notification/type/post.php rename to phpBB/phpbb/notification/type/post.php diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php similarity index 100% rename from phpBB/includes/notification/type/post_in_queue.php rename to phpBB/phpbb/notification/type/post_in_queue.php diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php similarity index 100% rename from phpBB/includes/notification/type/quote.php rename to phpBB/phpbb/notification/type/quote.php diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php similarity index 100% rename from phpBB/includes/notification/type/report_pm.php rename to phpBB/phpbb/notification/type/report_pm.php diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php similarity index 100% rename from phpBB/includes/notification/type/report_pm_closed.php rename to phpBB/phpbb/notification/type/report_pm_closed.php diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php similarity index 100% rename from phpBB/includes/notification/type/report_post.php rename to phpBB/phpbb/notification/type/report_post.php diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php similarity index 100% rename from phpBB/includes/notification/type/report_post_closed.php rename to phpBB/phpbb/notification/type/report_post_closed.php diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php similarity index 100% rename from phpBB/includes/notification/type/topic.php rename to phpBB/phpbb/notification/type/topic.php diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php similarity index 100% rename from phpBB/includes/notification/type/topic_in_queue.php rename to phpBB/phpbb/notification/type/topic_in_queue.php diff --git a/phpBB/includes/php/ini.php b/phpBB/phpbb/php/ini.php similarity index 100% rename from phpBB/includes/php/ini.php rename to phpBB/phpbb/php/ini.php diff --git a/phpBB/includes/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php similarity index 100% rename from phpBB/includes/request/deactivated_super_global.php rename to phpBB/phpbb/request/deactivated_super_global.php diff --git a/phpBB/includes/request/interface.php b/phpBB/phpbb/request/interface.php similarity index 100% rename from phpBB/includes/request/interface.php rename to phpBB/phpbb/request/interface.php diff --git a/phpBB/includes/request/request.php b/phpBB/phpbb/request/request.php similarity index 100% rename from phpBB/includes/request/request.php rename to phpBB/phpbb/request/request.php diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php similarity index 100% rename from phpBB/includes/request/type_cast_helper.php rename to phpBB/phpbb/request/type_cast_helper.php diff --git a/phpBB/includes/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php similarity index 100% rename from phpBB/includes/request/type_cast_helper_interface.php rename to phpBB/phpbb/request/type_cast_helper_interface.php diff --git a/phpBB/includes/search/base.php b/phpBB/phpbb/search/base.php similarity index 100% rename from phpBB/includes/search/base.php rename to phpBB/phpbb/search/base.php diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php similarity index 100% rename from phpBB/includes/search/fulltext_mysql.php rename to phpBB/phpbb/search/fulltext_mysql.php diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php similarity index 100% rename from phpBB/includes/search/fulltext_native.php rename to phpBB/phpbb/search/fulltext_native.php diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php similarity index 100% rename from phpBB/includes/search/fulltext_postgres.php rename to phpBB/phpbb/search/fulltext_postgres.php diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php similarity index 100% rename from phpBB/includes/search/fulltext_sphinx.php rename to phpBB/phpbb/search/fulltext_sphinx.php diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/search/index.htm similarity index 100% rename from phpBB/includes/search/index.htm rename to phpBB/phpbb/search/index.htm diff --git a/phpBB/includes/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php similarity index 100% rename from phpBB/includes/search/sphinx/config.php rename to phpBB/phpbb/search/sphinx/config.php diff --git a/phpBB/includes/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php similarity index 100% rename from phpBB/includes/search/sphinx/config_comment.php rename to phpBB/phpbb/search/sphinx/config_comment.php diff --git a/phpBB/includes/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php similarity index 100% rename from phpBB/includes/search/sphinx/config_section.php rename to phpBB/phpbb/search/sphinx/config_section.php diff --git a/phpBB/includes/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php similarity index 100% rename from phpBB/includes/search/sphinx/config_variable.php rename to phpBB/phpbb/search/sphinx/config_variable.php diff --git a/phpBB/includes/session.php b/phpBB/phpbb/session.php similarity index 100% rename from phpBB/includes/session.php rename to phpBB/phpbb/session.php diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php similarity index 100% rename from phpBB/includes/style/extension_path_provider.php rename to phpBB/phpbb/style/extension_path_provider.php diff --git a/phpBB/includes/style/path_provider.php b/phpBB/phpbb/style/path_provider.php similarity index 100% rename from phpBB/includes/style/path_provider.php rename to phpBB/phpbb/style/path_provider.php diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php similarity index 100% rename from phpBB/includes/style/path_provider_interface.php rename to phpBB/phpbb/style/path_provider_interface.php diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php similarity index 100% rename from phpBB/includes/style/resource_locator.php rename to phpBB/phpbb/style/resource_locator.php diff --git a/phpBB/includes/style/style.php b/phpBB/phpbb/style/style.php similarity index 100% rename from phpBB/includes/style/style.php rename to phpBB/phpbb/style/style.php diff --git a/phpBB/includes/template/asset.php b/phpBB/phpbb/template/asset.php similarity index 100% rename from phpBB/includes/template/asset.php rename to phpBB/phpbb/template/asset.php diff --git a/phpBB/includes/template/context.php b/phpBB/phpbb/template/context.php similarity index 100% rename from phpBB/includes/template/context.php rename to phpBB/phpbb/template/context.php diff --git a/phpBB/includes/template/locator.php b/phpBB/phpbb/template/locator.php similarity index 100% rename from phpBB/includes/template/locator.php rename to phpBB/phpbb/template/locator.php diff --git a/phpBB/includes/template/template.php b/phpBB/phpbb/template/template.php similarity index 100% rename from phpBB/includes/template/template.php rename to phpBB/phpbb/template/template.php diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php similarity index 100% rename from phpBB/includes/template/twig/definition.php rename to phpBB/phpbb/template/twig/definition.php diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php similarity index 100% rename from phpBB/includes/template/twig/environment.php rename to phpBB/phpbb/template/twig/environment.php diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php similarity index 100% rename from phpBB/includes/template/twig/extension.php rename to phpBB/phpbb/template/twig/extension.php diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php similarity index 100% rename from phpBB/includes/template/twig/lexer.php rename to phpBB/phpbb/template/twig/lexer.php diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php similarity index 100% rename from phpBB/includes/template/twig/node/define.php rename to phpBB/phpbb/template/twig/node/define.php diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php similarity index 100% rename from phpBB/includes/template/twig/node/event.php rename to phpBB/phpbb/template/twig/node/event.php diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php similarity index 100% rename from phpBB/includes/template/twig/node/expression/binary/equalequal.php rename to phpBB/phpbb/template/twig/node/expression/binary/equalequal.php diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php similarity index 100% rename from phpBB/includes/template/twig/node/expression/binary/notequalequal.php rename to phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php similarity index 100% rename from phpBB/includes/template/twig/node/include.php rename to phpBB/phpbb/template/twig/node/include.php diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php similarity index 100% rename from phpBB/includes/template/twig/node/includeasset.php rename to phpBB/phpbb/template/twig/node/includeasset.php diff --git a/phpBB/includes/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php similarity index 100% rename from phpBB/includes/template/twig/node/includecss.php rename to phpBB/phpbb/template/twig/node/includecss.php diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php similarity index 100% rename from phpBB/includes/template/twig/node/includejs.php rename to phpBB/phpbb/template/twig/node/includejs.php diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php similarity index 100% rename from phpBB/includes/template/twig/node/includephp.php rename to phpBB/phpbb/template/twig/node/includephp.php diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php similarity index 100% rename from phpBB/includes/template/twig/node/php.php rename to phpBB/phpbb/template/twig/node/php.php diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/define.php rename to phpBB/phpbb/template/twig/tokenparser/define.php diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/event.php rename to phpBB/phpbb/template/twig/tokenparser/event.php diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/include.php rename to phpBB/phpbb/template/twig/tokenparser/include.php diff --git a/phpBB/includes/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includecss.php rename to phpBB/phpbb/template/twig/tokenparser/includecss.php diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includejs.php rename to phpBB/phpbb/template/twig/tokenparser/includejs.php diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includephp.php rename to phpBB/phpbb/template/twig/tokenparser/includephp.php diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/php.php rename to phpBB/phpbb/template/twig/tokenparser/php.php diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php similarity index 100% rename from phpBB/includes/template/twig/twig.php rename to phpBB/phpbb/template/twig/twig.php diff --git a/phpBB/includes/tree/interface.php b/phpBB/phpbb/tree/interface.php similarity index 100% rename from phpBB/includes/tree/interface.php rename to phpBB/phpbb/tree/interface.php diff --git a/phpBB/includes/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php similarity index 100% rename from phpBB/includes/tree/nestedset.php rename to phpBB/phpbb/tree/nestedset.php diff --git a/phpBB/includes/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php similarity index 100% rename from phpBB/includes/tree/nestedset_forum.php rename to phpBB/phpbb/tree/nestedset_forum.php diff --git a/phpBB/includes/user.php b/phpBB/phpbb/user.php similarity index 100% rename from phpBB/includes/user.php rename to phpBB/phpbb/user.php diff --git a/phpBB/includes/user_loader.php b/phpBB/phpbb/user_loader.php similarity index 100% rename from phpBB/includes/user_loader.php rename to phpBB/phpbb/user_loader.php diff --git a/phpunit.xml.all b/phpunit.xml.all index d47864e104..d18518d3e3 100644 --- a/phpunit.xml.all +++ b/phpunit.xml.all @@ -27,9 +27,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ac45597b45..c852f91b50 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -34,9 +34,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/phpunit.xml.functional b/phpunit.xml.functional index 3a3d653b47..cd9cc8771f 100644 --- a/phpunit.xml.functional +++ b/phpunit.xml.functional @@ -33,9 +33,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index a38740c82d..68cbb64c03 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,13 +14,13 @@ require_once $phpbb_root_path . 'includes/startup.php'; $table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; -require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; +require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; $phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php"); $phpbb_class_loader_mock->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php"); $phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', "php"); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'phpbb/', "php"); $phpbb_class_loader->register(); require_once 'test_framework/phpbb_test_case_helpers.php'; diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index bf27c7c217..2b55c1ff8d 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -30,9 +30,9 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/'); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/'); - $prefix .= 'includes/'; + $prefix .= 'phpbb/'; $this->assertEquals( '', @@ -71,10 +71,10 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $cache = new phpbb_mock_cache($cache_map); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', 'php', $cache); - $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', 'php', $cache); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/', 'php', $cache); + $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'phpbb/', 'php', $cache); - $prefix .= 'includes/'; + $prefix .= 'phpbb/'; $this->assertEquals( $prefix . 'dir/class_name.php', diff --git a/tests/class_loader/includes/class_name.php b/tests/class_loader/phpbb/class_name.php similarity index 100% rename from tests/class_loader/includes/class_name.php rename to tests/class_loader/phpbb/class_name.php diff --git a/tests/class_loader/includes/dir.php b/tests/class_loader/phpbb/dir.php similarity index 100% rename from tests/class_loader/includes/dir.php rename to tests/class_loader/phpbb/dir.php diff --git a/tests/class_loader/includes/dir/class_name.php b/tests/class_loader/phpbb/dir/class_name.php similarity index 100% rename from tests/class_loader/includes/dir/class_name.php rename to tests/class_loader/phpbb/dir/class_name.php diff --git a/tests/class_loader/includes/dir/subdir/class_name.php b/tests/class_loader/phpbb/dir/subdir/class_name.php similarity index 100% rename from tests/class_loader/includes/dir/subdir/class_name.php rename to tests/class_loader/phpbb/dir/subdir/class_name.php diff --git a/tests/class_loader/includes/dir2/dir2.php b/tests/class_loader/phpbb/dir2/dir2.php similarity index 100% rename from tests/class_loader/includes/dir2/dir2.php rename to tests/class_loader/phpbb/dir2/dir2.php diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c06bf7d548..dfc4f80469 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -59,7 +59,7 @@ class phpbb_controller_controller_test extends phpbb_test_case } if (!class_exists('phpbb_controller_foo')) { - include(__DIR__.'/includes/controller/foo.php'); + include(__DIR__.'/phpbb/controller/foo.php'); } $resolver = new phpbb_controller_resolver(new phpbb_user, $container); diff --git a/tests/controller/includes/controller/foo.php b/tests/controller/phpbb/controller/foo.php similarity index 100% rename from tests/controller/includes/controller/foo.php rename to tests/controller/phpbb/controller/foo.php diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index c28925272e..2d97672878 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -7,9 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/user.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/datetime.php'; require_once dirname(__FILE__) . '/../mock/lang.php'; class phpbb_datetime_from_format_test extends phpbb_test_case diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 1e40c9c6d6..07eb666e93 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migrator.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/migration.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/migration/dummy.php'; diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index 7d582f230b..b82d1ef48d 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -7,9 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/config.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; - class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case { public function setup() diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 3303086b26..828fb76c65 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/module.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index 438ab2b28e..79d9db66da 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/permission.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case { diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index d67dea3719..fceb8aa3d8 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../phpBB/includes/error_collector.php'; class phpbb_error_collector_test extends phpbb_test_case { diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 6f3cebbd7c..3bf2c42573 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -36,7 +36,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_suffix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_suffix('_class') ->get_classes(); @@ -81,7 +81,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_prefix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_prefix('hidden_') ->get_classes(); @@ -98,7 +98,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_directory_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_directory('type') ->get_classes(); @@ -209,7 +209,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_cached_get_files() { $query = array( - 'core_path' => 'includes/foo', + 'core_path' => 'phpbb/foo', 'core_suffix' => false, 'core_prefix' => false, 'core_directory' => 'bar', diff --git a/tests/extension/includes/default/implementation.php b/tests/extension/phpbb/default/implementation.php similarity index 100% rename from tests/extension/includes/default/implementation.php rename to tests/extension/phpbb/default/implementation.php diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 1ab9488568..6827aaa1b6 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -11,7 +11,6 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; require_once dirname(__FILE__) . '/../mock/user.php'; require_once dirname(__FILE__) . '/../mock/cache.php'; diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 1665c493be..8b9df33a63 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -10,6 +10,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions.php'; require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; require_once __DIR__ . '/../../phpBB/includes/functions_upload.php'; +require_once __DIR__ . '/../mock/filespec.php'; class phpbb_fileupload_test extends phpbb_test_case { From 057d860d07fe829104aa938338830787415bc1c6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 00:56:37 -0400 Subject: [PATCH 056/284] [ticket/11696] Rename db_tools.php so it can be autoloaded PHPBB3-11696 --- phpBB/config/services.yml | 1 - phpBB/includes/acp/acp_database.php | 4 ---- .../captcha/plugins/phpbb_captcha_qa_plugin.php | 12 ++---------- phpBB/includes/db/{db_tools.php => tools.php} | 0 phpBB/includes/functions_install.php | 6 ------ phpBB/phpbb/search/fulltext_sphinx.php | 5 ----- tests/dbal/auto_increment_test.php | 1 - tests/dbal/db_tools_test.php | 1 - tests/dbal/migrator_test.php | 2 -- tests/extension/metadata_manager_test.php | 2 -- tests/functional/extension_controller_test.php | 1 - tests/functional/metadata_manager_test.php | 2 -- tests/notification/convert_test.php | 2 -- 13 files changed, 2 insertions(+), 37 deletions(-) rename phpBB/includes/db/{db_tools.php => tools.php} (100%) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 25fff79de3..c1579cfb57 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -126,7 +126,6 @@ services: - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] dbal.tools: - file: %core.root_path%includes/db/db_tools.%core.php_ext% class: phpbb_db_tools arguments: - @dbal.conn diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index ebcbd28a87..5d191b3d0f 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -28,10 +28,6 @@ class acp_database global $cache, $db, $user, $auth, $template, $table_prefix; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - if (!class_exists('phpbb_db_tools')) - { - require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); - } $this->db_tools = new phpbb_db_tools($db); $user->add_lang('acp/database'); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index ec7636f511..6843f25d72 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -110,12 +110,8 @@ class phpbb_captcha_qa */ static public function is_installed() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools', false)) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); @@ -297,12 +293,8 @@ class phpbb_captcha_qa */ function install() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools')) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/tools.php similarity index 100% rename from phpBB/includes/db/db_tools.php rename to phpBB/includes/db/tools.php diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 8978e3fadd..bd0ffaaf00 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -184,12 +184,6 @@ function dbms_select($default = '', $only_20x_options = false) */ function get_tables(&$db) { - if (!class_exists('phpbb_db_tools')) - { - global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); - } - $db_tools = new phpbb_db_tools($db); return $db_tools->sql_list_tables(); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 2f7b236c78..4f3f852664 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -135,11 +135,6 @@ class phpbb_search_fulltext_sphinx $this->db = $db; $this->auth = $auth; - if (!class_exists('phpbb_db_tools')) - { - require($this->phpbb_root_path . 'includes/db/db_tools.' . $this->php_ext); - } - // Initialize phpbb_db_tools object $this->db_tools = new phpbb_db_tools($this->db); diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index e87fc1c6bd..077bfad933 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; class phpbb_dbal_auto_increment_test extends phpbb_database_test_case { diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index c20e46011f..7bdbc696e7 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; class phpbb_dbal_db_tools_test extends phpbb_database_test_case { diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 07eb666e93..9e55e4dd35 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - require_once dirname(__FILE__) . '/migration/dummy.php'; require_once dirname(__FILE__) . '/migration/unfulfillable.php'; require_once dirname(__FILE__) . '/migration/if.php'; diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index bd88f396d9..e5bd29092e 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { protected $class_loader; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 9ddf1e3e5c..7d29f0000c 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -6,7 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; /** * @group functional diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index c55e7373ea..651c99a99d 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - /** * @group functional */ diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 4d00fa0a1e..c038020385 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -6,8 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ - -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/../mock/sql_insert_buffer.php'; class phpbb_notification_convert_test extends phpbb_database_test_case From 5d4c443c2df1685578084417123d52b86eb3bfb6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 01:01:53 -0400 Subject: [PATCH 057/284] [ticket/11696] Remove manual loading of db_tools in extension controller test Remember to store the file, before commiting it... PHPBB3-11696 --- tests/functional/extension_module_test.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index c573ea5410..c31a892ce9 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -6,8 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ - -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; /** From 131194d216f85dffe4fb9d8fd64eb15248fd374b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:12:49 -0400 Subject: [PATCH 058/284] [ticket/11696] Rename constructor to __construct() PHPBB3-11696 --- phpBB/includes/db/tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/db/tools.php b/phpBB/includes/db/tools.php index 983cdc18ea..492284ffcd 100644 --- a/phpBB/includes/db/tools.php +++ b/phpBB/includes/db/tools.php @@ -303,7 +303,7 @@ class phpbb_db_tools * @param phpbb_db_driver $db Database connection * @param bool $return_statements True if only statements should be returned and no SQL being executed */ - function phpbb_db_tools(phpbb_db_driver $db, $return_statements = false) + public function __construct(phpbb_db_driver $db, $return_statements = false) { $this->db = $db; $this->return_statements = $return_statements; From f302cbe175e99f90448458f44a499eeb33f75261 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:16:15 -0400 Subject: [PATCH 059/284] [ticket/11696] Move file to new directory PHPBB3-11696 --- phpBB/{includes => phpbb}/db/tools.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpBB/{includes => phpbb}/db/tools.php (100%) diff --git a/phpBB/includes/db/tools.php b/phpBB/phpbb/db/tools.php similarity index 100% rename from phpBB/includes/db/tools.php rename to phpBB/phpbb/db/tools.php From 405b5e54f6e97f70417af38c27f8fa2fb4062c3e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:49:23 -0400 Subject: [PATCH 060/284] [ticket/11702] Fix forum_posts left over for link-click counts in viewforum.php PHPBB3-11702 --- phpBB/viewforum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 06af674ee6..5a59e021b3 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -105,7 +105,7 @@ if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) { $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET forum_posts = forum_posts + 1 + SET forum_posts_approved = forum_posts_approved + 1 WHERE forum_id = ' . $forum_id; $db->sql_query($sql); } From e91b465de1c4cf767bba72c9eebe945b898c3fda Mon Sep 17 00:00:00 2001 From: Victor Nagy Date: Sun, 14 Jul 2013 10:57:19 -0400 Subject: [PATCH 061/284] [ticket/11697] author_search() used incorrect parameter The author_search() function in fulltext_mysql.php had an argument $m_approve_fid_ary parameter but it was changed in the Docblock and code to $post_visibility. This change renames that argument according to the docblock, the code and to mirror the other classes. PHPBB3-11697 --- phpBB/includes/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 7dc4da8ffe..a1e1b089b9 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -542,7 +542,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base * @param int $per_page number of ids each page is supposed to contain * @return boolean|int total number of results */ - public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts if (!sizeof($author_ary)) From 573987d2d2defe3425c083b093bb5a5d3ec2db2a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Jun 2013 10:52:13 +0200 Subject: [PATCH 062/284] [ticket/11582] Add new service for permissions Replace calls to the language-array type with a call to get_types() PHPBB3-11582 --- phpBB/config/services.yml | 5 + phpBB/includes/acp/acp_permissions.php | 9 +- phpBB/includes/permissions.php | 263 ++++++++++++++++++++ phpBB/language/en/acp/permissions_phpbb.php | 16 +- 4 files changed, 280 insertions(+), 13 deletions(-) create mode 100644 phpBB/includes/permissions.php diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index c1579cfb57..9337fb0a5b 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -8,6 +8,11 @@ imports: - { resource: auth_providers.yml } services: + acl.permissions: + class: phpbb_permissions + arguments: + - @dispatcher + auth: class: phpbb_auth diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index a64765f4f5..9c5395c5b2 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -587,7 +587,10 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $user, $auth; + global $user, $auth, $phpbb_container; + + $permissions = $phpbb_container->get('acl.permissions'); + $permission_types = $permissions->get_types(); $s_dropdown_options = ''; foreach ($options as $setting) @@ -598,8 +601,8 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = (isset($user->lang['permission_type'][$permission_scope][$setting])) ? $user->lang['permission_type'][$permission_scope][$setting] : $user->lang['permission_type'][$setting]; - $s_dropdown_options .= ''; + $l_setting = (isset($permission_types[$permission_scope][$setting])) ? $permission_types[$permission_scope][$setting] : $permission_types[$setting]; + $s_dropdown_options .= ''; } return $s_dropdown_options; diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php new file mode 100644 index 0000000000..d5389344f7 --- /dev/null +++ b/phpBB/includes/permissions.php @@ -0,0 +1,263 @@ +dispatcher = $phpbb_dispatcher; + } + + public function get_categories() + { + $categories = $this->categories; + + /** + * Allows to specify additional permission categories + * + * @event core.permissions_get_categories + * @var array categories Array with permission categories (pm, post, settings, misc, etc.) + * @since 3.1-A1 + */ + $vars = array('categories'); + extract($this->dispatcher->trigger_event('core.permissions_get_categories', $vars)); + + return $categories; + } + + public function get_types() + { + $types = $this->types; + + /** + * Allows to specify additional permission types + * + * @event core.permissions_get_types + * @var array types Array with permission types (a_, u_, m_, etc.) + * @since 3.1-A1 + */ + $vars = array('types'); + extract($this->dispatcher->trigger_event('core.permissions_get_types', $vars)); + + return $types; + } + + public function get_permissions() + { + $permissions = $this->permissions; + + /** + * Allows to specify additional permissions + * + * @event core.permissions_get_types + * @var array permissions Array with permissions. Each Permission has the following layout: + * 'acl_' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier 'acl_' is used with + * // all uppercase. + * 'cat' => 'Identifier of the category, the permission should be displayed in', + * ), + * Example: + * 'acl_u_viewprofile' => array( + * 'lang' => 'ACL_U_VIEWPROFILE', + * 'cat' => 'profile', + * ), + * + * @since 3.1-A1 + */ + $vars = array('permissions'); + extract($this->dispatcher->trigger_event('core.permissions_get_permissions', $vars)); + + return $permissions; + } + + protected $types = array( + 'u_' => 'ACL_TYPE_USER', + 'a_' => 'ACL_TYPE_ADMIN', + 'm_' => 'ACL_TYPE_MODERATOR', + 'f_' => 'ACL_TYPE_FORUM', + 'global' => array( + 'm_' => 'ACL_TYPE_GLOBAL_MODERATOR', + ), + ); + + protected $categories = array( + 'actions' => 'Actions', + 'content' => 'Content', + 'forums' => 'Forums', + 'misc' => 'Misc', + 'permissions' => 'Permissions', + 'pm' => 'Private messages', + 'polls' => 'Polls', + 'post' => 'Post', + 'post_actions' => 'Post actions', + 'posting' => 'Posting', + 'profile' => 'Profile', + 'settings' => 'Settings', + 'topic_actions' => 'Topic actions', + 'user_group' => 'Users & Groups', + ); + + protected $permissions = array( + // User Permissions + 'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'), + 'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'), + 'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'), + 'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'), + 'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'), + 'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'), + 'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'), + + 'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'), + 'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'), + 'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'), + 'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'), + 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'), + + 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'), + 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'), + 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'), + 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'), + 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'), + 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'), + 'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'), + 'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'), + 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'), + 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'), + 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'), + 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'), + 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'), + 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'), + 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'), + + 'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'), + 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'), + 'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'), + 'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'), + 'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'), + 'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'), + + // Forum Permissions + 'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'), + 'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'), + 'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'), + 'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'), + 'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'), + 'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'), + 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'), + 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'), + 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'), + 'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'), + + 'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'), + 'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'), + 'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'), + 'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'), + 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'), + 'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'post'), + 'acl_f_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'post'), + 'acl_f_postcount' => array('lang' => 'Increment post counter
Please note that this setting only affects new posts.', 'cat' => 'post'), + 'acl_f_noapprove' => array('lang' => 'Can post without approval', 'cat' => 'post'), + + 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'), + 'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'), + 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'), + 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), + 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'), + 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'), + 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'), + + 'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'), + 'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'), + 'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'), + + // Moderator Permissions + 'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'), + 'acl_m_delete' => array('lang' => 'Can delete posts', 'cat' => 'post_actions'), + 'acl_m_approve' => array('lang' => 'Can approve posts', 'cat' => 'post_actions'), + 'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'), + 'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'), + + 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'), + 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'), + 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'), + 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), + + 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), + 'acl_m_warn' => array('lang' => 'Can issue warnings
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) + 'acl_m_ban' => array('lang' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) + + // Admin Permissions + 'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'), + 'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'), + 'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'), + 'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'), + + 'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'), + 'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'), + 'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'), + 'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'), + + 'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'), + 'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'), + 'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'), + 'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'), + + 'acl_a_user' => array('lang' => 'Can manage users
This also includes seeing the users browser agent within the viewonline list.', 'cat' => 'user_group'), + 'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'), + 'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'), + 'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'), + 'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'), + 'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'), + 'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'), + 'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'), + 'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'), + + 'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'), + 'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'), + 'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'), + 'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'), + 'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'), + 'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'), + 'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'), + 'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'), + 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'), + + 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'), + 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'), + 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'), + 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'), + 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'), + 'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'), + 'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'), + 'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'), + 'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'), + 'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'), + 'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'), + ); +} diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 98679ad544..70312261a1 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -82,16 +82,12 @@ $lang = array_merge($lang, array( 'user_group' => 'Users & Groups', ), - // With defining 'global' here we are able to specify what is printed out if the permission is within the global scope. - 'permission_type' => array( - 'u_' => 'User permissions', - 'a_' => 'Admin permissions', - 'm_' => 'Moderator permissions', - 'f_' => 'Forum permissions', - 'global' => array( - 'm_' => 'Global moderator permissions', - ), - ), + + 'ACL_TYPE_USER' => 'User permissions', + 'ACL_TYPE_ADMIN' => 'Admin permissions', + 'ACL_TYPE_MODERATOR' => 'Moderator permissions', + 'ACL_TYPE_FORUM' => 'Forum permissions', + 'ACL_TYPE_GLOBAL_MODERATOR' => 'Global moderator permissions', )); // User Permissions From e8d2a2fd8861e5ef2473aa670808dc6098aa1241 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Jun 2013 11:10:33 +0200 Subject: [PATCH 063/284] [ticket/11582] Use new class for categories PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 7 +++-- phpBB/includes/acp/auth.php | 16 +++++++---- phpBB/includes/permissions.php | 28 +++++++++---------- phpBB/language/en/acp/permissions_phpbb.php | 30 ++++++++++----------- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index e830479389..8a2798a90a 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -456,7 +456,10 @@ class acp_permission_roles */ function display_auth_options($auth_options) { - global $template, $user; + global $template, $user, $phpbb_container; + + $permissions = $phpbb_container->get('acl.permissions'); + $permission_categories = $permissions->get_categories(); $content_array = $categories = array(); $key_sort_array = array(0); @@ -473,7 +476,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $user->lang['permission_cat'][$cat], + 'CAT_NAME' => $user->lang($permission_categories[$cat]), 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 6b1da46a12..03cc0c1705 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1100,7 +1100,10 @@ class auth_admin extends phpbb_auth */ function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view) { - global $template, $user, $phpbb_admin_path, $phpEx; + global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; + + $permissions = $phpbb_container->get('acl.permissions'); + $permission_categories = $permissions->get_categories(); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1110,8 +1113,8 @@ class auth_admin extends phpbb_auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $user->lang['permission_cat'][$cat]) - ); + 'CAT_NAME' => $user->lang($permission_categories[$cat]), + )); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) * Commented out due to it's memory consumption and time needed @@ -1176,7 +1179,10 @@ class auth_admin extends phpbb_auth */ function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array) { - global $user; + global $user, $phpbb_container; + + $permissions = $phpbb_container->get('acl.permissions'); + $permission_categories = $permissions->get_categories(); foreach ($key_sort_array as $forum_id) { @@ -1204,7 +1210,7 @@ class auth_admin extends phpbb_auth // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $user->lang['permission_cat'][$cat]; + $categories[$cat] = $user->lang($permission_categories[$cat]); } // Build our content array diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index d5389344f7..1e2cf9e4aa 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -107,20 +107,20 @@ class phpbb_permissions ); protected $categories = array( - 'actions' => 'Actions', - 'content' => 'Content', - 'forums' => 'Forums', - 'misc' => 'Misc', - 'permissions' => 'Permissions', - 'pm' => 'Private messages', - 'polls' => 'Polls', - 'post' => 'Post', - 'post_actions' => 'Post actions', - 'posting' => 'Posting', - 'profile' => 'Profile', - 'settings' => 'Settings', - 'topic_actions' => 'Topic actions', - 'user_group' => 'Users & Groups', + 'actions' => 'ACL_CAT_ACTIONS', + 'content' => 'ACL_CAT_CONTENT', + 'forums' => 'ACL_CAT_FORUMS', + 'misc' => 'ACL_CAT_MISC', + 'permissions' => 'ACL_CAT_PERMISSIONS', + 'pm' => 'ACL_CAT_PM', + 'polls' => 'ACL_CAT_POLLS', + 'post' => 'ACL_CAT_POST', + 'post_actions' => 'ACL_CAT_POST_ACTIONS', + 'posting' => 'ACL_CAT_POSTING', + 'profile' => 'ACL_CAT_PROFILE', + 'settings' => 'ACL_CAT_SETTINGS', + 'topic_actions' => 'ACL_CAT_TOPIC_ACTIONS', + 'user_group' => 'ACL_CAT_USER_GROUP', ); protected $permissions = array( diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 70312261a1..0a669a4b8d 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -65,22 +65,20 @@ if (empty($lang) || !is_array($lang)) // Define categories and permission types $lang = array_merge($lang, array( - 'permission_cat' => array( - 'actions' => 'Actions', - 'content' => 'Content', - 'forums' => 'Forums', - 'misc' => 'Misc', - 'permissions' => 'Permissions', - 'pm' => 'Private messages', - 'polls' => 'Polls', - 'post' => 'Post', - 'post_actions' => 'Post actions', - 'posting' => 'Posting', - 'profile' => 'Profile', - 'settings' => 'Settings', - 'topic_actions' => 'Topic actions', - 'user_group' => 'Users & Groups', - ), + 'ACL_CAT_ACTIONS' => 'Actions', + 'ACL_CAT_CONTENT' => 'Content', + 'ACL_CAT_FORUMS' => 'Forums', + 'ACL_CAT_MISC' => 'Misc', + 'ACL_CAT_PERMISSIONS' => 'Permissions', + 'ACL_CAT_PM' => 'Private messages', + 'ACL_CAT_POLLS' => 'Polls', + 'ACL_CAT_POST' => 'Post', + 'ACL_CAT_POST_ACTIONS' => 'Post actions', + 'ACL_CAT_POSTING' => 'Posting', + 'ACL_CAT_PROFILE' => 'Profile', + 'ACL_CAT_SETTINGS' => 'Settings', + 'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions', + 'ACL_CAT_USER_GROUP' => 'Users & Groups', 'ACL_TYPE_USER' => 'User permissions', From 137cec58950ad547a204a47b1e84e46fdc29139c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Jun 2013 11:16:52 +0200 Subject: [PATCH 064/284] [ticket/11582] Fix event dispatcher class name PHPBB3-11582 --- phpBB/includes/permissions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index 1e2cf9e4aa..c338727fc0 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -19,16 +19,16 @@ class phpbb_permissions { /** * Event dispatcher object - * @var phpbb_dispatcher + * @var phpbb_event_dispatcher */ protected $dispatcher; /** * Constructor * - * @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher + * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher * @return null */ - public function __construct($phpbb_dispatcher) + public function __construct(phpbb_event_dispatcher $phpbb_dispatcher) { $this->dispatcher = $phpbb_dispatcher; } From 7f9a1c811647c00b20cfa4f5029f6b569597cb4b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Jun 2013 11:27:38 +0200 Subject: [PATCH 065/284] [ticket/11582] Add event in constructor and add docs PHPBB3-11582 --- phpBB/config/services.yml | 1 + phpBB/includes/permissions.php | 103 +++++++++++++++++++-------------- 2 files changed, 62 insertions(+), 42 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 9337fb0a5b..4110f8c456 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -12,6 +12,7 @@ services: class: phpbb_permissions arguments: - @dispatcher + - @user auth: class: phpbb_auth diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index c338727fc0..ddeadc825b 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -22,59 +22,35 @@ class phpbb_permissions * @var phpbb_event_dispatcher */ protected $dispatcher; + + /** + * User object + * @var phpbb_user + */ + protected $user; + /** * Constructor * * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher + * @param phpbb_user $user User Object * @return null */ - public function __construct(phpbb_event_dispatcher $phpbb_dispatcher) + public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user) { $this->dispatcher = $phpbb_dispatcher; - } + $this->user = $user; - public function get_categories() - { $categories = $this->categories; - - /** - * Allows to specify additional permission categories - * - * @event core.permissions_get_categories - * @var array categories Array with permission categories (pm, post, settings, misc, etc.) - * @since 3.1-A1 - */ - $vars = array('categories'); - extract($this->dispatcher->trigger_event('core.permissions_get_categories', $vars)); - - return $categories; - } - - public function get_types() - { $types = $this->types; - - /** - * Allows to specify additional permission types - * - * @event core.permissions_get_types - * @var array types Array with permission types (a_, u_, m_, etc.) - * @since 3.1-A1 - */ - $vars = array('types'); - extract($this->dispatcher->trigger_event('core.permissions_get_types', $vars)); - - return $types; - } - - public function get_permissions() - { $permissions = $this->permissions; /** - * Allows to specify additional permissions + * Allows to specify additional permission categories, types and permissions * - * @event core.permissions_get_types + * @event core.permissions + * @var array types Array with permission types (a_, u_, m_, etc.) + * @var array categories Array with permission categories (pm, post, settings, misc, etc.) * @var array permissions Array with permissions. Each Permission has the following layout: * 'acl_' => array( * 'lang' => 'Language Key with a Short description', // Optional, if not set, @@ -87,13 +63,56 @@ class phpbb_permissions * 'lang' => 'ACL_U_VIEWPROFILE', * 'cat' => 'profile', * ), - * * @since 3.1-A1 */ - $vars = array('permissions'); - extract($this->dispatcher->trigger_event('core.permissions_get_permissions', $vars)); + $vars = array('types', 'categories', 'permissions'); + extract($phpbb_dispatcher->trigger_event('core.permissions', $vars)); - return $permissions; + $this->categories = $categories; + $this->types = $types; + $this->permissions = $permissions; + } + + /** + * Returns an array with all the permission categories (pm, post, settings, misc, etc.) + * + * @return array Layout: cat-identifier => Language key + */ + public function get_categories() + { + return $this->categories; + } + + /** + * Returns an array with all the permission types (a_, u_, m_, etc.) + * + * @return array Layout: type-identifier => Language key + */ + public function get_types() + { + return $this->types; + } + + /** + * Returns an array with all the permissions. + * Each Permission has the following layout: + * 'acl_' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier 'acl_' is used with + * // all uppercase. + * 'cat' => 'Identifier of the category, the permission should be displayed in', + * ), + * Example: + * 'acl_u_viewprofile' => array( + * 'lang' => 'ACL_U_VIEWPROFILE', + * 'cat' => 'profile', + * ), + * + * @return array + */ + public function get_permissions() + { + return $this->permissions; } protected $types = array( From ce0a182c7fcd0c67020a44109440cd807bee2e82 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Jun 2013 11:40:00 +0200 Subject: [PATCH 066/284] [ticket/11582] Add methods to return the language string PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 3 +-- phpBB/includes/acp/acp_permissions.php | 7 +++-- phpBB/includes/acp/auth.php | 6 ++--- phpBB/includes/permissions.php | 29 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 8a2798a90a..2a00301543 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -459,7 +459,6 @@ class acp_permission_roles global $template, $user, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); $content_array = $categories = array(); $key_sort_array = array(0); @@ -476,7 +475,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $user->lang($permission_categories[$cat]), + 'CAT_NAME' => $permissions->get_lang_category($cat), 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 9c5395c5b2..13e0f1c535 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -587,10 +587,9 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $user, $auth, $phpbb_container; + global $auth, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_types = $permissions->get_types(); $s_dropdown_options = ''; foreach ($options as $setting) @@ -601,8 +600,8 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = (isset($permission_types[$permission_scope][$setting])) ? $permission_types[$permission_scope][$setting] : $permission_types[$setting]; - $s_dropdown_options .= ''; + $l_setting = $permissions->get_lang_type($setting, $permission_scope); + $s_dropdown_options .= ''; } return $s_dropdown_options; diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 03cc0c1705..7a7ccc0c50 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1103,7 +1103,6 @@ class auth_admin extends phpbb_auth global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1113,7 +1112,7 @@ class auth_admin extends phpbb_auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $user->lang($permission_categories[$cat]), + 'CAT_NAME' => $permissions->get_lang_category($cat), )); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) @@ -1182,7 +1181,6 @@ class auth_admin extends phpbb_auth global $user, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); foreach ($key_sort_array as $forum_id) { @@ -1210,7 +1208,7 @@ class auth_admin extends phpbb_auth // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $user->lang($permission_categories[$cat]); + $categories[$cat] = $permissions->get_lang_category($cat); } // Build our content array diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index ddeadc825b..f3b2ab5da0 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -83,6 +83,16 @@ class phpbb_permissions return $this->categories; } + /** + * Returns the language string of a permission category + * + * @return array Language string + */ + public function get_lang_category($category) + { + return $this->user->lang($this->categories[$category]); + } + /** * Returns an array with all the permission types (a_, u_, m_, etc.) * @@ -93,6 +103,25 @@ class phpbb_permissions return $this->types; } + /** + * Returns the language string of a permission type + * + * @return array Language string + */ + public function get_lang_type($type, $scope = false) + { + if ($scope && isset($this->types[$scope][$type])) + { + $lang_key = $this->types[$scope][$type]; + } + else + { + $lang_key = $this->types[$type]; + } + + return $this->user->lang($lang_key); + } + /** * Returns an array with all the permissions. * Each Permission has the following layout: From 9c653341e4d747302bdde1273fd71199ca3b40ef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 13:37:59 +0200 Subject: [PATCH 067/284] [ticket/11582] Use new methods and remove duplicated entries PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 12 +++--- phpBB/includes/acp/acp_permissions.php | 9 +++-- phpBB/includes/acp/auth.php | 13 +++--- phpBB/includes/permissions.php | 44 ++++++++++++++++----- phpBB/language/en/acp/permissions_phpbb.php | 8 ---- 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 2a00301543..f7c0494a0b 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -306,6 +306,9 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } + global $phpbb_container; + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + $template->assign_vars(array( 'S_EDIT' => true, @@ -314,9 +317,8 @@ class acp_permission_roles 'ROLE_NAME' => $role_row['role_name'], 'ROLE_DESCRIPTION' => $role_row['role_description'], - 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], - ) - ); + 'L_ACL_TYPE' => $phpbb_permissions->get_type_lang($permission_type), + )); // We need to fill the auth options array with ACL_NO options ;) $sql = 'SELECT auth_option_id, auth_option @@ -458,7 +460,7 @@ class acp_permission_roles { global $template, $user, $phpbb_container; - $permissions = $phpbb_container->get('acl.permissions'); + $phpbb_permissions = $phpbb_container->get('acl.permissions'); $content_array = $categories = array(); $key_sort_array = array(0); @@ -475,7 +477,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $permissions->get_lang_category($cat), + 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat), 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 13e0f1c535..17c6561b65 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -510,9 +510,12 @@ class acp_permissions trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } + global $phpbb_container; + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + $template->assign_vars(array( 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, - 'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], + 'L_PERMISSION_TYPE' => $phpbb_permissions->get_type_lang($permission_type), 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields) @@ -589,7 +592,7 @@ class acp_permissions { global $auth, $phpbb_container; - $permissions = $phpbb_container->get('acl.permissions'); + $phpbb_permissions = $phpbb_container->get('acl.permissions'); $s_dropdown_options = ''; foreach ($options as $setting) @@ -600,7 +603,7 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = $permissions->get_lang_type($setting, $permission_scope); + $l_setting = $phpbb_permissions->get_type_lang($setting, $permission_scope); $s_dropdown_options .= ''; } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 7a7ccc0c50..630deb991e 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -261,7 +261,8 @@ class auth_admin extends phpbb_auth */ function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true) { - global $template, $user, $db, $phpbb_root_path, $phpEx; + global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container; + $phpbb_permissions = $phpbb_container->get('acl.permissions'); // Define names for template loops, might be able to be set $tpl_pmask = 'p_mask'; @@ -269,7 +270,7 @@ class auth_admin extends phpbb_auth $tpl_category = 'category'; $tpl_mask = 'mask'; - $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type); + $l_acl_type = $phpbb_permissions->get_type_lang($permission_type, (($local) ? 'local' : 'global')); // Allow trace for viewing permissions and in user mode $show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false; @@ -1102,7 +1103,7 @@ class auth_admin extends phpbb_auth { global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; - $permissions = $phpbb_container->get('acl.permissions'); + $phpbb_permissions = $phpbb_container->get('acl.permissions'); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1112,7 +1113,7 @@ class auth_admin extends phpbb_auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $permissions->get_lang_category($cat), + 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat), )); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) @@ -1180,7 +1181,7 @@ class auth_admin extends phpbb_auth { global $user, $phpbb_container; - $permissions = $phpbb_container->get('acl.permissions'); + $phpbb_permissions = $phpbb_container->get('acl.permissions'); foreach ($key_sort_array as $forum_id) { @@ -1208,7 +1209,7 @@ class auth_admin extends phpbb_auth // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $permissions->get_lang_category($cat); + $categories[$cat] = $phpbb_permissions->get_category_lang($cat); } // Build our content array diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index f3b2ab5da0..368fd7bc5f 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -86,9 +86,9 @@ class phpbb_permissions /** * Returns the language string of a permission category * - * @return array Language string + * @return string Language string */ - public function get_lang_category($category) + public function get_category_lang($category) { return $this->user->lang($this->categories[$category]); } @@ -106,18 +106,22 @@ class phpbb_permissions /** * Returns the language string of a permission type * - * @return array Language string + * @return string Language string */ - public function get_lang_type($type, $scope = false) + public function get_type_lang($type, $scope = false) { if ($scope && isset($this->types[$scope][$type])) { $lang_key = $this->types[$scope][$type]; } - else + else if (isset($this->types[$type])) { $lang_key = $this->types[$type]; } + else + { + $lang_key = 'ACL_TYPE_' . strtoupper(($scope) ? $scope . '_' . $type : $type); + } return $this->user->lang($lang_key); } @@ -144,13 +148,33 @@ class phpbb_permissions return $this->permissions; } + /** + * Returns the category of a permission + * + * @return string + */ + public function get_permission_category($permission) + { + return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc'; + } + + /** + * Returns the language string of a permission + * + * @return string Language string + */ + public function get_permission_lang($permission) + { + return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); + } + protected $types = array( - 'u_' => 'ACL_TYPE_USER', - 'a_' => 'ACL_TYPE_ADMIN', - 'm_' => 'ACL_TYPE_MODERATOR', - 'f_' => 'ACL_TYPE_FORUM', + 'u_' => 'ACL_TYPE_U_', + 'a_' => 'ACL_TYPE_A_', + 'm_' => 'ACL_TYPE_M_', + 'f_' => 'ACL_TYPE_F_', 'global' => array( - 'm_' => 'ACL_TYPE_GLOBAL_MODERATOR', + 'm_' => 'ACL_TYPE_GLOBAL_M_', ), ); diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 0a669a4b8d..4f2c9067d2 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -63,7 +63,6 @@ if (empty($lang) || !is_array($lang)) * */ -// Define categories and permission types $lang = array_merge($lang, array( 'ACL_CAT_ACTIONS' => 'Actions', 'ACL_CAT_CONTENT' => 'Content', @@ -79,13 +78,6 @@ $lang = array_merge($lang, array( 'ACL_CAT_SETTINGS' => 'Settings', 'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions', 'ACL_CAT_USER_GROUP' => 'Users & Groups', - - - 'ACL_TYPE_USER' => 'User permissions', - 'ACL_TYPE_ADMIN' => 'Admin permissions', - 'ACL_TYPE_MODERATOR' => 'Moderator permissions', - 'ACL_TYPE_FORUM' => 'Forum permissions', - 'ACL_TYPE_GLOBAL_MODERATOR' => 'Global moderator permissions', )); // User Permissions From 22ba3de1a2902b09cb00748664ad2bf328f37734 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 13:52:09 +0200 Subject: [PATCH 068/284] [ticket/11582] Use member isntead of a new variable everytime PHPBB3-11582 --- phpBB/includes/acp/acp_permissions.php | 20 +++++++++----------- phpBB/includes/permissions.php | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 17c6561b65..ed7159996a 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -22,15 +22,18 @@ class acp_permissions { var $u_action; var $permission_dropdown; + protected $permissions; function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + $this->permissions = $phpbb_container->get('acl.permissions'); + $auth_admin = new auth_admin(); $user->add_lang('acp/permissions'); @@ -49,7 +52,7 @@ class acp_permissions if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) { - $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']); + $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission)); $this->permission_trace($user_id, $forum_id, $permission); return; } @@ -510,12 +513,9 @@ class acp_permissions trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } - global $phpbb_container; - $phpbb_permissions = $phpbb_container->get('acl.permissions'); - $template->assign_vars(array( 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, - 'L_PERMISSION_TYPE' => $phpbb_permissions->get_type_lang($permission_type), + 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields) @@ -590,9 +590,7 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $auth, $phpbb_container; - - $phpbb_permissions = $phpbb_container->get('acl.permissions'); + global $auth; $s_dropdown_options = ''; foreach ($options as $setting) @@ -603,7 +601,7 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = $phpbb_permissions->get_type_lang($setting, $permission_scope); + $l_setting = $this->permissions->get_type_lang($setting, $permission_scope); $s_dropdown_options .= ''; } @@ -984,7 +982,7 @@ class acp_permissions $back = request_var('back', 0); $template->assign_vars(array( - 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], + 'PERMISSION' => $this->permissions->get_permission_lang($permission), 'PERMISSION_USERNAME' => $userdata['username'], 'FORUM_NAME' => $forum_name, diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index 368fd7bc5f..a450b12aed 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -165,7 +165,7 @@ class phpbb_permissions */ public function get_permission_lang($permission) { - return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); + return (isset($this->permissions['acl_' . $permission]['lang'])) ? $this->user->lang($this->permissions['acl_' . $permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); } protected $types = array( From aadff800dcadfdb21f3188feba754f0e93669781 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 13:57:58 +0200 Subject: [PATCH 069/284] [ticket/11582] Remove left over calls to lang['acl_*'] PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 2 +- phpBB/includes/acp/auth.php | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index f7c0494a0b..7c972c74ba 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -492,7 +492,7 @@ class acp_permission_roles 'S_NO' => ($allowed == ACL_NO) ? true : false, 'FIELD_NAME' => $permission, - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission) ); } } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 630deb991e..4ade9cab13 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1148,8 +1148,8 @@ class auth_admin extends phpbb_auth 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } else { @@ -1166,8 +1166,8 @@ class auth_admin extends phpbb_auth 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } } } @@ -1196,15 +1196,7 @@ class auth_admin extends phpbb_auth @reset($permissions); while (list($permission, $auth_setting) = each($permissions)) { - if (!isset($user->lang['acl_' . $permission])) - { - $user->lang['acl_' . $permission] = array( - 'cat' => 'misc', - 'lang' => '{ acl_' . $permission . ' }' - ); - } - - $cat = $user->lang['acl_' . $permission]['cat']; + $cat = $phpbb_permissions->get_permission_category($permission); // Build our categories array if (!isset($categories[$cat])) From 0e86c0247381b141cba53b6ab3fbdba276c521e3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 15:55:25 +0200 Subject: [PATCH 070/284] [ticket/11582] Split permission language strings from logic PHPBB3-11582 --- phpBB/includes/permissions.php | 230 ++++++++++---------- phpBB/language/en/acp/permissions_phpbb.php | 229 ++++++++++--------- 2 files changed, 224 insertions(+), 235 deletions(-) diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index a450b12aed..4cb3356c53 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -197,139 +197,139 @@ class phpbb_permissions protected $permissions = array( // User Permissions - 'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'), - 'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'), - 'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'), - 'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'), - 'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'), - 'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'), - 'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'), + 'acl_u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'), + 'acl_u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'), + 'acl_u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'), + 'acl_u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'), + 'acl_u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'), + 'acl_u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'), + 'acl_u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'), - 'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'), - 'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'), - 'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'), - 'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'), - 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'), + 'acl_u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'), + 'acl_u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'), + 'acl_u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'), + 'acl_u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'), + 'acl_u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'), - 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'), - 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'), - 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'), - 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'), - 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'), - 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'), - 'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'), - 'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'), - 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'), - 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'), - 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'), - 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'), - 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'), - 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'), - 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'), + 'acl_u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'), + 'acl_u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'), + 'acl_u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'), + 'acl_u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'), + 'acl_u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'), + 'acl_u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'), + 'acl_u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'), + 'acl_u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'), + 'acl_u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'), + 'acl_u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'), + 'acl_u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'), + 'acl_u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'), + 'acl_u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'), + 'acl_u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'), + 'acl_u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'), - 'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'), - 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'), - 'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'), - 'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'), - 'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'), - 'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'), + 'acl_u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'), + 'acl_u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'), + 'acl_u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'), + 'acl_u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'), + 'acl_u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'), + 'acl_u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'), // Forum Permissions - 'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'), - 'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'), - 'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'), - 'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'), - 'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'), - 'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'), - 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'), - 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'), - 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'), - 'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'), + 'acl_f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), + 'acl_f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), + 'acl_f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), + 'acl_f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), + 'acl_f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), + 'acl_f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), + 'acl_f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'), + 'acl_f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'), + 'acl_f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), + 'acl_f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'), - 'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'), - 'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'), - 'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'), - 'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'), - 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'), - 'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'post'), - 'acl_f_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'post'), - 'acl_f_postcount' => array('lang' => 'Increment post counter
Please note that this setting only affects new posts.', 'cat' => 'post'), - 'acl_f_noapprove' => array('lang' => 'Can post without approval', 'cat' => 'post'), + 'acl_f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), + 'acl_f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'), + 'acl_f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'), + 'acl_f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'), + 'acl_f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'), + 'acl_f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), + 'acl_f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'), + 'acl_f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'), + 'acl_f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), - 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'), - 'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'), - 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'), - 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), - 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'), - 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'), - 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'), + 'acl_f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), + 'acl_f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'), + 'acl_f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), + 'acl_f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'), + 'acl_f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'), + 'acl_f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'), + 'acl_f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'), - 'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'), - 'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'), - 'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'), + 'acl_f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'), + 'acl_f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'), + 'acl_f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'), // Moderator Permissions - 'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'), - 'acl_m_delete' => array('lang' => 'Can delete posts', 'cat' => 'post_actions'), - 'acl_m_approve' => array('lang' => 'Can approve posts', 'cat' => 'post_actions'), - 'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'), - 'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'), + 'acl_m_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'), + 'acl_m_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'), + 'acl_m_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'), + 'acl_m_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'), + 'acl_m_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'), - 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'), - 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'), - 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'), - 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), + 'acl_m_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), + 'acl_m_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), + 'acl_m_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), + 'acl_m_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), - 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), - 'acl_m_warn' => array('lang' => 'Can issue warnings
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) - 'acl_m_ban' => array('lang' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) + 'acl_m_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'), + 'acl_m_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'acl_m_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), // Admin Permissions - 'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'), - 'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'), - 'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'), - 'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'), + 'acl_a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'), + 'acl_a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'), + 'acl_a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'), + 'acl_a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'), - 'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'), - 'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'), - 'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'), - 'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'), + 'acl_a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'), + 'acl_a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'), + 'acl_a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'), + 'acl_a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'), - 'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'), - 'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'), - 'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'), - 'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'), + 'acl_a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'), + 'acl_a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'), + 'acl_a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'), + 'acl_a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'), - 'acl_a_user' => array('lang' => 'Can manage users
This also includes seeing the users browser agent within the viewonline list.', 'cat' => 'user_group'), - 'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'), - 'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'), - 'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'), - 'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'), - 'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'), - 'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'), - 'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'), - 'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'), + 'acl_a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'), + 'acl_a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'), + 'acl_a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'), + 'acl_a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'), + 'acl_a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'), + 'acl_a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'), + 'acl_a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'), + 'acl_a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'), + 'acl_a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'), - 'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'), - 'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'), - 'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'), - 'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'), - 'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'), - 'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'), - 'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'), - 'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'), - 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'), + 'acl_a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'), + 'acl_a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'), + 'acl_a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'), + 'acl_a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'), + 'acl_a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'), + 'acl_a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'), + 'acl_a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'), + 'acl_a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'), + 'acl_a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'), - 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'), - 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'), - 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'), - 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'), - 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'), - 'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'), - 'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'), - 'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'), - 'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'), - 'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'), - 'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'), + 'acl_a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'), + 'acl_a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'), + 'acl_a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'), + 'acl_a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'), + 'acl_a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'), + 'acl_a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'), + 'acl_a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'), + 'acl_a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'), + 'acl_a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'), + 'acl_a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'), + 'acl_a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'), ); } diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 4f2c9067d2..edcc812830 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -56,8 +56,8 @@ if (empty($lang) || !is_array($lang)) * * // Adding the permissions * $lang = array_merge($lang, array( -* 'acl_bug_view' => array('lang' => 'Can view bug reports', 'cat' => 'bugs'), -* 'acl_bug_post' => array('lang' => 'Can post bugs', 'cat' => 'post'), // Using a phpBB category here +* 'acl_bug_view' => 'Can view bug reports', 'cat' => 'bugs'), +* 'acl_bug_post' => 'Can post bugs', // Using a phpBB category here * )); * * @@ -82,146 +82,135 @@ $lang = array_merge($lang, array( // User Permissions $lang = array_merge($lang, array( - 'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'), - 'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'), - 'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'), - 'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'), - 'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'), - 'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'), - 'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'), + 'ACL_U_VIEWPROFILE' => 'Can view profiles, memberlist and online list', + 'ACL_U_CHGNAME' => 'Can change username', + 'ACL_U_CHGPASSWD' => 'Can change password', + 'ACL_U_CHGEMAIL' => 'Can change email address', + 'ACL_U_CHGAVATAR' => 'Can change avatar', + 'ACL_U_CHGGRP' => 'Can change default usergroup', + 'ACL_U_CHGPROFILEINFO' => 'Can change profile field information', - 'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'), - 'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'), - 'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'), - 'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'), - 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'), + 'ACL_U_ATTACH' => 'Can attach files', + 'ACL_U_DOWNLOAD' => 'Can download files', + 'ACL_U_SAVEDRAFTS' => 'Can save drafts', + 'ACL_U_CHGCENSORS' => 'Can disable word censors', + 'ACL_U_SIG' => 'Can use signature', - 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'), - 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'), - 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'), - 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'), - 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'), - 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'), - 'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'), - 'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'), - 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'), - 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'), - 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'), - 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'), - 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'), - 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'), - 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'), + 'ACL_U_SENDPM' => 'Can send private messages', + 'ACL_U_MASSPM' => 'Can send messages to multiple users', + 'ACL_U_MASSPM_GROUP'=> 'Can send messages to groups', + 'ACL_U_READPM' => 'Can read private messages', + 'ACL_U_PM_EDIT' => 'Can edit own private messages', + 'ACL_U_PM_DELETE' => 'Can remove private messages from own folder', + 'ACL_U_PM_FORWARD' => 'Can forward private messages', + 'ACL_U_PM_EMAILPM' => 'Can email private messages', + 'ACL_U_PM_PRINTPM' => 'Can print private messages', + 'ACL_U_PM_ATTACH' => 'Can attach files in private messages', + 'ACL_U_PM_DOWNLOAD' => 'Can download files in private messages', + 'ACL_U_PM_BBCODE' => 'Can use BBCode in private messages', + 'ACL_U_PM_SMILIES' => 'Can use smilies in private messages', + 'ACL_U_PM_IMG' => 'Can use [img] BBCode tag in private messages', + 'ACL_U_PM_FLASH' => 'Can use [flash] BBCode tag in private messages', - 'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'), - 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'), - 'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'), - 'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'), - 'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'), - 'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'), + 'ACL_U_SENDEMAIL' => 'Can send emails', + 'ACL_U_SENDIM' => 'Can send instant messages', + 'ACL_U_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_U_HIDEONLINE' => 'Can hide online status', + 'ACL_U_VIEWONLINE' => 'Can view hidden online users', + 'ACL_U_SEARCH' => 'Can search board', )); // Forum Permissions $lang = array_merge($lang, array( - 'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'), - 'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'), - 'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'), - 'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'), - 'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'), - 'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'), - 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'), - 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'), - 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'), - 'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'), + 'ACL_F_POST' => 'Can start new topics', + 'ACL_F_STICKY' => 'Can post stickies', + 'ACL_F_ANNOUNCE' => 'Can post announcements', + 'ACL_F_REPLY' => 'Can reply to topics', + 'ACL_F_EDIT' => 'Can edit own posts', + 'ACL_F_DELETE' => 'Can permanently delete own posts', + 'ACL_F_SOFTDELETE' => 'Can soft delete own posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_F_POSTCOUNT' => 'Increment post counter
Please note that this setting only affects new posts.', + 'ACL_F_NOAPPROVE' => 'Can post without approval', - 'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'), - 'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'), - 'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'), - 'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'), - 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'), - 'acl_f_delete' => array('lang' => 'Can permanently delete own posts', 'cat' => 'post'), - 'acl_f_softdelete' => array('lang' => 'Can soft delete own posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', 'cat' => 'post'), - 'acl_f_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'post'), - 'acl_f_postcount' => array('lang' => 'Increment post counter
Please note that this setting only affects new posts.', 'cat' => 'post'), - 'acl_f_noapprove' => array('lang' => 'Can post without approval', 'cat' => 'post'), + 'ACL_F_ATTACH' => 'Can attach files', + 'ACL_F_ICONS' => 'Can use topic/post icons', + 'ACL_F_BBCODE' => 'Can use BBCode', + 'ACL_F_FLASH' => 'Can use [flash] BBCode tag', + 'ACL_F_IMG' => 'Can use [img] BBCode tag', + 'ACL_F_SIGS' => 'Can use signatures', + 'ACL_F_SMILIES' => 'Can use smilies', - 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'), - 'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'), - 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'), - 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), - 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'), - 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'), - 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'), - - 'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'), - 'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'), - 'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'), + 'ACL_F_POLL' => 'Can create polls', + 'ACL_F_VOTE' => 'Can vote in polls', + 'ACL_F_VOTECHG' => 'Can change existing vote', )); // Moderator Permissions $lang = array_merge($lang, array( - 'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'), - 'acl_m_delete' => array('lang' => 'Can permanently delete posts', 'cat' => 'post_actions'), - 'acl_m_softdelete' => array('lang' => 'Can soft delete posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', 'cat' => 'post_actions'), - 'acl_m_approve' => array('lang' => 'Can approve and restore posts', 'cat' => 'post_actions'), - 'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'), - 'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'), + 'ACL_M_EDIT' => 'Can edit posts', + 'ACL_M_DELETE' => 'Can permanently delete posts', + 'ACL_M_SOFTDELETE' => 'Can soft delete posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_M_APPROVE' => 'Can approve posts', + 'ACL_M_REPORT' => 'Can close and delete reports', + 'ACL_M_CHGPOSTER' => 'Can change post author', - 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'), - 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'), - 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'), - 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), + 'ACL_M_MOVE' => 'Can move topics', + 'ACL_M_LOCK' => 'Can lock topics', + 'ACL_M_SPLIT' => 'Can split topics', + 'ACL_M_MERGE' => 'Can merge topics', - 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), - 'acl_m_warn' => array('lang' => 'Can issue warnings
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) - 'acl_m_ban' => array('lang' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) + 'ACL_M_INFO' => 'Can view post details', + 'ACL_M_WARN' => 'Can issue warnings
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) + 'ACL_M_BAN' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) )); // Admin Permissions $lang = array_merge($lang, array( - 'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'), - 'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'), - 'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'), - 'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'), + 'ACL_A_BOARD' => 'Can alter board settings/check for updates', + 'ACL_A_SERVER' => 'Can alter server/communication settings', + 'ACL_A_JABBER' => 'Can alter Jabber settings', + 'ACL_A_PHPINFO' => 'Can view php settings', - 'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'), - 'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'), - 'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'), - 'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'), + 'ACL_A_FORUM' => 'Can manage forums', + 'ACL_A_FORUMADD' => 'Can add new forums', + 'ACL_A_FORUMDEL' => 'Can delete forums', + 'ACL_A_PRUNE' => 'Can prune forums', - 'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'), - 'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'), - 'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'), - 'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'), + 'ACL_A_ICONS' => 'Can alter topic/post icons and smilies', + 'ACL_A_WORDS' => 'Can alter word censors', + 'ACL_A_BBCODE' => 'Can define BBCode tags', + 'ACL_A_ATTACH' => 'Can alter attachment related settings', - 'acl_a_user' => array('lang' => 'Can manage users
This also includes seeing the users browser agent within the viewonline list.', 'cat' => 'user_group'), - 'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'), - 'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'), - 'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'), - 'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'), - 'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'), - 'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'), - 'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'), - 'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'), + 'ACL_A_USER' => 'Can manage users
This also includes seeing the users browser agent within the viewonline list.', + 'ACL_A_USERDEL' => 'Can delete/prune users', + 'ACL_A_GROUP' => 'Can manage groups', + 'ACL_A_GROUPADD' => 'Can add new groups', + 'ACL_A_GROUPDEL' => 'Can delete groups', + 'ACL_A_RANKS' => 'Can manage ranks', + 'ACL_A_PROFILE' => 'Can manage custom profile fields', + 'ACL_A_NAMES' => 'Can manage disallowed names', + 'ACL_A_BAN' => 'Can manage bans', - 'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'), - 'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'), - 'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'), - 'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'), - 'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'), - 'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'), - 'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'), - 'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'), - 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'), + 'ACL_A_VIEWAUTH' => 'Can view permission masks', + 'ACL_A_AUTHGROUPS' => 'Can alter permissions for individual groups', + 'ACL_A_AUTHUSERS' => 'Can alter permissions for individual users', + 'ACL_A_FAUTH' => 'Can alter forum permission class', + 'ACL_A_MAUTH' => 'Can alter moderator permission class', + 'ACL_A_AAUTH' => 'Can alter admin permission class', + 'ACL_A_UAUTH' => 'Can alter user permission class', + 'ACL_A_ROLES' => 'Can manage roles', + 'ACL_A_SWITCHPERM' => 'Can use others permissions', - 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'), - 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'), - 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'), - 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'), - 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'), - 'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'), - 'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'), - 'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'), - 'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'), - 'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'), - 'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'), + 'ACL_A_STYLES' => 'Can manage styles', + 'ACL_A_EXTENSIONS' => 'Can manage extensions', + 'ACL_A_VIEWLOGS' => 'Can view logs', + 'ACL_A_CLEARLOGS' => 'Can clear logs', + 'ACL_A_MODULES' => 'Can manage modules', + 'ACL_A_LANGUAGE' => 'Can manage language packs', + 'ACL_A_EMAIL' => 'Can send mass email', + 'ACL_A_BOTS' => 'Can manage bots', + 'ACL_A_REASONS' => 'Can manage report/denial reasons', + 'ACL_A_BACKUP' => 'Can backup/restore database', + 'ACL_A_SEARCH' => 'Can manage search backends and settings', )); From 4a64e2c2b3d4b39cdedec72551076595a9cd6a6e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 16:07:05 +0200 Subject: [PATCH 071/284] [ticket/11582] Fix documentation for adding permissions PHPBB3-11582 --- phpBB/language/en/acp/permissions_phpbb.php | 34 +++++---------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index edcc812830..d0128db34a 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -33,34 +33,14 @@ if (empty($lang) || !is_array($lang)) // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine /** -* MODDERS PLEASE NOTE +* EXTENSION-DEVELOPERS PLEASE NOTE * -* You are able to put your permission sets into a separate file too by -* prefixing the new file with permissions_ and putting it into the acp -* language folder. -* -* An example of how the file could look like: -* -* -* -* if (empty($lang) || !is_array($lang)) -* { -* $lang = array(); -* } -* -* // Adding new category -* $lang['permission_cat']['bugs'] = 'Bugs'; -* -* // Adding new permission set -* $lang['permission_type']['bug_'] = 'Bug Permissions'; -* -* // Adding the permissions -* $lang = array_merge($lang, array( -* 'acl_bug_view' => 'Can view bug reports', 'cat' => 'bugs'), -* 'acl_bug_post' => 'Can post bugs', // Using a phpBB category here -* )); -* -* +* You are able to put your permission sets into your extension. +* The permissions logic should be added via the 'core.permissions' event. +* You can easily add new permission categories, types and permissions, by +* simply merging them into the respective arrays. +* The respective language strings should be added into a language file, that +* start with 'permissions_', so they are automatically loaded within the ACP. */ $lang = array_merge($lang, array( From aaa44eda2b1df7d7c5c02651c1a9536343eca846 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Jul 2013 00:48:26 +0200 Subject: [PATCH 072/284] [ticket/11582] Remove useless prefix PHPBB3-11582 --- phpBB/includes/permissions.php | 244 ++++++++++++++++----------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index 4cb3356c53..1db6843dbb 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -52,14 +52,14 @@ class phpbb_permissions * @var array types Array with permission types (a_, u_, m_, etc.) * @var array categories Array with permission categories (pm, post, settings, misc, etc.) * @var array permissions Array with permissions. Each Permission has the following layout: - * 'acl_' => array( + * '' => array( * 'lang' => 'Language Key with a Short description', // Optional, if not set, - * // the permissions identifier 'acl_' is used with + * // the permissions identifier '' is used with * // all uppercase. * 'cat' => 'Identifier of the category, the permission should be displayed in', * ), * Example: - * 'acl_u_viewprofile' => array( + * 'u_viewprofile' => array( * 'lang' => 'ACL_U_VIEWPROFILE', * 'cat' => 'profile', * ), @@ -129,14 +129,14 @@ class phpbb_permissions /** * Returns an array with all the permissions. * Each Permission has the following layout: - * 'acl_' => array( + * '' => array( * 'lang' => 'Language Key with a Short description', // Optional, if not set, - * // the permissions identifier 'acl_' is used with + * // the permissions identifier '' is used with * // all uppercase. * 'cat' => 'Identifier of the category, the permission should be displayed in', * ), * Example: - * 'acl_u_viewprofile' => array( + * 'u_viewprofile' => array( * 'lang' => 'ACL_U_VIEWPROFILE', * 'cat' => 'profile', * ), @@ -165,7 +165,7 @@ class phpbb_permissions */ public function get_permission_lang($permission) { - return (isset($this->permissions['acl_' . $permission]['lang'])) ? $this->user->lang($this->permissions['acl_' . $permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); + return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); } protected $types = array( @@ -197,139 +197,139 @@ class phpbb_permissions protected $permissions = array( // User Permissions - 'acl_u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'), - 'acl_u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'), - 'acl_u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'), - 'acl_u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'), - 'acl_u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'), - 'acl_u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'), - 'acl_u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'), + 'u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'), + 'u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'), + 'u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'), + 'u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'), + 'u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'), + 'u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'), + 'u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'), - 'acl_u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'), - 'acl_u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'), - 'acl_u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'), - 'acl_u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'), - 'acl_u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'), + 'u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'), + 'u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'), + 'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'), + 'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'), + 'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'), - 'acl_u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'), - 'acl_u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'), - 'acl_u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'), - 'acl_u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'), - 'acl_u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'), - 'acl_u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'), - 'acl_u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'), - 'acl_u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'), - 'acl_u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'), - 'acl_u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'), - 'acl_u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'), - 'acl_u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'), - 'acl_u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'), - 'acl_u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'), - 'acl_u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'), + 'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'), + 'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'), + 'u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'), + 'u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'), + 'u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'), + 'u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'), + 'u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'), + 'u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'), + 'u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'), + 'u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'), + 'u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'), + 'u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'), + 'u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'), + 'u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'), + 'u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'), - 'acl_u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'), - 'acl_u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'), - 'acl_u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'), - 'acl_u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'), - 'acl_u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'), - 'acl_u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'), + 'u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'), + 'u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'), + 'u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'), + 'u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'), + 'u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'), + 'u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'), // Forum Permissions - 'acl_f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), - 'acl_f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), - 'acl_f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), - 'acl_f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), - 'acl_f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), - 'acl_f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), - 'acl_f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'), - 'acl_f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'), - 'acl_f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), - 'acl_f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'), + 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), + 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), + 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), + 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), + 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), + 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), + 'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'), + 'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'), + 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), + 'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'), - 'acl_f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), - 'acl_f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'), - 'acl_f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'), - 'acl_f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'), - 'acl_f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'), - 'acl_f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), - 'acl_f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'), - 'acl_f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'), - 'acl_f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), + 'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), + 'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'), + 'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'), + 'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'), + 'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'), + 'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), + 'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'), + 'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'), + 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), - 'acl_f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), - 'acl_f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'), - 'acl_f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), - 'acl_f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'), - 'acl_f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'), - 'acl_f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'), - 'acl_f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'), + 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), + 'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'), + 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), + 'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'), + 'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'), + 'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'), + 'f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'), - 'acl_f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'), - 'acl_f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'), - 'acl_f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'), + 'f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'), + 'f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'), + 'f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'), // Moderator Permissions - 'acl_m_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'), - 'acl_m_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'), - 'acl_m_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'), - 'acl_m_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'), - 'acl_m_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'), + 'm_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'), + 'm_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'), + 'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'), + 'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'), + 'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'), - 'acl_m_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), - 'acl_m_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), - 'acl_m_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), - 'acl_m_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), + 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), + 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), + 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), + 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), - 'acl_m_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'), - 'acl_m_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), - 'acl_m_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), + 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'), + 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), // Admin Permissions - 'acl_a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'), - 'acl_a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'), - 'acl_a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'), - 'acl_a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'), + 'a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'), + 'a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'), + 'a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'), + 'a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'), - 'acl_a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'), - 'acl_a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'), - 'acl_a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'), - 'acl_a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'), + 'a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'), + 'a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'), + 'a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'), + 'a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'), - 'acl_a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'), - 'acl_a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'), - 'acl_a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'), - 'acl_a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'), + 'a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'), + 'a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'), + 'a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'), + 'a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'), - 'acl_a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'), - 'acl_a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'), - 'acl_a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'), - 'acl_a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'), - 'acl_a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'), - 'acl_a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'), - 'acl_a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'), - 'acl_a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'), - 'acl_a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'), + 'a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'), + 'a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'), + 'a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'), + 'a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'), + 'a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'), + 'a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'), + 'a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'), + 'a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'), + 'a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'), - 'acl_a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'), - 'acl_a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'), - 'acl_a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'), - 'acl_a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'), - 'acl_a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'), - 'acl_a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'), - 'acl_a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'), - 'acl_a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'), - 'acl_a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'), + 'a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'), + 'a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'), + 'a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'), + 'a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'), + 'a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'), + 'a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'), + 'a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'), + 'a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'), + 'a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'), - 'acl_a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'), - 'acl_a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'), - 'acl_a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'), - 'acl_a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'), - 'acl_a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'), - 'acl_a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'), - 'acl_a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'), - 'acl_a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'), - 'acl_a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'), - 'acl_a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'), - 'acl_a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'), + 'a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'), + 'a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'), + 'a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'), + 'a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'), + 'a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'), + 'a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'), + 'a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'), + 'a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'), + 'a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'), + 'a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'), + 'a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'), ); } From 4b7b7e895b4a0949d19a7524bedddfa969a33ee7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Jul 2013 16:44:24 +0200 Subject: [PATCH 073/284] [ticket/11582] Fix missing @params in the doc blocks PHPBB3-11582 --- phpBB/includes/permissions.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index 1db6843dbb..66360424ea 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -86,7 +86,8 @@ class phpbb_permissions /** * Returns the language string of a permission category * - * @return string Language string + * @param string $category Identifier of the category + * @return string Language string */ public function get_category_lang($category) { @@ -106,6 +107,8 @@ class phpbb_permissions /** * Returns the language string of a permission type * + * @param string $type Identifier of the type + * @param mixed $scope Scope of the type (should be 'global', 'local' or false) * @return string Language string */ public function get_type_lang($type, $scope = false) @@ -151,7 +154,8 @@ class phpbb_permissions /** * Returns the category of a permission * - * @return string + * @param string $permission Identifier of the permission + * @return string Returns the category identifier of the permission */ public function get_permission_category($permission) { @@ -161,6 +165,7 @@ class phpbb_permissions /** * Returns the language string of a permission * + * @param string $permission Identifier of the permission * @return string Language string */ public function get_permission_lang($permission) From 060754fd6ce998caf8b8e182f53a1464e16e9deb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 12 Jul 2013 00:05:48 -0400 Subject: [PATCH 074/284] [ticket/11582] Fix missing closing bracket PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 7c972c74ba..5657cbe675 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -492,8 +492,8 @@ class acp_permission_roles 'S_NO' => ($allowed == ACL_NO) ? true : false, 'FIELD_NAME' => $permission, - 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } } } From cfb13bb5476dfa7895f984405d6a0c40ddcda08e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 13 Jul 2013 23:31:13 -0400 Subject: [PATCH 075/284] [ticket/11582] Fix extension permission tests PHPBB3-11582 --- .../ext/foo/bar/event/permission_listener.php | 40 +++++++++++++++++++ .../foo/bar/language/en/permissions_foo.php | 3 +- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tests/functional/fixtures/ext/foo/bar/event/permission_listener.php diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php new file mode 100644 index 0000000000..dfabf7c540 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php @@ -0,0 +1,40 @@ + 'add_permissions', + ); + } + + public function add_permissions($event) + { + $permissions = $event['permissions']; + $permissions['u_foo'] = array('lang' => 'ACL_U_FOO', 'cat' => 'misc'), + $event['permissions'] = $permissions; + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php index cd4b9a32d1..36c84c5209 100644 --- a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php +++ b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php @@ -1,6 +1,5 @@ array('lang' => 'Can view foo', 'cat' => 'misc'), + 'ACL_U_FOO' => 'Can view foo', )); From 9c72bbe284514c1aa70f8ac65e9dfcafb72d36dd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 12:04:04 -0400 Subject: [PATCH 076/284] [ticket/11582] Move file to new directory PHPBB3-11582 --- phpBB/{includes => phpbb}/permissions.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpBB/{includes => phpbb}/permissions.php (100%) diff --git a/phpBB/includes/permissions.php b/phpBB/phpbb/permissions.php similarity index 100% rename from phpBB/includes/permissions.php rename to phpBB/phpbb/permissions.php From 81e0859041cd181c142a87a5fc78640f92aa5ce0 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 14 Jul 2013 12:11:57 -0400 Subject: [PATCH 077/284] [ticket/11688] Purge TWIG cache Purge directories Replace opendir() with DirectoryIterator PHPBB3-11688 --- phpBB/phpbb/cache/driver/file.php | 67 +++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 85decbe3e8..7f8c646a11 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -205,28 +205,36 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base function purge() { // Purge all phpbb cache files - $dir = @opendir($this->cache_dir); - - if (!$dir) + try + { + $iterator = new DirectoryIterator($this->cache_dir); + } + catch (Exception $e) { return; } - while (($entry = readdir($dir)) !== false) + foreach ($iterator as $fileInfo) { - if (strpos($entry, 'container_') !== 0 && - strpos($entry, 'url_matcher') !== 0 && - strpos($entry, 'sql_') !== 0 && - strpos($entry, 'data_') !== 0 && - strpos($entry, 'ctpl_') !== 0 && - strpos($entry, 'tpl_') !== 0) + if ($fileInfo->isDot()) { continue; } - - $this->remove_file($this->cache_dir . $entry); + $filename = $fileInfo->getFilename(); + if ($fileInfo->isDir()) + { + $this->purge_dir($fileInfo->getPathname()); + } + elseif (strpos($filename, 'container_') === 0 || + strpos($filename, 'url_matcher') === 0 || + strpos($filename, 'sql_') === 0 || + strpos($filename, 'data_') === 0 || + strpos($filename, 'ctpl_') === 0 || + strpos($filename, 'tpl_') === 0) + { + $this->remove_file($fileInfo->getPathname()); + } } - closedir($dir); unset($this->vars); unset($this->var_expires); @@ -241,6 +249,39 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base $this->is_modified = false; } + /** + * Remove directory + */ + protected function purge_dir($dir) + { + try + { + $iterator = new DirectoryIterator($dir); + } + catch (Exception $e) + { + return; + } + + foreach ($iterator as $fileInfo) + { + if ($fileInfo->isDot()) + { + continue; + } + if ($fileInfo->isDir()) + { + $this->purge_dir($fileInfo->getPathname()); + } + else + { + $this->remove_file($fileInfo->getPathname()); + } + } + + @rmdir($dir); + } + /** * Destroy cache data */ From e4a5ce307d49c215b08e35a79147ba2418f133ff Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 12:55:03 -0400 Subject: [PATCH 078/284] [ticket/11582] Test the event and and fix it. PHPBB3-11582 --- phpBB/phpbb/permissions.php | 2 +- tests/functional/extension_permission_lang_test.php | 2 +- .../fixtures/ext/foo/bar/event/permission_listener.php | 2 +- .../fixtures/ext/foo/bar/language/en/permissions_foo.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index 66360424ea..0fbacdad8a 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -66,7 +66,7 @@ class phpbb_permissions * @since 3.1-A1 */ $vars = array('types', 'categories', 'permissions'); - extract($phpbb_dispatcher->trigger_event('core.permissions', $vars)); + extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars))); $this->categories = $categories; $this->types = $types; diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 6c1720735c..badbdbb057 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -75,6 +75,6 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t $this->assertContains('Can attach files', $crawler->filter('body')->text()); // language from ext/foo/bar/language/en/permissions_foo.php - $this->assertContains('Can view foo', $crawler->filter('body')->text()); + $this->assertContains('Can view foobar', $crawler->filter('body')->text()); } } diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php index dfabf7c540..39cb9f8b46 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php @@ -34,7 +34,7 @@ class phpbb_ext_foo_bar_event_permission_listener implements EventSubscriberInte public function add_permissions($event) { $permissions = $event['permissions']; - $permissions['u_foo'] = array('lang' => 'ACL_U_FOO', 'cat' => 'misc'), + $permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post'), $event['permissions'] = $permissions; } } diff --git a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php index 36c84c5209..64b497c394 100644 --- a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php +++ b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php @@ -1,5 +1,5 @@ 'Can view foo', + 'ACL_U_FOOBAR' => 'Can view foobar with permission foo', )); From a68aed51190e10535d364db056de97098cd56019 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 14 Jul 2013 13:20:41 -0400 Subject: [PATCH 079/284] [ticket/11688] tpl_ files are no longer used Remove tpl_ and ctpl_ from cache->purge() because those prefixes are no longer used. PHPBB3-11688 --- phpBB/phpbb/cache/driver/file.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 7f8c646a11..19596f5205 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -228,9 +228,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base elseif (strpos($filename, 'container_') === 0 || strpos($filename, 'url_matcher') === 0 || strpos($filename, 'sql_') === 0 || - strpos($filename, 'data_') === 0 || - strpos($filename, 'ctpl_') === 0 || - strpos($filename, 'tpl_') === 0) + strpos($filename, 'data_') === 0) { $this->remove_file($fileInfo->getPathname()); } From a9a6305d939467dd7e3a003a4c52f408c93f8c8c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 13:20:58 -0400 Subject: [PATCH 080/284] [ticket/11582] Fix little typo PHPBB3-11582 --- .../fixtures/ext/foo/bar/event/permission_listener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php index 39cb9f8b46..6986755f71 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php @@ -34,7 +34,7 @@ class phpbb_ext_foo_bar_event_permission_listener implements EventSubscriberInte public function add_permissions($event) { $permissions = $event['permissions']; - $permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post'), + $permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post'); $event['permissions'] = $permissions; } } From 2a41128e6be929bf6bc3135ba738e1889a0640a9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 14 Jul 2013 19:48:41 +0200 Subject: [PATCH 081/284] [ticket/11704] Correctly escape " PHPBB3-11704 --- build/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.xml b/build/build.xml index a418f40b53..cee8160eff 100644 --- a/build/build.xml +++ b/build/build.xml @@ -171,7 +171,7 @@ From da1ee75140608220b13908c74f5157033689db8c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 14 Jul 2013 19:48:55 +0200 Subject: [PATCH 082/284] [ticket/11704] Use the correct directory for dependency checking. PHPBB3-11704 --- build/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.xml b/build/build.xml index cee8160eff..bb88bd3cfa 100644 --- a/build/build.xml +++ b/build/build.xml @@ -170,7 +170,7 @@ checkreturn="true" /> - From a0e5f833113221493540376b9b73718f7a517595 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 14 Jul 2013 15:13:09 -0400 Subject: [PATCH 083/284] [ticket/11706] Use @ to suppress errors for getimagesize in remote avatar PHPBB3-11706 --- phpBB/phpbb/avatar/driver/remote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 7da58107a1..d629a490fd 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -93,7 +93,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver // Make sure getimagesize works... if (function_exists('getimagesize')) { - if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false)) + if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false)) { $error[] = 'UNABLE_GET_IMAGE_SIZE'; return false; From 8928240dc3fefd42d8e98132451e2de92ff7cbec Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 14 Jul 2013 15:40:09 -0400 Subject: [PATCH 084/284] [ticket/11574] Fix more issues in the updater * Stupid mistake in phpbb_create_update_container * Do not bootstrap extensions in installer/updater * Fix template lookup in installer/updater * Do not attempt to delete posts from bots The latter is a really fun problem. Since deleting posts now depends on a new db column that does not exist yet, we cannot call delete_post from a migration, ever. By using retain, we can hack around the issue for now. PHPBB3-11574 --- phpBB/includes/functions_container.php | 12 ++++++------ phpBB/install/index.php | 6 +++++- phpBB/install/install_update.php | 12 ------------ phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php | 2 +- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index 5c6bd6dd8a..7cbfa17a0e 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -148,9 +148,11 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) */ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) { + $config_file = $phpbb_root_path . 'config.' . $php_ext; return phpbb_create_compiled_container( + $config_file, array( - new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext), + new phpbb_di_extension_config($config_file), new phpbb_di_extension_core($config_path), ), array( @@ -173,11 +175,6 @@ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) */ function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) { - $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); - - // Now pass the enabled extension paths into the ext compiler extension - $extensions[] = new phpbb_di_extension_ext($installed_exts); - // Create the final container to be compiled and cached $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); @@ -258,11 +255,14 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi function phpbb_create_default_container($phpbb_root_path, $php_ext) { $config_file = $phpbb_root_path . 'config.' . $php_ext; + $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); + return phpbb_create_dumped_container_unless_debug( $config_file, array( new phpbb_di_extension_config($config_file), new phpbb_di_extension_core($phpbb_root_path . 'config'), + new phpbb_di_extension_ext($installed_exts), ), array( new phpbb_di_pass_collection_pass(), diff --git a/phpBB/install/index.php b/phpBB/install/index.php index ada1f43905..fe61c53558 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -249,7 +249,11 @@ $phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + +$paths = array($phpbb_admin_path . 'style', $phpbb_root_path . 'install/update/new/adm/style'); +$paths = array_filter($paths, 'is_dir'); +$phpbb_style->set_custom_style('admin', $paths, array(), ''); + $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index f9dfaaef50..478cc9f76f 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -222,12 +222,6 @@ class install_update extends module if ($this->test_update === false) { - // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present - if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files'])) - { - $this->tpl_name = '../../install/update/new/adm/style/install_update'; - } - // What about the language file? Got it updated? if (in_array('language/en/install.' . $phpEx, $this->update_info['files'])) { @@ -1068,12 +1062,6 @@ class install_update extends module $this->tpl_name = 'install_update_diff'; - // Got the diff template itself updated? If so, we are able to directly use it - if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files'])) - { - $this->tpl_name = '../../install/update/new/adm/style/install_update_diff'; - } - $this->page_title = 'VIEWING_FILE_DIFF'; $status = request_var('status', ''); diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php index 6a31a51201..a89a409dfd 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php @@ -108,7 +108,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration WHERE user_id = $bot_user_id"; $this->sql_query($sql); - user_delete('remove', $bot_user_id); + user_delete('retain', $bot_user_id); } else { From f96f2a9e23b41106c6a8ed71ad3538141c648c2f Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 15 Jul 2013 20:06:54 +0100 Subject: [PATCH 085/284] [ticket/11639] generate_text_for_display on functions_posting.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index b9b518ad32..d277ef06a3 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1104,14 +1104,12 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $decoded_message = bbcode_nl2br($decoded_message); } - - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); + + unset($parse_flags); if (!empty($attachments[$row['post_id']])) { From dde9a1fb27e6db3c1b4cd41d8848496a3ef8d363 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 15 Jul 2013 20:08:17 +0100 Subject: [PATCH 086/284] [ticket/11639] Added an useful comment. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index d277ef06a3..49fbe92256 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1104,9 +1104,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $decoded_message = bbcode_nl2br($decoded_message); } + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); - + // Do not censor text because it has already been censored before $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); unset($parse_flags); From 5f19ca6a6f3ad6641954c58c44ef0c94d1609e5a Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 15 Jul 2013 20:09:59 +0100 Subject: [PATCH 087/284] [ticket/11639] Whitespace fixing sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 49fbe92256..ad75ed1079 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1104,12 +1104,12 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $decoded_message = bbcode_nl2br($decoded_message); } - + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); // Do not censor text because it has already been censored before $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); - + unset($parse_flags); if (!empty($attachments[$row['post_id']])) From 0759b606c25a6ae38ab4c7eb35ebcc2b01e3f5eb Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 16 Jul 2013 20:11:28 +0300 Subject: [PATCH 088/284] [ticket/11708] Fix bulletin points in notifications PHPBB3-11708 --- phpBB/styles/prosilver/theme/common.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e58386de45..a2b8034187 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -758,6 +758,10 @@ p.rules a { clear: both; } +#notification_list ul li:before, #notification_list ul li:after { + display: none; +} + #notification_list > .header { padding: 0 10px; font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif; From 792c730f15ef61d444dcdbcee91831ec89366a88 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 16 Jul 2013 20:11:58 +0200 Subject: [PATCH 089/284] [ticket/10931] Add phpbb_php_ini as a service. PHPBB3-10931 --- phpBB/config/services.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index c1579cfb57..6d30a154e2 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -239,6 +239,9 @@ services: - %tables.notifications% - %tables.user_notifications% + php_ini: + class: phpbb_php_ini + request: class: phpbb_request From fc6bed28566590c26fab5845a6b94cf9b795e4da Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 16 Jul 2013 20:25:08 +0100 Subject: [PATCH 090/284] [ticket/11640] generate_text_for_display on functions_privmsgs.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11640 --- phpBB/includes/functions_privmsgs.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 14278a2529..001cf7bba0 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2018,14 +2018,12 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = bbcode_nl2br($decoded_message); } - - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); + unset($parse_flags); $subject = censor_text($subject); From e1e8d4ed347cb1707ee4cfca8d05e679b575fe0c Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 16 Jul 2013 21:01:47 +0100 Subject: [PATCH 091/284] [ticket/11641] generate_text_for_display on mcp/mcp_pm_reports.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11641 --- phpBB/includes/mcp/mcp_pm_reports.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 99ff397a66..dc953aae33 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -115,17 +115,8 @@ class mcp_pm_reports } // Process message, leave it uncensored - $message = $pm_info['message_text']; + $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); - if ($pm_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($pm_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) From e7bf3abd1ac79fabab7da925e55bd884aee0663d Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 16 Jul 2013 21:15:59 +0100 Subject: [PATCH 092/284] [ticket/11642] generate_text_for_display on mcp/mcp_post.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11642 --- phpBB/includes/mcp/mcp_post.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 520c964228..235b2a44be 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -125,17 +125,7 @@ function mcp_post_details($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($post_info['message_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From 596e9bb69df2f5d0c07c0b8201cc770bbe5253a0 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 16 Jul 2013 21:20:22 +0100 Subject: [PATCH 093/284] [ticket/11643] generate_text_for_display on mcp/mcp_queue.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11643 --- phpBB/includes/mcp/mcp_queue.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 24afa1f210..14490343c2 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -132,17 +132,7 @@ class mcp_queue $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($post_info['message_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From d183431894b85ca2ebc778ccb8fd52ecf91082fb Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 16 Jul 2013 21:28:06 +0100 Subject: [PATCH 094/284] [ticket/11653] generate_text_for_display on mcp/mcp_topic.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11653 --- phpBB/includes/mcp/mcp_topic.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index e3dd5a6b57..3491f37bcb 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -213,13 +213,7 @@ function mcp_topic_view($id, $mode, $action) $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); if (!empty($attachments[$row['post_id']])) { From d6a747fbd0f80e9f2c93f09aab6a0a89ec5afd26 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 17 Jul 2013 17:27:15 +0200 Subject: [PATCH 095/284] [ticket/11582] Correctly add all required fixtures PHPBB3-11582 --- tests/functional/extension_permission_lang_test.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index badbdbb057..19adb89819 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -18,6 +18,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t static protected $fixtures = array( 'foo/bar/language/en/', + 'foo/bar/event/', ); static public function setUpBeforeClass() From 96989e536dd5fc603f3598fa7a2a50414331d76c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 17 Jul 2013 23:55:20 +0200 Subject: [PATCH 096/284] [ticket/11531] Use abstract class for avatar tests and unify test cases PHPBB3-11531 --- tests/functional/avatar_acp_groups_test.php | 152 ++++++++++++ tests/functional/avatar_acp_test.php | 139 ----------- tests/functional/avatar_acp_users_test.php | 152 ++++++++++++ tests/functional/avatar_test.php | 246 -------------------- tests/functional/avatar_ucp_groups_test.php | 151 ++++++++++++ tests/functional/avatar_ucp_users_test.php | 151 ++++++++++++ tests/functional/common_avatar_test.php | 80 +++++++ 7 files changed, 686 insertions(+), 385 deletions(-) create mode 100644 tests/functional/avatar_acp_groups_test.php delete mode 100644 tests/functional/avatar_acp_test.php create mode 100644 tests/functional/avatar_acp_users_test.php delete mode 100644 tests/functional/avatar_test.php create mode 100644 tests/functional/avatar_ucp_groups_test.php create mode 100644 tests/functional/avatar_ucp_users_test.php create mode 100644 tests/functional/common_avatar_test.php diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php new file mode 100644 index 0000000000..62b7409bdb --- /dev/null +++ b/tests/functional/avatar_acp_groups_test.php @@ -0,0 +1,152 @@ + 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Gravatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 120, + 'avatar_gravatar_height' => 120, + ), + ), + // Incorrect email supplied for gravatar + array( + 'EMAIL_INVALID_EMAIL', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test.example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Upload image from remote + array( + 'GROUP_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ), + ), + // Incorrect URL + array( + 'AVATAR_URL_INVALID', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', + ), + ), + /* + // Does not work due to DomCrawler issue + // Valid file upload + array( + 'GROUP_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), + ), + ), + */ + // Correct remote avatar + array( + 'GROUP_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // Remote avatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 120, + 'avatar_remote_height' => 120, + ), + ), + // Wrong driver selected + array( + 'NO_AVATAR_SELECTED', + 'avatar_driver_upload', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist, remote avatar currently does + // not check if file exists if size is specified + array( + 'GROUP_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist and remote avatar errors when + // trying to get the image size + array( + 'UNABLE_GET_IMAGE_SIZE', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => '', + 'avatar_remote_height' => '', + ), + ), + // Delete avatar image to reset group settings + array( + 'GROUP_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_acp_groups_data + */ + public function test_avatar_acp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_acp_test.php b/tests/functional/avatar_acp_test.php deleted file mode 100644 index 609ccbb477..0000000000 --- a/tests/functional/avatar_acp_test.php +++ /dev/null @@ -1,139 +0,0 @@ -path = __DIR__ . '/fixtures/files/'; - $this->login(); - $this->admin_login(); - $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); - } - - public function test_acp_settings() - { - $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - // Check the default entries we should have - $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); - $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); - $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); - $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); - - // Now start setting the needed settings - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['config[allow_avatar_local]']->select(1); - $form['config[allow_avatar_gravatar]']->select(1); - $form['config[allow_avatar_remote]']->select(1); - $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = self::submit($form); - $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); - } - - public function test_user_acp_settings() - { - $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - - // Select "Avatar" in the drop-down menu - $form = $crawler->selectButton($this->lang('GO'))->form(); - $form['mode']->select('avatar'); - $crawler = self::submit($form); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - - // Test if setting a gravatar avatar properly works - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test@example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - - // Select "Avatar" in the drop-down menu - $form = $crawler->selectButton($this->lang('GO'))->form(); - $form['mode']->select('avatar'); - $crawler = self::submit($form); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - - // Test uploading a remote avatar - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and default size = 80px - $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = self::submit($form); - $this->assertContainsLang('USER_AVATAR_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'adm/index.php?i=users&u=2&sid=' . $this->sid); - - // Select "Avatar" in the drop-down menu - $form = $crawler->selectButton($this->lang('GO'))->form(); - $form['mode']->select('avatar'); - $crawler = self::submit($form); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - - // Submit gravatar with incorrect email and correct size - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test.example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); - } - - public function test_group_acp_settings() - { - // Test setting group avatar of admin group - $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - - // Test if setting a gravatar avatar properly works - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test@example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - - // Test uploading a remote avatar - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and default size = 80px - $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = self::submit($form); - $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - - // Submit gravatar with incorrect email and correct size - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test.example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); - } -} diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php new file mode 100644 index 0000000000..38ebcc8940 --- /dev/null +++ b/tests/functional/avatar_acp_users_test.php @@ -0,0 +1,152 @@ + 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Gravatar with incorrect sizes + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 120, + 'avatar_gravatar_height' => 120, + ), + ), + // Gravatar with incorrect email + array( + 'EMAIL_INVALID_EMAIL', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test.example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Remote avatar with correct link + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ), + ), + // Incorrect URL + array( + 'AVATAR_URL_INVALID', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', + ), + ), + /* + // Does not work due to DomCrawler issue + // Valid file upload + array( + 'PROFILE_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), + ), + ), + */ + // Correct remote avatar + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // Remote avatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 120, + 'avatar_remote_height' => 120, + ), + ), + // Wrong driver selected + array( + 'NO_AVATAR_SELECTED', + 'avatar_driver_upload', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist, remote avatar currently does + // not check if file exists if size is specified + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist and remote avatar errors when + // trying to get the image size + array( + 'UNABLE_GET_IMAGE_SIZE', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => '', + 'avatar_remote_height' => '', + ), + ), + // Reset avatar settings + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_acp_users_data + */ + public function test_avatar_acp_users($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_test.php b/tests/functional/avatar_test.php deleted file mode 100644 index c96ed46d30..0000000000 --- a/tests/functional/avatar_test.php +++ /dev/null @@ -1,246 +0,0 @@ -path = __DIR__ . '/fixtures/files/'; - $this->login(); - $this->admin_login(); - $this->add_lang(array('acp/board', 'ucp', 'acp/groups')); - } - - public function test_acp_settings() - { - $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - // Check the default entries we should have - $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); - $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); - $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); - $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); - - // Now start setting the needed settings - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['config[allow_avatar_local]']->select(1); - $form['config[allow_avatar_gravatar]']->select(1); - $form['config[allow_avatar_remote]']->select(1); - $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = self::submit($form); - $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); - } - - public function test_gravatar_avatar() - { - // Get ACP settings - $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $this->form_content = $form->getValues(); - - // Check if required form elements exist - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - $this->assertContainsLang('AVATAR_DRIVER_GRAVATAR_TITLE', $crawler->filter('#avatar_driver')->text()); - $this->assertContainsLang('GRAVATAR_AVATAR_EMAIL', $crawler->text()); - - // Submit gravatar with correct email and correct size - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test@example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); - - // Submit gravatar with correct mail but incorrect size - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test@example.com'); - $form['avatar_gravatar_width']->setValue(120); - $form['avatar_gravatar_height']->setValue(120); - $crawler = self::submit($form); - $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], - $this->form_content['config[avatar_min_width]'], - $this->form_content['config[avatar_min_height]'], - $this->form_content['config[avatar_max_width]'], - $this->form_content['config[avatar_max_height]'], - '120', - '120' - ), $crawler->text()); - - // Submit gravatar with incorrect email and correct size - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test.example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); - } - - public function test_upload_avatar() - { - // Check if required form elements exist - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assertContainsLang('AVATAR_DRIVER_UPLOAD_TITLE', $crawler->filter('#avatar_driver')->text()); - $this->assertContainsLang('UPLOAD_AVATAR_FILE', $crawler->text()); - $this->assertContainsLang('UPLOAD_AVATAR_URL', $crawler->text()); - - // Upload remote avatar with correct size and correct link - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and default size = 80px - $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = self::submit($form); - $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); - - // This will fail as the upload avatar currently expects a file that ends with an extension, e.g. .jpg - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and size (s) = 80px - $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80'); - $crawler = self::submit($form); - $this->assertContainsLang('AVATAR_URL_INVALID', $crawler->text()); - - // Submit gravatar with correct email and correct size - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->markTestIncomplete('Test fails due to bug in DomCrawler with Symfony < 2.2: https://github.com/symfony/symfony/issues/4674.'); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - $form['avatar_upload_file']->setValue($this->path . 'valid.jpg'); - $crawler = self::submit($form); - $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); - } - - public function test_remote_avatar() - { - // Get ACP settings - $crawler = $this->request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $this->form_content = $form->getValues(); - - // Check if required form elements exist - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->assertContainsLang('AVATAR_DRIVER_REMOTE_TITLE', $crawler->filter('#avatar_driver')->text()); - $this->assertContainsLang('LINK_REMOTE_AVATAR', $crawler->text()); - $this->assertContainsLang('LINK_REMOTE_SIZE', $crawler->text()); - - // Set remote avatar with correct size and correct link - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_remote'); - // use default gravatar supplied by test@example.com and default size = 80px - $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $form['avatar_remote_width']->setValue(80); - $form['avatar_remote_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('PROFILE_UPDATED', $crawler->text()); - - // Set remote avatar with incorrect size - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_remote'); - // use default gravatar supplied by test@example.com and size (s) = 80px - $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $form['avatar_remote_width']->setValue(120); - $form['avatar_remote_height']->setValue(120); - $crawler = self::submit($form); - $this->assertContains(sprintf($this->lang['AVATAR_WRONG_SIZE'], - $this->form_content['config[avatar_min_width]'], - $this->form_content['config[avatar_min_height]'], - $this->form_content['config[avatar_max_width]'], - $this->form_content['config[avatar_max_height]'], - '120', - '120' - ), $crawler->text()); - - // Enter correct data in form entries but select incorrect avatar driver - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and size (s) = 80px - $form['avatar_remote_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $form['avatar_remote_width']->setValue(80); - $form['avatar_remote_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); - - /* - * Enter incorrect link to a remote avatar_driver - * Due to the fact that this link to phpbb.com will not serve a 404 error but rather a 404 page, - * the remote avatar will think that this is a properly working avatar. This Bug also exists in - * the current phpBB 3.0.11 release. - */ - $crawler = $this->request('GET', 'ucp.php?i=ucp_profile&mode=avatar&sid=' . $this->sid); - $this->markTestIncomplete('Test currently fails because the remote avatar does not seem to check if it is an image'); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_remote'); - // use random incorrect link to phpBB.com - $form['avatar_remote_url']->setValue('https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $form['avatar_remote_width']->setValue(80); - $form['avatar_remote_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('NO_AVATAR_SELECTED', $crawler->text()); - } - - - public function test_group_ucp_settings() - { - // Test setting group avatar of admin group - $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $this->assertContainsLang('AVATAR_TYPE', $crawler->text()); - - // Test if setting a gravatar avatar properly works - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test@example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - - // Test uploading a remote avatar - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_upload'); - // use default gravatar supplied by test@example.com and default size = 80px - $form['avatar_upload_url']->setValue('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg'); - $crawler = self::submit($form); - $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); - - // Go back to previous page - $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - - // Submit gravatar with incorrect email and correct size - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->select('avatar_driver_gravatar'); - $form['avatar_gravatar_email']->setValue('test.example.com'); - $form['avatar_gravatar_width']->setValue(80); - $form['avatar_gravatar_height']->setValue(80); - $crawler = self::submit($form); - $this->assertContainsLang('EMAIL_INVALID_EMAIL', $crawler->text()); - - // Delete avatar - $crawler = $this->request('GET', 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_delete']->tick(); - $crawler = self::submit($form); - $this->assertContainsLang('GROUP_UPDATED', $crawler->text()); - } -} diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php new file mode 100644 index 0000000000..bd34f67491 --- /dev/null +++ b/tests/functional/avatar_ucp_groups_test.php @@ -0,0 +1,151 @@ + 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Gravatar with incorrect sizing + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 120, + 'avatar_gravatar_height' => 120, + ), + ), + // Gravatar with incorrect email address + array( + 'EMAIL_INVALID_EMAIL', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test.example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Correct remote upload avatar + array( + 'GROUP_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ), + ), + // Incorrect URL + array( + 'AVATAR_URL_INVALID', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', + ), + ), + /* + // Does not work due to DomCrawler issue + // Valid file upload + array( + 'GROUP_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), + ), + ), + */ + // Correct remote avatar + array( + 'GROUP_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // Remote avatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 120, + 'avatar_remote_height' => 120, + ), + ), + // Wrong driver selected + array( + 'NO_AVATAR_SELECTED', + 'avatar_driver_upload', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist, remote avatar currently does + // not check if file exists if size is specified + array( + 'GROUP_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist and remote avatar errors when + // trying to get the image size + array( + 'UNABLE_GET_IMAGE_SIZE', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => '', + 'avatar_remote_height' => '', + ), + ), + array( + 'GROUP_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_ucp_groups_data + */ + public function test_avatar_ucp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php new file mode 100644 index 0000000000..6b2c2344b3 --- /dev/null +++ b/tests/functional/avatar_ucp_users_test.php @@ -0,0 +1,151 @@ + 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Gravatar with incorrect sizing + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 120, + 'avatar_gravatar_height' => 120, + ), + ), + // Gravatar with incorrect email address + array( + 'EMAIL_INVALID_EMAIL', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test.example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Correct remote upload avatar + array( + 'PROFILE_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ), + ), + // Incorrect URL + array( + 'AVATAR_URL_INVALID', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', + ), + ), + /* + // Does not work due to DomCrawler issue + // Valid file upload + array( + 'PROFILE_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), + ), + ), + */ + // Correct remote avatar + array( + 'PROFILE_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // Remote avatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 120, + 'avatar_remote_height' => 120, + ), + ), + // Wrong driver selected + array( + 'NO_AVATAR_SELECTED', + 'avatar_driver_upload', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist, remote avatar currently does + // not check if file exists if size is specified + array( + 'PROFILE_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + // File does not exist and remote avatar errors when + // trying to get the image size + array( + 'UNABLE_GET_IMAGE_SIZE', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => '', + 'avatar_remote_height' => '', + ), + ), + array( + 'PROFILE_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_ucp_groups_data + */ + public function test_avatar_ucp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php new file mode 100644 index 0000000000..c0f21d07c2 --- /dev/null +++ b/tests/functional/common_avatar_test.php @@ -0,0 +1,80 @@ +path = __DIR__ . '/fixtures/files/'; + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); + $this->set_acp_settings(); + } + + private function set_acp_settings() + { + $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + // Check the default entries we should have + $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); + $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); + $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); + $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_gravatar]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = self::submit($form); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); + } + + public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT') + { + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang($button_text))->form(); + $form['avatar_driver']->select($type); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $form[$key]->$value[0]($value[1]); + } + else + { + $form[$key]->setValue($value); + } + } + + $crawler = self::submit($form); + + try + { + $this->assertContainsLang($expected, $crawler->text()); + } + catch (Exception $e) + { + $this->assertContains($expected, $crawler->text()); + } + } +} From 16b411616575cdd4023fb42bb77b56e43db735e0 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 18 Jul 2013 16:15:36 +0100 Subject: [PATCH 097/284] [ticket/11654] generate_text_for_display on mcp/mcp_warn.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11654 --- phpBB/includes/mcp/mcp_warn.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 4ef477775d..d0fcd8a77d 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -289,19 +289,7 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = censor_text($user_row['post_text']); - - // Second parse bbcode here - if ($user_row['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - - $bbcode = new bbcode($user_row['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], ($user_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) From d05c04ae40326768e35464d42e3bd9e51b140155 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 18 Jul 2013 19:10:36 +0300 Subject: [PATCH 098/284] [ticket/11712] Fixing typo in editor.js PHPBB3-11712 --- phpBB/styles/prosilver/template/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 235cc0025b..4c70ee345f 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -301,7 +301,7 @@ function colorPalette(dir, width, height) { var r = 0, g = 0, b = 0, - numberList = new Array(6); + numberList = new Array(6), color = '', html = ''; From f421c082f73b26f5578d14af7cdbfefd013f554a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 18 Jul 2013 22:41:23 +0200 Subject: [PATCH 099/284] [ticket/11713] Do not remove module if it couldn't be deleted Up to now, the module or module category was always removed with jQuery, even if there was an error. With this change, the modules will not be deleted by jQuery if the return JSON array will have SUCCESS set to false. PHPBB3-11713 --- phpBB/adm/style/ajax.js | 6 ++++-- phpBB/includes/acp/acp_modules.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 6f21dfa6ac..efb0639f1b 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -127,8 +127,10 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) { * The removes the parent row of the link or form that triggered the callback, * and is good for stuff like the removal of forums. */ -phpbb.addAjaxCallback('row_delete', function() { - $(this).parents('tr').remove(); +phpbb.addAjaxCallback('row_delete', function(res) { + if (res.SUCCESS !== false) { + $(this).parents('tr').remove(); + } }); diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index a1e681b29c..7a1d30196d 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -379,6 +379,7 @@ class acp_modules $json_response->send(array( 'MESSAGE_TITLE' => $user->lang('ERROR'), 'MESSAGE_TEXT' => implode('
', $errors), + 'SUCCESS' => false, )); } From ef7a7cac6dc3f313960a70462b084fbeaff9d4bd Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 19 Jul 2013 18:27:25 +0100 Subject: [PATCH 100/284] [ticket/11655] generate_text_for_display on ucp_pm_viewmessage.php sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11655 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 28 ++--------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index b7d2dd6821..0a8a3d55ab 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -76,17 +76,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $message = censor_text($message_row['message_text']); - - // Second parse bbcode here - if ($message_row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']); - } - - // Always process smilies after parsing bbcodes - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); // Replace naughty words such as farty pants $message_row['message_subject'] = censor_text($message_row['message_subject']); @@ -160,21 +150,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { - $signature = censor_text($signature); - - if ($user_info['user_sig_bbcode_bitfield']) - { - if ($bbcode === false) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']); - } - - $bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']); - } - - $signature = bbcode_nl2br($signature); - $signature = smiley_text($signature); + $signature = generate_text_for_display($signature, $user_info['bbcode_uid'], $user_info['bbcode_bitfield'], ($user_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); From b92f660ed389414a1d8550a5ba92804f7151eb79 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 13:08:41 -0500 Subject: [PATCH 101/284] [ticket/11718] Twig lexer only correcting statements in IF, not ELSEIF PHPBB3-11718 --- phpBB/phpbb/template/twig/lexer.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 46412ad048..cb44de76f1 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -219,19 +219,20 @@ class phpbb_template_twig_lexer extends Twig_Lexer { $callback = function($matches) { + $inner = $matches[2]; // Replace $TEST with definition.TEST - $matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]); + $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); // Replace .test with test|length - $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]); + $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner); - return ''; + return ""; }; // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces) $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code); - return preg_replace_callback('##', $callback, $code); + return preg_replace_callback('##', $callback, $code); } /** From 1c59ad87b026794e44ce6c7561feabd3eb7bf165 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 13:34:08 -0500 Subject: [PATCH 102/284] [ticket/11718] Quick test for fixes in ELSEIF PHPBB3-11718 --- tests/template/template_test.php | 2 +- tests/template/templates/define.html | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 802f0c19ba..86af97cc84 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -151,7 +151,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), - "xyz\nabc\nabc\nbar\nbar\nabc", + "xyz\nabc\n\$VALUE == 'abc'\nabc\nbar\nbar\nabc", ), array( 'define_advanced.html', diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html index 4e6d0ee793..5b8ed9ac40 100644 --- a/tests/template/templates/define.html +++ b/tests/template/templates/define.html @@ -2,6 +2,11 @@ {$VALUE} {$VALUE} + +$VALUE != 'abc' + +$VALUE == 'abc' + {$INCLUDED_VALUE} {$VALUE} From 375976eb38882f42155f1f7fa2c849add8dbcf08 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 14:12:28 -0500 Subject: [PATCH 103/284] [ticket/11707] Twig DEFINE not working as expected PHPBB3-11707 --- phpBB/phpbb/template/twig/lexer.php | 12 ++++++++---- tests/template/template_test.php | 2 +- tests/template/templates/define.html | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 46412ad048..1fa4c5b3e6 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -126,10 +126,14 @@ class phpbb_template_twig_lexer extends Twig_Lexer { $callback = function($matches) { - // Remove any quotes that may have been used in different implementations - // E.g. DEFINE $TEST = 'blah' vs INCLUDE foo - // Replace {} with start/end to parse variables (' ~ TEST ~ '.html) - $matches[2] = str_replace(array('"', "'", '{', '}'), array('', '', "' ~ ", " ~ '"), $matches[2]); + // Remove matching quotes at the beginning/end if a statement; + // E.g. 'asdf'"' -> asdf'" + // E.g. "asdf'"" -> asdf'" + // E.g. 'asdf'" -> 'asdf'" + $matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]); + + // Replace template variables with start/end to parse variables (' ~ TEST ~ '.html) + $matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]); // Surround the matches in single quotes ('' ~ TEST ~ '.html') return ""; diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 802f0c19ba..2ed0f03698 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -151,7 +151,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), - "xyz\nabc\nabc\nbar\nbar\nabc", + "xyz\nabc\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?", ), array( 'define_advanced.html', diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html index 4e6d0ee793..f0df16a8f8 100644 --- a/tests/template/templates/define.html +++ b/tests/template/templates/define.html @@ -7,3 +7,5 @@ {$VALUE} {$VALUE} + +{$VALUE} From e48f0555e9e40a9e1d3e9a60e25a9f206c565efe Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 20 Jul 2013 14:36:38 +0200 Subject: [PATCH 104/284] [ticket/11531] Reduced amount of avatar functional tests to minimum The tests were reduced to only test one case that should be correct and one that should fail. Different test cases have been split up over the specific test files for the acp groups, acp users, ucp groups, and ucp users page. PHPBB3-11531 --- tests/functional/avatar_acp_groups_test.php | 89 -------------------- tests/functional/avatar_acp_users_test.php | 91 --------------------- tests/functional/avatar_ucp_groups_test.php | 80 ------------------ tests/functional/avatar_ucp_users_test.php | 89 -------------------- 4 files changed, 349 deletions(-) diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 62b7409bdb..9fdc29cc76 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -42,95 +42,6 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av 'avatar_gravatar_height' => 120, ), ), - // Incorrect email supplied for gravatar - array( - 'EMAIL_INVALID_EMAIL', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test.example.com', - 'avatar_gravatar_width' => 80, - 'avatar_gravatar_height' => 80, - ), - ), - // Upload image from remote - array( - 'GROUP_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - ), - ), - // Incorrect URL - array( - 'AVATAR_URL_INVALID', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', - ), - ), - /* - // Does not work due to DomCrawler issue - // Valid file upload - array( - 'GROUP_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), - ), - ), - */ - // Correct remote avatar - array( - 'GROUP_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // Remote avatar with incorrect size - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 120, - 'avatar_remote_height' => 120, - ), - ), - // Wrong driver selected - array( - 'NO_AVATAR_SELECTED', - 'avatar_driver_upload', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist, remote avatar currently does - // not check if file exists if size is specified - array( - 'GROUP_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist and remote avatar errors when - // trying to get the image size - array( - 'UNABLE_GET_IMAGE_SIZE', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => '', - 'avatar_remote_height' => '', - ), - ), // Delete avatar image to reset group settings array( 'GROUP_UPDATED', diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php index 38ebcc8940..0afd05e530 100644 --- a/tests/functional/avatar_acp_users_test.php +++ b/tests/functional/avatar_acp_users_test.php @@ -22,26 +22,6 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava public function avatar_acp_users_data() { return array( - // Correct gravatar - array( - 'USER_AVATAR_UPDATED', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 80, - 'avatar_gravatar_height' => 80, - ), - ), - // Gravatar with incorrect sizes - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 120, - 'avatar_gravatar_height' => 120, - ), - ), // Gravatar with incorrect email array( 'EMAIL_INVALID_EMAIL', @@ -60,77 +40,6 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', ), ), - // Incorrect URL - array( - 'AVATAR_URL_INVALID', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', - ), - ), - /* - // Does not work due to DomCrawler issue - // Valid file upload - array( - 'PROFILE_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), - ), - ), - */ - // Correct remote avatar - array( - 'USER_AVATAR_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // Remote avatar with incorrect size - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 120, - 'avatar_remote_height' => 120, - ), - ), - // Wrong driver selected - array( - 'NO_AVATAR_SELECTED', - 'avatar_driver_upload', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist, remote avatar currently does - // not check if file exists if size is specified - array( - 'USER_AVATAR_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist and remote avatar errors when - // trying to get the image size - array( - 'UNABLE_GET_IMAGE_SIZE', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => '', - 'avatar_remote_height' => '', - ), - ), // Reset avatar settings array( 'USER_AVATAR_UPDATED', diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php index bd34f67491..233b7d36e1 100644 --- a/tests/functional/avatar_ucp_groups_test.php +++ b/tests/functional/avatar_ucp_groups_test.php @@ -22,44 +22,6 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av public function avatar_ucp_groups_data() { return array( - // Gravatar with correct settings - array( - 'GROUP_UPDATED', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 80, - 'avatar_gravatar_height' => 80, - ), - ), - // Gravatar with incorrect sizing - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 120, - 'avatar_gravatar_height' => 120, - ), - ), - // Gravatar with incorrect email address - array( - 'EMAIL_INVALID_EMAIL', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test.example.com', - 'avatar_gravatar_width' => 80, - 'avatar_gravatar_height' => 80, - ), - ), - // Correct remote upload avatar - array( - 'GROUP_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - ), - ), // Incorrect URL array( 'AVATAR_URL_INVALID', @@ -89,48 +51,6 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av 'avatar_remote_height' => 80, ), ), - // Remote avatar with incorrect size - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 120, - 'avatar_remote_height' => 120, - ), - ), - // Wrong driver selected - array( - 'NO_AVATAR_SELECTED', - 'avatar_driver_upload', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist, remote avatar currently does - // not check if file exists if size is specified - array( - 'GROUP_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist and remote avatar errors when - // trying to get the image size - array( - 'UNABLE_GET_IMAGE_SIZE', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => '', - 'avatar_remote_height' => '', - ), - ), array( 'GROUP_UPDATED', 'avatar_driver_gravatar', diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php index 6b2c2344b3..fa6282abf4 100644 --- a/tests/functional/avatar_ucp_users_test.php +++ b/tests/functional/avatar_ucp_users_test.php @@ -32,73 +32,6 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava 'avatar_gravatar_height' => 80, ), ), - // Gravatar with incorrect sizing - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 120, - 'avatar_gravatar_height' => 120, - ), - ), - // Gravatar with incorrect email address - array( - 'EMAIL_INVALID_EMAIL', - 'avatar_driver_gravatar', - array( - 'avatar_gravatar_email' => 'test.example.com', - 'avatar_gravatar_width' => 80, - 'avatar_gravatar_height' => 80, - ), - ), - // Correct remote upload avatar - array( - 'PROFILE_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - ), - ), - // Incorrect URL - array( - 'AVATAR_URL_INVALID', - 'avatar_driver_upload', - array( - 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', - ), - ), - /* - // Does not work due to DomCrawler issue - // Valid file upload - array( - 'PROFILE_UPDATED', - 'avatar_driver_upload', - array( - 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), - ), - ), - */ - // Correct remote avatar - array( - 'PROFILE_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // Remote avatar with incorrect size - array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 120, - 'avatar_remote_height' => 120, - ), - ), // Wrong driver selected array( 'NO_AVATAR_SELECTED', @@ -109,28 +42,6 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava 'avatar_remote_height' => 80, ), ), - // File does not exist, remote avatar currently does - // not check if file exists if size is specified - array( - 'PROFILE_UPDATED', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), - // File does not exist and remote avatar errors when - // trying to get the image size - array( - 'UNABLE_GET_IMAGE_SIZE', - 'avatar_driver_remote', - array( - 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => '', - 'avatar_remote_height' => '', - ), - ), array( 'PROFILE_UPDATED', 'avatar_driver_gravatar', From b3ad2fc23f35fce2a888bb8f9c35ece247e0bc09 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:16:10 +0100 Subject: [PATCH 105/284] [ticket/11642] Fixed typo in the variable name. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11642 --- phpBB/includes/mcp/mcp_post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 235b2a44be..e8768957e0 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -125,7 +125,7 @@ function mcp_post_details($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = generate_text_for_display($post_info['message_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From f1bfbde3f5bdb9191057f28dd623dc2a3a530bf7 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:19:27 +0100 Subject: [PATCH 106/284] [ticket/11643] Fixed typo in the variable name. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11643 --- phpBB/includes/mcp/mcp_queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 14490343c2..2c95dc6a67 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -132,7 +132,7 @@ class mcp_queue $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = generate_text_for_display($post_info['message_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From fc64e6997f9d54362a7fbe2f7a366fb8ba497deb Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:24:31 +0100 Subject: [PATCH 107/284] [ticket/11638] Fixed typo in the variable name. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9274539ab4..d18478fbfa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1385,7 +1385,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } // Parse the message and subject - $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); if (!empty($attachments[$row['post_id']])) { From 73414823048cac8c2963b2034ba13daaf60c3fee Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:25:05 +0100 Subject: [PATCH 108/284] [ticket/11638] Fixed not following guidelines for brackets sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d18478fbfa..de76d1186d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -830,7 +830,8 @@ if (!empty($topic_data['poll_start'])) $parse_bbcode_flags = OPTION_FLAG_SMILIES; - if(empty($poll_info[0]['bbcode_bitfield'])){ + if(empty($poll_info[0]['bbcode_bitfield'])) + { $parse_bbcode_flags |= OPTION_FLAG_BBCODE; } From 0ef1bcac2b3152bbf389b512fd373987a7d0edce Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:31:08 +0100 Subject: [PATCH 109/284] [ticket/11639] Whitespace fixing sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index ad75ed1079..49a1797321 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1108,7 +1108,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); // Do not censor text because it has already been censored before - $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); unset($parse_flags); From 67ba959d9b34ff727b77206f4c706b1fbe024cb2 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:35:28 +0100 Subject: [PATCH 110/284] [ticket/11654] first parameter fail sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11654 --- phpBB/includes/mcp/mcp_warn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index d0fcd8a77d..65cf641418 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -289,7 +289,7 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = generate_text_for_display($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], ($user_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], ($user_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) From 43b172c8aabbfbcc5180a3f3ad5daede45fcc041 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sat, 20 Jul 2013 16:44:24 +0100 Subject: [PATCH 111/284] [ticket/11655] wrong var names for the uid and for the bitfield sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11655 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 0a8a3d55ab..52a28e3552 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -150,7 +150,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { - $signature = generate_text_for_display($signature, $user_info['bbcode_uid'], $user_info['bbcode_bitfield'], ($user_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); From 603dc1f78617e64e41f61daf85f463b0465123ec Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 20 Jul 2013 15:09:28 +0200 Subject: [PATCH 112/284] [ticket/11717] Use topic_posts_approved instead of topic_replies Due to the move to soft-delete, the topic_replies column no longer exists in the topics table. Instead, the column topic_posts_approved should be used. PHPBB3-11717 --- phpBB/includes/functions_posting.php | 5 ++++- phpBB/includes/ucp/ucp_prefs.php | 2 +- phpBB/phpbb/feed/topic.php | 2 +- phpBB/search.php | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 03565c27bb..f80736a6c4 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1995,6 +1995,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } } + $first_post_topic_info = ($post_mode == 'edit_first_post' && (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1))); // Fix the post's and topic's visibility and first/last post information, when the post is edited if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility) { @@ -2007,7 +2010,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); } - else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])) + else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_topic_info) { if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility) { diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 7c3286c1d1..f24578da84 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -267,7 +267,7 @@ class ucp_prefs $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); - $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); + $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views'); // Post ordering options $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 36f958ac60..696b0f5a52 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -43,7 +43,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base function open() { - $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type + $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type FROM ' . TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) diff --git a/phpBB/search.php b/phpBB/search.php index 2429c81dae..8bcbfc498b 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -366,7 +366,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = "SELECT p.post_id FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_replies = 0 + WHERE t.topic_posts_approved = 1 AND p.topic_id = t.topic_id $last_post_time AND $m_approve_posts_fid_sql @@ -378,7 +378,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_replies = 0 + WHERE t.topic_posts_approved = 1 AND t.topic_moved_id = 0 AND p.topic_id = t.topic_id $last_post_time From 56df3fd8cafde10b230c925c7eb455003ae76382 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 20 Jul 2013 22:02:51 +0200 Subject: [PATCH 113/284] [ticket/11720] Do not call $captcha->validate if $captcha is not set PHPBB3-11566 changed big parts of code. Unfortunately, a call to $captcha->validate was added that is being called even if $captcha hasn't been initialized. This change will fix this issue. PHPBB3-11720 --- phpBB/report.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index c92ecdfdcc..c909b4fcf3 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -146,10 +146,13 @@ $s_hidden_fields = ''; // Submit report? if ($submit && $reason_id) { - $visual_confirmation_response = $captcha->validate(); - if ($visual_confirmation_response) + if (isset($captcha)) { - $error[] = $visual_confirmation_response; + $visual_confirmation_response = $captcha->validate(); + if ($visual_confirmation_response) + { + $error[] = $visual_confirmation_response; + } } $sql = 'SELECT * From 865bf0db3d5ca3f8bbadd009ce0a5e8324de49c1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 20 Jul 2013 22:35:45 +0200 Subject: [PATCH 114/284] [ticket/11720] Add functional test for submitting report as user The already existing functional tests were not ran as the filename was missing the appended "_test". PHPBB3-11720 --- ...ptcha.php => report_post_captcha_test.php} | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) rename tests/functional/{report_post_captcha.php => report_post_captcha_test.php} (89%) diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha_test.php similarity index 89% rename from tests/functional/report_post_captcha.php rename to tests/functional/report_post_captcha_test.php index af713775c5..8283465041 100644 --- a/tests/functional/report_post_captcha.php +++ b/tests/functional/report_post_captcha_test.php @@ -12,13 +12,6 @@ */ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_case { - public function test_user_report_post() - { - $this->login(); - $crawler = self::request('GET', 'report.php?f=2&p=1'); - $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); - } - public function test_guest_report_post() { $crawler = self::request('GET', 'report.php?f=2&p=1'); @@ -31,6 +24,18 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca $this->set_reporting_guest(-1); } + public function test_user_report_post() + { + $this->login(); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POST_REPORTED_SUCCESS'), $crawler->text()); + } + protected function set_reporting_guest($report_post_allowed) { $this->login(); From 570e21285bab8f98b45dfa46d0c6b6a8de885055 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 22 Jul 2013 03:30:27 +0200 Subject: [PATCH 115/284] [ticket/11722] Remove reference assignment for $captcha in report.php PHPBB3-11722 --- phpBB/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/report.php b/phpBB/report.php index 063e55e571..c9ca57ecbe 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -147,7 +147,7 @@ else if ($config['enable_post_confirm'] && !$user->data['is_registered']) { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REPORT); } From effafa4b4d82e8f0debcda2e84e03117433e5a7d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 22 Jul 2013 10:42:46 +0200 Subject: [PATCH 116/284] [ticket/11717] Add 'has' to boolean variable and reduce line length PHPBB3-11717 --- phpBB/includes/functions_posting.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f80736a6c4..103cc81205 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1995,9 +1995,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } } - $first_post_topic_info = ($post_mode == 'edit_first_post' && (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) || - ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) || - ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1))); + $first_post_has_topic_info = ($post_mode == 'edit_first_post' && + (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1))); // Fix the post's and topic's visibility and first/last post information, when the post is edited if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility) { @@ -2010,7 +2011,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); } - else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_topic_info) + else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info) { if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility) { From 580131b5c316925107d1c8bed586b1c6044f4c6e Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 22 Jul 2013 11:16:47 +0100 Subject: [PATCH 117/284] [ticket/11640] removed the unset sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11640 --- phpBB/includes/functions_privmsgs.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 001cf7bba0..15907feedd 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2023,7 +2023,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); - unset($parse_flags); $subject = censor_text($subject); From 128af41a7ce983a1b54406e5c467e40b14af7afc Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 22 Jul 2013 12:47:32 +0200 Subject: [PATCH 118/284] [ticket/11725] Use new paths for phpbb_class_loader in file.php In the PR #1559, the paths were changed from "{$phpbb_root_path}includes/" to "{$phpbb_root_path}phpbb/" for the class loader. However, this was not changed in all files that use it. PHPBB3-11725 --- phpBB/download/file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index cf7128b25b..5a091db7c7 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -41,7 +41,7 @@ if (isset($_GET['avatar'])) exit; } - require($phpbb_root_path . 'includes/class_loader.' . $phpEx); + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); @@ -50,7 +50,7 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Setup class loader first - $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); + $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); From 2eb32ef515c59b19bd1bb4f7e6d56736733ea9d8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 22 Jul 2013 13:38:19 +0200 Subject: [PATCH 119/284] [ticket/11531] Check if uploaded avatar is properly displayed in tests PHPBB3-11531 --- tests/functional/avatar_ucp_users_test.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php index fa6282abf4..f828559e0d 100644 --- a/tests/functional/avatar_ucp_users_test.php +++ b/tests/functional/avatar_ucp_users_test.php @@ -59,4 +59,20 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava { $this->assert_avatar_submit($expected, $avatar_type, $data); } + + public function test_display_upload_avatar() + { + $this->assert_avatar_submit('PROFILE_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ) + ); + + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + $avatar_link = $crawler->filter('img')->attr('src'); + $crawler = self::request('GET', $avatar_link . '&sid=' . $this->sid, array(), false); + $content = self::$client->getResponse()->getContent(); + self::assertEquals(false, stripos(trim($content), 'debug'), 'Output contains debug message'); + } } From 43538fdca15b9b6cd1d64a7808b4e4a4d2027221 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 22 Jul 2013 12:23:53 -0500 Subject: [PATCH 120/284] [ticket/11726] Don't run lint tests on Travis on postgres PHPBB3-11726 --- travis/phpunit-postgres-travis.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 3d1b574716..aa829f4d30 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -17,9 +17,6 @@ tests/functional tests/lint_test.php - - tests/lint_test.php - ../tests/functional From 62d7a0570071bb572fa60e502596d21eaee57376 Mon Sep 17 00:00:00 2001 From: asperous Date: Thu, 11 Jul 2013 14:58:41 -0700 Subject: [PATCH 121/284] [ticket/11620] Abstracted session setUp into a test_case class When defining a database test case with a setUp function, it is important to call the parent's setup function, because that is when the database is setup. PHPBB3-11620 --- tests/session/create_test.php | 16 ++--------- tests/session/extract_hostname_test.php | 16 ++--------- tests/session/extract_page_test.php | 16 ++--------- tests/session/validate_referrer_test.php | 16 ++--------- .../phpbb_session_test_case.php | 27 +++++++++++++++++++ 5 files changed, 35 insertions(+), 56 deletions(-) create mode 100644 tests/test_framework/phpbb_session_test_case.php diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 4a7484321c..a8248ae62c 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -7,27 +7,15 @@ * */ -require_once dirname(__FILE__) . '/testable_facade.php'; +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; -class phpbb_session_create_test extends phpbb_database_test_case +class phpbb_session_create_test extends phpbb_session_test_case { - public $session_factory; - public $db; - public $session_facade; - public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); } - public function setUp() - { - $this->session_factory = new phpbb_session_testable_factory; - $this->db = $this->new_dbal(); - $this->session_facade = - new phpbb_session_testable_facade($this->db, $this->session_factory); - } - static function bot($bot_agent, $user_id, $bot_ip) { return array(array( diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index cd71f82b17..5ff43cbb60 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -7,27 +7,15 @@ * */ -require_once dirname(__FILE__) . '/testable_facade.php'; +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; -class phpbb_session_extract_hostname_test extends phpbb_database_test_case +class phpbb_session_extract_hostname_test extends phpbb_session_test_case { - public $session_factory; - public $db; - public $session_facade; - public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); } - public function setUp() - { - $this->session_factory = new phpbb_session_testable_factory; - $this->db = $this->new_dbal(); - $this->session_facade = - new phpbb_session_testable_facade($this->db, $this->session_factory); - } - static public function extract_current_hostname_data() { return array ( diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index c17845526f..9346973bc4 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -7,27 +7,15 @@ * */ -require_once dirname(__FILE__) . '/testable_facade.php'; +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; -class phpbb_session_extract_page_test extends phpbb_database_test_case +class phpbb_session_extract_page_test extends phpbb_session_test_case { - public $session_factory; - public $db; - public $session_facade; - public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); } - public function setUp() - { - $this->session_factory = new phpbb_session_testable_factory; - $this->db = $this->new_dbal(); - $this->session_facade = - new phpbb_session_testable_facade($this->db, $this->session_factory); - } - static public function extract_current_page_data() { return array( diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index 1428187f27..f91ac5f1f9 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -7,27 +7,15 @@ * */ -require_once dirname(__FILE__) . '/testable_facade.php'; +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; -class phpbb_session_validate_referrer_test extends phpbb_database_test_case +class phpbb_session_validate_referrer_test extends phpbb_session_test_case { - public $session_factory; - public $db; - public $session_facade; - public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); } - public function setUp() - { - $this->session_factory = new phpbb_session_testable_factory; - $this->db = $this->new_dbal(); - $this->session_facade = - new phpbb_session_testable_facade($this->db, $this->session_factory); - } - static function referrer_inputs() { $ex = "example.org"; $alt = "example.com"; diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php new file mode 100644 index 0000000000..6ff7d8e2ef --- /dev/null +++ b/tests/test_framework/phpbb_session_test_case.php @@ -0,0 +1,27 @@ +session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); + } +} From 0f708646241ed43c86793d8cbe0b5fea7397f0e6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 22 Jul 2013 20:06:30 +0200 Subject: [PATCH 122/284] [ticket/11582] Move global declaration to beginning of block PHPBB3-11582 --- phpBB/includes/acp/acp_permission_roles.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 5657cbe675..17e48d6576 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -25,7 +25,7 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -306,7 +306,6 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } - global $phpbb_container; $phpbb_permissions = $phpbb_container->get('acl.permissions'); $template->assign_vars(array( From 87e65224d45c0571e90e00156abd165bd6bbe059 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 11:07:17 -0700 Subject: [PATCH 123/284] [ticket/11620] Cherry-Pick merge tests from session-storage-cache PHPBB3-11620 --- tests/session/testable_facade.php | 16 +++++----- tests/session/unset_admin_test.php | 48 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 tests/session/unset_admin_test.php diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index b9f61b80cb..1cb1c94b52 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -77,14 +77,16 @@ class phpbb_session_testable_facade function session_begin ( $update_session_page = true, $config_overrides = array(), - $request_overrides = array() + $request_overrides = array(), + $cookies_overrides = array() ) { + $this->session_factory->merge_config_data($config_overrides); + $this->session_factory->merge_server_data($request_overrides); + $this->session_factory->set_cookies($cookies_overrides); $session = $this->session_factory->get_session($this->db); - global $config, $request; - $request->merge(phpbb_request_interface::SERVER, $request_overrides); - $config = array_merge($config, $config_overrides); - return $session->session_begin($update_session_page); + $session->session_begin($update_session_page); + return $session; } function session_create ( @@ -93,8 +95,8 @@ class phpbb_session_testable_facade $persist_login = false, $viewonline = true, array $config_overrides = array(), - $user_agent, - $ip_address, + $user_agent = 'user agent', + $ip_address = '127.0.0.1', array $bot_overrides = array(), $uri_sid = "" ) diff --git a/tests/session/unset_admin_test.php b/tests/session/unset_admin_test.php new file mode 100644 index 0000000000..bbb5eb1439 --- /dev/null +++ b/tests/session/unset_admin_test.php @@ -0,0 +1,48 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + } + + function get_test_session() + { + return $this->session_facade->session_begin( + true, + // Config + array( + 'session_length' => time(), // need to do this to allow sessions started at time 0 + ), + // Server + array( + 'HTTP_USER_AGENT' => "user agent", + 'REMOTE_ADDR' => "127.0.0.1", + ), + // Cookies + array( + '_sid' => 'bar_session000000000000000000000', + '_u' => 4, + ) + ); + } + + public function test_unset_admin() + { + $session = $this->get_test_session(); + $this->assertEquals(1, $session->data['session_admin'], 'should be an admin before test starts'); + $session->unset_admin(); + $session = $this->get_test_session(); + $this->assertEquals(0, $session->data['session_admin'], 'should be not be an admin after unset_admin'); + } +} From f7da773c06534cd9b359bc5e6430469c2ff9a4bc Mon Sep 17 00:00:00 2001 From: asperous Date: Thu, 11 Jul 2013 20:23:12 -0700 Subject: [PATCH 124/284] [ticket/11620] Added manual key test PHPBB3-11620 --- tests/session/fixtures/sessions_key.xml | 44 +++++++++++++++++++++++++ tests/session/session_key_tests.php | 28 ++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 tests/session/fixtures/sessions_key.xml create mode 100644 tests/session/session_key_tests.php diff --git a/tests/session/fixtures/sessions_key.xml b/tests/session/fixtures/sessions_key.xml new file mode 100644 index 0000000000..246d284557 --- /dev/null +++ b/tests/session/fixtures/sessions_key.xml @@ -0,0 +1,44 @@ + + + + key_id + user_id + last_ip + last_login + + a87ff679a2f3e71d9181a67b7542122c + 4 + 127.0.0.1 + 0 + +
+ + session_id + session_user_id + session_ip + session_browser + + bar_session000000000000000000000 + 4 + 127.0.0.1 + user agent + 1 + +
+ + user_id + username_clean + user_permissions + user_sig + user_occ + user_interests + + 4 + bar + + + + + +
+
diff --git a/tests/session/session_key_tests.php b/tests/session/session_key_tests.php new file mode 100644 index 0000000000..382ed06a15 --- /dev/null +++ b/tests/session/session_key_tests.php @@ -0,0 +1,28 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_key.xml'); + } + + public function test_set_key_manually() + { + $this->session_factory->merge_config_data(array('allow_autologin' => true)); + $session = $this->session_factory->get_session($this->db); + $session->cookie_data['u'] = 4; + $session->cookie_data['k'] = 4; + $session->session_create(4, false, 4); + $this->assertEquals(4, $session->data['user_id']); + } +} From f5a09858d044592fa027e5ce23f4060aec0c38fa Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 07:15:46 -0700 Subject: [PATCH 125/284] [ticket/11620] Added a session key reset test PHPBB3-11620 --- tests/session/session_key_tests.php | 33 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/tests/session/session_key_tests.php b/tests/session/session_key_tests.php index 382ed06a15..bc3d6dd71c 100644 --- a/tests/session/session_key_tests.php +++ b/tests/session/session_key_tests.php @@ -1,4 +1,4 @@ -createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_key.xml'); @@ -18,11 +21,31 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case public function test_set_key_manually() { + // With AutoLogin setup $this->session_factory->merge_config_data(array('allow_autologin' => true)); $session = $this->session_factory->get_session($this->db); - $session->cookie_data['u'] = 4; - $session->cookie_data['k'] = 4; - $session->session_create(4, false, 4); - $this->assertEquals(4, $session->data['user_id']); + // Using a user_id and key that is already in the database + $session->cookie_data['u'] = $this->user_id; + $session->cookie_data['k'] = $this->key_id; + // Try to access session + $session->session_create($this->user_id, false, $this->user_id); + + $this->assertEquals($this->user_id, $session->data['user_id'], "session should automatically login"); + } + + public function test_reset_keys() + { + // With AutoLogin setup + $this->session_factory->merge_config_data(array('allow_autologin' => true)); + $session = $this->session_factory->get_session($this->db); + // Reset of the keys for this user + $session->reset_login_keys($this->user_id); + // Using a user_id and key that was in the database (before reset) + $session->cookie_data['u'] = $this->user_id; + $session->cookie_data['k'] = $this->key_id; + // Try to access session + $session->session_create($this->user_id, false, $this->user_id); + + $this->assertNotEquals($this->user_id, $session->data['user_id'], "session should be cleared"); } } From 750ea771084d96097ea5a22c11a6659e8f39869d Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 07:20:46 -0700 Subject: [PATCH 126/284] [ticket/11620] Typo in file name session_key_tests -> test PHPBB3-11620 --- tests/session/{session_key_tests.php => session_key_test.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/session/{session_key_tests.php => session_key_test.php} (100%) diff --git a/tests/session/session_key_tests.php b/tests/session/session_key_test.php similarity index 100% rename from tests/session/session_key_tests.php rename to tests/session/session_key_test.php From 016faad6682495a35566d2d0451697486a47e80c Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 09:47:06 -0700 Subject: [PATCH 127/284] [ticket/11620] Remove typo in beginning of session_key_test PHPBB3-11620 --- tests/session/session_key_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php index bc3d6dd71c..6406742168 100644 --- a/tests/session/session_key_test.php +++ b/tests/session/session_key_test.php @@ -1,4 +1,4 @@ -_ Date: Fri, 12 Jul 2013 09:54:38 -0700 Subject: [PATCH 128/284] [ticket/11620] Added a test for checking if users are banned PHPBB3-11620 --- tests/mock/session_testable.php | 4 ++ tests/session/check_ban_test.php | 51 ++++++++++++++++ tests/session/fixtures/sessions_banlist.xml | 66 +++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 tests/session/check_ban_test.php create mode 100644 tests/session/fixtures/sessions_banlist.xml diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index 56ff8c8b32..283f9af192 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -58,5 +58,9 @@ class phpbb_mock_session_testable extends phpbb_session } } } + + public function setup() + { + } } diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php new file mode 100644 index 0000000000..ec1f5e3aa1 --- /dev/null +++ b/tests/session/check_ban_test.php @@ -0,0 +1,51 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_banlist.xml'); + } + + static function check_banned_data() + { + return array( + array('All false values, should not be banned', + false, false, false, false, /* ?: */ false), + array('Matching values in the database, should be banned', + 4, '127.0.0.1', 'bar@example.org', true, /* ?: */ true), + array('IP Banned, should be banned', + false, '127.1.1.1', false, falseN, /* ?: */ true), + ); + } + + /** @dataProvider check_banned_data */ + public function test_check_is_banned($test_msg, $user_id, $user_ips, $user_email, $return, $should_be_banned) + { + $session = $this->session_factory->get_session($this->db); + // Change the global cache object for this test because + // the mock cache object does not hit the database as is + // needed for this test. + global $cache; + $old_cache = $cache; + $cache = new phpbb_cache_driver_file(); + + $is_banned = + $session->check_ban($user_id, $user_ips, $user_email, $return); + $this->assertEquals($should_be_banned, $is_banned, $test_msg); + + $cache = $old_cache; + } +} diff --git a/tests/session/fixtures/sessions_banlist.xml b/tests/session/fixtures/sessions_banlist.xml new file mode 100644 index 0000000000..9422fc0665 --- /dev/null +++ b/tests/session/fixtures/sessions_banlist.xml @@ -0,0 +1,66 @@ + + + + user_id + username_clean + user_permissions + user_sig + user_occ + user_interests + + 1 + anonymous + + + + + +
+ + session_id + session_user_id + session_ip + session_browser + session_admin + + bar_session000000000000000000000 + 4 + 127.0.0.1 + user agent + 1 + +
+ + ban_id + ban_userid + ban_ip + ban_email + ban_start + ban_end + ban_exclude + ban_reason + ban_give_reason + + 2 + 4 + 127.0.0.1 + bar@example.org + 1111 + 0 + 0 + HAHAHA + 1 + + + 3 + 0 + 127.1.1.1 + + 1111 + 0 + 0 + HAHAHA + 1 + +
+
From 362480263cbad6cabbe2637edca153b27d97c493 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:20:42 -0700 Subject: [PATCH 129/284] [ticket/11615] Rename continue -> check_isvalid for clarity PHPBB3-11615 --- tests/session/{continue_test.php => check_isvalid_test.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/session/{continue_test.php => check_isvalid_test.php} (98%) diff --git a/tests/session/continue_test.php b/tests/session/check_isvalid_test.php similarity index 98% rename from tests/session/continue_test.php rename to tests/session/check_isvalid_test.php index e5a7f7a4a1..7cc6f13286 100644 --- a/tests/session/continue_test.php +++ b/tests/session/check_isvalid_test.php @@ -9,7 +9,7 @@ require_once dirname(__FILE__) . '/testable_factory.php'; -class phpbb_session_continue_test extends phpbb_database_test_case +class phpbb_session_check_isvalid_test extends phpbb_database_test_case { public function getDataSet() { From e74abfaa2c25b7c9b4f2f865fbf6800de0761a6b Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Tue, 25 Jun 2013 12:24:02 -0700 Subject: [PATCH 130/284] [ticket/11615] Refactored isvalid test to be more imperative Refactoring the continue/is_valid test to remove the confusing data provider work around, while still keeping redundancies down to a minimum. PHPBB3-11615 --- tests/session/check_isvalid_test.php | 126 +++++++++------------------ tests/session/testable_factory.php | 28 +++++- 2 files changed, 66 insertions(+), 88 deletions(-) diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index 7cc6f13286..8083e3406a 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2013 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -16,42 +16,7 @@ class phpbb_session_check_isvalid_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); } - static public function session_begin_attempts() - { - // The session_id field is defined as CHAR(32) in the database schema. - // Thus the data we put in session_id fields has to have a length of 32 characters on stricter DBMSes. - // Thus we fill those strings up with zeroes until they have a string length of 32. - - return array( - array( - 'bar_session000000000000000000000', '4', 'user agent', '127.0.0.1', - array( - array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), - array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), - ), - array(), - 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.', - ), - array( - 'anon_session00000000000000000000', '4', 'user agent', '127.0.0.1', - array( - array('session_id' => '__new_session_id__', 'session_user_id' => 1), // use generated SID - array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), - ), - array( - 'u' => array('1', null), - 'k' => array(null, null), - 'sid' => array('__new_session_id__', null), - ), - 'If a request comes with a valid session id and IP but different user id and user agent, a new anonymous session is created and the session matching the supplied session id is deleted.', - ), - ); - } - - /** - * @dataProvider session_begin_attempts - */ - public function test_session_begin_valid_session($session_id, $user_id, $user_agent, $ip, $expected_sessions, $expected_cookies, $message) + protected function access_with($session_id, $user_id, $user_agent, $ip) { global $phpbb_container, $phpbb_root_path, $phpEx; @@ -68,66 +33,53 @@ class phpbb_session_check_isvalid_test extends phpbb_database_test_case ->will($this->returnValue($auth_provider)); $session_factory = new phpbb_session_testable_factory; - $session_factory->set_cookies(array( - '_sid' => $session_id, - '_u' => $user_id, - )); - $session_factory->merge_config_data(array( - 'session_length' => time(), // need to do this to allow sessions started at time 0 - )); - $session_factory->merge_server_data(array( - 'HTTP_USER_AGENT' => $user_agent, - 'REMOTE_ADDR' => $ip, - )); + $session_factory->merge_test_data($session_id, $user_id, $user_agent, $ip); $session = $session_factory->get_session($db); $session->page = array('page' => 'page', 'forum' => 0); $session->session_begin(); - - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $expected_sessions = $this->replace_session($expected_sessions, $session->session_id); - $expected_cookies = $this->replace_session($expected_cookies, $session->session_id); - - $this->assertSqlResultEquals( - $expected_sessions, - $sql, - $message - ); - - $session->check_cookies($this, $expected_cookies); - $session_factory->check($this); + return $session; } - /** - * Replaces recursively the value __new_session_id__ with the given session - * id. - * - * @param array $array An array of data - * @param string $session_id The new session id to use instead of the - * placeholder. - * @return array The input array with all occurances of __new_session_id__ - * replaced. - */ - public function replace_session($array, $session_id) + protected function check_session_equals($expected_sessions, $message) { - foreach ($array as $key => &$value) - { - if ($value === '__new_session_id__') - { - $value = $session_id; - } + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions + ORDER BY session_user_id'; - if (is_array($value)) - { - $value = $this->replace_session($value, $session_id); - } - } + $this->assertSqlResultEquals($expected_sessions, $sql, $message); + } - return $array; + public function test_session_valid_session_exists() + { + $session = $this->access_with('bar_session000000000000000000000', '4', 'user agent', '127.0.0.1'); + $session->check_cookies($this, array()); + + $this->check_session_equals(array( + array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), + array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), + ), + 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.' + ); + } + + public function test_session_invalid_make_new_annon_session() + { + $session = $this->access_with('anon_session00000000000000000000', '4', 'user agent', '127.0.0.1'); + $session->check_cookies($this, array( + 'u' => array('1', null), + 'k' => array(null, null), + 'sid' => array($session->session_id, null), + )); + + $this->check_session_equals(array( + array('session_id' => $session->session_id, 'session_user_id' => 1), // use generated SID + array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), + ), + 'If a request comes with a valid session id and IP but different user id and user agent, + a new anonymous session is created and the session matching the supplied session id is deleted.' + ); } } diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index ace968eb43..8733ce15ef 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2013 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -174,6 +174,32 @@ class phpbb_session_testable_factory return $this->server_data = array_merge($this->server_data, $server_data); } + /** + * Set cookies, merge config and server data in one step. + * + * New values overwrite old ones. + * + * @param $session_id + * @param $user_id + * @param $user_agent + * @param $ip + * @param int $time + */ + public function merge_test_data($session_id, $user_id, $user_agent, $ip, $time = 0) + { + $this->set_cookies(array( + '_sid' => $session_id, + '_u' => $user_id, + )); + $this->merge_config_data(array( + 'session_length' => time() + $time, // need to do this to allow sessions started at time 0 + )); + $this->merge_server_data(array( + 'HTTP_USER_AGENT' => $user_agent, + 'REMOTE_ADDR' => $ip, + )); + } + /** * Retrieve all server variables to be passed to the session. * From 2d850ba7a8f57dd74a23f0feaedf5c5fc409a520 Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 11:08:16 -0700 Subject: [PATCH 131/284] [ticket/11620] Refactored check_isvalid_test to use session_test_case Since the continue->isvalid refactoring is now in a branch with the session_test_case framework, this test can be refactored to use that framework. PHPBB3-11620 --- tests/session/check_isvalid_test.php | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index 8083e3406a..6c21359c7d 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -7,9 +7,10 @@ * */ -require_once dirname(__FILE__) . '/testable_factory.php'; +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; -class phpbb_session_check_isvalid_test extends phpbb_database_test_case + +class phpbb_session_check_isvalid_test extends phpbb_session_test_case { public function getDataSet() { @@ -18,28 +19,13 @@ class phpbb_session_check_isvalid_test extends phpbb_database_test_case protected function access_with($session_id, $user_id, $user_agent, $ip) { - global $phpbb_container, $phpbb_root_path, $phpEx; + $this->session_factory->merge_test_data($session_id, $user_id, $user_agent, $ip); - $db = $this->new_dbal(); - $config = new phpbb_config(array()); - $request = $this->getMock('phpbb_request'); - $user = $this->getMock('phpbb_user'); - - $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $phpbb_container->expects($this->any()) - ->method('get') - ->with('auth.provider.db') - ->will($this->returnValue($auth_provider)); - - $session_factory = new phpbb_session_testable_factory; - $session_factory->merge_test_data($session_id, $user_id, $user_agent, $ip); - - $session = $session_factory->get_session($db); + $session = $this->session_factory->get_session($this->db); $session->page = array('page' => 'page', 'forum' => 0); $session->session_begin(); - $session_factory->check($this); + $this->session_factory->check($this); return $session; } From 13e4271c502152b8fa318422d808aabeb97e6c8c Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 11:28:17 -0700 Subject: [PATCH 132/284] [ticket/11620] Fixed a typo on check_ban_test PHPBB3-11620 --- tests/session/check_ban_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index ec1f5e3aa1..6795338f23 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -27,7 +27,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case array('Matching values in the database, should be banned', 4, '127.0.0.1', 'bar@example.org', true, /* ?: */ true), array('IP Banned, should be banned', - false, '127.1.1.1', false, falseN, /* ?: */ true), + false, '127.1.1.1', false, false, /* ?: */ true), ); } From af3a4ee33a148c864c30d22a2031cfc7e1b7bcf3 Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 13:04:09 -0700 Subject: [PATCH 133/284] [ticket/11620] Fixed check_ban_test errors with cache and ban warning message PHPBB3-11620 --- tests/session/check_ban_test.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 6795338f23..6ff688ee3d 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -38,14 +38,26 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case // Change the global cache object for this test because // the mock cache object does not hit the database as is // needed for this test. - global $cache; - $old_cache = $cache; - $cache = new phpbb_cache_driver_file(); + global $cache, $config, $phpbb_root_path, $php_ext; + $cache = new phpbb_cache_service( + new phpbb_cache_driver_file(), + $config, + $this->db, + $phpbb_root_path, + $php_ext + ); - $is_banned = - $session->check_ban($user_id, $user_ips, $user_email, $return); + try + { + $is_banned = + $session->check_ban($user_id, $user_ips, $user_email, $return); + } catch (PHPUnit_Framework_Error_Notice $e) + { + // User error was triggered, user must have been banned + $is_banned = true; + } $this->assertEquals($should_be_banned, $is_banned, $test_msg); - $cache = $old_cache; + $cache = new phpbb_mock_cache(); } } From 7dbd85ad02b031fc2392adfd27c66c3725ef117b Mon Sep 17 00:00:00 2001 From: asperous Date: Fri, 12 Jul 2013 13:04:37 -0700 Subject: [PATCH 134/284] [ticket/11620] Added garbage_collection_test PHPBB3-11620 --- tests/session/fixtures/sessions_garbage.xml | 58 +++++++++++++++++++ tests/session/garbage_collection_test.php | 63 +++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 tests/session/fixtures/sessions_garbage.xml create mode 100644 tests/session/garbage_collection_test.php diff --git a/tests/session/fixtures/sessions_garbage.xml b/tests/session/fixtures/sessions_garbage.xml new file mode 100644 index 0000000000..23c44a975b --- /dev/null +++ b/tests/session/fixtures/sessions_garbage.xml @@ -0,0 +1,58 @@ + + + + user_id + username_clean + user_permissions + user_sig + user_occ + user_interests + + 4 + bar + + + + + +
+ + session_id + session_user_id + session_ip + session_browser + session_admin + + anon_session00000000000000000000 + 1 + 127.0.0.1 + anonymous user agent + 0 + + + bar_session000000000000000000000 + 4 + 127.0.0.1 + user agent + 1 + +
+ + attempt_ip + attempt_browser + attempt_forwarded_for + attempt_time + user_id + username + username_clean + + 127.0.0.1 + browser + + 0001 + 4 + bar + bar + +
+
diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php new file mode 100644 index 0000000000..1b607dfb4f --- /dev/null +++ b/tests/session/garbage_collection_test.php @@ -0,0 +1,63 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_garbage.xml'); + } + + public function setUp() + { + parent::setUp(); + $this->session = $this->session_factory->get_session($this->db); + } + + protected function assert_sessions_equal($expected, $msg) + { + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions + ORDER BY session_user_id'; + + $this->assertSqlResultEquals($expected, $sql, $msg); + } + + public function test_cleanup_all() + { + $this->assert_sessions_equal( + array( + array + ( + 'session_id' => 'anon_session00000000000000000000', + 'session_user_id' => 1, + ), + array + ( + 'session_id' => 'bar_session000000000000000000000', + 'session_user_id' => 4, + )), + 'Before test, should have some sessions.' + ); + // Set session length so it clears all + global $config; + $config['session_length'] = 0; + // There is an error unless the captcha plugin is set + $config['captcha_plugin'] = 'phpbb_captcha_nogd'; + $this->session->session_gc(); + $this->assert_sessions_equal( + array(), + 'After setting session time to 0, should remove all.' + ); + } +} From 30f198c61a56deb14223a60a8ebf370cc90d9f4b Mon Sep 17 00:00:00 2001 From: asperous Date: Sat, 13 Jul 2013 07:32:49 -0700 Subject: [PATCH 135/284] [ticket/11620] Update auth_provider for new interface PHPBB3-11620 --- tests/mock/auth_provider.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index 9674c573e3..e0a2abd2d5 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -31,7 +31,7 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface return array(); } - function acp($new) + function acp() { return array(); } @@ -45,4 +45,9 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface { return null; } + + public function get_acp_template($new_config) + { + return null; + } } From 25b189d33bbf2b94da6f9f969e8d91ade8eba30a Mon Sep 17 00:00:00 2001 From: asperous Date: Sat, 13 Jul 2013 08:26:46 -0700 Subject: [PATCH 136/284] [ticket/11620] Cleanup creation_test that was renamed on a cherry-pick PHPBB3-11620 --- tests/session/creation_test.php | 69 --------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 tests/session/creation_test.php diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php deleted file mode 100644 index fde76d6b06..0000000000 --- a/tests/session/creation_test.php +++ /dev/null @@ -1,69 +0,0 @@ -createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); - } - - // also see security/extract_current_page.php - - public function test_login_session_create() - { - global $phpbb_container, $phpbb_root_path, $phpEx; - - $db = $this->new_dbal(); - $config = new phpbb_config(array()); - $request = $this->getMock('phpbb_request'); - $user = $this->getMock('phpbb_user'); - - $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $phpbb_container->expects($this->any()) - ->method('get') - ->with('auth.provider.db') - ->will($this->returnValue($auth_provider)); - - $session_factory = new phpbb_session_testable_factory; - - $session = $session_factory->get_session($db); - $session->page = array('page' => 'page', 'forum' => 0); - - $session->session_create(3); - - $sql = 'SELECT session_user_id - FROM phpbb_sessions'; - - $this->assertSqlResultEquals( - array(array('session_user_id' => 3)), - $sql, - 'Check if exactly one session for user id 3 was created' - ); - - $one_year_in_seconds = 365 * 24 * 60 * 60; - $cookie_expire = $session->time_now + $one_year_in_seconds; - - $session->check_cookies($this, array( - 'u' => array(null, $cookie_expire), - 'k' => array(null, $cookie_expire), - 'sid' => array($session->session_id, $cookie_expire), - )); - - global $SID, $_SID; - $this->assertEquals($session->session_id, $_SID); - $this->assertEquals('?sid=' . $session->session_id, $SID); - - $session_factory->check($this); - } -} - From de2cb595336ee49aeb4bab4ee857fbe71e249599 Mon Sep 17 00:00:00 2001 From: asperous Date: Sat, 13 Jul 2013 08:38:02 -0700 Subject: [PATCH 137/284] [ticket/11620] Fix a static calls to non-static for session captcha These changes fixes an error in certain version of php that throws an error if you call a non-static method statically. PHPBB3-11620 --- phpBB/includes/captcha/captcha_factory.php | 3 ++- phpBB/includes/session.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 1ed8e119b5..af79f059fe 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -50,7 +50,8 @@ class phpbb_captcha_factory { include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); } - call_user_func(array($name, 'garbage_collect'), 0); + $captcha = new $name; + $captcha->garbage_collect(''); } /** diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 66bf053f7d..392a55e48f 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1016,7 +1016,8 @@ class phpbb_session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); + $captcha_factory = new phpbb_captcha_factory(); + $captcha_factory->garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']); From cc1aef47fb4f5d37415436c62067ad2dcde768bb Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 11:13:31 -0700 Subject: [PATCH 138/284] [ticket/11620] Changes for code guidelines consistency PHPBB3-11620 --- tests/session/extract_page_test.php | 20 ++++++++++---------- tests/session/testable_facade.php | 3 ++- tests/session/validate_referrer_test.php | 5 +++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index 9346973bc4..4dbbbc9c59 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -32,8 +32,8 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case 'root_script_path' => '/phpBB/', 'page' => 'index.php', 'forum' => 0, - ) - ) , + ), + ), array( './', '/phpBB/ucp.php', @@ -47,8 +47,8 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=login', 'forum' => 0, - ) - ) , + ), + ), array( './', '/phpBB/ucp.php', @@ -62,8 +62,8 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=register', 'forum' => 0, - ) - ) , + ), + ), array( './', '/phpBB/ucp.php', @@ -77,8 +77,8 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case 'root_script_path' => '/phpBB/', 'page' => 'ucp.php?mode=register', 'forum' => 0, - ) - ) , + ), + ), array( './../', '/phpBB/adm/index.php', @@ -93,8 +93,8 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case 'root_script_path' => '/phpBB/', //'page' => 'adm/index.php', 'forum' => 0, - ) - ) + ), + ), ); } diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 1cb1c94b52..1343b34a79 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -27,7 +27,8 @@ class phpbb_session_testable_facade protected $db; protected $session_factory; - function __construct($db, $session_factory) { + function __construct($db, $session_factory) + { $this->db = $db; $this->session_factory = $session_factory; } diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index f91ac5f1f9..b517b668ac 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -52,7 +52,7 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case ) { // Referrer needs http:// because it's going to get stripped in function. - $referrer = $referrer ? 'http://'.$referrer : ''; + $referrer = $referrer ? 'http://' . $referrer : ''; $this->assertEquals( $pass_or_fail, $this->session_facade->validate_referer( @@ -63,6 +63,7 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case $server_port, $server_name, $root_script_path - ), "referrer should" . ($pass_or_fail? '' : "n't") . " be validated"); + ), + "referrer should" . ($pass_or_fail ? '' : "n't") . " be validated"); } } From 28e98466d959875d2f5b0e917c32783c1039dc23 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 12:26:02 -0700 Subject: [PATCH 139/284] [ticket/11620] Changes to match merge PHPBB3-11620 --- tests/session/fixtures/sessions_full.xml | 3 +++ tests/session/testable_facade.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml index 509687f4d2..6bbaf1c9d5 100644 --- a/tests/session/fixtures/sessions_full.xml +++ b/tests/session/fixtures/sessions_full.xml @@ -37,17 +37,20 @@ session_user_id session_ip session_browser + session_admin anon_session00000000000000000000 1 127.0.0.1 anonymous user agent + 0 bar_session000000000000000000000 4 127.0.0.1 user agent + 1 diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 1343b34a79..c5e58fce05 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -8,7 +8,7 @@ */ require_once dirname(__FILE__) . '/testable_factory.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; +require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php'; /** * This class exists to expose session.php's functions in a more testable way. From 974da6449c2f18f52086bd5ee6d24aafed046e37 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 22 Jul 2013 22:00:27 +0200 Subject: [PATCH 140/284] [ticket/11723] Correctly redirect user to agreement page and let him leave This patch consists of two changes. The first one will make sure that $agree is correctly reset to 0 and the user redirected back to the agreement page after changing the display language. Secondly, by reseting 'change_lang', the user will be able to agree to the terms on the agreement page again. The changed language will still be kept, as this is correctly saved in the 'lang' field that is passed to the ucp_register page. The variable $agree has also been changed to be boolean. It is not used as an integer anywere in the ucp_register file. PHPBB3-11723 --- phpBB/includes/ucp/ucp_register.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 70fbfe46fb..7bc7ac8191 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -38,7 +38,7 @@ class ucp_register include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; - $agreed = (int) $request->variable('agreed', false); + $agreed = $request->variable('agreed', false); $submit = $request->is_set_post('submit'); $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); @@ -63,7 +63,7 @@ class ucp_register $submit = false; // Setting back agreed to let the user view the agreement in his/her language - $agreed = ($request->variable('change_lang', false)) ? 0 : $agreed; + $agreed = false; } $user->lang_name = $user_lang = $use_lang; @@ -89,7 +89,7 @@ class ucp_register $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; $s_hidden_fields = array( - 'change_lang' => $change_lang, + 'change_lang' => '', ); // If we change the language, we want to pass on some more possible parameter. From 9dbd42e9452fe8459de905170f9031a4515cc0b2 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 13:51:06 -0700 Subject: [PATCH 141/284] [ticket/11620] Space between . in directory import concatenation PHPBB3-11620 --- tests/session/check_ban_test.php | 2 +- tests/session/check_isvalid_test.php | 2 +- tests/session/create_test.php | 2 +- tests/session/extract_hostname_test.php | 2 +- tests/session/extract_page_test.php | 2 +- tests/session/garbage_collection_test.php | 2 +- tests/session/session_key_test.php | 2 +- tests/session/unset_admin_test.php | 2 +- tests/session/validate_referrer_test.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 6ff688ee3d..dfe971ea27 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -16,7 +16,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_banlist.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_banlist.xml'); } static function check_banned_data() diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index 6c21359c7d..24dce7c9c4 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -14,7 +14,7 @@ class phpbb_session_check_isvalid_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); } protected function access_with($session_id, $user_id, $user_agent, $ip) diff --git a/tests/session/create_test.php b/tests/session/create_test.php index a8248ae62c..64140f9883 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -13,7 +13,7 @@ class phpbb_session_create_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); } static function bot($bot_agent, $user_id, $bot_ip) diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index 5ff43cbb60..bd183fd438 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -13,7 +13,7 @@ class phpbb_session_extract_hostname_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); } static public function extract_current_hostname_data() diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index 4dbbbc9c59..f4ae8de021 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -13,7 +13,7 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); } static public function extract_current_page_data() diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php index 1b607dfb4f..b1be958d62 100644 --- a/tests/session/garbage_collection_test.php +++ b/tests/session/garbage_collection_test.php @@ -15,7 +15,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_garbage.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_garbage.xml'); } public function setUp() diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php index 6406742168..1cf2101385 100644 --- a/tests/session/session_key_test.php +++ b/tests/session/session_key_test.php @@ -16,7 +16,7 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_key.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_key.xml'); } public function test_set_key_manually() diff --git a/tests/session/unset_admin_test.php b/tests/session/unset_admin_test.php index bbb5eb1439..1d5b1759ab 100644 --- a/tests/session/unset_admin_test.php +++ b/tests/session/unset_admin_test.php @@ -13,7 +13,7 @@ class phpbb_session_unset_admin_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); } function get_test_session() diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index b517b668ac..f78bf36c1b 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -13,7 +13,7 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); } static function referrer_inputs() { From 9d38ded22875e023d4391e7724673087f87fa481 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 13:52:17 -0700 Subject: [PATCH 142/284] [ticket/11620] Expected and actual test conditions wrongly swapped PHPBB3-11620 --- tests/session/create_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 64140f9883..0faedf4db2 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -38,6 +38,6 @@ class phpbb_session_create_test extends phpbb_session_test_case self::bot('user agent', 13, '127.0.0.1'), '' ); - $this->assertEquals($output->data['is_bot'], true, 'should be a bot'); + $this->assertEquals(true, $output->data['is_bot'] , 'should be a bot'); } } From aa77367267d381f1f87f1ed725e4f5f4a3135922 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 22 Jul 2013 22:54:55 +0200 Subject: [PATCH 143/284] [ticket/11728] Replace topic_approved with topic_visibility PHPBB3-11728 --- phpBB/phpbb/feed/topic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 696b0f5a52..bb1753d823 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -60,7 +60,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base $this->forum_id = (int) $this->topic_data['forum_id']; // Make sure topic is either approved or user authed - if (!$this->topic_data['topic_approved'] && !$this->auth->acl_get('m_approve', $this->forum_id)) + if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id)) { trigger_error('SORRY_AUTH_READ'); } From 80f81dd0d2d4aaef0b9c770d6071526aaca79e06 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 15:04:30 -0700 Subject: [PATCH 144/284] [ticket/11731] Remove static calls to captcha garbage collector PHPBB3-11731 --- phpBB/includes/captcha/captcha_factory.php | 3 ++- phpBB/phpbb/session.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 1ed8e119b5..fac45087e3 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -50,7 +50,8 @@ class phpbb_captcha_factory { include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); } - call_user_func(array($name, 'garbage_collect'), 0); + $captcha = self::get_instance($name); + $captcha->garbage_collect(0); } /** diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index e0585b1523..dc33786666 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1022,7 +1022,8 @@ class phpbb_session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); + $captcha_factory = new phpbb_captcha_factory(); + $captcha_factory->garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']); From 8dc8ee205a30e4f1813f2b85e0176cc47100f47b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 23 Jul 2013 00:58:03 +0200 Subject: [PATCH 145/284] [ticket/11733] Add browse test for feed.php PHPBB3-11733 --- tests/functional/browse_test.php | 7 +++++++ .../phpbb_functional_test_case.php | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index 18a2ad9464..c3be301762 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -29,4 +29,11 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case $crawler = self::request('GET', 'viewtopic.php?t=1'); $this->assertGreaterThan(0, $crawler->filter('.postbody')->count()); } + + public function test_feed() + { + $crawler = self::request('GET', 'feed.php', array(), false); + self::assert_response_xml(); + $this->assertGreaterThan(0, $crawler->filter('entry')->count()); + } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index ed307c3ce2..de3611c4cc 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -747,6 +747,27 @@ class phpbb_functional_test_case extends phpbb_test_case self::assertStringStartsWith('getResponse()->getContent(); + self::assertNotContains('[phpBB Debug]', $content); + self::assertStringStartsWith(' Date: Tue, 23 Jul 2013 00:59:51 +0200 Subject: [PATCH 146/284] [ticket/11733] Fix "Illegal offset type" Warning caused by overall feed PHPBB3-11733 --- phpBB/phpbb/feed/overall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index 869df7cde0..224d97ec03 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -72,7 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . $this->content_visibility->get_visibility_sql('post', array(), 'p.') . ' + AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . ' AND p.post_time >= ' . $min_post_time . ' AND u.user_id = p.poster_id', 'ORDER_BY' => 'p.post_time DESC', From cc6147f8769b7d70c9c48257c787ff00552beaf4 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 15:41:51 -0700 Subject: [PATCH 147/284] [ticket/11620] Minor indentation changes and comment clarity PHPBB3-11620 --- tests/session/check_ban_test.php | 11 +++++------ tests/session/check_isvalid_test.php | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index dfe971ea27..303751f54c 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -23,11 +23,11 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case { return array( array('All false values, should not be banned', - false, false, false, false, /* ?: */ false), + false, false, false, false, /* should be banned? -> */ false), array('Matching values in the database, should be banned', - 4, '127.0.0.1', 'bar@example.org', true, /* ?: */ true), + 4, '127.0.0.1', 'bar@example.org', true, /* should be banned? -> */ true), array('IP Banned, should be banned', - false, '127.1.1.1', false, false, /* ?: */ true), + false, '127.1.1.1', false, false, /* should be banned? -> */ true), ); } @@ -38,7 +38,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case // Change the global cache object for this test because // the mock cache object does not hit the database as is // needed for this test. - global $cache, $config, $phpbb_root_path, $php_ext; + global $cache, $config, $phpbb_root_path, $php_ext; $cache = new phpbb_cache_service( new phpbb_cache_driver_file(), $config, @@ -49,8 +49,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case try { - $is_banned = - $session->check_ban($user_id, $user_ips, $user_email, $return); + $is_banned = $session->check_ban($user_id, $user_ips, $user_email, $return); } catch (PHPUnit_Framework_Error_Notice $e) { // User error was triggered, user must have been banned diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index 24dce7c9c4..c60770dad8 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -9,7 +9,6 @@ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; - class phpbb_session_check_isvalid_test extends phpbb_session_test_case { public function getDataSet() From 568de3b8ceb68c4d988a7e69b0d357bd43bdd25b Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 15:44:22 -0700 Subject: [PATCH 148/284] [ticket/11620] Changed incorrect global variable PHPBB3-11620 --- tests/session/check_ban_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 303751f54c..fe7c70575a 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -38,13 +38,13 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case // Change the global cache object for this test because // the mock cache object does not hit the database as is // needed for this test. - global $cache, $config, $phpbb_root_path, $php_ext; + global $cache, $config, $phpbb_root_path, $phpEx; $cache = new phpbb_cache_service( new phpbb_cache_driver_file(), $config, $this->db, $phpbb_root_path, - $php_ext + $phpEx ); try From 0c54fb034b71cfc2bff338430acb1e2b43083dd5 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 17:39:14 -0700 Subject: [PATCH 149/284] [ticket/11620] Move check_ban_test functions to setUp/tearDown for clarity PHPBB3-11620 --- tests/session/check_ban_test.php | 36 +++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index fe7c70575a..8d6c9a866d 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -13,6 +13,8 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case { protected $user_id = 4; protected $key_id = 4; + protected $session; + protected $backup_cache; public function getDataSet() { @@ -31,14 +33,16 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case ); } - /** @dataProvider check_banned_data */ - public function test_check_is_banned($test_msg, $user_id, $user_ips, $user_email, $return, $should_be_banned) + public function setUp() { - $session = $this->session_factory->get_session($this->db); - // Change the global cache object for this test because - // the mock cache object does not hit the database as is - // needed for this test. + parent::setUp(); + // Get session here so that config is mocked correctly + $this->session = $this->session_factory->get_session($this->db); global $cache, $config, $phpbb_root_path, $phpEx; + $this->backup_cache = $cache; + // Change the global cache object for this test because + // the mock cache object does not hit the database as is needed + // for this test. $cache = new phpbb_cache_service( new phpbb_cache_driver_file(), $config, @@ -46,17 +50,29 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case $phpbb_root_path, $phpEx ); + } + public function tearDown() + { + parent::tearDown(); + // Set cache back to what it was before the test changed it + global $cache; + $cache = $this->backup_cache; + } + + /** @dataProvider check_banned_data */ + public function test_check_is_banned($test_msg, $user_id, $user_ips, $user_email, $return, $should_be_banned) + { try { - $is_banned = $session->check_ban($user_id, $user_ips, $user_email, $return); - } catch (PHPUnit_Framework_Error_Notice $e) + $is_banned = $this->session->check_ban($user_id, $user_ips, $user_email, $return); + } + catch (PHPUnit_Framework_Error_Notice $e) { // User error was triggered, user must have been banned $is_banned = true; } - $this->assertEquals($should_be_banned, $is_banned, $test_msg); - $cache = new phpbb_mock_cache(); + $this->assertEquals($should_be_banned, $is_banned, $test_msg); } } From 2fe2724e684304e1c8323c047d1dde6cd732afcd Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 22 Jul 2013 17:39:45 -0700 Subject: [PATCH 150/284] [ticket/11620] Whitespace and combine function into test_case PHPBB3-11620 --- tests/mock/auth_provider.php | 8 +++---- tests/session/check_isvalid_test.php | 13 ++--------- tests/session/create_test.php | 2 +- tests/session/garbage_collection_test.php | 22 +++++-------------- tests/session/testable_facade.php | 8 +++---- tests/session/validate_referrer_test.php | 7 +++--- .../phpbb_session_test_case.php | 9 ++++++++ 7 files changed, 30 insertions(+), 39 deletions(-) diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index e0a2abd2d5..9d002334d6 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -20,10 +20,10 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface function login($username, $password) { return array( - 'status' => "", - 'error_msg' => "", - 'user_row' => "", - ); + 'status' => "", + 'error_msg' => "", + 'user_row' => "", + ); } function autologin() diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index c60770dad8..760e2a6f24 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -28,21 +28,12 @@ class phpbb_session_check_isvalid_test extends phpbb_session_test_case return $session; } - protected function check_session_equals($expected_sessions, $message) - { - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $this->assertSqlResultEquals($expected_sessions, $sql, $message); - } - public function test_session_valid_session_exists() { $session = $this->access_with('bar_session000000000000000000000', '4', 'user agent', '127.0.0.1'); $session->check_cookies($this, array()); - $this->check_session_equals(array( + $this->check_sessions_equals(array( array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), ), @@ -59,7 +50,7 @@ class phpbb_session_check_isvalid_test extends phpbb_session_test_case 'sid' => array($session->session_id, null), )); - $this->check_session_equals(array( + $this->check_sessions_equals(array( array('session_id' => $session->session_id, 'session_user_id' => 1), // use generated SID array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), ), diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 0faedf4db2..442445599b 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -38,6 +38,6 @@ class phpbb_session_create_test extends phpbb_session_test_case self::bot('user agent', 13, '127.0.0.1'), '' ); - $this->assertEquals(true, $output->data['is_bot'] , 'should be a bot'); + $this->assertEquals(true, $output->data['is_bot'], 'should be a bot'); } } diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php index b1be958d62..e7d01785dd 100644 --- a/tests/session/garbage_collection_test.php +++ b/tests/session/garbage_collection_test.php @@ -24,29 +24,19 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case $this->session = $this->session_factory->get_session($this->db); } - protected function assert_sessions_equal($expected, $msg) - { - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $this->assertSqlResultEquals($expected, $sql, $msg); - } - public function test_cleanup_all() { - $this->assert_sessions_equal( + $this->check_sessions_equals( array( - array - ( + array( 'session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1, ), - array - ( + array( 'session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4, - )), + ), + ), 'Before test, should have some sessions.' ); // Set session length so it clears all @@ -55,7 +45,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case // There is an error unless the captcha plugin is set $config['captcha_plugin'] = 'phpbb_captcha_nogd'; $this->session->session_gc(); - $this->assert_sessions_equal( + $this->check_sessions_equals( array(), 'After setting session time to 0, should remove all.' ); diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index c5e58fce05..9f0a3c5f59 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -33,7 +33,7 @@ class phpbb_session_testable_facade $this->session_factory = $session_factory; } - function extract_current_page ( + function extract_current_page( $root_path, $php_self, $query_string, @@ -48,7 +48,7 @@ class phpbb_session_testable_facade return phpbb_session::extract_current_page($root_path); } - function extract_current_hostname ( + function extract_current_hostname( $host, $server_name_config, $cookie_domain_config @@ -75,7 +75,7 @@ class phpbb_session_testable_facade * @param request_overrides An array of overrides for the global request object * @return boolean False if the user is identified, otherwise true. */ - function session_begin ( + function session_begin( $update_session_page = true, $config_overrides = array(), $request_overrides = array(), @@ -90,7 +90,7 @@ class phpbb_session_testable_facade return $session; } - function session_create ( + function session_create( $user_id = false, $set_admin = false, $persist_login = false, diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index f78bf36c1b..a302229287 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -16,7 +16,8 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); } - static function referrer_inputs() { + static function referrer_inputs() + { $ex = "example.org"; $alt = "example.com"; return array( @@ -39,8 +40,8 @@ class phpbb_session_validate_referrer_test extends phpbb_session_test_case ); } - /** @dataProvider referrer_inputs */ - function test_referrer_inputs ( + /** @dataProvider referrer_inputs */ + function test_referrer_inputs( $check_script_path, $referrer, $host, diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 6ff7d8e2ef..e6a2b03bba 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -24,4 +24,13 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $this->session_facade = new phpbb_session_testable_facade($this->db, $this->session_factory); } + + protected function check_sessions_equals($expected_sessions, $message) + { + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions + ORDER BY session_user_id'; + + $this->assertSqlResultEquals($expected_sessions, $sql, $message); + } } From c36699811221b17c563a7525b790e0c6c3ab98e0 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 23 Jul 2013 12:47:18 +0100 Subject: [PATCH 151/284] [ticket/11654] Moved some code to reduce line width. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11654 --- phpBB/includes/mcp/mcp_warn.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 65cf641418..bb21d3d377 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -289,7 +289,8 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], ($user_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $parse_flags = OPTION_FLAG_SMILIES | ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) From 6b0b0f2a9fdd2e2169534756e9ceb4421125c7ea Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sun, 14 Jul 2013 12:10:49 -0500 Subject: [PATCH 152/284] [ticket/11701] Loop variables are not passed correctly to events PHPBB3-11701 --- phpBB/phpbb/template/twig/lexer.php | 10 +++++----- phpBB/phpbb/template/twig/twig.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 4f88147542..606ca347ae 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -191,20 +191,20 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Recursive...fix any child nodes $body = $parent_class->fix_begin_tokens($body, $parent_nodes); - // Rename loopname vars (to prevent collisions, loop children are named (loop name)_loop_element) - $body = str_replace($name . '.', $name . '_loop_element.', $body); + // Rename loopname vars + $body = str_replace($name . '.', $name . '.', $body); // Need the parent variable name array_pop($parent_nodes); - $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '_loop_element.' : ''; + $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; if ($subset !== '') { $subset = '|subset(' . $subset . ')'; } - // Turn into a Twig for loop, using (loop name)_loop_element for each child - return "{% for {$name}_loop_element in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; + // Turn into a Twig for loop + return "{% for {$name} in loops.{$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; // Replace correctly, only needs to be done once diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 92a37d1634..6cff1bb8e4 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -429,15 +429,15 @@ class phpbb_template_twig implements phpbb_template $vars = array_merge( $context_vars['.'][0], // To get normal vars - $context_vars, // To get loops array( 'definition' => new phpbb_template_twig_definition(), 'user' => $this->user, + 'loops' => $context_vars, // To get loops ) ); // cleanup - unset($vars['.']); + unset($vars['loops']['.']); return $vars; } From 0d31420ae099b9284c6240bfbda0f03f1be155c1 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sun, 14 Jul 2013 12:18:44 -0500 Subject: [PATCH 153/284] [ticket/11701] Remove useless str_replace PHPBB3-11701 --- phpBB/phpbb/template/twig/lexer.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 606ca347ae..3c072adff9 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -191,9 +191,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Recursive...fix any child nodes $body = $parent_class->fix_begin_tokens($body, $parent_nodes); - // Rename loopname vars - $body = str_replace($name . '.', $name . '.', $body); - // Need the parent variable name array_pop($parent_nodes); $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; From 1d2d3032d3f0f614b0df9851c373618e205580f8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 23 Jul 2013 16:26:01 +0200 Subject: [PATCH 154/284] [ticket/11734] Readd accidently removed language strings of forum permissions PHPBB3-11734 --- phpBB/language/en/acp/permissions_phpbb.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index d0128db34a..5ea151f6ea 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -102,6 +102,17 @@ $lang = array_merge($lang, array( // Forum Permissions $lang = array_merge($lang, array( + 'ACL_F_LIST' => 'Can see forum', + 'ACL_F_READ' => 'Can read forum', + 'ACL_F_SEARCH' => 'Can search the forum', + 'ACL_F_SUBSCRIBE' => 'Can subscribe forum', + 'ACL_F_PRINT' => 'Can print topics', + 'ACL_F_EMAIL' => 'Can email topics', + 'ACL_F_BUMP' => 'Can bump topics', + 'ACL_F_USER_LOCK' => 'Can lock own topics', + 'ACL_F_DOWNLOAD' => 'Can download files', + 'ACL_F_REPORT' => 'Can report posts', + 'ACL_F_POST' => 'Can start new topics', 'ACL_F_STICKY' => 'Can post stickies', 'ACL_F_ANNOUNCE' => 'Can post announcements', From c0b9db1c626c88780b2ee5f5a237561a125c54aa Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sun, 14 Jul 2013 14:10:11 -0500 Subject: [PATCH 155/284] [ticket/11701] Fix loops var check PHPBB3-11701 --- phpBB/phpbb/template/twig/lexer.php | 8 +++-- tests/template/template_test.php | 32 +++++++++---------- tests/template/templates/include_loop.html | 8 ++--- .../templates/include_loop_define.html | 6 ++-- tests/template/templates/loop.html | 14 ++++---- tests/template/templates/loop_advanced.html | 20 ++++++------ tests/template/templates/loop_size.html | 10 +++--- tests/template/templates/loop_vars.html | 18 +++++------ 8 files changed, 60 insertions(+), 56 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 3c072adff9..4f127bd7e6 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -200,8 +200,9 @@ class phpbb_template_twig_lexer extends Twig_Lexer $subset = '|subset(' . $subset . ')'; } + $parent = ($parent) ?: 'loops.'; // Turn into a Twig for loop - return "{% for {$name} in loops.{$parent}{$name}{$subset} %}{$body}{% endfor %}"; + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; // Replace correctly, only needs to be done once @@ -224,7 +225,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace $TEST with definition.TEST $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); - // Replace .test with test|length + // Replace .foo with loops.foo|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)#', ' loops.$1|length', $inner); + + // Replace .foo.bar with foo.bar|length $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner); return ""; diff --git a/tests/template/template_test.php b/tests/template/template_test.php index dd9ba21c26..0a6b680100 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -93,49 +93,49 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop.html', array(), - array('loop' => array(array())), + array('test_loop' => array(array())), array(), "loop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array())), array(), "loop\nloop\nloop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array()), 'block' => array(array(), array())), array(), "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'))), + array('test_loop' => array(array('VARIABLE' => 'x'))), array(), "first\n0 - a\nx - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", ), array( 'loop_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())), array(), "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", ), @@ -149,14 +149,14 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'define.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), "xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?", ), array( 'define_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), "abc\nzxc\ncde\nbcd", ), @@ -200,7 +200,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop.html', array(), - array('loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'test_loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), array(), "1\n_1\n_02\n_3", ), @@ -221,8 +221,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop'), '', ), array( @@ -235,7 +235,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop_define.html', array('VARIABLE' => 'value'), - array('loop' => array(array('NESTED_FILE' => 'variable.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'variable.html'))), array(), 'value', ), @@ -243,8 +243,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop.inner'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop.inner'), "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast", ),*/ array( @@ -295,7 +295,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_size.html', array(), - array('loop' => array(array()), 'empty_loop' => array()), + array('test_loop' => array(array()), 'empty_loop' => array()), array(), "nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop", ), diff --git a/tests/template/templates/include_loop.html b/tests/template/templates/include_loop.html index d5c3d9bc82..5cad34b363 100644 --- a/tests/template/templates/include_loop.html +++ b/tests/template/templates/include_loop.html @@ -1,4 +1,4 @@ - - -_ - + + +_ + diff --git a/tests/template/templates/include_loop_define.html b/tests/template/templates/include_loop_define.html index f539b21396..4bab09422e 100644 --- a/tests/template/templates/include_loop_define.html +++ b/tests/template/templates/include_loop_define.html @@ -1,4 +1,4 @@ - - + + - + diff --git a/tests/template/templates/loop.html b/tests/template/templates/loop.html index de1a10004d..f541e934df 100644 --- a/tests/template/templates/loop.html +++ b/tests/template/templates/loop.html @@ -1,21 +1,21 @@ - + loop noloop - + - + loop noloop - + loop - + -loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} +loop#{test_loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} - + diff --git a/tests/template/templates/loop_advanced.html b/tests/template/templates/loop_advanced.html index c75fe55f03..1f56686eaa 100644 --- a/tests/template/templates/loop_advanced.html +++ b/tests/template/templates/loop_advanced.html @@ -1,19 +1,19 @@ -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} x -{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW} diff --git a/tests/template/templates/loop_size.html b/tests/template/templates/loop_size.html index 8f581cef10..2b1fcd2dd4 100644 --- a/tests/template/templates/loop_size.html +++ b/tests/template/templates/loop_size.html @@ -22,18 +22,18 @@ ! empty - + loop - + loop = 0 - + ! loop - + in loop - + diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html index 7d86d4b7b6..70a3eb2cec 100644 --- a/tests/template/templates/loop_vars.html +++ b/tests/template/templates/loop_vars.html @@ -1,13 +1,13 @@ - -first -{loop.S_ROW_NUM} - a -{loop.VARIABLE} - b -set - + +first +{test_loop.S_ROW_NUM} - a +{test_loop.VARIABLE} - b +set + last -{inner.S_ROW_NUM} - c -last inner +{test_loop.inner.S_ROW_NUM} - c +last inner - + From 2d764ef7d54104be2925aa015193da20c4383c5d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 11:31:52 -0500 Subject: [PATCH 156/284] [ticket/11701] Fix regex for appending |length PHPBB3-11701 --- phpBB/phpbb/template/twig/lexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 4f127bd7e6..95b3043403 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -226,10 +226,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); // Replace .foo with loops.foo|length - $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)#', ' loops.$1|length', $inner); + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+) #', ' loops.$1|length ', $inner); // Replace .foo.bar with foo.bar|length - $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner); + $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+) #', ' $1|length ', $inner); return ""; }; From ea250a5ef5dd3e790b22336e5a9e74c77da35569 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 12:43:24 -0500 Subject: [PATCH 157/284] [ticket/11701] Refix regex for appending |length PHPBB3-11701 --- phpBB/phpbb/template/twig/lexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 95b3043403..3534311b7a 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -226,10 +226,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); // Replace .foo with loops.foo|length - $inner = preg_replace('#\s\.([a-zA-Z_0-9]+) #', ' loops.$1|length ', $inner); + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner); // Replace .foo.bar with foo.bar|length - $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+) #', ' $1|length ', $inner); + $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner); return ""; }; From 30bfd7fb61bbe1d7ca50290730d8c4b6094c41a4 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 13:25:53 -0500 Subject: [PATCH 158/284] [ticket/11701] Test events in loops PHPBB3-11701 --- .../trivial/styles/all/template/test_event_loop.html | 1 + .../ext_trivial/styles/silver/template/event_loop.html | 3 +++ tests/template/template_events_test.php | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 100644 tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html create mode 100644 tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html new file mode 100644 index 0000000000..149398d6bd --- /dev/null +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html @@ -0,0 +1 @@ +{event_loop.S_ROW_COUNT}| \ No newline at end of file diff --git a/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html new file mode 100644 index 0000000000..c70d8f86d7 --- /dev/null +++ b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html @@ -0,0 +1,3 @@ + +event_loop + diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index f7bcd2dcc6..d3b65e763a 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -80,6 +80,16 @@ Zeta test event in all', array(), 'two in silver in omega', ), + array( + 'EVENT in loop', + 'ext_trivial', + array('silver'), + 'event_loop.html', + array(), + array('event_loop' => array(array(), array(), array())), + array(), + 'event_loop0|event_loop1|event_loop2', + ), ); } From 0f83d7fd6cf6819c0fe2f4bfa9f65873f7124b72 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 19 Jul 2013 13:36:28 -0500 Subject: [PATCH 159/284] [ticket/11701] New line at EOF PHPBB3-11701 --- .../ext/trivial/styles/all/template/test_event_loop.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html index 149398d6bd..235e129f85 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html @@ -1 +1 @@ -{event_loop.S_ROW_COUNT}| \ No newline at end of file +{event_loop.S_ROW_COUNT}| From bf04bfcced7934704e7f2682ee608f490cb3fc76 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 23 Jul 2013 11:16:23 -0500 Subject: [PATCH 160/284] [ticket/11667] Use @inheritdoc PHPBB3-11667 --- phpBB/phpbb/template/twig/node/includecss.php | 9 ++------- phpBB/phpbb/template/twig/node/includejs.php | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 450edb3e1e..a9d9b46d69 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -10,9 +10,7 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset { /** - * Get the definition name - * - * @return string (e.g. 'SCRIPTS') + * {@inheritdoc} */ public function get_definition_name() { @@ -20,10 +18,7 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_inclu } /** - * Append the output code for the asset - * - * @param Twig_Compiler A Twig_Compiler instance - * @return null + * {@inheritdoc} */ public function append_asset(Twig_Compiler $compiler) { diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php index 50ab448e0f..2b4b55fb0a 100644 --- a/phpBB/phpbb/template/twig/node/includejs.php +++ b/phpBB/phpbb/template/twig/node/includejs.php @@ -10,9 +10,7 @@ class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset { /** - * Get the definition name - * - * @return string (e.g. 'SCRIPTS') + * {@inheritdoc} */ public function get_definition_name() { @@ -20,10 +18,7 @@ class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includ } /** - * Append the output code for the asset - * - * @param Twig_Compiler A Twig_Compiler instance - * @return null + * {@inheritdoc} */ protected function append_asset(Twig_Compiler $compiler) { From 1372b4f20801d6079798832f15caf38949fe9333 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 10:33:06 +0100 Subject: [PATCH 161/284] [ticket/11639] Removed a non-needed unset sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 49a1797321..acf0cc874b 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1110,8 +1110,6 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id // Do not censor text because it has already been censored before $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); - unset($parse_flags); - if (!empty($attachments[$row['post_id']])) { $update_count = array(); From 13fa346e8f5b496f5e51ea20e9420a48228a5072 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 11:38:04 +0100 Subject: [PATCH 162/284] [ticket/11656] Made the check for the bitfield just like other PR's sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11656 --- phpBB/memberlist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index f8ee82084c..018526d034 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -561,7 +561,8 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], OPTION_FLAG_BBCODE | OPTION_FLAG_SMILIES, true); + $parse_flags = ($member['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true); } $poster_avatar = phpbb_get_user_avatar($member); From 4ed322b5b8642ec8d0a6faf23d9ea751e81dbf69 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 11:59:28 +0100 Subject: [PATCH 163/284] [ticket/11638] Updated: bitwise $parse_flags use optionset() sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index de76d1186d..303b9bb6da 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1381,8 +1381,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { - $include_bbcode_parse = $user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0; - $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $include_bbcode_parse | OPTION_FLAG_SMILIES, true); + $parse_flags = phpbb_optionset(OPTION_FLAG_SMILIES, true, 0); + $parse_flags = phpbb_optionset(OPTION_FLAG_BBCODE, $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flag); + $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $parse_flags, true); } // Parse the message and subject From 0dcf24acc10e7ad52bf47c39faf14b118fd1566d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 24 Jul 2013 12:41:40 +0200 Subject: [PATCH 164/284] [ticket/8228] Fix whitespaces before code in Firefox Based on the "[code] enhancements" modification by TerraFrost PHPBB3-8228 --- phpBB/styles/prosilver/template/bbcode.html | 4 ++-- phpBB/styles/prosilver/template/forum_fn.js | 5 +++-- phpBB/styles/prosilver/theme/colours.css | 2 +- phpBB/styles/prosilver/theme/content.css | 2 +- phpBB/styles/subsilver2/template/bbcode.html | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index c0c0a2da46..460d102c28 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -12,8 +12,8 @@
-
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}
-
+
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

+
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index eccb12e827..42a68a2ef5 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -187,7 +187,7 @@ function displayBlocks(c, e, t) { function selectCode(a) { // Get ID of code block - var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; + var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0]; var s, r; // Not IE and IE9+ @@ -205,7 +205,8 @@ function selectCode(a) { } r = document.createRange(); - r.selectNodeContents(e); + r.setStart(e.firstChild, 0); + r.setEnd(e.lastChild, e.lastChild.textContent.length); s.removeAllRanges(); s.addRange(r); } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 7d0462be1b..801d607d9c 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -479,7 +479,7 @@ dl.codebox dt { border-bottom-color: #CCCCCC; } -dl.codebox code { +dl.codebox pre { color: #2E8B57; } diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 4b8c972697..0cab12910b 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -491,7 +491,7 @@ blockquote dl.codebox { margin-left: 0; } -dl.codebox code { +dl.codebox pre { /* Also see tweaks.css */ overflow: auto; display: block; diff --git a/phpBB/styles/subsilver2/template/bbcode.html b/phpBB/styles/subsilver2/template/bbcode.html index efcf5e1acb..5558716cad 100644 --- a/phpBB/styles/subsilver2/template/bbcode.html +++ b/phpBB/styles/subsilver2/template/bbcode.html @@ -21,11 +21,11 @@ -
{L_CODE}{L_COLON}
+
{L_CODE}{L_COLON}
 
 
 
-
+ From 029015e1542e7719d4a35d350093f4dfb3a7313e Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 12:31:14 +0100 Subject: [PATCH 165/284] [ticket/11638] Reverted to use the $parse tags way as the other ones sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 303b9bb6da..a0e7eb6a94 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1381,9 +1381,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { - $parse_flags = phpbb_optionset(OPTION_FLAG_SMILIES, true, 0); - $parse_flags = phpbb_optionset(OPTION_FLAG_BBCODE, $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flag); - $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $parse_flags, true); + $parse_flags = ($user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true); } // Parse the message and subject From 6c68348a71891219b039ae98a5a0af2fd52d3956 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 12:31:38 +0100 Subject: [PATCH 166/284] [ticket/11638] Use the $parse_flags like the other commits sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a0e7eb6a94..151176fc6f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1386,7 +1386,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } // Parse the message and subject - $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); if (!empty($attachments[$row['post_id']])) { From 4cdccbd42b2f6ee54c6edb7f96ec3a0cac2ae8ea Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 24 Jul 2013 12:45:23 +0100 Subject: [PATCH 167/284] [ticket/11638] Removed the unneeded reset. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 151176fc6f..64006fbe61 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -830,7 +830,7 @@ if (!empty($topic_data['poll_start'])) $parse_bbcode_flags = OPTION_FLAG_SMILIES; - if(empty($poll_info[0]['bbcode_bitfield'])) + if (empty($poll_info[0]['bbcode_bitfield'])) { $parse_bbcode_flags |= OPTION_FLAG_BBCODE; } @@ -841,8 +841,6 @@ if (!empty($topic_data['poll_start'])) } $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_bbcode_flags, true); - - unset($parse_bbcode_flags); foreach ($poll_info as $poll_option) { From 27126e065dd6a8de44c9da718b4b5b9895544bb1 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 24 Jul 2013 17:22:10 +0200 Subject: [PATCH 168/284] [ticket/11741] Fix empty brackets and remove bullet PHPBB3-11741 --- phpBB/styles/subsilver2/template/overall_header.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index bc2307154b..b0d7ce6fab 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -154,8 +154,8 @@ function marklist(id, name, state) + + @@ -23,7 +25,33 @@ var text_name = 'signature'; // ]]> - + +
- - [ {NOTIFICATIONS_COUNT} ] • + + [ {NOTIFICATIONS_COUNT}
{L_NOTIFICATIONS} From 5af63a7860678ac55f84201cf7dbbdf82dcdc8e8 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 24 Jul 2013 18:15:03 +0200 Subject: [PATCH 169/284] [ticket/10917] Fixed notice that files are out of date when updating to an unreleased version PHPBB3-10917 --- phpBB/install/install_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index c18a0fb4ec..5393040061 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -204,7 +204,7 @@ class install_update extends module } // Check if the update files stored are for the latest version... - if ($this->latest_version != $this->update_info['version']['to']) + if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) { $this->unequal_version = true; From 98b385bc1c14a3155dd429f8d9118f4d7eb95556 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 11:59:21 -0500 Subject: [PATCH 170/284] [ticket/11628] Remove style resource locator No longer used since Twig was implemented. PHPBB3-11628 --- phpBB/config/services.yml | 4 - phpBB/includes/bbcode.php | 3 +- phpBB/install/index.php | 3 +- phpBB/phpbb/style/resource_locator.php | 348 ------------------------- phpBB/phpbb/style/style.php | 45 +--- phpBB/phpbb/template/locator.php | 163 ------------ 6 files changed, 3 insertions(+), 563 deletions(-) delete mode 100644 phpBB/phpbb/style/resource_locator.php delete mode 100644 phpBB/phpbb/template/locator.php diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 8abc413a5a..4902f4b6f6 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -258,13 +258,9 @@ services: - %core.php_ext% - @config - @user - - @style.resource_locator - @style.path_provider_ext - @template - style.resource_locator: - class: phpbb_style_resource_locator - style.path_provider_ext: class: phpbb_style_extension_path_provider arguments: diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index fd00728510..4ce6f17d90 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -132,10 +132,9 @@ class bbcode { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $style_resource_locator = new phpbb_style_resource_locator(); $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); - $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template); + $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_path_provider, $template); $style->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 45e5777e36..f924b05547 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -212,10 +212,9 @@ $config = new phpbb_config(array( 'load_tplcompile' => '1' )); -$phpbb_style_resource_locator = new phpbb_style_resource_locator(); $phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); +$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_var('T_ASSETS_PATH', '../assets'); diff --git a/phpBB/phpbb/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php deleted file mode 100644 index 4cf767c062..0000000000 --- a/phpBB/phpbb/style/resource_locator.php +++ /dev/null @@ -1,348 +0,0 @@ -set_default_template_path(); - } - - /** - * Sets the list of style paths - * - * These paths will be searched for style files in the provided order. - * Paths may be outside of phpBB, but templates loaded from these paths - * will still be cached. - * - * @param array $style_paths An array of paths to style directories - * @return null - */ - public function set_paths($style_paths) - { - $this->roots = array(); - $this->files = array(); - $this->filenames = array(); - - foreach ($style_paths as $key => $paths) - { - foreach ($paths as $path) - { - // Make sure $path has no ending slash - if (substr($path, -1) === '/') - { - $path = substr($path, 0, -1); - } - $this->roots[$key][] = $path; - } - } - } - - /** - * Sets the location of templates directory within style directories. - * - * The location must be a relative path, with a trailing slash. - * Typically it is one directory level deep, e.g. "template/". - * - * @param string $template_path Relative path to templates directory within style directories - * @return null - */ - public function set_template_path($template_path) - { - $this->template_path = $template_path; - } - - /** - * Sets the location of templates directory within style directories - * to the default, which is "template/". - * - * @return null - */ - public function set_default_template_path() - { - $this->template_path = 'template/'; - } - - /** - * {@inheritDoc} - */ - public function set_filenames(array $filename_array) - { - foreach ($filename_array as $handle => $filename) - { - if (empty($filename)) - { - trigger_error("style resource locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR); - } - - $this->filename[$handle] = $filename; - - foreach ($this->roots as $root_key => $root_paths) - { - foreach ($root_paths as $root_index => $root) - { - $this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename; - } - } - } - } - - /** - * {@inheritDoc} - */ - public function get_filename_for_handle($handle) - { - if (!isset($this->filename[$handle])) - { - trigger_error("style resource locator: get_filename_for_handle: No file specified for handle $handle", E_USER_ERROR); - } - return $this->filename[$handle]; - } - - /** - * {@inheritDoc} - */ - public function get_virtual_source_file_for_handle($handle) - { - // If we don't have a file assigned to this handle, die. - if (!isset($this->files['style'][0][$handle])) - { - trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); - } - - $source_file = $this->files['style'][0][$handle]; - return $source_file; - } - - /** - * {@inheritDoc} - */ - public function get_source_file_for_handle($handle, $find_all = false) - { - // If we don't have a file assigned to this handle, die. - if (!isset($this->files['style'][0][$handle])) - { - trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); - } - - // locate a source file that exists - $source_file = $this->files['style'][0][$handle]; - $tried = $source_file; - $found = false; - $found_all = array(); - foreach ($this->roots as $root_key => $root_paths) - { - foreach ($root_paths as $root_index => $root) - { - $source_file = $this->files[$root_key][$root_index][$handle]; - $tried .= ', ' . $source_file; - if (file_exists($source_file)) - { - $found = true; - break; - } - } - if ($found) - { - if ($find_all) - { - $found_all[] = $source_file; - $found = false; - } - else - { - break; - } - } - } - - // search failed - if (!$found && !$find_all) - { - trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); - } - - return ($find_all) ? $found_all : $source_file; - } - - /** - * {@inheritDoc} - */ - public function get_first_file_location($files, $return_default = false, $return_full_path = true) - { - // set default value - $default_result = false; - - // check all available paths - foreach ($this->roots as $root_paths) - { - foreach ($root_paths as $path) - { - // check all files - foreach ($files as $filename) - { - $source_file = $path . '/' . $filename; - if (file_exists($source_file)) - { - return ($return_full_path) ? $source_file : $filename; - } - - // assign first file as result if $return_default is true - if ($return_default && $default_result === false) - { - $default_result = $source_file; - } - } - } - } - - // search failed - return $default_result; - } - - /** - * Obtains filesystem path for a template file. - * - * The simplest use is specifying a single template file as a string - * in the first argument. This template file should be a basename - * of a template file in the selected style, or its parent styles - * if template inheritance is being utilized. - * - * Note: "selected style" is whatever style the style resource locator - * is configured for. - * - * The return value then will be a path, relative to the current - * directory or absolute, to the template file in the selected style - * or its closest parent. - * - * If the selected style does not have the template file being searched, - * (and if inheritance is involved, none of the parents have it either), - * false will be returned. - * - * Specifying true for $return_default will cause the function to - * return the first path which was checked for existence in the event - * that the template file was not found, instead of false. - * This is the path in the selected style itself, not any of its - * parents. - * - * $files can be given an array of templates instead of a single - * template. When given an array, the function will try to resolve - * each template in the array to a path, and will return the first - * path that exists, or false if none exist. - * - * If $files is an array and template inheritance is involved, first - * each of the files will be checked in the selected style, then each - * of the files will be checked in the immediate parent, and so on. - * - * If $return_full_path is false, then instead of returning a usable - * path (when the template is found) only the template's basename - * will be returned. This can be used to check which of the templates - * specified in $files exists. Naturally more than one template must - * be given in $files. - * - * This function works identically to get_first_file_location except - * it operates on a list of templates, not files. Practically speaking, - * the templates given in the first argument first are prepended with - * the template path (property in this class), then given to - * get_first_file_location for the rest of the processing. - * - * Templates given to this function can be relative paths for templates - * located in subdirectories of the template directories. The paths - * should be relative to the templates directory (template/ by default). - * - * @param string or array $files List of templates to locate. If there is only - * one template, $files can be a string to make code easier to read. - * @param bool $return_default Determines what to return if template does not - * exist. If true, function will return location where template is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to template. If false, function will return template file name. - * This parameter can be used to check which one of set of template - * files is available. - * @return string or boolean Source template path if template exists or $return_default is - * true. False if template does not exist and $return_default is false - */ - public function get_first_template_location($templates, $return_default = false, $return_full_path = true) - { - // add template path prefix - $files = array(); - if (is_string($templates)) - { - $files[] = $this->template_path . $templates; - } - else - { - foreach ($templates as $template) - { - $files[] = $this->template_path . $template; - } - } - - return $this->get_first_file_location($files, $return_default, $return_full_path); - } -} diff --git a/phpBB/phpbb/style/style.php b/phpBB/phpbb/style/style.php index 034f518091..9756fb74ac 100644 --- a/phpBB/phpbb/style/style.php +++ b/phpBB/phpbb/style/style.php @@ -52,12 +52,6 @@ class phpbb_style */ private $user; - /** - * Style resource locator - * @var phpbb_style_resource_locator - */ - private $locator; - /** * Style path provider * @var phpbb_style_path_provider @@ -69,17 +63,15 @@ class phpbb_style * * @param string $phpbb_root_path phpBB root path * @param user $user current user - * @param phpbb_style_resource_locator $locator style resource locator * @param phpbb_style_path_provider $provider style path provider * @param phpbb_template $template template */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template) + public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_path_provider_interface $provider, phpbb_template $template) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->config = $config; $this->user = $user; - $this->locator = $locator; $this->provider = $provider; $this->template = $template; } @@ -130,7 +122,6 @@ class phpbb_style } $this->provider->set_styles($paths); - $this->locator->set_paths($this->provider); $new_paths = array(); foreach ($paths as $path) @@ -168,12 +159,6 @@ class phpbb_style $this->names = $names; $this->provider->set_styles($paths); - $this->locator->set_paths($this->provider); - - if ($template_path !== false) - { - $this->locator->set_template_path($template_path); - } $new_paths = array(); foreach ($paths as $path) @@ -210,32 +195,4 @@ class phpbb_style { $this->provider->set_ext_dir_prefix($ext_dir_prefix); } - - /** - * Locates source file path, accounting for styles tree and verifying that - * the path exists. - * - * @param string or array $files List of files to locate. If there is only - * one file, $files can be a string to make code easier to read. - * @param bool $return_default Determines what to return if file does not - * exist. If true, function will return location where file is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to file. If false, function will return file name. This - * parameter can be used to check which one of set of files - * is available. - * @return string or boolean Source file path if file exists or $return_default is - * true. False if file does not exist and $return_default is false - */ - public function locate($files, $return_default = false, $return_full_path = true) - { - // convert string to array - if (is_string($files)) - { - $files = array($files); - } - - // use resource locator to find files - return $this->locator->get_first_file_location($files, $return_default, $return_full_path); - } } diff --git a/phpBB/phpbb/template/locator.php b/phpBB/phpbb/template/locator.php deleted file mode 100644 index f6fd20bcc2..0000000000 --- a/phpBB/phpbb/template/locator.php +++ /dev/null @@ -1,163 +0,0 @@ - filename pairs. - * - * @param array $filename_array Should be a hash of handle => filename pairs. - */ - public function set_filenames(array $filename_array); - - /** - * Determines the filename for a template handle. - * - * The filename comes from array used in a set_filenames call, - * which should have been performed prior to invoking this function. - * Return value is a file basename (without path). - * - * @param $handle string Template handle - * @return string Filename corresponding to the template handle - */ - public function get_filename_for_handle($handle); - - /** - * Determines the source file path for a template handle without - * regard for styles tree. - * - * This function returns the path in "primary" style directory - * corresponding to the given template handle. That path may or - * may not actually exist on the filesystem. Because this function - * does not perform stat calls to determine whether the path it - * returns actually exists, it is faster than get_source_file_for_handle. - * - * Use get_source_file_for_handle to obtain the actual path that is - * guaranteed to exist (which might come from the parent style - * directory if primary style has parent styles). - * - * This function will trigger an error if the handle was never - * associated with a template file via set_filenames. - * - * @param $handle string Template handle - * @return string Path to source file path in primary style directory - */ - public function get_virtual_source_file_for_handle($handle); - - /** - * Determines the source file path for a template handle, accounting - * for styles tree and verifying that the path exists. - * - * This function returns the actual path that may be compiled for - * the specified template handle. It will trigger an error if - * the template handle was never associated with a template path - * via set_filenames or if the template file does not exist on the - * filesystem. - * - * Use get_virtual_source_file_for_handle to just resolve a template - * handle to a path without any filesystem or styles tree checks. - * - * @param string $handle Template handle (i.e. "friendly" template name) - * @param bool $find_all If true, each root path will be checked and function - * will return array of files instead of string and will not - * trigger a error if template does not exist - * @return string Source file path - */ - public function get_source_file_for_handle($handle, $find_all = false); - - /** - * Obtains a complete filesystem path for a file in a style. - * - * This function traverses the style tree (selected style and - * its parents in order, if inheritance is being used) and finds - * the first file on the filesystem matching specified relative path, - * or the first of the specified paths if more than one path is given. - * - * This function can be used to determine filesystem path of any - * file under any style, with the consequence being that complete - * relative to the style directory path must be provided as an argument. - * - * In particular, this function can be used to locate templates - * and javascript files. - * - * For locating templates get_first_template_location should be used - * as it prepends the configured template path to the template basename. - * - * Note: "selected style" is whatever style the style resource locator - * is configured for. - * - * The return value then will be a path, relative to the current - * directory or absolute, to the first existing file in the selected - * style or its closest parent. - * - * If the selected style does not have the file being searched, - * (and if inheritance is involved, none of the parents have it either), - * false will be returned. - * - * Multiple files can be specified, in which case the first file in - * the list that can be found on the filesystem is returned. - * - * If multiple files are specified and inheritance is involved, - * first each of the specified files is checked in the selected style, - * then each of the specified files is checked in the immediate parent, - * etc. - * - * Specifying true for $return_default will cause the function to - * return the first path which was checked for existence in the event - * that the template file was not found, instead of false. - * This is always a path in the selected style itself, not any of its - * parents. - * - * If $return_full_path is false, then instead of returning a usable - * path (when the file is found) the file's path relative to the style - * directory will be returned. This is the same path as was given to - * the function as a parameter. This can be used to check which of the - * files specified in $files exists. Naturally this requires passing - * more than one file in $files. - * - * @param array $files List of files to locate. - * @param bool $return_default Determines what to return if file does not - * exist. If true, function will return location where file is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to file. If false, function will return file name. This - * parameter can be used to check which one of set of files - * is available. - * @return string or boolean Source file path if file exists or $return_default is - * true. False if file does not exist and $return_default is false - */ - public function get_first_file_location($files, $return_default = false, $return_full_path = true); -} From 44a82dd0837a4693b6a4a410c21c438f244094d3 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:05:04 -0500 Subject: [PATCH 171/284] [ticket/11628] Remove style path provider No longer used since Twig was implemented. PHPBB3-11628 --- phpBB/config/services.yml | 11 -- phpBB/includes/bbcode.php | 3 +- phpBB/install/index.php | 4 +- phpBB/phpbb/style/extension_path_provider.php | 137 ------------------ phpBB/phpbb/style/path_provider.php | 62 -------- phpBB/phpbb/style/path_provider_interface.php | 42 ------ phpBB/phpbb/style/style.php | 25 +--- tests/controller/helper_url_test.php | 5 +- tests/extension/style_path_provider_test.php | 50 ------- tests/template/template_events_test.php | 4 +- tests/template/template_test_case.php | 6 +- .../template/template_test_case_with_tree.php | 4 +- 12 files changed, 7 insertions(+), 346 deletions(-) delete mode 100644 phpBB/phpbb/style/extension_path_provider.php delete mode 100644 phpBB/phpbb/style/path_provider.php delete mode 100644 phpBB/phpbb/style/path_provider_interface.php delete mode 100644 tests/extension/style_path_provider_test.php diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 4902f4b6f6..7acc44f24d 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -258,19 +258,8 @@ services: - %core.php_ext% - @config - @user - - @style.path_provider_ext - @template - style.path_provider_ext: - class: phpbb_style_extension_path_provider - arguments: - - @ext.manager - - @style.path_provider - - %core.root_path% - - style.path_provider: - class: phpbb_style_path_provider - template: class: phpbb_template_twig arguments: diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 4ce6f17d90..9b1939030a 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -132,9 +132,8 @@ class bbcode { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); - $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_path_provider, $template); + $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); $style->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f924b05547..46660723ba 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -212,10 +212,8 @@ $config = new phpbb_config(array( 'load_tplcompile' => '1' )); -$phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_path_provider, $template); -$phpbb_style->set_ext_dir_prefix('adm/'); +$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/phpbb/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php deleted file mode 100644 index ec1d85f821..0000000000 --- a/phpBB/phpbb/style/extension_path_provider.php +++ /dev/null @@ -1,137 +0,0 @@ -base_path_provider = $base_path_provider; - $this->phpbb_root_path = $phpbb_root_path; - } - - /** - * Sets a prefix for style paths searched within extensions. - * - * The prefix is inserted between the extension's path e.g. ext/foo/ and - * the looked up style path, e.g. styles/bar/. So it should not have a - * leading slash, but should have a trailing slash. - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->ext_dir_prefix = $ext_dir_prefix; - } - - /** - * Finds style paths using the extension manager - * - * Locates a path (e.g. styles/prosilver/) in all active extensions. - * Then appends the core style paths based in the current working - * directory. - * - * @return array List of style paths - */ - public function find() - { - $directories = array(); - - $finder = $this->extension_manager->get_finder(); - foreach ($this->base_path_provider as $key => $paths) - { - if ($key == 'style') - { - foreach ($paths as $path) - { - $directories['style'][] = $path; - if ($path && !phpbb_is_absolute($path)) - { - // Remove phpBB root path from the style path, - // so the finder is able to find extension styles, - // when the root path is not ./ - if (strpos($path, $this->phpbb_root_path) === 0) - { - $path = substr($path, strlen($this->phpbb_root_path)); - } - - $result = $finder->directory('/' . $this->ext_dir_prefix . $path) - ->get_directories(true, false, true); - foreach ($result as $ext => $ext_path) - { - // Make sure $ext_path has no ending slash - if (substr($ext_path, -1) === '/') - { - $ext_path = substr($ext_path, 0, -1); - } - $directories[$ext][] = $ext_path; - } - } - } - } - } - - return $directories; - } - - /** - * Overwrites the current style paths - * - * @param array $styles An array of style paths. The first element is the main style. - * @return null - */ - public function set_styles(array $styles) - { - $this->base_path_provider->set_styles($styles); - $this->items = null; - } -} diff --git a/phpBB/phpbb/style/path_provider.php b/phpBB/phpbb/style/path_provider.php deleted file mode 100644 index 731d682e88..0000000000 --- a/phpBB/phpbb/style/path_provider.php +++ /dev/null @@ -1,62 +0,0 @@ -paths = array('style' => $styles); - } - - /** - * Retrieve an iterator over all style paths - * - * @return ArrayIterator An iterator for the array of style paths - */ - public function getIterator() - { - return new ArrayIterator($this->paths); - } -} diff --git a/phpBB/phpbb/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php deleted file mode 100644 index 1a6153a4d3..0000000000 --- a/phpBB/phpbb/style/path_provider_interface.php +++ /dev/null @@ -1,42 +0,0 @@ -phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->config = $config; $this->user = $user; - $this->provider = $provider; $this->template = $template; } @@ -121,8 +113,6 @@ class phpbb_style } } - $this->provider->set_styles($paths); - $new_paths = array(); foreach ($paths as $path) { @@ -158,8 +148,6 @@ class phpbb_style } $this->names = $names; - $this->provider->set_styles($paths); - $new_paths = array(); foreach ($paths as $path) { @@ -184,15 +172,4 @@ class phpbb_style { return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; } - - /** - * Defines a prefix to use for style paths in extensions - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->provider->set_ext_dir_prefix($ext_dir_prefix); - } } diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 6686b77e8f..29399af77a 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -48,12 +48,9 @@ class phpbb_controller_helper_url_test extends phpbb_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->style_resource_locator = new phpbb_style_resource_locator(); $this->user = $this->getMock('phpbb_user'); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->template); $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php deleted file mode 100644 index e1021c20ac..0000000000 --- a/tests/extension/style_path_provider_test.php +++ /dev/null @@ -1,50 +0,0 @@ -relative_root_path = './'; - $this->root_path = dirname(__FILE__) . '/'; - } - - public function test_find() - { - $phpbb_style_path_provider = new phpbb_style_path_provider(); - $phpbb_style_path_provider->set_styles(array($this->relative_root_path . 'styles/prosilver')); - $phpbb_style_extension_path_provider = new phpbb_style_extension_path_provider(new phpbb_mock_extension_manager( - $this->root_path, - array( - 'foo' => array( - 'ext_name' => 'foo', - 'ext_active' => '1', - 'ext_path' => 'ext/foo/', - ), - 'bar' => array( - 'ext_name' => 'bar', - 'ext_active' => '1', - 'ext_path' => 'ext/bar/', - ), - )), $phpbb_style_path_provider, $this->relative_root_path); - - $this->assertEquals(array( - 'style' => array( - $this->relative_root_path . 'styles/prosilver', - ), - 'bar' => array( - $this->root_path . 'ext/bar/styles/prosilver', - ), - ), $phpbb_style_extension_path_provider->find()); - } -} diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index f7bcd2dcc6..c3ebcb8739 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -103,13 +103,11 @@ Zeta test event in all', $config = new phpbb_config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . "/datasets/$dataset/styles/silver/template"; - $this->style_resource_locator = new phpbb_style_resource_locator(); $this->extension_manager = new phpbb_mock_filesystem_extension_manager( dirname(__FILE__) . "/datasets/$dataset/" ); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); - $this->style_provider = new phpbb_style_path_provider(); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->template); $this->style->set_custom_style('silver', array($this->template_path), $style_names, ''); } } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 6d87e5ebc0..87573a53fe 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -14,8 +14,6 @@ class phpbb_template_template_test_case extends phpbb_test_case protected $style; protected $template; protected $template_path; - protected $style_resource_locator; - protected $style_provider; protected $user; protected $test_path = 'tests/template'; @@ -67,10 +65,8 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->user = new phpbb_user; $this->template_path = $this->test_path . '/templates'; - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->template); $this->style->set_custom_style('tests', $this->template_path, array(), ''); } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 4b8cbada45..50a6e9190d 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -20,10 +20,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $this->style_resource_locator = new phpbb_style_resource_locator(); - $this->style_provider = new phpbb_style_path_provider(); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->template); $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), ''); } } From e80503696350d7410e82e63e9d108d65e3c35696 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 24 Jul 2013 19:08:49 +0200 Subject: [PATCH 172/284] [ticket/10917] Using phpbb wrapper PHPBB3-10917 --- phpBB/install/install_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 5393040061..5419e3edf1 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -204,7 +204,7 @@ class install_update extends module } // Check if the update files stored are for the latest version... - if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) + if (phpbb_version_compare($this->latest_version, $this->update_info['version']['to'], '>')) { $this->unequal_version = true; From 5d1afb453211d42a8deacb66684c136385918192 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:24:35 -0500 Subject: [PATCH 173/284] [ticket/11628] Remove phpbb_style (move methods to phpbb_template) PHPBB3-11628 --- phpBB/adm/index.php | 2 +- phpBB/adm/swatch.php | 2 +- phpBB/common.php | 1 - phpBB/config/services.yml | 11 +- phpBB/includes/bbcode.php | 3 +- phpBB/includes/functions_module.php | 6 +- phpBB/install/index.php | 3 +- phpBB/install/install_update.php | 4 +- phpBB/phpbb/controller/resolver.php | 16 +- phpBB/phpbb/style/style.php | 175 ------------------ phpBB/phpbb/template/template.php | 30 +++ phpBB/phpbb/template/twig/twig.php | 107 ++++++++++- phpBB/phpbb/user.php | 4 +- tests/controller/helper_url_test.php | 1 - tests/template/includephp_test.php | 2 +- tests/template/template_events_test.php | 3 +- tests/template/template_test.php | 2 +- tests/template/template_test_case.php | 4 +- .../template/template_test_case_with_tree.php | 3 +- 19 files changed, 161 insertions(+), 218 deletions(-) delete mode 100644 phpBB/phpbb/style/style.php diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 8cd1967c75..3f29072899 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,7 +50,7 @@ $module_id = request_var('i', ''); $mode = request_var('mode', ''); // Set custom style for admin area -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index 3ae38d0d8b..70441ffeed 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -22,7 +22,7 @@ $auth->acl($user->data); $user->setup(); // Set custom template for admin area -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->set_filenames(array( 'body' => 'colour_swatch.html') diff --git a/phpBB/common.php b/phpBB/common.php index 962a1f951f..6a1f307d64 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -121,7 +121,6 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); $template = $phpbb_container->get('template'); -$phpbb_style = $phpbb_container->get('style'); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 7acc44f24d..d0753322da 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -98,7 +98,7 @@ services: arguments: - @user - @service_container - - @style + - @template cron.task_collection: class: phpbb_di_service_collection @@ -251,15 +251,6 @@ services: request: class: phpbb_request - style: - class: phpbb_style - arguments: - - %core.root_path% - - %core.php_ext% - - @config - - @user - - @template - template: class: phpbb_template_twig arguments: diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 9b1939030a..2fa6a8b099 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -133,8 +133,7 @@ class bbcode $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); - $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); - $style->set_style(); + $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 99c24fcb19..a5ece1ecac 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -455,7 +455,7 @@ class p_master */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $phpbb_style; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template; $module_path = $this->include_path . $this->p_class; $icat = request_var('icat', ''); @@ -508,7 +508,7 @@ class p_master if (is_dir($module_style_dir)) { - $phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), ''); + $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), ''); } } @@ -537,7 +537,7 @@ class p_master if (is_dir($phpbb_root_path . $module_style_dir)) { - $phpbb_style->set_style(array($module_style_dir, 'styles')); + $template->set_style(array($module_style_dir, 'styles')); } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 46660723ba..fd0d8a2d48 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -213,8 +213,7 @@ $config = new phpbb_config(array( )); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index df9b6c1c7e..51fbd1975c 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -71,7 +71,7 @@ class install_update extends module function main($mode, $sub) { - global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; + global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; // Create a normal container now @@ -138,7 +138,7 @@ class install_update extends module } // Set custom template again. ;) - $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + $template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 95dfc8da8e..850df84a0f 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -38,23 +38,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface protected $container; /** - * phpbb_style object - * @var phpbb_style + * phpbb_template object + * @var phpbb_template */ - protected $style; + protected $template; /** * Construct method * * @param phpbb_user $user User Object * @param ContainerInterface $container ContainerInterface object - * @param phpbb_style $style + * @param phpbb_template_interface $template */ - public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null) + public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_template $template = null) { $this->user = $user; $this->container = $container; - $this->style = $style; + $this->template = $template; } /** @@ -96,13 +96,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface $controller_dir = explode('_', get_class($controller_object)); // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') + if (!is_null($this->template) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') { $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles'; if (is_dir($controller_style_dir)) { - $this->style->set_style(array($controller_style_dir, 'styles')); + $this->template->set_style(array($controller_style_dir, 'styles')); } } diff --git a/phpBB/phpbb/style/style.php b/phpBB/phpbb/style/style.php deleted file mode 100644 index 283e3015ca..0000000000 --- a/phpBB/phpbb/style/style.php +++ /dev/null @@ -1,175 +0,0 @@ -phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; - $this->config = $config; - $this->user = $user; - $this->template = $template; - } - - /** - * Get the style tree of the style preferred by the current user - * - * @return array Style tree, most specific first - */ - public function get_user_style() - { - $style_list = array( - $this->user->style['style_path'], - ); - - if ($this->user->style['style_parent_id']) - { - $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree']))); - } - - return $style_list; - } - - /** - * Set style location based on (current) user's chosen style. - * - * @param array $style_directories The directories to add style paths for - * E.g. array('ext/foo/bar/styles', 'styles') - * Default: array('styles') (phpBB's style directory) - * @return bool true - */ - public function set_style($style_directories = array('styles')) - { - $this->names = $this->get_user_style(); - - $paths = array(); - foreach ($style_directories as $directory) - { - foreach ($this->names as $name) - { - $path = $this->get_style_path($name, $directory); - - if (is_dir($path)) - { - $paths[] = $path; - } - } - } - - $new_paths = array(); - foreach ($paths as $path) - { - $new_paths[] = $path . '/template/'; - } - - $this->template->set_style_names($this->names, $new_paths, ($style_directories === array('styles'))); - - return true; - } - - /** - * Set custom style location (able to use directory outside of phpBB). - * - * Note: Templates are still compiled to phpBB's cache directory. - * - * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" - * @param array or string $paths Array of style paths, relative to current root directory - * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. - * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). - * @return bool true - */ - public function set_custom_style($name, $paths, $names = array(), $template_path = false) - { - if (is_string($paths)) - { - $paths = array($paths); - } - - if (empty($names)) - { - $names = array($name); - } - $this->names = $names; - - $new_paths = array(); - foreach ($paths as $path) - { - $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/'); - } - - $this->template->set_style_names($names, $new_paths); - - return true; - } - - /** - * Get location of style directory for specific style_path - * - * @param string $path Style path, such as "prosilver" - * @param string $style_base_directory The base directory the style is in - * E.g. 'styles', 'ext/foo/bar/styles' - * Default: 'styles' - * @return string Path to style directory, relative to current path - */ - public function get_style_path($path, $style_base_directory = 'styles') - { - return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; - } -} diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 89a01e924d..537c4eaf01 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -33,6 +33,36 @@ interface phpbb_template */ public function set_filenames(array $filename_array); + /** + * Get the style tree of the style preferred by the current user + * + * @return array Style tree, most specific first + */ + public function get_user_style(); + + /** + * Set style location based on (current) user's chosen style. + * + * @param array $style_directories The directories to add style paths for + * E.g. array('ext/foo/bar/styles', 'styles') + * Default: array('styles') (phpBB's style directory) + * @return bool true + */ + public function set_style($style_directories = array('styles')); + + /** + * Set custom style location (able to use directory outside of phpBB). + * + * Note: Templates are still compiled to phpBB's cache directory. + * + * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" + * @param array or string $paths Array of style paths, relative to current root directory + * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. + * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). + * @return bool true + */ + public function set_custom_style($name, $paths, $names = array(), $template_path = false); + /** * Sets the style names/paths corresponding to style hierarchy being compiled * and/or rendered. diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 92a37d1634..92a52d26b8 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -177,6 +177,97 @@ class phpbb_template_twig implements phpbb_template return $this; } + /** + * Get the style tree of the style preferred by the current user + * + * @return array Style tree, most specific first + */ + public function get_user_style() + { + $style_list = array( + $this->user->style['style_path'], + ); + + if ($this->user->style['style_parent_id']) + { + $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree']))); + } + + return $style_list; + } + + /** + * Set style location based on (current) user's chosen style. + * + * @param array $style_directories The directories to add style paths for + * E.g. array('ext/foo/bar/styles', 'styles') + * Default: array('styles') (phpBB's style directory) + * @return bool true + */ + public function set_style($style_directories = array('styles')) + { + $this->names = $this->get_user_style(); + + $paths = array(); + foreach ($style_directories as $directory) + { + foreach ($this->names as $name) + { + $path = $this->get_style_path($name, $directory); + + if (is_dir($path)) + { + $paths[] = $path; + } + } + } + + $new_paths = array(); + foreach ($paths as $path) + { + $new_paths[] = $path . '/template/'; + } + + $this->set_style_names($this->names, $new_paths, ($style_directories === array('styles'))); + + return true; + } + + /** + * Set custom style location (able to use directory outside of phpBB). + * + * Note: Templates are still compiled to phpBB's cache directory. + * + * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" + * @param array or string $paths Array of style paths, relative to current root directory + * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. + * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). + * @return bool true + */ + public function set_custom_style($name, $paths, $names = array(), $template_path = false) + { + if (is_string($paths)) + { + $paths = array($paths); + } + + if (empty($names)) + { + $names = array($name); + } + $this->names = $names; + + $new_paths = array(); + foreach ($paths as $path) + { + $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/'); + } + + $this->set_style_names($names, $new_paths); + + return true; + } + /** * Sets the style names/paths corresponding to style hierarchy being compiled * and/or rendered. @@ -194,7 +285,7 @@ class phpbb_template_twig implements phpbb_template // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); - // Core style namespace from phpbb_style::set_style() + // Core style namespace from this::set_style() if ($is_core) { $this->twig->getLoader()->setPaths($style_paths, 'core'); @@ -462,4 +553,18 @@ class phpbb_template_twig implements phpbb_template { return $this->twig->getLoader()->getCacheKey($this->get_filename_from_handle($handle)); } + + /** + * Get location of style directory for specific style_path + * + * @param string $path Style path, such as "prosilver" + * @param string $style_base_directory The base directory the style is in + * E.g. 'styles', 'ext/foo/bar/styles' + * Default: 'styles' + * @return string Path to style directory, relative to current path + */ + protected function get_style_path($path, $style_base_directory = 'styles') + { + return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; + } } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 5530fe3f03..2828bab6a8 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -75,7 +75,7 @@ class phpbb_user extends phpbb_session */ function setup($lang_set = false, $style_id = false) { - global $db, $phpbb_style, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; global $phpbb_dispatcher; if ($this->data['user_id'] != ANONYMOUS) @@ -236,7 +236,7 @@ class phpbb_user extends phpbb_session } } - $phpbb_style->set_style(); + $template->set_style(); $this->img_lang = $this->lang_name; diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 29399af77a..fc7d02e9cf 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -50,7 +50,6 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $this->user = $this->getMock('phpbb_user'); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->template); $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index ff7b890d11..1afa933514 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -46,7 +46,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->style->set_custom_style('tests', $cache_dir, array(), ''); + $this->template->set_custom_style('tests', $cache_dir, array(), ''); $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php"); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index c3ebcb8739..7de3ebbfae 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -107,7 +107,6 @@ Zeta test event in all', dirname(__FILE__) . "/datasets/$dataset/" ); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->template); - $this->style->set_custom_style('silver', array($this->template_path), $style_names, ''); + $this->template->set_custom_style('silver', array($this->template_path), $style_names, ''); } } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index dd9ba21c26..3989f10229 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -410,7 +410,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->style->set_custom_style('tests', $cache_dir, array(), ''); + $this->template->set_custom_style('tests', $cache_dir, array(), ''); $this->run_template('php.html', array(), array(), array(), 'test'); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 87573a53fe..f90d291d15 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -11,7 +11,6 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_template_template_test_case extends phpbb_test_case { - protected $style; protected $template; protected $template_path; protected $user; @@ -66,8 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template_path = $this->test_path . '/templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->template); - $this->style->set_custom_style('tests', $this->template_path, array(), ''); + $this->template->set_custom_style('tests', $this->template_path, array(), ''); } protected function setUp() diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 50a6e9190d..7de719f430 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -21,7 +21,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->template); - $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), ''); + $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), ''); } } From 85ff05bec635e8e6ef0fb64a561e2dd400b53897 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:34:22 -0500 Subject: [PATCH 174/284] [ticket/11628] Remove $this->names, $this->style_names from phpbb_template These are not used anywhere PHPBB3-11628 --- phpBB/phpbb/template/twig/twig.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 92a52d26b8..4ae918ed86 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -74,16 +74,6 @@ class phpbb_template_twig implements phpbb_template */ protected $extension_manager; - /** - * Name of the style that the template being compiled and/or rendered - * belongs to, and its parents, in inheritance tree order. - * - * Used to invoke style-specific template events. - * - * @var array - */ - protected $style_names; - /** * Twig Environment * @@ -206,12 +196,12 @@ class phpbb_template_twig implements phpbb_template */ public function set_style($style_directories = array('styles')) { - $this->names = $this->get_user_style(); + $names = $this->get_user_style(); $paths = array(); foreach ($style_directories as $directory) { - foreach ($this->names as $name) + foreach ($names as $name) { $path = $this->get_style_path($name, $directory); @@ -228,7 +218,7 @@ class phpbb_template_twig implements phpbb_template $new_paths[] = $path . '/template/'; } - $this->set_style_names($this->names, $new_paths, ($style_directories === array('styles'))); + $this->set_style_names($names, $new_paths, ($style_directories === array('styles'))); return true; } @@ -255,7 +245,6 @@ class phpbb_template_twig implements phpbb_template { $names = array($name); } - $this->names = $names; $new_paths = array(); foreach ($paths as $path) @@ -280,8 +269,6 @@ class phpbb_template_twig implements phpbb_template */ public function set_style_names(array $style_names, array $style_paths, $is_core = false) { - $this->style_names = $style_names; - // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); From ecaed319ab46ee4dd45fe788a05aaeff96afc1d2 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:42:37 -0500 Subject: [PATCH 175/284] [ticket/11628] Move setting core namespace to set_style() PHPBB3-11628 --- phpBB/phpbb/template/twig/twig.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 4ae918ed86..eb84da20dc 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -196,6 +196,12 @@ class phpbb_template_twig implements phpbb_template */ public function set_style($style_directories = array('styles')) { + if ($style_directories !== array('styles') && $this->twig->getLoader()->getPaths('core') === array()) + { + // We should set up the core styles path since not already setup + $this->set_style(); + } + $names = $this->get_user_style(); $paths = array(); @@ -203,7 +209,7 @@ class phpbb_template_twig implements phpbb_template { foreach ($names as $name) { - $path = $this->get_style_path($name, $directory); + $path = $this->get_style_path($name, $directory) . 'template/'; if (is_dir($path)) { @@ -212,13 +218,15 @@ class phpbb_template_twig implements phpbb_template } } - $new_paths = array(); - foreach ($paths as $path) + // If we're setting up the main phpBB styles directory and the core + // namespace isn't setup yet, we will set it up now + if ($style_directories === array('styles') && $this->twig->getLoader()->getPaths('core') === array()) { - $new_paths[] = $path . '/template/'; + // Set up the core style paths namespace + $this->twig->getLoader()->setPaths($paths, 'core'); } - $this->set_style_names($names, $new_paths, ($style_directories === array('styles'))); + $this->set_style_names($names, $paths); return true; } @@ -263,21 +271,13 @@ class phpbb_template_twig implements phpbb_template * * @param array $style_names List of style names in inheritance tree order * @param array $style_paths List of style paths in inheritance tree order - * @param bool $is_core True if the style names are the "core" styles for this page load - * Core means the main phpBB template files * @return phpbb_template $this */ - public function set_style_names(array $style_names, array $style_paths, $is_core = false) + public function set_style_names(array $style_names, array $style_paths) { // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); - // Core style namespace from this::set_style() - if ($is_core) - { - $this->twig->getLoader()->setPaths($style_paths, 'core'); - } - // Add admin namespace if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/')) { @@ -552,6 +552,6 @@ class phpbb_template_twig implements phpbb_template */ protected function get_style_path($path, $style_base_directory = 'styles') { - return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; + return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . rtrim($path, '/') . '/'; } } From bfbc7aa74250ea5e9e39efc63caf7cfdb9407e14 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:45:35 -0500 Subject: [PATCH 176/284] [ticket/11628] Return $this from set_style, set_custom_style PHPBB3-11628 --- phpBB/phpbb/template/template.php | 4 ++-- phpBB/phpbb/template/twig/twig.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 537c4eaf01..95a48ba0ad 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -46,7 +46,7 @@ interface phpbb_template * @param array $style_directories The directories to add style paths for * E.g. array('ext/foo/bar/styles', 'styles') * Default: array('styles') (phpBB's style directory) - * @return bool true + * @return phpbb_template $this */ public function set_style($style_directories = array('styles')); @@ -59,7 +59,7 @@ interface phpbb_template * @param array or string $paths Array of style paths, relative to current root directory * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). - * @return bool true + * @return phpbb_template $this */ public function set_custom_style($name, $paths, $names = array(), $template_path = false); diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index eb84da20dc..48ea8edeb1 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -192,7 +192,7 @@ class phpbb_template_twig implements phpbb_template * @param array $style_directories The directories to add style paths for * E.g. array('ext/foo/bar/styles', 'styles') * Default: array('styles') (phpBB's style directory) - * @return bool true + * @return phpbb_template $this */ public function set_style($style_directories = array('styles')) { @@ -228,7 +228,7 @@ class phpbb_template_twig implements phpbb_template $this->set_style_names($names, $paths); - return true; + return $this; } /** @@ -240,7 +240,7 @@ class phpbb_template_twig implements phpbb_template * @param array or string $paths Array of style paths, relative to current root directory * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). - * @return bool true + * @return phpbb_template $this */ public function set_custom_style($name, $paths, $names = array(), $template_path = false) { @@ -262,7 +262,7 @@ class phpbb_template_twig implements phpbb_template $this->set_style_names($names, $new_paths); - return true; + return $this; } /** From 4b761f65758c40db4851983fa3a08d354da3323d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:55:41 -0500 Subject: [PATCH 177/284] [ticket/11628] Remove third parameter ($names) from set_custom_style This was basically duplicating functionality. $names would be used if not empty, else array($name) would be used. Merged functionality into the first argument PHPBB3-11628 --- phpBB/adm/index.php | 2 +- phpBB/adm/swatch.php | 2 +- phpBB/includes/functions_module.php | 2 +- phpBB/install/index.php | 2 +- phpBB/install/install_update.php | 2 +- phpBB/phpbb/template/template.php | 5 ++--- phpBB/phpbb/template/twig/twig.php | 9 ++++----- tests/template/includephp_test.php | 2 +- tests/template/template_events_test.php | 2 +- tests/template/template_test.php | 2 +- tests/template/template_test_case.php | 2 +- tests/template/template_test_case_with_tree.php | 2 +- 12 files changed, 16 insertions(+), 18 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 3f29072899..c79327d22c 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,7 +50,7 @@ $module_id = request_var('i', ''); $mode = request_var('mode', ''); // Set custom style for admin area -$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index 70441ffeed..ef89081dc8 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -22,7 +22,7 @@ $auth->acl($user->data); $user->setup(); // Set custom template for admin area -$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->set_filenames(array( 'body' => 'colour_swatch.html') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index a5ece1ecac..c84e02afe6 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -508,7 +508,7 @@ class p_master if (is_dir($module_style_dir)) { - $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), ''); + $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), ''); } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index fd0d8a2d48..f80b975e2c 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -213,7 +213,7 @@ $config = new phpbb_config(array( )); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 51fbd1975c..63f10c96d7 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -138,7 +138,7 @@ class install_update extends module } // Set custom template again. ;) - $template->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + $template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 95a48ba0ad..c77586587f 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -55,13 +55,12 @@ interface phpbb_template * * Note: Templates are still compiled to phpBB's cache directory. * - * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" + * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). * @return phpbb_template $this */ - public function set_custom_style($name, $paths, $names = array(), $template_path = false); + public function set_custom_style($names, $paths, $template_path = false); /** * Sets the style names/paths corresponding to style hierarchy being compiled diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 48ea8edeb1..c9249196e7 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -236,22 +236,21 @@ class phpbb_template_twig implements phpbb_template * * Note: Templates are still compiled to phpBB's cache directory. * - * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" + * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). * @return phpbb_template $this */ - public function set_custom_style($name, $paths, $names = array(), $template_path = false) + public function set_custom_style($names, $paths, $template_path = false) { if (is_string($paths)) { $paths = array($paths); } - if (empty($names)) + if (!is_array($names)) { - $names = array($name); + $names = array($names); } $new_paths = array(); diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index 1afa933514..70e7cea232 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -46,7 +46,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->template->set_custom_style('tests', $cache_dir, array(), ''); + $this->template->set_custom_style('tests', $cache_dir, ''); $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php"); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 7de3ebbfae..1b2ab38e2b 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -107,6 +107,6 @@ Zeta test event in all', dirname(__FILE__) . "/datasets/$dataset/" ); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); - $this->template->set_custom_style('silver', array($this->template_path), $style_names, ''); + $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path), ''); } } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 3989f10229..0cc53f4d07 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -410,7 +410,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->template->set_custom_style('tests', $cache_dir, array(), ''); + $this->template->set_custom_style('tests', $cache_dir, ''); $this->run_template('php.html', array(), array(), array(), 'test'); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index f90d291d15..00c89e4501 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -65,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template_path = $this->test_path . '/templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->template->set_custom_style('tests', $this->template_path, array(), ''); + $this->template->set_custom_style('tests', $this->template_path, ''); } protected function setUp() diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 7de719f430..1a29fd27b0 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -21,6 +21,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); - $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), ''); + $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); } } From 67627f3336f7a90a7de67427d25c8cdd43d74f6e Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:01:30 -0500 Subject: [PATCH 178/284] [ticket/11628] Change set_custom_style $template path to default to string Rather than default to false and compare === false ? 'template/' : value just assign this default in the arguments PHPBB3-11628 --- phpBB/phpbb/template/template.php | 4 ++-- phpBB/phpbb/template/twig/twig.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index c77586587f..c929934376 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -57,10 +57,10 @@ interface phpbb_template * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). + * @param string $template_path Path to templates, relative to style directory. Default (template/). * @return phpbb_template $this */ - public function set_custom_style($names, $paths, $template_path = false); + public function set_custom_style($names, $paths, $template_path = 'template/'); /** * Sets the style names/paths corresponding to style hierarchy being compiled diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index c9249196e7..5537b1195c 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -238,10 +238,10 @@ class phpbb_template_twig implements phpbb_template * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). + * @param string $template_path Path to templates, relative to style directory. Default (template/). * @return phpbb_template $this */ - public function set_custom_style($names, $paths, $template_path = false) + public function set_custom_style($names, $paths, $template_path = 'template/') { if (is_string($paths)) { @@ -256,7 +256,7 @@ class phpbb_template_twig implements phpbb_template $new_paths = array(); foreach ($paths as $path) { - $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/'); + $new_paths[] = $path . '/' . ltrim($template_path, '/'); } $this->set_style_names($names, $new_paths); From 44142782095f4a847e575dde40faef867c704220 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:04:27 -0500 Subject: [PATCH 179/284] [ticket/11628] Set admin namespace in the constructor PHPBB3-11628 --- phpBB/phpbb/template/twig/twig.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 5537b1195c..72ba70ecc4 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -43,12 +43,6 @@ class phpbb_template_twig implements phpbb_template */ protected $phpbb_root_path; - /** - * adm relative path - * @var string - */ - protected $adm_relative_path; - /** * PHP file extension * @var string @@ -102,7 +96,6 @@ class phpbb_template_twig implements phpbb_template public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null) { $this->phpbb_root_path = $phpbb_root_path; - $this->adm_relative_path = $adm_relative_path; $this->php_ext = $php_ext; $this->config = $config; $this->user = $user; @@ -137,6 +130,12 @@ class phpbb_template_twig implements phpbb_template $lexer = new phpbb_template_twig_lexer($this->twig); $this->twig->setLexer($lexer); + + // Add admin namespace + if ($adm_relative_path !== null && is_dir($this->phpbb_root_path . $adm_relative_path . 'style/')) + { + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $adm_relative_path . 'style/', 'admin'); + } } /** @@ -277,12 +276,6 @@ class phpbb_template_twig implements phpbb_template // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); - // Add admin namespace - if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/')) - { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->adm_relative_path . 'style/', 'admin'); - } - // Add all namespaces for all extensions if ($this->extension_manager instanceof phpbb_extension_manager) { From 863592a8bedbacf3e7bf6bee458797e819020e6f Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:19:20 -0500 Subject: [PATCH 180/284] [ticket/11628] Remove set_style_names function, moved to set_custom_style PHPBB3-11628 --- phpBB/includes/functions_messenger.php | 2 +- phpBB/phpbb/template/template.php | 10 ---------- phpBB/phpbb/template/twig/twig.php | 27 ++++++-------------------- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 0222a57bcc..89dd3c70fc 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -660,7 +660,7 @@ class messenger { $this->setup_template(); - $this->template->set_style_names(array($path_name), $paths); + $this->template->set_custom_style($path_name, $paths, ''); } } diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index c929934376..8554365c95 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -62,16 +62,6 @@ interface phpbb_template */ public function set_custom_style($names, $paths, $template_path = 'template/'); - /** - * Sets the style names/paths corresponding to style hierarchy being compiled - * and/or rendered. - * - * @param array $style_names List of style names in inheritance tree order - * @param array $style_paths List of style paths in inheritance tree order - * @return phpbb_template $this - */ - public function set_style_names(array $style_names, array $style_paths); - /** * Clears all variables and blocks assigned to this template. * diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 72ba70ecc4..26f454e972 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -225,7 +225,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->getLoader()->setPaths($paths, 'core'); } - $this->set_style_names($names, $paths); + $this->set_custom_style($names, $paths, ''); return $this; } @@ -247,39 +247,24 @@ class phpbb_template_twig implements phpbb_template $paths = array($paths); } - if (!is_array($names)) + if (is_string($names)) { $names = array($names); } - $new_paths = array(); + $style_paths = array(); foreach ($paths as $path) { - $new_paths[] = $path . '/' . ltrim($template_path, '/'); + $style_paths[] = $path . '/' . ltrim($template_path, '/'); } - $this->set_style_names($names, $new_paths); - - return $this; - } - - /** - * Sets the style names/paths corresponding to style hierarchy being compiled - * and/or rendered. - * - * @param array $style_names List of style names in inheritance tree order - * @param array $style_paths List of style paths in inheritance tree order - * @return phpbb_template $this - */ - public function set_style_names(array $style_names, array $style_paths) - { // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); // Add all namespaces for all extensions if ($this->extension_manager instanceof phpbb_extension_manager) { - $style_names[] = 'all'; + $names[] = 'all'; foreach ($this->extension_manager->all_enabled() as $ext_namespace => $ext_path) { @@ -287,7 +272,7 @@ class phpbb_template_twig implements phpbb_template $namespace = str_replace('/', '_', $ext_namespace); $paths = array(); - foreach ($style_names as $style_name) + foreach ($names as $style_name) { $ext_style_path = $ext_path . 'styles/' . $style_name . '/template'; From 12c22585069066957cc3211136ebd480295d4758 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:25:20 -0500 Subject: [PATCH 181/284] [ticket/11628] Remove template_path option on set_custom_style This was set to default 'template/' to append template/ to all the paths, but every location was actually just setting it to '' to not append anything. So removed the option entirely (additional paths can be appended to the paths being sent to the function already) PHPBB3-11628 --- phpBB/adm/index.php | 2 +- phpBB/adm/swatch.php | 2 +- phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/functions_module.php | 2 +- phpBB/install/index.php | 2 +- phpBB/install/install_update.php | 2 +- phpBB/phpbb/template/template.php | 3 +-- phpBB/phpbb/template/twig/twig.php | 13 +++---------- tests/template/includephp_test.php | 2 +- tests/template/template_events_test.php | 2 +- tests/template/template_test.php | 2 +- tests/template/template_test_case.php | 2 +- tests/template/template_test_case_with_tree.php | 2 +- 13 files changed, 15 insertions(+), 23 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c79327d22c..3520eb8b70 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,7 +50,7 @@ $module_id = request_var('i', ''); $mode = request_var('mode', ''); // Set custom style for admin area -$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index ef89081dc8..cdd6bf3969 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -22,7 +22,7 @@ $auth->acl($user->data); $user->setup(); // Set custom template for admin area -$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->set_filenames(array( 'body' => 'colour_swatch.html') diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 89dd3c70fc..3a9e1fa77b 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -660,7 +660,7 @@ class messenger { $this->setup_template(); - $this->template->set_custom_style($path_name, $paths, ''); + $this->template->set_custom_style($path_name, $paths); } } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index c84e02afe6..8f0f6a837a 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -508,7 +508,7 @@ class p_master if (is_dir($module_style_dir)) { - $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), ''); + $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style')); } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f80b975e2c..84d751e279 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -213,7 +213,7 @@ $config = new phpbb_config(array( )); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 63f10c96d7..a105944fb3 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -138,7 +138,7 @@ class install_update extends module } // Set custom template again. ;) - $template->set_custom_style('admin', $phpbb_admin_path . 'style', ''); + $template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 8554365c95..9881938a8f 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -57,10 +57,9 @@ interface phpbb_template * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param string $template_path Path to templates, relative to style directory. Default (template/). * @return phpbb_template $this */ - public function set_custom_style($names, $paths, $template_path = 'template/'); + public function set_custom_style($names, $paths); /** * Clears all variables and blocks assigned to this template. diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 26f454e972..4aa1774ef4 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -225,7 +225,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->getLoader()->setPaths($paths, 'core'); } - $this->set_custom_style($names, $paths, ''); + $this->set_custom_style($names, $paths); return $this; } @@ -237,10 +237,9 @@ class phpbb_template_twig implements phpbb_template * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. * @param array or string $paths Array of style paths, relative to current root directory - * @param string $template_path Path to templates, relative to style directory. Default (template/). * @return phpbb_template $this */ - public function set_custom_style($names, $paths, $template_path = 'template/') + public function set_custom_style($names, $paths) { if (is_string($paths)) { @@ -252,14 +251,8 @@ class phpbb_template_twig implements phpbb_template $names = array($names); } - $style_paths = array(); - foreach ($paths as $path) - { - $style_paths[] = $path . '/' . ltrim($template_path, '/'); - } - // Set as __main__ namespace - $this->twig->getLoader()->setPaths($style_paths); + $this->twig->getLoader()->setPaths($paths); // Add all namespaces for all extensions if ($this->extension_manager instanceof phpbb_extension_manager) diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index 70e7cea232..a0dd8368cf 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -46,7 +46,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->template->set_custom_style('tests', $cache_dir, ''); + $this->template->set_custom_style('tests', $cache_dir); $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php"); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 1b2ab38e2b..f0cdeb39c5 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -107,6 +107,6 @@ Zeta test event in all', dirname(__FILE__) . "/datasets/$dataset/" ); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); - $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path), ''); + $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path)); } } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0cc53f4d07..2f3ca6e313 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -410,7 +410,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->template->set_custom_style('tests', $cache_dir, ''); + $this->template->set_custom_style('tests', $cache_dir); $this->run_template('php.html', array(), array(), array(), 'test'); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 00c89e4501..91895502ad 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -65,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template_path = $this->test_path . '/templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); - $this->template->set_custom_style('tests', $this->template_path, ''); + $this->template->set_custom_style('tests', $this->template_path); } protected function setUp() diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 1a29fd27b0..477192c28a 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -21,6 +21,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); - $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path), ''); + $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } } From 3b46f77e4e77defdd7c38249c865fdaecd83629e Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:26:55 -0500 Subject: [PATCH 182/284] [ticket/11628] Shorten an if to an inline statement PHPBB3-11628 --- phpBB/phpbb/template/twig/twig.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 4aa1774ef4..c3ed52c3bd 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -241,15 +241,8 @@ class phpbb_template_twig implements phpbb_template */ public function set_custom_style($names, $paths) { - if (is_string($paths)) - { - $paths = array($paths); - } - - if (is_string($names)) - { - $names = array($names); - } + $paths = (is_string($paths)) ? array($paths) : $paths; + $names = (is_string($names)) ? array($names) : $names; // Set as __main__ namespace $this->twig->getLoader()->setPaths($paths); From 8795a354fed4e78b64cce531e6deaec9aa4d56f8 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:31:09 -0500 Subject: [PATCH 183/284] [ticket/11628] Remove the one usage of get_style_path() Makes the code easier to follow PHPBB3-11628 --- phpBB/phpbb/template/template.php | 2 +- phpBB/phpbb/template/twig/twig.php | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 9881938a8f..6b9c331a3e 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -56,7 +56,7 @@ interface phpbb_template * Note: Templates are still compiled to phpBB's cache directory. * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. - * @param array or string $paths Array of style paths, relative to current root directory + * @param string|array or string $paths Array of style paths, relative to current root directory * @return phpbb_template $this */ public function set_custom_style($names, $paths); diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index c3ed52c3bd..0b5b4105ae 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -208,7 +208,7 @@ class phpbb_template_twig implements phpbb_template { foreach ($names as $name) { - $path = $this->get_style_path($name, $directory) . 'template/'; + $path = $this->phpbb_root_path . trim($directory, '/') . "/{$name}/template/"; if (is_dir($path)) { @@ -236,7 +236,7 @@ class phpbb_template_twig implements phpbb_template * Note: Templates are still compiled to phpBB's cache directory. * * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. - * @param array or string $paths Array of style paths, relative to current root directory + * @param string|array or string $paths Array of style paths, relative to current root directory * @return phpbb_template $this */ public function set_custom_style($names, $paths) @@ -503,18 +503,4 @@ class phpbb_template_twig implements phpbb_template { return $this->twig->getLoader()->getCacheKey($this->get_filename_from_handle($handle)); } - - /** - * Get location of style directory for specific style_path - * - * @param string $path Style path, such as "prosilver" - * @param string $style_base_directory The base directory the style is in - * E.g. 'styles', 'ext/foo/bar/styles' - * Default: 'styles' - * @return string Path to style directory, relative to current path - */ - protected function get_style_path($path, $style_base_directory = 'styles') - { - return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . rtrim($path, '/') . '/'; - } } From 427fa17f7fd9db6f69a6cb4634198a2f484e0bd9 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:34:41 -0500 Subject: [PATCH 184/284] [ticket/11628] Fix a bug I noticed in template->destroy Should not be setting $this->context = array()! PHPBB3-11628 --- phpBB/phpbb/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 0b5b4105ae..710411c594 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -282,7 +282,7 @@ class phpbb_template_twig implements phpbb_template */ public function destroy() { - $this->context = array(); + $this->context->clear(); return $this; } From ffbc144a739740ad1901c9eaf481815c9ec2d918 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:38:12 -0500 Subject: [PATCH 185/284] [ticket/11628] Make get_template_vars protected Remove all references to it and the hacky code in messenger that was using it PHPBB3-11628 --- phpBB/includes/functions_messenger.php | 31 ++++++-------------------- phpBB/phpbb/template/twig/twig.php | 2 +- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 3a9e1fa77b..3bfc1a44f0 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ class messenger { - var $vars, $msg, $extra_headers, $replyto, $from, $subject; + var $msg, $extra_headers, $replyto, $from, $subject; var $addresses = array(); var $mail_priority = MAIL_NORMAL_PRIORITY; @@ -53,7 +53,7 @@ class messenger function reset() { $this->addresses = $this->extra_headers = array(); - $this->vars = $this->msg = $this->replyto = $this->from = ''; + $this->msg = $this->replyto = $this->from = ''; $this->mail_priority = MAIL_NORMAL_PRIORITY; } @@ -258,8 +258,6 @@ class messenger 'body' => $template_file . '.txt', )); - $this->vars = $this->template->get_template_vars(); - return true; } @@ -288,26 +286,11 @@ class messenger global $config, $user; // We add some standard variables we always use, no need to specify them always - if (!isset($this->vars['U_BOARD'])) - { - $this->assign_vars(array( - 'U_BOARD' => generate_board_url(), - )); - } - - if (!isset($this->vars['EMAIL_SIG'])) - { - $this->assign_vars(array( - 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), - )); - } - - if (!isset($this->vars['SITENAME'])) - { - $this->assign_vars(array( - 'SITENAME' => htmlspecialchars_decode($config['sitename']), - )); - } + $this->assign_vars(array( + 'U_BOARD' => generate_board_url(), + 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), + 'SITENAME' => htmlspecialchars_decode($config['sitename']), + )); // Parse message through template $this->msg = trim($this->template->assign_display('body')); diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 710411c594..582939c252 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -464,7 +464,7 @@ class phpbb_template_twig implements phpbb_template * * @return array */ - public function get_template_vars() + protected function get_template_vars() { $context_vars = $this->context->get_data_ref(); From ce0a1bb3c59e5815e8c39dc9f7b70ca9810df6e3 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 13:44:39 -0500 Subject: [PATCH 186/284] [ticket/11628] Remove remaining style_path_provider_test PHPBB3-11628 --- .../subdir/style_path_provider_test.php | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 tests/extension/subdir/style_path_provider_test.php diff --git a/tests/extension/subdir/style_path_provider_test.php b/tests/extension/subdir/style_path_provider_test.php deleted file mode 100644 index 1b5ce62e5f..0000000000 --- a/tests/extension/subdir/style_path_provider_test.php +++ /dev/null @@ -1,18 +0,0 @@ -relative_root_path = '../'; - $this->root_path = dirname(__FILE__) . '/../'; - } -} From a9f05775025f010339fee5607df9b890abf472f8 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 25 Jul 2013 12:29:25 +0200 Subject: [PATCH 187/284] [ticket/11062] Load new strings from user's language file if provided PHPBB3-11062 --- phpBB/install/install_update.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index c18a0fb4ec..0afd6b07bb 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -232,6 +232,13 @@ class install_update extends module } // What about the language file? Got it updated? + if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files'])) + { + $lang = array(); + include($this->new_location . 'language/' . $language . '/install.' . $phpEx); + // this is the user's language.. just merge it + $user->lang = array_merge($user->lang, $lang); + } if (in_array('language/en/install.' . $phpEx, $this->update_info['files'])) { $lang = array(); From 7304ac9c3ca817716f14bb8817a201b149e5ebef Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 25 Jul 2013 13:10:45 +0200 Subject: [PATCH 188/284] [ticket/11062] If user's language is english there is no further work needed PHPBB3-11062 --- phpBB/install/install_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 0afd6b07bb..9823703f0a 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -239,7 +239,7 @@ class install_update extends module // this is the user's language.. just merge it $user->lang = array_merge($user->lang, $lang); } - if (in_array('language/en/install.' . $phpEx, $this->update_info['files'])) + if ($language != 'en' && in_array('language/en/install.' . $phpEx, $this->update_info['files'])) { $lang = array(); include($this->new_location . 'language/en/install.' . $phpEx); From c5de4dd51dfba4737e4b46af05546f3c6a4f8da6 Mon Sep 17 00:00:00 2001 From: MichaelC Date: Thu, 25 Jul 2013 13:06:11 +0100 Subject: [PATCH 189/284] [ticket/11740] Update FAQ to include Ideas Centre PHPBB3-11740 --- phpBB/language/en/help_faq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index dab66779c3..b68336e0f7 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -333,7 +333,7 @@ $help = array( ), array( 0 => 'Why isn’t X feature available?', - 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, or you want to report a bug, please visit the phpBB Area51 website, where you will find resources to do so.' + 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added please visit the phpBB Ideas Centre, where you can upvote existing ideas or suggest new features.' ), array( 0 => 'Who do I contact about abusive and/or legal matters related to this board?', From 866e475f9644dd3575ed62bfb0e7dde0338fd5cc Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 25 Jul 2013 15:47:55 +0200 Subject: [PATCH 190/284] [ticket/10037] Apply attached patch with a few changes PHPBB3-10037 --- phpBB/includes/ucp/ucp_profile.php | 3 ++ .../prosilver/template/posting_smilies.html | 4 +-- .../subsilver2/template/posting_smilies.html | 4 +-- .../template/ucp_profile_signature.html | 35 ++++++++++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index d35d13b6c1..847311058b 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -548,6 +548,9 @@ class ucp_profile // Build custom bbcodes array display_custom_bbcodes(); + // Generate smiley listing + generate_smilies('inline', 0); + break; case 'avatar': diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index 86ac24aa53..d45b185ed3 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -2,8 +2,8 @@ diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html index fcab578bd9..d2224887bc 100644 --- a/phpBB/styles/subsilver2/template/posting_smilies.html +++ b/phpBB/styles/subsilver2/template/posting_smilies.html @@ -2,8 +2,8 @@ diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html index a33726e166..8588a99438 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_signature.html @@ -5,9 +5,11 @@
{L_TITLE}
{L_SIGNATURE_EXPLAIN}
+ + + + +
+ {L_SIGNATURE_EXPLAIN} + + + + + + + + + + + + + +
{L_SMILIES}
+ + {smiley.SMILEY_CODE} + +
{L_MORE_SMILIES}
+ +
+ @@ -47,6 +75,11 @@
+ +
+ From 57bc3c7d3aaa66fc66798bc1e60b88ae17b110a9 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 25 Jul 2013 09:32:28 -0500 Subject: [PATCH 191/284] [ticket/11628] phpbb_template, not phpbb_template_interface PHPBB3-11628 --- phpBB/phpbb/controller/resolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 850df84a0f..d772507261 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -48,7 +48,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface * * @param phpbb_user $user User Object * @param ContainerInterface $container ContainerInterface object - * @param phpbb_template_interface $template + * @param phpbb_template $template */ public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_template $template = null) { From 9e68404de5277de23baa153a29f4a3825e233e1e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 27 Jul 2013 10:44:39 -0700 Subject: [PATCH 192/284] [ticket/11749] PHP Events for search.php PHPBB3-11749 --- phpBB/search.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/phpBB/search.php b/phpBB/search.php index 8bcbfc498b..d0484bf598 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -687,6 +687,18 @@ if ($keywords || $author || $author_id || $search_id || $submit) $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } + /** + * Event to modify the SQL query before the topic data is retrieved + * + * @event core.search_get_topic_data + * @var string sql_select The SQL SELECT string used by search to get topic data + * @var string sql_from The SQL FROM string used by search to get topic data + * @var string sql_where The SQL WHERE string used by search to get topic data + * @since 3.1-A1 + */ + $vars = array('sql_select', 'sql_from', 'sql_where'); + extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); + $sql = "SELECT $sql_select FROM $sql_from WHERE $sql_where"; @@ -989,6 +1001,17 @@ if ($keywords || $author || $author_id || $search_id || $submit) ); } + /** + * Modify the topic data before it is assigned to the template + * + * @event core.search_modify_tpl_ary + * @var array row Array with topic data + * @var array tpl_ary Template block array with topic data + * @since 3.1-A1 + */ + $vars = array('row', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); + $template->assign_block_vars('searchresults', array_merge($tpl_ary, array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $result_topic_id, From 9ffb150d47d3db42c1816ffa662e73046a1b5d03 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 27 Jul 2013 10:45:40 -0700 Subject: [PATCH 193/284] [ticket/11749] PHP Events for viewforum.php PHPBB3-11749 --- phpBB/viewforum.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 5a59e021b3..1fa2030671 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -372,6 +372,16 @@ $sql_array = array( 'LEFT_JOIN' => array(), ); +/** +* Event to modify the SQL query before the topic data is retrieved +* +* @event core.viewforum_get_topic_data +* @var array sql_array The SQL array to get the data of all topics +* @since 3.1-A1 +*/ +$vars = array('sql_array'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars))); + $sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); if ($user->data['is_registered']) @@ -554,6 +564,17 @@ if (sizeof($shadow_topic_list)) $sql = 'SELECT * FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list)); + + /** + * Event to modify the SQL query before the shadowtopic data is retrieved + * + * @event core.viewforum_get_shadowtopic_data + * @var string sql The SQL string to get the data of any shadowtopics + * @since 3.1-A1 + */ + $vars = array('sql'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars))); + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) From 8e636e4572ef11af61f2b2c6dfb56d7a9530c8de Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 27 Jul 2013 10:48:40 -0700 Subject: [PATCH 194/284] [ticket/11749] Template events for topic_list_row_pre/append PHPBB3-11749 --- phpBB/docs/events.md | 18 ++++++++++++++++++ .../prosilver/template/search_results.html | 2 ++ .../prosilver/template/viewforum_body.html | 2 ++ .../subsilver2/template/search_results.html | 2 ++ .../subsilver2/template/viewforum_body.html | 4 ++++ 5 files changed, 28 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 3723bf7b3f..855f238653 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -114,6 +114,24 @@ simple_footer_after * Location: styles/prosilver/template/simple_footer.html * Purpose: Add content directly prior to the `` tag of the simple footer +topiclist_row_prepend +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/search_results.html + + styles/subsilver2/template/viewforum_body.html +* Purpose: Add content into topic rows (inside the elements containing topic titles) + +topiclist_row_append +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/search_results.html + + styles/subsilver2/template/viewforum_body.html +* Purpose: Add content into topic rows (inside the elements containing topic titles) + ucp_pm_viewmessage_print_head_append === * Location: styles/prosilver/template/ucp_pm_viewmessage_print.html diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index f0424c45db..54e8867526 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -63,6 +63,7 @@
style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{searchresults.TOPIC_FOLDER_IMG_ALT}">
+ {NEWEST_POST_IMG} {searchresults.TOPIC_TITLE} {searchresults.ATTACH_ICON_IMG} {searchresults.UNAPPROVED_IMG} @@ -83,6 +84,7 @@
{L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} {searchresults.FORUM_TITLE} +
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 69b0608a64..ecd993d7fb 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -144,6 +144,7 @@
style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
+ {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {DELETED_IMG} @@ -164,6 +165,7 @@ {topicrow.ATTACH_ICON_IMG} {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} » {L_IN} {topicrow.FORUM_NAME} +
{topicrow.REPLIES} {L_REPLIES}
diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html index d98079de20..19ba0b196a 100644 --- a/phpBB/styles/subsilver2/template/search_results.html +++ b/phpBB/styles/subsilver2/template/search_results.html @@ -34,6 +34,7 @@ + {NEWEST_POST_IMG} {searchresults.ATTACH_ICON_IMG} {searchresults.TOPIC_TITLE} @@ -58,6 +59,7 @@ ]

{L_IN} {searchresults.FORUM_TITLE}

+

{searchresults.TOPIC_AUTHOR_FULL}

{searchresults.TOPIC_REPLIES}

diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index d07e9a1372..dfbe0a605b 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -40,6 +40,7 @@ + {NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TYPE} {topicrow.TOPIC_TITLE} @@ -63,6 +64,7 @@ ]

+

{topicrow.TOPIC_AUTHOR_FULL}

{topicrow.REPLIES}

@@ -203,6 +205,7 @@ + {NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TYPE} {topicrow.TOPIC_TITLE} @@ -227,6 +230,7 @@ ]

{L_IN} {topicrow.FORUM_NAME}

+

{topicrow.TOPIC_AUTHOR_FULL}

{topicrow.REPLIES}

From d8584877a19ece5b5d6cd1d0ec752905ef8501e7 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sat, 27 Jul 2013 22:37:44 +0200 Subject: [PATCH 195/284] [ticket/10917] Revert use of phpbb wrapper PHPBB3-10917 --- phpBB/install/install_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 9ac17e7579..e8fcabfc2d 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -204,7 +204,7 @@ class install_update extends module } // Check if the update files stored are for the latest version... - if (phpbb_version_compare($this->latest_version, $this->update_info['version']['to'], '>')) + if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) { $this->unequal_version = true; From d5c56c5d503ea4b12852866e2d3b956e92a92aea Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 27 Jul 2013 20:02:03 -0500 Subject: [PATCH 196/284] [ticket/11724] Support "ELSE IF" and "ELSEIF" in the same way PHPBB3-11724 --- phpBB/phpbb/template/twig/lexer.php | 3 ++- tests/template/template_test.php | 7 +++++++ tests/template/templates/if.html | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 4f88147542..1a640e559e 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -236,7 +236,8 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces) $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code); - return preg_replace_callback('##', $callback, $code); + // (ELSE)?\s?IF; match IF|ELSEIF|ELSE IF; replace ELSE IF with ELSEIF + return preg_replace_callback('##', $callback, $code); } /** diff --git a/tests/template/template_test.php b/tests/template/template_test.php index dd9ba21c26..2a40107d90 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -62,6 +62,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), '1!false', ), + array( + 'if.html', + array('S_OTHER_OTHER_VALUE' => true), + array(), + array(), + '|S_OTHER_OTHER_VALUE|!false', + ), array( 'if.html', array('S_VALUE' => false, 'S_OTHER_VALUE' => true), diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html index c010aff7fa..f6ab6e575a 100644 --- a/tests/template/templates/if.html +++ b/tests/template/templates/if.html @@ -2,6 +2,8 @@ 1 2 + +|S_OTHER_OTHER_VALUE| 03 From dd875f13e875a726c9ea4654a90a74878658e423 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sun, 28 Jul 2013 02:35:01 +0200 Subject: [PATCH 197/284] [ticket/10917] Variable used only once so delete it The variable $this->unequal_version was only used once and only to display the version the package updates to. To display the version it updates to makes no sense when the update files just aren't meant to update from the current version. (It's already shown in an error message) So I deleted the variable from there. Furthermore the use of version_compare makes the variable useless in that context which is why I deleted the variable from the whole file and replaced it in the relevant if statement with the old comparison. PHPBB3-10917 --- phpBB/install/install_update.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index e8fcabfc2d..2f3ee1c55a 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -58,7 +58,6 @@ class install_update extends module var $new_location; var $latest_version; var $current_version; - var $unequal_version; var $update_to_version; @@ -76,7 +75,6 @@ class install_update extends module $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; - $this->unequal_version = false; $this->old_location = $phpbb_root_path . 'install/update/old/'; $this->new_location = $phpbb_root_path . 'install/update/new/'; @@ -195,8 +193,6 @@ class install_update extends module // Check if the update files are actually meant to update from the current version if ($this->current_version != $this->update_info['version']['from']) { - $this->unequal_version = true; - $template->assign_vars(array( 'S_ERROR' => true, 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']), @@ -206,8 +202,6 @@ class install_update extends module // Check if the update files stored are for the latest version... if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) { - $this->unequal_version = true; - $template->assign_vars(array( 'S_WARNING' => true, 'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) @@ -294,7 +288,7 @@ class install_update extends module ); // Print out version the update package updates to - if ($this->unequal_version) + if ($this->latest_version != $this->update_info['version']['to']) { $template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']); } From 0215e0bd95104c628cf084e1be0df72b2752346c Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 28 Jul 2013 21:31:12 -0500 Subject: [PATCH 198/284] [ticket/11724] Replace spaces with tabs PHPBB3-11724 --- phpBB/phpbb/template/twig/lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 1a640e559e..7cb84167bf 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -237,7 +237,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code); // (ELSE)?\s?IF; match IF|ELSEIF|ELSE IF; replace ELSE IF with ELSEIF - return preg_replace_callback('##', $callback, $code); + return preg_replace_callback('##', $callback, $code); } /** From 9902f1c75178aa72d3b89f51033fcda552141b40 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 29 Jul 2013 00:05:31 -0700 Subject: [PATCH 199/284] [ticket/11749] Move event after all template data has been defined PHPBB3-11749 --- phpBB/search.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index d0484bf598..40c0b9a8ce 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1001,18 +1001,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) ); } - /** - * Modify the topic data before it is assigned to the template - * - * @event core.search_modify_tpl_ary - * @var array row Array with topic data - * @var array tpl_ary Template block array with topic data - * @since 3.1-A1 - */ - $vars = array('row', 'tpl_ary'); - extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); - - $template->assign_block_vars('searchresults', array_merge($tpl_ary, array( + $tpl_ary = array_merge($tpl_ary, array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $result_topic_id, 'POST_ID' => ($show_results == 'posts') ? $row['post_id'] : false, @@ -1024,9 +1013,22 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), - 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '') + 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '', )); + /** + * Modify the topic data before it is assigned to the template + * + * @event core.search_modify_tpl_ary + * @var array row Array with topic data + * @var array tpl_ary Template block array with topic data + * @since 3.1-A1 + */ + $vars = array('row', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars('searchresults', $tpl_ary); + if ($show_results == 'topics') { phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); From b8fef3b33a5c04c6637667b0a9a9f3b24ba2c594 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 29 Jul 2013 16:55:58 +0100 Subject: [PATCH 200/284] [ticket/11640] removed the space that I wonder what it was doing there. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11640 --- phpBB/includes/functions_privmsgs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 15907feedd..5fc6de8e02 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2022,7 +2022,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); - $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags , false); + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); $subject = censor_text($subject); From ccc5c5f6b8c197c0f96349e139472ddbe17f19ce Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Mon, 29 Jul 2013 17:00:51 +0100 Subject: [PATCH 201/284] [ticket/11638] Changed the layout to match the other similar commits sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 64006fbe61..a24c40f697 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -828,19 +828,14 @@ if (!empty($topic_data['poll_start'])) $poll_total += $poll_option['poll_option_total']; } - $parse_bbcode_flags = OPTION_FLAG_SMILIES; - - if (empty($poll_info[0]['bbcode_bitfield'])) - { - $parse_bbcode_flags |= OPTION_FLAG_BBCODE; - } + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { - $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_bbcode_flags, true); + $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true); } - $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_bbcode_flags, true); + $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true); foreach ($poll_info as $poll_option) { From 5bb08a1ab973ee13237876d11b001c4ed6658892 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 29 Jul 2013 21:30:01 +0200 Subject: [PATCH 202/284] [ticket/11574] Change order of files and database update PHPBB3-11574 --- phpBB/adm/style/install_update.html | 46 ++++++++++++++--------------- phpBB/install/database_update.php | 3 +- phpBB/install/index.php | 2 +- phpBB/install/install_update.php | 33 ++++++++++++++++----- phpBB/language/en/install.php | 6 ++-- 5 files changed, 55 insertions(+), 35 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index b5fa46dbf6..bd46f7877e 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -109,27 +109,14 @@ - +
- +
+

{L_CHECK_FILES_EXPLAIN}

+ +
-
-

{L_UPDATE_DATABASE_EXPLAIN}

- -
- -
- - -
- -
-

{L_CHECK_FILES_UP_TO_DATE}

- -
- -
- + @@ -155,6 +142,11 @@ +
+

{L_UPDATE_DB_SUCCESS}

+

{L_EVERYTHING_UP_TO_DATE}

+
+

{L_UPDATE_DB_SUCCESS}



@@ -174,10 +166,18 @@ -
-

{L_UPDATE_SUCCESS}

-

{L_ALL_FILES_UP_TO_DATE}

-
+

{L_UPDATE_FILE_SUCCESS}

+

{L_ALL_FILES_UP_TO_DATE}

+ +

{L_UPDATE_DATABASE_EXPLAIN}

+ +
+ +
+ +
+ +

{L_COLLECTED_INFORMATION}

diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 44cbc74d29..f69f0f6986 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -110,6 +110,7 @@ phpbb_require_updated('includes/functions_container.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx); phpbb_require_updated('includes/constants.' . $phpEx); +phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); phpbb_require_updated('includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours @@ -305,7 +306,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '
'; if ($request->variable('type', 0)) { echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '

'; - echo '' . $user->lang['CONTINUE_UPDATE_NOW'] . ''; + echo '' . $user->lang['CONTINUE_UPDATE_NOW'] . ''; } else { diff --git a/phpBB/install/index.php b/phpBB/install/index.php index fe61c53558..bd39e231f4 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -250,7 +250,7 @@ $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, ne $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); -$paths = array($phpbb_admin_path . 'style', $phpbb_root_path . 'install/update/new/adm/style'); +$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); $phpbb_style->set_custom_style('admin', $paths, array(), ''); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 478cc9f76f..a8abfc7cfc 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -39,7 +39,7 @@ if (!empty($setmodules)) 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), 'module_order' => 30, 'module_subs' => '', - 'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'), + 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), 'module_reqs' => '' ); } @@ -74,6 +74,11 @@ class install_update extends module global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; + // We must enable super globals, otherwise creating a new instance of the request class, + // using the new container with a dbal connection will fail with the following PHP Notice: + // Object of class phpbb_request_deactivated_super_global could not be converted to int + $request->enable_super_globals(); + // Create a normal container now $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); @@ -138,7 +143,9 @@ class install_update extends module } // Set custom template again. ;) - $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); + $paths = array_filter($paths, 'is_dir'); + $phpbb_style->set_custom_style('admin', $paths, array(), ''); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], @@ -267,15 +274,14 @@ class install_update extends module $this->page_title = 'STAGE_VERSION_CHECK'; $template->assign_vars(array( - 'S_UP_TO_DATE' => $up_to_date, 'S_VERSION_CHECK' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'S_UP_TO_DATE' => $up_to_date, 'LATEST_VERSION' => $this->latest_version, - 'CURRENT_VERSION' => $this->current_version) - ); + 'CURRENT_VERSION' => $this->current_version, + )); // Print out version the update package updates to if ($this->unequal_version) @@ -303,6 +309,7 @@ class install_update extends module 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), )); break; @@ -470,13 +477,23 @@ class install_update extends module $template->assign_vars(array( 'S_FILE_CHECK' => true, 'S_ALL_UP_TO_DATE' => $all_up_to_date, - 'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), 'S_VERSION_UP_TO_DATE' => $up_to_date, + 'S_UP_TO_DATE' => $up_to_date, 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), )); + // Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run + // we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less + // We now try to cope with this by triggering the update process + if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<')) + { + $template->assign_vars(array( + 'S_UP_TO_DATE' => false, + )); + } + if ($all_up_to_date) { global $phpbb_container; diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index be45047861..f994f339a9 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -374,7 +374,7 @@ $lang = array_merge($lang, array( // Updater $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', 'ARCHIVE_FILE' => 'Source file within archive', 'BACK' => 'Back', @@ -419,8 +419,9 @@ $lang = array_merge($lang, array( 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - 'ERROR' => 'Error', 'EDIT_USERNAME' => 'Edit username', + 'ERROR' => 'Error', + 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', @@ -570,6 +571,7 @@ $lang = array_merge($lang, array( 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', + 'UPDATE_FILE_SUCCESS' => 'File update was successful.', 'USER_ACTIVE' => 'Active user', 'USER_INACTIVE' => 'Inactive user', From 5f3f41d6d6fb5c997ab7b70482fef542a5534b6a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 29 Jul 2013 23:47:31 +0200 Subject: [PATCH 203/284] [ticket/11574] Remove old "continue step"-message PHPBB3-11574 --- phpBB/adm/style/install_update.html | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index bd46f7877e..57e2c8ffea 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -143,23 +143,10 @@
-

{L_UPDATE_DB_SUCCESS}

+

{L_UPDATE_SUCCESS}

{L_EVERYTHING_UP_TO_DATE}

-

{L_UPDATE_DB_SUCCESS}

- -

- -
- -
-

{L_CHECK_FILES_EXPLAIN}

- -
- -
- From 18164e63e2897a755a214b8fcb4b6d84897888e6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 30 Jul 2013 01:06:10 +0200 Subject: [PATCH 204/284] [ticket/11752] HTTP -> HTTPs in email/installed.txt PHPBB3-11752 --- phpBB/language/en/email/installed.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/email/installed.txt b/phpBB/language/en/email/installed.txt index 2aa03a7f33..60e52e37c4 100644 --- a/phpBB/language/en/email/installed.txt +++ b/phpBB/language/en/email/installed.txt @@ -12,7 +12,7 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - http://www.phpbb.com/support/ +Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - https://www.phpbb.com/support/ In order to keep your board safe and secure, we highly recommended keeping current with software releases. For your convenience, a mailing list is available at the page referenced above. From 0ff2e93c1937f96f8fcd733a152a0c2f263706b1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 30 Jul 2013 01:18:32 +0200 Subject: [PATCH 205/284] [ticket/11574] Do not display incompatible package note after successful update PHPBB3-11574 --- phpBB/install/install_update.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index dce0134730..4ae39f202f 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -313,6 +313,11 @@ class install_update extends module 'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), )); + // Do not display incompatible package note after successful update + if ($config['version'] == $this->update_info['version']['to']) + { + $template->assign_var('S_ERROR', false); + } break; case 'file_check': From 32499c8808bb72812f66ba00e35c5af128a4d4e2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 30 Jul 2013 01:38:06 +0200 Subject: [PATCH 206/284] [ticket/11574] Remove install/udpate/new/ fallback from database_update.php Since we switched the order, everything should be in the normal root by then. PHPBB3-11574 --- phpBB/install/database_update.php | 67 +++++-------------------------- phpBB/language/en/install.php | 2 +- 2 files changed, 12 insertions(+), 57 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index f69f0f6986..3be5ea659c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -21,46 +21,6 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (!function_exists('phpbb_require_updated')) -{ - function phpbb_require_updated($path, $optional = false) - { - global $phpbb_root_path, $table_prefix; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - require($new_path); - } - else if (!$optional || file_exists($old_path)) - { - require($old_path); - } - } -} - -if (!function_exists('phpbb_include_updated')) -{ - function phpbb_include_updated($path, $optional = false) - { - global $phpbb_root_path; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - include($new_path); - } - else if (!$optional || file_exists($old_path)) - { - include($old_path); - } - } -} - function phpbb_end_update($cache, $config) { $cache->purge(); @@ -89,7 +49,7 @@ function phpbb_end_update($cache, $config) exit_handler(); } -phpbb_require_updated('includes/startup.' . $phpEx); +require($phpbb_root_path . 'includes/startup.' . $phpEx); include($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) @@ -102,33 +62,28 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -phpbb_require_updated('phpbb/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); -phpbb_require_updated('includes/functions.' . $phpEx); -phpbb_require_updated('includes/functions_content.' . $phpEx); -phpbb_require_updated('includes/functions_container.' . $phpEx); +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'config.' . $phpEx); -phpbb_require_updated('includes/constants.' . $phpEx); -phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); -phpbb_require_updated('includes/utf/utf_tools.' . $phpEx); +require($phpbb_root_path . 'includes/constants.' . $phpEx); +include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx); -$phpbb_class_loader_new->register(); $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) -$other_config_path = $phpbb_root_path . 'install/update/new/config/'; -$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; - $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), - new phpbb_di_extension_core($config_path), + new phpbb_di_extension_core($phpbb_root_path . 'config/'), ); $container_passes = array( new phpbb_di_pass_collection_pass(), @@ -289,8 +244,8 @@ while (!$migrator->finished()) // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $update_start_time) >= $safe_time_limit) { - echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '
'; - echo '' . $user->lang['DATABASE_UPDATE_CONTINUE'] . ''; + echo '
' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '

'; + echo '' . $user->lang['DATABASE_UPDATE_CONTINUE'] . ''; phpbb_end_update($cache, $config); } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f994f339a9..03c9562983 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -398,7 +398,7 @@ $lang = array_merge($lang, array( 'DATABASE_TYPE' => 'Database type', 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update.', + 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', 'DELETE_USER_REMOVE' => 'Delete user and remove posts', From 8a6f3a58000b7d969bd9108f2bdb34203354d39b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 30 Jul 2013 01:54:11 +0200 Subject: [PATCH 207/284] [ticket/11524] Add another isset() to mitigate "Illegal string offset 'limit'" ... on PHP 5.4 or higher. PHPBB3-11524 --- phpBB/develop/mysql_upgrader.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 05d279a099..17ce12e2bf 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -149,7 +149,8 @@ foreach ($schema_data as $table_name => $table_data) list($orig_column_type, $column_length) = explode(':', $column_data[0]); $column_type = sprintf($dbms_type_map['mysql_41'][$orig_column_type . ':'], $column_length); - if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])) + if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit']) && + isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])) { switch ($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]) { From 404f2881135373060086116003122a9f6d851adf Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 30 Jul 2013 02:01:24 +0200 Subject: [PATCH 208/284] [ticket/11753] Update MySQL upgrader schema data. PHPBB3-11753 --- phpBB/develop/mysql_upgrader.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 05d279a099..b3f40b2ca4 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -694,6 +694,24 @@ function get_schema_struct() ), ); + $schema_data['phpbb_login_attempts'] = array( + 'COLUMNS' => array( + 'attempt_ip' => array('VCHAR:40', ''), + 'attempt_browser' => array('VCHAR:150', ''), + 'attempt_forwarded_for' => array('VCHAR:255', ''), + 'attempt_time' => array('TIMESTAMP', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', 0), + 'username_clean' => array('VCHAR_CI', 0), + ), + 'KEYS' => array( + 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'att_time' => array('INDEX', array('attempt_time')), + 'user_id' => array('INDEX', 'user_id'), + ), + ); + $schema_data['phpbb_moderator_cache'] = array( 'COLUMNS' => array( 'forum_id' => array('UINT', 0), @@ -897,6 +915,7 @@ function get_schema_struct() 'field_default_value' => array('VCHAR_UNI', ''), 'field_validation' => array('VCHAR_UNI:20', ''), 'field_required' => array('BOOL', 0), + 'field_show_novalue' => array('BOOL', 0), 'field_show_on_reg' => array('BOOL', 0), 'field_show_on_vt' => array('BOOL', 0), 'field_show_profile' => array('BOOL', 0), From a3de463b3027733f0560a420fb1c61e5413a8957 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 30 Jul 2013 02:01:41 +0200 Subject: [PATCH 209/284] [ticket/11753] Remove ?> from MySQL Upgrader. PHPBB3-11753 --- phpBB/develop/mysql_upgrader.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index b3f40b2ca4..6dd577ebf7 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -1415,5 +1415,3 @@ function get_schema_struct() return $schema_data; } - -?> \ No newline at end of file From c335edc038461449d86c2278cf414f304dcc735b Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 30 Jul 2013 12:21:34 +0300 Subject: [PATCH 210/284] [ticket/11754] Remove styleswitcher leftovers PHPBB3-11754 --- phpBB/includes/functions.php | 2 -- phpBB/styles/prosilver/template/overall_header.html | 2 -- phpBB/styles/prosilver/template/simple_header.html | 2 -- 3 files changed, 6 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 49f2e469bc..3db843ffd1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5390,8 +5390,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_UPLOAD' => $config['upload_path'], 'SITE_LOGO_IMG' => $user->img('site_logo'), - - 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), )); // application/xhtml+xml not used because of IE diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index ddbd917bd6..fcce0060f3 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -30,8 +30,6 @@ var on_page = '{ON_PAGE}'; var per_page = '{PER_PAGE}'; var base_url = '{A_BASE_URL}'; - var style_cookie = 'phpBBstyle'; - var style_cookie_settings = '{A_COOKIE_SETTINGS}'; var onload_functions = new Array(); var onunload_functions = new Array(); diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 667698c371..5bdc539f40 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -14,10 +14,8 @@ var on_page = '{ON_PAGE}'; var per_page = '{PER_PAGE}'; var base_url = '{A_BASE_URL}'; - var style_cookie = 'phpBBstyle'; var onload_functions = new Array(); var onunload_functions = new Array(); - var style_cookie_settings = '{A_COOKIE_SETTINGS}'; /** * New function for handling multiple calls to window.onload and window.unload by pentapenguin From 212294382d2626012bb1caf0dde1392e59b1ca31 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 30 Jul 2013 12:32:14 +0300 Subject: [PATCH 211/284] [ticket/11688] Rename purge_dir to remove_dir PHPBB3-11688 --- phpBB/phpbb/cache/driver/file.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 19596f5205..66a74ea4eb 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -223,7 +223,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base $filename = $fileInfo->getFilename(); if ($fileInfo->isDir()) { - $this->purge_dir($fileInfo->getPathname()); + $this->remove_dir($fileInfo->getPathname()); } elseif (strpos($filename, 'container_') === 0 || strpos($filename, 'url_matcher') === 0 || @@ -250,7 +250,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base /** * Remove directory */ - protected function purge_dir($dir) + protected function remove_dir($dir) { try { @@ -269,7 +269,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base } if ($fileInfo->isDir()) { - $this->purge_dir($fileInfo->getPathname()); + $this->remove_dir($fileInfo->getPathname()); } else { From 8295d0fb36df1c11af45f9062e17520d661e625c Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 30 Jul 2013 11:15:46 +0100 Subject: [PATCH 212/284] [ticket/11638] Variable names goof... sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11638 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a24c40f697..e120322a4f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -828,7 +828,7 @@ if (!empty($topic_data['poll_start'])) $poll_total += $poll_option['poll_option_total']; } - $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { From 95c603d545ade8ab37e81fd99f2b62765a54bcb0 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 30 Jul 2013 18:00:47 +0200 Subject: [PATCH 213/284] [ticket/8228] Fix still existing problems with code in firefox A user of a board mentioned that there are still some problems in firefox if php-highlighting is on. So I used a snippet which they worked on for weeks. Link to the snippet (in german): http://www.ongray-design.de/forum/viewtopic.php?t=541 PHPBB3-8228 --- phpBB/styles/prosilver/template/bbcode.html | 4 ++-- phpBB/styles/prosilver/template/forum_fn.js | 5 ++--- phpBB/styles/prosilver/theme/bidi.css | 2 +- phpBB/styles/prosilver/theme/colours.css | 6 +++--- phpBB/styles/prosilver/theme/content.css | 8 ++++---- phpBB/styles/prosilver/theme/print.css | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index 460d102c28..909c09df5a 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -12,8 +12,8 @@
-
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

-
+

{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

+
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 42a68a2ef5..eccb12e827 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -187,7 +187,7 @@ function displayBlocks(c, e, t) { function selectCode(a) { // Get ID of code block - var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0]; + var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; var s, r; // Not IE and IE9+ @@ -205,8 +205,7 @@ function selectCode(a) { } r = document.createRange(); - r.setStart(e.firstChild, 0); - r.setEnd(e.lastChild, e.lastChild.textContent.length); + r.selectNodeContents(e); s.removeAllRanges(); s.addRange(r); } diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index f617428565..a921805327 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -422,7 +422,7 @@ margin-left: 0; } -.rtl blockquote dl.codebox { +.rtl blockquote .codebox { margin-right: 0; } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 801d607d9c..5548905ede 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -470,16 +470,16 @@ blockquote blockquote blockquote { } /* Code block */ -dl.codebox { +.codebox { background-color: #FFFFFF; border-color: #C9D2D8; } -dl.codebox dt { +.codebox p { border-bottom-color: #CCCCCC; } -dl.codebox pre { +.codebox code { color: #2E8B57; } diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 0cab12910b..c56c7f9ef8 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -472,13 +472,13 @@ blockquote.uncited { } /* Code block */ -dl.codebox { +.codebox { padding: 3px; border: 1px solid transparent; font-size: 1em; } -dl.codebox dt { +.codebox p { text-transform: uppercase; border-bottom: 1px solid transparent; margin-bottom: 3px; @@ -487,11 +487,11 @@ dl.codebox dt { display: block; } -blockquote dl.codebox { +blockquote .codebox { margin-left: 0; } -dl.codebox pre { +.codebox code { /* Also see tweaks.css */ overflow: auto; display: block; diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index bc3ca80fdc..88de620493 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -136,4 +136,4 @@ div.spacer { clear: both; } /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } -dl.codebox dt { display: none; } +.codebox p { display: none; } From 5eb321d3113136f5e6cbc1f0ad911636f93f94df Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 30 Jul 2013 21:02:40 +0300 Subject: [PATCH 214/284] [ticket/11688] Fix docblock PHPBB3-11688 --- phpBB/phpbb/cache/driver/file.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 66a74ea4eb..944dfd6541 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -249,6 +249,10 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base /** * Remove directory + * + * @param string $dir Directory to remove + * + * @return null */ protected function remove_dir($dir) { @@ -267,6 +271,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base { continue; } + if ($fileInfo->isDir()) { $this->remove_dir($fileInfo->getPathname()); From 8892205644a9423998441472b48a29dcea321360 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 30 Jul 2013 22:32:05 +0200 Subject: [PATCH 215/284] [ticket/11757] Fix typo in signature_module_auth migration PHPBB3-11757 --- phpBB/phpbb/db/migration/data/310/signature_module_auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php index e4fbb27bcb..02cd70059a 100644 --- a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php +++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php @@ -17,7 +17,7 @@ class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migrati AND module_basename = 'ucp_profile' AND module_mode = 'signature'"; $result = $this->db->sql_query($sql); - $module_auth = $this->db_sql_fetchfield('module_auth'); + $module_auth = $this->db->sql_fetchfield('module_auth'); $this->db->sql_freeresult($result); return $module_auth === 'acl_u_sig' || $module_auth === false; From 715e408ee6765f84b812636e808786f73f43699b Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 31 Jul 2013 00:00:50 +0200 Subject: [PATCH 216/284] [ticket/11464] Add missing and remove unnecessary database entry PHPBB3-11464 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index d03fdf9de4..0a31b89aab 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -170,7 +170,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load' INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_profile', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); From 6f883b6791e1bc9b168c98d4a95e9bbed6731a74 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 31 Jul 2013 14:04:50 +0200 Subject: [PATCH 217/284] [ticket/10037] Fix table in subsilver2 Thanks, nickvergessen! ;-) PHPBB3-10037 --- .../template/ucp_profile_signature.html | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html index 8588a99438..54e8aaa723 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_signature.html @@ -1,5 +1,12 @@ + + @@ -18,20 +25,10 @@ - From 07bc935efea32de9cbef7039730d910b1e2befea Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 31 Jul 2013 23:03:32 +0200 Subject: [PATCH 218/284] [ticket/11751] Add mcp modules for softdelete on update PHPBB3-11751 --- .../data/310/softdelete_mcp_modules.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php new file mode 100644 index 0000000000..f80f55d19a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php @@ -0,0 +1,55 @@ +db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return $module_id !== false; + } + + static public function depends_on() + { + return array( + 'phpbb_db_migration_data_310_dev', + 'phpbb_db_migration_data_310_softdelete_p2', + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_topics'), + ), + )), + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_posts'), + ), + )), + ); + } +} From c2aff70cf561c1787be6cdaa193432d0cbdf432d Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:03:04 +0100 Subject: [PATCH 219/284] [ticket/11655] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11655 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 52a28e3552..8e7ae49fa4 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -76,7 +76,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES + $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true); // Replace naughty words such as farty pants $message_row['message_subject'] = censor_text($message_row['message_subject']); From 776773522ba129c0e7d0918b2f6beccd4c044dbe Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:07:58 +0100 Subject: [PATCH 220/284] [ticket/11653] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11653 --- phpBB/includes/mcp/mcp_topic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 3491f37bcb..5014879b02 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -213,7 +213,8 @@ function mcp_topic_view($id, $mode, $action) $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; - $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); if (!empty($attachments[$row['post_id']])) { From c806375828c01c011915f1438f718349aaaaf282 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:09:11 +0100 Subject: [PATCH 221/284] [ticket/11653] Missing ";" sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11653 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 8e7ae49fa4..79c4297858 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -76,7 +76,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES + $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true); // Replace naughty words such as farty pants From ea6938d3e518b636529238ab9ffd5b57b1a19241 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:11:08 +0100 Subject: [PATCH 222/284] [ticket/11643] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11643 --- phpBB/includes/mcp/mcp_queue.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 2c95dc6a67..190fccab9a 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -132,7 +132,8 @@ class mcp_queue $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From a302a09ffbe174e6720ce250121d34ba8b6fd626 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:12:58 +0100 Subject: [PATCH 223/284] [ticket/11642] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11642 --- phpBB/includes/mcp/mcp_post.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index e8768957e0..e9f6ce0471 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -125,7 +125,8 @@ function mcp_post_details($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { From 3ae33910fc600ae86f0036370958bd7ec19e7ab9 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:14:34 +0100 Subject: [PATCH 224/284] [ticket/11653] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11653 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 79c4297858..c7b4489daf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -151,7 +151,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { - $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, true); + $parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); From 2f251972790e7836d9c35eb2f5b49fda97f736d6 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 1 Aug 2013 10:16:33 +0100 Subject: [PATCH 225/284] [ticket/11641] Use $parse_flags sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11641 --- phpBB/includes/mcp/mcp_pm_reports.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index dc953aae33..cb61b25174 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -115,7 +115,8 @@ class mcp_pm_reports } // Process message, leave it uncensored - $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES, false); + $parse_flags = ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], $parse_flags, false); $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); From ea8f584de9d572f8c58b26acd1fd7551c42ab59c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Aug 2013 17:26:34 +0200 Subject: [PATCH 226/284] [prep-release-3.0.12] Bumping version number for 3.0.12-RC2. --- build/build.xml | 4 ++-- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 8 +++++++- phpBB/install/schemas/schema_data.sql | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/build.xml b/build/build.xml index a418f40b53..db327ccc30 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - + - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 0a853adb9b..09e1e50b8d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.12-RC1'); +define('PHPBB_VERSION', '3.0.12-RC2'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5cb410bf29..59f795e37e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.12-RC1'); +define('UPDATES_TO_VERSION', '3.0.12-RC2'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -1005,6 +1005,8 @@ function database_update_info() '3.0.11-RC2' => array(), // No changes from 3.0.11 to 3.0.12-RC1 '3.0.11' => array(), + // No changes from 3.0.12-RC1 to 3.0.12-RC2 + '3.0.12-RC1' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.13-RC1 */ ); @@ -2236,6 +2238,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.12-RC1 to 3.0.12-RC2 + case '3.0.12-RC1': + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 04b92b19c6..cfe3c0c4cb 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.12-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.12-RC2'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From 0a73d64b9772971b7e43e989c659184ee20c5bc6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Aug 2013 17:28:21 +0200 Subject: [PATCH 227/284] [prep-release-3.0.12] Update Changelog for 3.0.12-RC2 release. --- phpBB/docs/CHANGELOG.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 44cc49d8c4..f2d5ddc212 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -190,6 +190,8 @@
  • [PHPBB3-11662] - "occured" should be "occurred"
  • [PHPBB3-11670] - Replace trademark â„¢ with ® on "Welcome to phpBB" install page
  • [PHPBB3-11674] - Do not include vendor folder if there are no dependencies.
  • +
  • [PHPBB3-11524] - MySQL Upgrader throws warnings on PHP 5.4
  • +
  • [PHPBB3-11720] - Reporting posts leads to white page error
  • Improvement

      @@ -213,6 +215,7 @@
    • [PHPBB3-11294] - Update extension list in running tests doc
    • [PHPBB3-11368] - Latest pm reports row count
    • [PHPBB3-11583] - InnoDB supports FULLTEXT index since MySQL 5.6.4.
    • +
    • [PHPBB3-11740] - Update link in FAQ to Ideas Centre

    Sub-task

      @@ -238,6 +241,8 @@
    • [PHPBB3-11529] - Rename RUNNING_TESTS file to .md file to render it on GitHub
    • [PHPBB3-11576] - Make phpBB Test Suite MySQL behave at least as strict as phpBB MySQL driver
    • [PHPBB3-11671] - Add phing/phing to composer.json
    • +
    • [PHPBB3-11752] - Update phpBB.com URLs to https in email templates
    • +
    • [PHPBB3-11753] - Upgrade mysql_upgrader.php schema data.

    1.ii. Changes since 3.0.10

    From 7d90f0a8a00ac66f6a561766e25fb4ea16a4111b Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 2 Aug 2013 02:49:28 +0200 Subject: [PATCH 228/284] [ticket/11759] Change lowercase to uppercase PHPBB3-11759 --- phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php | 4 ++-- phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php | 4 ++-- 24 files changed, 47 insertions(+), 47 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php index 0ed05812dc..459b423736 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc1', '>='); + return version_compare($this->config['version'], '3.0.10-RC1', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration return array( array('config.add', array('email_max_chunk_size', 50)), - array('config.update', array('version', '3.0.10-rc1')), + array('config.update', array('version', '3.0.10-RC1')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php index b14b3b00aa..8d21cab45d 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc2', '>='); + return version_compare($this->config['version'], '3.0.10-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.10-rc2')), + array('config.update', array('version', '3.0.10-RC2')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php index 473057d65d..296c3c40af 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc3', '>='); + return version_compare($this->config['version'], '3.0.10-RC3', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.10-rc3')), + array('config.update', array('version', '3.0.10-RC3')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php index dddfc0e0e7..3a3908258f 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-rc1', '>='); + return version_compare($this->config['version'], '3.0.11-RC1', '>='); } static public function depends_on() @@ -25,7 +25,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'cleanup_deactivated_styles'))), array('custom', array(array(&$this, 'delete_orphan_private_messages'))), - array('config.update', array('version', '3.0.11-rc1')), + array('config.update', array('version', '3.0.11-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php index fac8523e8c..4b1b5642ce 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-rc2', '>='); + return version_compare($this->config['version'], '3.0.11-RC2', '>='); } static public function depends_on() @@ -44,7 +44,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.11-rc2')), + array('config.update', array('version', '3.0.11-RC2')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php index 6a31a51201..97331e9bb2 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php @@ -13,7 +13,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.12-rc1', '>='); + return version_compare($this->config['version'], '3.0.12-RC1', '>='); } static public function depends_on() @@ -28,7 +28,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'update_bots'))), array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))), - array('config.update', array('version', '3.0.12-rc1')), + array('config.update', array('version', '3.0.12-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php index 562ccf077c..761ed5d2ec 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.1-rc1', '>='); + return version_compare($this->config['version'], '3.0.1-RC1', '>='); } public function update_schema() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'fix_unset_last_view_time'))), array('custom', array(array(&$this, 'reset_smiley_size'))), - array('config.update', array('version', '3.0.1-rc1')), + array('config.update', array('version', '3.0.1-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php index a960e90765..a84f3c2d92 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-rc1', '>='); + return version_compare($this->config['version'], '3.0.2-RC1', '>='); } static public function depends_on() @@ -26,7 +26,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration array('config.add', array('check_attachment_content', '1')), array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')), - array('config.update', array('version', '3.0.2-rc1')), + array('config.update', array('version', '3.0.2-RC1')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php index 8917dfea77..33bacc077f 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-rc2', '>='); + return version_compare($this->config['version'], '3.0.2-RC2', '>='); } static public function depends_on() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.2-rc2')), + array('config.update', array('version', '3.0.2-RC2')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php index 4b102e1a2e..69433f386e 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.3-rc1', '>='); + return version_compare($this->config['version'], '3.0.3-RC1', '>='); } static public function depends_on() @@ -60,7 +60,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration array('permission.add', array('u_masspm_group', true, 'u_masspm')), array('custom', array(array(&$this, 'correct_acp_email_permissions'))), - array('config.update', array('version', '3.0.3-rc1')), + array('config.update', array('version', '3.0.3-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php index 8ad75a557b..e45bd3eeee 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.4-rc1', '>='); + return version_compare($this->config['version'], '3.0.4-RC1', '>='); } static public function depends_on() @@ -76,7 +76,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_custom_profile_fields'))), - array('config.update', array('version', '3.0.4-rc1')), + array('config.update', array('version', '3.0.4-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php index ea17cc1e31..62ae7bff1a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-rc1', '>='); + return version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php index 8538347b1a..d72176489b 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-rc1', '>='); + return version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() @@ -36,7 +36,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.5-rc1')), + array('config.update', array('version', '3.0.5-RC1')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php index 38c282ebf0..25f4995b0e 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc1', '>='); + return version_compare($this->config['version'], '3.0.6-RC1', '>='); } static public function depends_on() @@ -185,7 +185,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'add_newly_registered_group'))), array('custom', array(array(&$this, 'set_user_options_default'))), - array('config.update', array('version', '3.0.6-rc1')), + array('config.update', array('version', '3.0.6-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php index a939dbd489..d5d14ab05d 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc2', '>='); + return version_compare($this->config['version'], '3.0.6-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.6-rc2')), + array('config.update', array('version', '3.0.6-RC2')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php index b3f09d8ab8..f3f1fb42f4 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc3', '>='); + return version_compare($this->config['version'], '3.0.6-RC3', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_cp_fields'))), - array('config.update', array('version', '3.0.6-rc3')), + array('config.update', array('version', '3.0.6-RC3')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php index fc2923f99b..6138ef351d 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc4', '>='); + return version_compare($this->config['version'], '3.0.6-RC4', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.6-rc4')), + array('config.update', array('version', '3.0.6-RC4')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php index ffebf66f2d..be8f9045f4 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-rc1', '>='); + return version_compare($this->config['version'], '3.0.7-RC1', '>='); } static public function depends_on() @@ -62,7 +62,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])), array('custom', array(array(&$this, 'delete_text_templates'))), - array('config.update', array('version', '3.0.7-rc1')), + array('config.update', array('version', '3.0.7-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php index 55bc2bc679..0e43229f13 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-rc2', '>='); + return version_compare($this->config['version'], '3.0.7-RC2', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_email_hash'))), - array('config.update', array('version', '3.0.7-rc2')), + array('config.update', array('version', '3.0.7-RC2')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php index aeff35333e..ff7824fa3b 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.8-rc1', '>='); + return version_compare($this->config['version'], '3.0.8-RC1', '>='); } static public function depends_on() @@ -38,7 +38,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration array('config.update_if_equals', array(600, 'queue_interval', 60)), array('config.update_if_equals', array(50, 'email_package_size', 20)), - array('config.update', array('version', '3.0.8-rc1')), + array('config.update', array('version', '3.0.8-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php index 4c345b429b..d3beda63b7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc1', '>='); + return version_compare($this->config['version'], '3.0.9-RC1', '>='); } static public function depends_on() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'update_file_extension_group_names'))), array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))), - array('config.update', array('version', '3.0.9-rc1')), + array('config.update', array('version', '3.0.9-RC1')), ); } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php index c0e662aa45..beb8873da7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc2', '>='); + return version_compare($this->config['version'], '3.0.9-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc2')), + array('config.update', array('version', '3.0.9-RC2')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php index d6d1f14b2e..56e04e7235 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc3', '>='); + return version_compare($this->config['version'], '3.0.9-RC3', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc3')), + array('config.update', array('version', '3.0.9-RC3')), ); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php index e673249343..5be1124287 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc4', '>='); + return version_compare($this->config['version'], '3.0.9-RC4', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc4')), + array('config.update', array('version', '3.0.9-RC4')), ); } } From e667481c6c3d98808ac412531f562d68fad10ae5 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 2 Aug 2013 03:28:32 +0200 Subject: [PATCH 229/284] [ticket/11760] Use phpbb_version_compare() wrapper PHPBB3-11760 --- phpBB/phpbb/db/migration/data/30x/3_0_1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_10.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_11.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_3.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_4.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_5.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_6.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_7.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_8.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_9.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php | 2 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php index c996a0138a..c5b1681d96 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php index 122f93d6b4..640fcbc16f 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php index 459b423736..e0aca09c3a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php index 8d21cab45d..394e030acf 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php index 296c3c40af..92900e3aed 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-RC3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC3', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php index e063c699cc..3be03cec40 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php index 3a3908258f..f7b0247fdb 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php index 4b1b5642ce..204aa314ac 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php index 97331e9bb2..28ee84469a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php @@ -13,7 +13,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.12-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.12-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php index 761ed5d2ec..984b8fb37e 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.1-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>='); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php index eed5acef82..6e11e5a145 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php index a84f3c2d92..9a25628f25 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php index 33bacc077f..6c37d6701b 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php index 8984cf7b76..11fd2a2e80 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.3', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php index 69433f386e..cbeb00499a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.3-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.3-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php index 9a0c132e78..4375a96dac 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.4', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php index e45bd3eeee..73334dcc6f 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.4-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php index 16d2dee457..2700274f35 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php index 62ae7bff1a..90c6b3b46a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php index d72176489b..2d1e5cfed8 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php index bb651dc7cd..1877b0c5a1 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php index 25f4995b0e..3e2a9544c7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php index d5d14ab05d..439e25b100 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php index f3f1fb42f4..77b62d7fc7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-RC3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC3', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php index 6138ef351d..61a31d09e6 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-RC4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC4', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php index 9ff2e9e4ab..3eb1caddbc 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php index c9cc9d19ac..c7b5c584ac 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-pl1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-pl1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php index be8f9045f4..e0fd313834 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php index 0e43229f13..f4f3327385 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php index 8998ef9627..77771a9acd 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.8', '>='); + return phpbb_version_compare($this->config['version'], '3.0.8', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php index ff7824fa3b..c534cabb6c 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.8-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php index d5269ea6f0..6a38793269 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php index d3beda63b7..81c67550bd 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-RC1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC1', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php index beb8873da7..1531f408b7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-RC2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC2', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php index 56e04e7235..851680b093 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-RC3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC3', '>='); } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php index 5be1124287..879538c341 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-RC4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC4', '>='); } static public function depends_on() From d7e048da10d17beeda85e67bc6fcf8649716441a Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 21:30:14 +0200 Subject: [PATCH 230/284] [ticket/9550] Add template event memberlist_view_user_statistics_before Adds a template event required for the karma extension. It allows adding entries to the user statistics part of any user profile. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Used by the karma extension to add a karma score indication that allows other users to see how respected this user is. Prepend because karma score is often a more meaningful statistic than the bottom statistics (like "Most active topic"), and should therefore be more prominent. PHPBB3-9550 --- phpBB/styles/prosilver/template/memberlist_view.html | 1 + phpBB/styles/subsilver2/template/memberlist_view.html | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 57cfcb86d9..b339e07d37 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -77,6 +77,7 @@

    {L_USER_FORUM}

    +
    {L_JOINED}{L_COLON}
    {JOINED}
    {L_VISITED}{L_COLON}
    {VISITED}
    diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 464369a7a8..e097e09565 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -66,6 +66,7 @@
    From ef7861bffc557e5f979ec91704d4a4da398484bc Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 22:06:41 +0200 Subject: [PATCH 232/284] [ticket/9550] Add template event viewtopic_body_post_buttons_after Adds a template event required for the karma extension. It allows adding post buttons to posts (next to the quote and edit buttons). Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Used by the karma extension to add thumbs up/down icons that allow users to give karma on posts. PHPBB3-9550 --- phpBB/styles/prosilver/template/viewtopic_body.html | 1 + phpBB/styles/subsilver2/template/viewtopic_body.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index a8bac42842..54f0b27c4d 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -142,6 +142,7 @@
  • {L_WARN_USER}
  • {L_INFORMATION}
  • {L_REPLY_WITH_QUOTE}
  • + diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 299b8219eb..9398953532 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -315,7 +315,7 @@
    - + From fd8ab9255981f9e613a0f0419c3115e4c470c5a7 Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 22:19:37 +0200 Subject: [PATCH 233/284] [ticket/9550] Add template event viewtopic_body_post_buttons_before Adds the prepend counterpart of a template event required for the karma extension. It allows adding post buttons to posts (next to the quote and edit buttons). Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Per suggestion of nickvergessen, add a counterpart for every append or prepend event. PHPBB3-9550 --- phpBB/styles/prosilver/template/viewtopic_body.html | 1 + phpBB/styles/subsilver2/template/viewtopic_body.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 54f0b27c4d..bc8a71c9bf 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -136,6 +136,7 @@
      +
    • {L_EDIT_POST}
    • {L_DELETE_POST}
    • {L_REPORT_POST}
    • diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 9398953532..38847d0805 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -315,7 +315,7 @@
    - + From c049c8d6f0aea53e39de64c82a72ca4a724cb17d Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 22:25:49 +0200 Subject: [PATCH 234/284] [ticket/9550] Add template event viewtopic_body_postrow_custom_fields_before Adds a template event required for the karma extension. It allows adding data before the custom fields, under the username and avatar next to every post. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Used by the karma extension to add a karma score indication that allows users to see how respected the post author is. PHPBB3-9550 --- phpBB/styles/prosilver/template/viewtopic_body.html | 1 + phpBB/styles/subsilver2/template/viewtopic_body.html | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index bc8a71c9bf..3260ae8b92 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -239,6 +239,7 @@
    {postrow.PROFILE_FIELD1_NAME}{L_COLON} {postrow.PROFILE_FIELD1_VALUE}
    +
    {postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE}
    diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 38847d0805..787f67275b 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -208,6 +208,7 @@
    {postrow.PROFILE_FIELD1_NAME}{L_COLON} {postrow.PROFILE_FIELD1_VALUE} +
    {postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE} From 84689680143f6e2b02dfb41d019419dce91a47ec Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 22:33:45 +0200 Subject: [PATCH 235/284] [ticket/9550] Add template event viewtopic_body_postrow_custom_fields_after Adds the append counterpart of a template event required for the karma extension. It allows adding data after the custom fields under the username and avatar next to every post. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Per suggestion of nickvergessen, add a counterpart for every append or prepend event. PHPBB3-9550 --- phpBB/styles/prosilver/template/viewtopic_body.html | 1 + phpBB/styles/subsilver2/template/viewtopic_body.html | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 3260ae8b92..c8a99b18e4 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -243,6 +243,7 @@
    {postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE}
    + diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 787f67275b..51ab702b51 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -212,6 +212,7 @@
    {postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE} + From 2f1635116cbaaee3645044022f883f075f5ded69 Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 23:31:41 +0200 Subject: [PATCH 236/284] [ticket/9550] Add template event ucp_pm_viewmessage_custom_fields_before Adds a template event required for the karma extension. It allows adding data before the custom fields under the username and avatar next to every private message in prosilver. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Used by the karma extension to add a karma score indication that allows users to see how respected the pm sender is. PHPBB3-9550 --- phpBB/styles/prosilver/template/ucp_pm_viewmessage.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 22149c8b80..accea4d3dd 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -85,6 +85,7 @@
    {L_JOINED}{L_COLON} {AUTHOR_JOINED}
    {L_LOCATION}{L_COLON} {AUTHOR_FROM}
    +
    {custom_fields.PROFILE_FIELD_NAME}{L_COLON} {custom_fields.PROFILE_FIELD_VALUE}
    From cd0b1be2082f11a80b42f7f25841d0e432ff5912 Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 23:36:00 +0200 Subject: [PATCH 237/284] [ticket/9550] Add template event ucp_pm_viewmessage_custom_fields_after Adds the append counterpart of a template event required for the karma extension. It allows adding data after the custom fields under the username and avatar next to every private message in prosilver. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Per suggestion of nickvergessen, add a counterpart for every append or prepend event. PHPBB3-9550 --- phpBB/styles/prosilver/template/ucp_pm_viewmessage.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index accea4d3dd..4f2531d3a6 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -89,6 +89,7 @@
    {custom_fields.PROFILE_FIELD_NAME}{L_COLON} {custom_fields.PROFILE_FIELD_VALUE}
    + From ee251fe45b6fb27900df91a3909e28aa8c785543 Mon Sep 17 00:00:00 2001 From: rechosen Date: Wed, 17 Jul 2013 13:44:27 +0200 Subject: [PATCH 238/284] [ticket/9550] Add template event memberlist_body_username_append Adds a template event required for the karma extension. It allows adding information after every username in the memberlist. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Used by the karma extension to add a karma score indication that allows other users to see how respected every listed user is. PHPBB3-9550 --- phpBB/styles/prosilver/template/memberlist_body.html | 2 +- phpBB/styles/subsilver2/template/memberlist_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 07a7e2e182..4c5c576eb1 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -109,7 +109,7 @@
    - + diff --git a/phpBB/styles/subsilver2/template/memberlist_body.html b/phpBB/styles/subsilver2/template/memberlist_body.html index 09336fb8a3..8fd7451b55 100644 --- a/phpBB/styles/subsilver2/template/memberlist_body.html +++ b/phpBB/styles/subsilver2/template/memberlist_body.html @@ -66,7 +66,7 @@ - + From 075f491cb868119bf7de2f3dc6e0f0f79db7156e Mon Sep 17 00:00:00 2001 From: rechosen Date: Wed, 17 Jul 2013 13:49:12 +0200 Subject: [PATCH 239/284] [ticket/9550] Add template event memberlist_body_username_prepend Adds the prepend counterpart of a template event required for the karma extension. It allows adding information before every username in the memberlist. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Per suggestion of nickvergessen, add a counterpart for every append or prepend event. PHPBB3-9550 --- phpBB/styles/prosilver/template/memberlist_body.html | 2 +- phpBB/styles/subsilver2/template/memberlist_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 4c5c576eb1..459c3f6bc6 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -109,7 +109,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/memberlist_body.html b/phpBB/styles/subsilver2/template/memberlist_body.html index 8fd7451b55..7c4d301de7 100644 --- a/phpBB/styles/subsilver2/template/memberlist_body.html +++ b/phpBB/styles/subsilver2/template/memberlist_body.html @@ -66,7 +66,7 @@ - + From 8c565ea1a642ab7b72d22eaf6c83236cef9444a1 Mon Sep 17 00:00:00 2001 From: rechosen Date: Wed, 17 Jul 2013 15:06:53 +0200 Subject: [PATCH 240/284] [ticket/9550] Add the new template events to phpBB/docs/events.md The newly added template events weren't listed and described yet in events.md. Fixed now. PHPBB3-9550 --- phpBB/docs/events.md | 76 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 855f238653..d037237b34 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -52,6 +52,38 @@ index_body_stat_blocks_before + styles/subsilver2/template/index_body.html * Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks +memberlist_body_username_append +=== +* Locations: + + styles/prosilver/template/memberlist_body.html + + styles/subsilver2/template/memberlist_body.html +* Purpose: Add information after every username in the memberlist. Works in +all display modes (leader, group and normal memberlist). + +memberlist_body_username_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_body.html + + styles/subsilver2/template/memberlist_body.html +* Purpose: Add information before every username in the memberlist. Works in +all display modes (leader, group and normal memberlist). + +memberlist_view_user_statistics_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Purpose: Add entries to the bottom of the user statistics part of any user +profile + +memberlist_view_user_statistics_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Purpose: Add entries to the top of the user statistics part of any user +profile + overall_footer_after === * Locations: @@ -132,6 +164,18 @@ topiclist_row_append + styles/subsilver2/template/viewforum_body.html * Purpose: Add content into topic rows (inside the elements containing topic titles) +ucp_pm_viewmessage_custom_fields_after +=== +* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Purpose: Add data after the custom fields, under the username and avatar +next to every private message in prosilver + +ucp_pm_viewmessage_custom_fields_before +=== +* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Purpose: Add data before the custom fields, under the username and avatar +next to every private message in prosilver + ucp_pm_viewmessage_print_head_append === * Location: styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -151,6 +195,38 @@ viewtopic_body_footer_before and quick reply, directly before the jumpbox in Prosilver, breadcrumbs in Subsilver2. +viewtopic_body_post_buttons_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add post button to posts (next to edit, quote etc), at the end of +the list. + +viewtopic_body_post_buttons_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add post button to posts (next to edit, quote etc), at the start of +the list. + +viewtopic_body_postrow_custom_fields_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add data after the postrow custom fields, under the username and +avatar next to every post. + +viewtopic_body_postrow_custom_fields_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add data before the postrow custom fields, under the username and +avatar next to every post. + viewtopic_topic_title_prepend === * Locations: From f61910c3f83fd4de16ca946232bab1bd3c679341 Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 2 Aug 2013 11:38:25 +0200 Subject: [PATCH 241/284] [ticket/9550] Improve template event descriptions in phpBB/docs/events.md Per suggestion of nickvergessen, stick to "before" and "after" in the template event descriptions instead of "at the top of" and "at the bottom of". PHPBB3-9550 --- phpBB/docs/events.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index d037237b34..b1e8c7ad05 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -73,16 +73,14 @@ memberlist_view_user_statistics_after * Locations: + styles/prosilver/template/memberlist_view.html + styles/subsilver2/template/memberlist_view.html -* Purpose: Add entries to the bottom of the user statistics part of any user -profile +* Purpose: Add entries after the user statistics part of any user profile memberlist_view_user_statistics_before === * Locations: + styles/prosilver/template/memberlist_view.html + styles/subsilver2/template/memberlist_view.html -* Purpose: Add entries to the top of the user statistics part of any user -profile +* Purpose: Add entries before the user statistics part of any user profile overall_footer_after === From 61fd61692b5c93eee560424717d272d84d710cd4 Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 2 Aug 2013 11:44:07 +0200 Subject: [PATCH 242/284] [ticket/9550] Improve template event descriptions in phpBB/docs/events.md Update the custom_fields template events descriptions according to nickvergessen's suggestions. PHPBB3-9550 --- phpBB/docs/events.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index b1e8c7ad05..af6e6bdb1c 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -165,14 +165,14 @@ topiclist_row_append ucp_pm_viewmessage_custom_fields_after === * Location: styles/prosilver/template/ucp_pm_viewmessage.html -* Purpose: Add data after the custom fields, under the username and avatar -next to every private message in prosilver +* Purpose: Add data after the custom fields on the user profile when viewing +a private message ucp_pm_viewmessage_custom_fields_before === * Location: styles/prosilver/template/ucp_pm_viewmessage.html -* Purpose: Add data before the custom fields, under the username and avatar -next to every private message in prosilver +* Purpose: Add data before the custom fields on the user profile when viewing +a private message ucp_pm_viewmessage_print_head_append === @@ -214,16 +214,16 @@ viewtopic_body_postrow_custom_fields_after * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html -* Purpose: Add data after the postrow custom fields, under the username and -avatar next to every post. +* Purpose: Add data after the custom fields on the user profile when viewing +a post viewtopic_body_postrow_custom_fields_before === * Locations: + styles/prosilver/template/viewtopic_body.html + styles/subsilver2/template/viewtopic_body.html -* Purpose: Add data before the postrow custom fields, under the username and -avatar next to every post. +* Purpose: Add data before the custom fields on the user profile when viewing +a post viewtopic_topic_title_prepend === From 351abf38830ddb8d6466f39ec6a173ce688b0206 Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 2 Aug 2013 14:07:49 +0200 Subject: [PATCH 243/284] [ticket/9550] Break up a long ugly line in subsilver2 viewtopic_body.html Per request of nickvergessen, break up the long post buttons line in viewtopic_body.html of subsilver2 into nicely indented parent and child elements. Keep the whitespace in such a way that browsers display the buttons pixel-perfectly equal to the old code. In the process, move the viewtopic_body_post_buttons_before event to a more logical (though possibly less intuitive) place (only in subsilver2). PHPBB3-9550 --- .../subsilver2/template/viewtopic_body.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 51ab702b51..26e74b8c38 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -317,7 +317,21 @@ - + From 8a02db317ef3c2d3c4e3dcfc5f8b85397f7ebb4a Mon Sep 17 00:00:00 2001 From: s9e Date: Sat, 3 Aug 2013 12:20:52 +0200 Subject: [PATCH 244/284] [ticket/11762] Use the === operator to distinguish "0" from "" PHPBB3-11762 --- phpBB/includes/functions_content.php | 4 +-- .../generate_text_for_display.php | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/text_processing/generate_text_for_display.php diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index b7650ecd6a..6213d2fd24 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -413,7 +413,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) { static $bbcode; - if (!$text) + if ($text === '') { return ''; } @@ -459,7 +459,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb $uid = $bitfield = ''; $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); - if (!$text) + if ($text === '') { return; } diff --git a/tests/text_processing/generate_text_for_display.php b/tests/text_processing/generate_text_for_display.php new file mode 100644 index 0000000000..4088e33f30 --- /dev/null +++ b/tests/text_processing/generate_text_for_display.php @@ -0,0 +1,36 @@ +optionset('viewcensors', false); + } + + public function test_empty_string() + { + $this->assertSame('', generate_text_for_display('', '', '', 0)); + } + + public function test_zero_string() + { + $this->assertSame('0', generate_text_for_display('0', '', '', 0)); + } +} From 68aa974a207b444199fabe9d754f403d27d700ad Mon Sep 17 00:00:00 2001 From: s9e Date: Sat, 3 Aug 2013 12:29:23 +0200 Subject: [PATCH 245/284] [ticket/11762] Fixed test's filename PHPBB3-11762 --- ...te_text_for_display.php => generate_text_for_display_test.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/text_processing/{generate_text_for_display.php => generate_text_for_display_test.php} (100%) diff --git a/tests/text_processing/generate_text_for_display.php b/tests/text_processing/generate_text_for_display_test.php similarity index 100% rename from tests/text_processing/generate_text_for_display.php rename to tests/text_processing/generate_text_for_display_test.php From 9db1728b4b976c99f5811e578619e37c69e306cd Mon Sep 17 00:00:00 2001 From: s9e Date: Sat, 3 Aug 2013 14:05:40 +0200 Subject: [PATCH 246/284] [ticket/11762] Added call to test class's parent::setUp(). Added call to test class's parent::setUp(). Updated copyright year. PHPBB3-11762 --- tests/text_processing/generate_text_for_display_test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 4088e33f30..a157fe7d9a 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2013 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -18,6 +18,8 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca { global $cache, $user; + parent::setUp(); + $cache = new phpbb_mock_cache; $user = new phpbb_mock_user; From 71ababe6fb1648c9cb286c8c84e939a36a35cbbf Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sat, 3 Aug 2013 17:30:28 +0200 Subject: [PATCH 247/284] [ticket/11763] Add missing variable when reporting a PM to avoid SQL Error PHPBB3-11763 --- phpBB/report.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index c9ca57ecbe..5081f90ad1 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -139,9 +139,10 @@ else $reported_post_text = $report_data['message_text']; $reported_post_bitfield = $report_data['bbcode_bitfield']; - $reported_post_enable_bbcode = $report_data['reported_post_enable_bbcode']; - $reported_post_enable_smilies = $report_data['reported_post_enable_smilies']; - $reported_post_enable_magic_url = $report_data['reported_post_enable_magic_url']; + $reported_post_uid = $report_data['bbcode_uid']; + $reported_post_enable_bbcode = $report_data['enable_bbcode']; + $reported_post_enable_smilies = $report_data['enable_smilies']; + $reported_post_enable_magic_url = $report_data['enable_magic_url']; } if ($config['enable_post_confirm'] && !$user->data['is_registered']) From 28a0a9e0b1cf77f1be64934f98e4c607d6098362 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sat, 3 Aug 2013 21:46:06 +0100 Subject: [PATCH 248/284] [ticket/11639] Changing how censorship is handled. sub-task of ticket PHPBB3-11635: find and fix all bypasses of generate_text_for_* PHPBB3-11639 --- phpBB/includes/functions_posting.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index acf0cc874b..c528d36fef 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1093,13 +1093,12 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $poster_id = $row['user_id']; $post_subject = $row['post_subject']; - $message = censor_text($row['post_text']); $decoded_message = false; if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) { - $decoded_message = $message; + $decoded_message = censor_text($row['post_text']); decode_message($decoded_message, $row['bbcode_uid']); $decoded_message = bbcode_nl2br($decoded_message); @@ -1107,8 +1106,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); - // Do not censor text because it has already been censored before - $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); if (!empty($attachments[$row['post_id']])) { From 3713ff71eafa575fc78f788085803ec6488c8fcd Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 6 Aug 2013 21:47:35 +0300 Subject: [PATCH 249/284] [ticket/11770] Fix class name for pm list PHPBB3-11770 --- phpBB/styles/prosilver/template/ucp_pm_viewfolder.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index c5078df268..9cbff64a6a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -53,7 +53,7 @@ -
      +
      • From 2508439b02f5115e0557b2eee467e5ec5737d350 Mon Sep 17 00:00:00 2001 From: Andy Chase Date: Mon, 5 Aug 2013 10:35:39 -0700 Subject: [PATCH 250/284] [ticket/11761] Serve blank file locally in functional test Example.org no longer serves blank responses, failing functional tests. this patch creates a blank file and serve it locally during the test, instead of hitting the http://example.org servers kindly provided by IANA. PHPBB3-11761 --- phpBB/develop/blank.gif | 0 phpBB/develop/blank.jpg | 0 tests/functional/fileupload_remote_test.php | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 phpBB/develop/blank.gif create mode 100644 phpBB/develop/blank.jpg diff --git a/phpBB/develop/blank.gif b/phpBB/develop/blank.gif new file mode 100644 index 0000000000..e69de29bb2 diff --git a/phpBB/develop/blank.jpg b/phpBB/develop/blank.jpg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 8e361ab77b..65c4b6b7c4 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -44,14 +44,14 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_invalid_extension() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.gif'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.gif'); $this->assertEquals('URL_INVALID', $file->error[0]); } - public function test_non_existant() + public function test_empty_file() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.jpg'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.jpg'); $this->assertEquals('EMPTY_REMOTE_DATA', $file->error[0]); } From 91eccc708bb0ca4143ad670be6ecddef818b9316 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 Aug 2013 13:42:51 +0200 Subject: [PATCH 251/284] [ticket/11775] Fix error when moving the last post to another topic PHPBB3-11775 --- phpBB/includes/mcp/mcp_topic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 76985488b7..8e0e89e3da 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -668,10 +668,10 @@ function merge_posts($topic_id, $to_topic_id) } // If the topic no longer exist, we will update the topic watch table. - phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id); + phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $to_topic_id); // If the topic no longer exist, we will update the bookmarks table. - phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id); + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } // Link to the new topic From 74559eb0d59d9b97d6769ef5d57a3b375a6b8507 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 8 Aug 2013 15:50:20 +0200 Subject: [PATCH 252/284] [ticket/11774] Fix constant to avoid PHP errors PHPBB3-11774 --- phpBB/includes/mcp/mcp_reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 72400ce623..3f48c58073 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -187,7 +187,7 @@ class mcp_reports 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED), + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, From a6e69f377bb436fe59eed9fdedc0cd735d8d8ce9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 Aug 2013 23:33:26 +0200 Subject: [PATCH 253/284] [ticket/11775] Backport moving of the posting functions to 3.0 PHPBB3-11775 --- tests/functional/posting_test.php | 101 -------------- .../phpbb_functional_test_case.php | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+), 101 deletions(-) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 9bcfcc2fda..7fd1e4fdcf 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -32,105 +32,4 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}"); $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); } - - /** - * Creates a topic - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return self::submit_post($posting_url, 'POST_TOPIC', $form_data); - } - - /** - * Creates a post - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return self::submit_post($posting_url, 'POST_REPLY', $form_data); - } - - /** - * Helper for submitting posts - * - * @param string $posting_url - * @param string $posting_contains - * @param array $form_data - * @return array post_id, topic_id - */ - protected function submit_post($posting_url, $posting_contains, $form_data) - { - $this->add_lang('posting'); - - $crawler = self::request('GET', $posting_url); - $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); - - $hidden_fields = array( - $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); - }), - ); - - foreach ($hidden_fields as $fields) - { - foreach($fields as $field) - { - $form_data[$field['name']] = $field['value']; - } - } - - // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) - // is not at least 2 seconds before submission, cancel the form - $form_data['lastclick'] = 0; - - // I use a request because the form submission method does not allow you to send data that is not - // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) - // Instead, I send it as a request with the submit button "post" set to true. - $crawler = self::request('POST', $posting_url, $form_data); - $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); - - $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); - - $matches = $topic_id = $post_id = false; - preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); - - $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; - $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; - - return array( - 'topic_id' => $topic_id, - 'post_id' => $post_id, - ); - } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 684d7a84cb..15f7814800 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -593,4 +593,135 @@ class phpbb_functional_test_case extends phpbb_test_case { self::assertEquals($status_code, self::$client->getResponse()->getStatus()); } + + /** + * Creates a topic + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return self::submit_post($posting_url, 'POST_TOPIC', $form_data); + } + + /** + * Creates a post + * + * Be sure to login before creating + * + * @param int $forum_id + * @param int $topic_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return self::submit_post($posting_url, 'POST_REPLY', $form_data); + } + + /** + * Helper for submitting posts + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return array post_id, topic_id + */ + protected function submit_post($posting_url, $posting_contains, $form_data) + { + $this->add_lang('posting'); + + $crawler = self::request('GET', $posting_url); + $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); + + $hidden_fields = array( + $crawler->filter('[type="hidden"]')->each(function ($node, $i) { + return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); + }), + ); + + foreach ($hidden_fields as $fields) + { + foreach($fields as $field) + { + $form_data[$field['name']] = $field['value']; + } + } + + // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) + // is not at least 2 seconds before submission, cancel the form + $form_data['lastclick'] = 0; + + // I use a request because the form submission method does not allow you to send data that is not + // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) + // Instead, I send it as a request with the submit button "post" set to true. + $crawler = self::request('POST', $posting_url, $form_data); + $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); + $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); + + return array( + 'topic_id' => $this->get_parameter_from_link($url, 't'), + 'post_id' => $this->get_parameter_from_link($url, 'p'), + ); + } + + /* + * Returns the requested parameter from a URL + * + * @param string $url + * @param string $parameter + * @return string Value of the parameter in the URL, null if not set + */ + public function get_parameter_from_link($url, $parameter) + { + if (strpos($url, '?') === false) + { + return null; + } + + $url_parts = explode('?', $url); + if (isset($url_parts[1])) + { + $url_parameters = $url_parts[1]; + if (strpos($url_parameters, '#') !== false) + { + $url_parameters = explode('#', $url_parameters); + $url_parameters = $url_parameters[0]; + } + + foreach (explode('&', $url_parameters) as $url_param) + { + list($param, $value) = explode('=', $url_param); + if ($param == $parameter) + { + return $value; + } + } + } + return null; + } } From a9b5e77e684043924f8c34c8782b32a0f146228c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 9 Aug 2013 00:41:28 +0200 Subject: [PATCH 254/284] [ticket/11775] Add functional test for moving the last post PHPBB3-11775 --- tests/functional/mcp_test.php | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/functional/mcp_test.php diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php new file mode 100644 index 0000000000..f7e15de853 --- /dev/null +++ b/tests/functional/mcp_test.php @@ -0,0 +1,43 @@ +login(); + + // Test creating topic + $post = $this->create_topic(2, 'Test Topic 2', 'Testing move post with "Move posts" option from Quick-Moderator Tools.'); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text()); + + // Test moving a post + $this->add_lang('mcp'); + $form = $crawler->selectButton('Go')->eq(1)->form(); + $form['action']->select('merge'); + $crawler = self::submit($form); + + // Select the post in MCP + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array( + 'to_topic_id' => 1, + )); + $form['post_id_list'][0]->tick(); + $crawler = self::submit($form); + $this->assertContains($this->lang('MERGE_POSTS'), $crawler->filter('html')->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); + } +} From 0aea5e48d8ad3505fc957d67131eece477d84947 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 11 Aug 2013 10:37:29 +0300 Subject: [PATCH 255/284] [ticket/11779] Fix unapproved messages class name PHPBB3-11779 --- phpBB/styles/prosilver/template/mcp_front.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index e88b7c62df..402cfe029a 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -13,7 +13,7 @@

        {L_UNAPPROVED_TOTAL}

        -
          +
          • {L_VIEW_DETAILS}
            @@ -21,7 +21,7 @@
          -
            +
            • From fe3b57a1416fbc70779aebe6ff15fd6f1733f269 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 11 Aug 2013 10:51:16 +0300 Subject: [PATCH 256/284] [ticket/11780] Remove unused images PHPBB3-11780 --- .../prosilver/theme/en/button_pm_forward.gif | Bin 2168 -> 0 bytes .../styles/prosilver/theme/en/button_pm_new.gif | Bin 2005 -> 0 bytes .../prosilver/theme/en/button_pm_reply.gif | Bin 2126 -> 0 bytes .../prosilver/theme/en/button_topic_locked.gif | Bin 1923 -> 0 bytes .../prosilver/theme/en/button_topic_new.gif | Bin 2737 -> 0 bytes .../prosilver/theme/en/button_topic_reply.gif | Bin 2135 -> 0 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 phpBB/styles/prosilver/theme/en/button_pm_forward.gif delete mode 100644 phpBB/styles/prosilver/theme/en/button_pm_new.gif delete mode 100644 phpBB/styles/prosilver/theme/en/button_pm_reply.gif delete mode 100644 phpBB/styles/prosilver/theme/en/button_topic_locked.gif delete mode 100644 phpBB/styles/prosilver/theme/en/button_topic_new.gif delete mode 100644 phpBB/styles/prosilver/theme/en/button_topic_reply.gif diff --git a/phpBB/styles/prosilver/theme/en/button_pm_forward.gif b/phpBB/styles/prosilver/theme/en/button_pm_forward.gif deleted file mode 100644 index 3384df34be5926db98693854fd66da017ec9d013..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2168 zcmV-;2#5DaNk%w1VPF6<0OkMy@7&<_5e393Gl+=cq)`*+e ziJaSwpxBh8*OQ~$m#5m6rr?~c-lMVHp|9JZuH>q?-mSUmxWwnc%HzDo?Z(jL$Ik1{ z)#=RB?b+Vw)!Osv?DFXA-rnKf-{IZf-~ejI085R;*5b(6ASma<|%v$mop9>5$Co<@5UM_WSwy_{qk?$HTwo2?O!PL^x)6vlX|Ns8}{{8*^{QUg;`}_L(`uX|!`1ttu_xJYp_VxAk^z`)e^YilZ z^6~NU@bK{O@9*yJ?(OaE?Ck98>+9<3>gnm}=;-K=kB?+zWZ~lFA^8LW004ggEC2ui z0AK(z000O7fPY0}VO)lXh>41ejE#n}-l1 zI+#ciKpOxdB18xw^9AdNgSZ2N|*^O`*{T zQ8sJ;{K%c_XHC(f{@&=_%hy2%zHd%A_@VcQgBEY7_WdivL4r3GA~*o@Cc@vq4n#!Q z>vwMk2Z=!!&b*h6+&-vNvjM!cr*#6>(A5Wepi8u}nkT>8U4ttOn8i;>jU^$Qr z9~%FNvz$hQ^y1Ovzz*)UHy(TB#qmZPr=iwHg5&u!$AlDC=)eUpWVpi|wpG|62M*LA zB8W9i_`w4xTrdX;51cq5h%eM|fdfIzaiNGWIKaUiAXa!?g>blWnj5IOQDKGt(4pl2 zl1w^40F!i-;D7>3D&W8hbP(Xck^?wUf|4~%^d$}xfj~zP0=__plS^uu<(5@CV5X7^ zo~D-{eY^qXlK#};=bwN&31}SyKmfrCD;PRJ9a;tof}dzQfCHfu*-!@zlKR=@1a%1N zr<4O|2?Goz7^=XZaGVB*9I5sJ$Dn`uW5=wt*6P3pwayxZ2ZnkO#H=1nQ0oN3&N_hu z1I&s6jdn}`L9J5uFo6fOV!FcyAZ^e?t#icDM;vq55r-e(=1QwScciQCy6m>=?z`~D zD=)m=&XI1t@cM(tzWny<@4o;CEbzbt7i=&d{^X(X!VEX;@WT*CEb+t?SDc6cKYC=W z@x~l??D5AShb;2QBs^2#i??DESn$1L;AG}C;?GOU!5a?L#V?DNky`$EPg zUG!th(MTt)bSZ0ep~@ddkikqOR99{F)sSpKh7o`Ku>=)SG$HobWS4FB*=VP&_S$T# z9R(Fj{Go&sRba97-FW9c3Kms3p~Mtc=nVAWgcmOJ9c5TC#S>ZJ!N=o}M=tr~lvi%~ z<(OxlIUZR&(L@<~7%uwgg_|rk=q0DF`s%EUT*m1Z$1eNqv{U^0=K{C!NgH^~v4$CD ztT6{3a&ojyJZL%fExjf zAb|uU2;hbq2Y@7j3IdoRfd*;F!Gi-MtntPS4&Z?t&OiYNEWlpn1IYmb06zsTzzyqa z$S2r9zSEiOTn?bX3^q6e0SI7yE^xv61kgYZ#?J)}6aX7k-~b7jA%$_+p956D20N5b zgEMe}12lk!_-#-H>sx>vX4McR81aZmD8mJ9csf|c$^i#R15wt%!UX_i0S<6M8sb-m zp_DI*0OSDyCE$Pn*e{Ay(8dXEF^=&A2?YcYhcj|A02CMj03XQ78wdc3+z=2CZdnFf zajAP2=rfkcXjk@35MIK#ta`G3Z{}@IeWLaD?~NOZi5C2J}rN z2W&W|CDj1H9E3819({vC9UuT7&H#uKu%b@=$&Hkj0j8hTJl$RJ0>v{FMWgCtUjWj8 zh7nM}3_~$PH_@tArncb>a5N(YTsV}aE+CjaC29b3IgtY_K#Fz!r!(B3$H8uuu%`n` zM69O_psWE6z&mIg9?QIkqyczoNT?agfQB{*gR_^d>}0J6S;@A6w7uX&V;9TWhmcmW z5D_0kW=q@J+EyXrFNCZ{Jbhn3Xagn!@v3Y`TF|$`}_O&`1tDT z>g((4?Ck9A?d|vX_x1Jl_V)JZ=;-k9@b2#J@9*#Q^z`xZ@$>WZ{r&yLMrGuxxZs?u z^3>b@{{Fx?SpaIq$yIU3Qf|XVV~>xI(s78+ZG^u!SoY)R^78WApsvnid;ms+9hK7A zm8NaA+TPyb!$f0dW@g`{veVMh+l`>*$j{e_o5|Va>CDsW_4~=j!sX-P-J`Ml@$<@G zdF{r~>dn;Hl%&^xl+t^UV42F6mX-ipst}RU+Lou=m#2uS#nREy=E>0QDJne%IUPUw0U`Xwawzi#l`8k#G<02+}zyDV0wgvgznqlyVvlL%<6Qt+`hiPxVX3x zbI9%4-o)18=fKMO`S^**=*q^!Zf$lhjEvpp?wP~r&CSh-x#Y~41ejE#E{3m`1$(#{Qds_0RI`#W*}e!dkzvRTu5es422CH z$QVG8Vu%4l68agCB;iB{6)Bcr;6MaLAPKin6tQsOffzAnBxp&~9)z1Xb50zv<>o{P zNd^EJ3S>)(5I2Vm$a3>21d29nlo(K=B*i2*gANdp6GB1=24alBqOfaDdk@m8T{|&E zh_n;`A0Qd9RxaHKA}*%&VB-NrwIMv#WBOjIzLWi{2Unju_4Go^@FIa6Y2Nl-eoy$i^b zE9ZQnMQ7&DL)y4tq6H5T7erVefE=n+s@VrPZ!vzW@&{5zsMoT-2p9>-<^o2y#fF?mHSj0~8e0Kv5GEG(k}fQ&LprlrK_{WeODNxTXYb z#4yDdRn##;6&9>nr9Be_DyX0hJTbtaJ{+25MIi(_p`aHDO3|Q!zUZh4f$B)91ahEp z1p^jbF#;GCP&%kR4Wz2-s;su^>Z`EE>Z%1;urZ|qd`#x8DE9|hu7CUSM z6Zo2JvGy$B?6c5DEA6z@R%`9G*g9*E0^D}%?YH2DEAF`DmTNAz*YMIn0PMEw?z`~D zEAPDY)@yGA#>|k)y7u<#@4o=Q+dwW$yx@cy28^Qc!VEXui2-VyBFGZQKw|O##TaLt zhzZ zL>E196fUrk0|OB>?ex=7M=kZ#R99{F)ePhyG5`t`?e*9HDgeO9T%T+9*=VQj?brkW zknP)W$1QiXYy(iN0{}SSE8YolfK>`h6J^%n3I0(W3LL_j36$5PWKn0-#;2;S-V2}Yt9Q1htMHyh=DgZ02Km`i2 z)@`bw4}?Cz32C*y!2ldI&%p^KfFM8uLJXk70R}|x`T#W0K*9hd$WGD!1~)A~K<(iJ1Sj(3QDj;`?xTNHLL*w^`k)DpoAg_gpLELGl23wrwId~@CUa;;qwOYg9IjE zfeoCU3Yd4h@8vE<1|UKlj6j4He83HTSiu_vK*G9}s6Gx@AqQ3%5*iqA0~*L(2C&FN zigfRL;hWv^HZaEXVW2(0UOxMoB(qLZfJu5i0}a-AmE)hsT)levN!=Gq!*7{ z+$M^FfDRPH0T{KYMlGt4jy|rV9YDb1QrZ#$=z$B^n*$sKV1SACjcf+VsZMt)kOSlc z0RgESJ%&ouq8gPQbt{Kbm&(+pc4KTxi(oaTO4X`bRT%;@(Av*bF^sNy^{cGFMHgIf ngCley2RTctT0@b8E*xPDe;7m3T1MBp+V!p{V}T3c8VCS89tP2U diff --git a/phpBB/styles/prosilver/theme/en/button_pm_reply.gif b/phpBB/styles/prosilver/theme/en/button_pm_reply.gif deleted file mode 100644 index 3275b06d525af8176c4d76059a11d1e6916cb68d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2126 zcmV-U2(kA^Nk%w1VPF6<0OkMy?%Ut!)!Fvr=lk*V?c?RnV|><#n%Ih*;kv`-zsTdf z#q!kK@8;<3Fn|6>fYYr-rwQf-rxXg#sEu=#Ma`-*yGCCwApXA+H$wriOA@T%IT2I>gDtL>-PKk`S{7k!pFnE=H%k#+9<3>gnm}=;-K=kB?+zWZ~lFA^8LW004ggEC2ui z0AK(z000O7fPX|{U|WWVh>41ejE#n}-l@ zTyWrkLy(6QGdciJF`|PuFEUE_08yiZ3q9JHbZ|hWMvE>XPMq;@hJy+hAFffeMkh~* z5B<3rI+Wvw9ycmz80vsTkEcD{P@FL|q#G3up3bPyfoW3`9ULsBNTMtWs${`B=t_~O z%?d;RXA)(z#?KlzbnUVs>c-!jzkfplP7vX*0~LS`M~EQgjbN;RZTfga5pd~SX;TsD2GslG&D$qcN2I??}10(1l z;twCTFvkWJoZ!G5Dq`4x12lXHBMl!oaDt2@}_kur^-* zkQe$x$CFPw00WeCNLl3xR8~190T4{!039kq34;R!RQY9;6PTH$npsk`rkh#5fn*x}n2N1ZhgAE1-P=^B{>|p2)gSwEX3>4LYf&+%S0Ko@&Hd^TfgAy9TrZQxz zr=ApTx~ZU+ehSB&NuCDBr~cUC>Z>9^Kv4!fxVjP$4j}Mq1`gQaLPijX@G3>GPB4KT zD+x>NtG1dX1G2p`YeyWY_R&Wib1>`A9o%;7?YH2DEAF`DmTT@D3Ys^^xBlSa?z`~D zEAPDY)@$#*_~wg;KY8@)@4o;CEbzbt7i{ps2rT z%pH4l?D5AShb;2QB$sUR$tT~j3@c@DjPlDc$1HQozKn4R7i5^C^Ugf?Yzi4%sPab< zV=xoR(MTt)G$dM#QN$mAC@}>TOjK?4)mUe(_10W>?e*7PLotOCeZ z-WgXtImVoK?)m2xm!WyWq?c~`=?9B0xx8_3Q^p!|;L*k>v%~K0>_Kf}MjLdBn1IG_L{Bw-0^kU|rBzufO|1Wg9j*JNJGW}4vJ*q1#18TT&9qO5!6Wb?023wc+UX>pwM|j zX#`TLAzjiV4NiR5QNVuT$YS|6kp_R3FC1^M zA8+U>%1x+&Jeo^P8bHv>2Ac4i60D#FU8#ot9n^yh2qXx&p~Z~)@0=^N-)ktM!V;jg ze3{{BJ=s`>*JzF}Y)C^1BtVe@EP$pa@m>!0a)wo!Pb4L)NP|Sn;07~L;Grv#pBDMT zO9zN^h-7`E5!Sj^XOLBMKv7K^j_3+Cv>}?Fh$b2yB8)P?!jD?L>n8R(S2N(X6Myw9 zP!7w9#O`&mpm;1qq{ooTTK2M-RfzQX!P(Aw_Otqs9y>-$+R~a<9isai8n(gO*1Gn! z*FXd0=H?1y*!H%#4nouG*Ghg(e{34@ii@6TrsY<~sMeV0%IojvEL7 EJ6a7+7XSbN diff --git a/phpBB/styles/prosilver/theme/en/button_topic_locked.gif b/phpBB/styles/prosilver/theme/en/button_topic_locked.gif deleted file mode 100644 index b08918a24f3c8d82d357b6abecef1a016f54488a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1923 zcmV-}2YmQPNk%w1VORh%0Oo%H|NsB#>FK;GP5k`)3Xagn!@v6a`uX|!`}_O&`1tDT z>g((4?Ck9A?d|vX_wn)Z=;-M5^z`%d^YHNS_4W1k_V(`X?(gsK+l`H zgviZogMop8If2InNUbj~FM@)C*MF45MPuo>!~#XD?Be9e;qZflgX`??GBPsq)Z5Q) zg&rP1$yIUHhnlRctn%pV&1-|@-PKk`S{$SuMm;Z+Lov4*4rMJ)X{p6 z%*e#UL}KKsxX8r8?b_dc!{*R#hIzr|-L1Iz`1i`<@y=s>*p#H}&eg<4WXfN7>g?{* zdywO^zKqK0;_~^(Q*V&W>fP`7;osfm$j{Bm#>~mZ_xJYt`T6hM;Nafe=H%k%)Y*y1 z=p>reA(_41ejE#Wbx8o5oSmMZprN9pq@|llbyHbr zMF1ZIu(7hUw6(UkxVgHp9{@#YPzJBN#Kp$Pv>ygg1po-o(9zP<)YaD4*xAznh5!cN z;Njxq600RmfNU)&6emoK;G`P=!!-o(Z z2oMm_fg39&N?398aEKKzCA^4vIMHF3jAACL6tG94N)2DSRCJ(2hme~!XFl9lp{LKE z6(#~5QbK?a9|B4YsW7CB(J)1s^b|^^s1lbcvZfFdR6tgzCAt8uU~`9AAv(tX+()6U z+qV?|Cc;I^q%9KxVJL+0+Lnp{FKs7MaauR70Jw(TrZ9?Fg$c7eOsGKoc3*_cm@`M1 zsJVuKBbSc|s1d<4Xw91i+!4SBGiS}OBZwY>TEz@7xM!$9oq3;x-@t=Qm?)e$aN@>= z4_6sw$nTZLlP?!8*|CZ0CX@r;_n^D??++$|_uQm=lhF^zd*>3Q`@|cGKfM4EVkGI3MDGI&jmErXyXMFg`i^ydVE+Rgd^Z^0S-}A_ymYb&^QtQ zjYyz{KtvQH zM3JVL6OBoP0DD3gf|)9f@I@MBTCk#vETT~8nEN!~=%bKED(R$@R%+>`FUX+jrZT)x z={^jED(a}DmTKy$sHUpws-^C;z^kyvD(kGY)@tjmxaK#x8DE9|hu7HjOW z!EzH!0|7Ma?6c5DEA6z@R%`9G&o;0OD*!Ny?YH2DD{i*F_;CpwZJ46&y6m>=NgHrX z(Z?Tbys<_k_~xtczKN{y1{;6;VT2uX5Mc1Z2q&!Y!VEX;@WT)rJck`d{6WV55^@;f z?#3K-5u5M?LJ)L+fhw)mUe3E7bs`>cA!rkov#@B8YIn1EP*SfCvLn z5bD-M6Y-TMEEL-9B0Y2ODUh!3G>u&_DzvYyg4=AlQ(A z1%nF!Km|Q0Zo`=vWImAwTlC;~q&M6E!|JIE&h(;;5))nFGLq?NVfp!SWc`pgab@YtX|9WvZUT^)TE3yO>;m2`1q+8jw5x3*WFH01XGw zAOHpi9KeA9AoMa32fwqBK=J-Wfd2p(+-|^)8Gym{asY!2c&|oWi;;{7r=SmjKmZ&# z!3o|MzXwKe0tax#*Cz5i44kcaoX8*pC#X9SFen2n(1HqAkO2iIh-(Hq5aGO2yzUfl zh7UMFKO`VJ_>n+=XW9e~Yv>&hWFP|`Na7Ja5JMX>O*`8m9B>>6!M0G4iX5PT1Ps6e z4`z-A>Z5@Hp0~U)N|6Fr3=R@kz(zJ25sExy8gDRDJa8aje9ti72JX1NXY@b-K#-s2 zYA1l?5e^*pJ0$;Zhk(o=F^P~g;vDtIG|ISzj2PemA#tZW5+s1&1P|Om@CqqH%^5%n zoty~sn)kdd=#B#kcncC^KucO0(UKJ4np%9)!-?1c0fW(zW~OX4w2Ck`3FCkEhv1FVg02Y84%%O(N@gmV+*G$#PW z=?PfiO&Jx5!4da)#2A2+YX=FaKnF@tfpRS$2u-L$7g`UlspFv#ji^M;u{4+sKpPm% zs75zRjR6FWWUfGlNJmOiUI4%hSGbrN^5C(Sx|9@oFvAkg@P{*8fesPNsZMvw(}dCC J3N#G_06Tv4yea?y diff --git a/phpBB/styles/prosilver/theme/en/button_topic_new.gif b/phpBB/styles/prosilver/theme/en/button_topic_new.gif deleted file mode 100644 index 5b7b1e0e605dd5aed90d5c0067c15c3b480c6d37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2737 zcmcIl=~vPT8~uTpxMVI+S>~Wwxi*%jHdbSZrMZj?nL0HRnwgfiIF;r2D(<-9GH#Iv z#T1uN(MrovNK`N|4Y$Ara0wN0&Aoh^5AUDw-g7_QbMAefFZbMwju)&?U&jC^fi(b- z3C5-e_>%t5tK(m`7MG>siCNKjw}0e7QsEGuIGFrwy~lKoUAGiUJ7@Nlg<;742moW~)C+3tn+6S)x~cvN!$nm5ly(-J=}-)X40bbY)BSb!%aD zOR}^%v%D!=UfbAMUteEaTU!;44RhG-92T>)t#xWbJUK3!5DUe^QPJ3laCDfTU-@kwR_HBE6duwZJbMuG%zo6CCuV25etgI|AFE1@EEiNuDEG*2= z&&y=8xw$#1R6095J2NvgJv}XvNT#NyCMPFFBGJgm$nfy6Kp+?z8X6oNlF8(vq9P)Zn46oMot>SLk&&F7oS2vx8yg!H z6%`Q?@#xW`hYufyhK7cOgaicz1qKHG_!;;=Lw5rL0)R2VrDT z+-KGgW|%&~=%cQ=ZvPBBHc)!WD5qjt_^rN*ayRm&=a*hp_E&k=2cJFFB{V=|+VF>* zURQsv58_o`OQ{Uuq3@1&J$HIT9eMY7d1mBU*POxSXgOsa=f+x5Tau=+tGp!~+ghdP zlrBYqHQ0Y&(aoe6EGsDftY=Q>IlMFld2VyeJN^jc%O1sAl&h(3{O#_ny3!%H>vFN| zO!tUoOK123JIcq6 z)8HCj4SC&4e?@A+^%uNb@RyCkc<8!!?M=|GY4FLTyK2`{he#_Up9%2L4q-%FIt+N-mKF;Pw8@r-l3bQv&> zbs?TWT}OZjRJCbaxSguv3%OtKuO3#=KrbH7(Qd@P$k1^XPG(Ut6-TnG&Dzo|IY49T zsnGzkQZ{w{YuEF~qqpK9H4_LB{OPLWL2!*TAy!?x`8}gJQp_$Ory)0$ZbA_x9K^_( zFCj;avM*T-Ih(sscvtOQESefWRru94%mh~<9d>#u6?B*fQdBi;i;ZFG%==))V@x$C z6@9fWqnlLht@tW02l{!FhUY!Tv^s;?N>xiHIK{YnKQEQS+s{)rrZ)2{{b;3Cp>Hob z5JCYMMtGb$Tb5!h@5G|TLH0{(kKddrL7Z2fd5r)m(SWNp@4-BROim+?blil2@l2zz znmuaXMsdZ9ojQAT8J&6=&9M;oQtf!49>wqh)x+pMFvNq^d!R!OJ)qsE9|84T#7A&A zXsJX9me)`b)tS7()Tf!VlP)=%oPR3aXX<@3?N2$4ptHz9RL=lt0G68eXSXl!eZj!4 zzMcoWcVYf{$bZ1YMl0@fyUPIkbnYxUTlGo7DHc3iIVZmN*5wc4R4du~IN{>)jfos5 zS0|G$ZM#=y+#x;XiKx$do08JJ(9LN|IdyZU>Z!>urnDa1TfaAbp<8o}U#MHM<~7;Y zJbg^O?>KW`*!CjpSk3kl$7+6ixiK7$Hf=(Oefv6ev*z3C@T2)}Yh!~nm=oD;&-V>U zc}>(hIU32f&yT}?+Flt9YjrHfEF~L^Ie&6IqOM2+6ddSD=n~EB^$x53y3lh&q8PPQ z66BZzL& zT^O;Lf>9ZtZ)BnRUSeTY`$x16kE>Iwk$Ycz`#V;pw=kL`%#zAsOcwdwUnCu3=gF?h;QN-{cqoU?3QgRVTTWZi5 zM$l+ES3IBqp=jRmwvBebTNX)00LmvZF)9}4;SE8<2K=5~C_3_fI!fErx7blpMQB^7 zEw82z!~`QTfQed+A^L=zqBa1pU;OImJJ5Q9Q$d(}Wb0OPQdX!BY5fuC3#5g`a-+=r5=x*!x{l*RrkF-5p(P zs3Y!4up(gn(=D!4dAXy52Tq-`rW>f`06Z1xtD-t#5GHKeD7{5fVUhU7RKCiT-VBC6 zwUyIiA$(2}i&aA1n6`eCEY}f7c&|x36y7m_mUiKa|X;$rSpJHs>12&z4F2F~ilB0BT%rPK0;IW(o>RG;*d*r*2q=zI90 z95JjT*}Op1oO$+O7A*QHAr7 zr(K`={+u3=Lb>QN<53l#a@wNZ%ZoeX^={Ls%nhr24VU99*c>>cWv}}dK-yV| z$Ww30RdLH;dd+Kt&~Ap#ZG_Kmh0<||(t3~Af0WdQnbwG#)rXqbiJaSwpxKqC*p#H# zlcU;}r{J8d+n}!Bq_X6yxZbU~>A1w=yT$Fs(B;U_>(15c&D814)9B06?b+Vy*4yXQ z+4Je_^62aF=js4z#sEu===A#vj?fU1(H@u7A(_-9n$>y1<$c5EfW_yD$mop9>5t3l zk<9Ad@A&2O`s?=l;_~_V`S|$w_xJbq%*n;f$i&CPzvkrP<>TSx;^5-o-r?Wf;NINL z$;QaU!TS06`1kk!|Ns8}{{8*^{QUg;`}_L(`uX|!`1ttu_xJYp_VxAk^z`)e^YilZ z^6~NU@bK{O@9*yJ?(OaE?Ck98>+9<3>gnm}=;-K=kB?+zWdHyFA^8LW004ggEC2ui z0AK(z000O7fPYn9VOoZVh>41ejE#n}-l1 zNQ^)s21ErMB!U3&@COKq9B?q0IFUjdk`Y3lM44jcL=Zn#Ld>Y(p@Ik)Vm@4>X3fr? z5Fh$;L$qjw6ghH`h!DU{jH5Xic%T5p4F?Vk7>J;nG)07@O(mvCAtHhYH)6-8P=NL* z*$5*4+7`Wufhf(QY}WW$<0kK3Hbvd|dqcQz1Q&#ZM2Mj{Md3FXM7%kin1T+%E+RaZ zXjn7n$CEV^=0G9zCort3U z8?*H>TY4yd=noxKRv7^cRZnbx35wrY6jg zDW!pa%BcxHd>U#UaMA4<7Kw zEAPDY)@$#*_~xtczIgbP$G-pvEbzbt7i{ps2q&y?9{%Xz@WT*CEb+t?S8VbB#TaL- zM>oOTvB$?Chb;2QB$sUR$tb6s@*T^tQijJW$1L;AG_UN-7nf`?hABMv?DNm2jIo6n zWc+aj7+6H2^wLZ>9SIg-T=B;rQZSK35m;xf_10W>?e*7Shb=bPNiZSBA5<98gcLxx z?e^QFNYR85R4n1d%Qfe%_uePpQHB#s95DqRd=zf@;fN=$_~MK=?)c-6<1xh%MU8Pi!dcvhwK5rYHnBhjead1<{8gsxqM?cP7_=y>? zcanzho(Rd+K|==;jUYh(dIO9gQ3np# zfM5mKlZ1ZzB&h&@_ye^6avI>%@CF<-L~y|XcJNk1xYxaZxT|x|!k!8o;D8cDKmcrz zK?D|P0|QiG0BGny2W()25nPagDu@6B1<*bfsK9&%D4_{eKm!$;Zv^(U!yEc{fmh_u z4X|p+5XxW&9sYw`oeLHAUf>2f3?KqBIHC&JAO|>{;Q}y>zzf&_hXGW;0djD|3nEYk zIn2R+4Uq^K0RjgwW{`bi2n}*niI2=(1{S$y3 zsKf>pRKN@tWT61ezy>^^wha1DUg8<6aXYa#0E$Xpac~-p95ku%P*qjfAbTg3nLIkE`n$cA&fu?a0jAO zrt*%=Y-Z;=gc2F3A&?x312QjY12vdo05rHj4c7ok_Oy=%G;rVxRA|C>pkxH~6JvYc zAOML7Ae-j2qYzZ7hILiXIz!}y8s4BpHT1;{P*fiT-9Sz*Hna@50VDP0wWkC8Z1(yXYE{2+JJ^Kpkb~L5ymFa;FC72p{`{x179Cf*SpenuWd+! z83g+YSRfW6fbE21?K;=UN_MW*V~A!q%h}E6pRpsKSV(ZNEn-Rr%T=H NjtvP)Xl@_?06RStF?j$0 From fe97611eacb913a93b8c604d2ceb97e3fd42d744 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 11 Aug 2013 10:51:37 +0300 Subject: [PATCH 257/284] [ticket/11780] Remove references to unused images PHPBB3-11780 --- .../styles/prosilver/theme/en/stylesheet.css | 30 ------------------- phpBB/styles/prosilver/theme/imageset.css | 30 ------------------- 2 files changed, 60 deletions(-) diff --git a/phpBB/styles/prosilver/theme/en/stylesheet.css b/phpBB/styles/prosilver/theme/en/stylesheet.css index 1a3d0acb4b..82b7df0830 100644 --- a/phpBB/styles/prosilver/theme/en/stylesheet.css +++ b/phpBB/styles/prosilver/theme/en/stylesheet.css @@ -32,33 +32,3 @@ ul.profile-icons li.edit-icon { width: 42px; height: 20px; } padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css index 296c617f17..7aa19df06e 100644 --- a/phpBB/styles/prosilver/theme/imageset.css +++ b/phpBB/styles/prosilver/theme/imageset.css @@ -378,33 +378,3 @@ span.imageset { padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./en/button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./en/button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./en/button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./en/button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./en/button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./en/button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} From a0206a61bcc174d04f80a6e172f37b25f5b84694 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 11 Aug 2013 11:31:02 +0300 Subject: [PATCH 258/284] [ticket/11781] Include func update_post_information() Include functions_posting before using functions defined in that file PHPBB3-11781 --- phpBB/phpbb/content_visibility.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 4ad5f6793e..fb8ece0e8c 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -360,6 +360,11 @@ class phpbb_content_visibility // Sync the first/last topic information if needed if (!$is_starter && $is_latest) { + if (!function_exists('update_post_information')) + { + include($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext); + } + // update_post_information can only update the last post info ... if ($topic_id) { From 49824a0fd33df6b9da4e413ccd189379fb7f728b Mon Sep 17 00:00:00 2001 From: rechosen Date: Thu, 8 Aug 2013 11:31:06 +0200 Subject: [PATCH 259/284] [ticket/11777] Add subdirectory 'events/' to the template event search path Makes the twig template engine look in the events/ subdirectory instead of the main styles/[style]/template/ directory for extension template events. Note that it does _not_ look recursively! PHPBB3-11777 --- phpBB/phpbb/template/twig/node/event.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 971dea14fa..30a9963a77 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -18,6 +18,11 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_node_event extends Twig_Node { + /** + * The subdirectory in which all template event files must be placed + */ + const TEMPLATE_EVENTS_SUBDIRECTORY = 'events/'; + /** @var Twig_Environment */ protected $environment; @@ -50,19 +55,19 @@ class phpbb_template_twig_node_event extends Twig_Node // slower, but makes developing extensions easier (no need to // purge the cache when a new event template file is added) $compiler - ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") + ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')) {\n") ->indent() ; } - if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) + if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . self::TEMPLATE_EVENTS_SUBDIRECTORY . $location . '.html')) { $compiler ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") // We set the namespace lookup order to be this extension first, then the main path ->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n") - ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n") + ->write("\$this->env->loadTemplate('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')->display(\$context);\n") ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") ; } From e1c9a875867953f6bfd4e442ae804c85377f8360 Mon Sep 17 00:00:00 2001 From: rechosen Date: Thu, 8 Aug 2013 14:00:44 +0200 Subject: [PATCH 260/284] [ticket/11777] Move the testing template events to 'events/' subdirectories The tests written for extension template events did not follow the convention and documentation of placing template event files in the events/ subdirectory. Moved the files to this subdirectory so the tests succeed again. PHPBB3-11777 --- .../ext/kappa/styles/all/template/{ => events}/test.html | 0 .../ext/kappa/styles/silver/template/{ => events}/test.html | 0 .../kappa/styles/silver_inherit/template/{ => events}/test.html | 0 .../ext/omega/styles/all/template/{ => events}/test.html | 0 .../ext/omega/styles/silver/template/{ => events}/test.html | 0 .../ext/omega/styles/silver/template/{ => events}/two.html | 0 .../ext/zeta/styles/all/template/{ => events}/test.html | 0 .../styles/all/template/{ => events}/event_variable_spacing.html | 0 .../ext/trivial/styles/all/template/{ => events}/universal.html | 0 .../ext/trivial/styles/silver/template/{ => events}/simple.html | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/{ => events}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/{ => events}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/{ => events}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/all/template/{ => events}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/{ => events}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/{ => events}/two.html (100%) rename tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/{ => events}/test.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/{ => events}/event_variable_spacing.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/{ => events}/universal.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/{ => events}/simple.html (100%) diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/events/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/events/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/events/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/all/template/events/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/two.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/two.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/events/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html rename to tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/events/test.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/event_variable_spacing.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/event_variable_spacing.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/universal.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/universal.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/events/simple.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/events/simple.html From 7f76c9f9c7d9014f313f150a9596bec030f39915 Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 9 Aug 2013 11:33:24 +0200 Subject: [PATCH 261/284] [ticket/11777] Rename the extension template listener subdirectory to 'event/' Per suggestion of EXreaction and nickvergessen, do not look for extension template event listeners in styles/[style]/template/events/ but in styles/[style]/template/event/ (without the trailing 's') to match the way phpBB looks for php template event listeners. PHPBB3-11777 --- phpBB/phpbb/template/twig/node/event.php | 13 +++++++------ .../styles/all/template/{events => event}/test.html | 0 .../silver/template/{events => event}/test.html | 0 .../template/{events => event}/test.html | 0 .../styles/all/template/{events => event}/test.html | 0 .../silver/template/{events => event}/test.html | 0 .../silver/template/{events => event}/two.html | 0 .../styles/all/template/{events => event}/test.html | 0 .../{events => event}/event_variable_spacing.html | 0 .../all/template/{events => event}/universal.html | 0 .../silver/template/{events => event}/simple.html | 0 11 files changed, 7 insertions(+), 6 deletions(-) rename tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/{events => event}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/{events => event}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/{events => event}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/all/template/{events => event}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/{events => event}/test.html (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/{events => event}/two.html (100%) rename tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/{events => event}/test.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/{events => event}/event_variable_spacing.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/{events => event}/universal.html (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/{events => event}/simple.html (100%) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 30a9963a77..c94e5fdf20 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -19,9 +19,10 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_node_event extends Twig_Node { /** - * The subdirectory in which all template event files must be placed + * The subdirectory in which all template listener files must be placed + * @var string */ - const TEMPLATE_EVENTS_SUBDIRECTORY = 'events/'; + protected $listener_directory = 'event/'; /** @var Twig_Environment */ protected $environment; @@ -42,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->getNode('expr')->getAttribute('name'); + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name'); foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { @@ -55,19 +56,19 @@ class phpbb_template_twig_node_event extends Twig_Node // slower, but makes developing extensions easier (no need to // purge the cache when a new event template file is added) $compiler - ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')) {\n") + ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") ->indent() ; } - if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . self::TEMPLATE_EVENTS_SUBDIRECTORY . $location . '.html')) + if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) { $compiler ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") // We set the namespace lookup order to be this extension first, then the main path ->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n") - ->write("\$this->env->loadTemplate('@{$ext_namespace}/" . self::TEMPLATE_EVENTS_SUBDIRECTORY . "{$location}.html')->display(\$context);\n") + ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n") ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") ; } diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/events/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/events/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/events/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/events/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/all/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/two.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/events/two.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/events/test.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/events/test.html rename to tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/event_variable_spacing.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/event_variable_spacing.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/universal.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/events/universal.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/events/simple.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/events/simple.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html From 08e6c6118036700f5d4196aa09d9d1a34b840514 Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 9 Aug 2013 11:39:43 +0200 Subject: [PATCH 262/284] [ticket/11777] Require a suffix of '_listener' on extension template listeners To further mirror the file name and location requirements for php template event listeners, require extension template event listener files to follow the '_listener.html' naming format. PHPBB3-11777 --- phpBB/phpbb/template/twig/node/event.php | 2 +- .../styles/all/template/event/{test.html => test_listener.html} | 0 .../silver/template/event/{test.html => test_listener.html} | 0 .../template/event/{test.html => test_listener.html} | 0 .../styles/all/template/event/{test.html => test_listener.html} | 0 .../silver/template/event/{test.html => test_listener.html} | 0 .../silver/template/event/{two.html => two_listener.html} | 0 .../styles/all/template/event/{test.html => test_listener.html} | 0 ...riable_spacing.html => event_variable_spacing_listener.html} | 0 .../template/event/{universal.html => universal_listener.html} | 0 .../silver/template/event/{simple.html => simple_listener.html} | 0 11 files changed, 1 insertion(+), 1 deletion(-) rename tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/{two.html => two_listener.html} (100%) rename tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/{test.html => test_listener.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/{event_variable_spacing.html => event_variable_spacing_listener.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/{universal.html => universal_listener.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/{simple.html => simple_listener.html} (100%) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index c94e5fdf20..4533151d05 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -43,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name'); + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name') . '_listener'; foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html rename to tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html From 4b1c5879eb64006c57d94bf534d4a382d9ba5c41 Mon Sep 17 00:00:00 2001 From: rechosen Date: Mon, 12 Aug 2013 10:21:40 +0200 Subject: [PATCH 263/284] [ticket/11777] Fix new test for loop variables in extension template listeners With the merge of https://github.com/phpbb/phpbb3/pull/1564 a new test has been added. Renamed and moved the template listener file of that test to comply with the new requirements. PHPBB3-11777 --- .../{test_event_loop.html => event/test_event_loop_listener.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/{test_event_loop.html => event/test_event_loop_listener.html} (100%) diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/test_event_loop.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html From 63535b196dd5d4dcdc9a8fb6af03663638f8d8ce Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 12 Aug 2013 15:31:19 +0200 Subject: [PATCH 264/284] [ticket/11775] Split test into multiple steps PHPBB3-11775 --- tests/functional/mcp_test.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index f7e15de853..f65a7d0784 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -22,12 +22,27 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); $this->assertContains('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text()); + return $crawler; + } + + /** + * @depends test_post_new_topic + */ + public function test_handle_quickmod($crawler) + { // Test moving a post - $this->add_lang('mcp'); $form = $crawler->selectButton('Go')->eq(1)->form(); $form['action']->select('merge'); $crawler = self::submit($form); + return $crawler; + } + + /** + * @depends test_handle_quickmod + */ + public function test_move_post_to_topic($crawler) + { // Select the post in MCP $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array( 'to_topic_id' => 1, @@ -36,6 +51,15 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertContains($this->lang('MERGE_POSTS'), $crawler->filter('html')->text()); + return $crawler; + } + + /** + * @depends test_move_post_to_topic + */ + public function test_confirm_result($crawler) + { + $this->add_lang('mcp'); $form = $crawler->selectButton('Yes')->form(); $crawler = self::submit($form); $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); From 65d8cd63022d688fe618f128768b78a6214db166 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 13 Aug 2013 02:14:22 -0700 Subject: [PATCH 265/284] [ticket/11784] Remove naming redundancy for event listeners PHPBB3-11784 --- phpBB/phpbb/event/extension_subscriber_loader.php | 1 - phpBB/phpbb/template/twig/node/event.php | 2 +- .../foo/bar/event/{permission_listener.php => permission.php} | 2 +- .../styles/all/template/event/{test_listener.html => test.html} | 0 .../silver/template/event/{test_listener.html => test.html} | 0 .../template/event/{test_listener.html => test.html} | 0 .../styles/all/template/event/{test_listener.html => test.html} | 0 .../silver/template/event/{test_listener.html => test.html} | 0 .../silver/template/event/{two_listener.html => two.html} | 0 .../styles/all/template/event/{test_listener.html => test.html} | 0 ...riable_spacing_listener.html => event_variable_spacing.html} | 0 .../{test_event_loop_listener.html => test_event_loop.html} | 0 .../template/event/{universal_listener.html => universal.html} | 0 .../silver/template/event/{simple_listener.html => simple.html} | 0 14 files changed, 2 insertions(+), 3 deletions(-) rename tests/functional/fixtures/ext/foo/bar/event/{permission_listener.php => permission.php} (87%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/{two_listener.html => two.html} (100%) rename tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/{test_listener.html => test.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/{event_variable_spacing_listener.html => event_variable_spacing.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/{test_event_loop_listener.html => test_event_loop.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/{universal_listener.html => universal.html} (100%) rename tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/{simple_listener.html => simple.html} (100%) diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php index d933b943d7..d6284a52fb 100644 --- a/phpBB/phpbb/event/extension_subscriber_loader.php +++ b/phpBB/phpbb/event/extension_subscriber_loader.php @@ -33,7 +33,6 @@ class phpbb_event_extension_subscriber_loader $finder = $this->extension_manager->get_finder(); $subscriber_classes = $finder ->extension_directory('/event') - ->suffix('listener') ->core_path('event/') ->get_classes(); diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 4533151d05..c94e5fdf20 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -43,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name') . '_listener'; + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name'); foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php similarity index 87% rename from tests/functional/fixtures/ext/foo/bar/event/permission_listener.php rename to tests/functional/fixtures/ext/foo/bar/event/permission.php index 6986755f71..48688a586a 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) */ use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class phpbb_ext_foo_bar_event_permission_listener implements EventSubscriberInterface +class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface { static public function getSubscribedEvents() { diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two_listener.html rename to tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html similarity index 100% rename from tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test_listener.html rename to tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing_listener.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop_listener.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal_listener.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html similarity index 100% rename from tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple_listener.html rename to tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html From 9c299b0e8367ec8f9bb631e637b2492483ab3b8a Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Wed, 14 Aug 2013 19:09:27 +0300 Subject: [PATCH 266/284] [ticket/11789] Remove colors from HTML code PHPBB3-11789 --- phpBB/styles/subsilver2/template/overall_header.html | 2 +- phpBB/styles/subsilver2/template/ucp_header.html | 4 ++-- phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 +- phpBB/styles/subsilver2/theme/stylesheet.css | 10 +++++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 62ed79ed39..7eb736aa32 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -160,7 +160,7 @@ function marklist(id, name, state)
    - - - - - + - -
    - {L_SIGNATURE_EXPLAIN} - - + + -
    + {L_SIGNATURE_EXPLAIN} + @@ -47,11 +44,13 @@ -
    {L_SMILIES}
    {L_MORE_SMILIES}
    - -
    - +
    +
    + + + + @@ -75,11 +74,6 @@
    - -
    -
    + From a10ab3e7d94061d264ee285359565f651e7b9671 Mon Sep 17 00:00:00 2001 From: rechosen Date: Sun, 14 Jul 2013 21:50:22 +0200 Subject: [PATCH 231/284] [ticket/9550] Add template event memberlist_view_user_statistics_after Adds the append counterpart of a template event required for the karma extension. It allows adding entries to the user statistics part of any user profile. Explanation from http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44379: Per suggestion of nickvergessen, add a counterpart for every append or prepend event. PHPBB3-9550 --- phpBB/styles/prosilver/template/memberlist_view.html | 1 + phpBB/styles/subsilver2/template/memberlist_view.html | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index b339e07d37..0d103b5914 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -93,6 +93,7 @@
    {L_ACTIVE_IN_FORUM}{L_COLON}
    {ACTIVE_FORUM}
    ({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT}) -
    {L_ACTIVE_IN_TOPIC}{L_COLON}
    {ACTIVE_TOPIC}
    ({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT}) -
    + diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index e097e09565..3ffdb1ce70 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -97,6 +97,7 @@
    +
    {L_JOINED}{L_COLON} {JOINED}{ACTIVE_TOPIC}
    [ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]-
    {L_BACK_TO_TOP}
    {L_BACK_TO_TOP}
    {memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL}
    {L_SELECT} ]
    {memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL}
    {L_SELECT} ]
    {memberrow.POSTS}{memberrow.POSTS}
    {memberrow.LOCATION}
     
    {memberrow.JOINED}
     {memberrow.ROW_NUMBER} {memberrow.USERNAME_FULL}{L_SELECT} ]{memberrow.USERNAME_FULL}{L_SELECT} ]  {memberrow.JOINED}  {memberrow.POSTS} {memberrow.RANK_IMG}{memberrow.RANK_TITLE}
    {memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL}
    {L_SELECT} ]
    {memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL}
    {L_SELECT} ]
    {memberrow.POSTS}{memberrow.POSTS}
    {memberrow.LOCATION}
     
    {memberrow.JOINED}
     {memberrow.ROW_NUMBER} {memberrow.USERNAME_FULL}{L_SELECT} ]{memberrow.USERNAME_FULL}{L_SELECT} ]  {memberrow.JOINED}  {memberrow.POSTS} {memberrow.RANK_IMG}{memberrow.RANK_TITLE}
    {L_BACK_TO_TOP} + +
    + + + {EDIT_IMG} + {QUOTE_IMG} + + +  
    +
    * {L_LOGIN_LOGOUT}   * {L_RESTORE_PERMISSIONS} -  {L_BOARD_DISABLED} +  {L_BOARD_DISABLED}  * {PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD} diff --git a/phpBB/styles/subsilver2/template/ucp_header.html b/phpBB/styles/subsilver2/template/ucp_header.html index 1566a15929..4ad27738fa 100644 --- a/phpBB/styles/subsilver2/template/ucp_header.html +++ b/phpBB/styles/subsilver2/template/ucp_header.html @@ -123,7 +123,7 @@
    - {L_FRIENDS_ONLINE} + {L_FRIENDS_ONLINE}
    - style="background-color:lightblue"> + class="current">
    {L_PM_SUBJECT}: {history_row.SUBJECT}
    {L_FOLDER}: {history_row.FOLDER}
    diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index 177a988e93..29db8f2d47 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -292,7 +292,11 @@ p.topicdetails { text-decoration: none; } -.error { +.online { + color: green; +} + +.offline, .error { color: red; } @@ -360,6 +364,10 @@ td.profile { background-color: #D1D7DC; } +.current { + background-color: lightblue; +} + hr { height: 1px; border-width: 0; From 4b0adfcff54f9ebd3261e4673f689eb2c4c066df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Aug 2013 01:35:02 +0200 Subject: [PATCH 267/284] [ticket/11775] Remove spaces at line ends PHPBB3-11775 --- tests/test_framework/phpbb_functional_test_case.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 15f7814800..72990d3a21 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -596,9 +596,9 @@ class phpbb_functional_test_case extends phpbb_test_case /** * Creates a topic - * + * * Be sure to login before creating - * + * * @param int $forum_id * @param string $subject * @param string $message @@ -620,9 +620,9 @@ class phpbb_functional_test_case extends phpbb_test_case /** * Creates a post - * + * * Be sure to login before creating - * + * * @param int $forum_id * @param int $topic_id * @param string $subject From c30d4025d2976db3f55a8d477e27ca5598f83f69 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Aug 2013 01:36:38 +0200 Subject: [PATCH 268/284] [ticket/11775] Fix doc blocks syntax PHPBB3-11775 --- tests/test_framework/phpbb_functional_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 72990d3a21..7d8b4a3144 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -689,7 +689,7 @@ class phpbb_functional_test_case extends phpbb_test_case ); } - /* + /** * Returns the requested parameter from a URL * * @param string $url From 48f6f4559c9d3df49b56f0831a89b516f0f2f34f Mon Sep 17 00:00:00 2001 From: rechosen Date: Fri, 16 Aug 2013 17:48:36 +0200 Subject: [PATCH 269/284] [ticket/11794] Add missing array element commas to docs/coding-guidelines.html Even though the coding guidelines document prescribes "commas after every array element", it contains several example code fragments with array elements not terminated by a comma. This commit fixes that. PHPBB3-11794 --- phpBB/docs/coding-guidelines.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index a541fe8866..f3d161589b 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -728,7 +728,7 @@ $sql = 'SELECT * $sql_ary = array( 'somedata' => $my_string, 'otherdata' => $an_int, - 'moredata' => $another_int + 'moredata' => $another_int, ); $db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); @@ -740,7 +740,7 @@ $db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('I $sql_ary = array( 'somedata' => $my_string, 'otherdata' => $an_int, - 'moredata' => $another_int + 'moredata' => $another_int, ); $sql = 'UPDATE ' . SOME_TABLE . ' @@ -833,20 +833,20 @@ $sql_array = array( 'FROM' => array( FORUMS_WATCH_TABLE => 'fw', - FORUMS_TABLE => 'f' + FORUMS_TABLE => 'f', ), 'LEFT_JOIN' => array( array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' - ) + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id', + ), ), 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id', - 'ORDER_BY' => 'left_id' + 'ORDER_BY' => 'left_id', ); $sql = $db->sql_build_query('SELECT', $sql_array); @@ -860,13 +860,13 @@ $sql_array = array( 'FROM' => array( FORUMS_WATCH_TABLE => 'fw', - FORUMS_TABLE => 'f' + FORUMS_TABLE => 'f', ), 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id', - 'ORDER_BY' => 'left_id' + 'ORDER_BY' => 'left_id', ); if ($config['load_db_lastread']) @@ -874,8 +874,8 @@ if ($config['load_db_lastread']) $sql_array['LEFT_JOIN'] = array( array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' - ) + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id', + ), ); $sql_array['SELECT'] .= ', ft.mark_time '; From 87dd739a84375958af618605e580127f3d0e1784 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 16 Aug 2013 18:51:31 +0300 Subject: [PATCH 270/284] [ticket/11796] Replace pagination with pagination.html PHPBB3-11796 --- phpBB/styles/prosilver/template/mcp_forum.html | 15 +-------------- .../styles/prosilver/template/mcp_warn_list.html | 15 +-------------- .../styles/prosilver/template/search_results.html | 15 +-------------- .../styles/prosilver/template/viewtopic_body.html | 12 +----------- 4 files changed, 4 insertions(+), 53 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 45e6c10d46..e5dcb94855 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -100,20 +100,7 @@