[PHPBB3-10661] - UCP > PM > Compose > enumerated recipients > BCC group misses a (prosilver)
+
[PHPBB3-10678] - Provide Firebird, Oracle, and increased MSSQL support in unit tests
+
[PHPBB3-10772] - trigger_error is using the default style
+
[PHPBB3-10789] - PM print template (prosilver) with unnecessary variables
+
[PHPBB3-10820] - Display images directly in IE9 and 10 instead of download
+
[PHPBB3-10828] - PostgreSQL dbal tests try to connect to the database named as user specified in configuration
+
[PHPBB3-10838] - Functional tests are not mentioned in RUNNING_TESTS.txt
+
[PHPBB3-10840] - If you add a member to a group, the form_token can be set to 0 if the creation_time is 0 too. Maybe even if creation_time is unchanged.
+
[PHPBB3-10848] - Wrong redirect to installer from acp
+
[PHPBB3-10850] - create_schema_files.php is not creating the oracle or postgres' schema file properly
+
[PHPBB3-10879] - prosilver: attachment-link will be displayed wrong, when filename is too long
+
[PHPBB3-10880] - m_approve should not imply f_noapprove
+
[PHPBB3-10896] - board_email & board_contact are not validated as email addresses in ACP
[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
-
1.vi. Changes since 3.0.6
+
1.vii. Changes since 3.0.6
[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)
@@ -1282,7 +1430,7 @@
-
1.vii. Changes since 3.0.5
+
1.viii. Changes since 3.0.5
[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
@@ -1504,7 +1652,7 @@
[Feature] Send anonymous statistical information to phpBB on installation and update (optional).
-
1.viii. Changes since 3.0.4
+
1.ix. Changes since 3.0.4
[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
@@ -1593,7 +1741,7 @@
[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)
-
1.ix. Changes since 3.0.3
+
1.x. Changes since 3.0.3
[Fix] Allow mixed-case template directories to be inherited (Bug #36725)
@@ -1625,7 +1773,7 @@
[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
-
1.x. Changes since 3.0.2
+
1.xi. Changes since 3.0.2
[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
@@ -1724,7 +1872,7 @@
[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
-
1.xi. Changes since 3.0.1
+
1.xii. Changes since 3.0.1
[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
@@ -1772,7 +1920,7 @@
[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
-
1.xii Changes since 3.0.0
+
1.xiii Changes since 3.0.0
[Change] Validate birthdays (Bug #15004)
@@ -1843,7 +1991,7 @@
[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
-
1.xiii. Changes since 3.0.RC8
+
1.xiv. Changes since 3.0.RC8
[Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
@@ -1852,7 +2000,7 @@
[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
-
1.xiv. Changes since 3.0.RC7
+
1.xv. Changes since 3.0.RC7
[Fix] Fixed MSSQL related bug in the update system
@@ -1887,7 +2035,7 @@
[Fix] No duplication of active topics (Bug #15474)
-
1.xv. Changes since 3.0.RC6
+
1.xvi. Changes since 3.0.RC6
[Fix] Submitting language changes using acp_language (Bug #14736)
@@ -1897,7 +2045,7 @@
[Fix] Able to request new password (Bug #14743)
-
1.xvi. Changes since 3.0.RC5
+
1.xvii. Changes since 3.0.RC5
[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
@@ -1960,7 +2108,7 @@
[Sec] New password hashing mechanism for storing passwords (#i42)
-
1.xvii. Changes since 3.0.RC4
+
1.xviii. Changes since 3.0.RC4
[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
@@ -2011,7 +2159,7 @@
[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
-
1.xviii. Changes since 3.0.RC3
+
1.xix. Changes since 3.0.RC3
[Fix] Fixing some subsilver2 and prosilver style issues
@@ -2120,7 +2268,7 @@
-
1.xviv. Changes since 3.0.RC2
+
1.xx. Changes since 3.0.RC2
[Fix] Re-allow searching within the memberlist
@@ -2166,7 +2314,7 @@
-
1.xx. Changes since 3.0.RC1
+
1.xxi. Changes since 3.0.RC1
[Fix] (X)HTML issues within the templates (Bug #11255, #11255)
@@ -2301,7 +2449,7 @@
-
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
+
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
There are people, companies (unrelated to your hosting provider), etc. that will install your forum, either for free or for a payment. We do not recommend you make use of these offers. Unless the service is provided by your hosting company you will have to divulge passwords and other sensitive details. If you did not know how to use an ATM would you give a passer-by your bank card and PIN and ask them to show you what to do? No, probably not! The same applies to your hosting account details!
-
We think a better solution is for you to carefully read the enclosed documentation, read through our knowledge base at www.phpbb.com and if necessary ask for help on any thing you get stuck on. However, the decision is yours but please note we may not offer support if we believe you have had the board installed by a third party. In such cases you should direct your questions to that company or person/s.
+
We think a better solution is for you to carefully read the enclosed documentation, read through our knowledge base at www.phpbb.com and if necessary ask for help on any thing you get stuck on. However, the decision is yours but please note we may not offer support if we believe you have had the board installed by a third party. In such cases you should direct your questions to that company or person/s.
@@ -143,7 +143,7 @@ I want to sue you because i think you host an illegal board!
-
This error will occur if phpBB cannot send mail. phpBB can send email two ways; using the PHP mail() function or directly via SMTP. Some hosting providers limit the mail() function to prevent its use in spamming, others may rename it or limit its functionality. If the mail() function got renamed, you are able to enter the correct name within the administration control panel. In either case you may need to make use of SMTP. This requires that you have access to such a facility, e.g. your hosting provider may provide one (perhaps requiring specific written authorisation), etc. Please see www.phpbb.com for additional help on this matter.
+
This error will occur if phpBB cannot send mail. phpBB can send email two ways; using the PHP mail() function or directly via SMTP. Some hosting providers limit the mail() function to prevent its use in spamming, others may rename it or limit its functionality. If the mail() function got renamed, you are able to enter the correct name within the administration control panel. In either case you may need to make use of SMTP. This requires that you have access to such a facility, e.g. your hosting provider may provide one (perhaps requiring specific written authorisation), etc. Please see www.phpbb.com for additional help on this matter.
If you do require SMTP services please do not ask (on our forums or elsewhere) for someone to provide you with one. Open relays are now things of the past thanks to the unthinking spammers out there. Therefore you are unlikely to find someone willing to offer you (free) services.
@@ -243,7 +243,7 @@ I want to sue you because i think you host an illegal board!
-
Please read the paragraph about permissions in our extensive online documentation.
+
Please read the paragraph about permissions in our extensive online documentation.
@@ -299,11 +299,11 @@ I want to sue you because i think you host an illegal board!
Feel free to search our community forum for the information you require. PLEASE DO NOT post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:
@@ -321,7 +321,7 @@ I want to sue you because i think you host an illegal board!
-
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
+
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
This document will walk you through the basics on installing, updating and converting the forum software.
-
A basic overview of running phpBB3 can be found in the accompanying README file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read the documentation available online.
+
A basic overview of running phpBB3 can be found in the accompanying README file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read the documentation available online.
Install
@@ -220,7 +220,7 @@
Administrator details
-
Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from www.phpbb.com, and add them before installing or later.
+
Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from www.phpbb.com, and add them before installing or later.
Configuration file
@@ -299,7 +299,7 @@
To perform the update, either follow the instructions from the Administration Control Panel->System Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.
-
Go to the downloads page and download the latest update package listed there, matching your current version.
+
Go to the downloads page and download the latest update package listed there, matching your current version.
Upload the uncompressed archive contents to your phpBB installation - only the install folder is required. Upload the whole install folder, retaining the file structure.
After the install folder is present, phpBB3 will go offline automatically.
Point your browser to the install directory, for example http://www.example.com/phpBB3/install/
@@ -346,7 +346,7 @@
As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB3 database tables and copying additional data over to your phpBB3 installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.
-
Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: Knowledge Base - Offline Conversions
+
Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: Knowledge Base - Offline Conversions
Once completed, your board should be immediately available. If you encountered errors, you should report the problems to our bug tracker or seek help via our forums (see README for details).
@@ -430,7 +430,7 @@
-
Like any online site that allows user input, your board could be subject to unwanted posts; often referred to as forum spam. The vast majority of these attacks will be from automated computer programs known as spambots. The attacks, generally, are not personal as the spammers are just trying to find accessible targets. phpBB has a number of anti-spam measures built in, including a range of CAPTCHAs. However, administrators are strongly urged to read and follow the advice for Preventing Spam in phpBB as soon as possible after completing the installation of your board.
+
Like any online site that allows user input, your board could be subject to unwanted posts; often referred to as forum spam. The vast majority of these attacks will be from automated computer programs known as spambots. The attacks, generally, are not personal as the spammers are just trying to find accessible targets. phpBB has a number of anti-spam measures built in, including a range of CAPTCHAs. However, administrators are strongly urged to read and follow the advice for Preventing Spam in phpBB as soon as possible after completing the installation of your board.
Thank you for downloading phpBB3. This README will guide through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully before proceeding with the installation.
+
Thank you for downloading phpBB3. This README will guide you through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully before proceeding with the installation.
Installation, update and conversion instructions can be found in the INSTALL document contained in this distribution. If you are intending to convert from a previous phpBB 2.0.x or 3.0.x installation we highly recommend you backup any existing data before proceeding!
+
Installation, update and conversion instructions can be found in the INSTALL document in this directory. If you are intending on converting from a phpBB 2.0.x or 3.0.x installation we highly recommend that you backup any existing data before proceeding!
Users of phpBB 3.0 and 3.1 Beta versions cannot directly update.
-
Please note that we won't support the following installation types:
+
Please note that we don't support the following installation types:
Updates from phpBB 3.0 Beta versions to phpBB 3.0 RC1 and higher
Updates from phpBB 3.1 Beta versions to phpBB 3.1 RC1 and higher
@@ -103,8 +102,8 @@
Updates from phpBB 3.0 RC1 and 3.1 RC1 to the latest version
Note: if using the Automatic Update Package, updates are supported from phpBB 3.0.2 onward. To update a pre-3.0.2 installation, first update to 3.0.2 and then update to the current version.
Conversions from phpBB 2.0.x to the latest version
-
New installations of phpBB 3.0.x - always only the latest released version
-
New installations of phpBB 3.1.x - always only the latest released version
+
New installations of phpBB 3.0.x - only the latest released version
+
New installations of phpBB 3.1.x - only the latest released version
@@ -127,21 +126,21 @@
2.i. Languages (Internationalisation - i18n)
-
A number of language packs with included style localisations are available. You can find them listed in the Language Packs pages of our downloads section or from the Language Packs section of the Customisation Database.
+
A number of language packs with included style localisations are available. You can find them listed in the Language Packs pages of our downloads section or from the Language Packs section of the Customisation Database.
This is the official location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. So please, do not ask for help in these cases!
+
This is the official location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. Please do not ask for support if you download a language pack from a 3rd party site.
-
Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included language and styles folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: System tab -> General Tasks -> Language packs. A more detailed description of the process is in the Knowledge Base article, How to Install a Language Pack.
+
Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included language and styles folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: System tab -> General Tasks -> Language packs. A more detailed description of the process is in the Knowledge Base article, How to Install a Language Pack.
-
If your language is not available, please visit our [3.0.x] Translations forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can Apply to become a translator.
+
If your language is not available, please visit our [3.0.x] Translations forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can Apply to become a translator.
2.ii. Styles
-
Although the phpBB Group is rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the Styles section of our Customisation Database.
+
Although the phpBB Group is rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the Styles section of our Customisation Database.
Please note that 3rd party styles downloaded for versions of phpBB2 will not work in phpBB3. It is also important to ensure that the style is updated to match the current version of the phpBB software you are using.
@@ -151,9 +150,9 @@
2.iii. Modifications
-
Although not officially supported by the phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB software, known as MODs, extend its capabilities still further. You can browse through many of the MODs in the Modifications section of our Customisation Database.
+
Although not officially supported by the phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB software, known as MODs, extend its capabilities still further. You can browse through many of the MODs in the Modifications section of our Customisation Database.
Please remember that any bugs or other issues that occur after you have added any modification should NOT be reported to the bug tracker (see below). First remove the MOD and see if the problem is resolved. Any support for a MOD should only be sought in the "Discussion/Support" forum for that MOD.
@@ -175,35 +174,35 @@
-
phpBB3 can seem a little daunting to new users in places, particularly with regard the permission system. The first thing you should do is check the FAQ which covers a few basic getting started questions. If you need additional help there are several places you should look.
+
phpBB3 can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the FAQ, which covers a few basic getting started questions. If you need additional help there are several places you can find it.
3.i. phpBB3 Documentation
-
A comprehensive documentation is now available online and can be accessed from the following location:
+
Comprehensive documentation is now available on the phpBB website:
This covers everything from installation through setting permissions and managing users.
+
This covers everything from installation to setting permissions and managing users.
3.ii. Knowledge Base
The Knowledge Base consists of a number of detailed articles on some common issues phpBB users may encounter while using the product. The Knowledge Base can be found at:
The phpBB Group maintains a thriving community where a number of people have generously decided to donate their time to help support users. This site can be found at:
If you do seek help via our forums please be sure to do a Search before posting. This may well save both you and us time and allow the developer, moderator and support groups to spend more time responding to people with unknown issues and problems. Please also remember that phpBB is an entirely volunteer effort, no one receives any compensation for the time they give, this includes moderators as well as developers. So please be respectful and mindful when awaiting responses.
+
If you do seek help via our forums please be sure to do a search before posting; if someone has experienced the issue before, then you may find that your question has already been answered. Please remember that phpBB is entirely staffed by volunteers, no one receives any compensation for the time they give, including moderators as well as developers; please be respectful and mindful when awaiting responses and receiving support.
3.iv Internet Relay Chat
Another place you may find help is our IRC channel. This operates on the Freenode IRC network, irc.freenode.net and the channel is #phpbb and can be accessed by any decent IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.
The relevant database type/version is listed within the administration control panel.
-
Please also be as detailed as you can in your report, if possible list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request on GitHub.
+
Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository on GitHub.
If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.1.x the coding guidelines may be found here: http://area51.phpbb.com/docs/31x/coding-guidelines.html
@@ -278,7 +277,7 @@
If you find a potential security related vulnerability in phpBB please DO NOT post it to the bug tracker, public forums, etc.! Doing so may allow unscrupulous users to take advantage of it before we have time to put a fix in place. All security related bugs should be sent to our security tracker:
This list is not complete but does represent those bugs which may affect users on a wider scale. Other bugs listed in the tracker have typically been shown to be limited to certain setups or methods of installation, updating and/or conversions.
-
Conversions may fail to complete on large boards under some hosts
-
Updates may fail to complete on large update sets under some hosts
+
Conversions may fail to complete on large boards under some hosts.
+
Updates may fail to complete on large update sets under some hosts.
Smilies placed directly after bbcode tags will not get parsed. Smilies always need to be separated by spaces.
@@ -322,7 +321,7 @@
phpBB 3.1.x takes advantage of new features added in PHP 5.3. We recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 5.3.3.
-
Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.
+
Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.
This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.
diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html
index 249ceebfbc..f45ea5e5c8 100644
--- a/phpBB/docs/auth_api.html
+++ b/phpBB/docs/auth_api.html
@@ -268,7 +268,7 @@ $auth_admin = new auth_admin();
-
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
+
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence www.phpbb.com will not make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).
+
it will be included and executed inline.
A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence www.phpbb.com will not make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).
Conditionals/Control structures
The most significant addition to 3.x are conditions or control structures, "if something then do this else do that". The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:
@@ -2499,7 +2499,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
-
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
+
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html
index 6dd84bfc23..3f209b8a34 100644
--- a/phpBB/docs/hook_system.html
+++ b/phpBB/docs/hook_system.html
@@ -861,7 +861,7 @@ function phpbb_hook_register(&$hook)
-
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
+
This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.
',
'ACL_NEVER' => 'Never',
diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php
index 27ef714f8b..98679ad544 100644
--- a/phpBB/language/en/acp/permissions_phpbb.php
+++ b/phpBB/language/en/acp/permissions_phpbb.php
@@ -152,7 +152,8 @@ $lang = array_merge($lang, array(
'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_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'),
@@ -173,8 +174,9 @@ $lang = array_merge($lang, array(
// Moderator Permissions
$lang = array_merge($lang, array(
'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_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'),
diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php
index 89e171744f..ea3eadb0dd 100644
--- a/phpBB/language/en/acp/posting.php
+++ b/phpBB/language/en/acp/posting.php
@@ -83,7 +83,8 @@ $lang = array_merge($lang, array(
'NUMBER' => 'Any series of digits',
'EMAIL' => 'A valid email address',
'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://” is prefixed to the string.',
- 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol.',
+ 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol, as links are prefixed with “%s”',
+ 'RELATIVE_URL' => 'A relative URL. You can use this to match parts of a URL, but be careful: a full URL is a valid relative URL. When you want to use relative URLs of your board, use the LOCAL_URL token.',
'COLOR' => 'A HTML colour, can be either in the numeric form #FF1234 or a CSS colour keyword such as fuchsia or InactiveBorder'
)
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index cdfd3416f5..b188d90f3a 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -204,8 +204,8 @@ $lang = array_merge($lang, array(
'ERR_TEMPLATE_EVENT_LOCATION' => 'The specified template event location [%s] is improperly formatted.',
'ERR_TEMPLATE_COMPILATION' => 'The file could not be compiled: %s',
'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.',
- 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.',
- 'ERR_WATCHING' => 'An error occured while trying to subscribe.',
+ 'ERR_UNWATCHING' => 'An error occurred while trying to unsubscribe.',
+ 'ERR_WATCHING' => 'An error occurred while trying to subscribe.',
'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.',
'ERROR' => 'Error',
'EXPAND_VIEW' => 'Expand view',
@@ -338,7 +338,7 @@ $lang = array_merge($lang, array(
'LAST_VISIT' => 'Last visit',
'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.',
'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.',
- 'LDAP_SEARCH_FAILED' => 'An error occured while searching the LDAP directory.',
+ 'LDAP_SEARCH_FAILED' => 'An error occurred while searching the LDAP directory.',
'LEGEND' => 'Legend',
'LOADING' => 'Loading',
'LOCATION' => 'Location',
@@ -519,8 +519,12 @@ $lang = array_merge($lang, array(
'POSTS' => 'Posts',
'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.',
'POST_BY_AUTHOR' => 'by',
- 'POST_BY_FOE' => 'This post was made by %1$s who is currently on your ignore list. %2$sDisplay this post%3$s.',
+ 'POST_BY_FOE' => '%1$s, who is currently on your ignore list, made this post.',
+ 'POST_DISPLAY' => '%1$sDisplay this post%2$s.',
'POST_DAY' => '%.2f posts per day',
+ 'POST_DELETED' => 'Deleted post:',
+ 'POST_DELETED_BY' => '%2$s deleted the post by %1$s on %3$s.',
+ 'POST_DELETED_BY_REASON'=> '%2$s deleted the post by %1$s on %3$s for the following reason: %4$s',
'POST_DETAILS' => 'Post details',
'POST_NEW_TOPIC' => 'Post new topic',
'POST_PCT' => '%.2f%% of all posts',
diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php
index 9500943b88..68dc05f992 100644
--- a/phpBB/language/en/help_faq.php
+++ b/phpBB/language/en/help_faq.php
@@ -328,7 +328,7 @@ $help = array(
),
array(
0 => 'Who wrote this bulletin board?',
- 1 => 'This software (in its unmodified form) is produced, released and is copyright phpBB Group. It is made available under the GNU General Public License and may be freely distributed. See the link for more details.'
+ 1 => 'This software (in its unmodified form) is produced, released and is copyright phpBB Group. It is made available under the GNU General Public License and may be freely distributed. See the link for more details.'
),
array(
0 => 'Why isn’t X feature available?',
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 7607512eab..be45047861 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -78,7 +78,7 @@ $lang = array_merge($lang, array(
'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion',
'CONVERT' => 'Convert',
'CONVERT_COMPLETE' => 'Conversion completed',
- 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.',
+ 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.',
'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework',
'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.',
'CONVERT_NEW_CONVERSION' => 'New conversion',
@@ -192,7 +192,7 @@ $lang = array_merge($lang, array(
Convert an existing board to phpBB3
The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.
Go live with your phpBB3!
-
Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.
Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.',
+
Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.
Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.',
'INSTALL_INTRO' => 'Welcome to Installation',
'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.
In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:
@@ -275,7 +275,7 @@ $lang = array_merge($lang, array(
'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again: »%s.',
'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again: »%s.',
- 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s. Before you proceed the update, you need to upgrade the schema.
Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.',
+ 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s. Before you proceed the update, you need to upgrade the schema.
%s',
'NEXT_STEP' => 'Proceed to next step',
@@ -286,7 +286,7 @@ $lang = array_merge($lang, array(
'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel',
'NO_TABLES_FOUND' => 'No tables found.',
- 'OVERVIEW_BODY' => 'Welcome to phpBB3!
phpBB™ is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.
This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.
To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.',
+ 'OVERVIEW_BODY' => 'Welcome to phpBB3!
phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.
This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.
To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.',
'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support',
'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.',
@@ -346,7 +346,7 @@ $lang = array_merge($lang, array(
'SUB_LICENSE' => 'License',
'SUB_SUPPORT' => 'Support',
'SUCCESSFUL_CONNECT' => 'Successful connection',
- 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:
installation
configuration
technical questions
problems relating to potential bugs in the software
updating from Release Candidate (RC) versions to the latest stable version
converting from phpBB 2.0.x to phpBB3
converting from other discussion board software to phpBB3 (please see the Convertors Forum)
We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.
MODs / Styles
For issues relating to MODs, please post in the appropriate Modifications Forum. For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.
If your question relates to a specific package, please post directly in the topic dedicated to the package.
',
+ 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:
installation
configuration
technical questions
problems relating to potential bugs in the software
updating from Release Candidate (RC) versions to the latest stable version
converting from phpBB 2.0.x to phpBB3
converting from other discussion board software to phpBB3 (please see the Convertors Forum)
We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.
MODs / Styles
For issues relating to MODs, please post in the appropriate Modifications Forum. For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.
If your question relates to a specific package, please post directly in the topic dedicated to the package.
',
'SYNC_FORUMS' => 'Starting to synchronise forums',
'SYNC_POST_COUNT' => 'Synchronising post_counts',
'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.',
@@ -364,7 +364,7 @@ $lang = array_merge($lang, array(
'UNAVAILABLE' => 'Unavailable',
'UNWRITABLE' => 'Unwritable',
'UPDATE_TOPICS_POSTED' => 'Generating topics posted information',
- 'UPDATE_TOPICS_POSTED_ERR' => 'An error occured while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.',
+ 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.',
'VERIFY_OPTIONS' => 'Verifying conversion options',
'VERSION' => 'Version',
@@ -472,7 +472,7 @@ $lang = array_merge($lang, array(
'NO_ERRORS' => 'No errors',
'NO_UPDATE_FILES' => 'Not updating the following files',
'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.',
- 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.
Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit http://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.',
+ 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.
Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit https://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.',
'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.',
'NO_UPDATE_INFO' => 'Update file information could not be found.',
'NO_UPDATES_REQUIRED' => 'No updates required',
@@ -540,7 +540,7 @@ $lang = array_merge($lang, array(
The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:
Upload the complete uncompressed install folder to your phpBB root directory (where your config.php file is).
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 29f418183f..b75e0ea495 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -52,6 +52,10 @@ $lang = array_merge($lang, array(
'APPROVE_POST_CONFIRM' => 'Are you sure you want to approve this post?',
'APPROVE_POSTS' => 'Approve posts',
'APPROVE_POSTS_CONFIRM' => 'Are you sure you want to approve the selected posts?',
+ 'APPROVE_TOPIC' => 'Approve topic',
+ 'APPROVE_TOPIC_CONFIRM' => 'Are you sure you want to approve this topic?',
+ 'APPROVE_TOPICS' => 'Approve topics',
+ 'APPROVE_TOPICS_CONFIRM'=> 'Are you sure you want to approve the selected topics?',
'CANNOT_MOVE_SAME_FORUM'=> 'You cannot move a topic to the forum it’s already in.',
'CANNOT_WARN_ANONYMOUS' => 'You cannot warn unregistered guest users.',
@@ -72,16 +76,12 @@ $lang = array_merge($lang, array(
'DELETE_PM_REPORTS' => 'Delete PM reports',
'DELETE_PM_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected PM reports?',
'DELETE_POSTS' => 'Delete posts',
- 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?',
- 'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?',
'DELETE_REPORT' => 'Delete report',
'DELETE_REPORT_CONFIRM' => 'Are you sure you want to delete the selected report?',
'DELETE_REPORTS' => 'Delete reports',
'DELETE_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected reports?',
'DELETE_SHADOW_TOPIC' => 'Delete shadow topic',
'DELETE_TOPICS' => 'Delete selected topics',
- 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?',
- 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
'DISAPPROVE' => 'Disapprove',
'DISAPPROVE_REASON' => 'Reason for disapproval',
'DISAPPROVE_POST' => 'Disapprove post',
@@ -201,6 +201,10 @@ $lang = array_merge($lang, array(
'MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN' => 'This is a list of all posts which require approving before they will be visible to users.',
'MCP_QUEUE_UNAPPROVED_TOPICS' => 'Topics awaiting approval',
'MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN' => 'This is a list of all topics which require approving before they will be visible to users.',
+ 'MCP_QUEUE_DELETED_POSTS' => 'Deleted posts',
+ 'MCP_QUEUE_DELETED_POSTS_EXPLAIN' => 'This is a list of all soft deleted posts. You can restore or permanently delete the posts from this screen.',
+ 'MCP_QUEUE_DELETED_TOPICS' => 'Deleted topics',
+ 'MCP_QUEUE_DELETED_TOPICS_EXPLAIN' => 'This is a list of all soft deleted topics. You can restore or permanently delete the topics from this screen.',
'MCP_VIEW_USER' => 'View warnings for a specific user',
@@ -238,6 +242,7 @@ $lang = array_merge($lang, array(
'NO_POST' => 'You have to select a post in order to warn the user for a post.',
'NO_POST_REPORT' => 'This post was not reported.',
'NO_POST_SELECTED' => 'You must select at least one post to perform this action.',
+ 'NO_POSTS_DELETED' => 'There are no deleted posts.',
'NO_POSTS_QUEUE' => 'There are no posts waiting for approval.',
'NO_REASON_DISAPPROVAL' => 'Please give an appropriate reason for disapproval.',
'NO_REPORT' => 'No report found',
@@ -245,6 +250,7 @@ $lang = array_merge($lang, array(
'NO_REPORT_SELECTED' => 'You must select at least one report to perform this action.',
'NO_TOPIC_ICON' => 'None',
'NO_TOPIC_SELECTED' => 'You must select at least one topic to perform this action.',
+ 'NO_TOPICS_DELETED' => 'There are no deleted topics.',
'NO_TOPICS_QUEUE' => 'There are no topics waiting for approval.',
'ONLY_TOPIC' => 'Only topic “%s”',
@@ -269,15 +275,17 @@ $lang = array_merge($lang, array(
'POSTS_DISAPPROVED_SUCCESS' => 'The selected posts have been disapproved.',
'POSTS_LOCKED_SUCCESS' => 'The selected posts have been locked successfully.',
'POSTS_MERGED_SUCCESS' => 'The selected posts have been merged.',
- 'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POSTS_PER_PAGE' => 'Posts per page',
'POSTS_PER_PAGE_EXPLAIN' => '(Set to 0 to view all posts.)',
+ 'POSTS_RESTORED_SUCCESS' => 'The selected posts have been restored successfully.',
+ 'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POST_APPROVED_SUCCESS' => 'The selected post has been approved.',
'POST_DELETED_SUCCESS' => 'The selected post has been successfully removed from the database.',
'POST_DISAPPROVED_SUCCESS' => 'The selected post has been disapproved.',
'POST_LOCKED_SUCCESS' => 'Post locked successfully.',
'POST_NOT_EXIST' => 'The post you requested does not exist.',
'POST_REPORTED_SUCCESS' => 'This post has been successfully reported.',
+ 'POST_RESTORED_SUCCESS' => 'This post has been restored successfully.',
'POST_UNLOCKED_SUCCESS' => 'Post unlocked successfully.',
'READ_USERNOTES' => 'User notes',
@@ -304,6 +312,15 @@ $lang = array_merge($lang, array(
'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.',
'REPORT_REASON' => 'Report reason',
'REPORT_TIME' => 'Report time',
+ 'RESTORE' => 'Restore',
+ 'RESTORE_POST' => 'Restore post',
+ 'RESTORE_POST_CONFIRM' => 'Are you sure you want to restore this post?',
+ 'RESTORE_POSTS' => 'Restore posts',
+ 'RESTORE_POSTS_CONFIRM' => 'Are you sure you want to restore the selected posts?',
+ 'RESTORE_TOPIC' => 'Restore topic',
+ 'RESTORE_TOPIC_CONFIRM' => 'Are you sure you want to restore this topic?',
+ 'RESTORE_TOPICS' => 'Restore topics',
+ 'RESTORE_TOPICS_CONFIRM' => 'Are you sure you want to restore the selected topics?',
'RESYNC' => 'Resync',
'RETURN_MESSAGE' => '%sReturn to the message%s',
'RETURN_NEW_FORUM' => '%sGo to the new forum%s',
@@ -344,6 +361,7 @@ $lang = array_merge($lang, array(
'TOPICS_FORKED_SUCCESS' => 'The selected topics have been copied successfully.',
'TOPICS_LOCKED_SUCCESS' => 'The selected topics have been locked.',
'TOPICS_MOVED_SUCCESS' => 'The selected topics have been moved successfully.',
+ 'TOPICS_RESTORED_SUCCESS' => 'The selected topics have been restored successfully.',
'TOPICS_RESYNC_SUCCESS' => 'The selected topics have been resynchronised.',
'TOPICS_TYPE_CHANGED' => 'Topic types changed successfully.',
'TOPICS_UNLOCKED_SUCCESS' => 'The selected topics have been unlocked.',
@@ -354,6 +372,7 @@ $lang = array_merge($lang, array(
'TOPIC_LOCKED_SUCCESS' => 'The selected topic has been locked.',
'TOPIC_MOVED_SUCCESS' => 'The selected topic has been moved successfully.',
'TOPIC_NOT_EXIST' => 'The topic you selected does not exist.',
+ 'TOPIC_RESTORED_SUCCESS' => 'The selected topic has been restored successfully.',
'TOPIC_RESYNC_SUCCESS' => 'The selected topic has been resynchronised.',
'TOPIC_SPLIT_SUCCESS' => 'The selected topic has been split successfully.',
'TOPIC_TIME' => 'Topic time',
diff --git a/phpBB/language/en/migrator.php b/phpBB/language/en/migrator.php
index f94c27be8c..34dcbf4c52 100644
--- a/phpBB/language/en/migrator.php
+++ b/phpBB/language/en/migrator.php
@@ -45,7 +45,7 @@ $lang = array_merge($lang, array(
'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".',
'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %s',
- 'MODULE_ERROR' => 'An error occured while creating a module: %s',
+ 'MODULE_ERROR' => 'An error occurred while creating a module: %s',
'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s',
'MODULE_NOT_EXIST' => 'A required module does not exist: %s',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 7651ff2b63..0e8d59a92e 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -77,8 +77,20 @@ $lang = array_merge($lang, array(
'DELETE_MESSAGE' => 'Delete message',
'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this message?',
'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.',
+ 'DELETE_PERMANENTLY' => 'Delete permanently',
'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?',
- 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
+ 'DELETE_POST_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this post?',
+ 'DELETE_POST_PERMANENTLY' => 'Permanently delete this post so it can not be recovered',
+ 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?',
+ 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these posts?',
+ 'DELETE_REASON' => 'Soft delete reason',
+ 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.',
+ 'DELETE_POST_WARN' => 'Deleted this post',
+ 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
+ 'DELETE_TOPIC_PERMANENTLY' => 'Permanently delete this topic so it can not be recovered',
+ 'DELETE_TOPIC_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this topic?',
+ 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?',
+ 'DELETE_TOPICS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these topics?',
'DISABLE_BBCODE' => 'Disable BBCode',
'DISABLE_MAGIC_URL' => 'Do not automatically parse URLs',
'DISABLE_SMILIES' => 'Disable smilies',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index a91b6b84d5..51823ddb12 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -38,7 +38,7 @@ if (empty($lang) || !is_array($lang))
$lang = array_merge($lang, array(
'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.
- Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “GNU General Public License v2” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: http://www.phpbb.com/.
+ Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “GNU General Public License v2” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: https://www.phpbb.com/.
You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised.
',
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php
index 278c064fe7..6f318c39f1 100644
--- a/phpBB/language/en/viewtopic.php
+++ b/phpBB/language/en/viewtopic.php
@@ -50,6 +50,7 @@ $lang = array_merge($lang, array(
'CODE' => 'Code',
'DELETE_TOPIC' => 'Delete topic',
+ 'DELETED_INFORMATION' => 'Deleted by %1$s on %2$s',
'DISAPPROVE' => 'Disapprove',
'DOWNLOAD_NOTICE' => 'You do not have the required permissions to view the files attached to this post.',
@@ -89,6 +90,7 @@ $lang = array_merge($lang, array(
'POLL_ENDED_AT' => 'Poll ended at %s',
'POLL_RUN_TILL' => 'Poll runs till %s',
'POLL_VOTED_OPTION' => 'You voted for this option',
+ 'POST_DELETED_RESTORE' => 'This post has been deleted. It can be restored.',
'PRINT_TOPIC' => 'Print view',
'QUICK_MOD' => 'Quick-mod tools',
@@ -96,6 +98,8 @@ $lang = array_merge($lang, array(
'QUOTE' => 'Quote',
'REPLY_TO_TOPIC' => 'Reply to topic',
+ 'RESTORE' => 'Restore',
+ 'RESTORE_TOPIC' => 'Restore topic',
'RETURN_POST' => '%sReturn to the post%s',
'SUBMIT_VOTE' => 'Submit vote',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index c36faad74b..5beea45c7d 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -158,6 +158,7 @@ if ($quickmod)
case 'move':
case 'delete_post':
case 'delete_topic':
+ case 'restore_topic':
$module->load('mcp', 'main', 'quickmod');
return;
break;
@@ -199,7 +200,7 @@ if (!$post_id)
$module->set_display('warn', 'warn_post', false);
}
-if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts')
+if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts' || $mode == 'deleted_topics' || $mode == 'deleted_posts')
{
$module->set_display('queue', 'approve_details', false);
}
@@ -483,7 +484,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
continue;
}
- if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ if ($row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
{
// Moderators without the permission to approve post should at least not see them. ;)
continue;
@@ -501,7 +502,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
*/
function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
{
- global $auth, $db, $user, $config;
+ global $auth, $db, $user, $config, $phpbb_container;
$rowset = array();
@@ -531,6 +532,8 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
WHERE " . $db->sql_in_set('f.forum_id', $forum_id);
$result = $db->sql_query($sql);
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
while ($row = $db->sql_fetchrow($result))
{
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
@@ -538,10 +541,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
continue;
}
- if ($auth->acl_get('m_approve', $row['forum_id']))
- {
- $row['forum_topics'] = $row['forum_topics_real'];
- }
+ $row['forum_topics_approved'] = $phpbb_content_visibility->get_count('forum_topics', $row, $row['forum_id']);
$rowset[$row['forum_id']] = $row;
}
@@ -619,7 +619,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
if (!$auth->acl_get('m_approve', $forum_id))
{
- $sql .= 'AND topic_approved = 1';
+ $sql .= 'AND topic_visibility = ' . ITEM_APPROVED;
}
break;
@@ -635,11 +635,13 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
if (!$auth->acl_get('m_approve', $forum_id))
{
- $sql .= 'AND post_approved = 1';
+ $sql .= 'AND post_visibility = ' . ITEM_APPROVED;
}
break;
case 'unapproved_posts':
+ case 'deleted_posts':
+ $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED;
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
@@ -648,9 +650,9 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
$where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
- AND p.post_approved = 0
+ AND p.post_visibility = ' . $visibility_const . '
AND t.topic_id = p.topic_id
- AND t.topic_first_post_id <> p.post_id';
+ AND t.topic_visibility <> p.post_visibility';
if ($min_time)
{
@@ -659,6 +661,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
break;
case 'unapproved_topics':
+ case 'deleted_topics':
+ $visibility_const = ($mode == 'unapproved_topics') ? ITEM_UNAPPROVED : ITEM_DELETED;
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
@@ -666,7 +670,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "
$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
- AND topic_approved = 0';
+ AND topic_visibility = ' . $visibility_const;
if ($min_time)
{
@@ -748,7 +752,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$limit_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_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_replies_real' : 't.topic_replies'), 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
break;
@@ -796,7 +800,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
'S_SELECT_SORT_DAYS' => $s_limit_days)
);
- if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts')) || $where_sql != 'WHERE')
+ if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE')
{
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 7ecf332720..46136dbdd4 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -638,7 +638,7 @@ switch ($mode)
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
- AND post_approved = 0';
+ AND post_visibility = ' . ITEM_UNAPPROVED;
$result = $db->sql_query($sql);
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
diff --git a/phpBB/includes/auth/auth.php b/phpBB/phpbb/auth/auth.php
similarity index 99%
rename from phpBB/includes/auth/auth.php
rename to phpBB/phpbb/auth/auth.php
index 2535247571..279959974d 100644
--- a/phpBB/includes/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -927,15 +927,14 @@ class phpbb_auth
*/
function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
- global $config, $db, $user, $phpbb_root_path, $phpEx;
+ global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container;
$method = trim(basename($config['auth_method']));
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- $method = 'login_' . $method;
- if (function_exists($method))
+ $provider = $phpbb_container->get('auth.provider.' . $method);
+ if ($provider)
{
- $login = $method($username, $password, $user->ip, $user->browser, $user->forwarded_for);
+ $login = $provider->login($username, $password);
// If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS
if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE)
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/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
new file mode 100644
index 0000000000..2e80436f78
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -0,0 +1,259 @@
+db = $db;
+ $this->config = $config;
+ $this->request = $request;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')))
+ {
+ return $this->user->lang['APACHE_SETUP_BEFORE_USE'];
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'));
+ $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW'));
+
+ if (!empty($php_auth_user) && !empty($php_auth_pw))
+ {
+ if ($php_auth_user !== $username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
+ FROM ' . USERS_TABLE . "
+ WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+
+ // this is the user's first login so create an empty profile
+ return array(
+ 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
+ 'error_msg' => false,
+ 'user_row' => user_row_apache($php_auth_user, $php_auth_pw),
+ );
+ }
+
+ // Not logged into apache
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function autologin()
+ {
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ return array();
+ }
+
+ $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'));
+ $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW'));
+
+ if (!empty($php_auth_user) && !empty($php_auth_pw))
+ {
+ set_var($php_auth_user, $php_auth_user, 'string', true);
+ set_var($php_auth_pw, $php_auth_pw, 'string', true);
+
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . "
+ WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row;
+ }
+
+ if (!function_exists('user_add'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
+ // create the user if he does not exist yet
+ user_add(user_row_apache($php_auth_user, $php_auth_pw));
+
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($php_auth_user)) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ return $row;
+ }
+ }
+
+ return array();
+ }
+
+ /**
+ * This function generates an array which can be passed to the user_add
+ * function in order to create a user
+ *
+ * @param string $username The username of the new user.
+ * @param string $password The password of the new user.
+ * @return array Contains data that can be passed directly to
+ * the user_add function.
+ */
+ private function user_row($username, $password)
+ {
+ // first retrieve default group id
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "'
+ AND group_type = " . GROUP_SPECIAL;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ trigger_error('NO_GROUP');
+ }
+
+ // generate user account data
+ return array(
+ 'username' => $username,
+ 'user_password' => phpbb_hash($password),
+ 'user_email' => '',
+ 'group_id' => (int) $row['group_id'],
+ 'user_type' => USER_NORMAL,
+ 'user_ip' => $this->user->ip,
+ 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0,
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function validate_session($user)
+ {
+ // Check if PHP_AUTH_USER is set and handle this case
+ if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ $php_auth_user = $this->request->server('PHP_AUTH_USER');
+
+ return ($php_auth_user === $user['username']) ? true : false;
+ }
+
+ // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not)
+ if ($user['user_type'] == USER_IGNORE)
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php
new file mode 100644
index 0000000000..7eaf8bb2d3
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/base.php
@@ -0,0 +1,72 @@
+db = $db;
+ $this->config = $config;
+ $this->request = $request;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // Auth plugins get the password untrimmed.
+ // For compatibility we trim() here.
+ $password = trim($password);
+
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $username_clean = utf8_clean_string($username);
+
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (($this->user->ip && !$this->config['ip_login_limit_use_forwarded']) ||
+ ($this->user->forwarded_for && $this->config['ip_login_limit_use_forwarded']))
+ {
+ $sql = 'SELECT COUNT(*) AS attempts
+ FROM ' . LOGIN_ATTEMPT_TABLE . '
+ WHERE attempt_time > ' . (time() - (int) $this->config['ip_login_limit_time']);
+ if ($this->config['ip_login_limit_use_forwarded'])
+ {
+ $sql .= " AND attempt_forwarded_for = '" . $this->db->sql_escape($this->user->forwarded_for) . "'";
+ }
+ else
+ {
+ $sql .= " AND attempt_ip = '" . $this->db->sql_escape($this->user->ip) . "' ";
+ }
+
+ $result = $this->db->sql_query($sql);
+ $attempts = (int) $this->db->sql_fetchfield('attempts');
+ $this->db->sql_freeresult($result);
+
+ $attempt_data = array(
+ 'attempt_ip' => $this->user->ip,
+ 'attempt_browser' => trim(substr($this->user->browser, 0, 149)),
+ 'attempt_forwarded_for' => $this->user->forwarded_for,
+ 'attempt_time' => time(),
+ 'user_id' => ($row) ? (int) $row['user_id'] : 0,
+ 'username' => $username,
+ 'username_clean' => $username_clean,
+ );
+ $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data);
+ $result = $this->db->sql_query($sql);
+ }
+ else
+ {
+ $attempts = 0;
+ }
+
+ if (!$row)
+ {
+ if ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max'])
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ATTEMPTS,
+ 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) ||
+ ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']);
+
+ // If there are too many login attempts, we need to check for a confirm image
+ // Every auth module is able to define what to do by itself...
+ if ($show_captcha)
+ {
+ // Visual Confirmation handling
+ if (!class_exists('phpbb_captcha_factory', false))
+ {
+ include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext);
+ }
+
+ $captcha = phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
+ $captcha->init(CONFIRM_LOGIN);
+ $vc_response = $captcha->validate($row);
+ if ($vc_response)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ATTEMPTS,
+ 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
+ 'user_row' => $row,
+ );
+ }
+ else
+ {
+ $captcha->reset();
+ }
+
+ }
+
+ // If the password convert flag is set we need to convert it
+ if ($row['user_pass_convert'])
+ {
+ // enable super globals to get literal value
+ // this is needed to prevent unicode normalization
+ $super_globals_disabled = $this->request->super_globals_disabled();
+ if ($super_globals_disabled)
+ {
+ $this->request->enable_super_globals();
+ }
+
+ // in phpBB2 passwords were used exactly as they were sent, with addslashes applied
+ $password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
+ $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
+ $password_new_format = $this->request->variable('password', '', true);
+
+ if ($super_globals_disabled)
+ {
+ $this->request->disable_super_globals();
+ }
+
+ if ($password == $password_new_format)
+ {
+ if (!function_exists('utf8_to_cp1252'))
+ {
+ include($this->phpbb_root_path . 'includes/utf/data/recode_basic.' . $this->php_ext);
+ }
+
+ // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
+ // plain md5 support left in for conversions from other systems.
+ if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password'])))
+ || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])))
+ {
+ $hash = phpbb_hash($password_new_format);
+
+ // Update the password in the users table to the new format and remove user_pass_convert flag
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_password = \'' . $this->db->sql_escape($hash) . '\',
+ user_pass_convert = 0
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+
+ $row['user_pass_convert'] = 0;
+ $row['user_password'] = $hash;
+ }
+ else
+ {
+ // Although we weren't able to convert this password we have to
+ // increase login attempt count to make sure this cannot be exploited
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = user_login_attempts + 1
+ WHERE user_id = ' . (int) $row['user_id'] . '
+ AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
+ $this->db->sql_query($sql);
+
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD_CONVERT,
+ 'error_msg' => 'LOGIN_ERROR_PASSWORD_CONVERT',
+ 'user_row' => $row,
+ );
+ }
+ }
+ }
+
+ // Check password ...
+ if (!$row['user_pass_convert'] && phpbb_check_hash($password, $row['user_password']))
+ {
+ // Check for old password hash...
+ if (strlen($row['user_password']) == 32)
+ {
+ $hash = phpbb_hash($password);
+
+ // Update the password in the users table to the new format
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_password = '" . $this->db->sql_escape($hash) . "',
+ user_pass_convert = 0
+ WHERE user_id = {$row['user_id']}";
+ $this->db->sql_query($sql);
+
+ $row['user_password'] = $hash;
+ }
+
+ $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+
+ if ($row['user_login_attempts'] != 0)
+ {
+ // Successful, reset login attempts (the user passed all stages)
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = 0
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+ }
+
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login... set user_login_attempts to zero...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+
+ // Password incorrect - increase login attempts
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = user_login_attempts + 1
+ WHERE user_id = ' . (int) $row['user_id'] . '
+ AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
+ $this->db->sql_query($sql);
+
+ // Give status about wrong password...
+ return array(
+ 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD,
+ 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD',
+ 'user_row' => $row,
+ );
+ }
+}
diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/auth/provider/index.htm
similarity index 100%
rename from phpBB/includes/search/index.htm
rename to phpBB/phpbb/auth/provider/index.htm
diff --git a/phpBB/phpbb/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php
new file mode 100644
index 0000000000..47043bc107
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/interface.php
@@ -0,0 +1,105 @@
+ status constant
+ * 'error_msg' => string
+ * 'user_row' => array
+ * )
+ */
+ public function login($username, $password);
+
+ /**
+ * Autologin function
+ *
+ * @return array|null containing the user row, empty if no auto login
+ * should take place, or null if not impletmented.
+ */
+ public function autologin();
+
+ /**
+ * This function is used to output any required fields in the authentication
+ * admin panel. It also defines any required configuration table fields.
+ *
+ * @return array|null Returns null if not implemented or an array of the
+ * configuration fields of the provider.
+ */
+ public function acp();
+
+ /**
+ * This function updates the template with variables related to the acp
+ * options with whatever configuraton values are passed to it as an array.
+ * It then returns the name of the acp file related to this authentication
+ * provider.
+ * @param array $new_config Contains the new configuration values that
+ * have been set in acp_board.
+ * @return array|null Returns null if not implemented or an array with
+ * the template file name and an array of the vars
+ * that the template needs that must conform to the
+ * following example:
+ * array(
+ * 'TEMPLATE_FILE' => string,
+ * 'TEMPLATE_VARS' => array(...),
+ * )
+ */
+ public function get_acp_template($new_config);
+
+ /**
+ * Performs additional actions during logout.
+ *
+ * @param array $data An array corresponding to
+ * phpbb_session::data
+ * @param boolean $new_session True for a new session, false for no new
+ * session.
+ */
+ public function logout($data, $new_session);
+
+ /**
+ * The session validation function checks whether the user is still logged
+ * into phpBB.
+ *
+ * @param array $user
+ * @return boolean true if the given user is authenticated, false if the
+ * session should be closed, or null if not implemented.
+ */
+ public function validate_session($user);
+}
diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
new file mode 100644
index 0000000000..0196529408
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -0,0 +1,346 @@
+db = $db;
+ $this->config = $config;
+ $this->user = $user;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ if (!@extension_loaded('ldap'))
+ {
+ return $this->user->lang['LDAP_NO_LDAP_EXTENSION'];
+ }
+
+ $this->config['ldap_port'] = (int) $this->config['ldap_port'];
+ if ($this->config['ldap_port'])
+ {
+ $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']);
+ }
+ else
+ {
+ $ldap = @ldap_connect($this->config['ldap_server']);
+ }
+
+ if (!$ldap)
+ {
+ return $this->user->lang['LDAP_NO_SERVER_CONNECTION'];
+ }
+
+ @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
+ @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
+
+ if ($this->config['ldap_user'] || $this->config['ldap_password'])
+ {
+ if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password'])))
+ {
+ return $this->user->lang['LDAP_INCORRECT_USER_PASSWORD'];
+ }
+ }
+
+ // ldap_connect only checks whether the specified server is valid, so the connection might still fail
+ $search = @ldap_search(
+ $ldap,
+ htmlspecialchars_decode($this->config['ldap_base_dn']),
+ $this->ldap_user_filter($this->user->data['username']),
+ (empty($this->config['ldap_email'])) ?
+ array(htmlspecialchars_decode($this->config['ldap_uid'])) :
+ array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])),
+ 0,
+ 1
+ );
+
+ if ($search === false)
+ {
+ return $this->user->lang['LDAP_SEARCH_FAILED'];
+ }
+
+ $result = @ldap_get_entries($ldap, $search);
+
+ @ldap_close($ldap);
+
+
+ if (!is_array($result) || sizeof($result) < 2)
+ {
+ return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']);
+ }
+
+ if (!empty($this->config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($this->config['ldap_email'])]))
+ {
+ return $this->user->lang['LDAP_NO_EMAIL'];
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!@extension_loaded('ldap'))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_LDAP_EXTENSION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $this->config['ldap_port'] = (int) $this->config['ldap_port'];
+ if ($this->config['ldap_port'])
+ {
+ $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']);
+ }
+ else
+ {
+ $ldap = @ldap_connect($this->config['ldap_server']);
+ }
+
+ if (!$ldap)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
+ @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
+
+ if ($this->config['ldap_user'] || $this->config['ldap_password'])
+ {
+ if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password'])))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+ }
+
+ $search = @ldap_search(
+ $ldap,
+ htmlspecialchars_decode($this->config['ldap_base_dn']),
+ $this->ldap_user_filter($username),
+ (empty($this->config['ldap_email'])) ?
+ array(htmlspecialchars_decode($this->config['ldap_uid'])) :
+ array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])),
+ 0,
+ 1
+ );
+
+ $ldap_result = @ldap_get_entries($ldap, $search);
+
+ if (is_array($ldap_result) && sizeof($ldap_result) > 1)
+ {
+ if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password)))
+ {
+ @ldap_close($ldap);
+
+ $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ unset($ldap_result);
+
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login... set user_login_attempts to zero...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+ else
+ {
+ // retrieve default group id
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "'
+ AND group_type = " . GROUP_SPECIAL;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ trigger_error('NO_GROUP');
+ }
+
+ // generate user account data
+ $ldap_user_row = array(
+ 'username' => $username,
+ 'user_password' => phpbb_hash($password),
+ 'user_email' => (!empty($this->config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($this->config['ldap_email'])][0]) : '',
+ 'group_id' => (int) $row['group_id'],
+ 'user_type' => USER_NORMAL,
+ 'user_ip' => $this->user->ip,
+ 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0,
+ );
+
+ unset($ldap_result);
+
+ // this is the user's first login so create an empty profile
+ return array(
+ 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
+ 'error_msg' => false,
+ 'user_row' => $ldap_user_row,
+ );
+ }
+ }
+ else
+ {
+ unset($ldap_result);
+ @ldap_close($ldap);
+
+ // Give status about wrong password...
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'LOGIN_ERROR_PASSWORD',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+ }
+
+ @ldap_close($ldap);
+
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+
+ public function acp()
+ {
+ // These are fields required in the config table
+ return array(
+ 'ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password',
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_acp_template($new_config)
+ {
+ return array(
+ 'TEMPLATE_FILE' => 'auth_provider_ldap.html',
+ 'TEMPLATE_VARS' => array(
+ 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'],
+ 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
+ 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
+ 'AUTH_LDAP_PORT' => $new_config['ldap_port'],
+ 'AUTH_LDAP_SERVER' => $new_config['ldap_server'],
+ 'AUTH_LDAP_UID' => $new_config['ldap_uid'],
+ 'AUTH_LDAP_USER' => $new_config['ldap_user'],
+ 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'],
+ ),
+ );
+ }
+
+ /**
+ * Generates a filter string for ldap_search to find a user
+ *
+ * @param $username string Username identifying the searched user
+ *
+ * @return string A filter string for ldap_search
+ */
+ private function ldap_user_filter($username)
+ {
+ $filter = '(' . $this->config['ldap_uid'] . '=' . $this->ldap_escape(htmlspecialchars_decode($username)) . ')';
+ if ($this->config['ldap_user_filter'])
+ {
+ $_filter = ($this->config['ldap_user_filter'][0] == '(' && substr($this->config['ldap_user_filter'], -1) == ')') ? $this->config['ldap_user_filter'] : "({$this->config['ldap_user_filter']})";
+ $filter = "(&{$filter}{$_filter})";
+ }
+ return $filter;
+ }
+
+ /**
+ * Escapes an LDAP AttributeValue
+ *
+ * @param string $string The string to be escaped
+ * @return string The escaped string
+ */
+ private function ldap_escape($string)
+ {
+ return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
+ }
+}
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 89%
rename from phpBB/includes/avatar/driver/upload.php
rename to phpBB/phpbb/avatar/driver/upload.php
index baf51f61c1..685ac4f349 100644
--- a/phpBB/includes/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -77,6 +77,32 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
}
elseif (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
{
+ if (!preg_match('#^(http|https|ftp)://#i', $url))
+ {
+ $url = 'http://' . $url;
+ }
+
+ if (!function_exists('validate_data'))
+ {
+ require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
+ $validate_array = validate_data(
+ array(
+ 'url' => $url,
+ ),
+ array(
+ 'url' => array('string', true, 5, 255),
+ )
+ );
+
+ $error = array_merge($error, $validate_array);
+
+ if (!empty($error))
+ {
+ return false;
+ }
+
$file = $upload->remote_upload($url);
}
else
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/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
new file mode 100644
index 0000000000..4ad5f6793e
--- /dev/null
+++ b/phpBB/phpbb/content_visibility.php
@@ -0,0 +1,651 @@
+auth = $auth;
+ $this->db = $db;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->forums_table = $forums_table;
+ $this->posts_table = $posts_table;
+ $this->topics_table = $topics_table;
+ $this->users_table = $users_table;
+ }
+
+ /**
+ * Can the current logged-in user soft-delete posts?
+ *
+ * @param $forum_id int Forum ID whose permissions to check
+ * @param $poster_id int Poster ID of the post in question
+ * @param $post_locked bool Is the post locked?
+ * @return bool
+ */
+ public function can_soft_delete($forum_id, $poster_id, $post_locked)
+ {
+ if ($this->auth->acl_get('m_softdelete', $forum_id))
+ {
+ return true;
+ }
+ else if ($this->auth->acl_get('f_softdelete', $forum_id) && $poster_id == $this->user->data['user_id'] && !$post_locked)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the topics post count or the forums post/topic count based on permissions
+ *
+ * @param $mode string One of topic_posts, forum_posts or forum_topics
+ * @param $data array Array with the topic/forum data to calculate from
+ * @param $forum_id int The forum id is used for permission checks
+ * @return int Number of posts/topics the user can see in the topic/forum
+ */
+ public function get_count($mode, $data, $forum_id)
+ {
+ if (!$this->auth->acl_get('m_approve', $forum_id))
+ {
+ return (int) $data[$mode . '_approved'];
+ }
+
+ return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];
+ }
+
+ /**
+ * Create topic/post visibility SQL for a given forum ID
+ *
+ * Note: Read permissions are not checked.
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $forum_id int The forum id is used for permission checks
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_visibility_sql($mode, $forum_id, $table_alias = '')
+ {
+ if ($this->auth->acl_get('m_approve', $forum_id))
+ {
+ return '1 = 1';
+ }
+
+ return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
+ }
+
+ /**
+ * Create topic/post visibility SQL for a set of forums
+ *
+ * Note: Read permissions are not checked. Forums without read permissions
+ * should not be in $forum_ids
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $forum_ids array Array of forum ids which the posts/topics are limited to
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '')
+ {
+ $where_sql = '(';
+
+ $approve_forums = array_intersect($forum_ids, array_keys($this->auth->acl_getf('m_approve', true)));
+
+ if (sizeof($approve_forums))
+ {
+ // Remove moderator forums from the rest
+ $forum_ids = array_diff($forum_ids, $approve_forums);
+
+ if (!sizeof($forum_ids))
+ {
+ // The user can see all posts/topics in all specified forums
+ return $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
+ }
+ else
+ {
+ // Moderator can view all posts/topics in some forums
+ $where_sql .= $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ' OR ';
+ }
+ }
+ else
+ {
+ // The user is just a normal user
+ return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
+ AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true);
+ }
+
+ $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
+ AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids) . '))';
+
+ return $where_sql;
+ }
+
+ /**
+ * Create topic/post visibility SQL for all forums on the board
+ *
+ * Note: Read permissions are not checked. Forums without read permissions
+ * should be in $exclude_forum_ids
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $exclude_forum_ids array Array of forum ids which are excluded
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
+ {
+ $where_sqls = array();
+
+ $approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
+
+ if (sizeof($exclude_forum_ids))
+ {
+ $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . '
+ AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
+ }
+ else
+ {
+ $where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
+ }
+
+ if (sizeof($approve_forums))
+ {
+ $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
+ return '(' . implode(' OR ', $where_sqls) . ')';
+ }
+
+ // There is only one element, so we just return that one
+ return $where_sqls[0];
+ }
+
+ /**
+ * Change visibility status of one post or all posts of a topic
+ *
+ * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED}
+ * @param $post_id mixed Post ID or array of post IDs to act on,
+ * if it is empty, all posts of topic_id will be modified
+ * @param $topic_id int Topic where $post_id is found
+ * @param $forum_id int Forum where $topic_id is found
+ * @param $user_id int User performing the action
+ * @param $time int Timestamp when the action is performed
+ * @param $reason string Reason why the visibilty was changed.
+ * @param $is_starter bool Is this the first post of the topic changed?
+ * @param $is_latest bool Is this the last post of the topic changed?
+ * @param $limit_visibility mixed Limit updating per topic_id to a certain visibility
+ * @param $limit_delete_time mixed Limit updating per topic_id to a certain deletion time
+ * @return array Changed post data, empty array if an error occured.
+ */
+ public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $limit_visibility = false, $limit_delete_time = false)
+ {
+ if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED)))
+ {
+ return array();
+ }
+
+ if ($post_id)
+ {
+ if (is_array($post_id))
+ {
+ $where_sql = $this->db->sql_in_set('post_id', array_map('intval', $post_id));
+ }
+ else
+ {
+ $where_sql = 'post_id = ' . (int) $post_id;
+ }
+ $where_sql .= ' AND topic_id = ' . (int) $topic_id;
+ }
+ else
+ {
+ $where_sql = 'topic_id = ' . (int) $topic_id;
+
+ // Limit the posts to a certain visibility and deletion time
+ // This allows us to only restore posts, that were approved
+ // when the topic got soft deleted. So previous soft deleted
+ // and unapproved posts are still soft deleted/unapproved
+ if ($limit_visibility !== false)
+ {
+ $where_sql .= ' AND post_visibility = ' . (int) $limit_visibility;
+ }
+
+ if ($limit_delete_time !== false)
+ {
+ $where_sql .= ' AND post_delete_time = ' . (int) $limit_delete_time;
+ }
+ }
+
+ $sql = 'SELECT poster_id, post_id, post_postcount, post_visibility
+ FROM ' . $this->posts_table . '
+ WHERE ' . $where_sql;
+ $result = $this->db->sql_query($sql);
+
+ $post_ids = $poster_postcounts = $postcounts = $postcount_visibility = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $post_ids[] = (int) $row['post_id'];
+
+ if ($row['post_visibility'] != $visibility)
+ {
+ if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']]))
+ {
+ $poster_postcounts[(int) $row['poster_id']] = 1;
+ }
+ else if ($row['post_postcount'])
+ {
+ $poster_postcounts[(int) $row['poster_id']]++;
+ }
+
+ if (!isset($postcount_visibility[$row['post_visibility']]))
+ {
+ $postcount_visibility[$row['post_visibility']] = 1;
+ }
+ else
+ {
+ $postcount_visibility[$row['post_visibility']]++;
+ }
+ }
+ }
+ $this->db->sql_freeresult($result);
+
+ if (empty($post_ids))
+ {
+ return array();
+ }
+
+ $data = array(
+ 'post_visibility' => (int) $visibility,
+ 'post_delete_user' => (int) $user_id,
+ 'post_delete_time' => ((int) $time) ?: time(),
+ 'post_delete_reason' => truncate_string($reason, 255, 255, false),
+ );
+
+ $sql = 'UPDATE ' . $this->posts_table . '
+ SET ' . $this->db->sql_build_array('UPDATE', $data) . '
+ WHERE ' . $this->db->sql_in_set('post_id', $post_ids);
+ $this->db->sql_query($sql);
+
+ // Group the authors by post count, to reduce the number of queries
+ foreach ($poster_postcounts as $poster_id => $num_posts)
+ {
+ $postcounts[$num_posts][] = $poster_id;
+ }
+
+ // Update users postcounts
+ foreach ($postcounts as $num_posts => $poster_ids)
+ {
+ if ($visibility == ITEM_DELETED)
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = 0
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
+ AND user_posts < ' . $num_posts;
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts - ' . $num_posts . '
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
+ AND user_posts >= ' . $num_posts;
+ $this->db->sql_query($sql);
+ }
+ else
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts + ' . $num_posts . '
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+ }
+ }
+
+ $update_topic_postcount = true;
+
+ // Sync the first/last topic information if needed
+ if (!$is_starter && $is_latest)
+ {
+ // update_post_information can only update the last post info ...
+ if ($topic_id)
+ {
+ update_post_information('topic', $topic_id, false);
+ }
+ if ($forum_id)
+ {
+ update_post_information('forum', $forum_id, false);
+ }
+ }
+ else if ($is_starter && $topic_id)
+ {
+ if (!function_exists('sync'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
+ }
+
+ // ... so we need to use sync, if the first post is changed.
+ // The forum is resynced recursive by sync() itself.
+ sync('topic', 'topic_id', $topic_id, true);
+
+ // sync recalculates the topic replies and forum posts by itself, so we don't do that.
+ $update_topic_postcount = false;
+ }
+
+ // Update the topic's reply count and the forum's post count
+ if ($update_topic_postcount)
+ {
+ $cur_posts = $cur_unapproved_posts = $cur_softdeleted_posts = 0;
+ foreach ($postcount_visibility as $post_visibility => $visibility_posts)
+ {
+ // We need to substract the posts from the counters ...
+ if ($post_visibility == ITEM_APPROVED)
+ {
+ $cur_posts += $visibility_posts;
+ }
+ else if ($post_visibility == ITEM_UNAPPROVED)
+ {
+ $cur_unapproved_posts += $visibility_posts;
+ }
+ else if ($post_visibility == ITEM_DELETED)
+ {
+ $cur_softdeleted_posts += $visibility_posts;
+ }
+ }
+
+ $sql_ary = array();
+ if ($visibility == ITEM_DELETED)
+ {
+ if ($cur_posts)
+ {
+ $sql_ary['posts_approved'] = ' - ' . $cur_posts;
+ }
+ if ($cur_unapproved_posts)
+ {
+ $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts;
+ }
+ if ($cur_posts + $cur_unapproved_posts)
+ {
+ $sql_ary['posts_softdeleted'] = ' + ' . ($cur_posts + $cur_unapproved_posts);
+ }
+ }
+ else
+ {
+ if ($cur_unapproved_posts)
+ {
+ $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts;
+ }
+ if ($cur_softdeleted_posts)
+ {
+ $sql_ary['posts_softdeleted'] = ' - ' . $cur_softdeleted_posts;
+ }
+ if ($cur_softdeleted_posts + $cur_unapproved_posts)
+ {
+ $sql_ary['posts_approved'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts);
+ }
+ }
+
+ if (sizeof($sql_ary))
+ {
+ $topic_sql = $forum_sql = array();
+
+ foreach ($sql_ary as $field => $value_change)
+ {
+ $topic_sql[] = 'topic_' . $field . ' = topic_' . $field . $value_change;
+ $forum_sql[] = 'forum_' . $field . ' = forum_' . $field . $value_change;
+ }
+
+ // Update the number for replies and posts
+ $sql = 'UPDATE ' . $this->topics_table . '
+ SET ' . implode(', ', $topic_sql) . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->forums_table . '
+ SET ' . implode(', ', $forum_sql) . '
+ WHERE forum_id = ' . (int) $forum_id;
+ $this->db->sql_query($sql);
+ }
+ }
+
+ return $data;
+ }
+
+ /**
+ * Set topic visibility
+ *
+ * Allows approving (which is akin to undeleting/restore) or soft deleting an entire topic.
+ * Calls set_post_visibility as needed.
+ *
+ * Note: By default, when a soft deleted topic is restored. Only posts that
+ * were approved at the time of soft deleting, are being restored.
+ * Same applies to soft deleting. Only approved posts will be marked
+ * as soft deleted.
+ * If you want to update all posts, use the force option.
+ *
+ * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED}
+ * @param $topic_id mixed Topic ID to act on
+ * @param $forum_id int Forum where $topic_id is found
+ * @param $user_id int User performing the action
+ * @param $time int Timestamp when the action is performed
+ * @param $reason string Reason why the visibilty was changed.
+ * @param $force_update_all bool Force to update all posts within the topic
+ * @return array Changed topic data, empty array if an error occured.
+ */
+ public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false)
+ {
+ if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED)))
+ {
+ return array();
+ }
+
+ if (!$force_update_all)
+ {
+ $sql = 'SELECT topic_visibility, topic_delete_time
+ FROM ' . $this->topics_table . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $result = $this->db->sql_query($sql);
+ $original_topic_data = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$original_topic_data)
+ {
+ // The topic does not exist...
+ return array();
+ }
+ }
+
+ // Note, we do not set a reason for the posts, just for the topic
+ $data = array(
+ 'topic_visibility' => (int) $visibility,
+ 'topic_delete_user' => (int) $user_id,
+ 'topic_delete_time' => ((int) $time) ?: time(),
+ 'topic_delete_reason' => truncate_string($reason, 255, 255, false),
+ );
+
+ $sql = 'UPDATE ' . $this->topics_table . '
+ SET ' . $this->db->sql_build_array('UPDATE', $data) . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $this->db->sql_query($sql);
+
+ if (!$this->db->sql_affectedrows())
+ {
+ return array();
+ }
+
+ if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED)
+ {
+ // If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion.
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']);
+ }
+ else if (!$force_update_all && $original_topic_data['topic_visibility'] == ITEM_APPROVED && $visibility == ITEM_DELETED)
+ {
+ // If we're soft deleting a topic we only approved posts are soft deleted.
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']);
+ }
+ else
+ {
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true);
+ }
+
+ return $data;
+ }
+
+ /**
+ * Add post to topic and forum statistics
+ *
+ * @param $data array Contains information from the topics table about given topic
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function add_post_to_statistic($data, &$sql_data)
+ {
+ $sql_data[$this->topics_table] = (($sql_data[$this->topics_table]) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved + 1';
+
+ $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved + 1';
+
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1';
+ }
+
+ set_config_count('num_posts', 1, true);
+ }
+
+ /**
+ * Remove post from topic and forum statistics
+ *
+ * @param $data array Contains information from the topics table about given topic
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function remove_post_from_statistic($data, &$sql_data)
+ {
+ $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1';
+ $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1';
+
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ }
+
+ set_config_count('num_posts', -1, true);
+ }
+
+ /**
+ * Remove topic from forum statistics
+ *
+ * @param $topic_id int The topic to act on
+ * @param $forum_id int Forum where the topic is found
+ * @param $topic_row array Contains information from the topic, may be empty at call time
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function remove_topic_from_statistic($topic_id, $forum_id, &$topic_row, &$sql_data)
+ {
+ // Do we need to grab some topic informations?
+ if (!sizeof($topic_row))
+ {
+ $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility
+ FROM ' . $this->topics_table . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $result = $this->db->sql_query($sql);
+ $topic_row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+ }
+
+ // If this is an edited topic or the first post the topic gets completely disapproved later on...
+ $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1';
+ $sql_data[$this->forums_table] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved'];
+ $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
+ $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];
+
+ set_config_count('num_topics', -1, true);
+ set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true);
+
+ // Get user post count information
+ $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts
+ FROM ' . $this->posts_table . '
+ WHERE topic_id = ' . (int) $topic_id . '
+ AND post_postcount = 1
+ AND post_visibility = ' . ITEM_APPROVED . '
+ GROUP BY poster_id';
+ $result = $this->db->sql_query($sql);
+
+ $postcounts = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $postcounts[(int) $row['num_posts']][] = (int) $row['poster_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ // Decrement users post count
+ foreach ($postcounts as $num_posts => $poster_ids)
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = 0
+ WHERE user_posts < ' . $num_posts . '
+ AND ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts - ' . $num_posts . '
+ WHERE user_posts >= ' . $num_posts . '
+ AND ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+ }
+ }
+}
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 80%
rename from phpBB/includes/controller/resolver.php
rename to phpBB/phpbb/controller/resolver.php
index ee469aa9c8..95dfc8da8e 100644
--- a/phpBB/includes/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -37,16 +37,24 @@ class phpbb_controller_resolver implements ControllerResolverInterface
*/
protected $container;
+ /**
+ * phpbb_style object
+ * @var phpbb_style
+ */
+ protected $style;
+
/**
* Construct method
*
* @param phpbb_user $user User Object
* @param ContainerInterface $container ContainerInterface object
+ * @param phpbb_style $style
*/
- public function __construct(phpbb_user $user, ContainerInterface $container)
+ public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
{
$this->user = $user;
$this->container = $container;
+ $this->style = $style;
}
/**
@@ -80,6 +88,24 @@ class phpbb_controller_resolver implements ControllerResolverInterface
$controller_object = $this->container->get($service);
+ /*
+ * If this is an extension controller, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $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')
+ {
+ $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'));
+ }
+ }
+
return array($controller_object, $method);
}
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 99%
rename from phpBB/includes/db/driver/driver.php
rename to phpBB/phpbb/db/driver/driver.php
index b915ee081b..08c966c07a 100644
--- a/phpBB/includes/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -878,7 +878,7 @@ class phpbb_db_driver
+
+
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 99%
rename from phpBB/includes/db/driver/mssql_odbc.php
rename to phpBB/phpbb/db/driver/mssql_odbc.php
index cde9d332ba..a1d1a5d5dd 100644
--- a/phpBB/includes/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
@@ -253,7 +253,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base
* Fetch current row
* @note number of bytes returned depends on odbc.defaultlrl php.ini setting. If it is limited to 4K for example only 4K of data is returned max.
*/
- function sql_fetchrow($query_id = false, $debug = false)
+ function sql_fetchrow($query_id = false)
{
global $cache;
diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
similarity index 98%
rename from phpBB/includes/db/driver/mssqlnative.php
rename to phpBB/phpbb/db/driver/mssqlnative.php
index 6f433e10cf..28fc88298a 100644
--- a/phpBB/includes/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -326,7 +326,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
$this->sql_report('stop', $query);
}
- if ($cache_ttl)
+ if ($cache && $cache_ttl)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
@@ -394,7 +394,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
*/
function sql_affectedrows()
{
- return (!empty($this->query_result)) ? @sqlsrv_rows_affected($this->query_result) : false;
+ return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->query_result) : false;
}
/**
@@ -409,7 +409,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
$query_id = $this->query_result;
}
- if ($cache->sql_exists($query_id))
+ if ($cache && $cache->sql_exists($query_id))
{
return $cache->sql_fetchrow($query_id);
}
@@ -474,9 +474,9 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
return $cache->sql_freeresult($query_id);
}
- if (isset($this->open_queries[$query_id]))
+ if (isset($this->open_queries[(int) $query_id]))
{
- unset($this->open_queries[$query_id]);
+ unset($this->open_queries[(int) $query_id]);
return @sqlsrv_free_stmt($query_id);
}
return false;
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 96%
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
index 1f8622798e..4c345b429b 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php
@@ -27,8 +27,8 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration
'COLUMNS' => array(
// this column was removed from the database updater
// after 3.0.9-RC3 was released. It might still exist
- // in 3.0.9-RCX installations and has to be dropped in
- // 3.0.12 after the db_tools class is capable of properly
+ // in 3.0.9-RCX installations and has to be dropped as
+ // soon as the db_tools class is capable of properly
// removing a primary key.
// 'attempt_id' => array('UINT', NULL, 'auto_increment'),
'attempt_ip' => array('VCHAR:40', ''),
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/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
new file mode 100644
index 0000000000..f324b8880d
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
@@ -0,0 +1,57 @@
+db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char);
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (!class_exists('acp_bbcodes'))
+ {
+ global $phpEx;
+ phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx);
+ }
+ $bbcode_match = $row['bbcode_match'];
+ $bbcode_tpl = $row['bbcode_tpl'];
+
+ $acp_bbcodes = new acp_bbcodes();
+ $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
+
+ $sql = 'UPDATE ' . BBCODES_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE bbcode_id = ' . (int) $row['bbcode_id'];
+ $this->sql_query($sql);
+ }
+ $this->db->sql_freeresult($result);
+ }
+}
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 98%
rename from phpBB/includes/db/migration/data/310/dev.php
rename to phpBB/phpbb/db/migration/data/310/dev.php
index 13b36bbf30..0fc2950987 100644
--- a/phpBB/includes/db/migration/data/310/dev.php
+++ b/phpBB/phpbb/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)),
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/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
new file mode 100644
index 0000000000..d994d7ec5f
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
@@ -0,0 +1,118 @@
+table_prefix . 'user_notifications';
+ $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table);
+
+ $this->perform_conversion($insert_buffer, $insert_table);
+ }
+
+ /**
+ * Perform the conversion (separate for testability)
+ *
+ * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param string $insert_table
+ */
+ public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table)
+ {
+ $sql = 'DELETE FROM ' . $insert_table;
+ $this->db->sql_query($sql);
+
+ $sql = 'SELECT user_id, user_notify_type, user_notify_pm
+ FROM ' . USERS_TABLE;
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $notification_methods = array();
+
+ // In-board notification
+ $notification_methods[] = '';
+
+ if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
+ {
+ $notification_methods[] = 'email';
+ }
+
+ if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
+ {
+ $notification_methods[] = 'jabber';
+ }
+
+ // Notifications for posts
+ foreach (array('post', 'topic') as $item_type)
+ {
+ $this->add_method_rows(
+ $insert_buffer,
+ $item_type,
+ 0,
+ $row['user_id'],
+ $notification_methods
+ );
+ }
+
+ if ($row['user_notify_pm'])
+ {
+ // Notifications for private messages
+ // User either gets all methods or no method
+ $this->add_method_rows(
+ $insert_buffer,
+ 'pm',
+ 0,
+ $row['user_id'],
+ $notification_methods
+ );
+ }
+ }
+ $this->db->sql_freeresult($result);
+
+ $insert_buffer->flush();
+ }
+
+ /**
+ * Insert method rows to DB
+ *
+ * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param string $item_type
+ * @param int $item_id
+ * @param int $user_id
+ * @param string $methods
+ */
+ protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
+ {
+ $row_base = array(
+ 'item_type' => $item_type,
+ 'item_id' => (int) $item_id,
+ 'user_id' => (int) $user_id,
+ 'notify' => 1
+ );
+
+ foreach ($methods as $method)
+ {
+ $row_base['method'] = $method;
+ $insert_buffer->insert($row_base);
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php
similarity index 56%
rename from phpBB/includes/db/migration/data/310/notifications.php
rename to phpBB/phpbb/db/migration/data/310/notifications.php
index 82bfd4cb2d..17c939d95a 100644
--- a/phpBB/includes/db/migration/data/310/notifications.php
+++ b/phpBB/phpbb/db/migration/data/310/notifications.php
@@ -91,70 +91,6 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
),
)),
array('config.add', array('load_notifications', 1)),
- array('custom', array(array($this, 'convert_notifications'))),
);
}
-
- public function convert_notifications()
- {
- $convert_notifications = array(
- array(
- 'check' => ($this->config['allow_topic_notify']),
- 'item_type' => 'post',
- ),
- array(
- 'check' => ($this->config['allow_forum_notify']),
- 'item_type' => 'topic',
- ),
- array(
- 'check' => ($this->config['allow_bookmarks']),
- 'item_type' => 'bookmark',
- ),
- array(
- 'check' => ($this->config['allow_privmsg']),
- 'item_type' => 'pm',
- ),
- );
-
- foreach ($convert_notifications as $convert_data)
- {
- if ($convert_data['check'])
- {
- $sql = 'SELECT user_id, user_notify_type
- FROM ' . USERS_TABLE . '
- WHERE user_notify = 1';
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => '',
- )));
-
- if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => 'email',
- )));
- }
-
- if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => 'jabber',
- )));
- }
- }
- $this->db->sql_freeresult($result);
- }
- }
- }
}
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/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
new file mode 100644
index 0000000000..e4fbb27bcb
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
@@ -0,0 +1,51 @@
+db->sql_query($sql);
+ $module_auth = $this->db_sql_fetchfield('module_auth');
+ $this->db->sql_freeresult($result);
+
+ return $module_auth === 'acl_u_sig' || $module_auth === false;
+ }
+
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_31x_dev');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(
+ array($this, 'update_signature_module_auth'),
+ ),
+ ),
+ );
+ }
+
+ public function update_signature_module_auth()
+ {
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_auth = 'acl_u_sig'
+ WHERE module_class = 'ucp'
+ AND module_basename = 'ucp_profile'
+ AND module_mode = 'signature'
+ AND module_auth = ''";
+ $this->db->sql_query($sql);
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
new file mode 100644
index 0000000000..84f8eebd4a
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
@@ -0,0 +1,171 @@
+db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility');
+ }
+
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_310_dev');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts_approved' => array('UINT', 0),
+ 'forum_posts_unapproved' => array('UINT', 0),
+ 'forum_posts_softdeleted' => array('UINT', 0),
+ 'forum_topics_approved' => array('UINT', 0),
+ 'forum_topics_unapproved' => array('UINT', 0),
+ 'forum_topics_softdeleted' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility' => array('TINT:3', 0),
+ 'post_delete_time' => array('TIMESTAMP', 0),
+ 'post_delete_reason' => array('STEXT_UNI', ''),
+ 'post_delete_user' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility' => array('TINT:3', 0),
+ 'topic_delete_time' => array('TIMESTAMP', 0),
+ 'topic_delete_reason' => array('STEXT_UNI', ''),
+ 'topic_delete_user' => array('UINT', 0),
+ 'topic_posts_approved' => array('UINT', 0),
+ 'topic_posts_unapproved' => array('UINT', 0),
+ 'topic_posts_softdeleted' => array('UINT', 0),
+ ),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility' => array('post_visibility'),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility' => array('topic_visibility'),
+ 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts_approved',
+ 'forum_posts_unapproved',
+ 'forum_posts_softdeleted',
+ 'forum_topics_approved',
+ 'forum_topics_unapproved',
+ 'forum_topics_softdeleted',
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility',
+ 'post_delete_time',
+ 'post_delete_reason',
+ 'post_delete_user',
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility',
+ 'topic_delete_time',
+ 'topic_delete_reason',
+ 'topic_delete_user',
+ 'topic_posts_approved',
+ 'topic_posts_unapproved',
+ 'topic_posts_softdeleted',
+ ),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'posts' => array('post_visibility'),
+ $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'),
+ ),
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'update_post_visibility'))),
+ array('custom', array(array($this, 'update_topic_visibility'))),
+ array('custom', array(array($this, 'update_topic_forum_counts'))),
+
+ array('permission.add', array('f_softdelete', false)),
+ array('permission.add', array('m_softdelete', false)),
+ );
+ }
+
+ public function update_post_visibility()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'posts
+ SET post_visibility = post_approved';
+ $this->sql_query($sql);
+ }
+
+ public function update_topic_visibility()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_visibility = topic_approved';
+ $this->sql_query($sql);
+ }
+
+ public function update_topic_forum_counts()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_posts_approved = topic_replies + 1,
+ topic_posts_unapproved = topic_replies_real - topic_replies
+ WHERE topic_visibility = ' . ITEM_APPROVED;
+ $this->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_posts_approved = 0,
+ topic_posts_unapproved = (topic_replies_real - topic_replies) + 1
+ WHERE topic_visibility = ' . ITEM_UNAPPROVED;
+ $this->sql_query($sql);
+
+ $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved
+ FROM ' . $this->table_prefix . 'topics
+ GROUP BY forum_id, topic_visibility';
+ $result = $this->db->sql_query($sql);
+
+ $update_forums = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $forum_id = (int) $row['forum_id'];
+ if (!isset($update_forums[$forum_id]))
+ {
+ $update_forums[$forum_id] = array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ );
+ }
+
+ $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved'];
+ $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved'];
+
+ $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics'];
+ }
+ $this->db->sql_freeresult($result);
+
+ foreach ($update_forums as $forum_id => $forum_data)
+ {
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . '
+ WHERE forum_id = ' . $forum_id;
+ $this->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
new file mode 100644
index 0000000000..7320a2c2bf
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
@@ -0,0 +1,68 @@
+db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ 'phpbb_db_migration_data_310_dev',
+ 'phpbb_db_migration_data_310_softdelete_p1',
+ );
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'forums' => array('forum_posts', 'forum_topics', 'forum_topics_real'),
+ $this->table_prefix . 'posts' => array('post_approved'),
+ $this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'posts' => array('post_approved'),
+ $this->table_prefix . 'topics' => array('forum_appr_last'),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts' => array('UINT', 0),
+ 'forum_topics' => array('UINT', 0),
+ 'forum_topics_real' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_approved' => array('BOOL', 1),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_approved' => array('BOOL', 1),
+ 'topic_replies' => array('UINT', 0),
+ 'topic_replies_real' => array('UINT', 0),
+ ),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'posts' => array(
+ 'post_approved' => array('post_approved'),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'),
+ ),
+ ),
+ );
+ }
+}
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 99%
rename from phpBB/includes/db/migration/migration.php
rename to phpBB/phpbb/db/migration/migration.php
index 5f14a6953c..0ffa96fd14 100644
--- a/phpBB/includes/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
@@ -44,7 +44,7 @@ abstract class phpbb_db_migration
/** @var string */
protected $php_ext;
- /** @var array Errors, if any occured */
+ /** @var array Errors, if any occurred */
protected $errors;
/** @var array List of queries executed through $this->sql_query() */
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/db/db_tools.php b/phpBB/phpbb/db/tools.php
similarity index 99%
rename from phpBB/includes/db/db_tools.php
rename to phpBB/phpbb/db/tools.php
index 983cdc18ea..492284ffcd 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/phpbb/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;
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 95%
rename from phpBB/includes/feed/base.php
rename to phpBB/phpbb/feed/base.php
index af28ee8dc8..296d830932 100644
--- a/phpBB/includes/feed/base.php
+++ b/phpBB/phpbb/feed/base.php
@@ -80,10 +80,11 @@ abstract class phpbb_feed_base
* @param phpbb_cache_driver_interface $cache Cache object
* @param phpbb_user $user User object
* @param phpbb_auth $auth Auth object
+ * @param phpbb_content_visibility $content_visibility Auth object
* @param string $phpEx php file extension
* @return null
*/
- function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $phpEx)
+ function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx)
{
$this->config = $config;
$this->helper = $helper;
@@ -91,6 +92,7 @@ abstract class phpbb_feed_base
$this->cache = $cache;
$this->user = $user;
$this->auth = $auth;
+ $this->content_visibility = $content_visibility;
$this->phpEx = $phpEx;
$this->set_keys();
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 90%
rename from phpBB/includes/feed/forum.php
rename to phpBB/phpbb/feed/forum.php
index 7670fbeaaa..b5f0dd0f8f 100644
--- a/phpBB/includes/feed/forum.php
+++ b/phpBB/phpbb/feed/forum.php
@@ -90,14 +90,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base
function get_sql()
{
- $m_approve = ($this->auth->acl_get('m_approve', $this->forum_id)) ? true : false;
-
// Determine topics with recent activity
$sql = 'SELECT topic_id, topic_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . $this->forum_id . '
AND topic_moved_id = 0
- ' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
+ AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -117,14 +115,14 @@ class phpbb_feed_forum extends phpbb_feed_post_base
}
$this->sql = array(
- 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
POSTS_TABLE => 'p',
USERS_TABLE => 'u',
),
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
- ' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . '
+ AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND p.poster_id = u.user_id',
'ORDER_BY' => 'p.post_time DESC',
diff --git a/phpBB/includes/feed/forums.php b/phpBB/phpbb/feed/forums.php
similarity index 91%
rename from phpBB/includes/feed/forums.php
rename to phpBB/phpbb/feed/forums.php
index 72f786aa6a..409097a9f3 100644
--- a/phpBB/includes/feed/forums.php
+++ b/phpBB/phpbb/feed/forums.php
@@ -49,7 +49,7 @@ class phpbb_feed_forums extends phpbb_feed_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time,
f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options,
- f.forum_topics, f.forum_posts',
+ f.forum_topics_approved, f.forum_posts_approved',
'FROM' => array(FORUMS_TABLE => 'f'),
'WHERE' => 'f.forum_type = ' . FORUM_POST . '
AND ' . $this->db->sql_in_set('f.forum_id', $in_fid_ary),
@@ -65,8 +65,8 @@ class phpbb_feed_forums extends phpbb_feed_base
if ($this->config['feed_item_statistics'])
{
- $item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics'])
- . ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']);
+ $item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics_approved'])
+ . ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts_approved']);
}
}
}
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 93%
rename from phpBB/includes/feed/news.php
rename to phpBB/phpbb/feed/news.php
index 92cc18a3ab..f2d45b5165 100644
--- a/phpBB/includes/feed/news.php
+++ b/phpBB/phpbb/feed/news.php
@@ -72,7 +72,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -90,7 +90,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
- t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
diff --git a/phpBB/includes/feed/overall.php b/phpBB/phpbb/feed/overall.php
similarity index 77%
rename from phpBB/includes/feed/overall.php
rename to phpBB/phpbb/feed/overall.php
index 5fb922f6bb..869df7cde0 100644
--- a/phpBB/includes/feed/overall.php
+++ b/phpBB/phpbb/feed/overall.php
@@ -33,17 +33,11 @@ class phpbb_feed_overall extends phpbb_feed_post_base
return false;
}
- // m_approve forums
- $fid_m_approve = $this->get_moderator_approve_forums();
- $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $this->db->sql_in_set('forum_id', $fid_m_approve) : '';
-
// Determine topics with recent activity
$sql = 'SELECT topic_id, topic_last_post_time
FROM ' . TOPICS_TABLE . '
- WHERE ' . $this->db->sql_in_set('forum_id', $forum_ids) . '
- AND topic_moved_id = 0
- AND (topic_approved = 1
- ' . $sql_m_approve . ')
+ WHERE topic_moved_id = 0
+ AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -65,7 +59,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
// Get the actual data
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name, ' .
- 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
USERS_TABLE => 'u',
@@ -78,8 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
),
),
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
- AND (p.post_approved = 1
- ' . str_replace('forum_id', 'p.forum_id', $sql_m_approve) . ')
+ AND ' . $this->content_visibility->get_visibility_sql('post', array(), 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND u.user_id = p.poster_id',
'ORDER_BY' => 'p.post_time DESC',
diff --git a/phpBB/includes/feed/post_base.php b/phpBB/phpbb/feed/post_base.php
similarity index 88%
rename from phpBB/includes/feed/post_base.php
rename to phpBB/phpbb/feed/post_base.php
index a25ed50263..1f4cb4b5ef 100644
--- a/phpBB/includes/feed/post_base.php
+++ b/phpBB/phpbb/feed/post_base.php
@@ -51,7 +51,7 @@ abstract class phpbb_feed_post_base extends phpbb_feed_base
{
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
- . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
+ . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
}
}
}
diff --git a/phpBB/includes/feed/topic.php b/phpBB/phpbb/feed/topic.php
similarity index 87%
rename from phpBB/includes/feed/topic.php
rename to phpBB/phpbb/feed/topic.php
index 7d9a344982..36f958ac60 100644
--- a/phpBB/includes/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_approved, 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_replies, t.topic_type
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . FORUMS_TABLE . ' f
ON (f.forum_id = t.forum_id)
@@ -94,14 +94,14 @@ class phpbb_feed_topic extends phpbb_feed_post_base
function get_sql()
{
$this->sql = array(
- 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
POSTS_TABLE => 'p',
USERS_TABLE => 'u',
),
'WHERE' => 'p.topic_id = ' . $this->topic_id . '
- ' . ($this->forum_id && !$this->auth->acl_get('m_approve', $this->forum_id) ? 'AND p.post_approved = 1' : '') . '
+ AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.poster_id = u.user_id',
'ORDER_BY' => 'p.post_time DESC',
);
diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php
similarity index 83%
rename from phpBB/includes/feed/topic_base.php
rename to phpBB/phpbb/feed/topic_base.php
index e6a47b4c86..b104a46631 100644
--- a/phpBB/includes/feed/topic_base.php
+++ b/phpBB/phpbb/feed/topic_base.php
@@ -51,9 +51,9 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base
{
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
- . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'])
+ . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
- . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
+ . (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
}
}
}
diff --git a/phpBB/includes/feed/topics.php b/phpBB/phpbb/feed/topics.php
similarity index 91%
rename from phpBB/includes/feed/topics.php
rename to phpBB/phpbb/feed/topics.php
index c8761d7176..31f5177773 100644
--- a/phpBB/includes/feed/topics.php
+++ b/phpBB/phpbb/feed/topics.php
@@ -44,7 +44,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -62,7 +62,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
- t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php
similarity index 95%
rename from phpBB/includes/feed/topics_active.php
rename to phpBB/phpbb/feed/topics_active.php
index d1c920c136..249dd1d66a 100644
--- a/phpBB/includes/feed/topics_active.php
+++ b/phpBB/phpbb/feed/topics_active.php
@@ -59,7 +59,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
' . $last_post_time_sql . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -78,7 +78,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
- t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views,
+ t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views,
t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
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 95%
rename from phpBB/includes/search/fulltext_mysql.php
rename to phpBB/phpbb/search/fulltext_mysql.php
index aa493c3281..7dc4da8ffe 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -140,7 +140,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
/**
* Checks for correct MySQL version and stores min/max word length in the config
*
- * @return string|bool Language key of the error/incompatiblity occured
+ * @return string|bool Language key of the error/incompatiblity occurred
*/
public function init()
{
@@ -351,7 +351,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -360,7 +360,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 keyword_search($type, $fields, $terms, $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 keyword_search($type, $fields, $terms, $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 keywords? No posts
if (!$this->search_query)
@@ -378,7 +378,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary)
)));
@@ -445,19 +445,6 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary === array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : '';
$sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
@@ -480,7 +467,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
- $sql_where_options .= $m_approve_fid_sql;
+ $sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
@@ -546,7 +533,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -574,7 +561,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -629,18 +616,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $m_approve_fid_sql = ' AND ' . $post_visibility;
// If the cache was completely empty count the results
$calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS ';
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
similarity index 97%
rename from phpBB/includes/search/fulltext_native.php
rename to phpBB/phpbb/search/fulltext_native.php
index b9c784ea67..730c3a6c2d 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -507,7 +507,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -516,7 +516,7 @@ class phpbb_search_fulltext_native 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 keyword_search($type, $fields, $terms, $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 keyword_search($type, $fields, $terms, $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 keywords? No posts.
if (empty($this->search_query))
@@ -544,7 +544,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -721,14 +721,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sql_where[] = '(' . implode(' OR ', $is_null_joins) . ')';
}
- if (!sizeof($m_approve_fid_ary))
- {
- $sql_where[] = 'p.post_approved = 1';
- }
- else if ($m_approve_fid_ary !== array(-1))
- {
- $sql_where[] = '(p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $sql_where[] = $post_visibility;
if ($topic_id)
{
@@ -911,7 +904,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -920,7 +913,7 @@ class phpbb_search_fulltext_native 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))
@@ -939,7 +932,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -967,6 +960,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
+ $post_visibility = ($post_visibility) ? ' AND ' . $post_visibility : '';
// Build sql strings for sorting
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
@@ -989,19 +983,6 @@ class phpbb_search_fulltext_native extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$select = ($type == 'posts') ? 'p.post_id' : 't.topic_id';
$is_mysql = false;
@@ -1024,7 +1005,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
$sql_time";
}
@@ -1044,7 +1025,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
AND t.topic_id = p.topic_id
$sql_time" . (($this->db->sql_layer == 'sqlite') ? ')' : '');
@@ -1070,7 +1051,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
$sql_sort_join
$sql_time
@@ -1084,7 +1065,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
AND t.topic_id = p.topic_id
$sql_sort_join
diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
similarity index 95%
rename from phpBB/includes/search/fulltext_postgres.php
rename to phpBB/phpbb/search/fulltext_postgres.php
index 496a29f5a3..6b4b310f2e 100644
--- a/phpBB/includes/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -185,7 +185,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Checks for correct PostgreSQL version and stores min/max word length in the config
*
- * @return string|bool Language key of the error/incompatiblity occured
+ * @return string|bool Language key of the error/incompatiblity occurred
*/
public function init()
{
@@ -334,7 +334,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -343,7 +343,7 @@ class phpbb_search_fulltext_postgres 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 keyword_search($type, $fields, $terms, $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 keyword_search($type, $fields, $terms, $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 keywords? No posts
if (!$this->search_query)
@@ -367,7 +367,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary)
)));
@@ -434,19 +434,6 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary === array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
@@ -470,7 +457,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
- $sql_where_options .= $m_approve_fid_sql;
+ $sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
@@ -550,7 +537,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -559,7 +546,7 @@ class phpbb_search_fulltext_postgres 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))
@@ -578,7 +565,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -633,18 +620,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $m_approve_fid_sql = ' AND ' . $post_visibility;
// Build the query for really selecting the post_ids
if ($type == 'posts')
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
similarity index 96%
rename from phpBB/includes/search/fulltext_sphinx.php
rename to phpBB/phpbb/search/fulltext_sphinx.php
index 63e35eb4af..4f3f852664 100644
--- a/phpBB/includes/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);
@@ -274,6 +269,7 @@ class phpbb_search_fulltext_sphinx
p.forum_id,
p.topic_id,
p.poster_id,
+ p.post_visibility,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
p.post_time,
p.post_subject,
@@ -291,6 +287,7 @@ class phpbb_search_fulltext_sphinx
array('sql_attr_uint', 'forum_id'),
array('sql_attr_uint', 'topic_id'),
array('sql_attr_uint', 'poster_id'),
+ array('sql_attr_uint', 'post_visibility'),
array('sql_attr_bool', 'topic_first_post'),
array('sql_attr_bool', 'deleted'),
array('sql_attr_timestamp' , 'post_time'),
@@ -306,6 +303,7 @@ class phpbb_search_fulltext_sphinx
p.forum_id,
p.topic_id,
p.poster_id,
+ p.post_visibility,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
p.post_time,
p.post_subject,
@@ -445,7 +443,7 @@ class phpbb_search_fulltext_sphinx
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -454,7 +452,7 @@ class phpbb_search_fulltext_sphinx
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function keyword_search($type, $fields, $terms, $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 keyword_search($type, $fields, $terms, $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 keywords? No posts.
if (!strlen($this->search_query) && !sizeof($author_ary))
@@ -569,6 +567,11 @@ class phpbb_search_fulltext_sphinx
$this->sphinx->SetFilter('poster_id', $author_ary);
}
+ // As this is not simply possible at the moment, we limit the result to approved posts.
+ // This will make it impossible for moderators to search unapproved and softdeleted posts,
+ // but at least it will also cause the same for normal users.
+ $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED));
+
if (sizeof($ex_fid_ary))
{
// All forums that a user is allowed to access
@@ -611,7 +614,7 @@ class phpbb_search_fulltext_sphinx
$result_count = $result['total_found'];
- if ($start >= $result_count)
+ if ($result_count && $start >= $result_count)
{
$start = floor(($result_count - 1) / $per_page) * $per_page;
@@ -663,7 +666,7 @@ class phpbb_search_fulltext_sphinx
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -672,14 +675,14 @@ class phpbb_search_fulltext_sphinx
* @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)
{
$this->search_query = '';
$this->sphinx->SetMatchMode(SPH_MATCH_FULLSCAN);
$fields = ($firstpost_only) ? 'firstpost' : 'all';
$terms = 'all';
- return $this->keyword_search($type, $fields, $terms, $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);
+ return $this->keyword_search($type, $fields, $terms, $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);
}
/**
diff --git a/phpBB/phpbb/search/index.htm b/phpBB/phpbb/search/index.htm
new file mode 100644
index 0000000000..ee1f723a7d
--- /dev/null
+++ b/phpBB/phpbb/search/index.htm
@@ -0,0 +1,10 @@
+
+