From 421fc8d94db1b6a89518cbcc3f3141625eefff25 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Tue, 10 Apr 2012 11:25:06 +0100 Subject: [PATCH 001/575] [ticket/10776] Fixed errors in docs/README.html. PHPBB3-10776 --- phpBB/docs/README.html | 77 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index aa60d7dd25..d54b9d920f 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -41,7 +41,7 @@ -

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.

Readme

@@ -62,12 +62,12 @@
  • Getting help with phpBB3
    1. Documentation
    2. -
    3. Community Forums
    4. +
    5. Community forums
    6. Internet Relay Chat
  • Status of this version
  • -
  • Reporting Bugs +
  • Reporting bugs
    1. Security related bugs
    @@ -91,11 +91,11 @@
    -

    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 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 installation we highly recommend that you backup any existing data before proceeding!

    Users of phpBB3 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 phpBB3 Beta versions to phpBB3 RC1 and higher
    • Conversions from phpBB 2.0.x to phpBB3 Beta versions
    • @@ -107,7 +107,7 @@
      • Updates from phpBB3 RC1 to the latest version
      • Conversions from phpBB 2.0.x to the latest version
      • -
      • New installations of phpBB3 - always only the latest released version
      • +
      • New installations of phpBB3 - only the latest released version
    @@ -134,33 +134,33 @@

    http://www.phpbb.com/downloads/

    -

    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 and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the now appeared new language pack. To install the style imageset you should download the imageset for your language and unarchive the file/s into the relevant imageset directory (styles/prosilver/imageset or styles/subsilver2/imageset), again you must retain the directory structure. Once installed the imageset will become immediately available.

    +

    Installation of these packages is straightforward; simply download the required language pack and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the new language pack, which will have been automatically detected. To install the style imageset you should download the imageset for your language and unarchive the file/s into the relevant imageset directory (styles/prosilver/imageset or styles/subsilver2/imageset). Again, you must retain the directory structure. Once installed the imageset will immediately become available.

    If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed.

    2.ii. Styles

    -

    Although phpBB Group are rather proud of the included styles we realise that it may not be to everyones tastes. Therefore phpBB3 allows styles to be switched with relative ease. Firstly you need to locate and download a style you like. We maintain such a site at

    +

    Although phpBB Group are rather proud of the included styles we realise that it may not be to everyones tastes. Therefore phpBB3 allows other styles to be used with relative ease. First, you need to locate and download a style you like. We maintain such a site at

    http://www.phpbb.com/styles/

    -

    Please note that 3rd party styles downloaded for versions of phpBB2 will not work in phpBB3.

    +

    Please note that styles for phpBB2 will not work with phpBB3.

    -

    Once you have downloaded a style the usual next step is to unarchive (or upload the unarchived contents of) the package into your styles/ directory. You then need to visit Administration -> Styles, you should see the new style available, click install and it will become available for all your users.

    +

    Once you have downloaded a style, the next step is to unarchive (or upload the unarchived contents of) the package into your styles/ directory. You then need to visit Administration -> Styles. You should see the new style, click install and it will become available for all your users.

    -

    Please note that if you create your own style or modify existing ones, please remember to enable the "Recompile stale style components" setting within the Admin->General->Load Settings screen. This setting allows the cache to detect changes made to the style and automatically refresh it. If this setting is disabled, you will not see your changes taking effect.

    +

    Please note that if you create your own style or modify existing ones, you should enable the "Recompile stale style components" setting within the Admin->General->Load Settings screen. This setting allows the cache to detect changes made to the style and automatically refresh it. If this setting is disabled, you will not see your changes taking effect without manually refreshing the style components.

    2.iii. Modifications

    -

    Although not officially supported by phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB extend its capabilities still further and can be found at:

    +

    Although the modifications themselves are not officially supported by phpBB Group, phpBB has a thriving modification scene. These add features to phpBB, and can be found at:

    http://www.phpbb.com/mods/

    -

    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 modification and see if the problem is resolved.

    +

    Please remember that any bugs or other issues that may occur as a result of installing a modification should NOT be reported to the bug tracker (see below). First remove the modification, and then see if that has fixed the problem.

    -

    Also remember that any modifications which modify the database in any way may render upgrading your forum to future versions more difficult unless we state otherwise. With all this said many users have and continue to utilise many of the mods already available with great success.

    +

    Also remember that any modifications which modify the database in any way may make upgrading your forum to future versions more difficult. However, many users have and continue to utilise many of the mods already available with great success.

    @@ -178,27 +178,27 @@
    -

    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:

    http://www.phpbb.com/support/documentation/3.0/

    -

    This covers everything from installation through setting permissions and managing users.

    +

    This covers everything from installation to setting permissions and managing users.

    3.ii. Community Forums

    -

    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:

    +

    phpBB Group maintains a thriving community where a number of people generously donate their time to help support users. This site can be found at:

    -

    http://www.phpbb.com/

    +

    http://www.phpbb.com/community/

    -

    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 to make sure; 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.iii 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 good IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.

    +

    Another place you can find help is our IRC channel, which you can find on the Freenode IRC network, irc.freenode.net in #phpbb. It can be accessed by any IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.

    @@ -216,13 +216,13 @@
    -

    This is the third stable release of phpBB. The 3.0.x line is essentially feature frozen, with only point releases seeing fixes for bugs and security issues, though feature alterations and minor feature additions may be done if deemed absolutely required. Our next major release will be phpBB 3.2 and the planning phase has begun (the unstable development version is 3.1). Please do not post questions asking when 3.2 will be available, no release date has been set.

    +

    This is the third stable release of phpBB. The 3.0.x line is essentially feature frozen, with releases only containing fixes for bugs and security issues, though feature alterations and minor feature additions may be done if deemed absolutely required. Our next major release will be phpBB 3.1, which is currently under development. Please do not post questions asking when any future releases will be released; they will be released when they are finished.

    -

    For those interested in the development of phpBB should keep an eye on the community forums to see how things are progressing:

    +

    Those interested in the development of phpBB should keep an eye on the forums on the development site, Area51, to see how things are progressing and to help out if you wish:

    http://area51.phpbb.com/phpBB/

    -

    Please note that this forum should NOT be used to obtain support for or ask questions about phpBB 2.0.x or phpBB 3.0.x, the main community forums are the place for this. Any such posts will be locked and go unanswered.

    +

    Please note that these forums should NOT be used to obtain support, as the main community forums are the place for this. Any such posts will be locked and go unanswered.

    @@ -240,20 +240,19 @@
    -

    The phpBB Group uses a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please DO NOT post bug reports to our forums, they will be locked. In addition please DO NOT use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).

    +

    The phpBB Group uses a bug tracking system to manage all reported bugs, which can be found at the location listed below. Please DO NOT post bug reports to our forums, they will be locked. In addition please DO NOT use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).

    http://tracker.phpbb.com/

    While we very much appreciate receiving bug reports (the more reports the more stable phpBB will be) we ask you carry out a few steps before adding new entries:

      -
    • Firstly determine if your bug is reproduceable, how to determine this depends on the bug in question. Only if the bug is reproduceable it is likely to be a problem with phpBB3 (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues

    • -
    • Next please read or search through the existing bug reports to see if your bug (or one very similar to it) is already listed. If it is please add to that existing bug rather than creating a new duplicate entry (all this does is slow us down).

    • -
    • Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please DO NOT post your particular bug to the forum unless it's non-reproduceable or you are sure it's related to something you have done rather phpBB3

    • -
    • If no existing bug exists then please feel free to add it
    • +
    • First determine if your bug is reproducible. How to determine this depends on the bug in question. If the bug is reproduceable it is likely to be a problem with phpBB3 (or in some way connected). If it cannot, then it is most likely not a bug in phpBB.

    • +
    • Next please read or search through the existing bug reports to see whether we already know about the bug you found. If there is already a ticket, then please add to that existing bug rather than creating a new duplicate entry (all this does is slow us down).

    • +
    • If no existing bug exists then please add it
    -

    If you do post a new bug (i.e. one that isn't already listed in the bug tracker) firstly make sure you have logged in (your username and password are the same as for the community forums) then please include the following details:

    +

    If you do post a new bug, make sure you are logged in (your username and password are the same as for the community forums) then please include the following details in your bug report:

    • Your server type/version, e.g. Apache 1.3.28, IIS 4, Sambar, etc.
    • @@ -263,9 +262,9 @@

      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.

      -

      Once a bug has been submitted you will be emailed any follow up comments added to it. Please if you are requested to supply additional information, do so! It is frustrating for us to receive bug reports, ask for additional information but get nothing. In these cases we have a policy of closing the bug, which may leave a very real problem in place. Obviously we would rather not have this situation arise.

      +

      Once a bug has been submitted you will be emailed any follow up comments added to it. If you are requested to supply additional information, please do so! It is frustrating for us to receive bug reports, ask for additional information but get nothing. If we cannot replicate the bug we may close the ticket, which could leave the bug in phpBB. Obviously we would rather not have this situation arise.

      5.i. Security related bugs

      @@ -289,11 +288,11 @@
      -

      This list is not complete but does represent those bugs which may effect 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.

      +

      This list is by no means complete but does represent those bugs which may effect 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.
      @@ -313,9 +312,9 @@
      -

      phpBB is no longer supported on PHP3 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 4.3.3.

      +

      phpBB is no longer supported on PHP3 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 4.3.3. The minimum version that will be required for phpBB 3.1 is PHP 5.3.2.

      -

      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 7.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 4.3.3 to 6.0.0-dev without problem.

      @@ -339,7 +338,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 open source 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 © phpBB Group, All Rights Reserved.

      From 8a2063090c382445835e64fb95ad3aebd777e146 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 12 Apr 2012 20:53:27 +0100 Subject: [PATCH 002/575] [ticket/10776] Fixed a couple language changes in docs/README.html. PHPBB3-10776 --- phpBB/docs/README.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index d54b9d920f..0b5709a7c7 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -136,7 +136,7 @@

      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 and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the new language pack, which will have been automatically detected. To install the style imageset you should download the imageset for your language and unarchive the file/s into the relevant imageset directory (styles/prosilver/imageset or styles/subsilver2/imageset). Again, you must retain the directory structure. Once installed the imageset will immediately become available.

      +

      Installation of these packages is straightforward; simply download the required language pack and extract it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the new language pack, which will have been automatically detected. To install the style imageset you should download the imageset for your language and extract the file/s into the relevant imageset directory (styles/prosilver/imageset or styles/subsilver2/imageset). Again, you must retain the directory structure. Once installed the imageset will immediately become available.

      If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed.

      @@ -148,7 +148,7 @@

      Please note that styles for phpBB2 will not work with phpBB3.

      -

      Once you have downloaded a style, the next step is to unarchive (or upload the unarchived contents of) the package into your styles/ directory. You then need to visit Administration -> Styles. You should see the new style, click install and it will become available for all your users.

      +

      Once you have downloaded a style, the next step is to extract (or upload the extracted contents of) the package into your styles/ directory. You then need to visit Administration -> Styles. You should see the new style, click install and it will become available for all your users.

      Please note that if you create your own style or modify existing ones, you should enable the "Recompile stale style components" setting within the Admin->General->Load Settings screen. This setting allows the cache to detect changes made to the style and automatically refresh it. If this setting is disabled, you will not see your changes taking effect without manually refreshing the style components.

      @@ -194,7 +194,7 @@

      http://www.phpbb.com/community/

      -

      If you do seek help via our forums please be sure to do a search before posting to make sure; 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.

      +

      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.iii Internet Relay Chat

      From b8c55291ed7ed86565be2bc651bf20eb1a9ed4dd Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 17 Jun 2010 23:58:18 -0500 Subject: [PATCH 003/575] [feature/soft-delete] Lay the groundwork for a soft-delete feature So far, I've added no new functionality. The biggest change here is adjusting the DB column names to "visibility" rather than "approved". Some things here are pretty likely to change, for example the name and location of the topic_visibility class. Happy birthday phpBB :) PHPBB3-9657 --- phpBB/common.php | 3 + phpBB/develop/create_schema_files.php | 10 +- phpBB/develop/mysql_upgrader.php | 10 +- phpBB/docs/README.html | 4 - phpBB/feed.php | 28 +- phpBB/includes/acp/acp_forums.php | 8 +- phpBB/includes/acp/acp_main.php | 6 +- phpBB/includes/acp/acp_users.php | 4 +- phpBB/includes/constants.php | 4 + phpBB/includes/functions_admin.php | 77 +- phpBB/includes/functions_convert.php | 6 +- phpBB/includes/functions_posting.php | 64 +- phpBB/includes/mcp/mcp_forum.php | 10 +- phpBB/includes/mcp/mcp_front.php | 4 +- phpBB/includes/mcp/mcp_main.php | 12 +- phpBB/includes/mcp/mcp_post.php | 4 +- phpBB/includes/mcp/mcp_queue.php | 12 +- phpBB/includes/mcp/mcp_reports.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 22 +- phpBB/includes/search/fulltext_mysql.php | 14 +- phpBB/includes/search/fulltext_native.php | 15 +- phpBB/install/install_convert.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 2732 ++++++++-------- phpBB/install/schemas/mssql_schema.sql | 3312 ++++++++++--------- phpBB/install/schemas/mysql_40_schema.sql | 1954 ++++++----- phpBB/install/schemas/mysql_41_schema.sql | 1954 ++++++----- phpBB/install/schemas/oracle_schema.sql | 3572 ++++++++++----------- phpBB/install/schemas/postgres_schema.sql | 2476 +++++++------- phpBB/install/schemas/schema_data.sql | 2 + phpBB/install/schemas/sqlite_schema.sql | 1898 ++++++----- phpBB/mcp.php | 10 +- phpBB/memberlist.php | 2 +- phpBB/posting.php | 18 +- phpBB/search.php | 19 +- phpBB/viewforum.php | 11 +- phpBB/viewtopic.php | 32 +- 36 files changed, 9164 insertions(+), 9149 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index c7c5859c25..6e226aea9f 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -82,6 +82,9 @@ require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +include($phpbb_root_path . 'includes/class_visibility.'.$phpEx); + // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 6eb4a80199..6ef73266ba 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1331,7 +1331,7 @@ function get_schema_struct() 'icon_id' => array('UINT', 0), 'poster_ip' => array('VCHAR:40', ''), 'post_time' => array('TIMESTAMP', 0), - 'post_approved' => array('BOOL', 1), + 'post_visibility' => array('TINT:3', 0), 'post_reported' => array('BOOL', 0), 'enable_bbcode' => array('BOOL', 1), 'enable_smilies' => array('BOOL', 1), @@ -1357,7 +1357,7 @@ function get_schema_struct() 'topic_id' => array('INDEX', 'topic_id'), 'poster_ip' => array('INDEX', 'poster_ip'), 'poster_id' => array('INDEX', 'poster_id'), - 'post_approved' => array('INDEX', 'post_approved'), + 'post_visibility' => array('INDEX', 'post_visibility'), 'post_username' => array('INDEX', 'post_username'), 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), ), @@ -1673,7 +1673,7 @@ function get_schema_struct() 'forum_id' => array('UINT', 0), 'icon_id' => array('UINT', 0), 'topic_attachment' => array('BOOL', 0), - 'topic_approved' => array('BOOL', 1), + 'topic_visibility' => array('TINT:3', 0), 'topic_reported' => array('BOOL', 0), 'topic_title' => array('STEXT_UNI', '', 'true_sort'), 'topic_poster' => array('UINT', 0), @@ -1709,8 +1709,8 @@ function get_schema_struct() 'forum_id' => array('INDEX', 'forum_id'), 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')), 'last_post_time' => array('INDEX', 'topic_last_post_time'), - 'topic_approved' => array('INDEX', 'topic_approved'), - 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')), + 'topic_visibility' => array('INDEX', 'topic_visibility'), + 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')), 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), ), ); diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 7f82ebfeab..3d3891c7b9 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -768,7 +768,7 @@ function get_schema_struct() 'icon_id' => array('UINT', 0), 'poster_ip' => array('VCHAR:40', ''), 'post_time' => array('TIMESTAMP', 0), - 'post_approved' => array('BOOL', 1), + 'post_visibility' => array('TINT:3', 0), 'post_reported' => array('BOOL', 0), 'enable_bbcode' => array('BOOL', 1), 'enable_smilies' => array('BOOL', 1), @@ -794,7 +794,7 @@ function get_schema_struct() 'topic_id' => array('INDEX', 'topic_id'), 'poster_ip' => array('INDEX', 'poster_ip'), 'poster_id' => array('INDEX', 'poster_id'), - 'post_approved' => array('INDEX', 'post_approved'), + 'post_visibility' => array('INDEX', 'post_visibility'), 'post_username' => array('INDEX', 'post_username'), 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), ), @@ -1107,7 +1107,7 @@ function get_schema_struct() 'forum_id' => array('UINT', 0), 'icon_id' => array('UINT', 0), 'topic_attachment' => array('BOOL', 0), - 'topic_approved' => array('BOOL', 1), + 'topic_visibility' => array('TINT:3', 0), 'topic_reported' => array('BOOL', 0), 'topic_title' => array('STEXT_UNI', '', 'true_sort'), 'topic_poster' => array('UINT', 0), @@ -1143,8 +1143,8 @@ function get_schema_struct() 'forum_id' => array('INDEX', 'forum_id'), 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')), 'last_post_time' => array('INDEX', 'topic_last_post_time'), - 'topic_approved' => array('INDEX', 'topic_approved'), - 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')), + 'topic_visibility' => array('INDEX', 'topic_visibility'), + 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')), 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), ), ); diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 8f9e960275..9bd6f13bf4 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -324,11 +324,7 @@

      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.

      -<<<<<<< HEAD

      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 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.

      -======= -

      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 7.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 4.3.3 to 5.4.x without problem.

      ->>>>>>> develop-olympus

      7.i. Notice on PHP security issues

      diff --git a/phpBB/feed.php b/phpBB/feed.php index 9b7ef3a575..a806cdd608 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -681,7 +681,7 @@ class phpbb_feed_post_base extends phpbb_feed_base { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')]) - . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); + . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); } } } @@ -760,8 +760,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' AND topic_moved_id = 0 - AND (topic_approved = 1 - ' . $sql_m_approve . ') + AND ' . topic_visibility::get_visibility_sql_global('topic') . ' ORDER BY topic_last_post_time DESC'; $result = $db->sql_query_limit($sql, $this->num_items); @@ -783,7 +782,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', @@ -796,8 +795,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $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 ' . topic_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', @@ -894,7 +892,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . $this->forum_id . ' AND topic_moved_id = 0 - ' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . ' + AND ' . topic_visibility::get_visibility_sql('topic', $this->forum_id) . ' ORDER BY topic_last_post_time DESC'; $result = $db->sql_query_limit($sql, $this->num_items); @@ -914,14 +912,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' => $db->sql_in_set('p.topic_id', $topic_ids) . ' - ' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . ' + AND ' . topic_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', @@ -967,7 +965,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base { global $auth, $db, $user; - $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) @@ -1020,14 +1018,14 @@ class phpbb_feed_topic extends phpbb_feed_post_base global $auth, $db; $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 && !$auth->acl_get('m_approve', $this->forum_id) ? 'AND p.post_approved = 1' : '') . ' + AND ' . topic_visibility::get_visibility_sql('post', $this->forum_id, 'p.') . ' AND p.poster_id = u.user_id', 'ORDER_BY' => 'p.post_time DESC', ); @@ -1163,7 +1161,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $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 = $db->sql_query_limit($sql, $this->num_items); @@ -1233,7 +1231,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $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 = $db->sql_query_limit($sql, $this->num_items); @@ -1325,7 +1323,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $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 = $db->sql_query_limit($sql, $this->num_items); diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index c6dbf5eb9c..622d84d15e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -314,7 +314,7 @@ class acp_forums $end = $start + $batch_size; // Sync all topics in batch mode... - sync('topic_approved', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false); + sync('topic_visibility', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false); sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true); if ($end < $row2['max_topic_id']) @@ -1793,7 +1793,7 @@ class acp_forums FROM ' . POSTS_TABLE . ' WHERE forum_id = ' . $forum_id . ' AND post_postcount = 1 - AND post_approved = 1'; + AND post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $post_counts = array(); @@ -1931,7 +1931,7 @@ class acp_forums // Make sure the overall post/topic count is correct... $sql = 'SELECT COUNT(post_id) AS stat FROM ' . POSTS_TABLE . ' - WHERE post_approved = 1'; + WHERE post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1940,7 +1940,7 @@ class acp_forums $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' - WHERE topic_approved = 1'; + WHERE topic_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index eb613535bf..0584bb510e 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -144,14 +144,14 @@ class acp_main $sql = 'SELECT COUNT(post_id) AS stat FROM ' . POSTS_TABLE . ' - WHERE post_approved = 1'; + WHERE post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); set_config('num_posts', (int) $db->sql_fetchfield('stat'), true); $db->sql_freeresult($result); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' - WHERE topic_approved = 1'; + WHERE topic_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); set_config('num_topics', (int) $db->sql_fetchfield('stat'), true); $db->sql_freeresult($result); @@ -232,7 +232,7 @@ class acp_main $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id FROM ' . POSTS_TABLE . ' WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . ' - AND post_postcount = 1 AND post_approved = 1 + AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . ' GROUP BY poster_id'; $result = $db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b54257b04a..304027df45 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -676,7 +676,7 @@ class acp_users 'topic_time' => time(), 'forum_id' => $new_forum_id, 'icon_id' => 0, - 'topic_approved' => 1, + 'topic_visibility' => ITEM_APPROVED, 'topic_title' => $post_ary['title'], 'topic_first_poster_name' => $user_row['username'], 'topic_type' => POST_NORMAL, @@ -1033,7 +1033,7 @@ class acp_users $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); $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 68af41ab20..62c06dc1d0 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -87,6 +87,10 @@ define('ITEM_UNLOCKED', 0); define('ITEM_LOCKED', 1); define('ITEM_MOVED', 2); +define('ITEM_UNAPPROVED', 0); // => has not yet been approved +define('ITEM_APPROVED', 1); // => has been approved, and has not been soft deleted +define('ITEM_DELETED', 2); // => has been soft deleted + // Forum Flags define('FORUM_FLAG_LINK_TRACK', 1); define('FORUM_FLAG_PRUNE_POLL', 2); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5e2ee8c8f6..328c8e9778 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -644,7 +644,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s 'posts' => ($call_delete_posts) ? delete_posts($where_type, $where_ids, false, true, $post_count_sync, false) : 0, ); - $sql = 'SELECT topic_id, forum_id, topic_approved, topic_moved_id + $sql = 'SELECT topic_id, forum_id, topic_visibility, topic_moved_id FROM ' . TOPICS_TABLE . ' WHERE ' . $where_clause; $result = $db->sql_query($sql); @@ -654,7 +654,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s $forum_ids[] = $row['forum_id']; $topic_ids[] = $row['topic_id']; - if ($row['topic_approved'] && !$row['topic_moved_id']) + if ($row['topic_visibility'] == ITEM_APPROVED && !$row['topic_moved_id']) { $approved_topics++; } @@ -767,7 +767,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $approved_posts = 0; $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array(); - $sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id + $sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id FROM ' . POSTS_TABLE . ' WHERE ' . $where_clause; $result = $db->sql_query($sql); @@ -779,12 +779,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $topic_ids[] = (int) $row['topic_id']; $forum_ids[] = (int) $row['forum_id']; - if ($row['post_postcount'] && $post_count_sync && $row['post_approved']) + if ($row['post_postcount'] && $post_count_sync && $row['post_visibility'] == ITEM_APPROVED) { $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; } - if ($row['post_approved']) + if ($row['post_visibility'] == ITEM_APPROVED) { $approved_posts++; } @@ -1274,7 +1274,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) * - forum Resync complete forum * - topic Resync topics * - topic_moved Removes topic shadows that would be in the same forum as the topic they link to -* - topic_approved Resyncs the topic_approved flag according to the status of the first post +* - topic_visibility Resyncs the topic_visibility flag according to the status of the first post * - post_reported Resyncs the post_reported flag, relying on actual reports * - topic_reported Resyncs the topic_reported flag, relying on post_reported flags * - post_attachement Same as post_reported, but with attachment flags @@ -1294,7 +1294,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $where_ids = ($where_ids) ? array((int) $where_ids) : array(); } - if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_approved' || $mode == 'topic_reported' || $mode == 'post_reported') + if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_visibility' || $mode == 'topic_reported' || $mode == 'post_reported') { if (!$where_type) { @@ -1380,7 +1380,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_transaction('commit'); break; - case 'topic_approved': + case 'topic_visibility': $db->sql_transaction('begin'); switch ($db->sql_layer) @@ -1388,22 +1388,22 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, case 'mysql4': case 'mysqli': $sql = 'UPDATE ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p - SET t.topic_approved = p.post_approved + SET t.topic_visibility = p.post_visibility $where_sql_and t.topic_first_post_id = p.post_id"; $db->sql_query($sql); break; default: - $sql = 'SELECT t.topic_id, p.post_approved + $sql = 'SELECT t.topic_id, p.post_visibility FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p $where_sql_and p.post_id = t.topic_first_post_id - AND p.post_approved <> t.topic_approved"; + AND p.post_visibility <> t.topic_visibility"; $result = $db->sql_query($sql); $topic_ids = array(); while ($row = $db->sql_fetchrow($result)) { - $topic_ids[] = $row['topic_id']; + $topic_ids[$row['topic_id']] = $row['post_visibility']; } $db->sql_freeresult($result); @@ -1412,10 +1412,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, return; } - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_approved = 1 - topic_approved - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + foreach ($topic_ids as $topic_id => $visibility) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_visibility = ' . $visibility . ' + WHERE topic_id' . $topic_id; + $db->sql_query($sql); + } break; } @@ -1680,10 +1683,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // 2: Get topic counts for each forum (optional) if ($sync_extra) { - $sql = 'SELECT forum_id, topic_approved, COUNT(topic_id) AS forum_topics + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS forum_topics FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' - GROUP BY forum_id, topic_approved'; + GROUP BY forum_id, topic_visibility'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1691,7 +1694,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_id = (int) $row['forum_id']; $forum_data[$forum_id]['topics_real'] += $row['forum_topics']; - if ($row['topic_approved']) + if ($row['topic_visibility'] == ITEM_APPROVED) { $forum_data[$forum_id]['topics'] = $row['forum_topics']; } @@ -1707,7 +1710,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'SELECT SUM(t.topic_replies + 1) AS forum_posts FROM ' . TOPICS_TABLE . ' t WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' - AND t.topic_approved = 1 + AND t.topic_visibility = ' . ITEM_APPROVED . ' AND t.topic_status <> ' . ITEM_MOVED; } else @@ -1715,7 +1718,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'SELECT t.forum_id, SUM(t.topic_replies + 1) AS forum_posts FROM ' . TOPICS_TABLE . ' t WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' - AND t.topic_approved = 1 + AND t.topic_visibility = ' . ITEM_APPROVED . ' AND t.topic_status <> ' . ITEM_MOVED . ' GROUP BY t.forum_id'; } @@ -1737,14 +1740,14 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id FROM ' . TOPICS_TABLE . ' t WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' - AND t.topic_approved = 1'; + AND t.topic_visibility = ' . ITEM_APPROVED; } else { $sql = 'SELECT t.forum_id, MAX(t.topic_last_post_id) as last_post_id FROM ' . TOPICS_TABLE . ' t WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' - AND t.topic_approved = 1 + AND t.topic_visibility = ' . ITEM_APPROVED . ' GROUP BY t.forum_id'; } @@ -1846,7 +1849,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_transaction('begin'); - $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_visibility, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time FROM ' . TOPICS_TABLE . " t $where_sql"; $result = $db->sql_query($sql); @@ -1880,10 +1883,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // Use "t" as table alias because of the $where_sql clause // NOTE: 't.post_approved' in the GROUP BY is causing a major slowdown. - $sql = 'SELECT t.topic_id, t.post_approved, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id + $sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id FROM ' . POSTS_TABLE . " t $where_sql - GROUP BY t.topic_id, t.post_approved"; + GROUP BY t.topic_id, t.post_visibility"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1907,7 +1910,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_data[$topic_id]['replies_real'] += $row['total_posts']; $topic_data[$topic_id]['first_post_id'] = (!$topic_data[$topic_id]['first_post_id']) ? $row['first_post_id'] : min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']); - if ($row['post_approved'] || !$topic_data[$topic_id]['last_post_id']) + if ($row['post_visibility'] || !$topic_data[$topic_id]['last_post_id']) { $topic_data[$topic_id]['replies'] = $row['total_posts'] - 1; $topic_data[$topic_id]['last_post_id'] = $row['last_post_id']; @@ -1952,7 +1955,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($delete_topics, $delete_topic_ids); } - $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND u.user_id = p.poster_id'; @@ -1965,9 +1968,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, if ($row['post_id'] == $topic_data[$topic_id]['first_post_id']) { - if ($topic_data[$topic_id]['topic_approved'] != $row['post_approved']) + if ($topic_data[$topic_id]['topic_visibility'] != $row['post_visibility']) { - $approved_unapproved_ids[] = $topic_id; + $approved_unapproved_ids[$topic_id] = $row['post_visibility']; } $topic_data[$topic_id]['time'] = $row['post_time']; $topic_data[$topic_id]['poster'] = $row['poster_id']; @@ -2029,7 +2032,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_shadow_topics = array(); if (sizeof($post_ids)) { - $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND u.user_id = p.poster_id'; @@ -2099,10 +2102,14 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // approved becomes unapproved, and vice-versa if (sizeof($approved_unapproved_ids)) { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_approved = 1 - topic_approved - WHERE ' . $db->sql_in_set('topic_id', $approved_unapproved_ids); - $db->sql_query($sql); + foreach ($approved_unapproved_ids as $update_topic_id => $status) + { + // @TODO: Consider grouping by $status and only running 3 queries + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_visibility = ' . $status . ' + WHERE topic_id = ' . $update_topic_id; + $db->sql_query($sql); + } } unset($approved_unapproved_ids); diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index ac791e0d9b..a34a193f60 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1768,7 +1768,7 @@ function sync_post_count($offset, $limit) $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id FROM ' . POSTS_TABLE . ' WHERE post_postcount = 1 - AND post_approved = 1 + AND post_visibility = ' . ITEM_APPROVED . ' GROUP BY poster_id ORDER BY poster_id'; $result = $db->sql_query_limit($sql, $limit, $offset); @@ -1941,7 +1941,7 @@ function update_dynamic_config() $sql = 'SELECT COUNT(post_id) AS stat FROM ' . POSTS_TABLE . ' - WHERE post_approved = 1'; + WHERE post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1950,7 +1950,7 @@ function update_dynamic_config() $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' - WHERE topic_approved = 1'; + WHERE topic_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index c50395a5df..2f51200b48 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -176,7 +176,7 @@ function update_post_information($type, $ids, $return_update_sql = false) if ($type != 'topic') { $topic_join = ', ' . TOPICS_TABLE . ' t'; - $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_approved = 1'; + $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_visibility = ' . ITEM_APPROVED; } else { @@ -190,7 +190,7 @@ function update_post_information($type, $ids, $return_update_sql = false) FROM ' . POSTS_TABLE . " p $topic_join WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " $topic_condition - AND p.post_approved = 1"; + AND p.post_visibility = " . ITEM_APPROVED; } else { @@ -198,7 +198,7 @@ function update_post_information($type, $ids, $return_update_sql = false) FROM ' . POSTS_TABLE . " p $topic_join WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " $topic_condition - AND p.post_approved = 1 + AND p.post_visibility = " . ITEM_APPROVED . " GROUP BY p.{$type}_id"; } $result = $db->sql_query($sql); @@ -993,7 +993,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p' . " WHERE p.topic_id = $topic_id - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' + AND " . topic_visibility::get_visibility_sql('post', $forum_id, 'p.') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' ORDER BY p.post_time '; @@ -1489,7 +1489,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) delete_topics('topic_id', array($topic_id), false); $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1'; - $sql_data[FORUMS_TABLE] .= ($data['topic_approved']) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : ''; + $sql_data[FORUMS_TABLE] .= ($data['topic_visibility'] == ITEM_APPROVED) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : ''; $update_sql = update_post_information('forum', $forum_id, true); if (sizeof($update_sql)) @@ -1509,18 +1509,18 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : ''; + $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : ''; $sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "', topic_time = " . (int) $row['post_time']; // Decrementing topic_replies here is fine because this case only happens if there is more than one post within the topic - basically removing one "reply" - $sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : ''); + $sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : ''); $next_post_id = (int) $row['post_id']; break; case 'delete_last_post': - $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : ''; + $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : ''; $update_sql = update_post_information('forum', $forum_id, true); if (sizeof($update_sql)) @@ -1529,7 +1529,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); } - $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : ''); + $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : ''); $update_sql = update_post_information('topic', $topic_id, true); if (sizeof($update_sql)) @@ -1541,8 +1541,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) { $sql = 'SELECT MAX(post_id) as last_post_id FROM ' . POSTS_TABLE . " - WHERE topic_id = $topic_id " . - ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : ''); + WHERE topic_id = $topic_id + AND " . topic_visibility::get_visibility_sql('post', $forum_id); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1554,17 +1554,17 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) case 'delete': $sql = 'SELECT post_id FROM ' . POSTS_TABLE . " - WHERE topic_id = $topic_id " . - ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '') . ' + WHERE topic_id = $topic_id + AND " . topic_visibility::get_visibility_sql('post', $forum_id) . ' AND post_time > ' . $data['post_time'] . ' ORDER BY post_time ASC'; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : ''; + $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : ''; - $sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : ''); + $sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : ''); $next_post_id = (int) $row['post_id']; break; } @@ -1674,9 +1674,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) $user->data['user_id']; // Retrieve some additional information if not present - if ($mode == 'edit' && (!isset($data['post_approved']) || !isset($data['topic_approved']) || $data['post_approved'] === false || $data['topic_approved'] === false)) + if ($mode == 'edit' && (!isset($data['post_visibility']) || !isset($data['topic_visibility']) || $data['post_visibility'] === false || $data['topic_visibility'] === false)) { - $sql = 'SELECT p.post_approved, t.topic_type, t.topic_replies, t.topic_replies_real, t.topic_approved + $sql = 'SELECT p.post_visibility, t.topic_type, t.topic_replies, t.topic_replies_real, t.topic_visibility FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE t.topic_id = p.topic_id AND p.post_id = ' . $data['post_id']; @@ -1684,8 +1684,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $topic_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $data['topic_approved'] = $topic_row['topic_approved']; - $data['post_approved'] = $topic_row['post_approved']; + $data['topic_visibility'] = $topic_row['topic_visibility']; + $data['post_visibility'] = $topic_row['post_visibility']; } // This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval @@ -1719,7 +1719,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'icon_id' => $data['icon_id'], 'poster_ip' => $user->ip, 'post_time' => $current_time, - 'post_approved' => $post_approval, + 'post_visibility' => $post_approval, 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_magic_url' => $data['enable_urls'], @@ -1785,7 +1785,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'forum_id' => $data['forum_id'], 'poster_id' => $data['poster_id'], 'icon_id' => $data['icon_id'], - 'post_approved' => (!$post_approval) ? 0 : $data['post_approved'], + 'post_visibility' => (!$post_approval) ? 0 : $data['post_visibility'], 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_magic_url' => $data['enable_urls'], @@ -1807,7 +1807,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u break; } - $post_approved = $sql_data[POSTS_TABLE]['sql']['post_approved']; + $post_approved = $sql_data[POSTS_TABLE]['sql']['post_visibility']; $topic_row = array(); // And the topic ladies and gentlemen @@ -1820,7 +1820,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_last_view_time' => $current_time, 'forum_id' => $data['forum_id'], 'icon_id' => $data['icon_id'], - 'topic_approved' => $post_approval, + 'topic_visibility' => $post_approval, 'topic_title' => $subject, 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), 'topic_first_poster_colour' => $user->data['user_colour'], @@ -1897,7 +1897,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[TOPICS_TABLE]['sql'] = array( 'forum_id' => $data['forum_id'], 'icon_id' => $data['icon_id'], - 'topic_approved' => (!$post_approval) ? 0 : $data['topic_approved'], + 'topic_visibility' => (!$post_approval) ? 0 : $data['topic_visibility'], 'topic_title' => $subject, 'topic_first_poster_name' => $username, 'topic_type' => $topic_type, @@ -1913,12 +1913,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u ); // Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved - if (!$post_approval && $data['topic_approved']) + if (!$post_approval && $data['topic_visibility'] == ITEM_APPROVED) { // Do we need to grab some topic informations? if (!sizeof($topic_row)) { - $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_approved + $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_visibility FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $data['topic_id']; $result = $db->sql_query($sql); @@ -1949,7 +1949,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'edit_last_post': // Correctly set back the topic replies and forum posts... but only if the post was approved before. - if (!$post_approval && $data['post_approved']) + if (!$post_approval && $data['post_visibility'] == ITEM_APPROVED) { $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1'; @@ -2173,7 +2173,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // we need to update the last forum information // only applicable if the topic is approved - if ($post_approved || !$data['post_approved']) + if ($post_approved || $data['post_visibility'] != ITEM_APPROVED) { // the last post makes us update the forum table. This can happen if... // We make a new topic @@ -2219,13 +2219,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'"; } } - else if ($data['post_approved'] !== $post_approved) + else if ($data['post_visibility'] !== $post_approved) { // we need a fresh change of socks, everything has become invalidated $sql = 'SELECT MAX(topic_last_post_id) as last_post_id FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . (int) $data['forum_id'] . ' - AND topic_approved = 1'; + AND topic_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -2290,13 +2290,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } } } - else if (!$data['post_approved'] && ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))) + else if (!$data['post_visibility'] == ITEM_APPROVED && ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))) { // like having the rug pulled from under us $sql = 'SELECT MAX(post_id) as last_post_id FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . (int) $data['topic_id'] . ' - AND post_approved = 1'; + AND post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 7b3bc82093..48b9c7c2d3 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -154,7 +154,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t WHERE t.forum_id = ' . $forum_id . ' - ' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " + ' . topic_visibility::get_visibility_sql('topic', $forum_id, 't.') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql"; $result = $db->sql_query_limit($sql, $topics_per_page, $start); @@ -220,9 +220,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $topic_title = censor_text($row['topic_title']); - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; + $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : ''; + $topic_deleted = ($row['topic_visibility'] == ITEM_DELETED) ? true : false; $topic_row = array( 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', @@ -232,6 +233,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'DELETED_IMG' => ($topic_deleted) ? $user->img(/*TODO*/) : '', 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -254,7 +256,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, 'S_UNREAD_TOPIC' => $unread_topic, + ); if ($row['topic_status'] == ITEM_MOVED) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 13398e62bc..1b9521674d 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -39,7 +39,7 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT COUNT(post_id) AS total FROM ' . POSTS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND post_approved = 0'; + AND post_visibility = ' . ITEM_UNAPPROVED; $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); $db->sql_freeresult($result); @@ -60,7 +60,7 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND post_approved = 0 + AND post_visibility = ' . ITEM_UNAPPROVED . ' ORDER BY post_time DESC'; $result = $db->sql_query_limit($sql, 5); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 95ca7c2e1b..db9872e04e 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -475,7 +475,7 @@ function mcp_move_topic($topic_ids) foreach ($topic_data as $topic_id => $topic_info) { - if ($topic_info['topic_approved']) + if ($topic_info['topic_visibility'] == ITEM_APPROVED) { $topics_authed_moved++; $topic_posts_added++; @@ -486,7 +486,7 @@ function mcp_move_topic($topic_ids) $topics_removed++; $topic_posts_removed += $topic_info['topic_replies']; - if ($topic_info['topic_approved']) + if ($topic_info['topic_visibility'] == ITEM_APPROVED) { $topics_authed_removed++; $topic_posts_removed++; @@ -528,13 +528,13 @@ function mcp_move_topic($topic_ids) add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']); // Leave a redirection if required and only if the topic is visible to users - if ($leave_shadow && $row['topic_approved'] && $row['topic_type'] != POST_GLOBAL) + if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL) { $shadow = array( 'forum_id' => (int) $row['forum_id'], 'icon_id' => (int) $row['icon_id'], 'topic_attachment' => (int) $row['topic_attachment'], - 'topic_approved' => 1, // a shadow topic is always approved + 'topic_visibliity' => ITEM_APPROVED, // a shadow topic is always approved 'topic_reported' => 0, // a shadow topic is never reported 'topic_title' => (string) $row['topic_title'], 'topic_poster' => (int) $row['topic_poster'], @@ -932,7 +932,7 @@ function mcp_fork_topic($topic_ids) 'forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], - 'topic_approved' => 1, + 'topic_visibility' => ITEM_APPROVED, 'topic_reported' => 0, 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], @@ -1009,7 +1009,7 @@ function mcp_fork_topic($topic_ids) 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], - 'post_approved' => 1, + 'post_visibility' => ITEM_APPROVED, 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_smilies' => (int) $row['enable_smilies'], diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 520c964228..90ce18de4e 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -185,7 +185,7 @@ function mcp_post_details($id, $mode, $action) 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), 'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false, - 'S_POST_UNAPPROVED' => (!$post_info['post_approved']) ? true : false, + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED) ? true : false, 'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false, 'S_USER_NOTES' => true, 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, @@ -415,7 +415,7 @@ function change_poster(&$post_info, $userdata) } // Adjust post counts... only if the post is approved (else, it was not added the users post count anyway) - if ($post_info['post_postcount'] && $post_info['post_approved']) + if ($post_info['post_postcount'] && $post_info['post_visibility'] == ITEM_APPROVED) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts - 1 diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index b44685b8a3..833f924efc 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -183,7 +183,7 @@ class mcp_queue 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => !$post_info['post_approved'], + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED) , 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, @@ -309,7 +309,7 @@ class mcp_queue $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . ' WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . ' - AND p.post_approved = 0 + AND p.post_visibility = ' . ITEM_UNAPPROVED . ' ' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . " AND t.topic_id = p.topic_id @@ -361,7 +361,7 @@ class mcp_queue $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour FROM ' . TOPICS_TABLE . " t WHERE " . $db->sql_in_set('forum_id', $forum_list) . " - AND topic_approved = 0 + AND topic_visibility = " . ITEM_UNAPPROVED . " $limit_time_sql ORDER BY $sort_order_sql"; $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); @@ -484,7 +484,7 @@ function approve_post($post_id_list, $id, $mode) foreach ($post_info as $post_id => $post_data) { - if ($post_data['post_approved']) + if ($post_data['post_visibility'] == ITEM_APPROVED) { $post_approved_list[] = $post_id; continue; @@ -544,7 +544,7 @@ function approve_post($post_id_list, $id, $mode) if (sizeof($topic_approve_sql)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_approved = 1 + SET topic_visibility = ' . ITEM_APPROVED . ' WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); $db->sql_query($sql); } @@ -552,7 +552,7 @@ function approve_post($post_id_list, $id, $mode) if (sizeof($post_approve_sql)) { $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_approved = 1 + SET post_visibility = ' . ITEM_APPROVED . ' WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); $db->sql_query($sql); } diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 2890cd56e2..dc917a25e0 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -190,7 +190,7 @@ class mcp_reports 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => !$post_info['post_approved'], + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED), 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index e39e553ab6..f6fd12f0c4 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -145,8 +145,8 @@ function mcp_topic_view($id, $mode, $action) $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . ' - p.topic_id = ' . $topic_id . ' ' . - ((!$auth->acl_get('m_approve', $topic_info['forum_id'])) ? ' AND p.post_approved = 1 ' : '') . ' + p.topic_id = ' . $topic_id . ' + AND ' . topic_visibility::get_visibility_sql('post', $topic_info['forum_id'], 'p.') . ' AND p.poster_id = u.user_id ' . $limit_time_sql . ' ORDER BY ' . $sort_order_sql; @@ -227,7 +227,7 @@ function mcp_topic_view($id, $mode, $action) parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count); } - if (!$row['post_approved']) + if ($row['post_visibility'] == ITEM_UNAPPROVED) { $has_unapproved_posts = true; } @@ -249,7 +249,7 @@ function mcp_topic_view($id, $mode, $action) 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])), - 'S_POST_UNAPPROVED' => (!$row['post_approved'] && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_POST_UNAPPROVED' => ($row['post_visibility'] != ITEM_APPROVED && $auth->acl_get('m_approve', $topic_info['forum_id'])), 'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, @@ -448,7 +448,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) if ($sort_order_sql[0] == 'u') { - $sql = 'SELECT p.post_id, p.forum_id, p.post_approved + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id @@ -457,7 +457,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } else { - $sql = 'SELECT p.post_id, p.forum_id, p.post_approved + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility FROM ' . POSTS_TABLE . " p WHERE p.topic_id = $topic_id $limit_time_sql @@ -470,7 +470,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) while ($row = $db->sql_fetchrow($result)) { // If split from selected post (split_beyond), we split the unapproved items too. - if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id'])) + if ($row['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) { // continue; } @@ -497,10 +497,10 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $icon_id = request_var('icon', 0); $sql_ary = array( - 'forum_id' => $to_forum_id, - 'topic_title' => $subject, - 'icon_id' => $icon_id, - 'topic_approved'=> 1 + 'forum_id' => $to_forum_id, + 'topic_title' => $subject, + 'icon_id' => $icon_id, + 'topic_visibility' => 1 ); $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index cf89ab1c24..73bf5c52f2 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -265,7 +265,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 array $m_approve_fid_sql specifies which types of posts a user may view, based on permissions * @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 @@ -292,7 +292,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $sort_key, $topic_id, implode(',', $ex_fid_ary), - implode(',', $m_approve_fid_ary), +// @TODO implode(',', $m_approve_fid_ary), implode(',', $author_ary) ))); @@ -354,7 +354,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base break; } - if (!sizeof($m_approve_fid_ary)) +/* if (!sizeof($m_approve_fid_ary)) { $m_approve_fid_sql = ' AND p.post_approved = 1'; } @@ -366,6 +366,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base { $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'; @@ -445,7 +446,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 array $m_approve_fid_sql specifies which types of posts a user may view, based on permissions * @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 @@ -473,7 +474,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $sort_key, $topic_id, implode(',', $ex_fid_ary), - implode(',', $m_approve_fid_ary), +// @TODO implode(',', $m_approve_fid_ary), implode(',', $author_ary), $author_name, ))); @@ -523,7 +524,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base break; } - if (!sizeof($m_approve_fid_ary)) +/* if (!sizeof($m_approve_fid_ary)) { $m_approve_fid_sql = ' AND p.post_approved = 1'; } @@ -535,6 +536,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base { $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')'; } +*/ // 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/includes/search/fulltext_native.php index 96b3f02ec6..c7e7a451e4 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -414,7 +414,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 array $m_approve_fid_sql specifies which types of posts the user can view * @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 @@ -451,7 +451,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $sort_key, $topic_id, implode(',', $ex_fid_ary), - implode(',', $m_approve_fid_ary), +// @TODO implode(',', $m_approve_fid_ary), implode(',', $author_ary), $author_name, ))); @@ -628,7 +628,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $sql_where[] = '(' . implode(' OR ', $is_null_joins) . ')'; } - if (!sizeof($m_approve_fid_ary)) +/* if (!sizeof($m_approve_fid_ary)) { $sql_where[] = 'p.post_approved = 1'; } @@ -636,6 +636,8 @@ class phpbb_search_fulltext_native extends phpbb_search_base { $sql_where[] = '(p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')'; } +*/ + $sql_where[] = $m_approve_fid_sql; if ($topic_id) { @@ -808,7 +810,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 array $m_approve_fid_sql specifies which posts a user can view, based on permissions * @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 @@ -836,7 +838,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $sort_key, $topic_id, implode(',', $ex_fid_ary), - implode(',', $m_approve_fid_ary), +// @TODO implode(',', $m_approve_fid_ary), implode(',', $author_ary), $author_name, ))); @@ -886,7 +888,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base break; } - if (!sizeof($m_approve_fid_ary)) +/* if (!sizeof($m_approve_fid_ary)) { $m_approve_fid_sql = ' AND p.post_approved = 1'; } @@ -898,6 +900,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base { $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; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index b8045cb98b..60606d74ab 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -1465,7 +1465,7 @@ class install_convert extends module $end = ($sync_batch + $batch_size - 1); // Sync all topics in batch mode... - sync('topic_approved', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, false); + sync('topic_visibility', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, false); sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true); $template->assign_block_vars('checks', array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 588557b92a..d83fe4c2da 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1,1367 +1,1365 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. - -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id INTEGER NOT NULL, - post_msg_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - in_message INTEGER DEFAULT 0 NOT NULL, - poster_id INTEGER DEFAULT 0 NOT NULL, - is_orphan INTEGER DEFAULT 1 NOT NULL, - physical_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - real_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - download_count INTEGER DEFAULT 0 NOT NULL, - attach_comment BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - mimetype VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - filesize INTEGER DEFAULT 0 NOT NULL, - filetime INTEGER DEFAULT 0 NOT NULL, - thumbnail INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_attachments ADD PRIMARY KEY (attach_id);; - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments(filetime);; -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments(post_msg_id);; -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments(topic_id);; -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments(poster_id);; -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments(is_orphan);; - -CREATE GENERATOR phpbb_attachments_gen;; -SET GENERATOR phpbb_attachments_gen TO 0;; - -CREATE TRIGGER t_phpbb_attachments FOR phpbb_attachments -BEFORE INSERT -AS -BEGIN - NEW.attach_id = GEN_ID(phpbb_attachments_gen, 1); -END;; - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_role_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups(group_id);; -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups(auth_option_id);; -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups(auth_role_id);; - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id INTEGER NOT NULL, - auth_option VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, - is_global INTEGER DEFAULT 0 NOT NULL, - is_local INTEGER DEFAULT 0 NOT NULL, - founder_only INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_options ADD PRIMARY KEY (auth_option_id);; - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; - -CREATE GENERATOR phpbb_acl_options_gen;; -SET GENERATOR phpbb_acl_options_gen TO 0;; - -CREATE TRIGGER t_phpbb_acl_options FOR phpbb_acl_options -BEFORE INSERT -AS -BEGIN - NEW.auth_option_id = GEN_ID(phpbb_acl_options_gen, 1); -END;; - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id INTEGER NOT NULL, - role_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - role_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - role_type VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - role_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_roles ADD PRIMARY KEY (role_id);; - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles(role_type);; -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles(role_order);; - -CREATE GENERATOR phpbb_acl_roles_gen;; -SET GENERATOR phpbb_acl_roles_gen TO 0;; - -CREATE TRIGGER t_phpbb_acl_roles FOR phpbb_acl_roles -BEFORE INSERT -AS -BEGIN - NEW.role_id = GEN_ID(phpbb_acl_roles_gen, 1); -END;; - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_roles_data ADD PRIMARY KEY (role_id, auth_option_id);; - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data(auth_option_id);; - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_role_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);; -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);; -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);; - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id INTEGER NOT NULL, - ban_userid INTEGER DEFAULT 0 NOT NULL, - ban_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - ban_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - ban_start INTEGER DEFAULT 0 NOT NULL, - ban_end INTEGER DEFAULT 0 NOT NULL, - ban_exclude INTEGER DEFAULT 0 NOT NULL, - ban_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - ban_give_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_banlist ADD PRIMARY KEY (ban_id);; - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist(ban_end);; -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist(ban_userid, ban_exclude);; -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist(ban_email, ban_exclude);; -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist(ban_ip, ban_exclude);; - -CREATE GENERATOR phpbb_banlist_gen;; -SET GENERATOR phpbb_banlist_gen TO 0;; - -CREATE TRIGGER t_phpbb_banlist FOR phpbb_banlist -BEFORE INSERT -AS -BEGIN - NEW.ban_id = GEN_ID(phpbb_banlist_gen, 1); -END;; - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id INTEGER DEFAULT 0 NOT NULL, - bbcode_tag VARCHAR(16) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_helpline VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - display_on_posting INTEGER DEFAULT 0 NOT NULL, - bbcode_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - bbcode_tpl BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - first_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - first_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - second_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - second_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_bbcodes ADD PRIMARY KEY (bbcode_id);; - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes(display_on_posting);; - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_bookmarks ADD PRIMARY KEY (topic_id, user_id);; - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id INTEGER NOT NULL, - bot_active INTEGER DEFAULT 1 NOT NULL, - bot_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_id INTEGER DEFAULT 0 NOT NULL, - bot_agent VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bot_ip VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_bots ADD PRIMARY KEY (bot_id);; - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots(bot_active);; - -CREATE GENERATOR phpbb_bots_gen;; -SET GENERATOR phpbb_bots_gen TO 0;; - -CREATE TRIGGER t_phpbb_bots FOR phpbb_bots -BEFORE INSERT -AS -BEGIN - NEW.bot_id = GEN_ID(phpbb_bots_gen, 1); -END;; - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - config_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - is_dynamic INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_config ADD PRIMARY KEY (config_name);; - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config(is_dynamic);; - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - confirm_type INTEGER DEFAULT 0 NOT NULL, - code VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - seed INTEGER DEFAULT 0 NOT NULL, - attempts INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_confirm ADD PRIMARY KEY (session_id, confirm_id);; - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm(confirm_type);; - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id INTEGER NOT NULL, - disallow_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_disallow ADD PRIMARY KEY (disallow_id);; - - -CREATE GENERATOR phpbb_disallow_gen;; -SET GENERATOR phpbb_disallow_gen TO 0;; - -CREATE TRIGGER t_phpbb_disallow FOR phpbb_disallow -BEFORE INSERT -AS -BEGIN - NEW.disallow_id = GEN_ID(phpbb_disallow_gen, 1); -END;; - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - save_time INTEGER DEFAULT 0 NOT NULL, - draft_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - draft_message BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_drafts ADD PRIMARY KEY (draft_id);; - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts(save_time);; - -CREATE GENERATOR phpbb_drafts_gen;; -SET GENERATOR phpbb_drafts_gen TO 0;; - -CREATE TRIGGER t_phpbb_drafts FOR phpbb_drafts -BEFORE INSERT -AS -BEGIN - NEW.draft_id = GEN_ID(phpbb_drafts_gen, 1); -END;; - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - ext_active INTEGER DEFAULT 0 NOT NULL, - ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id INTEGER NOT NULL, - group_id INTEGER DEFAULT 0 NOT NULL, - extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_extensions ADD PRIMARY KEY (extension_id);; - - -CREATE GENERATOR phpbb_extensions_gen;; -SET GENERATOR phpbb_extensions_gen TO 0;; - -CREATE TRIGGER t_phpbb_extensions FOR phpbb_extensions -BEFORE INSERT -AS -BEGIN - NEW.extension_id = GEN_ID(phpbb_extensions_gen, 1); -END;; - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id INTEGER NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - cat_id INTEGER DEFAULT 0 NOT NULL, - allow_group INTEGER DEFAULT 0 NOT NULL, - download_mode INTEGER DEFAULT 1 NOT NULL, - upload_icon VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - max_filesize INTEGER DEFAULT 0 NOT NULL, - allowed_forums BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - allow_in_pm INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_extension_groups ADD PRIMARY KEY (group_id);; - - -CREATE GENERATOR phpbb_extension_groups_gen;; -SET GENERATOR phpbb_extension_groups_gen TO 0;; - -CREATE TRIGGER t_phpbb_extension_groups FOR phpbb_extension_groups -BEFORE INSERT -AS -BEGIN - NEW.group_id = GEN_ID(phpbb_extension_groups_gen, 1); -END;; - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id INTEGER NOT NULL, - parent_id INTEGER DEFAULT 0 NOT NULL, - left_id INTEGER DEFAULT 0 NOT NULL, - right_id INTEGER DEFAULT 0 NOT NULL, - forum_parents BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - forum_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_desc_options INTEGER DEFAULT 7 NOT NULL, - forum_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_style INTEGER DEFAULT 0 NOT NULL, - forum_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_rules BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - forum_rules_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_rules_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_rules_options INTEGER DEFAULT 7 NOT NULL, - forum_rules_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, - forum_type INTEGER DEFAULT 0 NOT NULL, - forum_status INTEGER DEFAULT 0 NOT NULL, - forum_posts INTEGER DEFAULT 0 NOT NULL, - forum_topics INTEGER DEFAULT 0 NOT NULL, - forum_topics_real INTEGER DEFAULT 0 NOT NULL, - forum_last_post_id INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, - forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_last_post_time INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_flags INTEGER DEFAULT 32 NOT NULL, - forum_options INTEGER DEFAULT 0 NOT NULL, - display_subforum_list INTEGER DEFAULT 1 NOT NULL, - display_on_index INTEGER DEFAULT 1 NOT NULL, - enable_indexing INTEGER DEFAULT 1 NOT NULL, - enable_icons INTEGER DEFAULT 1 NOT NULL, - enable_prune INTEGER DEFAULT 0 NOT NULL, - prune_next INTEGER DEFAULT 0 NOT NULL, - prune_days INTEGER DEFAULT 0 NOT NULL, - prune_viewed INTEGER DEFAULT 0 NOT NULL, - prune_freq INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_forums ADD PRIMARY KEY (forum_id);; - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums(left_id, right_id);; -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums(forum_last_post_id);; - -CREATE GENERATOR phpbb_forums_gen;; -SET GENERATOR phpbb_forums_gen TO 0;; - -CREATE TRIGGER t_phpbb_forums FOR phpbb_forums -BEFORE INSERT -AS -BEGIN - NEW.forum_id = GEN_ID(phpbb_forums_gen, 1); -END;; - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_forums_access ADD PRIMARY KEY (forum_id, user_id, session_id);; - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_forums_track ADD PRIMARY KEY (user_id, forum_id);; - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch(forum_id);; -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch(user_id);; -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch(notify_status);; - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id INTEGER NOT NULL, - group_type INTEGER DEFAULT 1 NOT NULL, - group_founder_manage INTEGER DEFAULT 0 NOT NULL, - group_skip_auth INTEGER DEFAULT 0 NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_desc_options INTEGER DEFAULT 7 NOT NULL, - group_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_display INTEGER DEFAULT 0 NOT NULL, - group_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_avatar_type INTEGER DEFAULT 0 NOT NULL, - group_avatar_width INTEGER DEFAULT 0 NOT NULL, - group_avatar_height INTEGER DEFAULT 0 NOT NULL, - group_rank INTEGER DEFAULT 0 NOT NULL, - group_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_sig_chars INTEGER DEFAULT 0 NOT NULL, - group_receive_pm INTEGER DEFAULT 0 NOT NULL, - group_message_limit INTEGER DEFAULT 0 NOT NULL, - group_max_recipients INTEGER DEFAULT 0 NOT NULL, - group_legend INTEGER DEFAULT 0 NOT NULL, - group_teampage INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups(group_legend, group_name);; - -CREATE GENERATOR phpbb_groups_gen;; -SET GENERATOR phpbb_groups_gen TO 0;; - -CREATE TRIGGER t_phpbb_groups FOR phpbb_groups -BEFORE INSERT -AS -BEGIN - NEW.group_id = GEN_ID(phpbb_groups_gen, 1); -END;; - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id INTEGER NOT NULL, - icons_url VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - icons_width INTEGER DEFAULT 0 NOT NULL, - icons_height INTEGER DEFAULT 0 NOT NULL, - icons_order INTEGER DEFAULT 0 NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_icons ADD PRIMARY KEY (icons_id);; - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons(display_on_posting);; - -CREATE GENERATOR phpbb_icons_gen;; -SET GENERATOR phpbb_icons_gen TO 0;; - -CREATE TRIGGER t_phpbb_icons FOR phpbb_icons -BEFORE INSERT -AS -BEGIN - NEW.icons_id = GEN_ID(phpbb_icons_gen, 1); -END;; - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id INTEGER NOT NULL, - lang_iso VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - lang_dir VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - lang_english_name VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_local_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_author VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_lang ADD PRIMARY KEY (lang_id);; - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang(lang_iso);; - -CREATE GENERATOR phpbb_lang_gen;; -SET GENERATOR phpbb_lang_gen TO 0;; - -CREATE TRIGGER t_phpbb_lang FOR phpbb_lang -BEFORE INSERT -AS -BEGIN - NEW.lang_id = GEN_ID(phpbb_lang_gen, 1); -END;; - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id INTEGER NOT NULL, - log_type INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - reportee_id INTEGER DEFAULT 0 NOT NULL, - log_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - log_time INTEGER DEFAULT 0 NOT NULL, - log_operation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - log_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_log ADD PRIMARY KEY (log_id);; - -CREATE INDEX phpbb_log_log_type ON phpbb_log(log_type);; -CREATE INDEX phpbb_log_log_time ON phpbb_log(log_time);; -CREATE INDEX phpbb_log_forum_id ON phpbb_log(forum_id);; -CREATE INDEX phpbb_log_topic_id ON phpbb_log(topic_id);; -CREATE INDEX phpbb_log_reportee_id ON phpbb_log(reportee_id);; -CREATE INDEX phpbb_log_user_id ON phpbb_log(user_id);; - -CREATE GENERATOR phpbb_log_gen;; -SET GENERATOR phpbb_log_gen TO 0;; - -CREATE TRIGGER t_phpbb_log FOR phpbb_log -BEFORE INSERT -AS -BEGIN - NEW.log_id = GEN_ID(phpbb_log_gen, 1); -END;; - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_time INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE, - username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE -);; - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);; -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);; -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);; -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);; - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - group_id INTEGER DEFAULT 0 NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - display_on_index INTEGER DEFAULT 1 NOT NULL -);; - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache(display_on_index);; -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache(forum_id);; - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id INTEGER NOT NULL, - module_enabled INTEGER DEFAULT 1 NOT NULL, - module_display INTEGER DEFAULT 1 NOT NULL, - module_basename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_class VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - parent_id INTEGER DEFAULT 0 NOT NULL, - left_id INTEGER DEFAULT 0 NOT NULL, - right_id INTEGER DEFAULT 0 NOT NULL, - module_langname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_mode VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_auth VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_modules ADD PRIMARY KEY (module_id);; - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules(left_id, right_id);; -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules(module_enabled);; -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules(module_class, left_id);; - -CREATE GENERATOR phpbb_modules_gen;; -SET GENERATOR phpbb_modules_gen TO 0;; - -CREATE TRIGGER t_phpbb_modules FOR phpbb_modules -BEFORE INSERT -AS -BEGIN - NEW.module_id = GEN_ID(phpbb_modules_gen, 1); -END;; - - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - poll_option_total INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options(poll_option_id);; -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options(topic_id);; - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_id INTEGER DEFAULT 0 NOT NULL, - vote_user_id INTEGER DEFAULT 0 NOT NULL, - vote_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes(topic_id);; -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes(vote_user_id);; -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes(vote_user_ip);; - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INTEGER NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - poster_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - poster_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_time INTEGER DEFAULT 0 NOT NULL, - post_approved INTEGER DEFAULT 1 NOT NULL, - post_reported INTEGER DEFAULT 0 NOT NULL, - enable_bbcode INTEGER DEFAULT 1 NOT NULL, - enable_smilies INTEGER DEFAULT 1 NOT NULL, - enable_magic_url INTEGER DEFAULT 1 NOT NULL, - enable_sig INTEGER DEFAULT 1 NOT NULL, - post_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - post_checksum VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_postcount INTEGER DEFAULT 1 NOT NULL, - post_edit_time INTEGER DEFAULT 0 NOT NULL, - post_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_edit_user INTEGER DEFAULT 0 NOT NULL, - post_edit_count INTEGER DEFAULT 0 NOT NULL, - post_edit_locked INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_posts ADD PRIMARY KEY (post_id);; - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts(forum_id);; -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);; -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);; -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);; -CREATE INDEX phpbb_posts_post_approved ON phpbb_posts(post_approved);; -CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);; -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);; - -CREATE GENERATOR phpbb_posts_gen;; -SET GENERATOR phpbb_posts_gen TO 0;; - -CREATE TRIGGER t_phpbb_posts FOR phpbb_posts -BEFORE INSERT -AS -BEGIN - NEW.post_id = GEN_ID(phpbb_posts_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id INTEGER NOT NULL, - root_level INTEGER DEFAULT 0 NOT NULL, - author_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - author_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - message_time INTEGER DEFAULT 0 NOT NULL, - enable_bbcode INTEGER DEFAULT 1 NOT NULL, - enable_smilies INTEGER DEFAULT 1 NOT NULL, - enable_magic_url INTEGER DEFAULT 1 NOT NULL, - enable_sig INTEGER DEFAULT 1 NOT NULL, - message_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - message_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - message_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - message_edit_user INTEGER DEFAULT 0 NOT NULL, - message_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - message_edit_time INTEGER DEFAULT 0 NOT NULL, - message_edit_count INTEGER DEFAULT 0 NOT NULL, - to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - message_reported INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);; - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs(author_ip);; -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs(message_time);; -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs(author_id);; -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs(root_level);; - -CREATE GENERATOR phpbb_privmsgs_gen;; -SET GENERATOR phpbb_privmsgs_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs FOR phpbb_privmsgs -BEFORE INSERT -AS -BEGIN - NEW.msg_id = GEN_ID(phpbb_privmsgs_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - folder_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - pm_count INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs_folder ADD PRIMARY KEY (folder_id);; - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder(user_id);; - -CREATE GENERATOR phpbb_privmsgs_folder_gen;; -SET GENERATOR phpbb_privmsgs_folder_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs_folder FOR phpbb_privmsgs_folder -BEFORE INSERT -AS -BEGIN - NEW.folder_id = GEN_ID(phpbb_privmsgs_folder_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - rule_check INTEGER DEFAULT 0 NOT NULL, - rule_connection INTEGER DEFAULT 0 NOT NULL, - rule_string VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - rule_user_id INTEGER DEFAULT 0 NOT NULL, - rule_group_id INTEGER DEFAULT 0 NOT NULL, - rule_action INTEGER DEFAULT 0 NOT NULL, - rule_folder_id INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs_rules ADD PRIMARY KEY (rule_id);; - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules(user_id);; - -CREATE GENERATOR phpbb_privmsgs_rules_gen;; -SET GENERATOR phpbb_privmsgs_rules_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs_rules FOR phpbb_privmsgs_rules -BEFORE INSERT -AS -BEGIN - NEW.rule_id = GEN_ID(phpbb_privmsgs_rules_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - author_id INTEGER DEFAULT 0 NOT NULL, - pm_deleted INTEGER DEFAULT 0 NOT NULL, - pm_new INTEGER DEFAULT 1 NOT NULL, - pm_unread INTEGER DEFAULT 1 NOT NULL, - pm_replied INTEGER DEFAULT 0 NOT NULL, - pm_marked INTEGER DEFAULT 0 NOT NULL, - pm_forwarded INTEGER DEFAULT 0 NOT NULL, - folder_id INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to(msg_id);; -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to(author_id);; -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to(user_id, folder_id);; - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id INTEGER NOT NULL, - field_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_type INTEGER DEFAULT 0 NOT NULL, - field_ident VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_length VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_minlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_maxlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_novalue VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_required INTEGER DEFAULT 0 NOT NULL, - field_show_novalue INTEGER DEFAULT 0 NOT NULL, - field_show_on_reg INTEGER DEFAULT 0 NOT NULL, - field_show_on_pm INTEGER DEFAULT 0 NOT NULL, - field_show_on_vt INTEGER DEFAULT 0 NOT NULL, - field_show_profile INTEGER DEFAULT 0 NOT NULL, - field_hide INTEGER DEFAULT 0 NOT NULL, - field_no_view INTEGER DEFAULT 0 NOT NULL, - field_active INTEGER DEFAULT 0 NOT NULL, - field_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_profile_fields ADD PRIMARY KEY (field_id);; - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields(field_type);; -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields(field_order);; - -CREATE GENERATOR phpbb_profile_fields_gen;; -SET GENERATOR phpbb_profile_fields_gen TO 0;; - -CREATE TRIGGER t_phpbb_profile_fields FOR phpbb_profile_fields -BEFORE INSERT -AS -BEGIN - NEW.field_id = GEN_ID(phpbb_profile_fields_gen, 1); -END;; - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);; - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id INTEGER DEFAULT 0 NOT NULL, - lang_id INTEGER DEFAULT 0 NOT NULL, - option_id INTEGER DEFAULT 0 NOT NULL, - field_type INTEGER DEFAULT 0 NOT NULL, - lang_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_profile_fields_lang ADD PRIMARY KEY (field_id, lang_id, option_id);; - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id INTEGER DEFAULT 0 NOT NULL, - lang_id INTEGER DEFAULT 0 NOT NULL, - lang_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_explain BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - lang_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_profile_lang ADD PRIMARY KEY (field_id, lang_id);; - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id INTEGER NOT NULL, - rank_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - rank_min INTEGER DEFAULT 0 NOT NULL, - rank_special INTEGER DEFAULT 0 NOT NULL, - rank_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_ranks ADD PRIMARY KEY (rank_id);; - - -CREATE GENERATOR phpbb_ranks_gen;; -SET GENERATOR phpbb_ranks_gen TO 0;; - -CREATE TRIGGER t_phpbb_ranks FOR phpbb_ranks -BEFORE INSERT -AS -BEGIN - NEW.rank_id = GEN_ID(phpbb_ranks_gen, 1); -END;; - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id INTEGER NOT NULL, - reason_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - pm_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - report_closed INTEGER DEFAULT 0 NOT NULL, - report_time INTEGER DEFAULT 0 NOT NULL, - report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);; -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);; - -CREATE GENERATOR phpbb_reports_gen;; -SET GENERATOR phpbb_reports_gen TO 0;; - -CREATE TRIGGER t_phpbb_reports FOR phpbb_reports -BEFORE INSERT -AS -BEGIN - NEW.report_id = GEN_ID(phpbb_reports_gen, 1); -END;; - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER NOT NULL, - reason_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - reason_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reason_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_reports_reasons ADD PRIMARY KEY (reason_id);; - - -CREATE GENERATOR phpbb_reports_reasons_gen;; -SET GENERATOR phpbb_reports_reasons_gen TO 0;; - -CREATE TRIGGER t_phpbb_reports_reasons FOR phpbb_reports_reasons -BEFORE INSERT -AS -BEGIN - NEW.reason_id = GEN_ID(phpbb_reports_reasons_gen, 1); -END;; - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - search_time INTEGER DEFAULT 0 NOT NULL, - search_keywords BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - search_authors BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);; - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id INTEGER NOT NULL, - word_text VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - word_common INTEGER DEFAULT 0 NOT NULL, - word_count INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_search_wordlist ADD PRIMARY KEY (word_id);; - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist(word_text);; -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist(word_count);; - -CREATE GENERATOR phpbb_search_wordlist_gen;; -SET GENERATOR phpbb_search_wordlist_gen TO 0;; - -CREATE TRIGGER t_phpbb_search_wordlist FOR phpbb_search_wordlist -BEFORE INSERT -AS -BEGIN - NEW.word_id = GEN_ID(phpbb_search_wordlist_gen, 1); -END;; - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INTEGER DEFAULT 0 NOT NULL, - word_id INTEGER DEFAULT 0 NOT NULL, - title_match INTEGER DEFAULT 0 NOT NULL -);; - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch(word_id, post_id, title_match);; -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch(word_id);; -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch(post_id);; - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_user_id INTEGER DEFAULT 0 NOT NULL, - session_forum_id INTEGER DEFAULT 0 NOT NULL, - session_last_visit INTEGER DEFAULT 0 NOT NULL, - session_start INTEGER DEFAULT 0 NOT NULL, - session_time INTEGER DEFAULT 0 NOT NULL, - session_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_page VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - session_viewonline INTEGER DEFAULT 1 NOT NULL, - session_autologin INTEGER DEFAULT 0 NOT NULL, - session_admin INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sessions ADD PRIMARY KEY (session_id);; - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions(session_time);; -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions(session_user_id);; -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions(session_forum_id);; - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - last_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - last_login INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sessions_keys ADD PRIMARY KEY (key_id, user_id);; - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys(last_login);; - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id INTEGER NOT NULL, - site_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - site_hostname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - ip_exclude INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sitelist ADD PRIMARY KEY (site_id);; - - -CREATE GENERATOR phpbb_sitelist_gen;; -SET GENERATOR phpbb_sitelist_gen TO 0;; - -CREATE TRIGGER t_phpbb_sitelist FOR phpbb_sitelist -BEFORE INSERT -AS -BEGIN - NEW.site_id = GEN_ID(phpbb_sitelist_gen, 1); -END;; - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id INTEGER NOT NULL, - code VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - emotion VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - smiley_url VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, - smiley_width INTEGER DEFAULT 0 NOT NULL, - smiley_height INTEGER DEFAULT 0 NOT NULL, - smiley_order INTEGER DEFAULT 0 NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_smilies ADD PRIMARY KEY (smiley_id);; - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies(display_on_posting);; - -CREATE GENERATOR phpbb_smilies_gen;; -SET GENERATOR phpbb_smilies_gen TO 0;; - -CREATE TRIGGER t_phpbb_smilies FOR phpbb_smilies -BEFORE INSERT -AS -BEGIN - NEW.smiley_id = GEN_ID(phpbb_smilies_gen, 1); -END;; - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id INTEGER NOT NULL, - style_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - style_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - style_active INTEGER DEFAULT 1 NOT NULL, - style_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT 'kNg=' NOT NULL, - style_parent_id INTEGER DEFAULT 0 NOT NULL, - style_parent_tree BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_styles ADD PRIMARY KEY (style_id);; - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles(style_name);; - -CREATE GENERATOR phpbb_styles_gen;; -SET GENERATOR phpbb_styles_gen TO 0;; - -CREATE TRIGGER t_phpbb_styles FOR phpbb_styles -BEFORE INSERT -AS -BEGIN - NEW.style_id = GEN_ID(phpbb_styles_gen, 1); -END;; - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INTEGER NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - topic_attachment INTEGER DEFAULT 0 NOT NULL, - topic_approved INTEGER DEFAULT 1 NOT NULL, - topic_reported INTEGER DEFAULT 0 NOT NULL, - topic_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_poster INTEGER DEFAULT 0 NOT NULL, - topic_time INTEGER DEFAULT 0 NOT NULL, - topic_time_limit INTEGER DEFAULT 0 NOT NULL, - topic_views INTEGER DEFAULT 0 NOT NULL, - topic_replies INTEGER DEFAULT 0 NOT NULL, - topic_replies_real INTEGER DEFAULT 0 NOT NULL, - topic_status INTEGER DEFAULT 0 NOT NULL, - topic_type INTEGER DEFAULT 0 NOT NULL, - topic_first_post_id INTEGER DEFAULT 0 NOT NULL, - topic_first_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_first_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - topic_last_post_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - topic_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_last_post_time INTEGER DEFAULT 0 NOT NULL, - topic_last_view_time INTEGER DEFAULT 0 NOT NULL, - topic_moved_id INTEGER DEFAULT 0 NOT NULL, - topic_bumped INTEGER DEFAULT 0 NOT NULL, - topic_bumper INTEGER DEFAULT 0 NOT NULL, - poll_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - poll_start INTEGER DEFAULT 0 NOT NULL, - poll_length INTEGER DEFAULT 0 NOT NULL, - poll_max_options INTEGER DEFAULT 1 NOT NULL, - poll_last_vote INTEGER DEFAULT 0 NOT NULL, - poll_vote_change INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);; - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);; -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);; -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics(topic_last_post_time);; -CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics(topic_approved);; -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_approved, topic_last_post_id);; -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics(forum_id, topic_last_post_time, topic_moved_id);; - -CREATE GENERATOR phpbb_topics_gen;; -SET GENERATOR phpbb_topics_gen TO 0;; - -CREATE TRIGGER t_phpbb_topics FOR phpbb_topics -BEFORE INSERT -AS -BEGIN - NEW.topic_id = GEN_ID(phpbb_topics_gen, 1); -END;; - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics_track ADD PRIMARY KEY (user_id, topic_id);; - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track(topic_id);; -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track(forum_id);; - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - topic_posted INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics_posted ADD PRIMARY KEY (user_id, topic_id);; - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - group_leader INTEGER DEFAULT 0 NOT NULL, - user_pending INTEGER DEFAULT 1 NOT NULL -);; - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group(group_id);; -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group(user_id);; -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group(group_leader);; - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INTEGER NOT NULL, - user_type INTEGER DEFAULT 0 NOT NULL, - group_id INTEGER DEFAULT 3 NOT NULL, - user_permissions BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - user_perm_from INTEGER DEFAULT 0 NOT NULL, - user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_regdate INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_passchg INTEGER DEFAULT 0 NOT NULL, - user_pass_convert INTEGER DEFAULT 0 NOT NULL, - user_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_email_hash DOUBLE PRECISION DEFAULT 0 NOT NULL, - user_birthday VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_lastvisit INTEGER DEFAULT 0 NOT NULL, - user_lastmark INTEGER DEFAULT 0 NOT NULL, - user_lastpost_time INTEGER DEFAULT 0 NOT NULL, - user_lastpage VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_last_confirm_key VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_last_search INTEGER DEFAULT 0 NOT NULL, - user_warnings INTEGER DEFAULT 0 NOT NULL, - user_last_warning INTEGER DEFAULT 0 NOT NULL, - user_login_attempts INTEGER DEFAULT 0 NOT NULL, - user_inactive_reason INTEGER DEFAULT 0 NOT NULL, - user_inactive_time INTEGER DEFAULT 0 NOT NULL, - user_posts INTEGER DEFAULT 0 NOT NULL, - user_lang VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_timezone VARCHAR(100) CHARACTER SET NONE DEFAULT 'UTC' NOT NULL, - user_dateformat VARCHAR(30) CHARACTER SET UTF8 DEFAULT 'd M Y H:i' NOT NULL COLLATE UNICODE, - user_style INTEGER DEFAULT 0 NOT NULL, - user_rank INTEGER DEFAULT 0 NOT NULL, - user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_new_privmsg INTEGER DEFAULT 0 NOT NULL, - user_unread_privmsg INTEGER DEFAULT 0 NOT NULL, - user_last_privmsg INTEGER DEFAULT 0 NOT NULL, - user_message_rules INTEGER DEFAULT 0 NOT NULL, - user_full_folder INTEGER DEFAULT -3 NOT NULL, - user_emailtime INTEGER DEFAULT 0 NOT NULL, - user_topic_show_days INTEGER DEFAULT 0 NOT NULL, - user_topic_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, - user_topic_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'd' NOT NULL, - user_post_show_days INTEGER DEFAULT 0 NOT NULL, - user_post_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, - user_post_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'a' NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - user_notify_pm INTEGER DEFAULT 1 NOT NULL, - user_notify_type INTEGER DEFAULT 0 NOT NULL, - user_allow_pm INTEGER DEFAULT 1 NOT NULL, - user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, - user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, - user_allow_massemail INTEGER DEFAULT 1 NOT NULL, - user_options INTEGER DEFAULT 230271 NOT NULL, - user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_avatar_type INTEGER DEFAULT 0 NOT NULL, - user_avatar_width INTEGER DEFAULT 0 NOT NULL, - user_avatar_height INTEGER DEFAULT 0 NOT NULL, - user_sig BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - user_sig_bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_from VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_icq VARCHAR(15) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_aim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_yim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_occ BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_new INTEGER DEFAULT 1 NOT NULL, - user_reminded INTEGER DEFAULT 0 NOT NULL, - user_reminded_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; -CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; - -CREATE GENERATOR phpbb_users_gen;; -SET GENERATOR phpbb_users_gen TO 0;; - -CREATE TRIGGER t_phpbb_users FOR phpbb_users -BEFORE INSERT -AS -BEGIN - NEW.user_id = GEN_ID(phpbb_users_gen, 1); -END;; - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - log_id INTEGER DEFAULT 0 NOT NULL, - warning_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_warnings ADD PRIMARY KEY (warning_id);; - - -CREATE GENERATOR phpbb_warnings_gen;; -SET GENERATOR phpbb_warnings_gen TO 0;; - -CREATE TRIGGER t_phpbb_warnings FOR phpbb_warnings -BEFORE INSERT -AS -BEGIN - NEW.warning_id = GEN_ID(phpbb_warnings_gen, 1); -END;; - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id INTEGER NOT NULL, - word VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - replacement VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_words ADD PRIMARY KEY (word_id);; - - -CREATE GENERATOR phpbb_words_gen;; -SET GENERATOR phpbb_words_gen TO 0;; - -CREATE TRIGGER t_phpbb_words FOR phpbb_words -BEFORE INSERT -AS -BEGIN - NEW.word_id = GEN_ID(phpbb_words_gen, 1); -END;; - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INTEGER DEFAULT 0 NOT NULL, - zebra_id INTEGER DEFAULT 0 NOT NULL, - friend INTEGER DEFAULT 0 NOT NULL, - foe INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_zebra ADD PRIMARY KEY (user_id, zebra_id);; - - +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. + +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id INTEGER NOT NULL, + post_msg_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + in_message INTEGER DEFAULT 0 NOT NULL, + poster_id INTEGER DEFAULT 0 NOT NULL, + is_orphan INTEGER DEFAULT 1 NOT NULL, + physical_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + real_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + download_count INTEGER DEFAULT 0 NOT NULL, + attach_comment BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + mimetype VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + filesize INTEGER DEFAULT 0 NOT NULL, + filetime INTEGER DEFAULT 0 NOT NULL, + thumbnail INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_attachments ADD PRIMARY KEY (attach_id);; + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments(filetime);; +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments(post_msg_id);; +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments(topic_id);; +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments(poster_id);; +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments(is_orphan);; + +CREATE GENERATOR phpbb_attachments_gen;; +SET GENERATOR phpbb_attachments_gen TO 0;; + +CREATE TRIGGER t_phpbb_attachments FOR phpbb_attachments +BEFORE INSERT +AS +BEGIN + NEW.attach_id = GEN_ID(phpbb_attachments_gen, 1); +END;; + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_role_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups(group_id);; +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups(auth_option_id);; +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups(auth_role_id);; + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id INTEGER NOT NULL, + auth_option VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, + is_global INTEGER DEFAULT 0 NOT NULL, + is_local INTEGER DEFAULT 0 NOT NULL, + founder_only INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_options ADD PRIMARY KEY (auth_option_id);; + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; + +CREATE GENERATOR phpbb_acl_options_gen;; +SET GENERATOR phpbb_acl_options_gen TO 0;; + +CREATE TRIGGER t_phpbb_acl_options FOR phpbb_acl_options +BEFORE INSERT +AS +BEGIN + NEW.auth_option_id = GEN_ID(phpbb_acl_options_gen, 1); +END;; + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id INTEGER NOT NULL, + role_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + role_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + role_type VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + role_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_roles ADD PRIMARY KEY (role_id);; + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles(role_type);; +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles(role_order);; + +CREATE GENERATOR phpbb_acl_roles_gen;; +SET GENERATOR phpbb_acl_roles_gen TO 0;; + +CREATE TRIGGER t_phpbb_acl_roles FOR phpbb_acl_roles +BEFORE INSERT +AS +BEGIN + NEW.role_id = GEN_ID(phpbb_acl_roles_gen, 1); +END;; + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_acl_roles_data ADD PRIMARY KEY (role_id, auth_option_id);; + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data(auth_option_id);; + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + auth_option_id INTEGER DEFAULT 0 NOT NULL, + auth_role_id INTEGER DEFAULT 0 NOT NULL, + auth_setting INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);; +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);; +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);; + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id INTEGER NOT NULL, + ban_userid INTEGER DEFAULT 0 NOT NULL, + ban_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + ban_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + ban_start INTEGER DEFAULT 0 NOT NULL, + ban_end INTEGER DEFAULT 0 NOT NULL, + ban_exclude INTEGER DEFAULT 0 NOT NULL, + ban_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + ban_give_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_banlist ADD PRIMARY KEY (ban_id);; + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist(ban_end);; +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist(ban_userid, ban_exclude);; +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist(ban_email, ban_exclude);; +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist(ban_ip, ban_exclude);; + +CREATE GENERATOR phpbb_banlist_gen;; +SET GENERATOR phpbb_banlist_gen TO 0;; + +CREATE TRIGGER t_phpbb_banlist FOR phpbb_banlist +BEFORE INSERT +AS +BEGIN + NEW.ban_id = GEN_ID(phpbb_banlist_gen, 1); +END;; + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id INTEGER DEFAULT 0 NOT NULL, + bbcode_tag VARCHAR(16) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_helpline VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + display_on_posting INTEGER DEFAULT 0 NOT NULL, + bbcode_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + bbcode_tpl BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + first_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + first_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + second_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + second_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_bbcodes ADD PRIMARY KEY (bbcode_id);; + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes(display_on_posting);; + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_bookmarks ADD PRIMARY KEY (topic_id, user_id);; + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id INTEGER NOT NULL, + bot_active INTEGER DEFAULT 1 NOT NULL, + bot_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_id INTEGER DEFAULT 0 NOT NULL, + bot_agent VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bot_ip VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_bots ADD PRIMARY KEY (bot_id);; + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots(bot_active);; + +CREATE GENERATOR phpbb_bots_gen;; +SET GENERATOR phpbb_bots_gen TO 0;; + +CREATE TRIGGER t_phpbb_bots FOR phpbb_bots +BEFORE INSERT +AS +BEGIN + NEW.bot_id = GEN_ID(phpbb_bots_gen, 1); +END;; + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + config_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + is_dynamic INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_config ADD PRIMARY KEY (config_name);; + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config(is_dynamic);; + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + confirm_type INTEGER DEFAULT 0 NOT NULL, + code VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + seed INTEGER DEFAULT 0 NOT NULL, + attempts INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_confirm ADD PRIMARY KEY (session_id, confirm_id);; + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm(confirm_type);; + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id INTEGER NOT NULL, + disallow_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_disallow ADD PRIMARY KEY (disallow_id);; + + +CREATE GENERATOR phpbb_disallow_gen;; +SET GENERATOR phpbb_disallow_gen TO 0;; + +CREATE TRIGGER t_phpbb_disallow FOR phpbb_disallow +BEFORE INSERT +AS +BEGIN + NEW.disallow_id = GEN_ID(phpbb_disallow_gen, 1); +END;; + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + save_time INTEGER DEFAULT 0 NOT NULL, + draft_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + draft_message BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_drafts ADD PRIMARY KEY (draft_id);; + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts(save_time);; + +CREATE GENERATOR phpbb_drafts_gen;; +SET GENERATOR phpbb_drafts_gen TO 0;; + +CREATE TRIGGER t_phpbb_drafts FOR phpbb_drafts +BEFORE INSERT +AS +BEGIN + NEW.draft_id = GEN_ID(phpbb_drafts_gen, 1); +END;; + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + ext_active INTEGER DEFAULT 0 NOT NULL, + ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id INTEGER NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL, + extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_extensions ADD PRIMARY KEY (extension_id);; + + +CREATE GENERATOR phpbb_extensions_gen;; +SET GENERATOR phpbb_extensions_gen TO 0;; + +CREATE TRIGGER t_phpbb_extensions FOR phpbb_extensions +BEFORE INSERT +AS +BEGIN + NEW.extension_id = GEN_ID(phpbb_extensions_gen, 1); +END;; + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id INTEGER NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + cat_id INTEGER DEFAULT 0 NOT NULL, + allow_group INTEGER DEFAULT 0 NOT NULL, + download_mode INTEGER DEFAULT 1 NOT NULL, + upload_icon VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + max_filesize INTEGER DEFAULT 0 NOT NULL, + allowed_forums BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + allow_in_pm INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_extension_groups ADD PRIMARY KEY (group_id);; + + +CREATE GENERATOR phpbb_extension_groups_gen;; +SET GENERATOR phpbb_extension_groups_gen TO 0;; + +CREATE TRIGGER t_phpbb_extension_groups FOR phpbb_extension_groups +BEFORE INSERT +AS +BEGIN + NEW.group_id = GEN_ID(phpbb_extension_groups_gen, 1); +END;; + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id INTEGER NOT NULL, + parent_id INTEGER DEFAULT 0 NOT NULL, + left_id INTEGER DEFAULT 0 NOT NULL, + right_id INTEGER DEFAULT 0 NOT NULL, + forum_parents BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + forum_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_desc_options INTEGER DEFAULT 7 NOT NULL, + forum_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_style INTEGER DEFAULT 0 NOT NULL, + forum_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_rules BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + forum_rules_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_rules_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_rules_options INTEGER DEFAULT 7 NOT NULL, + forum_rules_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, + forum_type INTEGER DEFAULT 0 NOT NULL, + forum_status INTEGER DEFAULT 0 NOT NULL, + forum_posts INTEGER DEFAULT 0 NOT NULL, + forum_topics INTEGER DEFAULT 0 NOT NULL, + forum_topics_real INTEGER DEFAULT 0 NOT NULL, + forum_last_post_id INTEGER DEFAULT 0 NOT NULL, + forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, + forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_last_post_time INTEGER DEFAULT 0 NOT NULL, + forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + forum_flags INTEGER DEFAULT 32 NOT NULL, + forum_options INTEGER DEFAULT 0 NOT NULL, + display_subforum_list INTEGER DEFAULT 1 NOT NULL, + display_on_index INTEGER DEFAULT 1 NOT NULL, + enable_indexing INTEGER DEFAULT 1 NOT NULL, + enable_icons INTEGER DEFAULT 1 NOT NULL, + enable_prune INTEGER DEFAULT 0 NOT NULL, + prune_next INTEGER DEFAULT 0 NOT NULL, + prune_days INTEGER DEFAULT 0 NOT NULL, + prune_viewed INTEGER DEFAULT 0 NOT NULL, + prune_freq INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_forums ADD PRIMARY KEY (forum_id);; + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums(left_id, right_id);; +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums(forum_last_post_id);; + +CREATE GENERATOR phpbb_forums_gen;; +SET GENERATOR phpbb_forums_gen TO 0;; + +CREATE TRIGGER t_phpbb_forums FOR phpbb_forums +BEFORE INSERT +AS +BEGIN + NEW.forum_id = GEN_ID(phpbb_forums_gen, 1); +END;; + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_forums_access ADD PRIMARY KEY (forum_id, user_id, session_id);; + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + mark_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_forums_track ADD PRIMARY KEY (user_id, forum_id);; + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + notify_status INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch(forum_id);; +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch(user_id);; +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch(notify_status);; + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id INTEGER NOT NULL, + group_type INTEGER DEFAULT 1 NOT NULL, + group_founder_manage INTEGER DEFAULT 0 NOT NULL, + group_skip_auth INTEGER DEFAULT 0 NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_desc_options INTEGER DEFAULT 7 NOT NULL, + group_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_display INTEGER DEFAULT 0 NOT NULL, + group_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_avatar_type INTEGER DEFAULT 0 NOT NULL, + group_avatar_width INTEGER DEFAULT 0 NOT NULL, + group_avatar_height INTEGER DEFAULT 0 NOT NULL, + group_rank INTEGER DEFAULT 0 NOT NULL, + group_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + group_sig_chars INTEGER DEFAULT 0 NOT NULL, + group_receive_pm INTEGER DEFAULT 0 NOT NULL, + group_message_limit INTEGER DEFAULT 0 NOT NULL, + group_max_recipients INTEGER DEFAULT 0 NOT NULL, + group_legend INTEGER DEFAULT 0 NOT NULL, + group_teampage INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups(group_legend, group_name);; + +CREATE GENERATOR phpbb_groups_gen;; +SET GENERATOR phpbb_groups_gen TO 0;; + +CREATE TRIGGER t_phpbb_groups FOR phpbb_groups +BEFORE INSERT +AS +BEGIN + NEW.group_id = GEN_ID(phpbb_groups_gen, 1); +END;; + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id INTEGER NOT NULL, + icons_url VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + icons_width INTEGER DEFAULT 0 NOT NULL, + icons_height INTEGER DEFAULT 0 NOT NULL, + icons_order INTEGER DEFAULT 0 NOT NULL, + display_on_posting INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_icons ADD PRIMARY KEY (icons_id);; + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons(display_on_posting);; + +CREATE GENERATOR phpbb_icons_gen;; +SET GENERATOR phpbb_icons_gen TO 0;; + +CREATE TRIGGER t_phpbb_icons FOR phpbb_icons +BEFORE INSERT +AS +BEGIN + NEW.icons_id = GEN_ID(phpbb_icons_gen, 1); +END;; + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id INTEGER NOT NULL, + lang_iso VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + lang_dir VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + lang_english_name VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_local_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_author VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_lang ADD PRIMARY KEY (lang_id);; + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang(lang_iso);; + +CREATE GENERATOR phpbb_lang_gen;; +SET GENERATOR phpbb_lang_gen TO 0;; + +CREATE TRIGGER t_phpbb_lang FOR phpbb_lang +BEFORE INSERT +AS +BEGIN + NEW.lang_id = GEN_ID(phpbb_lang_gen, 1); +END;; + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id INTEGER NOT NULL, + log_type INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + reportee_id INTEGER DEFAULT 0 NOT NULL, + log_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + log_time INTEGER DEFAULT 0 NOT NULL, + log_operation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + log_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_log ADD PRIMARY KEY (log_id);; + +CREATE INDEX phpbb_log_log_type ON phpbb_log(log_type);; +CREATE INDEX phpbb_log_log_time ON phpbb_log(log_time);; +CREATE INDEX phpbb_log_forum_id ON phpbb_log(forum_id);; +CREATE INDEX phpbb_log_topic_id ON phpbb_log(topic_id);; +CREATE INDEX phpbb_log_reportee_id ON phpbb_log(reportee_id);; +CREATE INDEX phpbb_log_user_id ON phpbb_log(user_id);; + +CREATE GENERATOR phpbb_log_gen;; +SET GENERATOR phpbb_log_gen TO 0;; + +CREATE TRIGGER t_phpbb_log FOR phpbb_log +BEFORE INSERT +AS +BEGIN + NEW.log_id = GEN_ID(phpbb_log_gen, 1); +END;; + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + attempt_time INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE, + username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE +);; + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);; +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);; +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);; +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);; + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + group_id INTEGER DEFAULT 0 NOT NULL, + group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + display_on_index INTEGER DEFAULT 1 NOT NULL +);; + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache(display_on_index);; +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache(forum_id);; + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id INTEGER NOT NULL, + module_enabled INTEGER DEFAULT 1 NOT NULL, + module_display INTEGER DEFAULT 1 NOT NULL, + module_basename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_class VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + parent_id INTEGER DEFAULT 0 NOT NULL, + left_id INTEGER DEFAULT 0 NOT NULL, + right_id INTEGER DEFAULT 0 NOT NULL, + module_langname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_mode VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + module_auth VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_modules ADD PRIMARY KEY (module_id);; + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules(left_id, right_id);; +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules(module_enabled);; +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules(module_class, left_id);; + +CREATE GENERATOR phpbb_modules_gen;; +SET GENERATOR phpbb_modules_gen TO 0;; + +CREATE TRIGGER t_phpbb_modules FOR phpbb_modules +BEFORE INSERT +AS +BEGIN + NEW.module_id = GEN_ID(phpbb_modules_gen, 1); +END;; + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + poll_option_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + poll_option_total INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options(poll_option_id);; +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options(topic_id);; + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id INTEGER DEFAULT 0 NOT NULL, + poll_option_id INTEGER DEFAULT 0 NOT NULL, + vote_user_id INTEGER DEFAULT 0 NOT NULL, + vote_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes(topic_id);; +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes(vote_user_id);; +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes(vote_user_ip);; + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id INTEGER NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + poster_id INTEGER DEFAULT 0 NOT NULL, + icon_id INTEGER DEFAULT 0 NOT NULL, + poster_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_time INTEGER DEFAULT 0 NOT NULL, + post_approved INTEGER DEFAULT 1 NOT NULL, + post_reported INTEGER DEFAULT 0 NOT NULL, + enable_bbcode INTEGER DEFAULT 1 NOT NULL, + enable_smilies INTEGER DEFAULT 1 NOT NULL, + enable_magic_url INTEGER DEFAULT 1 NOT NULL, + enable_sig INTEGER DEFAULT 1 NOT NULL, + post_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + post_checksum VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_attachment INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + post_postcount INTEGER DEFAULT 1 NOT NULL, + post_edit_time INTEGER DEFAULT 0 NOT NULL, + post_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + post_edit_user INTEGER DEFAULT 0 NOT NULL, + post_edit_count INTEGER DEFAULT 0 NOT NULL, + post_edit_locked INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_posts ADD PRIMARY KEY (post_id);; + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts(forum_id);; +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);; +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);; +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);; +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts(post_approved);; +CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);; +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);; + +CREATE GENERATOR phpbb_posts_gen;; +SET GENERATOR phpbb_posts_gen TO 0;; + +CREATE TRIGGER t_phpbb_posts FOR phpbb_posts +BEFORE INSERT +AS +BEGIN + NEW.post_id = GEN_ID(phpbb_posts_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id INTEGER NOT NULL, + root_level INTEGER DEFAULT 0 NOT NULL, + author_id INTEGER DEFAULT 0 NOT NULL, + icon_id INTEGER DEFAULT 0 NOT NULL, + author_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + message_time INTEGER DEFAULT 0 NOT NULL, + enable_bbcode INTEGER DEFAULT 1 NOT NULL, + enable_smilies INTEGER DEFAULT 1 NOT NULL, + enable_magic_url INTEGER DEFAULT 1 NOT NULL, + enable_sig INTEGER DEFAULT 1 NOT NULL, + message_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + message_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + message_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + message_edit_user INTEGER DEFAULT 0 NOT NULL, + message_attachment INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + message_edit_time INTEGER DEFAULT 0 NOT NULL, + message_edit_count INTEGER DEFAULT 0 NOT NULL, + to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + message_reported INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);; + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs(author_ip);; +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs(message_time);; +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs(author_id);; +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs(root_level);; + +CREATE GENERATOR phpbb_privmsgs_gen;; +SET GENERATOR phpbb_privmsgs_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs FOR phpbb_privmsgs +BEFORE INSERT +AS +BEGIN + NEW.msg_id = GEN_ID(phpbb_privmsgs_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + folder_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + pm_count INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs_folder ADD PRIMARY KEY (folder_id);; + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder(user_id);; + +CREATE GENERATOR phpbb_privmsgs_folder_gen;; +SET GENERATOR phpbb_privmsgs_folder_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs_folder FOR phpbb_privmsgs_folder +BEFORE INSERT +AS +BEGIN + NEW.folder_id = GEN_ID(phpbb_privmsgs_folder_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + rule_check INTEGER DEFAULT 0 NOT NULL, + rule_connection INTEGER DEFAULT 0 NOT NULL, + rule_string VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + rule_user_id INTEGER DEFAULT 0 NOT NULL, + rule_group_id INTEGER DEFAULT 0 NOT NULL, + rule_action INTEGER DEFAULT 0 NOT NULL, + rule_folder_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_privmsgs_rules ADD PRIMARY KEY (rule_id);; + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules(user_id);; + +CREATE GENERATOR phpbb_privmsgs_rules_gen;; +SET GENERATOR phpbb_privmsgs_rules_gen TO 0;; + +CREATE TRIGGER t_phpbb_privmsgs_rules FOR phpbb_privmsgs_rules +BEFORE INSERT +AS +BEGIN + NEW.rule_id = GEN_ID(phpbb_privmsgs_rules_gen, 1); +END;; + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + author_id INTEGER DEFAULT 0 NOT NULL, + pm_deleted INTEGER DEFAULT 0 NOT NULL, + pm_new INTEGER DEFAULT 1 NOT NULL, + pm_unread INTEGER DEFAULT 1 NOT NULL, + pm_replied INTEGER DEFAULT 0 NOT NULL, + pm_marked INTEGER DEFAULT 0 NOT NULL, + pm_forwarded INTEGER DEFAULT 0 NOT NULL, + folder_id INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to(msg_id);; +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to(author_id);; +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to(user_id, folder_id);; + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id INTEGER NOT NULL, + field_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_type INTEGER DEFAULT 0 NOT NULL, + field_ident VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_length VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_minlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_maxlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + field_novalue VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + field_required INTEGER DEFAULT 0 NOT NULL, + field_show_novalue INTEGER DEFAULT 0 NOT NULL, + field_show_on_reg INTEGER DEFAULT 0 NOT NULL, + field_show_on_pm INTEGER DEFAULT 0 NOT NULL, + field_show_on_vt INTEGER DEFAULT 0 NOT NULL, + field_show_profile INTEGER DEFAULT 0 NOT NULL, + field_hide INTEGER DEFAULT 0 NOT NULL, + field_no_view INTEGER DEFAULT 0 NOT NULL, + field_active INTEGER DEFAULT 0 NOT NULL, + field_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_profile_fields ADD PRIMARY KEY (field_id);; + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields(field_type);; +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields(field_order);; + +CREATE GENERATOR phpbb_profile_fields_gen;; +SET GENERATOR phpbb_profile_fields_gen TO 0;; + +CREATE TRIGGER t_phpbb_profile_fields FOR phpbb_profile_fields +BEFORE INSERT +AS +BEGIN + NEW.field_id = GEN_ID(phpbb_profile_fields_gen, 1); +END;; + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);; + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id INTEGER DEFAULT 0 NOT NULL, + lang_id INTEGER DEFAULT 0 NOT NULL, + option_id INTEGER DEFAULT 0 NOT NULL, + field_type INTEGER DEFAULT 0 NOT NULL, + lang_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_profile_fields_lang ADD PRIMARY KEY (field_id, lang_id, option_id);; + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id INTEGER DEFAULT 0 NOT NULL, + lang_id INTEGER DEFAULT 0 NOT NULL, + lang_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + lang_explain BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + lang_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_profile_lang ADD PRIMARY KEY (field_id, lang_id);; + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id INTEGER NOT NULL, + rank_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + rank_min INTEGER DEFAULT 0 NOT NULL, + rank_special INTEGER DEFAULT 0 NOT NULL, + rank_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_ranks ADD PRIMARY KEY (rank_id);; + + +CREATE GENERATOR phpbb_ranks_gen;; +SET GENERATOR phpbb_ranks_gen TO 0;; + +CREATE TRIGGER t_phpbb_ranks FOR phpbb_ranks +BEFORE INSERT +AS +BEGIN + NEW.rank_id = GEN_ID(phpbb_ranks_gen, 1); +END;; + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id INTEGER NOT NULL, + reason_id INTEGER DEFAULT 0 NOT NULL, + post_id INTEGER DEFAULT 0 NOT NULL, + pm_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + user_notify INTEGER DEFAULT 0 NOT NULL, + report_closed INTEGER DEFAULT 0 NOT NULL, + report_time INTEGER DEFAULT 0 NOT NULL, + report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);; +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);; + +CREATE GENERATOR phpbb_reports_gen;; +SET GENERATOR phpbb_reports_gen TO 0;; + +CREATE TRIGGER t_phpbb_reports FOR phpbb_reports +BEFORE INSERT +AS +BEGIN + NEW.report_id = GEN_ID(phpbb_reports_gen, 1); +END;; + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id INTEGER NOT NULL, + reason_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + reason_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reason_order INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_reports_reasons ADD PRIMARY KEY (reason_id);; + + +CREATE GENERATOR phpbb_reports_reasons_gen;; +SET GENERATOR phpbb_reports_reasons_gen TO 0;; + +CREATE TRIGGER t_phpbb_reports_reasons FOR phpbb_reports_reasons +BEFORE INSERT +AS +BEGIN + NEW.reason_id = GEN_ID(phpbb_reports_reasons_gen, 1); +END;; + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + search_time INTEGER DEFAULT 0 NOT NULL, + search_keywords BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + search_authors BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);; + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id INTEGER NOT NULL, + word_text VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + word_common INTEGER DEFAULT 0 NOT NULL, + word_count INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_search_wordlist ADD PRIMARY KEY (word_id);; + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist(word_text);; +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist(word_count);; + +CREATE GENERATOR phpbb_search_wordlist_gen;; +SET GENERATOR phpbb_search_wordlist_gen TO 0;; + +CREATE TRIGGER t_phpbb_search_wordlist FOR phpbb_search_wordlist +BEFORE INSERT +AS +BEGIN + NEW.word_id = GEN_ID(phpbb_search_wordlist_gen, 1); +END;; + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id INTEGER DEFAULT 0 NOT NULL, + word_id INTEGER DEFAULT 0 NOT NULL, + title_match INTEGER DEFAULT 0 NOT NULL +);; + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch(word_id, post_id, title_match);; +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch(word_id);; +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch(post_id);; + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_user_id INTEGER DEFAULT 0 NOT NULL, + session_forum_id INTEGER DEFAULT 0 NOT NULL, + session_last_visit INTEGER DEFAULT 0 NOT NULL, + session_start INTEGER DEFAULT 0 NOT NULL, + session_time INTEGER DEFAULT 0 NOT NULL, + session_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + session_page VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + session_viewonline INTEGER DEFAULT 1 NOT NULL, + session_autologin INTEGER DEFAULT 0 NOT NULL, + session_admin INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sessions ADD PRIMARY KEY (session_id);; + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions(session_time);; +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions(session_user_id);; +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions(session_forum_id);; + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + last_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + last_login INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sessions_keys ADD PRIMARY KEY (key_id, user_id);; + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys(last_login);; + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id INTEGER NOT NULL, + site_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + site_hostname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + ip_exclude INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_sitelist ADD PRIMARY KEY (site_id);; + + +CREATE GENERATOR phpbb_sitelist_gen;; +SET GENERATOR phpbb_sitelist_gen TO 0;; + +CREATE TRIGGER t_phpbb_sitelist FOR phpbb_sitelist +BEFORE INSERT +AS +BEGIN + NEW.site_id = GEN_ID(phpbb_sitelist_gen, 1); +END;; + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id INTEGER NOT NULL, + code VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + emotion VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + smiley_url VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, + smiley_width INTEGER DEFAULT 0 NOT NULL, + smiley_height INTEGER DEFAULT 0 NOT NULL, + smiley_order INTEGER DEFAULT 0 NOT NULL, + display_on_posting INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_smilies ADD PRIMARY KEY (smiley_id);; + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies(display_on_posting);; + +CREATE GENERATOR phpbb_smilies_gen;; +SET GENERATOR phpbb_smilies_gen TO 0;; + +CREATE TRIGGER t_phpbb_smilies FOR phpbb_smilies +BEFORE INSERT +AS +BEGIN + NEW.smiley_id = GEN_ID(phpbb_smilies_gen, 1); +END;; + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id INTEGER NOT NULL, + style_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + style_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + style_active INTEGER DEFAULT 1 NOT NULL, + style_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, + bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT 'kNg=' NOT NULL, + style_parent_id INTEGER DEFAULT 0 NOT NULL, + style_parent_tree BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_styles ADD PRIMARY KEY (style_id);; + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles(style_name);; + +CREATE GENERATOR phpbb_styles_gen;; +SET GENERATOR phpbb_styles_gen TO 0;; + +CREATE TRIGGER t_phpbb_styles FOR phpbb_styles +BEFORE INSERT +AS +BEGIN + NEW.style_id = GEN_ID(phpbb_styles_gen, 1); +END;; + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id INTEGER NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + icon_id INTEGER DEFAULT 0 NOT NULL, + topic_attachment INTEGER DEFAULT 0 NOT NULL, + topic_approved INTEGER DEFAULT 1 NOT NULL, + topic_reported INTEGER DEFAULT 0 NOT NULL, + topic_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_poster INTEGER DEFAULT 0 NOT NULL, + topic_time INTEGER DEFAULT 0 NOT NULL, + topic_time_limit INTEGER DEFAULT 0 NOT NULL, + topic_views INTEGER DEFAULT 0 NOT NULL, + topic_replies INTEGER DEFAULT 0 NOT NULL, + topic_replies_real INTEGER DEFAULT 0 NOT NULL, + topic_status INTEGER DEFAULT 0 NOT NULL, + topic_type INTEGER DEFAULT 0 NOT NULL, + topic_first_post_id INTEGER DEFAULT 0 NOT NULL, + topic_first_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_first_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + topic_last_post_id INTEGER DEFAULT 0 NOT NULL, + topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, + topic_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + topic_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + topic_last_post_time INTEGER DEFAULT 0 NOT NULL, + topic_last_view_time INTEGER DEFAULT 0 NOT NULL, + topic_moved_id INTEGER DEFAULT 0 NOT NULL, + topic_bumped INTEGER DEFAULT 0 NOT NULL, + topic_bumper INTEGER DEFAULT 0 NOT NULL, + poll_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + poll_start INTEGER DEFAULT 0 NOT NULL, + poll_length INTEGER DEFAULT 0 NOT NULL, + poll_max_options INTEGER DEFAULT 1 NOT NULL, + poll_last_vote INTEGER DEFAULT 0 NOT NULL, + poll_vote_change INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);; + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);; +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);; +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics(topic_last_post_time);; +CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics(topic_approved);; +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_approved, topic_last_post_id);; +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics(forum_id, topic_last_post_time, topic_moved_id);; + +CREATE GENERATOR phpbb_topics_gen;; +SET GENERATOR phpbb_topics_gen TO 0;; + +CREATE TRIGGER t_phpbb_topics FOR phpbb_topics +BEFORE INSERT +AS +BEGIN + NEW.topic_id = GEN_ID(phpbb_topics_gen, 1); +END;; + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + forum_id INTEGER DEFAULT 0 NOT NULL, + mark_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics_track ADD PRIMARY KEY (user_id, topic_id);; + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track(topic_id);; +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track(forum_id);; + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id INTEGER DEFAULT 0 NOT NULL, + topic_id INTEGER DEFAULT 0 NOT NULL, + topic_posted INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_topics_posted ADD PRIMARY KEY (user_id, topic_id);; + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + notify_status INTEGER DEFAULT 0 NOT NULL +);; + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + group_leader INTEGER DEFAULT 0 NOT NULL, + user_pending INTEGER DEFAULT 1 NOT NULL +);; + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group(group_id);; +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group(user_id);; +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group(group_leader);; + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id INTEGER NOT NULL, + user_type INTEGER DEFAULT 0 NOT NULL, + group_id INTEGER DEFAULT 3 NOT NULL, + user_permissions BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, + user_perm_from INTEGER DEFAULT 0 NOT NULL, + user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_regdate INTEGER DEFAULT 0 NOT NULL, + username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_passchg INTEGER DEFAULT 0 NOT NULL, + user_pass_convert INTEGER DEFAULT 0 NOT NULL, + user_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_email_hash DOUBLE PRECISION DEFAULT 0 NOT NULL, + user_birthday VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_lastvisit INTEGER DEFAULT 0 NOT NULL, + user_lastmark INTEGER DEFAULT 0 NOT NULL, + user_lastpost_time INTEGER DEFAULT 0 NOT NULL, + user_lastpage VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_last_confirm_key VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_last_search INTEGER DEFAULT 0 NOT NULL, + user_warnings INTEGER DEFAULT 0 NOT NULL, + user_last_warning INTEGER DEFAULT 0 NOT NULL, + user_login_attempts INTEGER DEFAULT 0 NOT NULL, + user_inactive_reason INTEGER DEFAULT 0 NOT NULL, + user_inactive_time INTEGER DEFAULT 0 NOT NULL, + user_posts INTEGER DEFAULT 0 NOT NULL, + user_lang VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_timezone VARCHAR(100) CHARACTER SET NONE DEFAULT 'UTC' NOT NULL, + user_dateformat VARCHAR(30) CHARACTER SET UTF8 DEFAULT 'd M Y H:i' NOT NULL COLLATE UNICODE, + user_style INTEGER DEFAULT 0 NOT NULL, + user_rank INTEGER DEFAULT 0 NOT NULL, + user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_new_privmsg INTEGER DEFAULT 0 NOT NULL, + user_unread_privmsg INTEGER DEFAULT 0 NOT NULL, + user_last_privmsg INTEGER DEFAULT 0 NOT NULL, + user_message_rules INTEGER DEFAULT 0 NOT NULL, + user_full_folder INTEGER DEFAULT -3 NOT NULL, + user_emailtime INTEGER DEFAULT 0 NOT NULL, + user_topic_show_days INTEGER DEFAULT 0 NOT NULL, + user_topic_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, + user_topic_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'd' NOT NULL, + user_post_show_days INTEGER DEFAULT 0 NOT NULL, + user_post_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, + user_post_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'a' NOT NULL, + user_notify INTEGER DEFAULT 0 NOT NULL, + user_notify_pm INTEGER DEFAULT 1 NOT NULL, + user_notify_type INTEGER DEFAULT 0 NOT NULL, + user_allow_pm INTEGER DEFAULT 1 NOT NULL, + user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, + user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, + user_allow_massemail INTEGER DEFAULT 1 NOT NULL, + user_options INTEGER DEFAULT 230271 NOT NULL, + user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_avatar_type INTEGER DEFAULT 0 NOT NULL, + user_avatar_width INTEGER DEFAULT 0 NOT NULL, + user_avatar_height INTEGER DEFAULT 0 NOT NULL, + user_sig BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_sig_bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_from VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_icq VARCHAR(15) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_aim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_yim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_occ BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, + user_newpasswd VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + user_new INTEGER DEFAULT 1 NOT NULL, + user_reminded INTEGER DEFAULT 0 NOT NULL, + user_reminded_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; +CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; + +CREATE GENERATOR phpbb_users_gen;; +SET GENERATOR phpbb_users_gen TO 0;; + +CREATE TRIGGER t_phpbb_users FOR phpbb_users +BEFORE INSERT +AS +BEGIN + NEW.user_id = GEN_ID(phpbb_users_gen, 1); +END;; + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + post_id INTEGER DEFAULT 0 NOT NULL, + log_id INTEGER DEFAULT 0 NOT NULL, + warning_time INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_warnings ADD PRIMARY KEY (warning_id);; + + +CREATE GENERATOR phpbb_warnings_gen;; +SET GENERATOR phpbb_warnings_gen TO 0;; + +CREATE TRIGGER t_phpbb_warnings FOR phpbb_warnings +BEFORE INSERT +AS +BEGIN + NEW.warning_id = GEN_ID(phpbb_warnings_gen, 1); +END;; + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id INTEGER NOT NULL, + word VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + replacement VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE +);; + +ALTER TABLE phpbb_words ADD PRIMARY KEY (word_id);; + + +CREATE GENERATOR phpbb_words_gen;; +SET GENERATOR phpbb_words_gen TO 0;; + +CREATE TRIGGER t_phpbb_words FOR phpbb_words +BEFORE INSERT +AS +BEGIN + NEW.word_id = GEN_ID(phpbb_words_gen, 1); +END;; + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id INTEGER DEFAULT 0 NOT NULL, + zebra_id INTEGER DEFAULT 0 NOT NULL, + friend INTEGER DEFAULT 0 NOT NULL, + foe INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_zebra ADD PRIMARY KEY (user_id, zebra_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 9d0e81a66d..9c393b8361 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1,1657 +1,1655 @@ -/* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ - -/* - Table: 'phpbb_attachments' -*/ -CREATE TABLE [phpbb_attachments] ( - [attach_id] [int] IDENTITY (1, 1) NOT NULL , - [post_msg_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [in_message] [int] DEFAULT (0) NOT NULL , - [poster_id] [int] DEFAULT (0) NOT NULL , - [is_orphan] [int] DEFAULT (1) NOT NULL , - [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , - [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , - [download_count] [int] DEFAULT (0) NOT NULL , - [attach_comment] [varchar] (4000) DEFAULT ('') NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL , - [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , - [filesize] [int] DEFAULT (0) NOT NULL , - [filetime] [int] DEFAULT (0) NOT NULL , - [thumbnail] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED - ( - [attach_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] -GO - -CREATE INDEX [post_msg_id] ON [phpbb_attachments]([post_msg_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_attachments]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] -GO - -CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE [phpbb_acl_groups] ( - [group_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [group_id] ON [phpbb_acl_groups]([group_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_options' -*/ -CREATE TABLE [phpbb_acl_options] ( - [auth_option_id] [int] IDENTITY (1, 1) NOT NULL , - [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , - [is_global] [int] DEFAULT (0) NOT NULL , - [is_local] [int] DEFAULT (0) NOT NULL , - [founder_only] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED - ( - [auth_option_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE TABLE [phpbb_acl_roles] ( - [role_id] [int] IDENTITY (1, 1) NOT NULL , - [role_name] [varchar] (255) DEFAULT ('') NOT NULL , - [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , - [role_type] [varchar] (10) DEFAULT ('') NOT NULL , - [role_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED - ( - [role_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] -GO - -CREATE INDEX [role_order] ON [phpbb_acl_roles]([role_order]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE [phpbb_acl_roles_data] ( - [role_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED - ( - [role_id], - [auth_option_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE [phpbb_acl_users] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_acl_users]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_banlist' -*/ -CREATE TABLE [phpbb_banlist] ( - [ban_id] [int] IDENTITY (1, 1) NOT NULL , - [ban_userid] [int] DEFAULT (0) NOT NULL , - [ban_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [ban_email] [varchar] (100) DEFAULT ('') NOT NULL , - [ban_start] [int] DEFAULT (0) NOT NULL , - [ban_end] [int] DEFAULT (0) NOT NULL , - [ban_exclude] [int] DEFAULT (0) NOT NULL , - [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED - ( - [ban_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] -GO - -CREATE INDEX [ban_user] ON [phpbb_banlist]([ban_userid], [ban_exclude]) ON [PRIMARY] -GO - -CREATE INDEX [ban_email] ON [phpbb_banlist]([ban_email], [ban_exclude]) ON [PRIMARY] -GO - -CREATE INDEX [ban_ip] ON [phpbb_banlist]([ban_ip], [ban_exclude]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE [phpbb_bbcodes] ( - [bbcode_id] [int] DEFAULT (0) NOT NULL , - [bbcode_tag] [varchar] (16) DEFAULT ('') NOT NULL , - [bbcode_helpline] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_posting] [int] DEFAULT (0) NOT NULL , - [bbcode_match] [varchar] (4000) DEFAULT ('') NOT NULL , - [bbcode_tpl] [text] DEFAULT ('') NOT NULL , - [first_pass_match] [text] DEFAULT ('') NOT NULL , - [first_pass_replace] [text] DEFAULT ('') NOT NULL , - [second_pass_match] [text] DEFAULT ('') NOT NULL , - [second_pass_replace] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED - ( - [bbcode_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE [phpbb_bookmarks] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED - ( - [topic_id], - [user_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bots' -*/ -CREATE TABLE [phpbb_bots] ( - [bot_id] [int] IDENTITY (1, 1) NOT NULL , - [bot_active] [int] DEFAULT (1) NOT NULL , - [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , - [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bots] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED - ( - [bot_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE [phpbb_config] ( - [config_name] [varchar] (255) DEFAULT ('') NOT NULL , - [config_value] [varchar] (255) DEFAULT ('') NOT NULL , - [is_dynamic] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_config] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED - ( - [config_name] - ) ON [PRIMARY] -GO - -CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE [phpbb_confirm] ( - [confirm_id] [char] (32) DEFAULT ('') NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL , - [confirm_type] [int] DEFAULT (0) NOT NULL , - [code] [varchar] (8) DEFAULT ('') NOT NULL , - [seed] [int] DEFAULT (0) NOT NULL , - [attempts] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED - ( - [session_id], - [confirm_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_disallow' -*/ -CREATE TABLE [phpbb_disallow] ( - [disallow_id] [int] IDENTITY (1, 1) NOT NULL , - [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED - ( - [disallow_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_drafts' -*/ -CREATE TABLE [phpbb_drafts] ( - [draft_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [save_time] [int] DEFAULT (0) NOT NULL , - [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [draft_message] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED - ( - [draft_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE [phpbb_ext] ( - [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , - [ext_active] [int] DEFAULT (0) NOT NULL , - [ext_state] [varchar] (8000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_extensions' -*/ -CREATE TABLE [phpbb_extensions] ( - [extension_id] [int] IDENTITY (1, 1) NOT NULL , - [group_id] [int] DEFAULT (0) NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED - ( - [extension_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE TABLE [phpbb_extension_groups] ( - [group_id] [int] IDENTITY (1, 1) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [cat_id] [int] DEFAULT (0) NOT NULL , - [allow_group] [int] DEFAULT (0) NOT NULL , - [download_mode] [int] DEFAULT (1) NOT NULL , - [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , - [max_filesize] [int] DEFAULT (0) NOT NULL , - [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , - [allow_in_pm] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED - ( - [group_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums' -*/ -CREATE TABLE [phpbb_forums] ( - [forum_id] [int] IDENTITY (1, 1) NOT NULL , - [parent_id] [int] DEFAULT (0) NOT NULL , - [left_id] [int] DEFAULT (0) NOT NULL , - [right_id] [int] DEFAULT (0) NOT NULL , - [forum_parents] [text] DEFAULT ('') NOT NULL , - [forum_name] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_desc] [varchar] (4000) DEFAULT ('') NOT NULL , - [forum_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_desc_options] [int] DEFAULT (7) NOT NULL , - [forum_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_password] [varchar] (40) DEFAULT ('') NOT NULL , - [forum_style] [int] DEFAULT (0) NOT NULL , - [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules] [varchar] (4000) DEFAULT ('') NOT NULL , - [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules_options] [int] DEFAULT (7) NOT NULL , - [forum_rules_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , - [forum_type] [int] DEFAULT (0) NOT NULL , - [forum_status] [int] DEFAULT (0) NOT NULL , - [forum_posts] [int] DEFAULT (0) NOT NULL , - [forum_topics] [int] DEFAULT (0) NOT NULL , - [forum_topics_real] [int] DEFAULT (0) NOT NULL , - [forum_last_post_id] [int] DEFAULT (0) NOT NULL , - [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , - [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_last_post_time] [int] DEFAULT (0) NOT NULL , - [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [forum_flags] [int] DEFAULT (32) NOT NULL , - [forum_options] [int] DEFAULT (0) NOT NULL , - [display_subforum_list] [int] DEFAULT (1) NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL , - [enable_indexing] [int] DEFAULT (1) NOT NULL , - [enable_icons] [int] DEFAULT (1) NOT NULL , - [enable_prune] [int] DEFAULT (0) NOT NULL , - [prune_next] [int] DEFAULT (0) NOT NULL , - [prune_days] [int] DEFAULT (0) NOT NULL , - [prune_viewed] [int] DEFAULT (0) NOT NULL , - [prune_freq] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED - ( - [forum_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_lastpost_id] ON [phpbb_forums]([forum_last_post_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE [phpbb_forums_access] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED - ( - [forum_id], - [user_id], - [session_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE [phpbb_forums_track] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED - ( - [user_id], - [forum_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE [phpbb_forums_watch] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_forums_watch]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_forums_watch]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [notify_stat] ON [phpbb_forums_watch]([notify_status]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_groups' -*/ -CREATE TABLE [phpbb_groups] ( - [group_id] [int] IDENTITY (1, 1) NOT NULL , - [group_type] [int] DEFAULT (1) NOT NULL , - [group_founder_manage] [int] DEFAULT (0) NOT NULL , - [group_skip_auth] [int] DEFAULT (0) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , - [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [group_desc_options] [int] DEFAULT (7) NOT NULL , - [group_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [group_display] [int] DEFAULT (0) NOT NULL , - [group_avatar] [varchar] (255) DEFAULT ('') NOT NULL , - [group_avatar_type] [int] DEFAULT (0) NOT NULL , - [group_avatar_width] [int] DEFAULT (0) NOT NULL , - [group_avatar_height] [int] DEFAULT (0) NOT NULL , - [group_rank] [int] DEFAULT (0) NOT NULL , - [group_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [group_sig_chars] [int] DEFAULT (0) NOT NULL , - [group_receive_pm] [int] DEFAULT (0) NOT NULL , - [group_message_limit] [int] DEFAULT (0) NOT NULL , - [group_max_recipients] [int] DEFAULT (0) NOT NULL , - [group_legend] [int] DEFAULT (0) NOT NULL , - [group_teampage] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED - ( - [group_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_icons' -*/ -CREATE TABLE [phpbb_icons] ( - [icons_id] [int] IDENTITY (1, 1) NOT NULL , - [icons_url] [varchar] (255) DEFAULT ('') NOT NULL , - [icons_width] [int] DEFAULT (0) NOT NULL , - [icons_height] [int] DEFAULT (0) NOT NULL , - [icons_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_icons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED - ( - [icons_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_lang' -*/ -CREATE TABLE [phpbb_lang] ( - [lang_id] [int] IDENTITY (1, 1) NOT NULL , - [lang_iso] [varchar] (30) DEFAULT ('') NOT NULL , - [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , - [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , - [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_author] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED - ( - [lang_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_log' -*/ -CREATE TABLE [phpbb_log] ( - [log_id] [int] IDENTITY (1, 1) NOT NULL , - [log_type] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [reportee_id] [int] DEFAULT (0) NOT NULL , - [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [log_time] [int] DEFAULT (0) NOT NULL , - [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , - [log_data] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_log] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED - ( - [log_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] -GO - -CREATE INDEX [log_time] ON [phpbb_log]([log_time]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_log]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_log]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [reportee_id] ON [phpbb_log]([reportee_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_log]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE [phpbb_login_attempts] ( - [attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL , - [attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , - [attempt_time] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT (0) NOT NULL , - [username_clean] [varchar] (255) DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [att_for] ON [phpbb_login_attempts]([attempt_forwarded_for], [attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [att_time] ON [phpbb_login_attempts]([attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE [phpbb_moderator_cache] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT ('') NOT NULL , - [group_id] [int] DEFAULT (0) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [disp_idx] ON [phpbb_moderator_cache]([display_on_index]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_modules' -*/ -CREATE TABLE [phpbb_modules] ( - [module_id] [int] IDENTITY (1, 1) NOT NULL , - [module_enabled] [int] DEFAULT (1) NOT NULL , - [module_display] [int] DEFAULT (1) NOT NULL , - [module_basename] [varchar] (255) DEFAULT ('') NOT NULL , - [module_class] [varchar] (10) DEFAULT ('') NOT NULL , - [parent_id] [int] DEFAULT (0) NOT NULL , - [left_id] [int] DEFAULT (0) NOT NULL , - [right_id] [int] DEFAULT (0) NOT NULL , - [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , - [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , - [module_auth] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_modules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED - ( - [module_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] -GO - -CREATE INDEX [module_enabled] ON [phpbb_modules]([module_enabled]) ON [PRIMARY] -GO - -CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE [phpbb_poll_options] ( - [poll_option_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , - [poll_option_total] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [poll_opt_id] ON [phpbb_poll_options]([poll_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_poll_options]([topic_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE [phpbb_poll_votes] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [poll_option_id] [int] DEFAULT (0) NOT NULL , - [vote_user_id] [int] DEFAULT (0) NOT NULL , - [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_poll_votes]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [vote_user_id] ON [phpbb_poll_votes]([vote_user_id]) ON [PRIMARY] -GO - -CREATE INDEX [vote_user_ip] ON [phpbb_poll_votes]([vote_user_ip]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_posts' -*/ -CREATE TABLE [phpbb_posts] ( - [post_id] [int] IDENTITY (1, 1) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [poster_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [poster_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [post_time] [int] DEFAULT (0) NOT NULL , - [post_approved] [int] DEFAULT (1) NOT NULL , - [post_reported] [int] DEFAULT (0) NOT NULL , - [enable_bbcode] [int] DEFAULT (1) NOT NULL , - [enable_smilies] [int] DEFAULT (1) NOT NULL , - [enable_magic_url] [int] DEFAULT (1) NOT NULL , - [enable_sig] [int] DEFAULT (1) NOT NULL , - [post_username] [varchar] (255) DEFAULT ('') NOT NULL , - [post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [post_text] [text] DEFAULT ('') NOT NULL , - [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , - [post_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [post_postcount] [int] DEFAULT (1) NOT NULL , - [post_edit_time] [int] DEFAULT (0) NOT NULL , - [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [post_edit_user] [int] DEFAULT (0) NOT NULL , - [post_edit_count] [int] DEFAULT (0) NOT NULL , - [post_edit_locked] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_posts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED - ( - [post_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_posts]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [poster_ip] ON [phpbb_posts]([poster_ip]) ON [PRIMARY] -GO - -CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY] -GO - -CREATE INDEX [post_approved] ON [phpbb_posts]([post_approved]) ON [PRIMARY] -GO - -CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] -GO - -CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE TABLE [phpbb_privmsgs] ( - [msg_id] [int] IDENTITY (1, 1) NOT NULL , - [root_level] [int] DEFAULT (0) NOT NULL , - [author_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [author_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [message_time] [int] DEFAULT (0) NOT NULL , - [enable_bbcode] [int] DEFAULT (1) NOT NULL , - [enable_smilies] [int] DEFAULT (1) NOT NULL , - [enable_magic_url] [int] DEFAULT (1) NOT NULL , - [enable_sig] [int] DEFAULT (1) NOT NULL , - [message_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [message_text] [text] DEFAULT ('') NOT NULL , - [message_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [message_edit_user] [int] DEFAULT (0) NOT NULL , - [message_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [message_edit_time] [int] DEFAULT (0) NOT NULL , - [message_edit_count] [int] DEFAULT (0) NOT NULL , - [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [message_reported] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED - ( - [msg_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] -GO - -CREATE INDEX [message_time] ON [phpbb_privmsgs]([message_time]) ON [PRIMARY] -GO - -CREATE INDEX [author_id] ON [phpbb_privmsgs]([author_id]) ON [PRIMARY] -GO - -CREATE INDEX [root_level] ON [phpbb_privmsgs]([root_level]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE TABLE [phpbb_privmsgs_folder] ( - [folder_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , - [pm_count] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED - ( - [folder_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE TABLE [phpbb_privmsgs_rules] ( - [rule_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [rule_check] [int] DEFAULT (0) NOT NULL , - [rule_connection] [int] DEFAULT (0) NOT NULL , - [rule_string] [varchar] (255) DEFAULT ('') NOT NULL , - [rule_user_id] [int] DEFAULT (0) NOT NULL , - [rule_group_id] [int] DEFAULT (0) NOT NULL , - [rule_action] [int] DEFAULT (0) NOT NULL , - [rule_folder_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED - ( - [rule_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE [phpbb_privmsgs_to] ( - [msg_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [author_id] [int] DEFAULT (0) NOT NULL , - [pm_deleted] [int] DEFAULT (0) NOT NULL , - [pm_new] [int] DEFAULT (1) NOT NULL , - [pm_unread] [int] DEFAULT (1) NOT NULL , - [pm_replied] [int] DEFAULT (0) NOT NULL , - [pm_marked] [int] DEFAULT (0) NOT NULL , - [pm_forwarded] [int] DEFAULT (0) NOT NULL , - [folder_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [msg_id] ON [phpbb_privmsgs_to]([msg_id]) ON [PRIMARY] -GO - -CREATE INDEX [author_id] ON [phpbb_privmsgs_to]([author_id]) ON [PRIMARY] -GO - -CREATE INDEX [usr_flder_id] ON [phpbb_privmsgs_to]([user_id], [folder_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE TABLE [phpbb_profile_fields] ( - [field_id] [int] IDENTITY (1, 1) NOT NULL , - [field_name] [varchar] (255) DEFAULT ('') NOT NULL , - [field_type] [int] DEFAULT (0) NOT NULL , - [field_ident] [varchar] (20) DEFAULT ('') NOT NULL , - [field_length] [varchar] (20) DEFAULT ('') NOT NULL , - [field_minlen] [varchar] (255) DEFAULT ('') NOT NULL , - [field_maxlen] [varchar] (255) DEFAULT ('') NOT NULL , - [field_novalue] [varchar] (255) DEFAULT ('') NOT NULL , - [field_default_value] [varchar] (255) DEFAULT ('') NOT NULL , - [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , - [field_required] [int] DEFAULT (0) NOT NULL , - [field_show_novalue] [int] DEFAULT (0) NOT NULL , - [field_show_on_reg] [int] DEFAULT (0) NOT NULL , - [field_show_on_pm] [int] DEFAULT (0) NOT NULL , - [field_show_on_vt] [int] DEFAULT (0) NOT NULL , - [field_show_profile] [int] DEFAULT (0) NOT NULL , - [field_hide] [int] DEFAULT (0) NOT NULL , - [field_no_view] [int] DEFAULT (0) NOT NULL , - [field_active] [int] DEFAULT (0) NOT NULL , - [field_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED - ( - [field_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] -GO - -CREATE INDEX [fld_ordr] ON [phpbb_profile_fields]([field_order]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE [phpbb_profile_fields_data] ( - [user_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED - ( - [user_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE [phpbb_profile_fields_lang] ( - [field_id] [int] DEFAULT (0) NOT NULL , - [lang_id] [int] DEFAULT (0) NOT NULL , - [option_id] [int] DEFAULT (0) NOT NULL , - [field_type] [int] DEFAULT (0) NOT NULL , - [lang_value] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED - ( - [field_id], - [lang_id], - [option_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE [phpbb_profile_lang] ( - [field_id] [int] DEFAULT (0) NOT NULL , - [lang_id] [int] DEFAULT (0) NOT NULL , - [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , - [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED - ( - [field_id], - [lang_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_ranks' -*/ -CREATE TABLE [phpbb_ranks] ( - [rank_id] [int] IDENTITY (1, 1) NOT NULL , - [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , - [rank_min] [int] DEFAULT (0) NOT NULL , - [rank_special] [int] DEFAULT (0) NOT NULL , - [rank_image] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED - ( - [rank_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_reports' -*/ -CREATE TABLE [phpbb_reports] ( - [report_id] [int] IDENTITY (1, 1) NOT NULL , - [reason_id] [int] DEFAULT (0) NOT NULL , - [post_id] [int] DEFAULT (0) NOT NULL , - [pm_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [user_notify] [int] DEFAULT (0) NOT NULL , - [report_closed] [int] DEFAULT (0) NOT NULL , - [report_time] [int] DEFAULT (0) NOT NULL , - [report_text] [text] DEFAULT ('') NOT NULL , - [reported_post_text] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_reports] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED - ( - [report_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] -GO - -CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE TABLE [phpbb_reports_reasons] ( - [reason_id] [int] IDENTITY (1, 1) NOT NULL , - [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , - [reason_description] [text] DEFAULT ('') NOT NULL , - [reason_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED - ( - [reason_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE [phpbb_search_results] ( - [search_key] [varchar] (32) DEFAULT ('') NOT NULL , - [search_time] [int] DEFAULT (0) NOT NULL , - [search_keywords] [text] DEFAULT ('') NOT NULL , - [search_authors] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED - ( - [search_key] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE TABLE [phpbb_search_wordlist] ( - [word_id] [int] IDENTITY (1, 1) NOT NULL , - [word_text] [varchar] (255) DEFAULT ('') NOT NULL , - [word_common] [int] DEFAULT (0) NOT NULL , - [word_count] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED - ( - [word_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] -GO - -CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE [phpbb_search_wordmatch] ( - [post_id] [int] DEFAULT (0) NOT NULL , - [word_id] [int] DEFAULT (0) NOT NULL , - [title_match] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [unq_mtch] ON [phpbb_search_wordmatch]([word_id], [post_id], [title_match]) ON [PRIMARY] -GO - -CREATE INDEX [word_id] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] -GO - -CREATE INDEX [post_id] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE [phpbb_sessions] ( - [session_id] [char] (32) DEFAULT ('') NOT NULL , - [session_user_id] [int] DEFAULT (0) NOT NULL , - [session_forum_id] [int] DEFAULT (0) NOT NULL , - [session_last_visit] [int] DEFAULT (0) NOT NULL , - [session_start] [int] DEFAULT (0) NOT NULL , - [session_time] [int] DEFAULT (0) NOT NULL , - [session_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [session_browser] [varchar] (150) DEFAULT ('') NOT NULL , - [session_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , - [session_page] [varchar] (255) DEFAULT ('') NOT NULL , - [session_viewonline] [int] DEFAULT (1) NOT NULL , - [session_autologin] [int] DEFAULT (0) NOT NULL , - [session_admin] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED - ( - [session_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] -GO - -CREATE INDEX [session_user_id] ON [phpbb_sessions]([session_user_id]) ON [PRIMARY] -GO - -CREATE INDEX [session_fid] ON [phpbb_sessions]([session_forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE [phpbb_sessions_keys] ( - [key_id] [char] (32) DEFAULT ('') NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [last_login] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED - ( - [key_id], - [user_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sitelist' -*/ -CREATE TABLE [phpbb_sitelist] ( - [site_id] [int] IDENTITY (1, 1) NOT NULL , - [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , - [ip_exclude] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED - ( - [site_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_smilies' -*/ -CREATE TABLE [phpbb_smilies] ( - [smiley_id] [int] IDENTITY (1, 1) NOT NULL , - [code] [varchar] (50) DEFAULT ('') NOT NULL , - [emotion] [varchar] (50) DEFAULT ('') NOT NULL , - [smiley_url] [varchar] (50) DEFAULT ('') NOT NULL , - [smiley_width] [int] DEFAULT (0) NOT NULL , - [smiley_height] [int] DEFAULT (0) NOT NULL , - [smiley_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED - ( - [smiley_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_styles' -*/ -CREATE TABLE [phpbb_styles] ( - [style_id] [int] IDENTITY (1, 1) NOT NULL , - [style_name] [varchar] (255) DEFAULT ('') NOT NULL , - [style_copyright] [varchar] (255) DEFAULT ('') NOT NULL , - [style_active] [int] DEFAULT (1) NOT NULL , - [style_path] [varchar] (100) DEFAULT ('') NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , - [style_parent_id] [int] DEFAULT (0) NOT NULL , - [style_parent_tree] [varchar] (8000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_styles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED - ( - [style_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics' -*/ -CREATE TABLE [phpbb_topics] ( - [topic_id] [int] IDENTITY (1, 1) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [topic_attachment] [int] DEFAULT (0) NOT NULL , - [topic_approved] [int] DEFAULT (1) NOT NULL , - [topic_reported] [int] DEFAULT (0) NOT NULL , - [topic_title] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_poster] [int] DEFAULT (0) NOT NULL , - [topic_time] [int] DEFAULT (0) NOT NULL , - [topic_time_limit] [int] DEFAULT (0) NOT NULL , - [topic_views] [int] DEFAULT (0) NOT NULL , - [topic_replies] [int] DEFAULT (0) NOT NULL , - [topic_replies_real] [int] DEFAULT (0) NOT NULL , - [topic_status] [int] DEFAULT (0) NOT NULL , - [topic_type] [int] DEFAULT (0) NOT NULL , - [topic_first_post_id] [int] DEFAULT (0) NOT NULL , - [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [topic_last_post_id] [int] DEFAULT (0) NOT NULL , - [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , - [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [topic_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_last_post_time] [int] DEFAULT (0) NOT NULL , - [topic_last_view_time] [int] DEFAULT (0) NOT NULL , - [topic_moved_id] [int] DEFAULT (0) NOT NULL , - [topic_bumped] [int] DEFAULT (0) NOT NULL , - [topic_bumper] [int] DEFAULT (0) NOT NULL , - [poll_title] [varchar] (255) DEFAULT ('') NOT NULL , - [poll_start] [int] DEFAULT (0) NOT NULL , - [poll_length] [int] DEFAULT (0) NOT NULL , - [poll_max_options] [int] DEFAULT (1) NOT NULL , - [poll_last_vote] [int] DEFAULT (0) NOT NULL , - [poll_vote_change] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED - ( - [topic_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id_type] ON [phpbb_topics]([forum_id], [topic_type]) ON [PRIMARY] -GO - -CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY] -GO - -CREATE INDEX [topic_approved] ON [phpbb_topics]([topic_approved]) ON [PRIMARY] -GO - -CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_approved], [topic_last_post_id]) ON [PRIMARY] -GO - -CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE [phpbb_topics_track] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED - ( - [user_id], - [topic_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_topics_track]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE [phpbb_topics_posted] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [topic_posted] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED - ( - [user_id], - [topic_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE [phpbb_topics_watch] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_topics_watch]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE [phpbb_user_group] ( - [group_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [group_leader] [int] DEFAULT (0) NOT NULL , - [user_pending] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [group_id] ON [phpbb_user_group]([group_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_user_group]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [group_leader] ON [phpbb_user_group]([group_leader]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_users' -*/ -CREATE TABLE [phpbb_users] ( - [user_id] [int] IDENTITY (1, 1) NOT NULL , - [user_type] [int] DEFAULT (0) NOT NULL , - [group_id] [int] DEFAULT (3) NOT NULL , - [user_permissions] [text] DEFAULT ('') NOT NULL , - [user_perm_from] [int] DEFAULT (0) NOT NULL , - [user_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [user_regdate] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT ('') NOT NULL , - [username_clean] [varchar] (255) DEFAULT ('') NOT NULL , - [user_password] [varchar] (40) DEFAULT ('') NOT NULL , - [user_passchg] [int] DEFAULT (0) NOT NULL , - [user_pass_convert] [int] DEFAULT (0) NOT NULL , - [user_email] [varchar] (100) DEFAULT ('') NOT NULL , - [user_email_hash] [float] DEFAULT (0) NOT NULL , - [user_birthday] [varchar] (10) DEFAULT ('') NOT NULL , - [user_lastvisit] [int] DEFAULT (0) NOT NULL , - [user_lastmark] [int] DEFAULT (0) NOT NULL , - [user_lastpost_time] [int] DEFAULT (0) NOT NULL , - [user_lastpage] [varchar] (200) DEFAULT ('') NOT NULL , - [user_last_confirm_key] [varchar] (10) DEFAULT ('') NOT NULL , - [user_last_search] [int] DEFAULT (0) NOT NULL , - [user_warnings] [int] DEFAULT (0) NOT NULL , - [user_last_warning] [int] DEFAULT (0) NOT NULL , - [user_login_attempts] [int] DEFAULT (0) NOT NULL , - [user_inactive_reason] [int] DEFAULT (0) NOT NULL , - [user_inactive_time] [int] DEFAULT (0) NOT NULL , - [user_posts] [int] DEFAULT (0) NOT NULL , - [user_lang] [varchar] (30) DEFAULT ('') NOT NULL , - [user_timezone] [varchar] (100) DEFAULT ('UTC') NOT NULL , - [user_dateformat] [varchar] (30) DEFAULT ('d M Y H:i') NOT NULL , - [user_style] [int] DEFAULT (0) NOT NULL , - [user_rank] [int] DEFAULT (0) NOT NULL , - [user_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [user_new_privmsg] [int] DEFAULT (0) NOT NULL , - [user_unread_privmsg] [int] DEFAULT (0) NOT NULL , - [user_last_privmsg] [int] DEFAULT (0) NOT NULL , - [user_message_rules] [int] DEFAULT (0) NOT NULL , - [user_full_folder] [int] DEFAULT (-3) NOT NULL , - [user_emailtime] [int] DEFAULT (0) NOT NULL , - [user_topic_show_days] [int] DEFAULT (0) NOT NULL , - [user_topic_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , - [user_topic_sortby_dir] [varchar] (1) DEFAULT ('d') NOT NULL , - [user_post_show_days] [int] DEFAULT (0) NOT NULL , - [user_post_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , - [user_post_sortby_dir] [varchar] (1) DEFAULT ('a') NOT NULL , - [user_notify] [int] DEFAULT (0) NOT NULL , - [user_notify_pm] [int] DEFAULT (1) NOT NULL , - [user_notify_type] [int] DEFAULT (0) NOT NULL , - [user_allow_pm] [int] DEFAULT (1) NOT NULL , - [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , - [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , - [user_allow_massemail] [int] DEFAULT (1) NOT NULL , - [user_options] [int] DEFAULT (230271) NOT NULL , - [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , - [user_avatar_type] [int] DEFAULT (0) NOT NULL , - [user_avatar_width] [int] DEFAULT (0) NOT NULL , - [user_avatar_height] [int] DEFAULT (0) NOT NULL , - [user_sig] [text] DEFAULT ('') NOT NULL , - [user_sig_bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [user_sig_bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [user_from] [varchar] (100) DEFAULT ('') NOT NULL , - [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , - [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , - [user_yim] [varchar] (255) DEFAULT ('') NOT NULL , - [user_msnm] [varchar] (255) DEFAULT ('') NOT NULL , - [user_jabber] [varchar] (255) DEFAULT ('') NOT NULL , - [user_website] [varchar] (200) DEFAULT ('') NOT NULL , - [user_occ] [varchar] (4000) DEFAULT ('') NOT NULL , - [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , - [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , - [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , - [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , - [user_new] [int] DEFAULT (1) NOT NULL , - [user_reminded] [int] DEFAULT (0) NOT NULL , - [user_reminded_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_users] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED - ( - [user_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] -GO - -CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] -GO - -CREATE INDEX [user_type] ON [phpbb_users]([user_type]) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [username_clean] ON [phpbb_users]([username_clean]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_warnings' -*/ -CREATE TABLE [phpbb_warnings] ( - [warning_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [post_id] [int] DEFAULT (0) NOT NULL , - [log_id] [int] DEFAULT (0) NOT NULL , - [warning_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED - ( - [warning_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_words' -*/ -CREATE TABLE [phpbb_words] ( - [word_id] [int] IDENTITY (1, 1) NOT NULL , - [word] [varchar] (255) DEFAULT ('') NOT NULL , - [replacement] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_words] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED - ( - [word_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE [phpbb_zebra] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [zebra_id] [int] DEFAULT (0) NOT NULL , - [friend] [int] DEFAULT (0) NOT NULL , - [foe] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED - ( - [user_id], - [zebra_id] - ) ON [PRIMARY] -GO - - +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +/* + Table: 'phpbb_attachments' +*/ +CREATE TABLE [phpbb_attachments] ( + [attach_id] [int] IDENTITY (1, 1) NOT NULL , + [post_msg_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [in_message] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [is_orphan] [int] DEFAULT (1) NOT NULL , + [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [download_count] [int] DEFAULT (0) NOT NULL , + [attach_comment] [varchar] (4000) DEFAULT ('') NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL , + [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , + [filesize] [int] DEFAULT (0) NOT NULL , + [filetime] [int] DEFAULT (0) NOT NULL , + [thumbnail] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED + ( + [attach_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] +GO + +CREATE INDEX [post_msg_id] ON [phpbb_attachments]([post_msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_attachments]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE [phpbb_acl_groups] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_acl_groups]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE [phpbb_acl_options] ( + [auth_option_id] [int] IDENTITY (1, 1) NOT NULL , + [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , + [is_global] [int] DEFAULT (0) NOT NULL , + [is_local] [int] DEFAULT (0) NOT NULL , + [founder_only] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED + ( + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE [phpbb_acl_roles] ( + [role_id] [int] IDENTITY (1, 1) NOT NULL , + [role_name] [varchar] (255) DEFAULT ('') NOT NULL , + [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , + [role_type] [varchar] (10) DEFAULT ('') NOT NULL , + [role_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED + ( + [role_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] +GO + +CREATE INDEX [role_order] ON [phpbb_acl_roles]([role_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE [phpbb_acl_roles_data] ( + [role_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED + ( + [role_id], + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE [phpbb_acl_users] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_acl_users]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE [phpbb_banlist] ( + [ban_id] [int] IDENTITY (1, 1) NOT NULL , + [ban_userid] [int] DEFAULT (0) NOT NULL , + [ban_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [ban_email] [varchar] (100) DEFAULT ('') NOT NULL , + [ban_start] [int] DEFAULT (0) NOT NULL , + [ban_end] [int] DEFAULT (0) NOT NULL , + [ban_exclude] [int] DEFAULT (0) NOT NULL , + [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED + ( + [ban_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] +GO + +CREATE INDEX [ban_user] ON [phpbb_banlist]([ban_userid], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_email] ON [phpbb_banlist]([ban_email], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_ip] ON [phpbb_banlist]([ban_ip], [ban_exclude]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE [phpbb_bbcodes] ( + [bbcode_id] [int] DEFAULT (0) NOT NULL , + [bbcode_tag] [varchar] (16) DEFAULT ('') NOT NULL , + [bbcode_helpline] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_posting] [int] DEFAULT (0) NOT NULL , + [bbcode_match] [varchar] (4000) DEFAULT ('') NOT NULL , + [bbcode_tpl] [text] DEFAULT ('') NOT NULL , + [first_pass_match] [text] DEFAULT ('') NOT NULL , + [first_pass_replace] [text] DEFAULT ('') NOT NULL , + [second_pass_match] [text] DEFAULT ('') NOT NULL , + [second_pass_replace] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED + ( + [bbcode_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE [phpbb_bookmarks] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED + ( + [topic_id], + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE [phpbb_bots] ( + [bot_id] [int] IDENTITY (1, 1) NOT NULL , + [bot_active] [int] DEFAULT (1) NOT NULL , + [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , + [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bots] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED + ( + [bot_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE [phpbb_config] ( + [config_name] [varchar] (255) DEFAULT ('') NOT NULL , + [config_value] [varchar] (255) DEFAULT ('') NOT NULL , + [is_dynamic] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_config] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED + ( + [config_name] + ) ON [PRIMARY] +GO + +CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE [phpbb_confirm] ( + [confirm_id] [char] (32) DEFAULT ('') NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [confirm_type] [int] DEFAULT (0) NOT NULL , + [code] [varchar] (8) DEFAULT ('') NOT NULL , + [seed] [int] DEFAULT (0) NOT NULL , + [attempts] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED + ( + [session_id], + [confirm_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE [phpbb_disallow] ( + [disallow_id] [int] IDENTITY (1, 1) NOT NULL , + [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED + ( + [disallow_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_drafts' +*/ +CREATE TABLE [phpbb_drafts] ( + [draft_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [save_time] [int] DEFAULT (0) NOT NULL , + [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [draft_message] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED + ( + [draft_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE [phpbb_ext] ( + [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , + [ext_active] [int] DEFAULT (0) NOT NULL , + [ext_state] [varchar] (8000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extensions' +*/ +CREATE TABLE [phpbb_extensions] ( + [extension_id] [int] IDENTITY (1, 1) NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED + ( + [extension_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE TABLE [phpbb_extension_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [cat_id] [int] DEFAULT (0) NOT NULL , + [allow_group] [int] DEFAULT (0) NOT NULL , + [download_mode] [int] DEFAULT (1) NOT NULL , + [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , + [max_filesize] [int] DEFAULT (0) NOT NULL , + [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , + [allow_in_pm] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE [phpbb_forums] ( + [forum_id] [int] IDENTITY (1, 1) NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [forum_parents] [text] DEFAULT ('') NOT NULL , + [forum_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc_options] [int] DEFAULT (7) NOT NULL , + [forum_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_password] [varchar] (40) DEFAULT ('') NOT NULL , + [forum_style] [int] DEFAULT (0) NOT NULL , + [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_options] [int] DEFAULT (7) NOT NULL , + [forum_rules_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , + [forum_type] [int] DEFAULT (0) NOT NULL , + [forum_status] [int] DEFAULT (0) NOT NULL , + [forum_posts] [int] DEFAULT (0) NOT NULL , + [forum_topics] [int] DEFAULT (0) NOT NULL , + [forum_topics_real] [int] DEFAULT (0) NOT NULL , + [forum_last_post_id] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , + [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_post_time] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [forum_flags] [int] DEFAULT (32) NOT NULL , + [forum_options] [int] DEFAULT (0) NOT NULL , + [display_subforum_list] [int] DEFAULT (1) NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL , + [enable_indexing] [int] DEFAULT (1) NOT NULL , + [enable_icons] [int] DEFAULT (1) NOT NULL , + [enable_prune] [int] DEFAULT (0) NOT NULL , + [prune_next] [int] DEFAULT (0) NOT NULL , + [prune_days] [int] DEFAULT (0) NOT NULL , + [prune_viewed] [int] DEFAULT (0) NOT NULL , + [prune_freq] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED + ( + [forum_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_lastpost_id] ON [phpbb_forums]([forum_last_post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE [phpbb_forums_access] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED + ( + [forum_id], + [user_id], + [session_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE [phpbb_forums_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [forum_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE [phpbb_forums_watch] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_forums_watch]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_forums_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_forums_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE [phpbb_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_type] [int] DEFAULT (1) NOT NULL , + [group_founder_manage] [int] DEFAULT (0) NOT NULL , + [group_skip_auth] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc_options] [int] DEFAULT (7) NOT NULL , + [group_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [group_display] [int] DEFAULT (0) NOT NULL , + [group_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [group_avatar_type] [int] DEFAULT (0) NOT NULL , + [group_avatar_width] [int] DEFAULT (0) NOT NULL , + [group_avatar_height] [int] DEFAULT (0) NOT NULL , + [group_rank] [int] DEFAULT (0) NOT NULL , + [group_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [group_sig_chars] [int] DEFAULT (0) NOT NULL , + [group_receive_pm] [int] DEFAULT (0) NOT NULL , + [group_message_limit] [int] DEFAULT (0) NOT NULL , + [group_max_recipients] [int] DEFAULT (0) NOT NULL , + [group_legend] [int] DEFAULT (0) NOT NULL , + [group_teampage] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE [phpbb_icons] ( + [icons_id] [int] IDENTITY (1, 1) NOT NULL , + [icons_url] [varchar] (255) DEFAULT ('') NOT NULL , + [icons_width] [int] DEFAULT (0) NOT NULL , + [icons_height] [int] DEFAULT (0) NOT NULL , + [icons_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_icons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED + ( + [icons_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE [phpbb_lang] ( + [lang_id] [int] IDENTITY (1, 1) NOT NULL , + [lang_iso] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , + [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_author] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED + ( + [lang_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_log' +*/ +CREATE TABLE [phpbb_log] ( + [log_id] [int] IDENTITY (1, 1) NOT NULL , + [log_type] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [reportee_id] [int] DEFAULT (0) NOT NULL , + [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [log_time] [int] DEFAULT (0) NOT NULL , + [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , + [log_data] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_log] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED + ( + [log_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] +GO + +CREATE INDEX [log_time] ON [phpbb_log]([log_time]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_log]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_log]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [reportee_id] ON [phpbb_log]([reportee_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_log]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE [phpbb_login_attempts] ( + [attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL , + [attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , + [attempt_time] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT (0) NOT NULL , + [username_clean] [varchar] (255) DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [att_for] ON [phpbb_login_attempts]([attempt_forwarded_for], [attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [att_time] ON [phpbb_login_attempts]([attempt_time]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE [phpbb_moderator_cache] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [disp_idx] ON [phpbb_moderator_cache]([display_on_index]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE [phpbb_modules] ( + [module_id] [int] IDENTITY (1, 1) NOT NULL , + [module_enabled] [int] DEFAULT (1) NOT NULL , + [module_display] [int] DEFAULT (1) NOT NULL , + [module_basename] [varchar] (255) DEFAULT ('') NOT NULL , + [module_class] [varchar] (10) DEFAULT ('') NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , + [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , + [module_auth] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_modules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED + ( + [module_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [module_enabled] ON [phpbb_modules]([module_enabled]) ON [PRIMARY] +GO + +CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE [phpbb_poll_options] ( + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , + [poll_option_total] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [poll_opt_id] ON [phpbb_poll_options]([poll_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_options]([topic_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE [phpbb_poll_votes] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [vote_user_id] [int] DEFAULT (0) NOT NULL , + [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_votes]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_id] ON [phpbb_poll_votes]([vote_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_ip] ON [phpbb_poll_votes]([vote_user_ip]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE [phpbb_posts] ( + [post_id] [int] IDENTITY (1, 1) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [poster_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [post_time] [int] DEFAULT (0) NOT NULL , + [post_approved] [int] DEFAULT (1) NOT NULL , + [post_reported] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [post_username] [varchar] (255) DEFAULT ('') NOT NULL , + [post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [post_text] [text] DEFAULT ('') NOT NULL , + [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , + [post_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [post_postcount] [int] DEFAULT (1) NOT NULL , + [post_edit_time] [int] DEFAULT (0) NOT NULL , + [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [post_edit_user] [int] DEFAULT (0) NOT NULL , + [post_edit_count] [int] DEFAULT (0) NOT NULL , + [post_edit_locked] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED + ( + [post_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_posts]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_ip] ON [phpbb_posts]([poster_ip]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_approved] ON [phpbb_posts]([post_approved]) ON [PRIMARY] +GO + +CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] +GO + +CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE [phpbb_privmsgs] ( + [msg_id] [int] IDENTITY (1, 1) NOT NULL , + [root_level] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [author_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [message_time] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [message_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [message_text] [text] DEFAULT ('') NOT NULL , + [message_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [message_edit_user] [int] DEFAULT (0) NOT NULL , + [message_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [message_edit_time] [int] DEFAULT (0) NOT NULL , + [message_edit_count] [int] DEFAULT (0) NOT NULL , + [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [message_reported] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED + ( + [msg_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] +GO + +CREATE INDEX [message_time] ON [phpbb_privmsgs]([message_time]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [root_level] ON [phpbb_privmsgs]([root_level]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE TABLE [phpbb_privmsgs_folder] ( + [folder_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , + [pm_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED + ( + [folder_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE TABLE [phpbb_privmsgs_rules] ( + [rule_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [rule_check] [int] DEFAULT (0) NOT NULL , + [rule_connection] [int] DEFAULT (0) NOT NULL , + [rule_string] [varchar] (255) DEFAULT ('') NOT NULL , + [rule_user_id] [int] DEFAULT (0) NOT NULL , + [rule_group_id] [int] DEFAULT (0) NOT NULL , + [rule_action] [int] DEFAULT (0) NOT NULL , + [rule_folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED + ( + [rule_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE [phpbb_privmsgs_to] ( + [msg_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [pm_deleted] [int] DEFAULT (0) NOT NULL , + [pm_new] [int] DEFAULT (1) NOT NULL , + [pm_unread] [int] DEFAULT (1) NOT NULL , + [pm_replied] [int] DEFAULT (0) NOT NULL , + [pm_marked] [int] DEFAULT (0) NOT NULL , + [pm_forwarded] [int] DEFAULT (0) NOT NULL , + [folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [msg_id] ON [phpbb_privmsgs_to]([msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs_to]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [usr_flder_id] ON [phpbb_privmsgs_to]([user_id], [folder_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE [phpbb_profile_fields] ( + [field_id] [int] IDENTITY (1, 1) NOT NULL , + [field_name] [varchar] (255) DEFAULT ('') NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [field_ident] [varchar] (20) DEFAULT ('') NOT NULL , + [field_length] [varchar] (20) DEFAULT ('') NOT NULL , + [field_minlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_maxlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_novalue] [varchar] (255) DEFAULT ('') NOT NULL , + [field_default_value] [varchar] (255) DEFAULT ('') NOT NULL , + [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , + [field_required] [int] DEFAULT (0) NOT NULL , + [field_show_novalue] [int] DEFAULT (0) NOT NULL , + [field_show_on_reg] [int] DEFAULT (0) NOT NULL , + [field_show_on_pm] [int] DEFAULT (0) NOT NULL , + [field_show_on_vt] [int] DEFAULT (0) NOT NULL , + [field_show_profile] [int] DEFAULT (0) NOT NULL , + [field_hide] [int] DEFAULT (0) NOT NULL , + [field_no_view] [int] DEFAULT (0) NOT NULL , + [field_active] [int] DEFAULT (0) NOT NULL , + [field_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED + ( + [field_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] +GO + +CREATE INDEX [fld_ordr] ON [phpbb_profile_fields]([field_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE [phpbb_profile_fields_data] ( + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE [phpbb_profile_fields_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [option_id] [int] DEFAULT (0) NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [lang_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id], + [option_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE [phpbb_profile_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , + [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE [phpbb_ranks] ( + [rank_id] [int] IDENTITY (1, 1) NOT NULL , + [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , + [rank_min] [int] DEFAULT (0) NOT NULL , + [rank_special] [int] DEFAULT (0) NOT NULL , + [rank_image] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED + ( + [rank_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE [phpbb_reports] ( + [report_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [pm_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [report_closed] [int] DEFAULT (0) NOT NULL , + [report_time] [int] DEFAULT (0) NOT NULL , + [report_text] [text] DEFAULT ('') NOT NULL , + [reported_post_text] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED + ( + [report_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] +GO + +CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE [phpbb_reports_reasons] ( + [reason_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , + [reason_description] [text] DEFAULT ('') NOT NULL , + [reason_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED + ( + [reason_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE [phpbb_search_results] ( + [search_key] [varchar] (32) DEFAULT ('') NOT NULL , + [search_time] [int] DEFAULT (0) NOT NULL , + [search_keywords] [text] DEFAULT ('') NOT NULL , + [search_authors] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED + ( + [search_key] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE [phpbb_search_wordlist] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word_text] [varchar] (255) DEFAULT ('') NOT NULL , + [word_common] [int] DEFAULT (0) NOT NULL , + [word_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] +GO + +CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE [phpbb_search_wordmatch] ( + [post_id] [int] DEFAULT (0) NOT NULL , + [word_id] [int] DEFAULT (0) NOT NULL , + [title_match] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [unq_mtch] ON [phpbb_search_wordmatch]([word_id], [post_id], [title_match]) ON [PRIMARY] +GO + +CREATE INDEX [word_id] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE [phpbb_sessions] ( + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [session_user_id] [int] DEFAULT (0) NOT NULL , + [session_forum_id] [int] DEFAULT (0) NOT NULL , + [session_last_visit] [int] DEFAULT (0) NOT NULL , + [session_start] [int] DEFAULT (0) NOT NULL , + [session_time] [int] DEFAULT (0) NOT NULL , + [session_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [session_browser] [varchar] (150) DEFAULT ('') NOT NULL , + [session_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , + [session_page] [varchar] (255) DEFAULT ('') NOT NULL , + [session_viewonline] [int] DEFAULT (1) NOT NULL , + [session_autologin] [int] DEFAULT (0) NOT NULL , + [session_admin] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED + ( + [session_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] +GO + +CREATE INDEX [session_user_id] ON [phpbb_sessions]([session_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [session_fid] ON [phpbb_sessions]([session_forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE [phpbb_sessions_keys] ( + [key_id] [char] (32) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [last_login] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED + ( + [key_id], + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sitelist' +*/ +CREATE TABLE [phpbb_sitelist] ( + [site_id] [int] IDENTITY (1, 1) NOT NULL , + [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , + [ip_exclude] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED + ( + [site_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE [phpbb_smilies] ( + [smiley_id] [int] IDENTITY (1, 1) NOT NULL , + [code] [varchar] (50) DEFAULT ('') NOT NULL , + [emotion] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_url] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_width] [int] DEFAULT (0) NOT NULL , + [smiley_height] [int] DEFAULT (0) NOT NULL , + [smiley_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED + ( + [smiley_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE [phpbb_styles] ( + [style_id] [int] IDENTITY (1, 1) NOT NULL , + [style_name] [varchar] (255) DEFAULT ('') NOT NULL , + [style_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [style_active] [int] DEFAULT (1) NOT NULL , + [style_path] [varchar] (100) DEFAULT ('') NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , + [style_parent_id] [int] DEFAULT (0) NOT NULL , + [style_parent_tree] [varchar] (8000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED + ( + [style_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE [phpbb_topics] ( + [topic_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [topic_attachment] [int] DEFAULT (0) NOT NULL , + [topic_approved] [int] DEFAULT (1) NOT NULL , + [topic_reported] [int] DEFAULT (0) NOT NULL , + [topic_title] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_poster] [int] DEFAULT (0) NOT NULL , + [topic_time] [int] DEFAULT (0) NOT NULL , + [topic_time_limit] [int] DEFAULT (0) NOT NULL , + [topic_views] [int] DEFAULT (0) NOT NULL , + [topic_replies] [int] DEFAULT (0) NOT NULL , + [topic_replies_real] [int] DEFAULT (0) NOT NULL , + [topic_status] [int] DEFAULT (0) NOT NULL , + [topic_type] [int] DEFAULT (0) NOT NULL , + [topic_first_post_id] [int] DEFAULT (0) NOT NULL , + [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_post_time] [int] DEFAULT (0) NOT NULL , + [topic_last_view_time] [int] DEFAULT (0) NOT NULL , + [topic_moved_id] [int] DEFAULT (0) NOT NULL , + [topic_bumped] [int] DEFAULT (0) NOT NULL , + [topic_bumper] [int] DEFAULT (0) NOT NULL , + [poll_title] [varchar] (255) DEFAULT ('') NOT NULL , + [poll_start] [int] DEFAULT (0) NOT NULL , + [poll_length] [int] DEFAULT (0) NOT NULL , + [poll_max_options] [int] DEFAULT (1) NOT NULL , + [poll_last_vote] [int] DEFAULT (0) NOT NULL , + [poll_vote_change] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED + ( + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id_type] ON [phpbb_topics]([forum_id], [topic_type]) ON [PRIMARY] +GO + +CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY] +GO + +CREATE INDEX [topic_approved] ON [phpbb_topics]([topic_approved]) ON [PRIMARY] +GO + +CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_approved], [topic_last_post_id]) ON [PRIMARY] +GO + +CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE [phpbb_topics_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_topics_track]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE [phpbb_topics_posted] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [topic_posted] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE [phpbb_topics_watch] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_topics_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE [phpbb_user_group] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [group_leader] [int] DEFAULT (0) NOT NULL , + [user_pending] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_user_group]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_user_group]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [group_leader] ON [phpbb_user_group]([group_leader]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE [phpbb_users] ( + [user_id] [int] IDENTITY (1, 1) NOT NULL , + [user_type] [int] DEFAULT (0) NOT NULL , + [group_id] [int] DEFAULT (3) NOT NULL , + [user_permissions] [text] DEFAULT ('') NOT NULL , + [user_perm_from] [int] DEFAULT (0) NOT NULL , + [user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [user_regdate] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [username_clean] [varchar] (255) DEFAULT ('') NOT NULL , + [user_password] [varchar] (40) DEFAULT ('') NOT NULL , + [user_passchg] [int] DEFAULT (0) NOT NULL , + [user_pass_convert] [int] DEFAULT (0) NOT NULL , + [user_email] [varchar] (100) DEFAULT ('') NOT NULL , + [user_email_hash] [float] DEFAULT (0) NOT NULL , + [user_birthday] [varchar] (10) DEFAULT ('') NOT NULL , + [user_lastvisit] [int] DEFAULT (0) NOT NULL , + [user_lastmark] [int] DEFAULT (0) NOT NULL , + [user_lastpost_time] [int] DEFAULT (0) NOT NULL , + [user_lastpage] [varchar] (200) DEFAULT ('') NOT NULL , + [user_last_confirm_key] [varchar] (10) DEFAULT ('') NOT NULL , + [user_last_search] [int] DEFAULT (0) NOT NULL , + [user_warnings] [int] DEFAULT (0) NOT NULL , + [user_last_warning] [int] DEFAULT (0) NOT NULL , + [user_login_attempts] [int] DEFAULT (0) NOT NULL , + [user_inactive_reason] [int] DEFAULT (0) NOT NULL , + [user_inactive_time] [int] DEFAULT (0) NOT NULL , + [user_posts] [int] DEFAULT (0) NOT NULL , + [user_lang] [varchar] (30) DEFAULT ('') NOT NULL , + [user_timezone] [varchar] (100) DEFAULT ('UTC') NOT NULL , + [user_dateformat] [varchar] (30) DEFAULT ('d M Y H:i') NOT NULL , + [user_style] [int] DEFAULT (0) NOT NULL , + [user_rank] [int] DEFAULT (0) NOT NULL , + [user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [user_new_privmsg] [int] DEFAULT (0) NOT NULL , + [user_unread_privmsg] [int] DEFAULT (0) NOT NULL , + [user_last_privmsg] [int] DEFAULT (0) NOT NULL , + [user_message_rules] [int] DEFAULT (0) NOT NULL , + [user_full_folder] [int] DEFAULT (-3) NOT NULL , + [user_emailtime] [int] DEFAULT (0) NOT NULL , + [user_topic_show_days] [int] DEFAULT (0) NOT NULL , + [user_topic_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_topic_sortby_dir] [varchar] (1) DEFAULT ('d') NOT NULL , + [user_post_show_days] [int] DEFAULT (0) NOT NULL , + [user_post_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_post_sortby_dir] [varchar] (1) DEFAULT ('a') NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [user_notify_pm] [int] DEFAULT (1) NOT NULL , + [user_notify_type] [int] DEFAULT (0) NOT NULL , + [user_allow_pm] [int] DEFAULT (1) NOT NULL , + [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , + [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , + [user_allow_massemail] [int] DEFAULT (1) NOT NULL , + [user_options] [int] DEFAULT (230271) NOT NULL , + [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [user_avatar_type] [int] DEFAULT (0) NOT NULL , + [user_avatar_width] [int] DEFAULT (0) NOT NULL , + [user_avatar_height] [int] DEFAULT (0) NOT NULL , + [user_sig] [text] DEFAULT ('') NOT NULL , + [user_sig_bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [user_sig_bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [user_from] [varchar] (100) DEFAULT ('') NOT NULL , + [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , + [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_yim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_msnm] [varchar] (255) DEFAULT ('') NOT NULL , + [user_jabber] [varchar] (255) DEFAULT ('') NOT NULL , + [user_website] [varchar] (200) DEFAULT ('') NOT NULL , + [user_occ] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , + [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , + [user_new] [int] DEFAULT (1) NOT NULL , + [user_reminded] [int] DEFAULT (0) NOT NULL , + [user_reminded_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] +GO + +CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] +GO + +CREATE INDEX [user_type] ON [phpbb_users]([user_type]) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [username_clean] ON [phpbb_users]([username_clean]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE [phpbb_warnings] ( + [warning_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [log_id] [int] DEFAULT (0) NOT NULL , + [warning_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED + ( + [warning_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE [phpbb_words] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word] [varchar] (255) DEFAULT ('') NOT NULL , + [replacement] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE [phpbb_zebra] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [zebra_id] [int] DEFAULT (0) NOT NULL , + [friend] [int] DEFAULT (0) NOT NULL , + [foe] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED + ( + [user_id], + [zebra_id] + ) ON [PRIMARY] +GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index e71afcd5b3..8f2b779649 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -1,978 +1,976 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, - post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - physical_filename varbinary(255) DEFAULT '' NOT NULL, - real_filename varbinary(255) DEFAULT '' NOT NULL, - download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - attach_comment blob NOT NULL, - extension varbinary(100) DEFAULT '' NOT NULL, - mimetype varbinary(100) DEFAULT '' NOT NULL, - filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, - thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (attach_id), - KEY filetime (filetime), - KEY post_msg_id (post_msg_id), - KEY topic_id (topic_id), - KEY poster_id (poster_id), - KEY is_orphan (is_orphan) -); - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY group_id (group_id), - KEY auth_opt_id (auth_option_id), - KEY auth_role_id (auth_role_id) -); - - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, - auth_option varbinary(50) DEFAULT '' NOT NULL, - is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (auth_option_id), - UNIQUE auth_option (auth_option) -); - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id mediumint(8) UNSIGNED NOT NULL auto_increment, - role_name blob NOT NULL, - role_description blob NOT NULL, - role_type varbinary(10) DEFAULT '' NOT NULL, - role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id), - KEY role_type (role_type), - KEY role_order (role_order) -); - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id), - KEY ath_op_id (auth_option_id) -); - - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY user_id (user_id), - KEY auth_option_id (auth_option_id), - KEY auth_role_id (auth_role_id) -); - - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, - ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - ban_ip varbinary(40) DEFAULT '' NOT NULL, - ban_email blob NOT NULL, - ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ban_reason blob NOT NULL, - ban_give_reason blob NOT NULL, - PRIMARY KEY (ban_id), - KEY ban_end (ban_end), - KEY ban_user (ban_userid, ban_exclude), - KEY ban_email (ban_email(255), ban_exclude), - KEY ban_ip (ban_ip, ban_exclude) -); - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_tag varbinary(16) DEFAULT '' NOT NULL, - bbcode_helpline blob NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_match blob NOT NULL, - bbcode_tpl mediumblob NOT NULL, - first_pass_match mediumblob NOT NULL, - first_pass_replace mediumblob NOT NULL, - second_pass_match mediumblob NOT NULL, - second_pass_replace mediumblob NOT NULL, - PRIMARY KEY (bbcode_id), - KEY display_on_post (display_on_posting) -); - - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id, user_id) -); - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, - bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - bot_name blob NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - bot_agent varbinary(255) DEFAULT '' NOT NULL, - bot_ip varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id), - KEY bot_active (bot_active) -); - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varbinary(255) DEFAULT '' NOT NULL, - config_value blob NOT NULL, - is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (config_name), - KEY is_dynamic (is_dynamic) -); - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id binary(32) DEFAULT '' NOT NULL, - session_id binary(32) DEFAULT '' NOT NULL, - confirm_type tinyint(3) DEFAULT '0' NOT NULL, - code varbinary(8) DEFAULT '' NOT NULL, - seed int(10) UNSIGNED DEFAULT '0' NOT NULL, - attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id, confirm_id), - KEY confirm_type (confirm_type) -); - - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, - disallow_username blob NOT NULL, - PRIMARY KEY (disallow_id) -); - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - draft_subject blob NOT NULL, - draft_message mediumblob NOT NULL, - PRIMARY KEY (draft_id), - KEY save_time (save_time) -); - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varbinary(255) DEFAULT '' NOT NULL, - ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ext_state blob NOT NULL, - UNIQUE ext_name (ext_name) -); - - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - extension varbinary(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -); - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_name blob NOT NULL, - cat_id tinyint(2) DEFAULT '0' NOT NULL, - allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - upload_icon varbinary(255) DEFAULT '' NOT NULL, - max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - allowed_forums blob NOT NULL, - allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id) -); - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_parents mediumblob NOT NULL, - forum_name blob NOT NULL, - forum_desc blob NOT NULL, - forum_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, - forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_desc_uid varbinary(8) DEFAULT '' NOT NULL, - forum_link blob NOT NULL, - forum_password varbinary(120) DEFAULT '' NOT NULL, - forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_image varbinary(255) DEFAULT '' NOT NULL, - forum_rules blob NOT NULL, - forum_rules_link blob NOT NULL, - forum_rules_bitfield varbinary(255) DEFAULT '' NOT NULL, - forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_rules_uid varbinary(8) DEFAULT '' NOT NULL, - forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, - forum_type tinyint(4) DEFAULT '0' NOT NULL, - forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_subject blob NOT NULL, - forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_name blob NOT NULL, - forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, - forum_flags tinyint(4) DEFAULT '32' NOT NULL, - forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, - display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, - prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (forum_id), - KEY left_right_id (left_id, right_id), - KEY forum_lastpost_id (forum_last_post_id) -); - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_id binary(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -); - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, forum_id) -); - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY forum_id (forum_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -); - - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_type tinyint(4) DEFAULT '1' NOT NULL, - group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_name blob NOT NULL, - group_desc blob NOT NULL, - group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, - group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - group_desc_uid varbinary(8) DEFAULT '' NOT NULL, - group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar varbinary(255) DEFAULT '' NOT NULL, - group_avatar_type tinyint(2) DEFAULT '0' NOT NULL, - group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_colour varbinary(6) DEFAULT '' NOT NULL, - group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id), - KEY group_legend_name (group_legend, group_name(255)) -); - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, - icons_url varbinary(255) DEFAULT '' NOT NULL, - icons_width tinyint(4) DEFAULT '0' NOT NULL, - icons_height tinyint(4) DEFAULT '0' NOT NULL, - icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (icons_id), - KEY display_on_posting (display_on_posting) -); - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id tinyint(4) NOT NULL auto_increment, - lang_iso varbinary(30) DEFAULT '' NOT NULL, - lang_dir varbinary(30) DEFAULT '' NOT NULL, - lang_english_name blob NOT NULL, - lang_local_name blob NOT NULL, - lang_author blob NOT NULL, - PRIMARY KEY (lang_id), - KEY lang_iso (lang_iso) -); - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id mediumint(8) UNSIGNED NOT NULL auto_increment, - log_type tinyint(4) DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_ip varbinary(40) DEFAULT '' NOT NULL, - log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - log_operation blob NOT NULL, - log_data mediumblob NOT NULL, - PRIMARY KEY (log_id), - KEY log_type (log_type), - KEY log_time (log_time), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY reportee_id (reportee_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varbinary(40) DEFAULT '' NOT NULL, - attempt_browser varbinary(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL, - attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - username_clean blob NOT NULL, - KEY att_ip (attempt_ip, attempt_time), - KEY att_for (attempt_forwarded_for, attempt_time), - KEY att_time (attempt_time), - KEY user_id (user_id) -); - - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_name blob NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY disp_idx (display_on_index), - KEY forum_id (forum_id) -); - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id mediumint(8) UNSIGNED NOT NULL auto_increment, - module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_basename varbinary(255) DEFAULT '' NOT NULL, - module_class varbinary(10) DEFAULT '' NOT NULL, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - module_langname varbinary(255) DEFAULT '' NOT NULL, - module_mode varbinary(255) DEFAULT '' NOT NULL, - module_auth varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id), - KEY left_right_id (left_id, right_id), - KEY module_enabled (module_enabled), - KEY class_left_id (module_class, left_id) -); - - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_text blob NOT NULL, - poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - KEY poll_opt_id (poll_option_id), - KEY topic_id (topic_id) -); - - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - vote_user_ip varbinary(40) DEFAULT '' NOT NULL, - KEY topic_id (topic_id), - KEY vote_user_id (vote_user_id), - KEY vote_user_ip (vote_user_ip) -); - - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id mediumint(8) UNSIGNED NOT NULL auto_increment, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_ip varbinary(40) DEFAULT '' NOT NULL, - post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_username blob NOT NULL, - post_subject blob NOT NULL, - post_text mediumblob NOT NULL, - post_checksum varbinary(32) DEFAULT '' NOT NULL, - post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_reason blob NOT NULL, - post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (post_id), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY poster_ip (poster_ip), - KEY poster_id (poster_id), - KEY post_approved (post_approved), - KEY post_username (post_username(255)), - KEY tid_post_time (topic_id, post_time) -); - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, - root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_ip varbinary(40) DEFAULT '' NOT NULL, - message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - message_subject blob NOT NULL, - message_text mediumblob NOT NULL, - message_edit_reason blob NOT NULL, - message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - to_address blob NOT NULL, - bcc_address blob NOT NULL, - message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (msg_id), - KEY author_ip (author_ip), - KEY message_time (message_time), - KEY author_id (author_id), - KEY root_level (root_level) -); - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - folder_name blob NOT NULL, - pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (folder_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_string blob NOT NULL, - rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_folder_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - folder_id int(11) DEFAULT '0' NOT NULL, - KEY msg_id (msg_id), - KEY author_id (author_id), - KEY usr_flder_id (user_id, folder_id) -); - - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id mediumint(8) UNSIGNED NOT NULL auto_increment, - field_name blob NOT NULL, - field_type tinyint(4) DEFAULT '0' NOT NULL, - field_ident varbinary(20) DEFAULT '' NOT NULL, - field_length varbinary(20) DEFAULT '' NOT NULL, - field_minlen varbinary(255) DEFAULT '' NOT NULL, - field_maxlen varbinary(255) DEFAULT '' NOT NULL, - field_novalue blob NOT NULL, - field_default_value blob NOT NULL, - field_validation varbinary(60) DEFAULT '' NOT NULL, - field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (field_id), - KEY fld_type (field_type), - KEY fld_ordr (field_order) -); - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id) -); - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - field_type tinyint(4) DEFAULT '0' NOT NULL, - lang_value blob NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -); - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_name blob NOT NULL, - lang_explain blob NOT NULL, - lang_default_value blob NOT NULL, - PRIMARY KEY (field_id, lang_id) -); - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, - rank_title blob NOT NULL, - rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - rank_image varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -); - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id mediumint(8) UNSIGNED NOT NULL auto_increment, - reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - report_text mediumblob NOT NULL, - reported_post_text mediumblob NOT NULL, - PRIMARY KEY (report_id), - KEY post_id (post_id), - KEY pm_id (pm_id) -); - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id smallint(4) UNSIGNED NOT NULL auto_increment, - reason_title blob NOT NULL, - reason_description mediumblob NOT NULL, - reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (reason_id) -); - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varbinary(32) DEFAULT '' NOT NULL, - search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - search_keywords mediumblob NOT NULL, - search_authors mediumblob NOT NULL, - PRIMARY KEY (search_key) -); - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word_text blob NOT NULL, - word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (word_id), - UNIQUE wrd_txt (word_text(255)), - KEY wrd_cnt (word_count) -); - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE unq_mtch (word_id, post_id, title_match), - KEY word_id (word_id), - KEY post_id (post_id) -); - - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id binary(32) DEFAULT '' NOT NULL, - session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_ip varbinary(40) DEFAULT '' NOT NULL, - session_browser varbinary(150) DEFAULT '' NOT NULL, - session_forwarded_for varbinary(255) DEFAULT '' NOT NULL, - session_page blob NOT NULL, - session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id), - KEY session_time (session_time), - KEY session_user_id (session_user_id), - KEY session_fid (session_forum_id) -); - - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id binary(32) DEFAULT '' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - last_ip varbinary(40) DEFAULT '' NOT NULL, - last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (key_id, user_id), - KEY last_login (last_login) -); - - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id mediumint(8) UNSIGNED NOT NULL auto_increment, - site_ip varbinary(40) DEFAULT '' NOT NULL, - site_hostname varbinary(255) DEFAULT '' NOT NULL, - ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (site_id) -); - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, - code varbinary(150) DEFAULT '' NOT NULL, - emotion varbinary(150) DEFAULT '' NOT NULL, - smiley_url varbinary(50) DEFAULT '' NOT NULL, - smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (smiley_id), - KEY display_on_post (display_on_posting) -); - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id mediumint(8) UNSIGNED NOT NULL auto_increment, - style_name blob NOT NULL, - style_copyright blob NOT NULL, - style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - style_path varbinary(100) DEFAULT '' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, - style_parent_tree blob NOT NULL, - PRIMARY KEY (style_id), - UNIQUE style_name (style_name(255)) -); - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_title blob NOT NULL, - topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_status tinyint(3) DEFAULT '0' NOT NULL, - topic_type tinyint(3) DEFAULT '0' NOT NULL, - topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_first_poster_name blob NOT NULL, - topic_first_poster_colour varbinary(6) DEFAULT '' NOT NULL, - topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_name blob NOT NULL, - topic_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, - topic_last_post_subject blob NOT NULL, - topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_title blob NOT NULL, - poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_max_options tinyint(4) DEFAULT '1' NOT NULL, - poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id), - KEY forum_id (forum_id), - KEY forum_id_type (forum_id, topic_type), - KEY last_post_time (topic_last_post_time), - KEY topic_approved (topic_approved), - KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id), - KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) -); - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id), - KEY topic_id (topic_id), - KEY forum_id (forum_id) -); - - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id) -); - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY topic_id (topic_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -); - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY group_id (group_id), - KEY user_id (user_id), - KEY group_leader (group_leader) -); - - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_type tinyint(2) DEFAULT '0' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, - user_permissions mediumblob NOT NULL, - user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_ip varbinary(40) DEFAULT '' NOT NULL, - user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - username_clean blob NOT NULL, - user_password varbinary(120) DEFAULT '' NOT NULL, - user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_email blob NOT NULL, - user_email_hash bigint(20) DEFAULT '0' NOT NULL, - user_birthday varbinary(10) DEFAULT '' NOT NULL, - user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpage blob NOT NULL, - user_last_confirm_key varbinary(10) DEFAULT '' NOT NULL, - user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_warnings tinyint(4) DEFAULT '0' NOT NULL, - user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, - user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, - user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_lang varbinary(30) DEFAULT '' NOT NULL, - user_timezone varbinary(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varbinary(90) DEFAULT 'd M Y H:i' NOT NULL, - user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_colour varbinary(6) DEFAULT '' NOT NULL, - user_new_privmsg int(4) DEFAULT '0' NOT NULL, - user_unread_privmsg int(4) DEFAULT '0' NOT NULL, - user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_full_folder int(11) DEFAULT '-3' NOT NULL, - user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_sortby_type varbinary(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varbinary(1) DEFAULT 'd' NOT NULL, - user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_post_sortby_type varbinary(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varbinary(1) DEFAULT 'a' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_notify_type tinyint(4) DEFAULT '0' NOT NULL, - user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, - user_avatar varbinary(255) DEFAULT '' NOT NULL, - user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, - user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_sig mediumblob NOT NULL, - user_sig_bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - user_from blob NOT NULL, - user_icq varbinary(15) DEFAULT '' NOT NULL, - user_aim blob NOT NULL, - user_yim blob NOT NULL, - user_msnm blob NOT NULL, - user_jabber blob NOT NULL, - user_website blob NOT NULL, - user_occ blob NOT NULL, - user_interests blob NOT NULL, - user_actkey varbinary(32) DEFAULT '' NOT NULL, - user_newpasswd varbinary(120) DEFAULT '' NOT NULL, - user_form_salt varbinary(96) DEFAULT '' NOT NULL, - user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_reminded tinyint(4) DEFAULT '0' NOT NULL, - user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id), - KEY user_birthday (user_birthday), - KEY user_email_hash (user_email_hash), - KEY user_type (user_type), - UNIQUE username_clean (username_clean(255)) -); - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (warning_id) -); - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word blob NOT NULL, - replacement blob NOT NULL, - PRIMARY KEY (word_id) -); - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, zebra_id) -); - - +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + physical_filename varbinary(255) DEFAULT '' NOT NULL, + real_filename varbinary(255) DEFAULT '' NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_comment blob NOT NULL, + extension varbinary(100) DEFAULT '' NOT NULL, + mimetype varbinary(100) DEFAULT '' NOT NULL, + filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, + thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id), + KEY filetime (filetime), + KEY post_msg_id (post_msg_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY is_orphan (is_orphan) +); + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY group_id (group_id), + KEY auth_opt_id (auth_option_id), + KEY auth_role_id (auth_role_id) +); + + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, + auth_option varbinary(50) DEFAULT '' NOT NULL, + is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + UNIQUE auth_option (auth_option) +); + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + role_name blob NOT NULL, + role_description blob NOT NULL, + role_type varbinary(10) DEFAULT '' NOT NULL, + role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id), + KEY role_type (role_type), + KEY role_order (role_order) +); + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id), + KEY ath_op_id (auth_option_id) +); + + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY user_id (user_id), + KEY auth_option_id (auth_option_id), + KEY auth_role_id (auth_role_id) +); + + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + ban_ip varbinary(40) DEFAULT '' NOT NULL, + ban_email blob NOT NULL, + ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ban_reason blob NOT NULL, + ban_give_reason blob NOT NULL, + PRIMARY KEY (ban_id), + KEY ban_end (ban_end), + KEY ban_user (ban_userid, ban_exclude), + KEY ban_email (ban_email(255), ban_exclude), + KEY ban_ip (ban_ip, ban_exclude) +); + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_tag varbinary(16) DEFAULT '' NOT NULL, + bbcode_helpline blob NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_match blob NOT NULL, + bbcode_tpl mediumblob NOT NULL, + first_pass_match mediumblob NOT NULL, + first_pass_replace mediumblob NOT NULL, + second_pass_match mediumblob NOT NULL, + second_pass_replace mediumblob NOT NULL, + PRIMARY KEY (bbcode_id), + KEY display_on_post (display_on_posting) +); + + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id, user_id) +); + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, + bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + bot_name blob NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bot_agent varbinary(255) DEFAULT '' NOT NULL, + bot_ip varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id), + KEY bot_active (bot_active) +); + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varbinary(255) DEFAULT '' NOT NULL, + config_value blob NOT NULL, + is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +); + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id binary(32) DEFAULT '' NOT NULL, + session_id binary(32) DEFAULT '' NOT NULL, + confirm_type tinyint(3) DEFAULT '0' NOT NULL, + code varbinary(8) DEFAULT '' NOT NULL, + seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id, confirm_id), + KEY confirm_type (confirm_type) +); + + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username blob NOT NULL, + PRIMARY KEY (disallow_id) +); + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + draft_subject blob NOT NULL, + draft_message mediumblob NOT NULL, + PRIMARY KEY (draft_id), + KEY save_time (save_time) +); + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varbinary(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state blob NOT NULL, + UNIQUE ext_name (ext_name) +); + + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + extension varbinary(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +); + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_name blob NOT NULL, + cat_id tinyint(2) DEFAULT '0' NOT NULL, + allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + upload_icon varbinary(255) DEFAULT '' NOT NULL, + max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + allowed_forums blob NOT NULL, + allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id) +); + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_parents mediumblob NOT NULL, + forum_name blob NOT NULL, + forum_desc blob NOT NULL, + forum_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_desc_uid varbinary(8) DEFAULT '' NOT NULL, + forum_link blob NOT NULL, + forum_password varbinary(120) DEFAULT '' NOT NULL, + forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_image varbinary(255) DEFAULT '' NOT NULL, + forum_rules blob NOT NULL, + forum_rules_link blob NOT NULL, + forum_rules_bitfield varbinary(255) DEFAULT '' NOT NULL, + forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_rules_uid varbinary(8) DEFAULT '' NOT NULL, + forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, + forum_type tinyint(4) DEFAULT '0' NOT NULL, + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject blob NOT NULL, + forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_name blob NOT NULL, + forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, + forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, + display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, + prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_right_id (left_id, right_id), + KEY forum_lastpost_id (forum_last_post_id) +); + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id binary(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +); + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, forum_id) +); + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +); + + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_name blob NOT NULL, + group_desc blob NOT NULL, + group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + group_desc_uid varbinary(8) DEFAULT '' NOT NULL, + group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar varbinary(255) DEFAULT '' NOT NULL, + group_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_colour varbinary(6) DEFAULT '' NOT NULL, + group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id), + KEY group_legend_name (group_legend, group_name(255)) +); + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, + icons_url varbinary(255) DEFAULT '' NOT NULL, + icons_width tinyint(4) DEFAULT '0' NOT NULL, + icons_height tinyint(4) DEFAULT '0' NOT NULL, + icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (icons_id), + KEY display_on_posting (display_on_posting) +); + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id tinyint(4) NOT NULL auto_increment, + lang_iso varbinary(30) DEFAULT '' NOT NULL, + lang_dir varbinary(30) DEFAULT '' NOT NULL, + lang_english_name blob NOT NULL, + lang_local_name blob NOT NULL, + lang_author blob NOT NULL, + PRIMARY KEY (lang_id), + KEY lang_iso (lang_iso) +); + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id mediumint(8) UNSIGNED NOT NULL auto_increment, + log_type tinyint(4) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_ip varbinary(40) DEFAULT '' NOT NULL, + log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + log_operation blob NOT NULL, + log_data mediumblob NOT NULL, + PRIMARY KEY (log_id), + KEY log_type (log_type), + KEY log_time (log_time), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY reportee_id (reportee_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varbinary(40) DEFAULT '' NOT NULL, + attempt_browser varbinary(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL, + attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + username_clean blob NOT NULL, + KEY att_ip (attempt_ip, attempt_time), + KEY att_for (attempt_forwarded_for, attempt_time), + KEY att_time (attempt_time), + KEY user_id (user_id) +); + + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name blob NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY disp_idx (display_on_index), + KEY forum_id (forum_id) +); + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id mediumint(8) UNSIGNED NOT NULL auto_increment, + module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_basename varbinary(255) DEFAULT '' NOT NULL, + module_class varbinary(10) DEFAULT '' NOT NULL, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + module_langname varbinary(255) DEFAULT '' NOT NULL, + module_mode varbinary(255) DEFAULT '' NOT NULL, + module_auth varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id), + KEY left_right_id (left_id, right_id), + KEY module_enabled (module_enabled), + KEY class_left_id (module_class, left_id) +); + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_text blob NOT NULL, + poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + KEY poll_opt_id (poll_option_id), + KEY topic_id (topic_id) +); + + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + vote_user_ip varbinary(40) DEFAULT '' NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +); + + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varbinary(40) DEFAULT '' NOT NULL, + post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_username blob NOT NULL, + post_subject blob NOT NULL, + post_text mediumblob NOT NULL, + post_checksum varbinary(32) DEFAULT '' NOT NULL, + post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_reason blob NOT NULL, + post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_ip (poster_ip), + KEY poster_id (poster_id), + KEY post_approved (post_approved), + KEY post_username (post_username(255)), + KEY tid_post_time (topic_id, post_time) +); + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, + root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_ip varbinary(40) DEFAULT '' NOT NULL, + message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + message_subject blob NOT NULL, + message_text mediumblob NOT NULL, + message_edit_reason blob NOT NULL, + message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + to_address blob NOT NULL, + bcc_address blob NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (msg_id), + KEY author_ip (author_ip), + KEY message_time (message_time), + KEY author_id (author_id), + KEY root_level (root_level) +); + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + folder_name blob NOT NULL, + pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (folder_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_string blob NOT NULL, + rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_folder_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id), + KEY user_id (user_id) +); + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + folder_id int(11) DEFAULT '0' NOT NULL, + KEY msg_id (msg_id), + KEY author_id (author_id), + KEY usr_flder_id (user_id, folder_id) +); + + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id mediumint(8) UNSIGNED NOT NULL auto_increment, + field_name blob NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + field_ident varbinary(20) DEFAULT '' NOT NULL, + field_length varbinary(20) DEFAULT '' NOT NULL, + field_minlen varbinary(255) DEFAULT '' NOT NULL, + field_maxlen varbinary(255) DEFAULT '' NOT NULL, + field_novalue blob NOT NULL, + field_default_value blob NOT NULL, + field_validation varbinary(60) DEFAULT '' NOT NULL, + field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (field_id), + KEY fld_type (field_type), + KEY fld_ordr (field_order) +); + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +); + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + lang_value blob NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +); + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_name blob NOT NULL, + lang_explain blob NOT NULL, + lang_default_value blob NOT NULL, + PRIMARY KEY (field_id, lang_id) +); + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, + rank_title blob NOT NULL, + rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + rank_image varbinary(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +); + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_text mediumblob NOT NULL, + reported_post_text mediumblob NOT NULL, + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) +); + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint(4) UNSIGNED NOT NULL auto_increment, + reason_title blob NOT NULL, + reason_description mediumblob NOT NULL, + reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (reason_id) +); + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varbinary(32) DEFAULT '' NOT NULL, + search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + search_keywords mediumblob NOT NULL, + search_authors mediumblob NOT NULL, + PRIMARY KEY (search_key) +); + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_text blob NOT NULL, + word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (word_id), + UNIQUE wrd_txt (word_text(255)), + KEY wrd_cnt (word_count) +); + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE unq_mtch (word_id, post_id, title_match), + KEY word_id (word_id), + KEY post_id (post_id) +); + + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id binary(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_ip varbinary(40) DEFAULT '' NOT NULL, + session_browser varbinary(150) DEFAULT '' NOT NULL, + session_forwarded_for varbinary(255) DEFAULT '' NOT NULL, + session_page blob NOT NULL, + session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time), + KEY session_user_id (session_user_id), + KEY session_fid (session_forum_id) +); + + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id binary(32) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + last_ip varbinary(40) DEFAULT '' NOT NULL, + last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (key_id, user_id), + KEY last_login (last_login) +); + + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id mediumint(8) UNSIGNED NOT NULL auto_increment, + site_ip varbinary(40) DEFAULT '' NOT NULL, + site_hostname varbinary(255) DEFAULT '' NOT NULL, + ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (site_id) +); + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, + code varbinary(150) DEFAULT '' NOT NULL, + emotion varbinary(150) DEFAULT '' NOT NULL, + smiley_url varbinary(50) DEFAULT '' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smiley_id), + KEY display_on_post (display_on_posting) +); + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id mediumint(8) UNSIGNED NOT NULL auto_increment, + style_name blob NOT NULL, + style_copyright blob NOT NULL, + style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + style_path varbinary(100) DEFAULT '' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, + style_parent_tree blob NOT NULL, + PRIMARY KEY (style_id), + UNIQUE style_name (style_name(255)) +); + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_title blob NOT NULL, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name blob NOT NULL, + topic_first_poster_colour varbinary(6) DEFAULT '' NOT NULL, + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name blob NOT NULL, + topic_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, + topic_last_post_subject blob NOT NULL, + topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title blob NOT NULL, + poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_max_options tinyint(4) DEFAULT '1' NOT NULL, + poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY forum_id_type (forum_id, topic_type), + KEY last_post_time (topic_last_post_time), + KEY topic_approved (topic_approved), + KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id), + KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) +); + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id), + KEY topic_id (topic_id), + KEY forum_id (forum_id) +); + + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id) +); + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +); + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY group_id (group_id), + KEY user_id (user_id), + KEY group_leader (group_leader) +); + + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_type tinyint(2) DEFAULT '0' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, + user_permissions mediumblob NOT NULL, + user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_ip varbinary(40) DEFAULT '' NOT NULL, + user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, + username blob NOT NULL, + username_clean blob NOT NULL, + user_password varbinary(120) DEFAULT '' NOT NULL, + user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_email blob NOT NULL, + user_email_hash bigint(20) DEFAULT '0' NOT NULL, + user_birthday varbinary(10) DEFAULT '' NOT NULL, + user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpage blob NOT NULL, + user_last_confirm_key varbinary(10) DEFAULT '' NOT NULL, + user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_warnings tinyint(4) DEFAULT '0' NOT NULL, + user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, + user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, + user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varbinary(30) DEFAULT '' NOT NULL, + user_timezone varbinary(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varbinary(90) DEFAULT 'd M Y H:i' NOT NULL, + user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_colour varbinary(6) DEFAULT '' NOT NULL, + user_new_privmsg int(4) DEFAULT '0' NOT NULL, + user_unread_privmsg int(4) DEFAULT '0' NOT NULL, + user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_full_folder int(11) DEFAULT '-3' NOT NULL, + user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_sortby_type varbinary(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varbinary(1) DEFAULT 'd' NOT NULL, + user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_post_sortby_type varbinary(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varbinary(1) DEFAULT 'a' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_notify_type tinyint(4) DEFAULT '0' NOT NULL, + user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, + user_avatar varbinary(255) DEFAULT '' NOT NULL, + user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_sig mediumblob NOT NULL, + user_sig_bbcode_uid varbinary(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, + user_from blob NOT NULL, + user_icq varbinary(15) DEFAULT '' NOT NULL, + user_aim blob NOT NULL, + user_yim blob NOT NULL, + user_msnm blob NOT NULL, + user_jabber blob NOT NULL, + user_website blob NOT NULL, + user_occ blob NOT NULL, + user_interests blob NOT NULL, + user_actkey varbinary(32) DEFAULT '' NOT NULL, + user_newpasswd varbinary(120) DEFAULT '' NOT NULL, + user_form_salt varbinary(96) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY user_birthday (user_birthday), + KEY user_email_hash (user_email_hash), + KEY user_type (user_type), + UNIQUE username_clean (username_clean(255)) +); + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +); + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word blob NOT NULL, + replacement blob NOT NULL, + PRIMARY KEY (word_id) +); + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, zebra_id) +); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 20af6f3566..45da3284b7 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -1,978 +1,976 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, - post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - physical_filename varchar(255) DEFAULT '' NOT NULL, - real_filename varchar(255) DEFAULT '' NOT NULL, - download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - attach_comment text NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - mimetype varchar(100) DEFAULT '' NOT NULL, - filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, - thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (attach_id), - KEY filetime (filetime), - KEY post_msg_id (post_msg_id), - KEY topic_id (topic_id), - KEY poster_id (poster_id), - KEY is_orphan (is_orphan) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY group_id (group_id), - KEY auth_opt_id (auth_option_id), - KEY auth_role_id (auth_role_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, - auth_option varchar(50) DEFAULT '' NOT NULL, - is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (auth_option_id), - UNIQUE auth_option (auth_option) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id mediumint(8) UNSIGNED NOT NULL auto_increment, - role_name varchar(255) DEFAULT '' NOT NULL, - role_description text NOT NULL, - role_type varchar(10) DEFAULT '' NOT NULL, - role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id), - KEY role_type (role_type), - KEY role_order (role_order) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id), - KEY ath_op_id (auth_option_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY user_id (user_id), - KEY auth_option_id (auth_option_id), - KEY auth_role_id (auth_role_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, - ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - ban_ip varchar(40) DEFAULT '' NOT NULL, - ban_email varchar(100) DEFAULT '' NOT NULL, - ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ban_reason varchar(255) DEFAULT '' NOT NULL, - ban_give_reason varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (ban_id), - KEY ban_end (ban_end), - KEY ban_user (ban_userid, ban_exclude), - KEY ban_email (ban_email, ban_exclude), - KEY ban_ip (ban_ip, ban_exclude) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_tag varchar(16) DEFAULT '' NOT NULL, - bbcode_helpline varchar(255) DEFAULT '' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_match text NOT NULL, - bbcode_tpl mediumtext NOT NULL, - first_pass_match mediumtext NOT NULL, - first_pass_replace mediumtext NOT NULL, - second_pass_match mediumtext NOT NULL, - second_pass_replace mediumtext NOT NULL, - PRIMARY KEY (bbcode_id), - KEY display_on_post (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id, user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, - bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - bot_name varchar(255) DEFAULT '' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - bot_agent varchar(255) DEFAULT '' NOT NULL, - bot_ip varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id), - KEY bot_active (bot_active) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value varchar(255) DEFAULT '' NOT NULL, - is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (config_name), - KEY is_dynamic (is_dynamic) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - confirm_type tinyint(3) DEFAULT '0' NOT NULL, - code varchar(8) DEFAULT '' NOT NULL, - seed int(10) UNSIGNED DEFAULT '0' NOT NULL, - attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id, confirm_id), - KEY confirm_type (confirm_type) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, - disallow_username varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (disallow_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - draft_subject varchar(255) DEFAULT '' NOT NULL, - draft_message mediumtext NOT NULL, - PRIMARY KEY (draft_id), - KEY save_time (save_time) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varchar(255) DEFAULT '' NOT NULL, - ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ext_state text NOT NULL, - UNIQUE ext_name (ext_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_name varchar(255) DEFAULT '' NOT NULL, - cat_id tinyint(2) DEFAULT '0' NOT NULL, - allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - upload_icon varchar(255) DEFAULT '' NOT NULL, - max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - allowed_forums text NOT NULL, - allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_parents mediumtext NOT NULL, - forum_name varchar(255) DEFAULT '' NOT NULL, - forum_desc text NOT NULL, - forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_desc_uid varchar(8) DEFAULT '' NOT NULL, - forum_link varchar(255) DEFAULT '' NOT NULL, - forum_password varchar(40) DEFAULT '' NOT NULL, - forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_image varchar(255) DEFAULT '' NOT NULL, - forum_rules text NOT NULL, - forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_rules_uid varchar(8) DEFAULT '' NOT NULL, - forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, - forum_type tinyint(4) DEFAULT '0' NOT NULL, - forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, - forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, - forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - forum_flags tinyint(4) DEFAULT '32' NOT NULL, - forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, - display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, - prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (forum_id), - KEY left_right_id (left_id, right_id), - KEY forum_lastpost_id (forum_last_post_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY forum_id (forum_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_type tinyint(4) DEFAULT '1' NOT NULL, - group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_name varchar(255) DEFAULT '' NOT NULL, - group_desc text NOT NULL, - group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - group_desc_uid varchar(8) DEFAULT '' NOT NULL, - group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar varchar(255) DEFAULT '' NOT NULL, - group_avatar_type tinyint(2) DEFAULT '0' NOT NULL, - group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_colour varchar(6) DEFAULT '' NOT NULL, - group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id), - KEY group_legend_name (group_legend, group_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, - icons_url varchar(255) DEFAULT '' NOT NULL, - icons_width tinyint(4) DEFAULT '0' NOT NULL, - icons_height tinyint(4) DEFAULT '0' NOT NULL, - icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (icons_id), - KEY display_on_posting (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id tinyint(4) NOT NULL auto_increment, - lang_iso varchar(30) DEFAULT '' NOT NULL, - lang_dir varchar(30) DEFAULT '' NOT NULL, - lang_english_name varchar(100) DEFAULT '' NOT NULL, - lang_local_name varchar(255) DEFAULT '' NOT NULL, - lang_author varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (lang_id), - KEY lang_iso (lang_iso) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id mediumint(8) UNSIGNED NOT NULL auto_increment, - log_type tinyint(4) DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_ip varchar(40) DEFAULT '' NOT NULL, - log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - log_operation text NOT NULL, - log_data mediumtext NOT NULL, - PRIMARY KEY (log_id), - KEY log_type (log_type), - KEY log_time (log_time), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY reportee_id (reportee_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) DEFAULT '' NOT NULL, - attempt_browser varchar(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, - attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '0' NOT NULL, - username_clean varchar(255) DEFAULT '0' NOT NULL, - KEY att_ip (attempt_ip, attempt_time), - KEY att_for (attempt_forwarded_for, attempt_time), - KEY att_time (attempt_time), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_name varchar(255) DEFAULT '' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY disp_idx (display_on_index), - KEY forum_id (forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id mediumint(8) UNSIGNED NOT NULL auto_increment, - module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_basename varchar(255) DEFAULT '' NOT NULL, - module_class varchar(10) DEFAULT '' NOT NULL, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - module_langname varchar(255) DEFAULT '' NOT NULL, - module_mode varchar(255) DEFAULT '' NOT NULL, - module_auth varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id), - KEY left_right_id (left_id, right_id), - KEY module_enabled (module_enabled), - KEY class_left_id (module_class, left_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_text text NOT NULL, - poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - KEY poll_opt_id (poll_option_id), - KEY topic_id (topic_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - vote_user_ip varchar(40) DEFAULT '' NOT NULL, - KEY topic_id (topic_id), - KEY vote_user_id (vote_user_id), - KEY vote_user_ip (vote_user_ip) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id mediumint(8) UNSIGNED NOT NULL auto_increment, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_ip varchar(40) DEFAULT '' NOT NULL, - post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_username varchar(255) DEFAULT '' NOT NULL, - post_subject varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, - post_text mediumtext NOT NULL, - post_checksum varchar(32) DEFAULT '' NOT NULL, - post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_reason varchar(255) DEFAULT '' NOT NULL, - post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (post_id), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY poster_ip (poster_ip), - KEY poster_id (poster_id), - KEY post_approved (post_approved), - KEY post_username (post_username), - KEY tid_post_time (topic_id, post_time) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, - root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_ip varchar(40) DEFAULT '' NOT NULL, - message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - message_subject varchar(255) DEFAULT '' NOT NULL, - message_text mediumtext NOT NULL, - message_edit_reason varchar(255) DEFAULT '' NOT NULL, - message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - to_address text NOT NULL, - bcc_address text NOT NULL, - message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (msg_id), - KEY author_ip (author_ip), - KEY message_time (message_time), - KEY author_id (author_id), - KEY root_level (root_level) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - folder_name varchar(255) DEFAULT '' NOT NULL, - pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (folder_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_string varchar(255) DEFAULT '' NOT NULL, - rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_folder_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - folder_id int(11) DEFAULT '0' NOT NULL, - KEY msg_id (msg_id), - KEY author_id (author_id), - KEY usr_flder_id (user_id, folder_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id mediumint(8) UNSIGNED NOT NULL auto_increment, - field_name varchar(255) DEFAULT '' NOT NULL, - field_type tinyint(4) DEFAULT '0' NOT NULL, - field_ident varchar(20) DEFAULT '' NOT NULL, - field_length varchar(20) DEFAULT '' NOT NULL, - field_minlen varchar(255) DEFAULT '' NOT NULL, - field_maxlen varchar(255) DEFAULT '' NOT NULL, - field_novalue varchar(255) DEFAULT '' NOT NULL, - field_default_value varchar(255) DEFAULT '' NOT NULL, - field_validation varchar(20) DEFAULT '' NOT NULL, - field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (field_id), - KEY fld_type (field_type), - KEY fld_ordr (field_order) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - field_type tinyint(4) DEFAULT '0' NOT NULL, - lang_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_name varchar(255) DEFAULT '' NOT NULL, - lang_explain text NOT NULL, - lang_default_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, - rank_title varchar(255) DEFAULT '' NOT NULL, - rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - rank_image varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id mediumint(8) UNSIGNED NOT NULL auto_increment, - reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - report_text mediumtext NOT NULL, - reported_post_text mediumtext NOT NULL, - PRIMARY KEY (report_id), - KEY post_id (post_id), - KEY pm_id (pm_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id smallint(4) UNSIGNED NOT NULL auto_increment, - reason_title varchar(255) DEFAULT '' NOT NULL, - reason_description mediumtext NOT NULL, - reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (reason_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varchar(32) DEFAULT '' NOT NULL, - search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - search_keywords mediumtext NOT NULL, - search_authors mediumtext NOT NULL, - PRIMARY KEY (search_key) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word_text varchar(255) DEFAULT '' NOT NULL, - word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (word_id), - UNIQUE wrd_txt (word_text), - KEY wrd_cnt (word_count) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE unq_mtch (word_id, post_id, title_match), - KEY word_id (word_id), - KEY post_id (post_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' NOT NULL, - session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_ip varchar(40) DEFAULT '' NOT NULL, - session_browser varchar(150) DEFAULT '' NOT NULL, - session_forwarded_for varchar(255) DEFAULT '' NOT NULL, - session_page varchar(255) DEFAULT '' NOT NULL, - session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id), - KEY session_time (session_time), - KEY session_user_id (session_user_id), - KEY session_fid (session_forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - last_ip varchar(40) DEFAULT '' NOT NULL, - last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (key_id, user_id), - KEY last_login (last_login) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id mediumint(8) UNSIGNED NOT NULL auto_increment, - site_ip varchar(40) DEFAULT '' NOT NULL, - site_hostname varchar(255) DEFAULT '' NOT NULL, - ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (site_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, - code varchar(50) DEFAULT '' NOT NULL, - emotion varchar(50) DEFAULT '' NOT NULL, - smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (smiley_id), - KEY display_on_post (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id mediumint(8) UNSIGNED NOT NULL auto_increment, - style_name varchar(255) DEFAULT '' NOT NULL, - style_copyright varchar(255) DEFAULT '' NOT NULL, - style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - style_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, - style_parent_tree text NOT NULL, - PRIMARY KEY (style_id), - UNIQUE style_name (style_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, - topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_status tinyint(3) DEFAULT '0' NOT NULL, - topic_type tinyint(3) DEFAULT '0' NOT NULL, - topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, - topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_title varchar(255) DEFAULT '' NOT NULL, - poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_max_options tinyint(4) DEFAULT '1' NOT NULL, - poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id), - KEY forum_id (forum_id), - KEY forum_id_type (forum_id, topic_type), - KEY last_post_time (topic_last_post_time), - KEY topic_approved (topic_approved), - KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id), - KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id), - KEY topic_id (topic_id), - KEY forum_id (forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY topic_id (topic_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY group_id (group_id), - KEY user_id (user_id), - KEY group_leader (group_leader) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_type tinyint(2) DEFAULT '0' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, - user_permissions mediumtext NOT NULL, - user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_ip varchar(40) DEFAULT '' NOT NULL, - user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '' NOT NULL, - username_clean varchar(255) DEFAULT '' NOT NULL, - user_password varchar(40) DEFAULT '' NOT NULL, - user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_email varchar(100) DEFAULT '' NOT NULL, - user_email_hash bigint(20) DEFAULT '0' NOT NULL, - user_birthday varchar(10) DEFAULT '' NOT NULL, - user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpage varchar(200) DEFAULT '' NOT NULL, - user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, - user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_warnings tinyint(4) DEFAULT '0' NOT NULL, - user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, - user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, - user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_lang varchar(30) DEFAULT '' NOT NULL, - user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, - user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_colour varchar(6) DEFAULT '' NOT NULL, - user_new_privmsg int(4) DEFAULT '0' NOT NULL, - user_unread_privmsg int(4) DEFAULT '0' NOT NULL, - user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_full_folder int(11) DEFAULT '-3' NOT NULL, - user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, - user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_notify_type tinyint(4) DEFAULT '0' NOT NULL, - user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, - user_avatar varchar(255) DEFAULT '' NOT NULL, - user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, - user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_sig mediumtext NOT NULL, - user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - user_from varchar(100) DEFAULT '' NOT NULL, - user_icq varchar(15) DEFAULT '' NOT NULL, - user_aim varchar(255) DEFAULT '' NOT NULL, - user_yim varchar(255) DEFAULT '' NOT NULL, - user_msnm varchar(255) DEFAULT '' NOT NULL, - user_jabber varchar(255) DEFAULT '' NOT NULL, - user_website varchar(200) DEFAULT '' NOT NULL, - user_occ text NOT NULL, - user_interests text NOT NULL, - user_actkey varchar(32) DEFAULT '' NOT NULL, - user_newpasswd varchar(40) DEFAULT '' NOT NULL, - user_form_salt varchar(32) DEFAULT '' NOT NULL, - user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_reminded tinyint(4) DEFAULT '0' NOT NULL, - user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id), - KEY user_birthday (user_birthday), - KEY user_email_hash (user_email_hash), - KEY user_type (user_type), - UNIQUE username_clean (username_clean) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (warning_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word varchar(255) DEFAULT '' NOT NULL, - replacement varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (word_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, zebra_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + physical_filename varchar(255) DEFAULT '' NOT NULL, + real_filename varchar(255) DEFAULT '' NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_comment text NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + mimetype varchar(100) DEFAULT '' NOT NULL, + filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, + thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id), + KEY filetime (filetime), + KEY post_msg_id (post_msg_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY is_orphan (is_orphan) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY group_id (group_id), + KEY auth_opt_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, + auth_option varchar(50) DEFAULT '' NOT NULL, + is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + UNIQUE auth_option (auth_option) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id mediumint(8) UNSIGNED NOT NULL auto_increment, + role_name varchar(255) DEFAULT '' NOT NULL, + role_description text NOT NULL, + role_type varchar(10) DEFAULT '' NOT NULL, + role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id), + KEY role_type (role_type), + KEY role_order (role_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id), + KEY ath_op_id (auth_option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + auth_setting tinyint(2) DEFAULT '0' NOT NULL, + KEY user_id (user_id), + KEY auth_option_id (auth_option_id), + KEY auth_role_id (auth_role_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + ban_ip varchar(40) DEFAULT '' NOT NULL, + ban_email varchar(100) DEFAULT '' NOT NULL, + ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, + ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ban_reason varchar(255) DEFAULT '' NOT NULL, + ban_give_reason varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (ban_id), + KEY ban_end (ban_end), + KEY ban_user (ban_userid, ban_exclude), + KEY ban_email (ban_email, ban_exclude), + KEY ban_ip (ban_ip, ban_exclude) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_tag varchar(16) DEFAULT '' NOT NULL, + bbcode_helpline varchar(255) DEFAULT '' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_match text NOT NULL, + bbcode_tpl mediumtext NOT NULL, + first_pass_match mediumtext NOT NULL, + first_pass_replace mediumtext NOT NULL, + second_pass_match mediumtext NOT NULL, + second_pass_replace mediumtext NOT NULL, + PRIMARY KEY (bbcode_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id, user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, + bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + bot_name varchar(255) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bot_agent varchar(255) DEFAULT '' NOT NULL, + bot_ip varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id), + KEY bot_active (bot_active) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + confirm_type tinyint(3) DEFAULT '0' NOT NULL, + code varchar(8) DEFAULT '' NOT NULL, + seed int(10) UNSIGNED DEFAULT '0' NOT NULL, + attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id, confirm_id), + KEY confirm_type (confirm_type) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (disallow_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + draft_subject varchar(255) DEFAULT '' NOT NULL, + draft_message mediumtext NOT NULL, + PRIMARY KEY (draft_id), + KEY save_time (save_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state text NOT NULL, + UNIQUE ext_name (ext_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_name varchar(255) DEFAULT '' NOT NULL, + cat_id tinyint(2) DEFAULT '0' NOT NULL, + allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + upload_icon varchar(255) DEFAULT '' NOT NULL, + max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, + allowed_forums text NOT NULL, + allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_parents mediumtext NOT NULL, + forum_name varchar(255) DEFAULT '' NOT NULL, + forum_desc text NOT NULL, + forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_desc_uid varchar(8) DEFAULT '' NOT NULL, + forum_link varchar(255) DEFAULT '' NOT NULL, + forum_password varchar(40) DEFAULT '' NOT NULL, + forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_image varchar(255) DEFAULT '' NOT NULL, + forum_rules text NOT NULL, + forum_rules_link varchar(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + forum_rules_uid varchar(8) DEFAULT '' NOT NULL, + forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, + forum_type tinyint(4) DEFAULT '0' NOT NULL, + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, + forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + forum_flags tinyint(4) DEFAULT '32' NOT NULL, + forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, + display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, + prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_right_id (left_id, right_id), + KEY forum_lastpost_id (forum_last_post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + group_desc text NOT NULL, + group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, + group_desc_uid varchar(8) DEFAULT '' NOT NULL, + group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar varchar(255) DEFAULT '' NOT NULL, + group_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_colour varchar(6) DEFAULT '' NOT NULL, + group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (group_id), + KEY group_legend_name (group_legend, group_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, + icons_url varchar(255) DEFAULT '' NOT NULL, + icons_width tinyint(4) DEFAULT '0' NOT NULL, + icons_height tinyint(4) DEFAULT '0' NOT NULL, + icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (icons_id), + KEY display_on_posting (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id tinyint(4) NOT NULL auto_increment, + lang_iso varchar(30) DEFAULT '' NOT NULL, + lang_dir varchar(30) DEFAULT '' NOT NULL, + lang_english_name varchar(100) DEFAULT '' NOT NULL, + lang_local_name varchar(255) DEFAULT '' NOT NULL, + lang_author varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (lang_id), + KEY lang_iso (lang_iso) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id mediumint(8) UNSIGNED NOT NULL auto_increment, + log_type tinyint(4) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_ip varchar(40) DEFAULT '' NOT NULL, + log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + log_operation text NOT NULL, + log_data mediumtext NOT NULL, + PRIMARY KEY (log_id), + KEY log_type (log_type), + KEY log_time (log_time), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY reportee_id (reportee_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) DEFAULT '' NOT NULL, + attempt_browser varchar(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, + attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '0' NOT NULL, + username_clean varchar(255) DEFAULT '0' NOT NULL, + KEY att_ip (attempt_ip, attempt_time), + KEY att_for (attempt_forwarded_for, attempt_time), + KEY att_time (attempt_time), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY disp_idx (display_on_index), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id mediumint(8) UNSIGNED NOT NULL auto_increment, + module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + module_basename varchar(255) DEFAULT '' NOT NULL, + module_class varchar(10) DEFAULT '' NOT NULL, + parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + module_langname varchar(255) DEFAULT '' NOT NULL, + module_mode varchar(255) DEFAULT '' NOT NULL, + module_auth varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id), + KEY left_right_id (left_id, right_id), + KEY module_enabled (module_enabled), + KEY class_left_id (module_class, left_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_text text NOT NULL, + poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + KEY poll_opt_id (poll_option_id), + KEY topic_id (topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_option_id tinyint(4) DEFAULT '0' NOT NULL, + vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + vote_user_ip varchar(40) DEFAULT '' NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varchar(40) DEFAULT '' NOT NULL, + post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_username varchar(255) DEFAULT '' NOT NULL, + post_subject varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + post_text mediumtext NOT NULL, + post_checksum varchar(32) DEFAULT '' NOT NULL, + post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_reason varchar(255) DEFAULT '' NOT NULL, + post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_ip (poster_ip), + KEY poster_id (poster_id), + KEY post_approved (post_approved), + KEY post_username (post_username), + KEY tid_post_time (topic_id, post_time) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, + root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_ip varchar(40) DEFAULT '' NOT NULL, + message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + message_subject varchar(255) DEFAULT '' NOT NULL, + message_text mediumtext NOT NULL, + message_edit_reason varchar(255) DEFAULT '' NOT NULL, + message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + to_address text NOT NULL, + bcc_address text NOT NULL, + message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (msg_id), + KEY author_ip (author_ip), + KEY message_time (message_time), + KEY author_id (author_id), + KEY root_level (root_level) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + folder_name varchar(255) DEFAULT '' NOT NULL, + pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (folder_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_string varchar(255) DEFAULT '' NOT NULL, + rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rule_folder_id int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id), + KEY user_id (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + folder_id int(11) DEFAULT '0' NOT NULL, + KEY msg_id (msg_id), + KEY author_id (author_id), + KEY usr_flder_id (user_id, folder_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id mediumint(8) UNSIGNED NOT NULL auto_increment, + field_name varchar(255) DEFAULT '' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + field_ident varchar(20) DEFAULT '' NOT NULL, + field_length varchar(20) DEFAULT '' NOT NULL, + field_minlen varchar(255) DEFAULT '' NOT NULL, + field_maxlen varchar(255) DEFAULT '' NOT NULL, + field_novalue varchar(255) DEFAULT '' NOT NULL, + field_default_value varchar(255) DEFAULT '' NOT NULL, + field_validation varchar(20) DEFAULT '' NOT NULL, + field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (field_id), + KEY fld_type (field_type), + KEY fld_ordr (field_order) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + field_type tinyint(4) DEFAULT '0' NOT NULL, + lang_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + lang_name varchar(255) DEFAULT '' NOT NULL, + lang_explain text NOT NULL, + lang_default_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, + rank_title varchar(255) DEFAULT '' NOT NULL, + rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + rank_image varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id mediumint(8) UNSIGNED NOT NULL auto_increment, + reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + report_text mediumtext NOT NULL, + reported_post_text mediumtext NOT NULL, + PRIMARY KEY (report_id), + KEY post_id (post_id), + KEY pm_id (pm_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id smallint(4) UNSIGNED NOT NULL auto_increment, + reason_title varchar(255) DEFAULT '' NOT NULL, + reason_description mediumtext NOT NULL, + reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (reason_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varchar(32) DEFAULT '' NOT NULL, + search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + search_keywords mediumtext NOT NULL, + search_authors mediumtext NOT NULL, + PRIMARY KEY (search_key) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_text varchar(255) DEFAULT '' NOT NULL, + word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (word_id), + UNIQUE wrd_txt (word_text), + KEY wrd_cnt (word_count) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE unq_mtch (word_id, post_id, title_match), + KEY word_id (word_id), + KEY post_id (post_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + session_ip varchar(40) DEFAULT '' NOT NULL, + session_browser varchar(150) DEFAULT '' NOT NULL, + session_forwarded_for varchar(255) DEFAULT '' NOT NULL, + session_page varchar(255) DEFAULT '' NOT NULL, + session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time), + KEY session_user_id (session_user_id), + KEY session_fid (session_forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + last_ip varchar(40) DEFAULT '' NOT NULL, + last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (key_id, user_id), + KEY last_login (last_login) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id mediumint(8) UNSIGNED NOT NULL auto_increment, + site_ip varchar(40) DEFAULT '' NOT NULL, + site_hostname varchar(255) DEFAULT '' NOT NULL, + ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (site_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, + code varchar(50) DEFAULT '' NOT NULL, + emotion varchar(50) DEFAULT '' NOT NULL, + smiley_url varchar(50) DEFAULT '' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smiley_id), + KEY display_on_post (display_on_posting) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id mediumint(8) UNSIGNED NOT NULL auto_increment, + style_name varchar(255) DEFAULT '' NOT NULL, + style_copyright varchar(255) DEFAULT '' NOT NULL, + style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + style_path varchar(100) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, + style_parent_tree text NOT NULL, + PRIMARY KEY (style_id), + UNIQUE style_name (style_name) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, + topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title varchar(255) DEFAULT '' NOT NULL, + poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_max_options tinyint(4) DEFAULT '1' NOT NULL, + poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, + poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY forum_id_type (forum_id, topic_type), + KEY last_post_time (topic_last_post_time), + KEY topic_approved (topic_approved), + KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id), + KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id), + KEY topic_id (topic_id), + KEY forum_id (forum_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, topic_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_stat (notify_status) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + KEY group_id (group_id), + KEY user_id (user_id), + KEY group_leader (group_leader) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_type tinyint(2) DEFAULT '0' NOT NULL, + group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, + user_permissions mediumtext NOT NULL, + user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_ip varchar(40) DEFAULT '' NOT NULL, + user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, + username varchar(255) DEFAULT '' NOT NULL, + username_clean varchar(255) DEFAULT '' NOT NULL, + user_password varchar(40) DEFAULT '' NOT NULL, + user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_email varchar(100) DEFAULT '' NOT NULL, + user_email_hash bigint(20) DEFAULT '0' NOT NULL, + user_birthday varchar(10) DEFAULT '' NOT NULL, + user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_lastpage varchar(200) DEFAULT '' NOT NULL, + user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, + user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_warnings tinyint(4) DEFAULT '0' NOT NULL, + user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, + user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, + user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varchar(30) DEFAULT '' NOT NULL, + user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, + user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_colour varchar(6) DEFAULT '' NOT NULL, + user_new_privmsg int(4) DEFAULT '0' NOT NULL, + user_unread_privmsg int(4) DEFAULT '0' NOT NULL, + user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_full_folder int(11) DEFAULT '-3' NOT NULL, + user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, + user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_notify_type tinyint(4) DEFAULT '0' NOT NULL, + user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, + user_avatar varchar(255) DEFAULT '' NOT NULL, + user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_sig mediumtext NOT NULL, + user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + user_from varchar(100) DEFAULT '' NOT NULL, + user_icq varchar(15) DEFAULT '' NOT NULL, + user_aim varchar(255) DEFAULT '' NOT NULL, + user_yim varchar(255) DEFAULT '' NOT NULL, + user_msnm varchar(255) DEFAULT '' NOT NULL, + user_jabber varchar(255) DEFAULT '' NOT NULL, + user_website varchar(200) DEFAULT '' NOT NULL, + user_occ text NOT NULL, + user_interests text NOT NULL, + user_actkey varchar(32) DEFAULT '' NOT NULL, + user_newpasswd varchar(40) DEFAULT '' NOT NULL, + user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + user_reminded tinyint(4) DEFAULT '0' NOT NULL, + user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id), + KEY user_birthday (user_birthday), + KEY user_email_hash (user_email_hash), + KEY user_type (user_type), + UNIQUE username_clean (username_clean) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word varchar(255) DEFAULT '' NOT NULL, + replacement varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (word_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (user_id, zebra_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 04155fe28b..02d8042ff7 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1,1787 +1,1785 @@ -/* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ - -/* - This first section is optional, however its probably the best method - of running phpBB on Oracle. If you already have a tablespace and user created - for phpBB you can leave this section commented out! - - The first set of statements create a phpBB tablespace and a phpBB user, - make sure you change the password of the phpBB user before you run this script!! -*/ - -/* -CREATE TABLESPACE "PHPBB" - LOGGING - DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' - SIZE 10M - AUTOEXTEND ON NEXT 10M - MAXSIZE 100M; - -CREATE USER "PHPBB" - PROFILE "DEFAULT" - IDENTIFIED BY "phpbb_password" - DEFAULT TABLESPACE "PHPBB" - QUOTA UNLIMITED ON "PHPBB" - ACCOUNT UNLOCK; - -GRANT ANALYZE ANY TO "PHPBB"; -GRANT CREATE SEQUENCE TO "PHPBB"; -GRANT CREATE SESSION TO "PHPBB"; -GRANT CREATE TABLE TO "PHPBB"; -GRANT CREATE TRIGGER TO "PHPBB"; -GRANT CREATE VIEW TO "PHPBB"; -GRANT "CONNECT" TO "PHPBB"; - -COMMIT; -DISCONNECT; - -CONNECT phpbb/phpbb_password; -*/ -/* - Table: 'phpbb_attachments' -*/ -CREATE TABLE phpbb_attachments ( - attach_id number(8) NOT NULL, - post_msg_id number(8) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - in_message number(1) DEFAULT '0' NOT NULL, - poster_id number(8) DEFAULT '0' NOT NULL, - is_orphan number(1) DEFAULT '1' NOT NULL, - physical_filename varchar2(255) DEFAULT '' , - real_filename varchar2(255) DEFAULT '' , - download_count number(8) DEFAULT '0' NOT NULL, - attach_comment clob DEFAULT '' , - extension varchar2(100) DEFAULT '' , - mimetype varchar2(100) DEFAULT '' , - filesize number(20) DEFAULT '0' NOT NULL, - filetime number(11) DEFAULT '0' NOT NULL, - thumbnail number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_attachments PRIMARY KEY (attach_id) -) -/ - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime) -/ -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id) -/ -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) -/ -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) -/ -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) -/ - -CREATE SEQUENCE phpbb_attachments_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_attachments -BEFORE INSERT ON phpbb_attachments -FOR EACH ROW WHEN ( - new.attach_id IS NULL OR new.attach_id = 0 -) -BEGIN - SELECT phpbb_attachments_seq.nextval - INTO :new.attach_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE phpbb_acl_groups ( - group_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_role_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id) -/ -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id) -/ -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id) -/ - -/* - Table: 'phpbb_acl_options' -*/ -CREATE TABLE phpbb_acl_options ( - auth_option_id number(8) NOT NULL, - auth_option varchar2(50) DEFAULT '' , - is_global number(1) DEFAULT '0' NOT NULL, - is_local number(1) DEFAULT '0' NOT NULL, - founder_only number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id), - CONSTRAINT u_phpbb_auth_option UNIQUE (auth_option) -) -/ - - -CREATE SEQUENCE phpbb_acl_options_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_acl_options -BEFORE INSERT ON phpbb_acl_options -FOR EACH ROW WHEN ( - new.auth_option_id IS NULL OR new.auth_option_id = 0 -) -BEGIN - SELECT phpbb_acl_options_seq.nextval - INTO :new.auth_option_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE TABLE phpbb_acl_roles ( - role_id number(8) NOT NULL, - role_name varchar2(765) DEFAULT '' , - role_description clob DEFAULT '' , - role_type varchar2(10) DEFAULT '' , - role_order number(4) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_roles PRIMARY KEY (role_id) -) -/ - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type) -/ -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order) -/ - -CREATE SEQUENCE phpbb_acl_roles_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_acl_roles -BEFORE INSERT ON phpbb_acl_roles -FOR EACH ROW WHEN ( - new.role_id IS NULL OR new.role_id = 0 -) -BEGIN - SELECT phpbb_acl_roles_seq.nextval - INTO :new.role_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE phpbb_acl_roles_data ( - role_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_roles_data PRIMARY KEY (role_id, auth_option_id) -) -/ - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id) -/ - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE phpbb_acl_users ( - user_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_role_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id) -/ -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id) -/ -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id) -/ - -/* - Table: 'phpbb_banlist' -*/ -CREATE TABLE phpbb_banlist ( - ban_id number(8) NOT NULL, - ban_userid number(8) DEFAULT '0' NOT NULL, - ban_ip varchar2(40) DEFAULT '' , - ban_email varchar2(300) DEFAULT '' , - ban_start number(11) DEFAULT '0' NOT NULL, - ban_end number(11) DEFAULT '0' NOT NULL, - ban_exclude number(1) DEFAULT '0' NOT NULL, - ban_reason varchar2(765) DEFAULT '' , - ban_give_reason varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id) -) -/ - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end) -/ -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude) -/ -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude) -/ -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude) -/ - -CREATE SEQUENCE phpbb_banlist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_banlist -BEFORE INSERT ON phpbb_banlist -FOR EACH ROW WHEN ( - new.ban_id IS NULL OR new.ban_id = 0 -) -BEGIN - SELECT phpbb_banlist_seq.nextval - INTO :new.ban_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE phpbb_bbcodes ( - bbcode_id number(4) DEFAULT '0' NOT NULL, - bbcode_tag varchar2(16) DEFAULT '' , - bbcode_helpline varchar2(765) DEFAULT '' , - display_on_posting number(1) DEFAULT '0' NOT NULL, - bbcode_match clob DEFAULT '' , - bbcode_tpl clob DEFAULT '' , - first_pass_match clob DEFAULT '' , - first_pass_replace clob DEFAULT '' , - second_pass_match clob DEFAULT '' , - second_pass_replace clob DEFAULT '' , - CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id) -) -/ - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting) -/ - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE phpbb_bookmarks ( - topic_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_bookmarks PRIMARY KEY (topic_id, user_id) -) -/ - - -/* - Table: 'phpbb_bots' -*/ -CREATE TABLE phpbb_bots ( - bot_id number(8) NOT NULL, - bot_active number(1) DEFAULT '1' NOT NULL, - bot_name varchar2(765) DEFAULT '' , - user_id number(8) DEFAULT '0' NOT NULL, - bot_agent varchar2(255) DEFAULT '' , - bot_ip varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_bots PRIMARY KEY (bot_id) -) -/ - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active) -/ - -CREATE SEQUENCE phpbb_bots_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_bots -BEFORE INSERT ON phpbb_bots -FOR EACH ROW WHEN ( - new.bot_id IS NULL OR new.bot_id = 0 -) -BEGIN - SELECT phpbb_bots_seq.nextval - INTO :new.bot_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE phpbb_config ( - config_name varchar2(255) DEFAULT '' , - config_value varchar2(765) DEFAULT '' , - is_dynamic number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name) -) -/ - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic) -/ - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' , - session_id char(32) DEFAULT '' , - confirm_type number(3) DEFAULT '0' NOT NULL, - code varchar2(8) DEFAULT '' , - seed number(10) DEFAULT '0' NOT NULL, - attempts number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) -) -/ - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type) -/ - -/* - Table: 'phpbb_disallow' -*/ -CREATE TABLE phpbb_disallow ( - disallow_id number(8) NOT NULL, - disallow_username varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id) -) -/ - - -CREATE SEQUENCE phpbb_disallow_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_disallow -BEFORE INSERT ON phpbb_disallow -FOR EACH ROW WHEN ( - new.disallow_id IS NULL OR new.disallow_id = 0 -) -BEGIN - SELECT phpbb_disallow_seq.nextval - INTO :new.disallow_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_drafts' -*/ -CREATE TABLE phpbb_drafts ( - draft_id number(8) NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - save_time number(11) DEFAULT '0' NOT NULL, - draft_subject varchar2(765) DEFAULT '' , - draft_message clob DEFAULT '' , - CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id) -) -/ - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time) -/ - -CREATE SEQUENCE phpbb_drafts_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_drafts -BEFORE INSERT ON phpbb_drafts -FOR EACH ROW WHEN ( - new.draft_id IS NULL OR new.draft_id = 0 -) -BEGIN - SELECT phpbb_drafts_seq.nextval - INTO :new.draft_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE phpbb_ext ( - ext_name varchar2(255) DEFAULT '' , - ext_active number(1) DEFAULT '0' NOT NULL, - ext_state clob DEFAULT '' , - CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) -) -/ - - -/* - Table: 'phpbb_extensions' -*/ -CREATE TABLE phpbb_extensions ( - extension_id number(8) NOT NULL, - group_id number(8) DEFAULT '0' NOT NULL, - extension varchar2(100) DEFAULT '' , - CONSTRAINT pk_phpbb_extensions PRIMARY KEY (extension_id) -) -/ - - -CREATE SEQUENCE phpbb_extensions_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_extensions -BEFORE INSERT ON phpbb_extensions -FOR EACH ROW WHEN ( - new.extension_id IS NULL OR new.extension_id = 0 -) -BEGIN - SELECT phpbb_extensions_seq.nextval - INTO :new.extension_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE TABLE phpbb_extension_groups ( - group_id number(8) NOT NULL, - group_name varchar2(765) DEFAULT '' , - cat_id number(2) DEFAULT '0' NOT NULL, - allow_group number(1) DEFAULT '0' NOT NULL, - download_mode number(1) DEFAULT '1' NOT NULL, - upload_icon varchar2(255) DEFAULT '' , - max_filesize number(20) DEFAULT '0' NOT NULL, - allowed_forums clob DEFAULT '' , - allow_in_pm number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id) -) -/ - - -CREATE SEQUENCE phpbb_extension_groups_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_extension_groups -BEFORE INSERT ON phpbb_extension_groups -FOR EACH ROW WHEN ( - new.group_id IS NULL OR new.group_id = 0 -) -BEGIN - SELECT phpbb_extension_groups_seq.nextval - INTO :new.group_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_forums' -*/ -CREATE TABLE phpbb_forums ( - forum_id number(8) NOT NULL, - parent_id number(8) DEFAULT '0' NOT NULL, - left_id number(8) DEFAULT '0' NOT NULL, - right_id number(8) DEFAULT '0' NOT NULL, - forum_parents clob DEFAULT '' , - forum_name varchar2(765) DEFAULT '' , - forum_desc clob DEFAULT '' , - forum_desc_bitfield varchar2(255) DEFAULT '' , - forum_desc_options number(11) DEFAULT '7' NOT NULL, - forum_desc_uid varchar2(8) DEFAULT '' , - forum_link varchar2(765) DEFAULT '' , - forum_password varchar2(120) DEFAULT '' , - forum_style number(8) DEFAULT '0' NOT NULL, - forum_image varchar2(255) DEFAULT '' , - forum_rules clob DEFAULT '' , - forum_rules_link varchar2(765) DEFAULT '' , - forum_rules_bitfield varchar2(255) DEFAULT '' , - forum_rules_options number(11) DEFAULT '7' NOT NULL, - forum_rules_uid varchar2(8) DEFAULT '' , - forum_topics_per_page number(4) DEFAULT '0' NOT NULL, - forum_type number(4) DEFAULT '0' NOT NULL, - forum_status number(4) DEFAULT '0' NOT NULL, - forum_posts number(8) DEFAULT '0' NOT NULL, - forum_topics number(8) DEFAULT '0' NOT NULL, - forum_topics_real number(8) DEFAULT '0' NOT NULL, - forum_last_post_id number(8) DEFAULT '0' NOT NULL, - forum_last_poster_id number(8) DEFAULT '0' NOT NULL, - forum_last_post_subject varchar2(765) DEFAULT '' , - forum_last_post_time number(11) DEFAULT '0' NOT NULL, - forum_last_poster_name varchar2(765) DEFAULT '' , - forum_last_poster_colour varchar2(6) DEFAULT '' , - forum_flags number(4) DEFAULT '32' NOT NULL, - forum_options number(20) DEFAULT '0' NOT NULL, - display_subforum_list number(1) DEFAULT '1' NOT NULL, - display_on_index number(1) DEFAULT '1' NOT NULL, - enable_indexing number(1) DEFAULT '1' NOT NULL, - enable_icons number(1) DEFAULT '1' NOT NULL, - enable_prune number(1) DEFAULT '0' NOT NULL, - prune_next number(11) DEFAULT '0' NOT NULL, - prune_days number(8) DEFAULT '0' NOT NULL, - prune_viewed number(8) DEFAULT '0' NOT NULL, - prune_freq number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id) -) -/ - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id) -/ -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id) -/ - -CREATE SEQUENCE phpbb_forums_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_forums -BEFORE INSERT ON phpbb_forums -FOR EACH ROW WHEN ( - new.forum_id IS NULL OR new.forum_id = 0 -) -BEGIN - SELECT phpbb_forums_seq.nextval - INTO :new.forum_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE phpbb_forums_access ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' , - CONSTRAINT pk_phpbb_forums_access PRIMARY KEY (forum_id, user_id, session_id) -) -/ - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE phpbb_forums_track ( - user_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - mark_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_forums_track PRIMARY KEY (user_id, forum_id) -) -/ - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE phpbb_forums_watch ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - notify_status number(1) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id) -/ -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id) -/ -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status) -/ - -/* - Table: 'phpbb_groups' -*/ -CREATE TABLE phpbb_groups ( - group_id number(8) NOT NULL, - group_type number(4) DEFAULT '1' NOT NULL, - group_founder_manage number(1) DEFAULT '0' NOT NULL, - group_skip_auth number(1) DEFAULT '0' NOT NULL, - group_name varchar2(255) DEFAULT '' , - group_desc clob DEFAULT '' , - group_desc_bitfield varchar2(255) DEFAULT '' , - group_desc_options number(11) DEFAULT '7' NOT NULL, - group_desc_uid varchar2(8) DEFAULT '' , - group_display number(1) DEFAULT '0' NOT NULL, - group_avatar varchar2(255) DEFAULT '' , - group_avatar_type number(2) DEFAULT '0' NOT NULL, - group_avatar_width number(4) DEFAULT '0' NOT NULL, - group_avatar_height number(4) DEFAULT '0' NOT NULL, - group_rank number(8) DEFAULT '0' NOT NULL, - group_colour varchar2(6) DEFAULT '' , - group_sig_chars number(8) DEFAULT '0' NOT NULL, - group_receive_pm number(1) DEFAULT '0' NOT NULL, - group_message_limit number(8) DEFAULT '0' NOT NULL, - group_max_recipients number(8) DEFAULT '0' NOT NULL, - group_legend number(8) DEFAULT '0' NOT NULL, - group_teampage number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) -) -/ - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name) -/ - -CREATE SEQUENCE phpbb_groups_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_groups -BEFORE INSERT ON phpbb_groups -FOR EACH ROW WHEN ( - new.group_id IS NULL OR new.group_id = 0 -) -BEGIN - SELECT phpbb_groups_seq.nextval - INTO :new.group_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_icons' -*/ -CREATE TABLE phpbb_icons ( - icons_id number(8) NOT NULL, - icons_url varchar2(255) DEFAULT '' , - icons_width number(4) DEFAULT '0' NOT NULL, - icons_height number(4) DEFAULT '0' NOT NULL, - icons_order number(8) DEFAULT '0' NOT NULL, - display_on_posting number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id) -) -/ - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting) -/ - -CREATE SEQUENCE phpbb_icons_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_icons -BEFORE INSERT ON phpbb_icons -FOR EACH ROW WHEN ( - new.icons_id IS NULL OR new.icons_id = 0 -) -BEGIN - SELECT phpbb_icons_seq.nextval - INTO :new.icons_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_lang' -*/ -CREATE TABLE phpbb_lang ( - lang_id number(4) NOT NULL, - lang_iso varchar2(30) DEFAULT '' , - lang_dir varchar2(30) DEFAULT '' , - lang_english_name varchar2(300) DEFAULT '' , - lang_local_name varchar2(765) DEFAULT '' , - lang_author varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id) -) -/ - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso) -/ - -CREATE SEQUENCE phpbb_lang_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_lang -BEFORE INSERT ON phpbb_lang -FOR EACH ROW WHEN ( - new.lang_id IS NULL OR new.lang_id = 0 -) -BEGIN - SELECT phpbb_lang_seq.nextval - INTO :new.lang_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_log' -*/ -CREATE TABLE phpbb_log ( - log_id number(8) NOT NULL, - log_type number(4) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - reportee_id number(8) DEFAULT '0' NOT NULL, - log_ip varchar2(40) DEFAULT '' , - log_time number(11) DEFAULT '0' NOT NULL, - log_operation clob DEFAULT '' , - log_data clob DEFAULT '' , - CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id) -) -/ - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type) -/ -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time) -/ -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id) -/ -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id) -/ -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id) -/ -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id) -/ - -CREATE SEQUENCE phpbb_log_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_log -BEFORE INSERT ON phpbb_log -FOR EACH ROW WHEN ( - new.log_id IS NULL OR new.log_id = 0 -) -BEGIN - SELECT phpbb_log_seq.nextval - INTO :new.log_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar2(40) DEFAULT '' , - attempt_browser varchar2(150) DEFAULT '' , - attempt_forwarded_for varchar2(255) DEFAULT '' , - attempt_time number(11) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - username varchar2(765) DEFAULT '0' NOT NULL, - username_clean varchar2(255) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time) -/ -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time) -/ -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time) -/ -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id) -/ - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE phpbb_moderator_cache ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - username varchar2(765) DEFAULT '' , - group_id number(8) DEFAULT '0' NOT NULL, - group_name varchar2(765) DEFAULT '' , - display_on_index number(1) DEFAULT '1' NOT NULL -) -/ - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index) -/ -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id) -/ - -/* - Table: 'phpbb_modules' -*/ -CREATE TABLE phpbb_modules ( - module_id number(8) NOT NULL, - module_enabled number(1) DEFAULT '1' NOT NULL, - module_display number(1) DEFAULT '1' NOT NULL, - module_basename varchar2(255) DEFAULT '' , - module_class varchar2(10) DEFAULT '' , - parent_id number(8) DEFAULT '0' NOT NULL, - left_id number(8) DEFAULT '0' NOT NULL, - right_id number(8) DEFAULT '0' NOT NULL, - module_langname varchar2(255) DEFAULT '' , - module_mode varchar2(255) DEFAULT '' , - module_auth varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id) -) -/ - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id) -/ -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled) -/ -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id) -/ - -CREATE SEQUENCE phpbb_modules_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_modules -BEFORE INSERT ON phpbb_modules -FOR EACH ROW WHEN ( - new.module_id IS NULL OR new.module_id = 0 -) -BEGIN - SELECT phpbb_modules_seq.nextval - INTO :new.module_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE phpbb_poll_options ( - poll_option_id number(4) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - poll_option_text clob DEFAULT '' , - poll_option_total number(8) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id) -/ -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id) -/ - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE phpbb_poll_votes ( - topic_id number(8) DEFAULT '0' NOT NULL, - poll_option_id number(4) DEFAULT '0' NOT NULL, - vote_user_id number(8) DEFAULT '0' NOT NULL, - vote_user_ip varchar2(40) DEFAULT '' -) -/ - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id) -/ -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id) -/ -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip) -/ - -/* - Table: 'phpbb_posts' -*/ -CREATE TABLE phpbb_posts ( - post_id number(8) NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - poster_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - poster_ip varchar2(40) DEFAULT '' , - post_time number(11) DEFAULT '0' NOT NULL, - post_approved number(1) DEFAULT '1' NOT NULL, - post_reported number(1) DEFAULT '0' NOT NULL, - enable_bbcode number(1) DEFAULT '1' NOT NULL, - enable_smilies number(1) DEFAULT '1' NOT NULL, - enable_magic_url number(1) DEFAULT '1' NOT NULL, - enable_sig number(1) DEFAULT '1' NOT NULL, - post_username varchar2(765) DEFAULT '' , - post_subject varchar2(765) DEFAULT '' , - post_text clob DEFAULT '' , - post_checksum varchar2(32) DEFAULT '' , - post_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield varchar2(255) DEFAULT '' , - bbcode_uid varchar2(8) DEFAULT '' , - post_postcount number(1) DEFAULT '1' NOT NULL, - post_edit_time number(11) DEFAULT '0' NOT NULL, - post_edit_reason varchar2(765) DEFAULT '' , - post_edit_user number(8) DEFAULT '0' NOT NULL, - post_edit_count number(4) DEFAULT '0' NOT NULL, - post_edit_locked number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id) -) -/ - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id) -/ -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id) -/ -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip) -/ -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) -/ -CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved) -/ -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username) -/ -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) -/ - -CREATE SEQUENCE phpbb_posts_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_posts -BEFORE INSERT ON phpbb_posts -FOR EACH ROW WHEN ( - new.post_id IS NULL OR new.post_id = 0 -) -BEGIN - SELECT phpbb_posts_seq.nextval - INTO :new.post_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE TABLE phpbb_privmsgs ( - msg_id number(8) NOT NULL, - root_level number(8) DEFAULT '0' NOT NULL, - author_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - author_ip varchar2(40) DEFAULT '' , - message_time number(11) DEFAULT '0' NOT NULL, - enable_bbcode number(1) DEFAULT '1' NOT NULL, - enable_smilies number(1) DEFAULT '1' NOT NULL, - enable_magic_url number(1) DEFAULT '1' NOT NULL, - enable_sig number(1) DEFAULT '1' NOT NULL, - message_subject varchar2(765) DEFAULT '' , - message_text clob DEFAULT '' , - message_edit_reason varchar2(765) DEFAULT '' , - message_edit_user number(8) DEFAULT '0' NOT NULL, - message_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield varchar2(255) DEFAULT '' , - bbcode_uid varchar2(8) DEFAULT '' , - message_edit_time number(11) DEFAULT '0' NOT NULL, - message_edit_count number(4) DEFAULT '0' NOT NULL, - to_address clob DEFAULT '' , - bcc_address clob DEFAULT '' , - message_reported number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) -) -/ - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip) -/ -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time) -/ -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id) -/ -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level) -/ - -CREATE SEQUENCE phpbb_privmsgs_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs -BEFORE INSERT ON phpbb_privmsgs -FOR EACH ROW WHEN ( - new.msg_id IS NULL OR new.msg_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_seq.nextval - INTO :new.msg_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE TABLE phpbb_privmsgs_folder ( - folder_id number(8) NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - folder_name varchar2(765) DEFAULT '' , - pm_count number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id) -) -/ - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id) -/ - -CREATE SEQUENCE phpbb_privmsgs_folder_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_folder -BEFORE INSERT ON phpbb_privmsgs_folder -FOR EACH ROW WHEN ( - new.folder_id IS NULL OR new.folder_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_folder_seq.nextval - INTO :new.folder_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE TABLE phpbb_privmsgs_rules ( - rule_id number(8) NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - rule_check number(8) DEFAULT '0' NOT NULL, - rule_connection number(8) DEFAULT '0' NOT NULL, - rule_string varchar2(765) DEFAULT '' , - rule_user_id number(8) DEFAULT '0' NOT NULL, - rule_group_id number(8) DEFAULT '0' NOT NULL, - rule_action number(8) DEFAULT '0' NOT NULL, - rule_folder_id number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id) -) -/ - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id) -/ - -CREATE SEQUENCE phpbb_privmsgs_rules_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_rules -BEFORE INSERT ON phpbb_privmsgs_rules -FOR EACH ROW WHEN ( - new.rule_id IS NULL OR new.rule_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_rules_seq.nextval - INTO :new.rule_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE phpbb_privmsgs_to ( - msg_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - author_id number(8) DEFAULT '0' NOT NULL, - pm_deleted number(1) DEFAULT '0' NOT NULL, - pm_new number(1) DEFAULT '1' NOT NULL, - pm_unread number(1) DEFAULT '1' NOT NULL, - pm_replied number(1) DEFAULT '0' NOT NULL, - pm_marked number(1) DEFAULT '0' NOT NULL, - pm_forwarded number(1) DEFAULT '0' NOT NULL, - folder_id number(11) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id) -/ -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id) -/ -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id) -/ - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE TABLE phpbb_profile_fields ( - field_id number(8) NOT NULL, - field_name varchar2(765) DEFAULT '' , - field_type number(4) DEFAULT '0' NOT NULL, - field_ident varchar2(20) DEFAULT '' , - field_length varchar2(20) DEFAULT '' , - field_minlen varchar2(255) DEFAULT '' , - field_maxlen varchar2(255) DEFAULT '' , - field_novalue varchar2(765) DEFAULT '' , - field_default_value varchar2(765) DEFAULT '' , - field_validation varchar2(60) DEFAULT '' , - field_required number(1) DEFAULT '0' NOT NULL, - field_show_novalue number(1) DEFAULT '0' NOT NULL, - field_show_on_reg number(1) DEFAULT '0' NOT NULL, - field_show_on_pm number(1) DEFAULT '0' NOT NULL, - field_show_on_vt number(1) DEFAULT '0' NOT NULL, - field_show_profile number(1) DEFAULT '0' NOT NULL, - field_hide number(1) DEFAULT '0' NOT NULL, - field_no_view number(1) DEFAULT '0' NOT NULL, - field_active number(1) DEFAULT '0' NOT NULL, - field_order number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id) -) -/ - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type) -/ -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order) -/ - -CREATE SEQUENCE phpbb_profile_fields_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_profile_fields -BEFORE INSERT ON phpbb_profile_fields -FOR EACH ROW WHEN ( - new.field_id IS NULL OR new.field_id = 0 -) -BEGIN - SELECT phpbb_profile_fields_seq.nextval - INTO :new.field_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE phpbb_profile_fields_data ( - user_id number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id) -) -/ - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE phpbb_profile_fields_lang ( - field_id number(8) DEFAULT '0' NOT NULL, - lang_id number(8) DEFAULT '0' NOT NULL, - option_id number(8) DEFAULT '0' NOT NULL, - field_type number(4) DEFAULT '0' NOT NULL, - lang_value varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_profile_fields_lang PRIMARY KEY (field_id, lang_id, option_id) -) -/ - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE phpbb_profile_lang ( - field_id number(8) DEFAULT '0' NOT NULL, - lang_id number(8) DEFAULT '0' NOT NULL, - lang_name varchar2(765) DEFAULT '' , - lang_explain clob DEFAULT '' , - lang_default_value varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id) -) -/ - - -/* - Table: 'phpbb_ranks' -*/ -CREATE TABLE phpbb_ranks ( - rank_id number(8) NOT NULL, - rank_title varchar2(765) DEFAULT '' , - rank_min number(8) DEFAULT '0' NOT NULL, - rank_special number(1) DEFAULT '0' NOT NULL, - rank_image varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id) -) -/ - - -CREATE SEQUENCE phpbb_ranks_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_ranks -BEFORE INSERT ON phpbb_ranks -FOR EACH ROW WHEN ( - new.rank_id IS NULL OR new.rank_id = 0 -) -BEGIN - SELECT phpbb_ranks_seq.nextval - INTO :new.rank_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_reports' -*/ -CREATE TABLE phpbb_reports ( - report_id number(8) NOT NULL, - reason_id number(4) DEFAULT '0' NOT NULL, - post_id number(8) DEFAULT '0' NOT NULL, - pm_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - user_notify number(1) DEFAULT '0' NOT NULL, - report_closed number(1) DEFAULT '0' NOT NULL, - report_time number(11) DEFAULT '0' NOT NULL, - report_text clob DEFAULT '' , - reported_post_text clob DEFAULT '' , - CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) -) -/ - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id) -/ -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id) -/ - -CREATE SEQUENCE phpbb_reports_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_reports -BEFORE INSERT ON phpbb_reports -FOR EACH ROW WHEN ( - new.report_id IS NULL OR new.report_id = 0 -) -BEGIN - SELECT phpbb_reports_seq.nextval - INTO :new.report_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE TABLE phpbb_reports_reasons ( - reason_id number(4) NOT NULL, - reason_title varchar2(765) DEFAULT '' , - reason_description clob DEFAULT '' , - reason_order number(4) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id) -) -/ - - -CREATE SEQUENCE phpbb_reports_reasons_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_reports_reasons -BEFORE INSERT ON phpbb_reports_reasons -FOR EACH ROW WHEN ( - new.reason_id IS NULL OR new.reason_id = 0 -) -BEGIN - SELECT phpbb_reports_reasons_seq.nextval - INTO :new.reason_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE phpbb_search_results ( - search_key varchar2(32) DEFAULT '' , - search_time number(11) DEFAULT '0' NOT NULL, - search_keywords clob DEFAULT '' , - search_authors clob DEFAULT '' , - CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_key) -) -/ - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE TABLE phpbb_search_wordlist ( - word_id number(8) NOT NULL, - word_text varchar2(765) DEFAULT '' , - word_common number(1) DEFAULT '0' NOT NULL, - word_count number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id), - CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text) -) -/ - -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count) -/ - -CREATE SEQUENCE phpbb_search_wordlist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_search_wordlist -BEFORE INSERT ON phpbb_search_wordlist -FOR EACH ROW WHEN ( - new.word_id IS NULL OR new.word_id = 0 -) -BEGIN - SELECT phpbb_search_wordlist_seq.nextval - INTO :new.word_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE phpbb_search_wordmatch ( - post_id number(8) DEFAULT '0' NOT NULL, - word_id number(8) DEFAULT '0' NOT NULL, - title_match number(1) DEFAULT '0' NOT NULL, - CONSTRAINT u_phpbb_unq_mtch UNIQUE (word_id, post_id, title_match) -) -/ - -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id) -/ -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id) -/ - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' , - session_user_id number(8) DEFAULT '0' NOT NULL, - session_forum_id number(8) DEFAULT '0' NOT NULL, - session_last_visit number(11) DEFAULT '0' NOT NULL, - session_start number(11) DEFAULT '0' NOT NULL, - session_time number(11) DEFAULT '0' NOT NULL, - session_ip varchar2(40) DEFAULT '' , - session_browser varchar2(150) DEFAULT '' , - session_forwarded_for varchar2(255) DEFAULT '' , - session_page varchar2(765) DEFAULT '' , - session_viewonline number(1) DEFAULT '1' NOT NULL, - session_autologin number(1) DEFAULT '0' NOT NULL, - session_admin number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id) -) -/ - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time) -/ -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id) -/ -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id) -/ - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' , - user_id number(8) DEFAULT '0' NOT NULL, - last_ip varchar2(40) DEFAULT '' , - last_login number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sessions_keys PRIMARY KEY (key_id, user_id) -) -/ - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login) -/ - -/* - Table: 'phpbb_sitelist' -*/ -CREATE TABLE phpbb_sitelist ( - site_id number(8) NOT NULL, - site_ip varchar2(40) DEFAULT '' , - site_hostname varchar2(255) DEFAULT '' , - ip_exclude number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sitelist PRIMARY KEY (site_id) -) -/ - - -CREATE SEQUENCE phpbb_sitelist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_sitelist -BEFORE INSERT ON phpbb_sitelist -FOR EACH ROW WHEN ( - new.site_id IS NULL OR new.site_id = 0 -) -BEGIN - SELECT phpbb_sitelist_seq.nextval - INTO :new.site_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_smilies' -*/ -CREATE TABLE phpbb_smilies ( - smiley_id number(8) NOT NULL, - code varchar2(150) DEFAULT '' , - emotion varchar2(150) DEFAULT '' , - smiley_url varchar2(50) DEFAULT '' , - smiley_width number(4) DEFAULT '0' NOT NULL, - smiley_height number(4) DEFAULT '0' NOT NULL, - smiley_order number(8) DEFAULT '0' NOT NULL, - display_on_posting number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id) -) -/ - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting) -/ - -CREATE SEQUENCE phpbb_smilies_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_smilies -BEFORE INSERT ON phpbb_smilies -FOR EACH ROW WHEN ( - new.smiley_id IS NULL OR new.smiley_id = 0 -) -BEGIN - SELECT phpbb_smilies_seq.nextval - INTO :new.smiley_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_styles' -*/ -CREATE TABLE phpbb_styles ( - style_id number(8) NOT NULL, - style_name varchar2(765) DEFAULT '' , - style_copyright varchar2(765) DEFAULT '' , - style_active number(1) DEFAULT '1' NOT NULL, - style_path varchar2(100) DEFAULT '' , - bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id number(4) DEFAULT '0' NOT NULL, - style_parent_tree clob DEFAULT '' , - CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id), - CONSTRAINT u_phpbb_style_name UNIQUE (style_name) -) -/ - - -CREATE SEQUENCE phpbb_styles_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_styles -BEFORE INSERT ON phpbb_styles -FOR EACH ROW WHEN ( - new.style_id IS NULL OR new.style_id = 0 -) -BEGIN - SELECT phpbb_styles_seq.nextval - INTO :new.style_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_topics' -*/ -CREATE TABLE phpbb_topics ( - topic_id number(8) NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - topic_attachment number(1) DEFAULT '0' NOT NULL, - topic_approved number(1) DEFAULT '1' NOT NULL, - topic_reported number(1) DEFAULT '0' NOT NULL, - topic_title varchar2(765) DEFAULT '' , - topic_poster number(8) DEFAULT '0' NOT NULL, - topic_time number(11) DEFAULT '0' NOT NULL, - topic_time_limit number(11) DEFAULT '0' NOT NULL, - topic_views number(8) DEFAULT '0' NOT NULL, - topic_replies number(8) DEFAULT '0' NOT NULL, - topic_replies_real number(8) DEFAULT '0' NOT NULL, - topic_status number(3) DEFAULT '0' NOT NULL, - topic_type number(3) DEFAULT '0' NOT NULL, - topic_first_post_id number(8) DEFAULT '0' NOT NULL, - topic_first_poster_name varchar2(765) DEFAULT '' , - topic_first_poster_colour varchar2(6) DEFAULT '' , - topic_last_post_id number(8) DEFAULT '0' NOT NULL, - topic_last_poster_id number(8) DEFAULT '0' NOT NULL, - topic_last_poster_name varchar2(765) DEFAULT '' , - topic_last_poster_colour varchar2(6) DEFAULT '' , - topic_last_post_subject varchar2(765) DEFAULT '' , - topic_last_post_time number(11) DEFAULT '0' NOT NULL, - topic_last_view_time number(11) DEFAULT '0' NOT NULL, - topic_moved_id number(8) DEFAULT '0' NOT NULL, - topic_bumped number(1) DEFAULT '0' NOT NULL, - topic_bumper number(8) DEFAULT '0' NOT NULL, - poll_title varchar2(765) DEFAULT '' , - poll_start number(11) DEFAULT '0' NOT NULL, - poll_length number(11) DEFAULT '0' NOT NULL, - poll_max_options number(4) DEFAULT '1' NOT NULL, - poll_last_vote number(11) DEFAULT '0' NOT NULL, - poll_vote_change number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id) -) -/ - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id) -/ -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type) -/ -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time) -/ -CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved) -/ -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id) -/ -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id) -/ - -CREATE SEQUENCE phpbb_topics_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_topics -BEFORE INSERT ON phpbb_topics -FOR EACH ROW WHEN ( - new.topic_id IS NULL OR new.topic_id = 0 -) -BEGIN - SELECT phpbb_topics_seq.nextval - INTO :new.topic_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE phpbb_topics_track ( - user_id number(8) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - mark_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics_track PRIMARY KEY (user_id, topic_id) -) -/ - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id) -/ -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id) -/ - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE phpbb_topics_posted ( - user_id number(8) DEFAULT '0' NOT NULL, - topic_id number(8) DEFAULT '0' NOT NULL, - topic_posted number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics_posted PRIMARY KEY (user_id, topic_id) -) -/ - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE phpbb_topics_watch ( - topic_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - notify_status number(1) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id) -/ -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id) -/ -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status) -/ - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE phpbb_user_group ( - group_id number(8) DEFAULT '0' NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - group_leader number(1) DEFAULT '0' NOT NULL, - user_pending number(1) DEFAULT '1' NOT NULL -) -/ - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id) -/ -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id) -/ -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader) -/ - -/* - Table: 'phpbb_users' -*/ -CREATE TABLE phpbb_users ( - user_id number(8) NOT NULL, - user_type number(2) DEFAULT '0' NOT NULL, - group_id number(8) DEFAULT '3' NOT NULL, - user_permissions clob DEFAULT '' , - user_perm_from number(8) DEFAULT '0' NOT NULL, - user_ip varchar2(40) DEFAULT '' , - user_regdate number(11) DEFAULT '0' NOT NULL, - username varchar2(255) DEFAULT '' , - username_clean varchar2(255) DEFAULT '' , - user_password varchar2(120) DEFAULT '' , - user_passchg number(11) DEFAULT '0' NOT NULL, - user_pass_convert number(1) DEFAULT '0' NOT NULL, - user_email varchar2(300) DEFAULT '' , - user_email_hash number(20) DEFAULT '0' NOT NULL, - user_birthday varchar2(10) DEFAULT '' , - user_lastvisit number(11) DEFAULT '0' NOT NULL, - user_lastmark number(11) DEFAULT '0' NOT NULL, - user_lastpost_time number(11) DEFAULT '0' NOT NULL, - user_lastpage varchar2(600) DEFAULT '' , - user_last_confirm_key varchar2(10) DEFAULT '' , - user_last_search number(11) DEFAULT '0' NOT NULL, - user_warnings number(4) DEFAULT '0' NOT NULL, - user_last_warning number(11) DEFAULT '0' NOT NULL, - user_login_attempts number(4) DEFAULT '0' NOT NULL, - user_inactive_reason number(2) DEFAULT '0' NOT NULL, - user_inactive_time number(11) DEFAULT '0' NOT NULL, - user_posts number(8) DEFAULT '0' NOT NULL, - user_lang varchar2(30) DEFAULT '' , - user_timezone varchar2(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar2(90) DEFAULT 'd M Y H:i' NOT NULL, - user_style number(8) DEFAULT '0' NOT NULL, - user_rank number(8) DEFAULT '0' NOT NULL, - user_colour varchar2(6) DEFAULT '' , - user_new_privmsg number(4) DEFAULT '0' NOT NULL, - user_unread_privmsg number(4) DEFAULT '0' NOT NULL, - user_last_privmsg number(11) DEFAULT '0' NOT NULL, - user_message_rules number(1) DEFAULT '0' NOT NULL, - user_full_folder number(11) DEFAULT '-3' NOT NULL, - user_emailtime number(11) DEFAULT '0' NOT NULL, - user_topic_show_days number(4) DEFAULT '0' NOT NULL, - user_topic_sortby_type varchar2(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar2(1) DEFAULT 'd' NOT NULL, - user_post_show_days number(4) DEFAULT '0' NOT NULL, - user_post_sortby_type varchar2(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar2(1) DEFAULT 'a' NOT NULL, - user_notify number(1) DEFAULT '0' NOT NULL, - user_notify_pm number(1) DEFAULT '1' NOT NULL, - user_notify_type number(4) DEFAULT '0' NOT NULL, - user_allow_pm number(1) DEFAULT '1' NOT NULL, - user_allow_viewonline number(1) DEFAULT '1' NOT NULL, - user_allow_viewemail number(1) DEFAULT '1' NOT NULL, - user_allow_massemail number(1) DEFAULT '1' NOT NULL, - user_options number(11) DEFAULT '230271' NOT NULL, - user_avatar varchar2(255) DEFAULT '' , - user_avatar_type number(2) DEFAULT '0' NOT NULL, - user_avatar_width number(4) DEFAULT '0' NOT NULL, - user_avatar_height number(4) DEFAULT '0' NOT NULL, - user_sig clob DEFAULT '' , - user_sig_bbcode_uid varchar2(8) DEFAULT '' , - user_sig_bbcode_bitfield varchar2(255) DEFAULT '' , - user_from varchar2(300) DEFAULT '' , - user_icq varchar2(15) DEFAULT '' , - user_aim varchar2(765) DEFAULT '' , - user_yim varchar2(765) DEFAULT '' , - user_msnm varchar2(765) DEFAULT '' , - user_jabber varchar2(765) DEFAULT '' , - user_website varchar2(600) DEFAULT '' , - user_occ clob DEFAULT '' , - user_interests clob DEFAULT '' , - user_actkey varchar2(32) DEFAULT '' , - user_newpasswd varchar2(120) DEFAULT '' , - user_form_salt varchar2(96) DEFAULT '' , - user_new number(1) DEFAULT '1' NOT NULL, - user_reminded number(4) DEFAULT '0' NOT NULL, - user_reminded_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), - CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) -) -/ - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) -/ -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) -/ -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) -/ - -CREATE SEQUENCE phpbb_users_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_users -BEFORE INSERT ON phpbb_users -FOR EACH ROW WHEN ( - new.user_id IS NULL OR new.user_id = 0 -) -BEGIN - SELECT phpbb_users_seq.nextval - INTO :new.user_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_warnings' -*/ -CREATE TABLE phpbb_warnings ( - warning_id number(8) NOT NULL, - user_id number(8) DEFAULT '0' NOT NULL, - post_id number(8) DEFAULT '0' NOT NULL, - log_id number(8) DEFAULT '0' NOT NULL, - warning_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id) -) -/ - - -CREATE SEQUENCE phpbb_warnings_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_warnings -BEFORE INSERT ON phpbb_warnings -FOR EACH ROW WHEN ( - new.warning_id IS NULL OR new.warning_id = 0 -) -BEGIN - SELECT phpbb_warnings_seq.nextval - INTO :new.warning_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_words' -*/ -CREATE TABLE phpbb_words ( - word_id number(8) NOT NULL, - word varchar2(765) DEFAULT '' , - replacement varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id) -) -/ - - -CREATE SEQUENCE phpbb_words_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_words -BEFORE INSERT ON phpbb_words -FOR EACH ROW WHEN ( - new.word_id IS NULL OR new.word_id = 0 -) -BEGIN - SELECT phpbb_words_seq.nextval - INTO :new.word_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE phpbb_zebra ( - user_id number(8) DEFAULT '0' NOT NULL, - zebra_id number(8) DEFAULT '0' NOT NULL, - friend number(1) DEFAULT '0' NOT NULL, - foe number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_zebra PRIMARY KEY (user_id, zebra_id) -) -/ - - +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +/* + This first section is optional, however its probably the best method + of running phpBB on Oracle. If you already have a tablespace and user created + for phpBB you can leave this section commented out! + + The first set of statements create a phpBB tablespace and a phpBB user, + make sure you change the password of the phpBB user before you run this script!! +*/ + +/* +CREATE TABLESPACE "PHPBB" + LOGGING + DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' + SIZE 10M + AUTOEXTEND ON NEXT 10M + MAXSIZE 100M; + +CREATE USER "PHPBB" + PROFILE "DEFAULT" + IDENTIFIED BY "phpbb_password" + DEFAULT TABLESPACE "PHPBB" + QUOTA UNLIMITED ON "PHPBB" + ACCOUNT UNLOCK; + +GRANT ANALYZE ANY TO "PHPBB"; +GRANT CREATE SEQUENCE TO "PHPBB"; +GRANT CREATE SESSION TO "PHPBB"; +GRANT CREATE TABLE TO "PHPBB"; +GRANT CREATE TRIGGER TO "PHPBB"; +GRANT CREATE VIEW TO "PHPBB"; +GRANT "CONNECT" TO "PHPBB"; + +COMMIT; +DISCONNECT; + +CONNECT phpbb/phpbb_password; +*/ +/* + Table: 'phpbb_attachments' +*/ +CREATE TABLE phpbb_attachments ( + attach_id number(8) NOT NULL, + post_msg_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + in_message number(1) DEFAULT '0' NOT NULL, + poster_id number(8) DEFAULT '0' NOT NULL, + is_orphan number(1) DEFAULT '1' NOT NULL, + physical_filename varchar2(255) DEFAULT '' , + real_filename varchar2(255) DEFAULT '' , + download_count number(8) DEFAULT '0' NOT NULL, + attach_comment clob DEFAULT '' , + extension varchar2(100) DEFAULT '' , + mimetype varchar2(100) DEFAULT '' , + filesize number(20) DEFAULT '0' NOT NULL, + filetime number(11) DEFAULT '0' NOT NULL, + thumbnail number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_attachments PRIMARY KEY (attach_id) +) +/ + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime) +/ +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id) +/ +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) +/ +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) +/ +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) +/ + +CREATE SEQUENCE phpbb_attachments_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_attachments +BEFORE INSERT ON phpbb_attachments +FOR EACH ROW WHEN ( + new.attach_id IS NULL OR new.attach_id = 0 +) +BEGIN + SELECT phpbb_attachments_seq.nextval + INTO :new.attach_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE phpbb_acl_groups ( + group_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_role_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id) +/ +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id) +/ +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id) +/ + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE phpbb_acl_options ( + auth_option_id number(8) NOT NULL, + auth_option varchar2(50) DEFAULT '' , + is_global number(1) DEFAULT '0' NOT NULL, + is_local number(1) DEFAULT '0' NOT NULL, + founder_only number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id), + CONSTRAINT u_phpbb_auth_option UNIQUE (auth_option) +) +/ + + +CREATE SEQUENCE phpbb_acl_options_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_acl_options +BEFORE INSERT ON phpbb_acl_options +FOR EACH ROW WHEN ( + new.auth_option_id IS NULL OR new.auth_option_id = 0 +) +BEGIN + SELECT phpbb_acl_options_seq.nextval + INTO :new.auth_option_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE phpbb_acl_roles ( + role_id number(8) NOT NULL, + role_name varchar2(765) DEFAULT '' , + role_description clob DEFAULT '' , + role_type varchar2(10) DEFAULT '' , + role_order number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_acl_roles PRIMARY KEY (role_id) +) +/ + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type) +/ +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order) +/ + +CREATE SEQUENCE phpbb_acl_roles_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_acl_roles +BEFORE INSERT ON phpbb_acl_roles +FOR EACH ROW WHEN ( + new.role_id IS NULL OR new.role_id = 0 +) +BEGIN + SELECT phpbb_acl_roles_seq.nextval + INTO :new.role_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE phpbb_acl_roles_data ( + role_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_acl_roles_data PRIMARY KEY (role_id, auth_option_id) +) +/ + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id) +/ + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE phpbb_acl_users ( + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + auth_option_id number(8) DEFAULT '0' NOT NULL, + auth_role_id number(8) DEFAULT '0' NOT NULL, + auth_setting number(2) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id) +/ +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id) +/ +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id) +/ + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE phpbb_banlist ( + ban_id number(8) NOT NULL, + ban_userid number(8) DEFAULT '0' NOT NULL, + ban_ip varchar2(40) DEFAULT '' , + ban_email varchar2(300) DEFAULT '' , + ban_start number(11) DEFAULT '0' NOT NULL, + ban_end number(11) DEFAULT '0' NOT NULL, + ban_exclude number(1) DEFAULT '0' NOT NULL, + ban_reason varchar2(765) DEFAULT '' , + ban_give_reason varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id) +) +/ + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end) +/ +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude) +/ +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude) +/ +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude) +/ + +CREATE SEQUENCE phpbb_banlist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_banlist +BEFORE INSERT ON phpbb_banlist +FOR EACH ROW WHEN ( + new.ban_id IS NULL OR new.ban_id = 0 +) +BEGIN + SELECT phpbb_banlist_seq.nextval + INTO :new.ban_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id number(4) DEFAULT '0' NOT NULL, + bbcode_tag varchar2(16) DEFAULT '' , + bbcode_helpline varchar2(765) DEFAULT '' , + display_on_posting number(1) DEFAULT '0' NOT NULL, + bbcode_match clob DEFAULT '' , + bbcode_tpl clob DEFAULT '' , + first_pass_match clob DEFAULT '' , + first_pass_replace clob DEFAULT '' , + second_pass_match clob DEFAULT '' , + second_pass_replace clob DEFAULT '' , + CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id) +) +/ + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting) +/ + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_bookmarks PRIMARY KEY (topic_id, user_id) +) +/ + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE phpbb_bots ( + bot_id number(8) NOT NULL, + bot_active number(1) DEFAULT '1' NOT NULL, + bot_name varchar2(765) DEFAULT '' , + user_id number(8) DEFAULT '0' NOT NULL, + bot_agent varchar2(255) DEFAULT '' , + bot_ip varchar2(255) DEFAULT '' , + CONSTRAINT pk_phpbb_bots PRIMARY KEY (bot_id) +) +/ + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active) +/ + +CREATE SEQUENCE phpbb_bots_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_bots +BEFORE INSERT ON phpbb_bots +FOR EACH ROW WHEN ( + new.bot_id IS NULL OR new.bot_id = 0 +) +BEGIN + SELECT phpbb_bots_seq.nextval + INTO :new.bot_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE phpbb_config ( + config_name varchar2(255) DEFAULT '' , + config_value varchar2(765) DEFAULT '' , + is_dynamic number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name) +) +/ + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic) +/ + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' , + session_id char(32) DEFAULT '' , + confirm_type number(3) DEFAULT '0' NOT NULL, + code varchar2(8) DEFAULT '' , + seed number(10) DEFAULT '0' NOT NULL, + attempts number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) +) +/ + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type) +/ + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE phpbb_disallow ( + disallow_id number(8) NOT NULL, + disallow_username varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id) +) +/ + + +CREATE SEQUENCE phpbb_disallow_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_disallow +BEFORE INSERT ON phpbb_disallow +FOR EACH ROW WHEN ( + new.disallow_id IS NULL OR new.disallow_id = 0 +) +BEGIN + SELECT phpbb_disallow_seq.nextval + INTO :new.disallow_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_drafts' +*/ +CREATE TABLE phpbb_drafts ( + draft_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + save_time number(11) DEFAULT '0' NOT NULL, + draft_subject varchar2(765) DEFAULT '' , + draft_message clob DEFAULT '' , + CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id) +) +/ + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time) +/ + +CREATE SEQUENCE phpbb_drafts_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_drafts +BEFORE INSERT ON phpbb_drafts +FOR EACH ROW WHEN ( + new.draft_id IS NULL OR new.draft_id = 0 +) +BEGIN + SELECT phpbb_drafts_seq.nextval + INTO :new.draft_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar2(255) DEFAULT '' , + ext_active number(1) DEFAULT '0' NOT NULL, + ext_state clob DEFAULT '' , + CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) +) +/ + + +/* + Table: 'phpbb_extensions' +*/ +CREATE TABLE phpbb_extensions ( + extension_id number(8) NOT NULL, + group_id number(8) DEFAULT '0' NOT NULL, + extension varchar2(100) DEFAULT '' , + CONSTRAINT pk_phpbb_extensions PRIMARY KEY (extension_id) +) +/ + + +CREATE SEQUENCE phpbb_extensions_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_extensions +BEFORE INSERT ON phpbb_extensions +FOR EACH ROW WHEN ( + new.extension_id IS NULL OR new.extension_id = 0 +) +BEGIN + SELECT phpbb_extensions_seq.nextval + INTO :new.extension_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE TABLE phpbb_extension_groups ( + group_id number(8) NOT NULL, + group_name varchar2(765) DEFAULT '' , + cat_id number(2) DEFAULT '0' NOT NULL, + allow_group number(1) DEFAULT '0' NOT NULL, + download_mode number(1) DEFAULT '1' NOT NULL, + upload_icon varchar2(255) DEFAULT '' , + max_filesize number(20) DEFAULT '0' NOT NULL, + allowed_forums clob DEFAULT '' , + allow_in_pm number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id) +) +/ + + +CREATE SEQUENCE phpbb_extension_groups_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_extension_groups +BEFORE INSERT ON phpbb_extension_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT phpbb_extension_groups_seq.nextval + INTO :new.group_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE phpbb_forums ( + forum_id number(8) NOT NULL, + parent_id number(8) DEFAULT '0' NOT NULL, + left_id number(8) DEFAULT '0' NOT NULL, + right_id number(8) DEFAULT '0' NOT NULL, + forum_parents clob DEFAULT '' , + forum_name varchar2(765) DEFAULT '' , + forum_desc clob DEFAULT '' , + forum_desc_bitfield varchar2(255) DEFAULT '' , + forum_desc_options number(11) DEFAULT '7' NOT NULL, + forum_desc_uid varchar2(8) DEFAULT '' , + forum_link varchar2(765) DEFAULT '' , + forum_password varchar2(120) DEFAULT '' , + forum_style number(8) DEFAULT '0' NOT NULL, + forum_image varchar2(255) DEFAULT '' , + forum_rules clob DEFAULT '' , + forum_rules_link varchar2(765) DEFAULT '' , + forum_rules_bitfield varchar2(255) DEFAULT '' , + forum_rules_options number(11) DEFAULT '7' NOT NULL, + forum_rules_uid varchar2(8) DEFAULT '' , + forum_topics_per_page number(4) DEFAULT '0' NOT NULL, + forum_type number(4) DEFAULT '0' NOT NULL, + forum_status number(4) DEFAULT '0' NOT NULL, + forum_posts number(8) DEFAULT '0' NOT NULL, + forum_topics number(8) DEFAULT '0' NOT NULL, + forum_topics_real number(8) DEFAULT '0' NOT NULL, + forum_last_post_id number(8) DEFAULT '0' NOT NULL, + forum_last_poster_id number(8) DEFAULT '0' NOT NULL, + forum_last_post_subject varchar2(765) DEFAULT '' , + forum_last_post_time number(11) DEFAULT '0' NOT NULL, + forum_last_poster_name varchar2(765) DEFAULT '' , + forum_last_poster_colour varchar2(6) DEFAULT '' , + forum_flags number(4) DEFAULT '32' NOT NULL, + forum_options number(20) DEFAULT '0' NOT NULL, + display_subforum_list number(1) DEFAULT '1' NOT NULL, + display_on_index number(1) DEFAULT '1' NOT NULL, + enable_indexing number(1) DEFAULT '1' NOT NULL, + enable_icons number(1) DEFAULT '1' NOT NULL, + enable_prune number(1) DEFAULT '0' NOT NULL, + prune_next number(11) DEFAULT '0' NOT NULL, + prune_days number(8) DEFAULT '0' NOT NULL, + prune_viewed number(8) DEFAULT '0' NOT NULL, + prune_freq number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id) +) +/ + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id) +/ +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id) +/ + +CREATE SEQUENCE phpbb_forums_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_forums +BEFORE INSERT ON phpbb_forums +FOR EACH ROW WHEN ( + new.forum_id IS NULL OR new.forum_id = 0 +) +BEGIN + SELECT phpbb_forums_seq.nextval + INTO :new.forum_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE phpbb_forums_access ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + session_id char(32) DEFAULT '' , + CONSTRAINT pk_phpbb_forums_access PRIMARY KEY (forum_id, user_id, session_id) +) +/ + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE phpbb_forums_track ( + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_forums_track PRIMARY KEY (user_id, forum_id) +) +/ + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE phpbb_forums_watch ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + notify_status number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id) +/ +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id) +/ +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status) +/ + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE phpbb_groups ( + group_id number(8) NOT NULL, + group_type number(4) DEFAULT '1' NOT NULL, + group_founder_manage number(1) DEFAULT '0' NOT NULL, + group_skip_auth number(1) DEFAULT '0' NOT NULL, + group_name varchar2(255) DEFAULT '' , + group_desc clob DEFAULT '' , + group_desc_bitfield varchar2(255) DEFAULT '' , + group_desc_options number(11) DEFAULT '7' NOT NULL, + group_desc_uid varchar2(8) DEFAULT '' , + group_display number(1) DEFAULT '0' NOT NULL, + group_avatar varchar2(255) DEFAULT '' , + group_avatar_type number(2) DEFAULT '0' NOT NULL, + group_avatar_width number(4) DEFAULT '0' NOT NULL, + group_avatar_height number(4) DEFAULT '0' NOT NULL, + group_rank number(8) DEFAULT '0' NOT NULL, + group_colour varchar2(6) DEFAULT '' , + group_sig_chars number(8) DEFAULT '0' NOT NULL, + group_receive_pm number(1) DEFAULT '0' NOT NULL, + group_message_limit number(8) DEFAULT '0' NOT NULL, + group_max_recipients number(8) DEFAULT '0' NOT NULL, + group_legend number(8) DEFAULT '0' NOT NULL, + group_teampage number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) +) +/ + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name) +/ + +CREATE SEQUENCE phpbb_groups_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_groups +BEFORE INSERT ON phpbb_groups +FOR EACH ROW WHEN ( + new.group_id IS NULL OR new.group_id = 0 +) +BEGIN + SELECT phpbb_groups_seq.nextval + INTO :new.group_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE phpbb_icons ( + icons_id number(8) NOT NULL, + icons_url varchar2(255) DEFAULT '' , + icons_width number(4) DEFAULT '0' NOT NULL, + icons_height number(4) DEFAULT '0' NOT NULL, + icons_order number(8) DEFAULT '0' NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id) +) +/ + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting) +/ + +CREATE SEQUENCE phpbb_icons_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_icons +BEFORE INSERT ON phpbb_icons +FOR EACH ROW WHEN ( + new.icons_id IS NULL OR new.icons_id = 0 +) +BEGIN + SELECT phpbb_icons_seq.nextval + INTO :new.icons_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE phpbb_lang ( + lang_id number(4) NOT NULL, + lang_iso varchar2(30) DEFAULT '' , + lang_dir varchar2(30) DEFAULT '' , + lang_english_name varchar2(300) DEFAULT '' , + lang_local_name varchar2(765) DEFAULT '' , + lang_author varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id) +) +/ + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso) +/ + +CREATE SEQUENCE phpbb_lang_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_lang +BEFORE INSERT ON phpbb_lang +FOR EACH ROW WHEN ( + new.lang_id IS NULL OR new.lang_id = 0 +) +BEGIN + SELECT phpbb_lang_seq.nextval + INTO :new.lang_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_log' +*/ +CREATE TABLE phpbb_log ( + log_id number(8) NOT NULL, + log_type number(4) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + reportee_id number(8) DEFAULT '0' NOT NULL, + log_ip varchar2(40) DEFAULT '' , + log_time number(11) DEFAULT '0' NOT NULL, + log_operation clob DEFAULT '' , + log_data clob DEFAULT '' , + CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id) +) +/ + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type) +/ +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time) +/ +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id) +/ +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id) +/ +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id) +/ +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id) +/ + +CREATE SEQUENCE phpbb_log_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_log +BEFORE INSERT ON phpbb_log +FOR EACH ROW WHEN ( + new.log_id IS NULL OR new.log_id = 0 +) +BEGIN + SELECT phpbb_log_seq.nextval + INTO :new.log_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar2(40) DEFAULT '' , + attempt_browser varchar2(150) DEFAULT '' , + attempt_forwarded_for varchar2(255) DEFAULT '' , + attempt_time number(11) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(765) DEFAULT '0' NOT NULL, + username_clean varchar2(255) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time) +/ +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time) +/ +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time) +/ +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id) +/ + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + username varchar2(765) DEFAULT '' , + group_id number(8) DEFAULT '0' NOT NULL, + group_name varchar2(765) DEFAULT '' , + display_on_index number(1) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index) +/ +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id) +/ + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE phpbb_modules ( + module_id number(8) NOT NULL, + module_enabled number(1) DEFAULT '1' NOT NULL, + module_display number(1) DEFAULT '1' NOT NULL, + module_basename varchar2(255) DEFAULT '' , + module_class varchar2(10) DEFAULT '' , + parent_id number(8) DEFAULT '0' NOT NULL, + left_id number(8) DEFAULT '0' NOT NULL, + right_id number(8) DEFAULT '0' NOT NULL, + module_langname varchar2(255) DEFAULT '' , + module_mode varchar2(255) DEFAULT '' , + module_auth varchar2(255) DEFAULT '' , + CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id) +) +/ + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id) +/ +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled) +/ +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id) +/ + +CREATE SEQUENCE phpbb_modules_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_modules +BEFORE INSERT ON phpbb_modules +FOR EACH ROW WHEN ( + new.module_id IS NULL OR new.module_id = 0 +) +BEGIN + SELECT phpbb_modules_seq.nextval + INTO :new.module_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE phpbb_poll_options ( + poll_option_id number(4) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + poll_option_text clob DEFAULT '' , + poll_option_total number(8) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id) +/ +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id) +/ + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE phpbb_poll_votes ( + topic_id number(8) DEFAULT '0' NOT NULL, + poll_option_id number(4) DEFAULT '0' NOT NULL, + vote_user_id number(8) DEFAULT '0' NOT NULL, + vote_user_ip varchar2(40) DEFAULT '' +) +/ + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id) +/ +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id) +/ +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip) +/ + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE phpbb_posts ( + post_id number(8) NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + poster_id number(8) DEFAULT '0' NOT NULL, + icon_id number(8) DEFAULT '0' NOT NULL, + poster_ip varchar2(40) DEFAULT '' , + post_time number(11) DEFAULT '0' NOT NULL, + post_approved number(1) DEFAULT '1' NOT NULL, + post_reported number(1) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' NOT NULL, + enable_smilies number(1) DEFAULT '1' NOT NULL, + enable_magic_url number(1) DEFAULT '1' NOT NULL, + enable_sig number(1) DEFAULT '1' NOT NULL, + post_username varchar2(765) DEFAULT '' , + post_subject varchar2(765) DEFAULT '' , + post_text clob DEFAULT '' , + post_checksum varchar2(32) DEFAULT '' , + post_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield varchar2(255) DEFAULT '' , + bbcode_uid varchar2(8) DEFAULT '' , + post_postcount number(1) DEFAULT '1' NOT NULL, + post_edit_time number(11) DEFAULT '0' NOT NULL, + post_edit_reason varchar2(765) DEFAULT '' , + post_edit_user number(8) DEFAULT '0' NOT NULL, + post_edit_count number(4) DEFAULT '0' NOT NULL, + post_edit_locked number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id) +) +/ + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id) +/ +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id) +/ +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip) +/ +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) +/ +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved) +/ +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username) +/ +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) +/ + +CREATE SEQUENCE phpbb_posts_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_posts +BEFORE INSERT ON phpbb_posts +FOR EACH ROW WHEN ( + new.post_id IS NULL OR new.post_id = 0 +) +BEGIN + SELECT phpbb_posts_seq.nextval + INTO :new.post_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE phpbb_privmsgs ( + msg_id number(8) NOT NULL, + root_level number(8) DEFAULT '0' NOT NULL, + author_id number(8) DEFAULT '0' NOT NULL, + icon_id number(8) DEFAULT '0' NOT NULL, + author_ip varchar2(40) DEFAULT '' , + message_time number(11) DEFAULT '0' NOT NULL, + enable_bbcode number(1) DEFAULT '1' NOT NULL, + enable_smilies number(1) DEFAULT '1' NOT NULL, + enable_magic_url number(1) DEFAULT '1' NOT NULL, + enable_sig number(1) DEFAULT '1' NOT NULL, + message_subject varchar2(765) DEFAULT '' , + message_text clob DEFAULT '' , + message_edit_reason varchar2(765) DEFAULT '' , + message_edit_user number(8) DEFAULT '0' NOT NULL, + message_attachment number(1) DEFAULT '0' NOT NULL, + bbcode_bitfield varchar2(255) DEFAULT '' , + bbcode_uid varchar2(8) DEFAULT '' , + message_edit_time number(11) DEFAULT '0' NOT NULL, + message_edit_count number(4) DEFAULT '0' NOT NULL, + to_address clob DEFAULT '' , + bcc_address clob DEFAULT '' , + message_reported number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) +) +/ + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip) +/ +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time) +/ +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id) +/ +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level) +/ + +CREATE SEQUENCE phpbb_privmsgs_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs +BEFORE INSERT ON phpbb_privmsgs +FOR EACH ROW WHEN ( + new.msg_id IS NULL OR new.msg_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_seq.nextval + INTO :new.msg_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE TABLE phpbb_privmsgs_folder ( + folder_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + folder_name varchar2(765) DEFAULT '' , + pm_count number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id) +) +/ + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id) +/ + +CREATE SEQUENCE phpbb_privmsgs_folder_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_folder +BEFORE INSERT ON phpbb_privmsgs_folder +FOR EACH ROW WHEN ( + new.folder_id IS NULL OR new.folder_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_folder_seq.nextval + INTO :new.folder_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE TABLE phpbb_privmsgs_rules ( + rule_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + rule_check number(8) DEFAULT '0' NOT NULL, + rule_connection number(8) DEFAULT '0' NOT NULL, + rule_string varchar2(765) DEFAULT '' , + rule_user_id number(8) DEFAULT '0' NOT NULL, + rule_group_id number(8) DEFAULT '0' NOT NULL, + rule_action number(8) DEFAULT '0' NOT NULL, + rule_folder_id number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id) +) +/ + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id) +/ + +CREATE SEQUENCE phpbb_privmsgs_rules_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_rules +BEFORE INSERT ON phpbb_privmsgs_rules +FOR EACH ROW WHEN ( + new.rule_id IS NULL OR new.rule_id = 0 +) +BEGIN + SELECT phpbb_privmsgs_rules_seq.nextval + INTO :new.rule_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE phpbb_privmsgs_to ( + msg_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + author_id number(8) DEFAULT '0' NOT NULL, + pm_deleted number(1) DEFAULT '0' NOT NULL, + pm_new number(1) DEFAULT '1' NOT NULL, + pm_unread number(1) DEFAULT '1' NOT NULL, + pm_replied number(1) DEFAULT '0' NOT NULL, + pm_marked number(1) DEFAULT '0' NOT NULL, + pm_forwarded number(1) DEFAULT '0' NOT NULL, + folder_id number(11) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id) +/ +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id) +/ +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id) +/ + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE phpbb_profile_fields ( + field_id number(8) NOT NULL, + field_name varchar2(765) DEFAULT '' , + field_type number(4) DEFAULT '0' NOT NULL, + field_ident varchar2(20) DEFAULT '' , + field_length varchar2(20) DEFAULT '' , + field_minlen varchar2(255) DEFAULT '' , + field_maxlen varchar2(255) DEFAULT '' , + field_novalue varchar2(765) DEFAULT '' , + field_default_value varchar2(765) DEFAULT '' , + field_validation varchar2(60) DEFAULT '' , + field_required number(1) DEFAULT '0' NOT NULL, + field_show_novalue number(1) DEFAULT '0' NOT NULL, + field_show_on_reg number(1) DEFAULT '0' NOT NULL, + field_show_on_pm number(1) DEFAULT '0' NOT NULL, + field_show_on_vt number(1) DEFAULT '0' NOT NULL, + field_show_profile number(1) DEFAULT '0' NOT NULL, + field_hide number(1) DEFAULT '0' NOT NULL, + field_no_view number(1) DEFAULT '0' NOT NULL, + field_active number(1) DEFAULT '0' NOT NULL, + field_order number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id) +) +/ + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type) +/ +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order) +/ + +CREATE SEQUENCE phpbb_profile_fields_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_profile_fields +BEFORE INSERT ON phpbb_profile_fields +FOR EACH ROW WHEN ( + new.field_id IS NULL OR new.field_id = 0 +) +BEGIN + SELECT phpbb_profile_fields_seq.nextval + INTO :new.field_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE phpbb_profile_fields_data ( + user_id number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id) +) +/ + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE phpbb_profile_fields_lang ( + field_id number(8) DEFAULT '0' NOT NULL, + lang_id number(8) DEFAULT '0' NOT NULL, + option_id number(8) DEFAULT '0' NOT NULL, + field_type number(4) DEFAULT '0' NOT NULL, + lang_value varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_profile_fields_lang PRIMARY KEY (field_id, lang_id, option_id) +) +/ + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE phpbb_profile_lang ( + field_id number(8) DEFAULT '0' NOT NULL, + lang_id number(8) DEFAULT '0' NOT NULL, + lang_name varchar2(765) DEFAULT '' , + lang_explain clob DEFAULT '' , + lang_default_value varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id) +) +/ + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE phpbb_ranks ( + rank_id number(8) NOT NULL, + rank_title varchar2(765) DEFAULT '' , + rank_min number(8) DEFAULT '0' NOT NULL, + rank_special number(1) DEFAULT '0' NOT NULL, + rank_image varchar2(255) DEFAULT '' , + CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id) +) +/ + + +CREATE SEQUENCE phpbb_ranks_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_ranks +BEFORE INSERT ON phpbb_ranks +FOR EACH ROW WHEN ( + new.rank_id IS NULL OR new.rank_id = 0 +) +BEGIN + SELECT phpbb_ranks_seq.nextval + INTO :new.rank_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE phpbb_reports ( + report_id number(8) NOT NULL, + reason_id number(4) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + pm_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + user_notify number(1) DEFAULT '0' NOT NULL, + report_closed number(1) DEFAULT '0' NOT NULL, + report_time number(11) DEFAULT '0' NOT NULL, + report_text clob DEFAULT '' , + reported_post_text clob DEFAULT '' , + CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) +) +/ + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id) +/ +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id) +/ + +CREATE SEQUENCE phpbb_reports_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_reports +BEFORE INSERT ON phpbb_reports +FOR EACH ROW WHEN ( + new.report_id IS NULL OR new.report_id = 0 +) +BEGIN + SELECT phpbb_reports_seq.nextval + INTO :new.report_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE phpbb_reports_reasons ( + reason_id number(4) NOT NULL, + reason_title varchar2(765) DEFAULT '' , + reason_description clob DEFAULT '' , + reason_order number(4) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id) +) +/ + + +CREATE SEQUENCE phpbb_reports_reasons_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_reports_reasons +BEFORE INSERT ON phpbb_reports_reasons +FOR EACH ROW WHEN ( + new.reason_id IS NULL OR new.reason_id = 0 +) +BEGIN + SELECT phpbb_reports_reasons_seq.nextval + INTO :new.reason_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE phpbb_search_results ( + search_key varchar2(32) DEFAULT '' , + search_time number(11) DEFAULT '0' NOT NULL, + search_keywords clob DEFAULT '' , + search_authors clob DEFAULT '' , + CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_key) +) +/ + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE phpbb_search_wordlist ( + word_id number(8) NOT NULL, + word_text varchar2(765) DEFAULT '' , + word_common number(1) DEFAULT '0' NOT NULL, + word_count number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id), + CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text) +) +/ + +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count) +/ + +CREATE SEQUENCE phpbb_search_wordlist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_search_wordlist +BEFORE INSERT ON phpbb_search_wordlist +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) +BEGIN + SELECT phpbb_search_wordlist_seq.nextval + INTO :new.word_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE phpbb_search_wordmatch ( + post_id number(8) DEFAULT '0' NOT NULL, + word_id number(8) DEFAULT '0' NOT NULL, + title_match number(1) DEFAULT '0' NOT NULL, + CONSTRAINT u_phpbb_unq_mtch UNIQUE (word_id, post_id, title_match) +) +/ + +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id) +/ +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id) +/ + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' , + session_user_id number(8) DEFAULT '0' NOT NULL, + session_forum_id number(8) DEFAULT '0' NOT NULL, + session_last_visit number(11) DEFAULT '0' NOT NULL, + session_start number(11) DEFAULT '0' NOT NULL, + session_time number(11) DEFAULT '0' NOT NULL, + session_ip varchar2(40) DEFAULT '' , + session_browser varchar2(150) DEFAULT '' , + session_forwarded_for varchar2(255) DEFAULT '' , + session_page varchar2(765) DEFAULT '' , + session_viewonline number(1) DEFAULT '1' NOT NULL, + session_autologin number(1) DEFAULT '0' NOT NULL, + session_admin number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id) +) +/ + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time) +/ +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id) +/ +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id) +/ + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' , + user_id number(8) DEFAULT '0' NOT NULL, + last_ip varchar2(40) DEFAULT '' , + last_login number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sessions_keys PRIMARY KEY (key_id, user_id) +) +/ + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login) +/ + +/* + Table: 'phpbb_sitelist' +*/ +CREATE TABLE phpbb_sitelist ( + site_id number(8) NOT NULL, + site_ip varchar2(40) DEFAULT '' , + site_hostname varchar2(255) DEFAULT '' , + ip_exclude number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_sitelist PRIMARY KEY (site_id) +) +/ + + +CREATE SEQUENCE phpbb_sitelist_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_sitelist +BEFORE INSERT ON phpbb_sitelist +FOR EACH ROW WHEN ( + new.site_id IS NULL OR new.site_id = 0 +) +BEGIN + SELECT phpbb_sitelist_seq.nextval + INTO :new.site_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE phpbb_smilies ( + smiley_id number(8) NOT NULL, + code varchar2(150) DEFAULT '' , + emotion varchar2(150) DEFAULT '' , + smiley_url varchar2(50) DEFAULT '' , + smiley_width number(4) DEFAULT '0' NOT NULL, + smiley_height number(4) DEFAULT '0' NOT NULL, + smiley_order number(8) DEFAULT '0' NOT NULL, + display_on_posting number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id) +) +/ + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting) +/ + +CREATE SEQUENCE phpbb_smilies_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_smilies +BEFORE INSERT ON phpbb_smilies +FOR EACH ROW WHEN ( + new.smiley_id IS NULL OR new.smiley_id = 0 +) +BEGIN + SELECT phpbb_smilies_seq.nextval + INTO :new.smiley_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE phpbb_styles ( + style_id number(8) NOT NULL, + style_name varchar2(765) DEFAULT '' , + style_copyright varchar2(765) DEFAULT '' , + style_active number(1) DEFAULT '1' NOT NULL, + style_path varchar2(100) DEFAULT '' , + bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id number(4) DEFAULT '0' NOT NULL, + style_parent_tree clob DEFAULT '' , + CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id), + CONSTRAINT u_phpbb_style_name UNIQUE (style_name) +) +/ + + +CREATE SEQUENCE phpbb_styles_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_styles +BEFORE INSERT ON phpbb_styles +FOR EACH ROW WHEN ( + new.style_id IS NULL OR new.style_id = 0 +) +BEGIN + SELECT phpbb_styles_seq.nextval + INTO :new.style_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE phpbb_topics ( + topic_id number(8) NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + icon_id number(8) DEFAULT '0' NOT NULL, + topic_attachment number(1) DEFAULT '0' NOT NULL, + topic_approved number(1) DEFAULT '1' NOT NULL, + topic_reported number(1) DEFAULT '0' NOT NULL, + topic_title varchar2(765) DEFAULT '' , + topic_poster number(8) DEFAULT '0' NOT NULL, + topic_time number(11) DEFAULT '0' NOT NULL, + topic_time_limit number(11) DEFAULT '0' NOT NULL, + topic_views number(8) DEFAULT '0' NOT NULL, + topic_replies number(8) DEFAULT '0' NOT NULL, + topic_replies_real number(8) DEFAULT '0' NOT NULL, + topic_status number(3) DEFAULT '0' NOT NULL, + topic_type number(3) DEFAULT '0' NOT NULL, + topic_first_post_id number(8) DEFAULT '0' NOT NULL, + topic_first_poster_name varchar2(765) DEFAULT '' , + topic_first_poster_colour varchar2(6) DEFAULT '' , + topic_last_post_id number(8) DEFAULT '0' NOT NULL, + topic_last_poster_id number(8) DEFAULT '0' NOT NULL, + topic_last_poster_name varchar2(765) DEFAULT '' , + topic_last_poster_colour varchar2(6) DEFAULT '' , + topic_last_post_subject varchar2(765) DEFAULT '' , + topic_last_post_time number(11) DEFAULT '0' NOT NULL, + topic_last_view_time number(11) DEFAULT '0' NOT NULL, + topic_moved_id number(8) DEFAULT '0' NOT NULL, + topic_bumped number(1) DEFAULT '0' NOT NULL, + topic_bumper number(8) DEFAULT '0' NOT NULL, + poll_title varchar2(765) DEFAULT '' , + poll_start number(11) DEFAULT '0' NOT NULL, + poll_length number(11) DEFAULT '0' NOT NULL, + poll_max_options number(4) DEFAULT '1' NOT NULL, + poll_last_vote number(11) DEFAULT '0' NOT NULL, + poll_vote_change number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id) +) +/ + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id) +/ +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type) +/ +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time) +/ +CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved) +/ +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id) +/ +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id) +/ + +CREATE SEQUENCE phpbb_topics_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_topics +BEFORE INSERT ON phpbb_topics +FOR EACH ROW WHEN ( + new.topic_id IS NULL OR new.topic_id = 0 +) +BEGIN + SELECT phpbb_topics_seq.nextval + INTO :new.topic_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE phpbb_topics_track ( + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + forum_id number(8) DEFAULT '0' NOT NULL, + mark_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics_track PRIMARY KEY (user_id, topic_id) +) +/ + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id) +/ +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id) +/ + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE phpbb_topics_posted ( + user_id number(8) DEFAULT '0' NOT NULL, + topic_id number(8) DEFAULT '0' NOT NULL, + topic_posted number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_topics_posted PRIMARY KEY (user_id, topic_id) +) +/ + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE phpbb_topics_watch ( + topic_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + notify_status number(1) DEFAULT '0' NOT NULL +) +/ + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id) +/ +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id) +/ +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status) +/ + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE phpbb_user_group ( + group_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + group_leader number(1) DEFAULT '0' NOT NULL, + user_pending number(1) DEFAULT '1' NOT NULL +) +/ + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id) +/ +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id) +/ +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader) +/ + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE phpbb_users ( + user_id number(8) NOT NULL, + user_type number(2) DEFAULT '0' NOT NULL, + group_id number(8) DEFAULT '3' NOT NULL, + user_permissions clob DEFAULT '' , + user_perm_from number(8) DEFAULT '0' NOT NULL, + user_ip varchar2(40) DEFAULT '' , + user_regdate number(11) DEFAULT '0' NOT NULL, + username varchar2(255) DEFAULT '' , + username_clean varchar2(255) DEFAULT '' , + user_password varchar2(120) DEFAULT '' , + user_passchg number(11) DEFAULT '0' NOT NULL, + user_pass_convert number(1) DEFAULT '0' NOT NULL, + user_email varchar2(300) DEFAULT '' , + user_email_hash number(20) DEFAULT '0' NOT NULL, + user_birthday varchar2(10) DEFAULT '' , + user_lastvisit number(11) DEFAULT '0' NOT NULL, + user_lastmark number(11) DEFAULT '0' NOT NULL, + user_lastpost_time number(11) DEFAULT '0' NOT NULL, + user_lastpage varchar2(600) DEFAULT '' , + user_last_confirm_key varchar2(10) DEFAULT '' , + user_last_search number(11) DEFAULT '0' NOT NULL, + user_warnings number(4) DEFAULT '0' NOT NULL, + user_last_warning number(11) DEFAULT '0' NOT NULL, + user_login_attempts number(4) DEFAULT '0' NOT NULL, + user_inactive_reason number(2) DEFAULT '0' NOT NULL, + user_inactive_time number(11) DEFAULT '0' NOT NULL, + user_posts number(8) DEFAULT '0' NOT NULL, + user_lang varchar2(30) DEFAULT '' , + user_timezone varchar2(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar2(90) DEFAULT 'd M Y H:i' NOT NULL, + user_style number(8) DEFAULT '0' NOT NULL, + user_rank number(8) DEFAULT '0' NOT NULL, + user_colour varchar2(6) DEFAULT '' , + user_new_privmsg number(4) DEFAULT '0' NOT NULL, + user_unread_privmsg number(4) DEFAULT '0' NOT NULL, + user_last_privmsg number(11) DEFAULT '0' NOT NULL, + user_message_rules number(1) DEFAULT '0' NOT NULL, + user_full_folder number(11) DEFAULT '-3' NOT NULL, + user_emailtime number(11) DEFAULT '0' NOT NULL, + user_topic_show_days number(4) DEFAULT '0' NOT NULL, + user_topic_sortby_type varchar2(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar2(1) DEFAULT 'd' NOT NULL, + user_post_show_days number(4) DEFAULT '0' NOT NULL, + user_post_sortby_type varchar2(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar2(1) DEFAULT 'a' NOT NULL, + user_notify number(1) DEFAULT '0' NOT NULL, + user_notify_pm number(1) DEFAULT '1' NOT NULL, + user_notify_type number(4) DEFAULT '0' NOT NULL, + user_allow_pm number(1) DEFAULT '1' NOT NULL, + user_allow_viewonline number(1) DEFAULT '1' NOT NULL, + user_allow_viewemail number(1) DEFAULT '1' NOT NULL, + user_allow_massemail number(1) DEFAULT '1' NOT NULL, + user_options number(11) DEFAULT '230271' NOT NULL, + user_avatar varchar2(255) DEFAULT '' , + user_avatar_type number(2) DEFAULT '0' NOT NULL, + user_avatar_width number(4) DEFAULT '0' NOT NULL, + user_avatar_height number(4) DEFAULT '0' NOT NULL, + user_sig clob DEFAULT '' , + user_sig_bbcode_uid varchar2(8) DEFAULT '' , + user_sig_bbcode_bitfield varchar2(255) DEFAULT '' , + user_from varchar2(300) DEFAULT '' , + user_icq varchar2(15) DEFAULT '' , + user_aim varchar2(765) DEFAULT '' , + user_yim varchar2(765) DEFAULT '' , + user_msnm varchar2(765) DEFAULT '' , + user_jabber varchar2(765) DEFAULT '' , + user_website varchar2(600) DEFAULT '' , + user_occ clob DEFAULT '' , + user_interests clob DEFAULT '' , + user_actkey varchar2(32) DEFAULT '' , + user_newpasswd varchar2(120) DEFAULT '' , + user_form_salt varchar2(96) DEFAULT '' , + user_new number(1) DEFAULT '1' NOT NULL, + user_reminded number(4) DEFAULT '0' NOT NULL, + user_reminded_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), + CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) +) +/ + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) +/ +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) +/ +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) +/ + +CREATE SEQUENCE phpbb_users_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_users +BEFORE INSERT ON phpbb_users +FOR EACH ROW WHEN ( + new.user_id IS NULL OR new.user_id = 0 +) +BEGIN + SELECT phpbb_users_seq.nextval + INTO :new.user_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE phpbb_warnings ( + warning_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + log_id number(8) DEFAULT '0' NOT NULL, + warning_time number(11) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id) +) +/ + + +CREATE SEQUENCE phpbb_warnings_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_warnings +BEFORE INSERT ON phpbb_warnings +FOR EACH ROW WHEN ( + new.warning_id IS NULL OR new.warning_id = 0 +) +BEGIN + SELECT phpbb_warnings_seq.nextval + INTO :new.warning_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE phpbb_words ( + word_id number(8) NOT NULL, + word varchar2(765) DEFAULT '' , + replacement varchar2(765) DEFAULT '' , + CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id) +) +/ + + +CREATE SEQUENCE phpbb_words_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_words +BEFORE INSERT ON phpbb_words +FOR EACH ROW WHEN ( + new.word_id IS NULL OR new.word_id = 0 +) +BEGIN + SELECT phpbb_words_seq.nextval + INTO :new.word_id + FROM dual; +END; +/ + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE phpbb_zebra ( + user_id number(8) DEFAULT '0' NOT NULL, + zebra_id number(8) DEFAULT '0' NOT NULL, + friend number(1) DEFAULT '0' NOT NULL, + foe number(1) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_zebra PRIMARY KEY (user_id, zebra_id) +) +/ diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 659a32bf19..e1678c9cc5 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1,1240 +1,1236 @@ -/* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ - -BEGIN; - -/* - Domain definition -*/ -CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying; - -/* - Operation Functions -*/ -CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; - -/* - Operators -*/ -CREATE OPERATOR <( - PROCEDURE = _varchar_ci_less_than, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = >, - NEGATOR = >=, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel); - -CREATE OPERATOR <=( - PROCEDURE = _varchar_ci_less_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = >=, - NEGATOR = >, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel); - -CREATE OPERATOR >( - PROCEDURE = _varchar_ci_greater_than, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <, - NEGATOR = <=, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel); - -CREATE OPERATOR >=( - PROCEDURE = _varchar_ci_greater_equals, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <=, - NEGATOR = <, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel); - -CREATE OPERATOR <>( - PROCEDURE = _varchar_ci_not_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <>, - NEGATOR = =, - RESTRICT = neqsel, - JOIN = neqjoinsel); - -CREATE OPERATOR =( - PROCEDURE = _varchar_ci_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = =, - NEGATOR = <>, - RESTRICT = eqsel, - JOIN = eqjoinsel, - HASHES, - MERGES, - SORT1= <); - -/* - Table: 'phpbb_attachments' -*/ -CREATE SEQUENCE phpbb_attachments_seq; - -CREATE TABLE phpbb_attachments ( - attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'), - post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0), - poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), - is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0), - physical_filename varchar(255) DEFAULT '' NOT NULL, - real_filename varchar(255) DEFAULT '' NOT NULL, - download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0), - attach_comment varchar(4000) DEFAULT '' NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - mimetype varchar(100) DEFAULT '' NOT NULL, - filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0), - filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0), - thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0), - PRIMARY KEY (attach_id) -); - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE phpbb_acl_groups ( - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); - -/* - Table: 'phpbb_acl_options' -*/ -CREATE SEQUENCE phpbb_acl_options_seq; - -CREATE TABLE phpbb_acl_options ( - auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'), - auth_option varchar(50) DEFAULT '' NOT NULL, - is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0), - is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0), - founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0), - PRIMARY KEY (auth_option_id) -); - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE SEQUENCE phpbb_acl_roles_seq; - -CREATE TABLE phpbb_acl_roles ( - role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'), - role_name varchar(255) DEFAULT '' NOT NULL, - role_description varchar(4000) DEFAULT '' NOT NULL, - role_type varchar(10) DEFAULT '' NOT NULL, - role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0), - PRIMARY KEY (role_id) -); - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE phpbb_acl_roles_data ( - role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id) -); - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE phpbb_acl_users ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); - -/* - Table: 'phpbb_banlist' -*/ -CREATE SEQUENCE phpbb_banlist_seq; - -CREATE TABLE phpbb_banlist ( - ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'), - ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0), - ban_ip varchar(40) DEFAULT '' NOT NULL, - ban_email varchar(100) DEFAULT '' NOT NULL, - ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0), - ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0), - ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0), - ban_reason varchar(255) DEFAULT '' NOT NULL, - ban_give_reason varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (ban_id) -); - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE phpbb_bbcodes ( - bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0), - bbcode_tag varchar(16) DEFAULT '' NOT NULL, - bbcode_helpline varchar(255) DEFAULT '' NOT NULL, - display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0), - bbcode_match varchar(4000) DEFAULT '' NOT NULL, - bbcode_tpl TEXT DEFAULT '' NOT NULL, - first_pass_match TEXT DEFAULT '' NOT NULL, - first_pass_replace TEXT DEFAULT '' NOT NULL, - second_pass_match TEXT DEFAULT '' NOT NULL, - second_pass_replace TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (bbcode_id) -); - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE phpbb_bookmarks ( - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - PRIMARY KEY (topic_id, user_id) -); - - -/* - Table: 'phpbb_bots' -*/ -CREATE SEQUENCE phpbb_bots_seq; - -CREATE TABLE phpbb_bots ( - bot_id INT4 DEFAULT nextval('phpbb_bots_seq'), - bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0), - bot_name varchar(255) DEFAULT '' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - bot_agent varchar(255) DEFAULT '' NOT NULL, - bot_ip varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id) -); - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE phpbb_config ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value varchar(255) DEFAULT '' NOT NULL, - is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0), - PRIMARY KEY (config_name) -); - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - confirm_type INT2 DEFAULT '0' NOT NULL, - code varchar(8) DEFAULT '' NOT NULL, - seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0), - attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0), - PRIMARY KEY (session_id, confirm_id) -); - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); - -/* - Table: 'phpbb_disallow' -*/ -CREATE SEQUENCE phpbb_disallow_seq; - -CREATE TABLE phpbb_disallow ( - disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'), - disallow_username varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (disallow_id) -); - - -/* - Table: 'phpbb_drafts' -*/ -CREATE SEQUENCE phpbb_drafts_seq; - -CREATE TABLE phpbb_drafts ( - draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0), - draft_subject varchar(255) DEFAULT '' NOT NULL, - draft_message TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (draft_id) -); - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE phpbb_ext ( - ext_name varchar(255) DEFAULT '' NOT NULL, - ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0), - ext_state varchar(8000) DEFAULT '' NOT NULL -); - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); - -/* - Table: 'phpbb_extensions' -*/ -CREATE SEQUENCE phpbb_extensions_seq; - -CREATE TABLE phpbb_extensions ( - extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'), - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - extension varchar(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -); - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE SEQUENCE phpbb_extension_groups_seq; - -CREATE TABLE phpbb_extension_groups ( - group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'), - group_name varchar(255) DEFAULT '' NOT NULL, - cat_id INT2 DEFAULT '0' NOT NULL, - allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0), - download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0), - upload_icon varchar(255) DEFAULT '' NOT NULL, - max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0), - allowed_forums varchar(8000) DEFAULT '' NOT NULL, - allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0), - PRIMARY KEY (group_id) -); - - -/* - Table: 'phpbb_forums' -*/ -CREATE SEQUENCE phpbb_forums_seq; - -CREATE TABLE phpbb_forums ( - forum_id INT4 DEFAULT nextval('phpbb_forums_seq'), - parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), - left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), - right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), - forum_parents TEXT DEFAULT '' NOT NULL, - forum_name varchar(255) DEFAULT '' NOT NULL, - forum_desc varchar(4000) DEFAULT '' NOT NULL, - forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0), - forum_desc_uid varchar(8) DEFAULT '' NOT NULL, - forum_link varchar(255) DEFAULT '' NOT NULL, - forum_password varchar(40) DEFAULT '' NOT NULL, - forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0), - forum_image varchar(255) DEFAULT '' NOT NULL, - forum_rules varchar(4000) DEFAULT '' NOT NULL, - forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0), - forum_rules_uid varchar(8) DEFAULT '' NOT NULL, - forum_topics_per_page INT2 DEFAULT '0' NOT NULL, - forum_type INT2 DEFAULT '0' NOT NULL, - forum_status INT2 DEFAULT '0' NOT NULL, - forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), - forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), - forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0), - forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), - forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), - forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, - forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), - forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, - forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - forum_flags INT2 DEFAULT '32' NOT NULL, - forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0), - display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0), - display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), - enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), - enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0), - enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0), - prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0), - prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0), - prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0), - prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0), - PRIMARY KEY (forum_id) -); - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE phpbb_forums_access ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - session_id char(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -); - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE phpbb_forums_track ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), - PRIMARY KEY (user_id, forum_id) -); - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE phpbb_forums_watch ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) -); - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); - -/* - Table: 'phpbb_groups' -*/ -CREATE SEQUENCE phpbb_groups_seq; - -CREATE TABLE phpbb_groups ( - group_id INT4 DEFAULT nextval('phpbb_groups_seq'), - group_type INT2 DEFAULT '1' NOT NULL, - group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0), - group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0), - group_name varchar_ci DEFAULT '' NOT NULL, - group_desc varchar(4000) DEFAULT '' NOT NULL, - group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0), - group_desc_uid varchar(8) DEFAULT '' NOT NULL, - group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), - group_avatar varchar(255) DEFAULT '' NOT NULL, - group_avatar_type INT2 DEFAULT '0' NOT NULL, - group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0), - group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0), - group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0), - group_colour varchar(6) DEFAULT '' NOT NULL, - group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0), - group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0), - group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0), - group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0), - group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), - group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0), - PRIMARY KEY (group_id) -); - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); - -/* - Table: 'phpbb_icons' -*/ -CREATE SEQUENCE phpbb_icons_seq; - -CREATE TABLE phpbb_icons ( - icons_id INT4 DEFAULT nextval('phpbb_icons_seq'), - icons_url varchar(255) DEFAULT '' NOT NULL, - icons_width INT2 DEFAULT '0' NOT NULL, - icons_height INT2 DEFAULT '0' NOT NULL, - icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0), - display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), - PRIMARY KEY (icons_id) -); - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); - -/* - Table: 'phpbb_lang' -*/ -CREATE SEQUENCE phpbb_lang_seq; - -CREATE TABLE phpbb_lang ( - lang_id INT2 DEFAULT nextval('phpbb_lang_seq'), - lang_iso varchar(30) DEFAULT '' NOT NULL, - lang_dir varchar(30) DEFAULT '' NOT NULL, - lang_english_name varchar(100) DEFAULT '' NOT NULL, - lang_local_name varchar(255) DEFAULT '' NOT NULL, - lang_author varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (lang_id) -); - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); - -/* - Table: 'phpbb_log' -*/ -CREATE SEQUENCE phpbb_log_seq; - -CREATE TABLE phpbb_log ( - log_id INT4 DEFAULT nextval('phpbb_log_seq'), - log_type INT2 DEFAULT '0' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0), - log_ip varchar(40) DEFAULT '' NOT NULL, - log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0), - log_operation varchar(4000) DEFAULT '' NOT NULL, - log_data TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (log_id) -); - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) DEFAULT '' NOT NULL, - attempt_browser varchar(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, - attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - username varchar(255) DEFAULT '0' NOT NULL, - username_clean varchar_ci DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE phpbb_moderator_cache ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - username varchar(255) DEFAULT '' NOT NULL, - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - group_name varchar(255) DEFAULT '' NOT NULL, - display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0) -); - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); - -/* - Table: 'phpbb_modules' -*/ -CREATE SEQUENCE phpbb_modules_seq; - -CREATE TABLE phpbb_modules ( - module_id INT4 DEFAULT nextval('phpbb_modules_seq'), - module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0), - module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0), - module_basename varchar(255) DEFAULT '' NOT NULL, - module_class varchar(10) DEFAULT '' NOT NULL, - parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), - left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), - right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), - module_langname varchar(255) DEFAULT '' NOT NULL, - module_mode varchar(255) DEFAULT '' NOT NULL, - module_auth varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id) -); - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE phpbb_poll_options ( - poll_option_id INT2 DEFAULT '0' NOT NULL, - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - poll_option_text varchar(4000) DEFAULT '' NOT NULL, - poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0) -); - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE phpbb_poll_votes ( - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - poll_option_id INT2 DEFAULT '0' NOT NULL, - vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0), - vote_user_ip varchar(40) DEFAULT '' NOT NULL -); - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); - -/* - Table: 'phpbb_posts' -*/ -CREATE SEQUENCE phpbb_posts_seq; - -CREATE TABLE phpbb_posts ( - post_id INT4 DEFAULT nextval('phpbb_posts_seq'), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - poster_ip varchar(40) DEFAULT '' NOT NULL, - post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0), - post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0), - post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0), - enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), - enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), - enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), - enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), - post_username varchar(255) DEFAULT '' NOT NULL, - post_subject varchar(255) DEFAULT '' NOT NULL, - post_text TEXT DEFAULT '' NOT NULL, - post_checksum varchar(32) DEFAULT '' NOT NULL, - post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0), - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0), - post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), - post_edit_reason varchar(255) DEFAULT '' NOT NULL, - post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0), - post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0), - post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0), - PRIMARY KEY (post_id) -); - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); -CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE SEQUENCE phpbb_privmsgs_seq; - -CREATE TABLE phpbb_privmsgs ( - msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'), - root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0), - author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - author_ip varchar(40) DEFAULT '' NOT NULL, - message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0), - enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), - enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), - enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), - enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), - message_subject varchar(255) DEFAULT '' NOT NULL, - message_text TEXT DEFAULT '' NOT NULL, - message_edit_reason varchar(255) DEFAULT '' NOT NULL, - message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0), - message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0), - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0), - message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), - to_address varchar(4000) DEFAULT '' NOT NULL, - bcc_address varchar(4000) DEFAULT '' NOT NULL, - message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0), - PRIMARY KEY (msg_id) -); - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE SEQUENCE phpbb_privmsgs_folder_seq; - -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - folder_name varchar(255) DEFAULT '' NOT NULL, - pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0), - PRIMARY KEY (folder_id) -); - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE SEQUENCE phpbb_privmsgs_rules_seq; - -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0), - rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0), - rule_string varchar(255) DEFAULT '' NOT NULL, - rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0), - rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0), - rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0), - rule_folder_id INT4 DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id) -); - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE phpbb_privmsgs_to ( - msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), - pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0), - pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0), - pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0), - pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0), - pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0), - pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0), - folder_id INT4 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE SEQUENCE phpbb_profile_fields_seq; - -CREATE TABLE phpbb_profile_fields ( - field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'), - field_name varchar(255) DEFAULT '' NOT NULL, - field_type INT2 DEFAULT '0' NOT NULL, - field_ident varchar(20) DEFAULT '' NOT NULL, - field_length varchar(20) DEFAULT '' NOT NULL, - field_minlen varchar(255) DEFAULT '' NOT NULL, - field_maxlen varchar(255) DEFAULT '' NOT NULL, - field_novalue varchar(255) DEFAULT '' NOT NULL, - field_default_value varchar(255) DEFAULT '' NOT NULL, - field_validation varchar(20) DEFAULT '' NOT NULL, - field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), - field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0), - field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), - field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0), - field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0), - field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), - field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), - field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), - field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0), - field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0), - PRIMARY KEY (field_id) -); - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE phpbb_profile_fields_data ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - PRIMARY KEY (user_id) -); - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE phpbb_profile_fields_lang ( - field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), - lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), - option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0), - field_type INT2 DEFAULT '0' NOT NULL, - lang_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -); - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE phpbb_profile_lang ( - field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), - lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), - lang_name varchar(255) DEFAULT '' NOT NULL, - lang_explain varchar(4000) DEFAULT '' NOT NULL, - lang_default_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id) -); - - -/* - Table: 'phpbb_ranks' -*/ -CREATE SEQUENCE phpbb_ranks_seq; - -CREATE TABLE phpbb_ranks ( - rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'), - rank_title varchar(255) DEFAULT '' NOT NULL, - rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0), - rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0), - rank_image varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -); - - -/* - Table: 'phpbb_reports' -*/ -CREATE SEQUENCE phpbb_reports_seq; - -CREATE TABLE phpbb_reports ( - report_id INT4 DEFAULT nextval('phpbb_reports_seq'), - reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0), - post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), - pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), - report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), - report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), - report_text TEXT DEFAULT '' NOT NULL, - reported_post_text TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (report_id) -); - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE SEQUENCE phpbb_reports_reasons_seq; - -CREATE TABLE phpbb_reports_reasons ( - reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'), - reason_title varchar(255) DEFAULT '' NOT NULL, - reason_description TEXT DEFAULT '' NOT NULL, - reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0), - PRIMARY KEY (reason_id) -); - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE phpbb_search_results ( - search_key varchar(32) DEFAULT '' NOT NULL, - search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0), - search_keywords TEXT DEFAULT '' NOT NULL, - search_authors TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (search_key) -); - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE SEQUENCE phpbb_search_wordlist_seq; - -CREATE TABLE phpbb_search_wordlist ( - word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'), - word_text varchar(255) DEFAULT '' NOT NULL, - word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0), - word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0), - PRIMARY KEY (word_id) -); - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE phpbb_search_wordmatch ( - post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), - word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0), - title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0) -); - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' NOT NULL, - session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0), - session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0), - session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0), - session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0), - session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0), - session_ip varchar(40) DEFAULT '' NOT NULL, - session_browser varchar(150) DEFAULT '' NOT NULL, - session_forwarded_for varchar(255) DEFAULT '' NOT NULL, - session_page varchar(255) DEFAULT '' NOT NULL, - session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0), - session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0), - session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0), - PRIMARY KEY (session_id) -); - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - last_ip varchar(40) DEFAULT '' NOT NULL, - last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0), - PRIMARY KEY (key_id, user_id) -); - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); - -/* - Table: 'phpbb_sitelist' -*/ -CREATE SEQUENCE phpbb_sitelist_seq; - -CREATE TABLE phpbb_sitelist ( - site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'), - site_ip varchar(40) DEFAULT '' NOT NULL, - site_hostname varchar(255) DEFAULT '' NOT NULL, - ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0), - PRIMARY KEY (site_id) -); - - -/* - Table: 'phpbb_smilies' -*/ -CREATE SEQUENCE phpbb_smilies_seq; - -CREATE TABLE phpbb_smilies ( - smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'), - code varchar(50) DEFAULT '' NOT NULL, - emotion varchar(50) DEFAULT '' NOT NULL, - smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0), - smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0), - smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0), - display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), - PRIMARY KEY (smiley_id) -); - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); - -/* - Table: 'phpbb_styles' -*/ -CREATE SEQUENCE phpbb_styles_seq; - -CREATE TABLE phpbb_styles ( - style_id INT4 DEFAULT nextval('phpbb_styles_seq'), - style_name varchar(255) DEFAULT '' NOT NULL, - style_copyright varchar(255) DEFAULT '' NOT NULL, - style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0), - style_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0), - style_parent_tree varchar(8000) DEFAULT '' NOT NULL, - PRIMARY KEY (style_id) -); - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); - -/* - Table: 'phpbb_topics' -*/ -CREATE SEQUENCE phpbb_topics_seq; - -CREATE TABLE phpbb_topics ( - topic_id INT4 DEFAULT nextval('phpbb_topics_seq'), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0), - topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0), - topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0), - topic_title varchar(255) DEFAULT '' NOT NULL, - topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0), - topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), - topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), - topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), - topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0), - topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0), - topic_status INT2 DEFAULT '0' NOT NULL, - topic_type INT2 DEFAULT '0' NOT NULL, - topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), - topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0), - topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), - topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, - topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), - topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), - topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), - topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0), - topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0), - poll_title varchar(255) DEFAULT '' NOT NULL, - poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0), - poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0), - poll_max_options INT2 DEFAULT '1' NOT NULL, - poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0), - poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0), - PRIMARY KEY (topic_id) -); - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); -CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved); -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id); -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE phpbb_topics_track ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), - PRIMARY KEY (user_id, topic_id) -); - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE phpbb_topics_posted ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0), - PRIMARY KEY (user_id, topic_id) -); - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE phpbb_topics_watch ( - topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) -); - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE phpbb_user_group ( - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0), - user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0) -); - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); - -/* - Table: 'phpbb_users' -*/ -CREATE SEQUENCE phpbb_users_seq; - -CREATE TABLE phpbb_users ( - user_id INT4 DEFAULT nextval('phpbb_users_seq'), - user_type INT2 DEFAULT '0' NOT NULL, - group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0), - user_permissions TEXT DEFAULT '' NOT NULL, - user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0), - user_ip varchar(40) DEFAULT '' NOT NULL, - user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0), - username varchar_ci DEFAULT '' NOT NULL, - username_clean varchar_ci DEFAULT '' NOT NULL, - user_password varchar(40) DEFAULT '' NOT NULL, - user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0), - user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0), - user_email varchar(100) DEFAULT '' NOT NULL, - user_email_hash INT8 DEFAULT '0' NOT NULL, - user_birthday varchar(10) DEFAULT '' NOT NULL, - user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0), - user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0), - user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0), - user_lastpage varchar(200) DEFAULT '' NOT NULL, - user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, - user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0), - user_warnings INT2 DEFAULT '0' NOT NULL, - user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0), - user_login_attempts INT2 DEFAULT '0' NOT NULL, - user_inactive_reason INT2 DEFAULT '0' NOT NULL, - user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0), - user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0), - user_lang varchar(30) DEFAULT '' NOT NULL, - user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, - user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0), - user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0), - user_colour varchar(6) DEFAULT '' NOT NULL, - user_new_privmsg INT4 DEFAULT '0' NOT NULL, - user_unread_privmsg INT4 DEFAULT '0' NOT NULL, - user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0), - user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0), - user_full_folder INT4 DEFAULT '-3' NOT NULL, - user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0), - user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0), - user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, - user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0), - user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, - user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), - user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0), - user_notify_type INT2 DEFAULT '0' NOT NULL, - user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0), - user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), - user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), - user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), - user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0), - user_avatar varchar(255) DEFAULT '' NOT NULL, - user_avatar_type INT2 DEFAULT '0' NOT NULL, - user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), - user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0), - user_sig TEXT DEFAULT '' NOT NULL, - user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - user_from varchar(100) DEFAULT '' NOT NULL, - user_icq varchar(15) DEFAULT '' NOT NULL, - user_aim varchar(255) DEFAULT '' NOT NULL, - user_yim varchar(255) DEFAULT '' NOT NULL, - user_msnm varchar(255) DEFAULT '' NOT NULL, - user_jabber varchar(255) DEFAULT '' NOT NULL, - user_website varchar(200) DEFAULT '' NOT NULL, - user_occ varchar(4000) DEFAULT '' NOT NULL, - user_interests varchar(4000) DEFAULT '' NOT NULL, - user_actkey varchar(32) DEFAULT '' NOT NULL, - user_newpasswd varchar(40) DEFAULT '' NOT NULL, - user_form_salt varchar(32) DEFAULT '' NOT NULL, - user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), - user_reminded INT2 DEFAULT '0' NOT NULL, - user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0), - PRIMARY KEY (user_id) -); - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); - -/* - Table: 'phpbb_warnings' -*/ -CREATE SEQUENCE phpbb_warnings_seq; - -CREATE TABLE phpbb_warnings ( - warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'), - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), - log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0), - warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0), - PRIMARY KEY (warning_id) -); - - -/* - Table: 'phpbb_words' -*/ -CREATE SEQUENCE phpbb_words_seq; - -CREATE TABLE phpbb_words ( - word_id INT4 DEFAULT nextval('phpbb_words_seq'), - word varchar(255) DEFAULT '' NOT NULL, - replacement varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (word_id) -); - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE phpbb_zebra ( - user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), - zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0), - friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0), - foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0), - PRIMARY KEY (user_id, zebra_id) -); - - - -COMMIT; \ No newline at end of file +/* + * DO NOT EDIT THIS FILE, IT IS GENERATED + * + * To change the contents of this file, edit + * phpBB/develop/create_schema_files.php and + * run it. + */ + +BEGIN; + +/* + Domain definition +*/ +CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying; + +/* + Operation Functions +*/ +CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; + +/* + Operators +*/ +CREATE OPERATOR <( + PROCEDURE = _varchar_ci_less_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR <=( + PROCEDURE = _varchar_ci_less_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR >( + PROCEDURE = _varchar_ci_greater_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR >=( + PROCEDURE = _varchar_ci_greater_equals, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR <>( + PROCEDURE = _varchar_ci_not_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = neqsel, + JOIN = neqjoinsel); + +CREATE OPERATOR =( + PROCEDURE = _varchar_ci_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel, + HASHES, + MERGES, + SORT1= <); + +/* + Table: 'phpbb_attachments' +*/ +CREATE SEQUENCE phpbb_attachments_seq; + +CREATE TABLE phpbb_attachments ( + attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'), + post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0), + poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), + is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0), + physical_filename varchar(255) DEFAULT '' NOT NULL, + real_filename varchar(255) DEFAULT '' NOT NULL, + download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0), + attach_comment varchar(4000) DEFAULT '' NOT NULL, + extension varchar(100) DEFAULT '' NOT NULL, + mimetype varchar(100) DEFAULT '' NOT NULL, + filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0), + filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0), + thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0), + PRIMARY KEY (attach_id) +); + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE phpbb_acl_groups ( + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); + +/* + Table: 'phpbb_acl_options' +*/ +CREATE SEQUENCE phpbb_acl_options_seq; + +CREATE TABLE phpbb_acl_options ( + auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'), + auth_option varchar(50) DEFAULT '' NOT NULL, + is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0), + is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0), + founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0), + PRIMARY KEY (auth_option_id) +); + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE SEQUENCE phpbb_acl_roles_seq; + +CREATE TABLE phpbb_acl_roles ( + role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'), + role_name varchar(255) DEFAULT '' NOT NULL, + role_description varchar(4000) DEFAULT '' NOT NULL, + role_type varchar(10) DEFAULT '' NOT NULL, + role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0), + PRIMARY KEY (role_id) +); + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE phpbb_acl_roles_data ( + role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL, + PRIMARY KEY (role_id, auth_option_id) +); + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE phpbb_acl_users ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), + auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), + auth_setting INT2 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); + +/* + Table: 'phpbb_banlist' +*/ +CREATE SEQUENCE phpbb_banlist_seq; + +CREATE TABLE phpbb_banlist ( + ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'), + ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0), + ban_ip varchar(40) DEFAULT '' NOT NULL, + ban_email varchar(100) DEFAULT '' NOT NULL, + ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0), + ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0), + ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0), + ban_reason varchar(255) DEFAULT '' NOT NULL, + ban_give_reason varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (ban_id) +); + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE phpbb_bbcodes ( + bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0), + bbcode_tag varchar(16) DEFAULT '' NOT NULL, + bbcode_helpline varchar(255) DEFAULT '' NOT NULL, + display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0), + bbcode_match varchar(4000) DEFAULT '' NOT NULL, + bbcode_tpl TEXT DEFAULT '' NOT NULL, + first_pass_match TEXT DEFAULT '' NOT NULL, + first_pass_replace TEXT DEFAULT '' NOT NULL, + second_pass_match TEXT DEFAULT '' NOT NULL, + second_pass_replace TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (bbcode_id) +); + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE phpbb_bookmarks ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + PRIMARY KEY (topic_id, user_id) +); + + +/* + Table: 'phpbb_bots' +*/ +CREATE SEQUENCE phpbb_bots_seq; + +CREATE TABLE phpbb_bots ( + bot_id INT4 DEFAULT nextval('phpbb_bots_seq'), + bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0), + bot_name varchar(255) DEFAULT '' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + bot_agent varchar(255) DEFAULT '' NOT NULL, + bot_ip varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (bot_id) +); + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE phpbb_config ( + config_name varchar(255) DEFAULT '' NOT NULL, + config_value varchar(255) DEFAULT '' NOT NULL, + is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0), + PRIMARY KEY (config_name) +); + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE phpbb_confirm ( + confirm_id char(32) DEFAULT '' NOT NULL, + session_id char(32) DEFAULT '' NOT NULL, + confirm_type INT2 DEFAULT '0' NOT NULL, + code varchar(8) DEFAULT '' NOT NULL, + seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0), + attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0), + PRIMARY KEY (session_id, confirm_id) +); + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); + +/* + Table: 'phpbb_disallow' +*/ +CREATE SEQUENCE phpbb_disallow_seq; + +CREATE TABLE phpbb_disallow ( + disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'), + disallow_username varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (disallow_id) +); + + +/* + Table: 'phpbb_drafts' +*/ +CREATE SEQUENCE phpbb_drafts_seq; + +CREATE TABLE phpbb_drafts ( + draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0), + draft_subject varchar(255) DEFAULT '' NOT NULL, + draft_message TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (draft_id) +); + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); + +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0), + ext_state varchar(8000) DEFAULT '' NOT NULL +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); + +/* + Table: 'phpbb_extensions' +*/ +CREATE SEQUENCE phpbb_extensions_seq; + +CREATE TABLE phpbb_extensions ( + extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'), + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + extension varchar(100) DEFAULT '' NOT NULL, + PRIMARY KEY (extension_id) +); + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE SEQUENCE phpbb_extension_groups_seq; + +CREATE TABLE phpbb_extension_groups ( + group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'), + group_name varchar(255) DEFAULT '' NOT NULL, + cat_id INT2 DEFAULT '0' NOT NULL, + allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0), + download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0), + upload_icon varchar(255) DEFAULT '' NOT NULL, + max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0), + allowed_forums varchar(8000) DEFAULT '' NOT NULL, + allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0), + PRIMARY KEY (group_id) +); + + +/* + Table: 'phpbb_forums' +*/ +CREATE SEQUENCE phpbb_forums_seq; + +CREATE TABLE phpbb_forums ( + forum_id INT4 DEFAULT nextval('phpbb_forums_seq'), + parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), + left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), + right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), + forum_parents TEXT DEFAULT '' NOT NULL, + forum_name varchar(255) DEFAULT '' NOT NULL, + forum_desc varchar(4000) DEFAULT '' NOT NULL, + forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0), + forum_desc_uid varchar(8) DEFAULT '' NOT NULL, + forum_link varchar(255) DEFAULT '' NOT NULL, + forum_password varchar(40) DEFAULT '' NOT NULL, + forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0), + forum_image varchar(255) DEFAULT '' NOT NULL, + forum_rules varchar(4000) DEFAULT '' NOT NULL, + forum_rules_link varchar(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, + forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0), + forum_rules_uid varchar(8) DEFAULT '' NOT NULL, + forum_topics_per_page INT2 DEFAULT '0' NOT NULL, + forum_type INT2 DEFAULT '0' NOT NULL, + forum_status INT2 DEFAULT '0' NOT NULL, + forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), + forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), + forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0), + forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), + forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), + forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, + forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), + forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + forum_flags INT2 DEFAULT '32' NOT NULL, + forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0), + display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0), + display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), + enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), + enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0), + enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0), + prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0), + prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0), + prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0), + prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0), + PRIMARY KEY (forum_id) +); + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE phpbb_forums_access ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + session_id char(32) DEFAULT '' NOT NULL, + PRIMARY KEY (forum_id, user_id, session_id) +); + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE phpbb_forums_track ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), + PRIMARY KEY (user_id, forum_id) +); + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE phpbb_forums_watch ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) +); + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); + +/* + Table: 'phpbb_groups' +*/ +CREATE SEQUENCE phpbb_groups_seq; + +CREATE TABLE phpbb_groups ( + group_id INT4 DEFAULT nextval('phpbb_groups_seq'), + group_type INT2 DEFAULT '1' NOT NULL, + group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0), + group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0), + group_name varchar_ci DEFAULT '' NOT NULL, + group_desc varchar(4000) DEFAULT '' NOT NULL, + group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, + group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0), + group_desc_uid varchar(8) DEFAULT '' NOT NULL, + group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), + group_avatar varchar(255) DEFAULT '' NOT NULL, + group_avatar_type INT2 DEFAULT '0' NOT NULL, + group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0), + group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0), + group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0), + group_colour varchar(6) DEFAULT '' NOT NULL, + group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0), + group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0), + group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0), + group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0), + group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), + group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0), + PRIMARY KEY (group_id) +); + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); + +/* + Table: 'phpbb_icons' +*/ +CREATE SEQUENCE phpbb_icons_seq; + +CREATE TABLE phpbb_icons ( + icons_id INT4 DEFAULT nextval('phpbb_icons_seq'), + icons_url varchar(255) DEFAULT '' NOT NULL, + icons_width INT2 DEFAULT '0' NOT NULL, + icons_height INT2 DEFAULT '0' NOT NULL, + icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0), + display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), + PRIMARY KEY (icons_id) +); + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); + +/* + Table: 'phpbb_lang' +*/ +CREATE SEQUENCE phpbb_lang_seq; + +CREATE TABLE phpbb_lang ( + lang_id INT2 DEFAULT nextval('phpbb_lang_seq'), + lang_iso varchar(30) DEFAULT '' NOT NULL, + lang_dir varchar(30) DEFAULT '' NOT NULL, + lang_english_name varchar(100) DEFAULT '' NOT NULL, + lang_local_name varchar(255) DEFAULT '' NOT NULL, + lang_author varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (lang_id) +); + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); + +/* + Table: 'phpbb_log' +*/ +CREATE SEQUENCE phpbb_log_seq; + +CREATE TABLE phpbb_log ( + log_id INT4 DEFAULT nextval('phpbb_log_seq'), + log_type INT2 DEFAULT '0' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0), + log_ip varchar(40) DEFAULT '' NOT NULL, + log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0), + log_operation varchar(4000) DEFAULT '' NOT NULL, + log_data TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (log_id) +); + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); + +/* + Table: 'phpbb_login_attempts' +*/ +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) DEFAULT '' NOT NULL, + attempt_browser varchar(150) DEFAULT '' NOT NULL, + attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, + attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + username varchar(255) DEFAULT '0' NOT NULL, + username_clean varchar_ci DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE phpbb_moderator_cache ( + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + username varchar(255) DEFAULT '' NOT NULL, + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + group_name varchar(255) DEFAULT '' NOT NULL, + display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0) +); + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); + +/* + Table: 'phpbb_modules' +*/ +CREATE SEQUENCE phpbb_modules_seq; + +CREATE TABLE phpbb_modules ( + module_id INT4 DEFAULT nextval('phpbb_modules_seq'), + module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0), + module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0), + module_basename varchar(255) DEFAULT '' NOT NULL, + module_class varchar(10) DEFAULT '' NOT NULL, + parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), + left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), + right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), + module_langname varchar(255) DEFAULT '' NOT NULL, + module_mode varchar(255) DEFAULT '' NOT NULL, + module_auth varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (module_id) +); + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE phpbb_poll_options ( + poll_option_id INT2 DEFAULT '0' NOT NULL, + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + poll_option_text varchar(4000) DEFAULT '' NOT NULL, + poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0) +); + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE phpbb_poll_votes ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + poll_option_id INT2 DEFAULT '0' NOT NULL, + vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0), + vote_user_ip varchar(40) DEFAULT '' NOT NULL +); + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); + +/* + Table: 'phpbb_posts' +*/ +CREATE SEQUENCE phpbb_posts_seq; + +CREATE TABLE phpbb_posts ( + post_id INT4 DEFAULT nextval('phpbb_posts_seq'), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + poster_ip varchar(40) DEFAULT '' NOT NULL, + post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0), + post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0), + post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0), + enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), + enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), + enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), + enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), + post_username varchar(255) DEFAULT '' NOT NULL, + post_subject varchar(255) DEFAULT '' NOT NULL, + post_text TEXT DEFAULT '' NOT NULL, + post_checksum varchar(32) DEFAULT '' NOT NULL, + post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0), + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0), + post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), + post_edit_reason varchar(255) DEFAULT '' NOT NULL, + post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0), + post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0), + post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0), + PRIMARY KEY (post_id) +); + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE SEQUENCE phpbb_privmsgs_seq; + +CREATE TABLE phpbb_privmsgs ( + msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'), + root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0), + author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + author_ip varchar(40) DEFAULT '' NOT NULL, + message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0), + enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), + enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), + enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), + enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), + message_subject varchar(255) DEFAULT '' NOT NULL, + message_text TEXT DEFAULT '' NOT NULL, + message_edit_reason varchar(255) DEFAULT '' NOT NULL, + message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0), + message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0), + bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + bbcode_uid varchar(8) DEFAULT '' NOT NULL, + message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0), + message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), + to_address varchar(4000) DEFAULT '' NOT NULL, + bcc_address varchar(4000) DEFAULT '' NOT NULL, + message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0), + PRIMARY KEY (msg_id) +); + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE SEQUENCE phpbb_privmsgs_folder_seq; + +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + folder_name varchar(255) DEFAULT '' NOT NULL, + pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0), + PRIMARY KEY (folder_id) +); + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE SEQUENCE phpbb_privmsgs_rules_seq; + +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0), + rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0), + rule_string varchar(255) DEFAULT '' NOT NULL, + rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0), + rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0), + rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0), + rule_folder_id INT4 DEFAULT '0' NOT NULL, + PRIMARY KEY (rule_id) +); + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE phpbb_privmsgs_to ( + msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), + pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0), + pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0), + pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0), + pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0), + pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0), + pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0), + folder_id INT4 DEFAULT '0' NOT NULL +); + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE SEQUENCE phpbb_profile_fields_seq; + +CREATE TABLE phpbb_profile_fields ( + field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'), + field_name varchar(255) DEFAULT '' NOT NULL, + field_type INT2 DEFAULT '0' NOT NULL, + field_ident varchar(20) DEFAULT '' NOT NULL, + field_length varchar(20) DEFAULT '' NOT NULL, + field_minlen varchar(255) DEFAULT '' NOT NULL, + field_maxlen varchar(255) DEFAULT '' NOT NULL, + field_novalue varchar(255) DEFAULT '' NOT NULL, + field_default_value varchar(255) DEFAULT '' NOT NULL, + field_validation varchar(20) DEFAULT '' NOT NULL, + field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), + field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0), + field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), + field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0), + field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0), + field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), + field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), + field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), + field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0), + field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0), + PRIMARY KEY (field_id) +); + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE phpbb_profile_fields_data ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + PRIMARY KEY (user_id) +); + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE phpbb_profile_fields_lang ( + field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), + lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), + option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0), + field_type INT2 DEFAULT '0' NOT NULL, + lang_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id, option_id) +); + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE phpbb_profile_lang ( + field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), + lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), + lang_name varchar(255) DEFAULT '' NOT NULL, + lang_explain varchar(4000) DEFAULT '' NOT NULL, + lang_default_value varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (field_id, lang_id) +); + + +/* + Table: 'phpbb_ranks' +*/ +CREATE SEQUENCE phpbb_ranks_seq; + +CREATE TABLE phpbb_ranks ( + rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'), + rank_title varchar(255) DEFAULT '' NOT NULL, + rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0), + rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0), + rank_image varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (rank_id) +); + + +/* + Table: 'phpbb_reports' +*/ +CREATE SEQUENCE phpbb_reports_seq; + +CREATE TABLE phpbb_reports ( + report_id INT4 DEFAULT nextval('phpbb_reports_seq'), + reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0), + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), + report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), + report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), + report_text TEXT DEFAULT '' NOT NULL, + reported_post_text TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (report_id) +); + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE SEQUENCE phpbb_reports_reasons_seq; + +CREATE TABLE phpbb_reports_reasons ( + reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'), + reason_title varchar(255) DEFAULT '' NOT NULL, + reason_description TEXT DEFAULT '' NOT NULL, + reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0), + PRIMARY KEY (reason_id) +); + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE phpbb_search_results ( + search_key varchar(32) DEFAULT '' NOT NULL, + search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0), + search_keywords TEXT DEFAULT '' NOT NULL, + search_authors TEXT DEFAULT '' NOT NULL, + PRIMARY KEY (search_key) +); + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE SEQUENCE phpbb_search_wordlist_seq; + +CREATE TABLE phpbb_search_wordlist ( + word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'), + word_text varchar(255) DEFAULT '' NOT NULL, + word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0), + word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0), + PRIMARY KEY (word_id) +); + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE phpbb_search_wordmatch ( + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0), + title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0) +); + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '' NOT NULL, + session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0), + session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0), + session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0), + session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0), + session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0), + session_ip varchar(40) DEFAULT '' NOT NULL, + session_browser varchar(150) DEFAULT '' NOT NULL, + session_forwarded_for varchar(255) DEFAULT '' NOT NULL, + session_page varchar(255) DEFAULT '' NOT NULL, + session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0), + session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0), + session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0), + PRIMARY KEY (session_id) +); + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) DEFAULT '' NOT NULL, + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + last_ip varchar(40) DEFAULT '' NOT NULL, + last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0), + PRIMARY KEY (key_id, user_id) +); + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); + +/* + Table: 'phpbb_sitelist' +*/ +CREATE SEQUENCE phpbb_sitelist_seq; + +CREATE TABLE phpbb_sitelist ( + site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'), + site_ip varchar(40) DEFAULT '' NOT NULL, + site_hostname varchar(255) DEFAULT '' NOT NULL, + ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0), + PRIMARY KEY (site_id) +); + + +/* + Table: 'phpbb_smilies' +*/ +CREATE SEQUENCE phpbb_smilies_seq; + +CREATE TABLE phpbb_smilies ( + smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'), + code varchar(50) DEFAULT '' NOT NULL, + emotion varchar(50) DEFAULT '' NOT NULL, + smiley_url varchar(50) DEFAULT '' NOT NULL, + smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0), + smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0), + smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0), + display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), + PRIMARY KEY (smiley_id) +); + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); + +/* + Table: 'phpbb_styles' +*/ +CREATE SEQUENCE phpbb_styles_seq; + +CREATE TABLE phpbb_styles ( + style_id INT4 DEFAULT nextval('phpbb_styles_seq'), + style_name varchar(255) DEFAULT '' NOT NULL, + style_copyright varchar(255) DEFAULT '' NOT NULL, + style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0), + style_path varchar(100) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, + style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0), + style_parent_tree varchar(8000) DEFAULT '' NOT NULL, + PRIMARY KEY (style_id) +); + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); + +/* + Table: 'phpbb_topics' +*/ +CREATE SEQUENCE phpbb_topics_seq; + +CREATE TABLE phpbb_topics ( + topic_id INT4 DEFAULT nextval('phpbb_topics_seq'), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), + topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0), + topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0), + topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0), + topic_title varchar(255) DEFAULT '' NOT NULL, + topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0), + topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), + topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), + topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), + topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0), + topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0), + topic_status INT2 DEFAULT '0' NOT NULL, + topic_type INT2 DEFAULT '0' NOT NULL, + topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), + topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0), + topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), + topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, + topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), + topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), + topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), + topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0), + topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0), + poll_title varchar(255) DEFAULT '' NOT NULL, + poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0), + poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0), + poll_max_options INT2 DEFAULT '1' NOT NULL, + poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0), + poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0), + PRIMARY KEY (topic_id) +); + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); +CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved); +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id); +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE phpbb_topics_track ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), + mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), + PRIMARY KEY (user_id, topic_id) +); + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE phpbb_topics_posted ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0), + PRIMARY KEY (user_id, topic_id) +); + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE phpbb_topics_watch ( + topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) +); + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE phpbb_user_group ( + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0), + user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0) +); + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); + +/* + Table: 'phpbb_users' +*/ +CREATE SEQUENCE phpbb_users_seq; + +CREATE TABLE phpbb_users ( + user_id INT4 DEFAULT nextval('phpbb_users_seq'), + user_type INT2 DEFAULT '0' NOT NULL, + group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0), + user_permissions TEXT DEFAULT '' NOT NULL, + user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0), + user_ip varchar(40) DEFAULT '' NOT NULL, + user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0), + username varchar_ci DEFAULT '' NOT NULL, + username_clean varchar_ci DEFAULT '' NOT NULL, + user_password varchar(40) DEFAULT '' NOT NULL, + user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0), + user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0), + user_email varchar(100) DEFAULT '' NOT NULL, + user_email_hash INT8 DEFAULT '0' NOT NULL, + user_birthday varchar(10) DEFAULT '' NOT NULL, + user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0), + user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0), + user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0), + user_lastpage varchar(200) DEFAULT '' NOT NULL, + user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, + user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0), + user_warnings INT2 DEFAULT '0' NOT NULL, + user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0), + user_login_attempts INT2 DEFAULT '0' NOT NULL, + user_inactive_reason INT2 DEFAULT '0' NOT NULL, + user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0), + user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0), + user_lang varchar(30) DEFAULT '' NOT NULL, + user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, + user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, + user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0), + user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0), + user_colour varchar(6) DEFAULT '' NOT NULL, + user_new_privmsg INT4 DEFAULT '0' NOT NULL, + user_unread_privmsg INT4 DEFAULT '0' NOT NULL, + user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0), + user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0), + user_full_folder INT4 DEFAULT '-3' NOT NULL, + user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0), + user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0), + user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0), + user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, + user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, + user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), + user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0), + user_notify_type INT2 DEFAULT '0' NOT NULL, + user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0), + user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), + user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), + user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), + user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0), + user_avatar varchar(255) DEFAULT '' NOT NULL, + user_avatar_type INT2 DEFAULT '0' NOT NULL, + user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), + user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0), + user_sig TEXT DEFAULT '' NOT NULL, + user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, + user_from varchar(100) DEFAULT '' NOT NULL, + user_icq varchar(15) DEFAULT '' NOT NULL, + user_aim varchar(255) DEFAULT '' NOT NULL, + user_yim varchar(255) DEFAULT '' NOT NULL, + user_msnm varchar(255) DEFAULT '' NOT NULL, + user_jabber varchar(255) DEFAULT '' NOT NULL, + user_website varchar(200) DEFAULT '' NOT NULL, + user_occ varchar(4000) DEFAULT '' NOT NULL, + user_interests varchar(4000) DEFAULT '' NOT NULL, + user_actkey varchar(32) DEFAULT '' NOT NULL, + user_newpasswd varchar(40) DEFAULT '' NOT NULL, + user_form_salt varchar(32) DEFAULT '' NOT NULL, + user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), + user_reminded INT2 DEFAULT '0' NOT NULL, + user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0), + PRIMARY KEY (user_id) +); + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); + +/* + Table: 'phpbb_warnings' +*/ +CREATE SEQUENCE phpbb_warnings_seq; + +CREATE TABLE phpbb_warnings ( + warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0), + log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0), + warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0), + PRIMARY KEY (warning_id) +); + + +/* + Table: 'phpbb_words' +*/ +CREATE SEQUENCE phpbb_words_seq; + +CREATE TABLE phpbb_words ( + word_id INT4 DEFAULT nextval('phpbb_words_seq'), + word varchar(255) DEFAULT '' NOT NULL, + replacement varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (word_id) +); + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE phpbb_zebra ( + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0), + friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0), + foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0), + PRIMARY KEY (user_id, zebra_id) +); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ea7864bd4c..938b11388b 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -314,6 +314,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_subscribe', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_restore', 1); # -- Moderator related auth options INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1); @@ -327,6 +328,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_merg INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_restore', 1, 1); # -- Global moderator auth option (not a local option) INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 8360bc30ea..361e0ca9c6 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -1,951 +1,947 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -BEGIN TRANSACTION; - -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id INTEGER PRIMARY KEY NOT NULL , - post_msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - in_message INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - is_orphan INTEGER UNSIGNED NOT NULL DEFAULT '1', - physical_filename varchar(255) NOT NULL DEFAULT '', - real_filename varchar(255) NOT NULL DEFAULT '', - download_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - attach_comment text(65535) NOT NULL DEFAULT '', - extension varchar(100) NOT NULL DEFAULT '', - mimetype varchar(100) NOT NULL DEFAULT '', - filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', - filetime INTEGER UNSIGNED NOT NULL DEFAULT '0', - thumbnail INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id INTEGER PRIMARY KEY NOT NULL , - auth_option varchar(50) NOT NULL DEFAULT '', - is_global INTEGER UNSIGNED NOT NULL DEFAULT '0', - is_local INTEGER UNSIGNED NOT NULL DEFAULT '0', - founder_only INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id INTEGER PRIMARY KEY NOT NULL , - role_name varchar(255) NOT NULL DEFAULT '', - role_description text(65535) NOT NULL DEFAULT '', - role_type varchar(10) NOT NULL DEFAULT '', - role_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0', - PRIMARY KEY (role_id, auth_option_id) -); - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id INTEGER PRIMARY KEY NOT NULL , - ban_userid INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_ip varchar(40) NOT NULL DEFAULT '', - ban_email varchar(100) NOT NULL DEFAULT '', - ban_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_end INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_reason varchar(255) NOT NULL DEFAULT '', - ban_give_reason varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_tag varchar(16) NOT NULL DEFAULT '', - bbcode_helpline varchar(255) NOT NULL DEFAULT '', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_match text(65535) NOT NULL DEFAULT '', - bbcode_tpl mediumtext(16777215) NOT NULL DEFAULT '', - first_pass_match mediumtext(16777215) NOT NULL DEFAULT '', - first_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', - second_pass_match mediumtext(16777215) NOT NULL DEFAULT '', - second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', - PRIMARY KEY (bbcode_id) -); - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (topic_id, user_id) -); - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id INTEGER PRIMARY KEY NOT NULL , - bot_active INTEGER UNSIGNED NOT NULL DEFAULT '1', - bot_name text(65535) NOT NULL DEFAULT '', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - bot_agent varchar(255) NOT NULL DEFAULT '', - bot_ip varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varchar(255) NOT NULL DEFAULT '', - config_value varchar(255) NOT NULL DEFAULT '', - is_dynamic INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (config_name) -); - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id char(32) NOT NULL DEFAULT '', - session_id char(32) NOT NULL DEFAULT '', - confirm_type tinyint(3) NOT NULL DEFAULT '0', - code varchar(8) NOT NULL DEFAULT '', - seed INTEGER UNSIGNED NOT NULL DEFAULT '0', - attempts INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (session_id, confirm_id) -); - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id INTEGER PRIMARY KEY NOT NULL , - disallow_username varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - save_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - draft_subject text(65535) NOT NULL DEFAULT '', - draft_message mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varchar(255) NOT NULL DEFAULT '', - ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0', - ext_state text(65535) NOT NULL DEFAULT '' -); - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id INTEGER PRIMARY KEY NOT NULL , - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - extension varchar(100) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , - group_name varchar(255) NOT NULL DEFAULT '', - cat_id tinyint(2) NOT NULL DEFAULT '0', - allow_group INTEGER UNSIGNED NOT NULL DEFAULT '0', - download_mode INTEGER UNSIGNED NOT NULL DEFAULT '1', - upload_icon varchar(255) NOT NULL DEFAULT '', - max_filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', - allowed_forums text(65535) NOT NULL DEFAULT '', - allow_in_pm INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id INTEGER PRIMARY KEY NOT NULL , - parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_parents mediumtext(16777215) NOT NULL DEFAULT '', - forum_name text(65535) NOT NULL DEFAULT '', - forum_desc text(65535) NOT NULL DEFAULT '', - forum_desc_bitfield varchar(255) NOT NULL DEFAULT '', - forum_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - forum_desc_uid varchar(8) NOT NULL DEFAULT '', - forum_link varchar(255) NOT NULL DEFAULT '', - forum_password varchar(40) NOT NULL DEFAULT '', - forum_style INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_image varchar(255) NOT NULL DEFAULT '', - forum_rules text(65535) NOT NULL DEFAULT '', - forum_rules_link varchar(255) NOT NULL DEFAULT '', - forum_rules_bitfield varchar(255) NOT NULL DEFAULT '', - forum_rules_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - forum_rules_uid varchar(8) NOT NULL DEFAULT '', - forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', - forum_type tinyint(4) NOT NULL DEFAULT '0', - forum_status tinyint(4) NOT NULL DEFAULT '0', - forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_subject text(65535) NOT NULL DEFAULT '', - forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_poster_name varchar(255) NOT NULL DEFAULT '', - forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', - forum_flags tinyint(4) NOT NULL DEFAULT '32', - forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', - display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_icons INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_prune INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_next INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_viewed INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_freq INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_id char(32) NOT NULL DEFAULT '', - PRIMARY KEY (forum_id, user_id, session_id) -); - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, forum_id) -); - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , - group_type tinyint(4) NOT NULL DEFAULT '1', - group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_name varchar(255) NOT NULL DEFAULT '', - group_desc text(65535) NOT NULL DEFAULT '', - group_desc_bitfield varchar(255) NOT NULL DEFAULT '', - group_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - group_desc_uid varchar(8) NOT NULL DEFAULT '', - group_display INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_avatar varchar(255) NOT NULL DEFAULT '', - group_avatar_type tinyint(2) NOT NULL DEFAULT '0', - group_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_colour varchar(6) NOT NULL DEFAULT '', - group_sig_chars INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_teampage INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id INTEGER PRIMARY KEY NOT NULL , - icons_url varchar(255) NOT NULL DEFAULT '', - icons_width tinyint(4) NOT NULL DEFAULT '0', - icons_height tinyint(4) NOT NULL DEFAULT '0', - icons_order INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id INTEGER PRIMARY KEY NOT NULL , - lang_iso varchar(30) NOT NULL DEFAULT '', - lang_dir varchar(30) NOT NULL DEFAULT '', - lang_english_name varchar(100) NOT NULL DEFAULT '', - lang_local_name varchar(255) NOT NULL DEFAULT '', - lang_author varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id INTEGER PRIMARY KEY NOT NULL , - log_type tinyint(4) NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - reportee_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_ip varchar(40) NOT NULL DEFAULT '', - log_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_operation text(65535) NOT NULL DEFAULT '', - log_data mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) NOT NULL DEFAULT '', - attempt_browser varchar(150) NOT NULL DEFAULT '', - attempt_forwarded_for varchar(255) NOT NULL DEFAULT '', - attempt_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '0', - username_clean varchar(255) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '', - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_name varchar(255) NOT NULL DEFAULT '', - display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id INTEGER PRIMARY KEY NOT NULL , - module_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1', - module_display INTEGER UNSIGNED NOT NULL DEFAULT '1', - module_basename varchar(255) NOT NULL DEFAULT '', - module_class varchar(10) NOT NULL DEFAULT '', - parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - module_langname varchar(255) NOT NULL DEFAULT '', - module_mode varchar(255) NOT NULL DEFAULT '', - module_auth varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_option_text text(65535) NOT NULL DEFAULT '', - poll_option_total INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_option_id tinyint(4) NOT NULL DEFAULT '0', - vote_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - vote_user_ip varchar(40) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INTEGER PRIMARY KEY NOT NULL , - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_ip varchar(40) NOT NULL DEFAULT '', - post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_approved INTEGER UNSIGNED NOT NULL DEFAULT '1', - post_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', - post_username varchar(255) NOT NULL DEFAULT '', - post_subject text(65535) NOT NULL DEFAULT '', - post_text mediumtext(16777215) NOT NULL DEFAULT '', - post_checksum varchar(32) NOT NULL DEFAULT '', - post_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - bbcode_uid varchar(8) NOT NULL DEFAULT '', - post_postcount INTEGER UNSIGNED NOT NULL DEFAULT '1', - post_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_reason text(65535) NOT NULL DEFAULT '', - post_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); -CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id INTEGER PRIMARY KEY NOT NULL , - root_level INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_ip varchar(40) NOT NULL DEFAULT '', - message_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', - message_subject text(65535) NOT NULL DEFAULT '', - message_text mediumtext(16777215) NOT NULL DEFAULT '', - message_edit_reason text(65535) NOT NULL DEFAULT '', - message_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', - message_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - bbcode_uid varchar(8) NOT NULL DEFAULT '', - message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - to_address text(65535) NOT NULL DEFAULT '', - bcc_address text(65535) NOT NULL DEFAULT '', - message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - folder_name varchar(255) NOT NULL DEFAULT '', - pm_count INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_check INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_connection INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_string varchar(255) NOT NULL DEFAULT '', - rule_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_action INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_folder_id int(11) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_deleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_new INTEGER UNSIGNED NOT NULL DEFAULT '1', - pm_unread INTEGER UNSIGNED NOT NULL DEFAULT '1', - pm_replied INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_marked INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_forwarded INTEGER UNSIGNED NOT NULL DEFAULT '0', - folder_id int(11) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id INTEGER PRIMARY KEY NOT NULL , - field_name varchar(255) NOT NULL DEFAULT '', - field_type tinyint(4) NOT NULL DEFAULT '0', - field_ident varchar(20) NOT NULL DEFAULT '', - field_length varchar(20) NOT NULL DEFAULT '', - field_minlen varchar(255) NOT NULL DEFAULT '', - field_maxlen varchar(255) NOT NULL DEFAULT '', - field_novalue varchar(255) NOT NULL DEFAULT '', - field_default_value varchar(255) NOT NULL DEFAULT '', - field_validation varchar(20) NOT NULL DEFAULT '', - field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_novalue INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_active INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id) -); - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_type tinyint(4) NOT NULL DEFAULT '0', - lang_value varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (field_id, lang_id, option_id) -); - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_name varchar(255) NOT NULL DEFAULT '', - lang_explain text(65535) NOT NULL DEFAULT '', - lang_default_value varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (field_id, lang_id) -); - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id INTEGER PRIMARY KEY NOT NULL , - rank_title varchar(255) NOT NULL DEFAULT '', - rank_min INTEGER UNSIGNED NOT NULL DEFAULT '0', - rank_special INTEGER UNSIGNED NOT NULL DEFAULT '0', - rank_image varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id INTEGER PRIMARY KEY NOT NULL , - reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post_text mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER PRIMARY KEY NOT NULL , - reason_title varchar(255) NOT NULL DEFAULT '', - reason_description mediumtext(16777215) NOT NULL DEFAULT '', - reason_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varchar(32) NOT NULL DEFAULT '', - search_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - search_keywords mediumtext(16777215) NOT NULL DEFAULT '', - search_authors mediumtext(16777215) NOT NULL DEFAULT '', - PRIMARY KEY (search_key) -); - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id INTEGER PRIMARY KEY NOT NULL , - word_text varchar(255) NOT NULL DEFAULT '', - word_common INTEGER UNSIGNED NOT NULL DEFAULT '0', - word_count INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - word_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - title_match INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id char(32) NOT NULL DEFAULT '', - session_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_last_visit INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_ip varchar(40) NOT NULL DEFAULT '', - session_browser varchar(150) NOT NULL DEFAULT '', - session_forwarded_for varchar(255) NOT NULL DEFAULT '', - session_page varchar(255) NOT NULL DEFAULT '', - session_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', - session_autologin INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_admin INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (session_id) -); - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) NOT NULL DEFAULT '', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - last_ip varchar(40) NOT NULL DEFAULT '', - last_login INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (key_id, user_id) -); - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id INTEGER PRIMARY KEY NOT NULL , - site_ip varchar(40) NOT NULL DEFAULT '', - site_hostname varchar(255) NOT NULL DEFAULT '', - ip_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id INTEGER PRIMARY KEY NOT NULL , - code varchar(50) NOT NULL DEFAULT '', - emotion varchar(50) NOT NULL DEFAULT '', - smiley_url varchar(50) NOT NULL DEFAULT '', - smiley_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - smiley_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - smiley_order INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id INTEGER PRIMARY KEY NOT NULL , - style_name varchar(255) NOT NULL DEFAULT '', - style_copyright varchar(255) NOT NULL DEFAULT '', - style_active INTEGER UNSIGNED NOT NULL DEFAULT '1', - style_path varchar(100) NOT NULL DEFAULT '', - bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=', - style_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - style_parent_tree text(65535) NOT NULL DEFAULT '' -); - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INTEGER PRIMARY KEY NOT NULL , - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_approved INTEGER UNSIGNED NOT NULL DEFAULT '1', - topic_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_title text(65535) NOT NULL DEFAULT '', - topic_poster INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_replies INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_replies_real INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_status tinyint(3) NOT NULL DEFAULT '0', - topic_type tinyint(3) NOT NULL DEFAULT '0', - topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_first_poster_name varchar(255) NOT NULL DEFAULT '', - topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', - topic_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_poster_name varchar(255) NOT NULL DEFAULT '', - topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', - topic_last_post_subject text(65535) NOT NULL DEFAULT '', - topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_bumped INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_bumper INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_title text(65535) NOT NULL DEFAULT '', - poll_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_length INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_max_options tinyint(4) NOT NULL DEFAULT '1', - poll_last_vote INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); -CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved); -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id); -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, topic_id) -); - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posted INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, topic_id) -); - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_leader INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_pending INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INTEGER PRIMARY KEY NOT NULL , - user_type tinyint(2) NOT NULL DEFAULT '0', - group_id INTEGER UNSIGNED NOT NULL DEFAULT '3', - user_permissions mediumtext(16777215) NOT NULL DEFAULT '', - user_perm_from INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_ip varchar(40) NOT NULL DEFAULT '', - user_regdate INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '', - username_clean varchar(255) NOT NULL DEFAULT '', - user_password varchar(40) NOT NULL DEFAULT '', - user_passchg INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_pass_convert INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_email varchar(100) NOT NULL DEFAULT '', - user_email_hash bigint(20) NOT NULL DEFAULT '0', - user_birthday varchar(10) NOT NULL DEFAULT '', - user_lastvisit INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastmark INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastpost_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastpage varchar(200) NOT NULL DEFAULT '', - user_last_confirm_key varchar(10) NOT NULL DEFAULT '', - user_last_search INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_warnings tinyint(4) NOT NULL DEFAULT '0', - user_last_warning INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_login_attempts tinyint(4) NOT NULL DEFAULT '0', - user_inactive_reason tinyint(2) NOT NULL DEFAULT '0', - user_inactive_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lang varchar(30) NOT NULL DEFAULT '', - user_timezone varchar(100) NOT NULL DEFAULT 'UTC', - user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', - user_style INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_colour varchar(6) NOT NULL DEFAULT '', - user_new_privmsg int(4) NOT NULL DEFAULT '0', - user_unread_privmsg int(4) NOT NULL DEFAULT '0', - user_last_privmsg INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_message_rules INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_full_folder int(11) NOT NULL DEFAULT '-3', - user_emailtime INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_topic_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', - user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', - user_post_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', - user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', - user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_notify_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_notify_type tinyint(4) NOT NULL DEFAULT '0', - user_allow_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271', - user_avatar varchar(255) NOT NULL DEFAULT '', - user_avatar_type tinyint(2) NOT NULL DEFAULT '0', - user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_sig mediumtext(16777215) NOT NULL DEFAULT '', - user_sig_bbcode_uid varchar(8) NOT NULL DEFAULT '', - user_sig_bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - user_from varchar(100) NOT NULL DEFAULT '', - user_icq varchar(15) NOT NULL DEFAULT '', - user_aim varchar(255) NOT NULL DEFAULT '', - user_yim varchar(255) NOT NULL DEFAULT '', - user_msnm varchar(255) NOT NULL DEFAULT '', - user_jabber varchar(255) NOT NULL DEFAULT '', - user_website varchar(200) NOT NULL DEFAULT '', - user_occ text(65535) NOT NULL DEFAULT '', - user_interests text(65535) NOT NULL DEFAULT '', - user_actkey varchar(32) NOT NULL DEFAULT '', - user_newpasswd varchar(40) NOT NULL DEFAULT '', - user_form_salt varchar(32) NOT NULL DEFAULT '', - user_new INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_reminded tinyint(4) NOT NULL DEFAULT '0', - user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - warning_time INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id INTEGER PRIMARY KEY NOT NULL , - word varchar(255) NOT NULL DEFAULT '', - replacement varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - zebra_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - friend INTEGER UNSIGNED NOT NULL DEFAULT '0', - foe INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, zebra_id) -); - - - -COMMIT; \ No newline at end of file +# DO NOT EDIT THIS FILE, IT IS GENERATED +# +# To change the contents of this file, edit +# phpBB/develop/create_schema_files.php and +# run it. +BEGIN TRANSACTION; + +# Table: 'phpbb_attachments' +CREATE TABLE phpbb_attachments ( + attach_id INTEGER PRIMARY KEY NOT NULL , + post_msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + in_message INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + is_orphan INTEGER UNSIGNED NOT NULL DEFAULT '1', + physical_filename varchar(255) NOT NULL DEFAULT '', + real_filename varchar(255) NOT NULL DEFAULT '', + download_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + attach_comment text(65535) NOT NULL DEFAULT '', + extension varchar(100) NOT NULL DEFAULT '', + mimetype varchar(100) NOT NULL DEFAULT '', + filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', + filetime INTEGER UNSIGNED NOT NULL DEFAULT '0', + thumbnail INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); + +# Table: 'phpbb_acl_groups' +CREATE TABLE phpbb_acl_groups ( + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); +CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); +CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); + +# Table: 'phpbb_acl_options' +CREATE TABLE phpbb_acl_options ( + auth_option_id INTEGER PRIMARY KEY NOT NULL , + auth_option varchar(50) NOT NULL DEFAULT '', + is_global INTEGER UNSIGNED NOT NULL DEFAULT '0', + is_local INTEGER UNSIGNED NOT NULL DEFAULT '0', + founder_only INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); + +# Table: 'phpbb_acl_roles' +CREATE TABLE phpbb_acl_roles ( + role_id INTEGER PRIMARY KEY NOT NULL , + role_name varchar(255) NOT NULL DEFAULT '', + role_description text(65535) NOT NULL DEFAULT '', + role_type varchar(10) NOT NULL DEFAULT '', + role_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); + +# Table: 'phpbb_acl_roles_data' +CREATE TABLE phpbb_acl_roles_data ( + role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0', + PRIMARY KEY (role_id, auth_option_id) +); + +CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); + +# Table: 'phpbb_acl_users' +CREATE TABLE phpbb_acl_users ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); +CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); + +# Table: 'phpbb_banlist' +CREATE TABLE phpbb_banlist ( + ban_id INTEGER PRIMARY KEY NOT NULL , + ban_userid INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_ip varchar(40) NOT NULL DEFAULT '', + ban_email varchar(100) NOT NULL DEFAULT '', + ban_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_end INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0', + ban_reason varchar(255) NOT NULL DEFAULT '', + ban_give_reason varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); +CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); +CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); +CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); + +# Table: 'phpbb_bbcodes' +CREATE TABLE phpbb_bbcodes ( + bbcode_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_tag varchar(16) NOT NULL DEFAULT '', + bbcode_helpline varchar(255) NOT NULL DEFAULT '', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_match text(65535) NOT NULL DEFAULT '', + bbcode_tpl mediumtext(16777215) NOT NULL DEFAULT '', + first_pass_match mediumtext(16777215) NOT NULL DEFAULT '', + first_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', + second_pass_match mediumtext(16777215) NOT NULL DEFAULT '', + second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (bbcode_id) +); + +CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); + +# Table: 'phpbb_bookmarks' +CREATE TABLE phpbb_bookmarks ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (topic_id, user_id) +); + + +# Table: 'phpbb_bots' +CREATE TABLE phpbb_bots ( + bot_id INTEGER PRIMARY KEY NOT NULL , + bot_active INTEGER UNSIGNED NOT NULL DEFAULT '1', + bot_name text(65535) NOT NULL DEFAULT '', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + bot_agent varchar(255) NOT NULL DEFAULT '', + bot_ip varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); + +# Table: 'phpbb_config' +CREATE TABLE phpbb_config ( + config_name varchar(255) NOT NULL DEFAULT '', + config_value varchar(255) NOT NULL DEFAULT '', + is_dynamic INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (config_name) +); + +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); + +# Table: 'phpbb_confirm' +CREATE TABLE phpbb_confirm ( + confirm_id char(32) NOT NULL DEFAULT '', + session_id char(32) NOT NULL DEFAULT '', + confirm_type tinyint(3) NOT NULL DEFAULT '0', + code varchar(8) NOT NULL DEFAULT '', + seed INTEGER UNSIGNED NOT NULL DEFAULT '0', + attempts INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (session_id, confirm_id) +); + +CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); + +# Table: 'phpbb_disallow' +CREATE TABLE phpbb_disallow ( + disallow_id INTEGER PRIMARY KEY NOT NULL , + disallow_username varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_drafts' +CREATE TABLE phpbb_drafts ( + draft_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + save_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + draft_subject text(65535) NOT NULL DEFAULT '', + draft_message mediumtext(16777215) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); + +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) NOT NULL DEFAULT '', + ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0', + ext_state text(65535) NOT NULL DEFAULT '' +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); + +# Table: 'phpbb_extensions' +CREATE TABLE phpbb_extensions ( + extension_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + extension varchar(100) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_extension_groups' +CREATE TABLE phpbb_extension_groups ( + group_id INTEGER PRIMARY KEY NOT NULL , + group_name varchar(255) NOT NULL DEFAULT '', + cat_id tinyint(2) NOT NULL DEFAULT '0', + allow_group INTEGER UNSIGNED NOT NULL DEFAULT '0', + download_mode INTEGER UNSIGNED NOT NULL DEFAULT '1', + upload_icon varchar(255) NOT NULL DEFAULT '', + max_filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', + allowed_forums text(65535) NOT NULL DEFAULT '', + allow_in_pm INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_forums' +CREATE TABLE phpbb_forums ( + forum_id INTEGER PRIMARY KEY NOT NULL , + parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_parents mediumtext(16777215) NOT NULL DEFAULT '', + forum_name text(65535) NOT NULL DEFAULT '', + forum_desc text(65535) NOT NULL DEFAULT '', + forum_desc_bitfield varchar(255) NOT NULL DEFAULT '', + forum_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + forum_desc_uid varchar(8) NOT NULL DEFAULT '', + forum_link varchar(255) NOT NULL DEFAULT '', + forum_password varchar(40) NOT NULL DEFAULT '', + forum_style INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_image varchar(255) NOT NULL DEFAULT '', + forum_rules text(65535) NOT NULL DEFAULT '', + forum_rules_link varchar(255) NOT NULL DEFAULT '', + forum_rules_bitfield varchar(255) NOT NULL DEFAULT '', + forum_rules_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + forum_rules_uid varchar(8) NOT NULL DEFAULT '', + forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', + forum_type tinyint(4) NOT NULL DEFAULT '0', + forum_status tinyint(4) NOT NULL DEFAULT '0', + forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_post_subject text(65535) NOT NULL DEFAULT '', + forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_poster_name varchar(255) NOT NULL DEFAULT '', + forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', + forum_flags tinyint(4) NOT NULL DEFAULT '32', + forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', + display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_icons INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_prune INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_next INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_viewed INTEGER UNSIGNED NOT NULL DEFAULT '0', + prune_freq INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); +CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); + +# Table: 'phpbb_forums_access' +CREATE TABLE phpbb_forums_access ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + PRIMARY KEY (forum_id, user_id, session_id) +); + + +# Table: 'phpbb_forums_track' +CREATE TABLE phpbb_forums_track ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, forum_id) +); + + +# Table: 'phpbb_forums_watch' +CREATE TABLE phpbb_forums_watch ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); + +# Table: 'phpbb_groups' +CREATE TABLE phpbb_groups ( + group_id INTEGER PRIMARY KEY NOT NULL , + group_type tinyint(4) NOT NULL DEFAULT '1', + group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_name varchar(255) NOT NULL DEFAULT '', + group_desc text(65535) NOT NULL DEFAULT '', + group_desc_bitfield varchar(255) NOT NULL DEFAULT '', + group_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', + group_desc_uid varchar(8) NOT NULL DEFAULT '', + group_display INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_avatar varchar(255) NOT NULL DEFAULT '', + group_avatar_type tinyint(2) NOT NULL DEFAULT '0', + group_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_colour varchar(6) NOT NULL DEFAULT '', + group_sig_chars INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_teampage INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); + +# Table: 'phpbb_icons' +CREATE TABLE phpbb_icons ( + icons_id INTEGER PRIMARY KEY NOT NULL , + icons_url varchar(255) NOT NULL DEFAULT '', + icons_width tinyint(4) NOT NULL DEFAULT '0', + icons_height tinyint(4) NOT NULL DEFAULT '0', + icons_order INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); + +# Table: 'phpbb_lang' +CREATE TABLE phpbb_lang ( + lang_id INTEGER PRIMARY KEY NOT NULL , + lang_iso varchar(30) NOT NULL DEFAULT '', + lang_dir varchar(30) NOT NULL DEFAULT '', + lang_english_name varchar(100) NOT NULL DEFAULT '', + lang_local_name varchar(255) NOT NULL DEFAULT '', + lang_author varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); + +# Table: 'phpbb_log' +CREATE TABLE phpbb_log ( + log_id INTEGER PRIMARY KEY NOT NULL , + log_type tinyint(4) NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + reportee_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_ip varchar(40) NOT NULL DEFAULT '', + log_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_operation text(65535) NOT NULL DEFAULT '', + log_data mediumtext(16777215) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); +CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); + +# Table: 'phpbb_login_attempts' +CREATE TABLE phpbb_login_attempts ( + attempt_ip varchar(40) NOT NULL DEFAULT '', + attempt_browser varchar(150) NOT NULL DEFAULT '', + attempt_forwarded_for varchar(255) NOT NULL DEFAULT '', + attempt_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '0', + username_clean varchar(255) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); +CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); +CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); +CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); + +# Table: 'phpbb_moderator_cache' +CREATE TABLE phpbb_moderator_cache ( + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '', + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_name varchar(255) NOT NULL DEFAULT '', + display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); + +# Table: 'phpbb_modules' +CREATE TABLE phpbb_modules ( + module_id INTEGER PRIMARY KEY NOT NULL , + module_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1', + module_display INTEGER UNSIGNED NOT NULL DEFAULT '1', + module_basename varchar(255) NOT NULL DEFAULT '', + module_class varchar(10) NOT NULL DEFAULT '', + parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + module_langname varchar(255) NOT NULL DEFAULT '', + module_mode varchar(255) NOT NULL DEFAULT '', + module_auth varchar(255) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); + +# Table: 'phpbb_poll_options' +CREATE TABLE phpbb_poll_options ( + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_option_text text(65535) NOT NULL DEFAULT '', + poll_option_total INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); + +# Table: 'phpbb_poll_votes' +CREATE TABLE phpbb_poll_votes ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_option_id tinyint(4) NOT NULL DEFAULT '0', + vote_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + vote_user_ip varchar(40) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); + +# Table: 'phpbb_posts' +CREATE TABLE phpbb_posts ( + post_id INTEGER PRIMARY KEY NOT NULL , + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + poster_ip varchar(40) NOT NULL DEFAULT '', + post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_approved INTEGER UNSIGNED NOT NULL DEFAULT '1', + post_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', + enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', + post_username varchar(255) NOT NULL DEFAULT '', + post_subject text(65535) NOT NULL DEFAULT '', + post_text mediumtext(16777215) NOT NULL DEFAULT '', + post_checksum varchar(32) NOT NULL DEFAULT '', + post_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + post_postcount INTEGER UNSIGNED NOT NULL DEFAULT '1', + post_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_reason text(65535) NOT NULL DEFAULT '', + post_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); +CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); +CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); + +# Table: 'phpbb_privmsgs' +CREATE TABLE phpbb_privmsgs ( + msg_id INTEGER PRIMARY KEY NOT NULL , + root_level INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_ip varchar(40) NOT NULL DEFAULT '', + message_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', + enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', + message_subject text(65535) NOT NULL DEFAULT '', + message_text mediumtext(16777215) NOT NULL DEFAULT '', + message_edit_reason text(65535) NOT NULL DEFAULT '', + message_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', + message_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + bbcode_uid varchar(8) NOT NULL DEFAULT '', + message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', + to_address text(65535) NOT NULL DEFAULT '', + bcc_address text(65535) NOT NULL DEFAULT '', + message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); + +# Table: 'phpbb_privmsgs_folder' +CREATE TABLE phpbb_privmsgs_folder ( + folder_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + folder_name varchar(255) NOT NULL DEFAULT '', + pm_count INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); + +# Table: 'phpbb_privmsgs_rules' +CREATE TABLE phpbb_privmsgs_rules ( + rule_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_check INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_connection INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_string varchar(255) NOT NULL DEFAULT '', + rule_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_action INTEGER UNSIGNED NOT NULL DEFAULT '0', + rule_folder_id int(11) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); + +# Table: 'phpbb_privmsgs_to' +CREATE TABLE phpbb_privmsgs_to ( + msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_deleted INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_new INTEGER UNSIGNED NOT NULL DEFAULT '1', + pm_unread INTEGER UNSIGNED NOT NULL DEFAULT '1', + pm_replied INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_marked INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_forwarded INTEGER UNSIGNED NOT NULL DEFAULT '0', + folder_id int(11) NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); +CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); + +# Table: 'phpbb_profile_fields' +CREATE TABLE phpbb_profile_fields ( + field_id INTEGER PRIMARY KEY NOT NULL , + field_name varchar(255) NOT NULL DEFAULT '', + field_type tinyint(4) NOT NULL DEFAULT '0', + field_ident varchar(20) NOT NULL DEFAULT '', + field_length varchar(20) NOT NULL DEFAULT '', + field_minlen varchar(255) NOT NULL DEFAULT '', + field_maxlen varchar(255) NOT NULL DEFAULT '', + field_novalue varchar(255) NOT NULL DEFAULT '', + field_default_value varchar(255) NOT NULL DEFAULT '', + field_validation varchar(20) NOT NULL DEFAULT '', + field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_novalue INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_active INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); +CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); + +# Table: 'phpbb_profile_fields_data' +CREATE TABLE phpbb_profile_fields_data ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id) +); + + +# Table: 'phpbb_profile_fields_lang' +CREATE TABLE phpbb_profile_fields_lang ( + field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + field_type tinyint(4) NOT NULL DEFAULT '0', + lang_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id, option_id) +); + + +# Table: 'phpbb_profile_lang' +CREATE TABLE phpbb_profile_lang ( + field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + lang_name varchar(255) NOT NULL DEFAULT '', + lang_explain text(65535) NOT NULL DEFAULT '', + lang_default_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id) +); + + +# Table: 'phpbb_ranks' +CREATE TABLE phpbb_ranks ( + rank_id INTEGER PRIMARY KEY NOT NULL , + rank_title varchar(255) NOT NULL DEFAULT '', + rank_min INTEGER UNSIGNED NOT NULL DEFAULT '0', + rank_special INTEGER UNSIGNED NOT NULL DEFAULT '0', + rank_image varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_reports' +CREATE TABLE phpbb_reports ( + report_id INTEGER PRIMARY KEY NOT NULL , + reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + report_text mediumtext(16777215) NOT NULL DEFAULT '', + reported_post_text mediumtext(16777215) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); +CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); + +# Table: 'phpbb_reports_reasons' +CREATE TABLE phpbb_reports_reasons ( + reason_id INTEGER PRIMARY KEY NOT NULL , + reason_title varchar(255) NOT NULL DEFAULT '', + reason_description mediumtext(16777215) NOT NULL DEFAULT '', + reason_order INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_search_results' +CREATE TABLE phpbb_search_results ( + search_key varchar(32) NOT NULL DEFAULT '', + search_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + search_keywords mediumtext(16777215) NOT NULL DEFAULT '', + search_authors mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (search_key) +); + + +# Table: 'phpbb_search_wordlist' +CREATE TABLE phpbb_search_wordlist ( + word_id INTEGER PRIMARY KEY NOT NULL , + word_text varchar(255) NOT NULL DEFAULT '', + word_common INTEGER UNSIGNED NOT NULL DEFAULT '0', + word_count INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); +CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); + +# Table: 'phpbb_search_wordmatch' +CREATE TABLE phpbb_search_wordmatch ( + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + word_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + title_match INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); +CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); + +# Table: 'phpbb_sessions' +CREATE TABLE phpbb_sessions ( + session_id char(32) NOT NULL DEFAULT '', + session_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_last_visit INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_ip varchar(40) NOT NULL DEFAULT '', + session_browser varchar(150) NOT NULL DEFAULT '', + session_forwarded_for varchar(255) NOT NULL DEFAULT '', + session_page varchar(255) NOT NULL DEFAULT '', + session_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', + session_autologin INTEGER UNSIGNED NOT NULL DEFAULT '0', + session_admin INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (session_id) +); + +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); + +# Table: 'phpbb_sessions_keys' +CREATE TABLE phpbb_sessions_keys ( + key_id char(32) NOT NULL DEFAULT '', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + last_ip varchar(40) NOT NULL DEFAULT '', + last_login INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (key_id, user_id) +); + +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); + +# Table: 'phpbb_sitelist' +CREATE TABLE phpbb_sitelist ( + site_id INTEGER PRIMARY KEY NOT NULL , + site_ip varchar(40) NOT NULL DEFAULT '', + site_hostname varchar(255) NOT NULL DEFAULT '', + ip_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_smilies' +CREATE TABLE phpbb_smilies ( + smiley_id INTEGER PRIMARY KEY NOT NULL , + code varchar(50) NOT NULL DEFAULT '', + emotion varchar(50) NOT NULL DEFAULT '', + smiley_url varchar(50) NOT NULL DEFAULT '', + smiley_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + smiley_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + smiley_order INTEGER UNSIGNED NOT NULL DEFAULT '0', + display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); + +# Table: 'phpbb_styles' +CREATE TABLE phpbb_styles ( + style_id INTEGER PRIMARY KEY NOT NULL , + style_name varchar(255) NOT NULL DEFAULT '', + style_copyright varchar(255) NOT NULL DEFAULT '', + style_active INTEGER UNSIGNED NOT NULL DEFAULT '1', + style_path varchar(100) NOT NULL DEFAULT '', + bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=', + style_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + style_parent_tree text(65535) NOT NULL DEFAULT '' +); + +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); + +# Table: 'phpbb_topics' +CREATE TABLE phpbb_topics ( + topic_id INTEGER PRIMARY KEY NOT NULL , + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_approved INTEGER UNSIGNED NOT NULL DEFAULT '1', + topic_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_title text(65535) NOT NULL DEFAULT '', + topic_poster INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_replies INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_replies_real INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_status tinyint(3) NOT NULL DEFAULT '0', + topic_type tinyint(3) NOT NULL DEFAULT '0', + topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_first_poster_name varchar(255) NOT NULL DEFAULT '', + topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_poster_name varchar(255) NOT NULL DEFAULT '', + topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_subject text(65535) NOT NULL DEFAULT '', + topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_bumped INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_bumper INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_title text(65535) NOT NULL DEFAULT '', + poll_start INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_length INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_max_options tinyint(4) NOT NULL DEFAULT '1', + poll_last_vote INTEGER UNSIGNED NOT NULL DEFAULT '0', + poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); +CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); +CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved); +CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id); +CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); + +# Table: 'phpbb_topics_track' +CREATE TABLE phpbb_topics_track ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +); + +CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); + +# Table: 'phpbb_topics_posted' +CREATE TABLE phpbb_topics_posted ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posted INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +); + + +# Table: 'phpbb_topics_watch' +CREATE TABLE phpbb_topics_watch ( + topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); + +# Table: 'phpbb_user_group' +CREATE TABLE phpbb_user_group ( + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_leader INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_pending INTEGER UNSIGNED NOT NULL DEFAULT '1' +); + +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); + +# Table: 'phpbb_users' +CREATE TABLE phpbb_users ( + user_id INTEGER PRIMARY KEY NOT NULL , + user_type tinyint(2) NOT NULL DEFAULT '0', + group_id INTEGER UNSIGNED NOT NULL DEFAULT '3', + user_permissions mediumtext(16777215) NOT NULL DEFAULT '', + user_perm_from INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_ip varchar(40) NOT NULL DEFAULT '', + user_regdate INTEGER UNSIGNED NOT NULL DEFAULT '0', + username varchar(255) NOT NULL DEFAULT '', + username_clean varchar(255) NOT NULL DEFAULT '', + user_password varchar(40) NOT NULL DEFAULT '', + user_passchg INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_pass_convert INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_email varchar(100) NOT NULL DEFAULT '', + user_email_hash bigint(20) NOT NULL DEFAULT '0', + user_birthday varchar(10) NOT NULL DEFAULT '', + user_lastvisit INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastmark INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastpost_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lastpage varchar(200) NOT NULL DEFAULT '', + user_last_confirm_key varchar(10) NOT NULL DEFAULT '', + user_last_search INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_warnings tinyint(4) NOT NULL DEFAULT '0', + user_last_warning INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_login_attempts tinyint(4) NOT NULL DEFAULT '0', + user_inactive_reason tinyint(2) NOT NULL DEFAULT '0', + user_inactive_time INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_lang varchar(30) NOT NULL DEFAULT '', + user_timezone varchar(100) NOT NULL DEFAULT 'UTC', + user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', + user_style INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_colour varchar(6) NOT NULL DEFAULT '', + user_new_privmsg int(4) NOT NULL DEFAULT '0', + user_unread_privmsg int(4) NOT NULL DEFAULT '0', + user_last_privmsg INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_message_rules INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_full_folder int(11) NOT NULL DEFAULT '-3', + user_emailtime INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_topic_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', + user_post_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', + user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', + user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_notify_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_notify_type tinyint(4) NOT NULL DEFAULT '0', + user_allow_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271', + user_avatar varchar(255) NOT NULL DEFAULT '', + user_avatar_type tinyint(2) NOT NULL DEFAULT '0', + user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_sig mediumtext(16777215) NOT NULL DEFAULT '', + user_sig_bbcode_uid varchar(8) NOT NULL DEFAULT '', + user_sig_bbcode_bitfield varchar(255) NOT NULL DEFAULT '', + user_from varchar(100) NOT NULL DEFAULT '', + user_icq varchar(15) NOT NULL DEFAULT '', + user_aim varchar(255) NOT NULL DEFAULT '', + user_yim varchar(255) NOT NULL DEFAULT '', + user_msnm varchar(255) NOT NULL DEFAULT '', + user_jabber varchar(255) NOT NULL DEFAULT '', + user_website varchar(200) NOT NULL DEFAULT '', + user_occ text(65535) NOT NULL DEFAULT '', + user_interests text(65535) NOT NULL DEFAULT '', + user_actkey varchar(32) NOT NULL DEFAULT '', + user_newpasswd varchar(40) NOT NULL DEFAULT '', + user_form_salt varchar(32) NOT NULL DEFAULT '', + user_new INTEGER UNSIGNED NOT NULL DEFAULT '1', + user_reminded tinyint(4) NOT NULL DEFAULT '0', + user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); +CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); + +# Table: 'phpbb_warnings' +CREATE TABLE phpbb_warnings ( + warning_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + log_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + warning_time INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + +# Table: 'phpbb_words' +CREATE TABLE phpbb_words ( + word_id INTEGER PRIMARY KEY NOT NULL , + word varchar(255) NOT NULL DEFAULT '', + replacement varchar(255) NOT NULL DEFAULT '' +); + + +# Table: 'phpbb_zebra' +CREATE TABLE phpbb_zebra ( + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + zebra_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + friend INTEGER UNSIGNED NOT NULL DEFAULT '0', + foe INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, zebra_id) +); diff --git a/phpBB/mcp.php b/phpBB/mcp.php index d04a297cf9..984925789f 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -483,7 +483,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_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) { // Moderators without the permission to approve post should at least not see them. ;) continue; @@ -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 post_visibility = ' . ITEM_APPROVED; } break; @@ -635,7 +635,7 @@ 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; @@ -648,7 +648,7 @@ 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 = ' . ITEM_UNAPPROVED . ' AND t.topic_id = p.topic_id AND t.topic_first_post_id <> p.post_id'; @@ -666,7 +666,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 = ' . ITEM_UNAPPROVED; if ($min_time) { diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index f142d182bc..f8cb55ccc4 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -613,7 +613,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/posting.php b/phpBB/posting.php index a17578e343..273499c1e4 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -86,8 +86,8 @@ switch ($mode) $sql = 'SELECT f.*, t.* FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f WHERE t.topic_id = $topic_id - AND f.forum_id = t.forum_id" . - (($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND t.topic_approved = 1'); + AND f.forum_id = t.forum_id + AND " . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); break; case 'quote': @@ -114,8 +114,8 @@ switch ($mode) WHERE p.post_id = $post_id AND t.topic_id = p.topic_id AND u.user_id = p.poster_id - AND f.forum_id = t.forum_id" . - (($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND p.post_approved = 1'); + AND f.forum_id = t.forum_id + AND " . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); break; case 'smilies': @@ -163,7 +163,7 @@ if (!$post_data) // Not able to reply to unapproved posts/topics // TODO: add more descriptive language key -if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && !$post_data['topic_approved']) || ($mode == 'quote' && !$post_data['post_approved']))) +if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && $post_data['topic_visibility'] == ITEM_UNAPPROVED) || ($mode == 'quote' && $post_data['post_visibility'] == ITEM_UNAPPROVED))) { trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED'); } @@ -1063,8 +1063,8 @@ if ($submit || $preview || $refresh) 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, - 'topic_approved' => (isset($post_data['topic_approved'])) ? $post_data['topic_approved'] : false, - 'post_approved' => (isset($post_data['post_approved'])) ? $post_data['post_approved'] : false, + 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false, + 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false, ); if ($mode == 'edit') @@ -1514,9 +1514,9 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], - 'topic_approved' => $post_data['topic_approved'], + 'topic_visibility' => $post_data['topic_visibility'], 'topic_type' => $post_data['topic_type'], - 'post_approved' => $post_data['post_approved'], + 'post_visibility' => $post_data['post_visibility'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], diff --git a/phpBB/search.php b/phpBB/search.php index 190da5247f..7bf941f127 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -249,7 +249,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $db->sql_freeresult($result); - // find out in which forums the user is allowed to view approved posts +/* // find out in which forums the user is allowed to view approved posts if ($auth->acl_get('m_approve')) { $m_approve_fid_ary = array(-1); @@ -265,6 +265,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $m_approve_fid_ary = array(); $m_approve_fid_sql = ' AND p.post_approved = 1'; } +*/ + $m_approve_fid_sql = ' AND ' . topic_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.'); if ($reset_search_forum) { @@ -523,17 +525,17 @@ if ($keywords || $author || $author_id || $search_id || $submit) // make sure that some arrays are always in the same order sort($ex_fid_ary); - sort($m_approve_fid_ary); +// @TODO sort($m_approve_fid_ary); sort($author_id_ary); if (!empty($search->search_query)) { - $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } else if (sizeof($author_id_ary)) { $firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false; - $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } // For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options. @@ -548,7 +550,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary); $sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; - $sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_approved', 'p.forum_id'), array('t.topic_approved', 't.forum_id'), $m_approve_fid_sql); + $sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_visibility', 'p.forum_id'), array('t.topic_visibility', 't.forum_id'), $m_approve_fid_sql); } if ($show_results == 'posts') @@ -882,8 +884,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_deleted = ($row['topic_visibility'] == ITEM_DELETED) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; $row['topic_title'] = preg_replace('#(?!<.*)(?]*(?:)#is', '$1', $row['topic_title']); @@ -911,6 +914,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'DELETED_IMG' => ($topic_deleted) ? $user->img(/*TODO*/) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, @@ -919,6 +923,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 783c7181d2..2c29d92cd8 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -241,7 +241,7 @@ if ($sort_days) AND (topic_last_post_time >= $min_post_time OR topic_type = " . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ') - ' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND topic_approved = 1'); + AND ' . topic_visibility::get_visibility_sql('topic', $forum_id); $result = $db->sql_query($sql); $topics_count = (int) $db->sql_fetchfield('num_topics'); $db->sql_freeresult($result); @@ -353,7 +353,7 @@ $sql_array = array( 'LEFT_JOIN' => array(), ); -$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1'; +$sql_approved = 'AND ' . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); if ($user->data['is_registered']) { @@ -685,8 +685,9 @@ if (sizeof($topic_list)) $view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id; $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; + $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])); + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])); + $topic_deleted = ($row['topic_visibility'] == ITEM_DELETED); $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; // Send vars to template @@ -719,6 +720,7 @@ if (sizeof($topic_list)) 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'DELETED_IMG' => ($topic_deleted) ? $user->img(/*TODO*/) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, @@ -726,6 +728,7 @@ if (sizeof($topic_list)) 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, 'S_HAS_POLL' => ($row['poll_start']) ? true : false, 'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false, 'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3fde5b5e03..282c23cd70 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -83,7 +83,7 @@ if ($view && !$post_id) $sql = 'SELECT post_id, topic_id, forum_id FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . " + AND " . topic_visibility::get_visibility_sql('post', $forum_id) . " AND post_time > $topic_last_read AND forum_id = $forum_id ORDER BY post_time ASC"; @@ -137,7 +137,7 @@ if ($view && !$post_id) WHERE forum_id = ' . $row['forum_id'] . " AND topic_moved_id = 0 AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} - " . (($auth->acl_get('m_approve', $row['forum_id'])) ? '' : 'AND topic_approved = 1') . " + AND" . topic_visibility::get_visibility_sql('topic', $row['forum_id']) . " ORDER BY topic_last_post_time $sql_ordering"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -174,7 +174,7 @@ $sql_array = array( // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { - $sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id'; + $sql_array['SELECT'] .= ', p.post_visibility, p.post_time, p.post_id'; $sql_array['FROM'][POSTS_TABLE] = 'p'; } @@ -249,7 +249,7 @@ $forum_id = (int) $topic_data['forum_id']; if ($post_id) { // are we where we are supposed to be? - if (!$topic_data['post_approved'] && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + if ($topic_data['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $topic_data['forum_id'])) { // If post_id was submitted, we try at least to display the topic as a last resort... if ($topic_id) @@ -277,7 +277,7 @@ if ($post_id) $sql = 'SELECT COUNT(p.post_id) AS prev_posts FROM ' . POSTS_TABLE . " p WHERE p.topic_id = {$topic_data['topic_id']} - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : ''); + " . topic_visibility::get_visibility_sql('post', $forum_id, 'p'); if ($sort_dir == 'd') { @@ -315,7 +315,13 @@ if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == PO // Setup look and feel $user->setup('viewtopic', $topic_data['forum_style']); -if (!$topic_data['topic_approved'] && !$auth->acl_get('m_approve', $forum_id)) +/* the topic "does not exist": +* if the topic is unapproved and the user cannot approve it +* if the topic is deleted and the user cannot restore it +* NB: restoring a topic has two cases: moderator restore and poster restore. +*/ +if (($topic_data['topic_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $forum_id)) + || ($topic_data['topic_visibility'] == ITEM_DELETED && (!$auth->acl_get('m_restore', $forum_id) || ($user->data['user_id'] == $topic_data['topic_poster'] && $auth->acl_get('f_restore', $forum_id))))) { trigger_error('NO_TOPIC'); } @@ -402,7 +408,7 @@ if ($sort_days) FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id AND post_time >= $min_post_time - " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1'); + AND " . topic_visibility::get_visibility_sql('post', $forum_id); $result = $db->sql_query($sql); $total_posts = (int) $db->sql_fetchfield('num_posts'); $db->sql_freeresult($result); @@ -938,7 +944,7 @@ $i = $i_total = 0; $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . " WHERE p.topic_id = $topic_id - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . " + AND " . topic_visibility::get_visibility_sql('post', $forum_id, 'p.') . " " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " $limit_posts_time ORDER BY $sql_sort_order"; @@ -1020,7 +1026,7 @@ while ($row = $db->sql_fetchrow($result)) { $attach_list[] = (int) $row['post_id']; - if ($row['post_approved']) + if ($row['post_visibility'] == ITEM_UNAPPROVED) { $has_attachments = true; } @@ -1046,7 +1052,7 @@ while ($row = $db->sql_fetchrow($result)) // Make sure the icon actually exists 'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0, 'post_attachment' => $row['post_attachment'], - 'post_approved' => $row['post_approved'], + 'post_visibility' => $row['post_visibility'], 'post_reported' => $row['post_reported'], 'post_username' => $row['post_username'], 'post_text' => $row['post_text'], @@ -1313,8 +1319,8 @@ if (sizeof($attach_list)) $sql = 'SELECT a.post_msg_id as post_id FROM ' . ATTACHMENTS_TABLE . ' a, ' . POSTS_TABLE . " p WHERE p.topic_id = $topic_id - AND p.post_approved = 1 - AND p.topic_id = a.topic_id"; + AND p.post_visibility = " . ITEM_APPROVED . ' + AND p.topic_id = a.topic_id'; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1605,7 +1611,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, - 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, + 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_APPROVED) ? false : true, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], 'S_FRIEND' => ($row['friend']) ? true : false, From 244f6e2ddc7818125edc273be1d83a5298ce6589 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Fri, 18 Jun 2010 08:29:53 -0500 Subject: [PATCH 004/575] [feature/soft-delete] Correct some mistakes in e8d47 Notably: Uncomment the die() in create_schema_files, and add the class that makes everything tick. PHPBB3-9657 --- phpBB/includes/class_visibility.php | 137 ++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 phpBB/includes/class_visibility.php diff --git a/phpBB/includes/class_visibility.php b/phpBB/includes/class_visibility.php new file mode 100644 index 0000000000..28fc584b76 --- /dev/null +++ b/phpBB/includes/class_visibility.php @@ -0,0 +1,137 @@ +acl_get('m_approve', $forum_id)) + { + $status_ary[] = ITEM_UNAPPROVED; + } + + if ($auth->acl_get('m_restore', $forum_id)) + { + $status_ary[] = ITEM_DELETED; + } + + $clause = $db->sql_in_set($table_alias . $mode . '_visibility', $status_ary); + + // only allow the user to view deleted posts he himself made + if ($auth->acl_get('f_restore', $forum_id)) + { + $clause = 'AND (' . $clause . " + OR ($table_alias{$mode}_visibility = " . ITEM_DELETED . " + AND {$table_alias}poster_id = " . $user->data['user_id'] . '))'; + + } + + return $clause; + } + + public function get_visibility_sql_global($mode, $exclude_forum_ids = array(), $table_alias = '') + { + global $auth, $db, $user; + + // users can always see approved posts + $where_sql = "($table_alias{$mode}_visibility = " . ITEM_APPROVED; + + // in set notation: {approve_forums} = {m_approve} - {exclude_forums} + $approve_forums = array_diff(array_keys($auth->acl_getf('m_approve', true)), $exclude_forum_ids); + if (sizeof($approve_forums)) + { + // users can view unapproved topics in certain forums. specify them. + $where_sql .= " OR ($table_alias{$mode}_visibility = " . ITEM_UNAPPROVED . ' + AND ' . $db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ')'; + } + + // this is exactly the same logic as for approve forums, above + $restore_forums = array_diff(array_keys($auth->acl_getf('m_restore', true)), $exclude_forum_ids); + if (sizeof($restore_forums)) + { + $where_sql .= " OR ($table_alias{$mode}_visibility = " . ITEM_DELETED . ' + AND ' . $db->sql_in_set($table_alias . 'forum_id', $restore_forums) . ')'; + } + + // we also allow the user to view deleted posts he himself made + $user_restore_forums = array_diff(array_keys($auth->acl_getf('f_restore', true)), $exclude_forum_ids); + if (sizeof($user_restore_forums)) + { + // specify the poster ID, the visibility type, and the forums we're interested in + $where_sql .= " OR ($table_alias{$mode}poster_id = " . $user->data['user_id'] . " + AND $table_alias{$mode}_visibility = " . ITEM_DELETED . " + AND " . $db->sql_in_set($table_alias . 'forum_id', $user_restore_forums) . ')'; + } + + $where_sql .= ')'; + + return $where_sql; + } + + public function set_topic_visibility($visibility, $topic_id, $forum_id) + { + global $db; + + $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_visibility = ' . (int) $visibility . ' + WHERE topic_id = ' . (int) $topic_id; + $db->sql_query($sql); + + if ($visibility != ITEM_APPROVED) + { + $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $db->sql_query($sql); + + $status = true; + while ($row = $db->sql_fetchrow($result)) + { + $status = min($status, self::set_post_visibility($visibility, false, $topic_id, $forum_id, true, true)); + } + } + else + { + // TOOD: figure out which posts we actually care about + $status = self::set_post_visibility($visibility, 0, false, $forum_id, true, true); + } + + return $status; + } + + public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $is_starter, $is_latest) + { + global $db; + + if ($post_id) + { + $where_sql = 'post_id = ' . (int) $post_id; + } + else if ($topic_id) + { + $where_sql = 'topic_id = ' . (int) $topic_id; + } + else + { + // throw new MissingArgumentsException(); <-- a nice idea + return false; + } + + $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_visibility = ' . (int) $visibility . ' + WHERE ' . $where_sql; + $db->sql_query($sql); + + if ($is_starter || $is_latest) + { + update_post_information('topic', $topic_id, false); + update_post_information('forum', $forum_id, false); + } + + // if we're changing the starter, we need to change the rest of the topic + if ($is_starter && !$is_latest) + { + self::set_topic_visibility($visibility, $topic_id, $forum_id); + } + } +} +?> From c32d76080605f843bb23e9a608c368d4b5dc55d8 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 20 Jun 2010 15:01:26 -0500 Subject: [PATCH 005/575] [feature/soft-delete] I told you I was going to rename the class! Rename topic_visibility class to phpbb_visibility. Also a bit of work to the class itself, mostly cleanup and adding the comments that I'd previously written. PHPBB3-9657 --- phpBB/feed.php | 10 ++-- phpBB/includes/class_visibility.php | 85 ++++++++++++++++++++-------- phpBB/includes/functions_posting.php | 6 +- phpBB/includes/mcp/mcp_forum.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 2 +- phpBB/posting.php | 4 +- phpBB/search.php | 2 +- phpBB/viewforum.php | 4 +- phpBB/viewtopic.php | 10 ++-- 9 files changed, 82 insertions(+), 43 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index a806cdd608..89ee5a3bbe 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -760,7 +760,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' AND topic_moved_id = 0 - AND ' . topic_visibility::get_visibility_sql_global('topic') . ' + AND ' . phpbb_visibility::get_visibility_sql_global('topic') . ' ORDER BY topic_last_post_time DESC'; $result = $db->sql_query_limit($sql, $this->num_items); @@ -795,7 +795,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . topic_visibility::get_visibility_sql('post', array(), 'p.') . ' + AND ' . phpbb_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', @@ -892,7 +892,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . $this->forum_id . ' AND topic_moved_id = 0 - AND ' . topic_visibility::get_visibility_sql('topic', $this->forum_id) . ' + AND ' . phpbb_visibility::get_visibility_sql('topic', $this->forum_id) . ' ORDER BY topic_last_post_time DESC'; $result = $db->sql_query_limit($sql, $this->num_items); @@ -919,7 +919,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base USERS_TABLE => 'u', ), 'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . topic_visibility::get_visibility_sql('post', $this->forum_id, 'p.') . ' + AND ' . phpbb_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', @@ -1025,7 +1025,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base USERS_TABLE => 'u', ), 'WHERE' => 'p.topic_id = ' . $this->topic_id . ' - AND ' . topic_visibility::get_visibility_sql('post', $this->forum_id, 'p.') . ' + AND ' . phpbb_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/class_visibility.php b/phpBB/includes/class_visibility.php index 28fc584b76..46f188d833 100644 --- a/phpBB/includes/class_visibility.php +++ b/phpBB/includes/class_visibility.php @@ -1,7 +1,35 @@ sql_query($sql); - if ($visibility != ITEM_APPROVED) - { - $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' - WHERE topic_id = ' . (int) $topic_id; - $result = $db->sql_query($sql); + // if we're approving, disapproving, or deleteing a topic, assume that + // we are adjusting _all_ posts in that topic. + $status = self::set_post_visibility($visibility, false, $topic_id, $forum_id, true, true); - $status = true; - while ($row = $db->sql_fetchrow($result)) - { - $status = min($status, self::set_post_visibility($visibility, false, $topic_id, $forum_id, true, true)); - } - } - else - { - // TOOD: figure out which posts we actually care about - $status = self::set_post_visibility($visibility, 0, false, $forum_id, true, true); - } return $status; } + /** + * @param $visibility - int - element of {ITEM_UNAPPROVED, ITEM_APPROVED, ITEM_DELETED} + * @param $post_id - int - the post ID to act on + * @param $topic_id - int - forum where $post_id is found + * @param $forum_id - int - forum ID where $topic_id resides + * @param $is_starter - bool - is this the first post of the topic + * @param $is_latest - bool - is this the last post of the topic + */ public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $is_starter, $is_latest) { global $db; + // if we're changing the starter, we need to change the rest of the topic + if ($is_starter && !$is_latest) + { + return self::set_topic_visibility($visibility, $topic_id, $forum_id); + } + if ($post_id) { $where_sql = 'post_id = ' . (int) $post_id; @@ -121,17 +165,12 @@ class topic_visibility WHERE ' . $where_sql; $db->sql_query($sql); + // Sync the first/last topic information if needed if ($is_starter || $is_latest) { update_post_information('topic', $topic_id, false); update_post_information('forum', $forum_id, false); } - - // if we're changing the starter, we need to change the rest of the topic - if ($is_starter && !$is_latest) - { - self::set_topic_visibility($visibility, $topic_id, $forum_id); - } } } ?> diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2f51200b48..12448ea0ce 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -993,7 +993,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p' . " WHERE p.topic_id = $topic_id - AND " . topic_visibility::get_visibility_sql('post', $forum_id, 'p.') . ' + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p.') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' ORDER BY p.post_time '; @@ -1542,7 +1542,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql = 'SELECT MAX(post_id) as last_post_id FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - AND " . topic_visibility::get_visibility_sql('post', $forum_id); + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1555,7 +1555,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql = 'SELECT post_id FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - AND " . topic_visibility::get_visibility_sql('post', $forum_id) . ' + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id) . ' AND post_time > ' . $data['post_time'] . ' ORDER BY post_time ASC'; $result = $db->sql_query_limit($sql, 1); diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 48b9c7c2d3..90c0224b40 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -154,7 +154,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t WHERE t.forum_id = ' . $forum_id . ' - ' . topic_visibility::get_visibility_sql('topic', $forum_id, 't.') . " + ' . phpbb_visibility::get_visibility_sql('topic', $forum_id, 't.') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql"; $result = $db->sql_query_limit($sql, $topics_per_page, $start); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index f6fd12f0c4..5c25da7a9d 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -146,7 +146,7 @@ function mcp_topic_view($id, $mode, $action) FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . ' p.topic_id = ' . $topic_id . ' - AND ' . topic_visibility::get_visibility_sql('post', $topic_info['forum_id'], 'p.') . ' + AND ' . phpbb_visibility::get_visibility_sql('post', $topic_info['forum_id'], 'p.') . ' AND p.poster_id = u.user_id ' . $limit_time_sql . ' ORDER BY ' . $sort_order_sql; diff --git a/phpBB/posting.php b/phpBB/posting.php index 273499c1e4..30b897c068 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -87,7 +87,7 @@ switch ($mode) FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f WHERE t.topic_id = $topic_id AND f.forum_id = t.forum_id - AND " . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); + AND " . phpbb_visibility::get_visibility_sql('topic', $forum_id, 't.'); break; case 'quote': @@ -115,7 +115,7 @@ switch ($mode) AND t.topic_id = p.topic_id AND u.user_id = p.poster_id AND f.forum_id = t.forum_id - AND " . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); + AND " . phpbb_visibility::get_visibility_sql('topic', $forum_id, 't.'); break; case 'smilies': diff --git a/phpBB/search.php b/phpBB/search.php index 7bf941f127..9ff3c2e027 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -266,7 +266,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $m_approve_fid_sql = ' AND p.post_approved = 1'; } */ - $m_approve_fid_sql = ' AND ' . topic_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.'); + $m_approve_fid_sql = ' AND ' . phpbb_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.'); if ($reset_search_forum) { diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 2c29d92cd8..c775d33631 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -241,7 +241,7 @@ if ($sort_days) AND (topic_last_post_time >= $min_post_time OR topic_type = " . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ') - AND ' . topic_visibility::get_visibility_sql('topic', $forum_id); + AND ' . phpbb_visibility::get_visibility_sql('topic', $forum_id); $result = $db->sql_query($sql); $topics_count = (int) $db->sql_fetchfield('num_topics'); $db->sql_freeresult($result); @@ -353,7 +353,7 @@ $sql_array = array( 'LEFT_JOIN' => array(), ); -$sql_approved = 'AND ' . topic_visibility::get_visibility_sql('topic', $forum_id, 't.'); +$sql_approved = 'AND ' . phpbb_visibility::get_visibility_sql('topic', $forum_id, 't.'); if ($user->data['is_registered']) { diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 282c23cd70..b6c47211f7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -83,7 +83,7 @@ if ($view && !$post_id) $sql = 'SELECT post_id, topic_id, forum_id FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - AND " . topic_visibility::get_visibility_sql('post', $forum_id) . " + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id) . " AND post_time > $topic_last_read AND forum_id = $forum_id ORDER BY post_time ASC"; @@ -137,7 +137,7 @@ if ($view && !$post_id) WHERE forum_id = ' . $row['forum_id'] . " AND topic_moved_id = 0 AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} - AND" . topic_visibility::get_visibility_sql('topic', $row['forum_id']) . " + AND" . phpbb_visibility::get_visibility_sql('topic', $row['forum_id']) . " ORDER BY topic_last_post_time $sql_ordering"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -277,7 +277,7 @@ if ($post_id) $sql = 'SELECT COUNT(p.post_id) AS prev_posts FROM ' . POSTS_TABLE . " p WHERE p.topic_id = {$topic_data['topic_id']} - " . topic_visibility::get_visibility_sql('post', $forum_id, 'p'); + " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p'); if ($sort_dir == 'd') { @@ -408,7 +408,7 @@ if ($sort_days) FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id AND post_time >= $min_post_time - AND " . topic_visibility::get_visibility_sql('post', $forum_id); + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id); $result = $db->sql_query($sql); $total_posts = (int) $db->sql_fetchfield('num_posts'); $db->sql_freeresult($result); @@ -944,7 +944,7 @@ $i = $i_total = 0; $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . " WHERE p.topic_id = $topic_id - AND " . topic_visibility::get_visibility_sql('post', $forum_id, 'p.') . " + AND " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p.') . " " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " $limit_posts_time ORDER BY $sql_sort_order"; From fb13ab83e476d2afbc7bb181f7ab90df98f996da Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 27 Jun 2010 14:22:36 -0500 Subject: [PATCH 006/575] [feature/soft-delete] Implement the ability to soft-delete and restore posts The soft delete feature seems to work. Tests are pending. A real icon is pending. Add the permissions and the interface to soft-delete posts. Also able to restore posts via the MCP queue PHPBB3-9657 --- phpBB/includes/class_visibility.php | 265 +++++++++++++++++- phpBB/includes/functions_posting.php | 116 ++++---- phpBB/includes/mcp/info/mcp_queue.php | 1 + phpBB/includes/mcp/mcp_queue.php | 152 ++-------- phpBB/install/schemas/schema_data.sql | 4 +- phpBB/language/en/acp/common.php | 2 + phpBB/language/en/acp/permissions_phpbb.php | 5 + phpBB/language/en/mcp.php | 2 + phpBB/language/en/posting.php | 2 + phpBB/language/en/viewtopic.php | 2 + phpBB/mcp.php | 6 +- phpBB/posting.php | 51 +++- .../prosilver/imageset/icon_topic_deleted.png | Bin 0 -> 964 bytes phpBB/styles/prosilver/imageset/imageset.cfg | 117 ++++++++ .../styles/prosilver/template/mcp_queue.html | 5 + .../prosilver/template/posting_editor.html | 7 + .../prosilver/template/viewforum_body.html | 2 +- .../prosilver/template/viewtopic_body.html | 2 + phpBB/viewforum.php | 3 +- phpBB/viewtopic.php | 6 +- 20 files changed, 553 insertions(+), 197 deletions(-) create mode 100644 phpBB/styles/prosilver/imageset/icon_topic_deleted.png create mode 100644 phpBB/styles/prosilver/imageset/imageset.cfg diff --git a/phpBB/includes/class_visibility.php b/phpBB/includes/class_visibility.php index 46f188d833..9798e938b1 100644 --- a/phpBB/includes/class_visibility.php +++ b/phpBB/includes/class_visibility.php @@ -125,7 +125,6 @@ class phpbb_visibility // we are adjusting _all_ posts in that topic. $status = self::set_post_visibility($visibility, false, $topic_id, $forum_id, true, true); - return $status; } @@ -172,5 +171,267 @@ class phpbb_visibility update_post_information('forum', $forum_id, false); } } + + /** + * Can the current logged-in user soft-delete posts? + * @param $forum_id - int - the forum ID whose permissions to check + * @param $poster_id - int - the 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) + { + global $auth, $user; + + if ($auth->acl_get('m_softdelete', $forum_id)) + { + return true; + } + else if ($auth->acl_get('f_softdelete', $forum_id) && $poster_id == $user->data['poster_id'] && !$post_locked) + { + return true; + } + return false; + } + + /** + * Can the current logged-in user restore soft-deleted posts? + * @param $forum_id - int - the forum ID whose permissions to check + * @param $poster_id - int - the poster ID of the post in question + * @param $post_locked - bool - is the post locked? + * @return bool + */ + public function can_restore($forum_id, $poster_id, $post_locked) + { + global $auth, $user; + + if ($auth->acl_get('m_restore', $forum_id)) + { + return true; + } + else if ($auth->acl_get('f_restore', $forum_id) && $poster_id == $user->data['user_id'] && !$post_locked) + { + return true; + } + return false; + } + + /** + * Do the required math to hide a complete topic (going from approved to + * unapproved or from approved to deleted) + * @param $topic_id - int - the topic to act on + * @param $forum_id - int - the forum where the topic resides + * @param $topic_row - array - data about 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 hide_topic($topic_id, $forum_id, &$topic_row, &$sql_data) + { + global $auth, $config, $db; + + // Do we need to grab some topic informations? + if (!sizeof($topic_row)) + { + $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_visibility + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $topic_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + // If this is the only post remaining we do not need to decrement topic_replies. + // Also do not decrement if first post - then the topic_replies will not be adjusted if approving the topic again. + + // If this is an edited topic or the first post the topic gets completely disapproved later on... + $sql_data[FORUMS_TABLE] = 'forum_topics = forum_topics - 1'; + $sql_data[FORUMS_TABLE] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1); + + set_config_count('num_topics', -1, true); + set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true); + + // Only decrement this post, since this is the one non-approved now + if ($auth->acl_get('f_postcount', $forum_id)) + { + $sql_data[USERS_TABLE] = 'user_posts = user_posts - 1'; + } + } + + /** + * Do the required math to hide a single post (going from approved to + * unapproved or from approved to deleted) + * Notably, we do _not_ need the post ID to do this operation. We're only changing statistic caches + * @param $forum_id - int - the forum where the topic resides + * @param $current_time - int - passed for consistency instead of calling time() internally + * @param $sql_data - array - populated with the SQL changes, may be empty at call time + * @return void + */ + public function hide_post($forum_id, $current_time, &$sql_data) + { + global $auth, $config, $db; + + $sql_data[TOPICS_TABLE] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time; + $sql_data[FORUMS_TABLE] = 'forum_posts = forum_posts - 1'; + + set_config_count('num_posts', -1, true); + + if ($auth->acl_get('f_postcount', $forum_id)) + { + $sql_data[USERS_TABLE] = 'user_posts = user_posts - 1'; + } + } + + /** + * One function to rule them all ... and unhide posts and topics. This could + * reasonably be broken up, I straight copied this code from the mcp_queue.php + * file here for global access. + * @param $mode - string - member of the set {'approve', 'restore'} + * @param $post_info - array - Contains info from post U topics table about + * the posts/topics in question + * @param $post_id_list - array of ints - the set of posts being worked on + */ + public function unhide_posts_topics($mode, $post_info, $post_id_list) + { + global $db, $config; + + // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1 + // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 + + $total_topics = $total_posts = 0; + $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); + $user_posts_sql = $post_approved_list = array(); + + foreach ($post_info as $post_id => $post_data) + { + if ($post_data['post_visibility'] == ITEM_APPROVED) + { + $post_approved_list[] = $post_id; + continue; + } + + $topic_id_list[$post_data['topic_id']] = 1; + + if ($post_data['forum_id']) + { + $forum_id_list[$post_data['forum_id']] = 1; + } + + // User post update (we do not care about topic or post, since user posts are strictly connected to posts) + // But we care about forums where post counts get not increased. ;) + if ($post_data['post_postcount']) + { + $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1; + } + + // Topic or Post. ;) + if ($post_data['topic_first_post_id'] == $post_id) + { + if ($post_data['forum_id']) + { + $total_topics++; + } + $topic_approve_sql[] = $post_data['topic_id']; + + $approve_log[] = array( + 'type' => 'topic', + 'post_subject' => $post_data['post_subject'], + 'forum_id' => $post_data['forum_id'], + 'topic_id' => $post_data['topic_id'], + ); + } + else + { + $approve_log[] = array( + 'type' => 'post', + 'post_subject' => $post_data['post_subject'], + 'forum_id' => $post_data['forum_id'], + 'topic_id' => $post_data['topic_id'], + ); + } + + if ($post_data['forum_id']) + { + $total_posts++; + + // Increment by topic_replies if we approve a topic... + // This works because we do not adjust the topic_replies when re-approving a topic after an edit. + if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies']) + { + $total_posts += $post_data['topic_replies']; + } + } + + $post_approve_sql[] = $post_id; + } + + $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); + for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) + { + unset($post_info[$post_approved_list[$i]]); + } + + if (sizeof($topic_approve_sql)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_visibility = ' . ITEM_APPROVED . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); + $db->sql_query($sql); + } + + if (sizeof($post_approve_sql)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_visibility = ' . ITEM_APPROVED . ' + WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); + $db->sql_query($sql); + } + + unset($topic_approve_sql, $post_approve_sql); + + foreach ($approve_log as $log_data) + { + add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_' . strtoupper($mode) . 'D' : 'LOG_POST_' . strtoupper($mode) . 'D', $log_data['post_subject']); + } + + if (sizeof($user_posts_sql)) + { + // Try to minimize the query count by merging users with the same post count additions + $user_posts_update = array(); + + foreach ($user_posts_sql as $user_id => $user_posts) + { + $user_posts_update[$user_posts][] = $user_id; + } + + foreach ($user_posts_update as $user_posts => $user_id_ary) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . $user_posts . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + } + + if ($total_topics) + { + set_config_count('num_topics', $total_topics, true); + } + + if ($total_posts) + { + set_config_count('num_posts', $total_posts, true); + } + + if (!function_exists('sync')) + { + global $phpbb_root_path, $phpEx; + include ($phpbb_root_path . 'includes/functions_admin.'.$phpEx); + } + + sync('topic', 'topic_id', array_keys($topic_id_list), true); + sync('forum', 'forum_id', array_keys($forum_id_list), true, true); + unset($topic_id_list, $forum_id_list); + + return true; + } } -?> diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 12448ea0ce..b264e35a93 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1411,7 +1411,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id /** * Delete Post */ -function delete_post($forum_id, $topic_id, $post_id, &$data) +function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false) { global $db, $user, $auth; global $config, $phpEx, $phpbb_root_path; @@ -1422,10 +1422,14 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) { $post_mode = 'delete_topic'; } - else if ($data['topic_first_post_id'] == $post_id) + else if ($data['topic_first_post_id'] == $post_id && !$is_soft) { $post_mode = 'delete_first_post'; } + else if ($data['topic_first_post_id'] == $post_id && $is_soft) + { + $post_mode = 'delete_topic'; + } else if ($data['topic_last_post_id'] == $post_id) { $post_mode = 'delete_last_post'; @@ -1460,14 +1464,22 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $db->sql_freeresult($result); } - if (!delete_posts('post_id', array($post_id), false, false)) + if ($is_soft) { - // Try to delete topic, we may had an previous error causing inconsistency - if ($post_mode == 'delete_topic') + phpbb_visibility::set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id)); + phpbb_visibility::hide_post($forum_id, time(), $sql_data); + } + else + { + if (!delete_posts('post_id', array($post_id), false, false)) { - delete_topics('topic_id', array($topic_id), false); + // Try to delete topic, we may had an previous error causing inconsistency + if ($post_mode == 'delete_topic') + { + delete_topics('topic_id', array($topic_id), false); + } + trigger_error('ALREADY_DELETED'); } - trigger_error('ALREADY_DELETED'); } $db->sql_transaction('commit'); @@ -1486,17 +1498,31 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) update_post_information('forum', $updated_forum); } - delete_topics('topic_id', array($topic_id), false); - - $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1'; - $sql_data[FORUMS_TABLE] .= ($data['topic_visibility'] == ITEM_APPROVED) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : ''; - - $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if ($is_soft) { - $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; - $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + $topic_row = array(); + phpbb_visibility::set_topic_visibility(POST_DELETED, $topic_id, $forum_id); + phpbb_visibility::hide_topic($topic_id, $forum_id, $topic_row, $sql_data); } + else + { + delete_topics('topic_id', array($topic_id), false); + + + if ($data['topic_type'] != POST_GLOBAL) + { + $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1'; + $sql_data[FORUMS_TABLE] .= ($data['topic_visibility'] == ITEM_APPROVED) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : ''; + } + + $update_sql = update_post_information('forum', $forum_id, true); + if (sizeof($update_sql)) + { + $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; + $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + } + } + break; case 'delete_first_post': @@ -1520,19 +1546,27 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) break; case 'delete_last_post': - $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : ''; - - $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if ($is_soft) { - $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; - $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + phpbb_visibility::hide_post($forum_id, time(), $sql_data); + phpbb_visibility::set_post_visibility($post_id, $topic_id, $forum_id, false, true); + } + else + { + $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : ''; + + $update_sql = update_post_information('forum', $forum_id, true); + if (sizeof($update_sql)) + { + $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; + $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + } + + $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : ''); } - $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : ''); - $update_sql = update_post_information('topic', $topic_id, true); - if (sizeof($update_sql)) + if (sizeof($update_sql) && !$is_soft) { $sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]); $next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]); @@ -1702,7 +1736,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Mods are able to force approved/unapproved posts. True means the post is approved, false the post is unapproved if (isset($data['force_approved_state'])) { - $post_approval = ($data['force_approved_state']) ? 1 : 0; + $post_approval = ($data['force_approved_state']) ? ITEM_APPROVED : ITEM_UNAPPROVED; } // Start the transaction here @@ -1915,32 +1949,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved if (!$post_approval && $data['topic_visibility'] == ITEM_APPROVED) { - // Do we need to grab some topic informations? - if (!sizeof($topic_row)) - { - $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_visibility - FROM ' . TOPICS_TABLE . ' - WHERE topic_id = ' . $data['topic_id']; - $result = $db->sql_query($sql); - $topic_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - } - - // If this is the only post remaining we do not need to decrement topic_replies. - // Also do not decrement if first post - then the topic_replies will not be adjusted if approving the topic again. - - // If this is an edited topic or the first post the topic gets completely disapproved later on... - $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1'; - $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1); - - set_config_count('num_topics', -1, true); - set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true); - - // Only decrement this post, since this is the one non-approved now - if ($auth->acl_get('f_postcount', $data['forum_id'])) - { - $sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1'; - } + phpbb_visibility::hide_topic($data['topic_id'], $data['forum_id'], $topic_row, $sql_data); } break; @@ -1951,6 +1960,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Correctly set back the topic replies and forum posts... but only if the post was approved before. if (!$post_approval && $data['post_visibility'] == ITEM_APPROVED) { + //phpbb_visibility::hide_post($forum_id, $current_time, $sql_data); + // ^^ hide_post SQL is identical, except that it does not include the ['stat'] sub-array $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1'; @@ -1960,6 +1971,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { $sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1'; } + } break; diff --git a/phpBB/includes/mcp/info/mcp_queue.php b/phpBB/includes/mcp/info/mcp_queue.php index 7ad79f9781..31e9cc9af6 100644 --- a/phpBB/includes/mcp/info/mcp_queue.php +++ b/phpBB/includes/mcp/info/mcp_queue.php @@ -21,6 +21,7 @@ class mcp_queue_info 'modes' => array( 'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')), 'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')), + 'deleted_posts' => array('title' => 'MCP_QUEUE_DELETED_POSTS', 'auth' => 'aclf_m_restore', 'cat' => array('MCP_QUEUE')), 'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'acl_m_approve,$id || (!$id && aclf_m_approve)', 'cat' => array('MCP_QUEUE')), ), ); diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 833f924efc..c19fb9b2b6 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -46,6 +46,7 @@ class mcp_queue { case 'approve': case 'disapprove': + case 'restore': include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $post_id_list = request_var('post_id_list', array(0)); @@ -59,6 +60,10 @@ class mcp_queue { approve_post($post_id_list, 'queue', $mode); } + else if ($action == 'restore') + { +// do something + } else { disapprove_post($post_id_list, 'queue', $mode); @@ -224,6 +229,16 @@ class mcp_queue case 'unapproved_topics': case 'unapproved_posts': + case 'deleted_posts': + if ($mode == 'deleted_posts') + { + $m_perm = 'm_restore'; + } + else + { + $m_perm = 'm_approve'; + } + $user->add_lang(array('viewtopic', 'viewforum')); $topic_id = request_var('t', 0); @@ -242,7 +257,7 @@ class mcp_queue $forum_id = $topic_info['forum_id']; } - $forum_list_approve = get_forum_list('m_approve', false, true); + $forum_list_approve = get_forum_list($m_perm, false, true); $forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs // Remove forums we cannot read @@ -277,7 +292,7 @@ class mcp_queue } else { - $forum_info = get_forum_data(array($forum_id), 'm_approve'); + $forum_info = get_forum_data(array($forum_id), $m_perm); if (!sizeof($forum_info)) { @@ -304,8 +319,10 @@ class mcp_queue $forum_names = array(); - if ($mode == 'unapproved_posts') + if ($mode == 'unapproved_posts' || $mode == 'deleted_posts') { + $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED; + $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . ' WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . ' @@ -425,13 +442,14 @@ class mcp_queue // Now display the page $template->assign_vars(array( 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], - 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], - 'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], + 'L_EXPLAIN' => $user->lang['MCP_QUEUE_' . strtoupper($mode) . '_EXPLAIN'], + 'L_TITLE' => $user->lang['MCP_QUEUE_' . strtoupper($mode)], 'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), - 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true, + 'S_TOPICS' => ($mode == 'unapproved_topics') ? true : false, + 'S_RESTORE' => ($mode == 'deleted_posts') ? true : false, 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, @@ -475,127 +493,7 @@ function approve_post($post_id_list, $id, $mode) { $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false; - // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1 - // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 - - $total_topics = $total_posts = 0; - $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); - $user_posts_sql = $post_approved_list = array(); - - foreach ($post_info as $post_id => $post_data) - { - if ($post_data['post_visibility'] == ITEM_APPROVED) - { - $post_approved_list[] = $post_id; - continue; - } - - $topic_id_list[$post_data['topic_id']] = 1; - $forum_id_list[$post_data['forum_id']] = 1; - - // User post update (we do not care about topic or post, since user posts are strictly connected to posts) - // But we care about forums where post counts get not increased. ;) - if ($post_data['post_postcount']) - { - $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1; - } - - // Topic or Post. ;) - if ($post_data['topic_first_post_id'] == $post_id) - { - $total_topics++; - $topic_approve_sql[] = $post_data['topic_id']; - - $approve_log[] = array( - 'type' => 'topic', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => $post_data['topic_id'], - ); - } - else - { - $approve_log[] = array( - 'type' => 'post', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => $post_data['topic_id'], - ); - } - - $total_posts++; - - // Increment by topic_replies if we approve a topic... - // This works because we do not adjust the topic_replies when re-approving a topic after an edit. - if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies']) - { - $total_posts += $post_data['topic_replies']; - } - - $post_approve_sql[] = $post_id; - } - - $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); - for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) - { - unset($post_info[$post_approved_list[$i]]); - } - - if (sizeof($topic_approve_sql)) - { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_visibility = ' . ITEM_APPROVED . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); - $db->sql_query($sql); - } - - if (sizeof($post_approve_sql)) - { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_visibility = ' . ITEM_APPROVED . ' - WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); - $db->sql_query($sql); - } - - unset($topic_approve_sql, $post_approve_sql); - - foreach ($approve_log as $log_data) - { - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']); - } - - if (sizeof($user_posts_sql)) - { - // Try to minimize the query count by merging users with the same post count additions - $user_posts_update = array(); - - foreach ($user_posts_sql as $user_id => $user_posts) - { - $user_posts_update[$user_posts][] = $user_id; - } - - foreach ($user_posts_update as $user_posts => $user_id_ary) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_posts = user_posts + ' . $user_posts . ' - WHERE ' . $db->sql_in_set('user_id', $user_id_ary); - $db->sql_query($sql); - } - } - - if ($total_topics) - { - set_config_count('num_topics', $total_topics, true); - } - - if ($total_posts) - { - set_config_count('num_posts', $total_posts, true); - } - - sync('topic', 'topic_id', array_keys($topic_id_list), true); - sync('forum', 'forum_id', array_keys($forum_id_list), true, true); - unset($topic_id_list, $forum_id_list); + phpbb_visibility::unhide_posts_topics('approve', $post_info, $post_id_list); $messenger = new messenger(); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 938b11388b..e70e3db4d4 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -315,6 +315,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_restore', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_softdelete', 1); # -- Moderator related auth options INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1); @@ -329,6 +330,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_restore', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_softdelete', 1, 1); # -- Global moderator auth option (not a local option) INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1); @@ -513,7 +515,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter'); # Simple Moderator (m_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_edit', 'm_info', 'm_report'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_restore', 'm_edit', 'm_info', 'm_report'); # Queue Moderator (m_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit'); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 04df897dba..91a35311bc 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -554,12 +554,14 @@ $lang = array_merge($lang, array( 'LOG_POST_APPROVED' => 'Approved post
      » %s', 'LOG_POST_DISAPPROVED' => 'Disapproved post “%1$s” with the following reason
      » %2$s', 'LOG_POST_EDITED' => 'Edited post “%1$s” written by
      » %2$s', + 'LOG_POST_RESTORED' => 'Restored post
      » %s', 'LOG_REPORT_CLOSED' => 'Closed report
      » %s', 'LOG_REPORT_DELETED' => 'Deleted report
      » %s', 'LOG_SPLIT_DESTINATION' => 'Moved split posts
      » to %s', 'LOG_SPLIT_SOURCE' => 'Split posts
      » from %s', 'LOG_TOPIC_APPROVED' => 'Approved topic
      » %s', + 'LOG_TOPIC_RESTORED' => 'Restored topic
      » %s', 'LOG_TOPIC_DISAPPROVED' => 'Disapproved topic “%1$s” with the following reason
      %2$s', 'LOG_TOPIC_RESYNC' => 'Resynchronised topic counters
      » %s', 'LOG_TOPIC_TYPE_CHANGED' => 'Changed topic type
      » %s', diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 17649693fa..0a089f9dc1 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -156,6 +156,8 @@ $lang = array_merge($lang, array( 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'actions'), + 'acl_f_softdelete' => array('lang' => 'Can soft delete own posts', 'cat' => 'actions'), + 'acl_f_restore' => array('lang' => 'Can restore own posts', 'cat' => 'actions'), 'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'actions'), 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'), 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'), @@ -177,12 +179,15 @@ $lang = array_merge($lang, array( 'acl_m_approve' => array('lang' => 'Can approve posts', 'cat' => 'post_actions'), 'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'), 'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'), + 'acl_m_softdelete' => array('lang' => 'Can soft delete posts', 'cat' => 'post_actions'), + 'acl_m_restore' => array('lang' => 'Can restore deleted posts', 'cat' => 'post_actions'), 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'), 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'), 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'), 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), + 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), 'acl_m_warn' => array('lang' => 'Can issue warnings
      This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) 'acl_m_ban' => array('lang' => 'Can manage bans
      This setting is only assigned globally. It is not forum based.', 'cat' => 'misc'), // This moderator setting is only global (and not local) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index eaa2d7e3a5..175fa72829 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -201,6 +201,8 @@ $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 posts which have been soft deleted. You can restore or permanently delete the posts from this screen.', 'MCP_VIEW_USER' => 'View warnings for a specific user', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 086bd6ffb0..c0edc068dd 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -209,6 +209,8 @@ $lang = array_merge($lang, array( 'SMILIES' => 'Smilies', 'SMILIES_ARE_OFF' => 'Smilies are OFF', 'SMILIES_ARE_ON' => 'Smilies are ON', + 'SOFT_DELETE_POST' => 'Soft Delete', + 'SOFT_DELETE_POST_EXPLAIN' => 'Soft Deletion can be un-done', 'STICKY_ANNOUNCE_TIME_LIMIT'=> 'Sticky/Announcement time limit', 'STICK_TOPIC_FOR' => 'Stick topic for', 'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 or leave blank for a never ending Sticky/Announcement. Please note that this number is relative to the date of the post.', diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 278c064fe7..ce66a5b8e2 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -89,6 +89,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 +97,7 @@ $lang = array_merge($lang, array( 'QUOTE' => 'Quote', 'REPLY_TO_TOPIC' => 'Reply to topic', + 'RESTORE' => 'Restore', 'RETURN_POST' => '%sReturn to the post%s', 'SUBMIT_VOTE' => 'Submit vote', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 984925789f..9877c469b9 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -640,6 +640,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, 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,7 +650,7 @@ 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_visibility = ' . ITEM_UNAPPROVED . ' + AND p.post_visibility = ' . $visibility_const . ' AND t.topic_id = p.topic_id AND t.topic_first_post_id <> p.post_id'; @@ -796,7 +798,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_posts')) || $where_sql != 'WHERE') { $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); diff --git a/phpBB/posting.php b/phpBB/posting.php index 30b897c068..221d469b4a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -38,8 +38,20 @@ $load = (isset($_POST['load'])) ? true : false; $delete = (isset($_POST['delete'])) ? true : false; $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; -$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview) ? true : false; -$mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', ''); +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview); +$mode = request_var('mode', ''); + +if ($submit && !$refresh) +{ + if (isset($_POST['soft_delete'])) + { + $mode = 'soft_delete'; + } + else if (isset($_POST['delete'])) + { + $mode = 'delete'; + } +} $error = $post_data = array(); $current_time = time(); @@ -93,6 +105,7 @@ switch ($mode) case 'quote': case 'edit': case 'delete': + case 'soft_delete': if (!$post_id) { $user->setup('posting'); @@ -168,6 +181,13 @@ if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'b trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED'); } +if ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && phpbb_visibility::can_restore($forum_id, $post_data['poster_id'], $post_data['post_edit_locked'])) +{ + // don't feel that a confirm_box is needed for this + // do not return / trigger_error after this because the post content can also be changed + phpbb_visibility::unhide_posts_topics('restore', array($post_id => $post_data), array($post_id)); +} + if ($mode == 'popup') { upload_popup($post_data['forum_style']); @@ -259,6 +279,13 @@ switch ($mode) $is_authed = true; } break; + + case 'soft_delete': + if ($user->data['is_registered'] && $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id)) + { + $is_authed = true; + } + break; } if (!$is_authed) @@ -306,9 +333,9 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) } // Handle delete mode... -if ($mode == 'delete') +if ($mode == 'delete' || $mode == 'soft_delete') { - handle_post_delete($forum_id, $topic_id, $post_id, $post_data); + handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete')); return; } @@ -1401,6 +1428,10 @@ $template->assign_vars(array( 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', + 'S_SOFT_DELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '', + 'S_SOFT_DELETE_ALLOWED' => (phpbb_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, + 'S_RESTORE_ALLOWED' => (phpbb_visibility::can_restore($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, + 'S_IS_DELETED' => ($post_data['post_visibility'] == POST_DELETED) ? true : false, 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, @@ -1494,19 +1525,21 @@ function upload_popup($forum_style = 0) /** * Do the various checks required for removing posts as well as removing it */ -function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) +function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft) { global $user, $db, $auth, $config; global $phpbb_root_path, $phpEx; + $perm_check = ($is_soft) ? 'softdelete' : 'delete'; + // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) + if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) { $s_hidden_fields = build_hidden_fields(array( 'p' => $post_id, 'f' => $forum_id, - 'mode' => 'delete') - ); + 'mode' => ($is_soft) ? 'soft_delete' : 'delete', + )); if (confirm_box(true)) { @@ -1523,7 +1556,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) 'post_postcount' => $post_data['post_postcount'] ); - $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data); + $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft); $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; if ($next_post_id === false) diff --git a/phpBB/styles/prosilver/imageset/icon_topic_deleted.png b/phpBB/styles/prosilver/imageset/icon_topic_deleted.png new file mode 100644 index 0000000000000000000000000000000000000000..e5359030f300ba8aeba1721d73a9508085e0cd7b GIT binary patch literal 964 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl=OKpFe+g9XuVAkUn?jtWzh?-F^5ZC?wp) z#r^fS?;Ca=OfRZjwSLR%SFe_=*>d;(qqA3U?mKv>r+3oR$B(z~+|}3H`}p~*qN1vU z$Br#nv~2U1EyquuT(WLQa&pG{jhm01x-@C>)SbHzhR3DcxpjBbrcF0*+{n$zJ9P5= zp1pe;n_5ycvaj8|d-m+v!-o%V*>!m9*6mw1Z<@D!RaIs6kt4@;>^Zb+@BW>;cDeh9 zPM@*x#=ZO7cWke(uiwA-(3FXNFQ30ScjnabqleF4xbXM?|Jtg$<;z#D+i~c~x$6^V z&hMKr?c({1`%j#o)ZcgL*yRfs&bPJqSlBuj6&4>je!9H8IzBe`NKe01NDqe~VoS-Ncbty{PM|NrmBz*7K>u!fQ# zzhEGDAOV8~t9LpuUD$cLIEGZ*O1hA~b;Fh|+tV&x;tJ?3=6}k{p}?kWeRI;55;gbh zEi%U@OsQ~fU`R?3HoQ9Vapy+v@HM<0-H!~JI278H&Q|z0Ua6VAho|zVl-t`Bpt1?i z1r1WxdWRK%*0>y=y3q@$jLlPAHY`6gHq!AJlj6E0c2AJ9Dcm0uLr;YUCVG}ky^!{R z0jP{myk0t9(M@==hyBb`9IW7u6sfLW zs>iE+xC*FjMYut5i4Kp^xzf-{0>vLz0hP7=@~M+uyUIX2IWTbL0iSbVW#-S*gF8gI z`L=CMy*}Z=3Xrm@Fu}yay5|{b&oc4~xBUVud;UcKIU7@2x^12DYlz7DaB)LpQI3L5 jD<(gAuy#E=hXKPJN6U2<5(@pmSY_~Z^>bP0l+XkKyf!Oh literal 0 HcmV?d00001 diff --git a/phpBB/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg new file mode 100644 index 0000000000..bfcf357045 --- /dev/null +++ b/phpBB/styles/prosilver/imageset/imageset.cfg @@ -0,0 +1,117 @@ +# +# phpBB Imageset Configuration File +# +# @package phpBB3 +# @copyright (c) 2006 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# +# +# At the left is the name, please do not change this +# At the right the value is entered +# For on/off options the valid values are on, off, 1, 0, true and false +# +# Values get trimmed, if you want to add a space in front or at the end of +# the value, then enclose the value with single or double quotes. +# Single and double quotes do not need to be escaped. +# +# + +# General Information about this style +name = prosilver +copyright = © phpBB Group, 2007 +version = 3.0.7 + +# Images +img_site_logo = site_logo.gif*52*139 +img_poll_left = +img_poll_center = +img_poll_right = +img_icon_friend = +img_icon_foe = + +img_forum_link = forum_link.gif*27*27 +img_forum_read = forum_read.gif*27*27 +img_forum_read_locked = forum_read_locked.gif*27*27 +img_forum_read_subforum = forum_read_subforum.gif*27*27 +img_forum_unread = forum_unread.gif*27*27 +img_forum_unread_locked = forum_unread_locked.gif*27*27 +img_forum_unread_subforum = forum_unread_subforum.gif*27*27 + +img_topic_moved = topic_moved.gif*27*27 + +img_topic_read = topic_read.gif*27*27 +img_topic_read_mine = topic_read_mine.gif*27*27 +img_topic_read_hot = topic_read_hot.gif*27*27 +img_topic_read_hot_mine = topic_read_hot_mine.gif*27*27 +img_topic_read_locked = topic_read_locked.gif*27*27 +img_topic_read_locked_mine = topic_read_locked_mine.gif*27*27 + +img_topic_unread = topic_unread.gif*27*27 +img_topic_unread_mine = topic_unread_mine.gif*27*27 +img_topic_unread_hot = topic_unread_hot.gif*27*27 +img_topic_unread_hot_mine = topic_unread_hot_mine.gif*27*27 +img_topic_unread_locked = topic_unread_locked.gif*27*27 +img_topic_unread_locked_mine = topic_unread_locked_mine.gif*27*27 + +img_sticky_read = sticky_read.gif*27*27 +img_sticky_read_mine = sticky_read_mine.gif*27*27 +img_sticky_read_locked = sticky_read_locked.gif*27*27 +img_sticky_read_locked_mine = sticky_read_locked_mine.gif*27*27 +img_sticky_unread = sticky_unread.gif*27*27 +img_sticky_unread_mine = sticky_unread_mine.gif*27*27 +img_sticky_unread_locked = sticky_unread_locked.gif*27*27 +img_sticky_unread_locked_mine = sticky_unread_locked_mine.gif*27*27 + +img_announce_read = announce_read.gif*27*27 +img_announce_read_mine = announce_read_mine.gif*27*27 +img_announce_read_locked = announce_read_locked.gif*27*27 +img_announce_read_locked_mine = announce_read_locked_mine.gif*27*27 +img_announce_unread = announce_unread.gif*27*27 +img_announce_unread_mine = announce_unread_mine.gif*27*27 +img_announce_unread_locked = announce_unread_locked.gif*27*27 +img_announce_unread_locked_mine = announce_unread_locked_mine.gif*27*27 + +img_global_read = announce_read.gif*27*27 +img_global_read_mine = announce_read_mine.gif*27*27 +img_global_read_locked = announce_read_locked.gif*27*27 +img_global_read_locked_mine = announce_read_locked_mine.gif*27*27 +img_global_unread = announce_unread.gif*27*27 +img_global_unread_mine = announce_unread_mine.gif*27*27 +img_global_unread_locked = announce_unread_locked.gif*27*27 +img_global_unread_locked_mine = announce_unread_locked_mine.gif*27*27 + +img_subforum_read = subforum_read.gif*9*11 +img_subforum_unread = subforum_unread.gif*9*11 + +img_pm_read = topic_read.gif*27*27 +img_pm_unread = topic_unread.gif*27*27 + +img_icon_back_top = icon_back_top.gif*11*11 + +img_icon_contact_aim = icon_contact_aim.gif*20*20 +img_icon_contact_email = icon_contact_email.gif*20*20 +img_icon_contact_icq = icon_contact_icq.gif*20*20 +img_icon_contact_jabber = icon_contact_jabber.gif*20*20 +img_icon_contact_msnm = icon_contact_msnm.gif*20*20 + +img_icon_contact_www = icon_contact_www.gif*20*20 +img_icon_contact_yahoo = icon_contact_yahoo.gif*20*20 + +img_icon_post_delete = icon_post_delete.gif*20*20 + +img_icon_post_info = icon_post_info.gif*20*20 + +img_icon_post_report = icon_post_report.gif*20*20 +img_icon_post_target = icon_post_target.gif*9*11 +img_icon_post_target_unread = icon_post_target_unread.gif*9*11 + +img_icon_topic_attach = icon_topic_attach.gif*10*7 +img_icon_topic_latest = icon_topic_latest.gif*9*11 +img_icon_topic_newest = icon_topic_newest.gif*9*11 +img_icon_topic_reported = icon_topic_reported.gif*14*16 +img_icon_topic_unapproved = icon_topic_unapproved.gif*14*16 +img_icon_topic_deleted = icon_topic_deleted.png*16*16 + +img_icon_user_profile = + +img_icon_user_warn = icon_user_warn.gif*20*20 diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 93483ae02a..4b48674673 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -94,8 +94,13 @@
      + +   + +   +
      diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 99e518d486..f8fccf2d2f 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -83,6 +83,13 @@ + +
      +
      +
      +
      + +
      diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 373a172918..7f3703eabb 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -144,7 +144,7 @@
      style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">{NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} - {REPORTED_IMG}
      + {REPORTED_IMG}{topicrow.DELETED_IMG}
      From eafd0ae29f649213cf71b7575131b7f5555c4e67 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 10 Jun 2013 23:52:41 +0530 Subject: [PATCH 339/575] [ticket/11566] add error functionality add $error which stores the captcha error when captcha validation fails PHPBB3-11566 --- phpBB/report.php | 149 ++++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index 06fc086d4d..7f6cd4a792 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -140,90 +140,101 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered']) $captcha->init(CONFIRM_POST); } +$error = array(); + // Submit report? if ($submit && $reason_id) { - $sql = 'SELECT * - FROM ' . REPORTS_REASONS_TABLE . " - WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other')) + $vc_response = $captcha->validate(); + if ($vc_response) { - trigger_error('EMPTY_REPORT'); + $error[] = $vc_response; } - $sql_ary = array( - 'reason_id' => (int) $reason_id, - 'post_id' => $post_id, - 'pm_id' => $pm_id, - 'user_id' => (int) $user->data['user_id'], - 'user_notify' => (int) $user_notify, - 'report_closed' => 0, - 'report_time' => (int) time(), - 'report_text' => (string) $report_text - ); - - $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); - $report_id = $db->sql_nextid(); - - if ($post_id) + if (!sizeof($error)) { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_reported = 1 - WHERE post_id = ' . $post_id; - $db->sql_query($sql); + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$report_data['topic_reported']) + if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other')) { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_reported = 1 - WHERE topic_id = ' . $report_data['topic_id'] . ' - OR topic_moved_id = ' . $report_data['topic_id']; - $db->sql_query($sql); + trigger_error('EMPTY_REPORT'); } - $lang_return = $user->lang['RETURN_TOPIC']; - $lang_success = $user->lang['POST_REPORTED_SUCCESS']; - } - else - { - $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_reported = 1 - WHERE msg_id = ' . $pm_id; - $db->sql_query($sql); - $sql_ary = array( - 'msg_id' => $pm_id, - 'user_id' => ANONYMOUS, - 'author_id' => (int) $report_data['author_id'], - 'pm_deleted' => 0, - 'pm_new' => 0, - 'pm_unread' => 0, - 'pm_replied' => 0, - 'pm_marked' => 0, - 'pm_forwarded' => 0, - 'folder_id' => PRIVMSGS_INBOX, + 'reason_id' => (int) $reason_id, + 'post_id' => $post_id, + 'pm_id' => $pm_id, + 'user_id' => (int) $user->data['user_id'], + 'user_notify' => (int) $user_notify, + 'report_closed' => 0, + 'report_time' => (int) time(), + 'report_text' => (string) $report_text ); - $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); + $report_id = $db->sql_nextid(); - $lang_return = $user->lang['RETURN_PM']; - $lang_success = $user->lang['PM_REPORTED_SUCCESS']; + if ($post_id) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 1 + WHERE post_id = ' . $post_id; + $db->sql_query($sql); + + if (!$report_data['topic_reported']) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 1 + WHERE topic_id = ' . $report_data['topic_id'] . ' + OR topic_moved_id = ' . $report_data['topic_id']; + $db->sql_query($sql); + } + + $lang_return = $user->lang['RETURN_TOPIC']; + $lang_success = $user->lang['POST_REPORTED_SUCCESS']; + } + else + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_reported = 1 + WHERE msg_id = ' . $pm_id; + $db->sql_query($sql); + + $sql_ary = array( + 'msg_id' => $pm_id, + 'user_id' => ANONYMOUS, + 'author_id' => (int) $report_data['author_id'], + 'pm_deleted' => 0, + 'pm_new' => 0, + 'pm_unread' => 0, + 'pm_replied' => 0, + 'pm_marked' => 0, + 'pm_forwarded' => 0, + 'folder_id' => PRIVMSGS_INBOX, + ); + + $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $lang_return = $user->lang['RETURN_PM']; + $lang_success = $user->lang['PM_REPORTED_SUCCESS']; + } + + meta_refresh(3, $redirect_url); + + $message = $lang_success . '

      ' . sprintf($lang_return, '
      ', ''); + if ($return_forum_url) + { + $message .= '

      ' . sprintf($user->lang['RETURN_FORUM'], '', ''); + } + trigger_error($message); } - - meta_refresh(3, $redirect_url); - - $message = $lang_success . '

      ' . sprintf($lang_return, '', ''); - if ($return_forum_url) - { - $message .= '

      ' . sprintf($user->lang['RETURN_FORUM'], '', ''); - } - trigger_error($message); } // Generate the reasons @@ -231,14 +242,16 @@ display_reasons($reason_id); $page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST']; -if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false)) +if ((isset($captcha) && $captcha->is_solved() === false)) { $template->assign_vars(array( + 'S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template(), )); } $template->assign_vars(array( + 'ERROR' => (sizeof($error)) ? implode('
      ', $error) : '', 'S_REPORT_POST' => ($pm_id) ? false : true, 'REPORT_TEXT' => $report_text, 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id . '&pm=' . $pm_id), From 7c9a1cbca9719eccbee11db418cb4e531f539a0c Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 10 Jun 2013 23:53:33 +0530 Subject: [PATCH 340/575] [ticket/11566] add error in template Check if error exists, then display it in the report post template. PHPBB3-11566 --- phpBB/styles/prosilver/template/report_body.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/template/report_body.html b/phpBB/styles/prosilver/template/report_body.html index 8bf639791b..2d6a857afb 100644 --- a/phpBB/styles/prosilver/template/report_body.html +++ b/phpBB/styles/prosilver/template/report_body.html @@ -10,6 +10,7 @@

      {L_REPORT_POST_EXPLAIN}{L_REPORT_MESSAGE_EXPLAIN}

      +
      {ERROR}
      From 2c240f8a7b36feab129336b7e36273cdb9798364 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 11 Jun 2013 00:09:14 +0530 Subject: [PATCH 341/575] [ticket/11566] display error instead of trigger_error When the error report is empty display error in the template instead of trigger_error PHPBB3-11566 --- phpBB/report.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index 7f6cd4a792..1ae0abcdc2 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -151,20 +151,20 @@ if ($submit && $reason_id) $error[] = $vc_response; } + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other')) + { + $error[] = $user->lang('EMPTY_REPORT'); + } + if (!sizeof($error)) { - $sql = 'SELECT * - FROM ' . REPORTS_REASONS_TABLE . " - WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other')) - { - trigger_error('EMPTY_REPORT'); - } - $sql_ary = array( 'reason_id' => (int) $reason_id, 'post_id' => $post_id, From c4fbed251db058d808823d2700c441383edc3e63 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 11 Jun 2013 00:20:26 +0530 Subject: [PATCH 342/575] [ticket/11566] add captcha reset and hidden fields If captcha is solved and some other error pops up, store the captcha in a hidden field. Reset captcha if reporting the post is successful PHPBB3-11566 --- phpBB/report.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpBB/report.php b/phpBB/report.php index 1ae0abcdc2..b876b5c94f 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -141,6 +141,7 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered']) } $error = array(); +$s_hidden_fields = ''; // Submit report? if ($submit && $reason_id) @@ -165,6 +166,11 @@ if ($submit && $reason_id) if (!sizeof($error)) { + if (isset($captcha)) + { + $captcha->reset(); + } + $sql_ary = array( 'reason_id' => (int) $reason_id, 'post_id' => $post_id, @@ -235,6 +241,10 @@ if ($submit && $reason_id) } trigger_error($message); } + else if (isset($captcha) && $captcha->is_solved() !== false) + { + $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); + } } // Generate the reasons @@ -255,6 +265,7 @@ $template->assign_vars(array( 'S_REPORT_POST' => ($pm_id) ? false : true, 'REPORT_TEXT' => $report_text, 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id . '&pm=' . $pm_id), + 'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null, 'S_NOTIFY' => $user_notify, 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) From 43053c541ac0f998a3925b7277cfb77f1ceafb11 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 12 Jun 2013 01:45:07 +0530 Subject: [PATCH 343/575] [ticket/11566] add tests for reporting post Functional test for reporting post and check if captcha validation is required for guests and not for registerted users PHPBB3-11566 --- tests/functional/report_post_captcha.php | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/functional/report_post_captcha.php diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php new file mode 100644 index 0000000000..6b112c3538 --- /dev/null +++ b/tests/functional/report_post_captcha.php @@ -0,0 +1,55 @@ +login(); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + } + + public function test_guest_report_post() + { + $this->enable_reporting_guest(); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + } + + protected function enable_reporting_guest() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid); + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values["group_id[0]"] = 1; + $form->setValues($values); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values["forum_id"] = 2; + $form->setValues($values); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Apply all permissions')->form(); + $values = $form->getValues(); + $values["setting[1][2][f_report]"] = 1; + $form->setValues($values); + $crawler = self::submit($form); + + $crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid); + } +} From 1abc3d91d05919f20b31876dbafbb8edec83d724 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 12 Jun 2013 02:00:24 +0530 Subject: [PATCH 344/575] [ticket/11566] Use language variable instead of hardcode Add language variable in tests PHPBB3-11566 --- tests/functional/report_post_captcha.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php index 6b112c3538..e0a67ab6fa 100644 --- a/tests/functional/report_post_captcha.php +++ b/tests/functional/report_post_captcha.php @@ -44,7 +44,8 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca $form->setValues($values); $crawler = self::submit($form); - $form = $crawler->selectButton('Apply all permissions')->form(); + $this->add_lang('acp/permissions'); + $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form(); $values = $form->getValues(); $values["setting[1][2][f_report]"] = 1; $form->setValues($values); From 434d14e1d5c2341584c9d5cfd93840f3eb1a6941 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 12 Jun 2013 20:00:51 +0530 Subject: [PATCH 345/575] [ticket/11566] Revert forum permission changes Revert the f_report permission for guests in the functional tests PHPBB3-11566 --- tests/functional/report_post_captcha.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php index e0a67ab6fa..0585be1332 100644 --- a/tests/functional/report_post_captcha.php +++ b/tests/functional/report_post_captcha.php @@ -21,12 +21,13 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca public function test_guest_report_post() { - $this->enable_reporting_guest(); + $this->set_reporting_guest(1); $crawler = self::request('GET', 'report.php?f=2&p=1'); $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + $this->set_reporting_guest(-1); } - protected function enable_reporting_guest() + protected function set_reporting_guest($report_post_allowed) { $this->login(); $this->admin_login(); @@ -47,7 +48,7 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca $this->add_lang('acp/permissions'); $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form(); $values = $form->getValues(); - $values["setting[1][2][f_report]"] = 1; + $values["setting[1][2][f_report]"] = $report_post_allowed; $form->setValues($values); $crawler = self::submit($form); From 88b5180aa11ba90f37d598737bb46a054382042f Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 22 Jun 2013 03:54:21 +0530 Subject: [PATCH 346/575] [ticket/11566] Rename var to $visual_confirmation_response PHPBB3-11566 --- phpBB/report.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index b876b5c94f..4fecaf4046 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -146,10 +146,10 @@ $s_hidden_fields = ''; // Submit report? if ($submit && $reason_id) { - $vc_response = $captcha->validate(); - if ($vc_response) + $visual_confirmation_response = $captcha->validate(); + if ($visual_confirmation_response) { - $error[] = $vc_response; + $error[] = $visual_confirmation_response; } $sql = 'SELECT * From 4ad1d9aa6530ebe1d554909a978b9ee124377625 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 22 Jun 2013 04:07:21 +0530 Subject: [PATCH 347/575] [ticket/11566] Use the new constant CONFIRM_REPORT for captcha init PHPBB3-11566 --- phpBB/includes/constants.php | 1 + phpBB/report.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 17c25ee3c6..ad5b43bc9a 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -157,6 +157,7 @@ define('PHYSICAL_LINK', 2); define('CONFIRM_REG', 1); define('CONFIRM_LOGIN', 2); define('CONFIRM_POST', 3); +define('CONFIRM_REPORT', 4); // Categories - Attachments define('ATTACHMENT_CATEGORY_NONE', 0); diff --git a/phpBB/report.php b/phpBB/report.php index 4fecaf4046..f89a18fa8e 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -137,7 +137,7 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered']) { include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_POST); + $captcha->init(CONFIRM_REPORT); } $error = array(); From ea8a4abe66b7142fd8b16dc9732bac181031875a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 23 Jun 2013 21:47:42 +0530 Subject: [PATCH 348/575] [ticket/11566] Add captcha to report post template in subsilver PHPBB3-11566 --- phpBB/styles/subsilver2/template/report_body.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/styles/subsilver2/template/report_body.html b/phpBB/styles/subsilver2/template/report_body.html index 7cd7d1040f..1653875799 100644 --- a/phpBB/styles/subsilver2/template/report_body.html +++ b/phpBB/styles/subsilver2/template/report_body.html @@ -3,6 +3,11 @@ + + + + + @@ -25,6 +30,9 @@ + + + From 84ec1f542365d38763b099e0cb9dcc78cc341258 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 1 Jul 2013 01:34:21 +0530 Subject: [PATCH 349/575] [ticket/11566] Check that guest doesn't have reporting permission by default PHPBB3-11566 --- tests/functional/report_post_captcha.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php index 0585be1332..af713775c5 100644 --- a/tests/functional/report_post_captcha.php +++ b/tests/functional/report_post_captcha.php @@ -21,6 +21,10 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca public function test_guest_report_post() { + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->add_lang('mcp'); + $this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text()); + $this->set_reporting_guest(1); $crawler = self::request('GET', 'report.php?f=2&p=1'); $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); From d4645575fdf0b787721fb8c8a240d2bd01e784f2 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 1 Jul 2013 15:23:45 +0530 Subject: [PATCH 350/575] [ticket/11566] Remove extra pair of brackets from conditional statement PHPBB3-11566 --- phpBB/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/report.php b/phpBB/report.php index f89a18fa8e..c92ecdfdcc 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -252,7 +252,7 @@ display_reasons($reason_id); $page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST']; -if ((isset($captcha) && $captcha->is_solved() === false)) +if (isset($captcha) && $captcha->is_solved() === false) { $template->assign_vars(array( 'S_CONFIRM_CODE' => true, From 045e04fb6fa55ae96ba82245010a684cd2d61e5d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 1 Jul 2013 21:52:04 +0530 Subject: [PATCH 351/575] [ticket/11566] Subsilver template error displayed after table headers PHPBB3-11561 --- phpBB/styles/subsilver2/template/report_body.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/styles/subsilver2/template/report_body.html b/phpBB/styles/subsilver2/template/report_body.html index 1653875799..57747ffac0 100644 --- a/phpBB/styles/subsilver2/template/report_body.html +++ b/phpBB/styles/subsilver2/template/report_body.html @@ -3,14 +3,14 @@
      {ERROR}
      {L_REPORT_POST}{L_REPORT_MESSAGE}
      {L_MORE_INFO}:
      {L_CAN_LEAVE_BLANK}
       
      - - - - - + + + + + From ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 11:52:03 -0500 Subject: [PATCH 352/575] [feature/twig] A bit of cleanup in twig.php PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 717213ea1f..5fe8ba97f6 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -266,7 +266,7 @@ class phpbb_template_twig implements phpbb_template } $context = &$this->get_template_vars(); - $this->twig->display($this->filenames[$handle], $context); + $this->twig->display($this->get_filename_from_handle($handle), $context); return true; } @@ -324,20 +324,12 @@ class phpbb_template_twig implements phpbb_template */ public function assign_display($handle, $template_var = '', $return_content = true) { - ob_start(); - $result = $this->display($handle); - $contents = ob_get_clean(); - if ($result === false) - { - return false; - } - if ($return_content) { - return $contents; + return $this->twig->render($this->get_filename_from_handle($handle)); } - $this->assign_var($template_var, $contents); + $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle))); return true; } @@ -448,4 +440,15 @@ class phpbb_template_twig implements phpbb_template return $vars; } + + /** + * Get a filename from the handle + * + * @param string $handle + * @return string + */ + protected function get_filename_from_handle($handle) + { + return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle; + } } From 8c75d1c1bc494220bed313e542902cdc22c5336f Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 11:58:16 -0500 Subject: [PATCH 353/575] [feature/twig] Fix template_test.php Various tests were broken completely, and some things such as whitespace changed with Twig PHPBB3-11598 --- tests/template/template_test.php | 87 ++++--------------- tests/template/template_test_case.php | 24 ++--- tests/template/templates/define_unclosed.html | 2 - tests/template/templates/loop_nested.html | 8 +- tests/template/templates/loop_size.html | 2 +- tests/template/templates/loop_underscore.html | 2 +- tests/template/templates/loop_vars.html | 1 - 7 files changed, 38 insertions(+), 88 deletions(-) delete mode 100644 tests/template/templates/define_unclosed.html diff --git a/tests/template/template_test.php b/tests/template/template_test.php index a4748eb0b3..ad4c8fbd17 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -116,7 +116,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), array(), - "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner\ninner loop", + "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", ), array( 'loop_advanced.html', @@ -139,13 +139,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), "abc\nzxc\ncde\nbcd", ), - array( - 'define_unclosed.html', - array(), - array(), - array(), - "test", - ), array( 'expressions.html', array(), @@ -247,21 +240,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array(), array(), - "{ VARIABLE }\n{ 1_VARIABLE }\n{ VARIABLE }\n{ 1_VARIABLE }", + "VARIABLE\n1_VARIABLE\nVARIABLE\n1_VARIABLE", ), array( 'lang.html', - array('L_VARIABLE' => "Value'", 'L_1_VARIABLE' => "1 O'Clock"), + array(), array(), array(), "Value'\n1 O'Clock\nValue\'\n1 O\'Clock", - ), - array( - 'lang.html', - array('LA_VARIABLE' => "Value'", 'LA_1_VARIABLE' => "1 O'Clock"), - array(), - array(), - "{ VARIABLE }\n{ 1_VARIABLE }\nValue'\n1 O'Clock", + array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock"), ), array( 'loop_nested_multilevel_ref.html', @@ -275,7 +262,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('outer' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'outer.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), array(), - // I don't completely understand this output, hopefully it's correct "top-level content\nouter x\nouter y\ninner z\nfirst row\n\ninner zz", ), array( @@ -283,7 +269,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), array(), - // I don't completely understand this output, hopefully it's correct "top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz", ), array( @@ -313,24 +298,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->template->set_filenames(array('test' => $filename)); $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist'); - $expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', $this->test_path . '/templates/' . $filename); - $this->setExpectedTriggerError(E_USER_ERROR, $expecting); + $this->setExpectedException('Twig_Error_Loader'); $this->display('test'); } - public function test_empty_file() - { - $expecting = 'style resource locator: set_filenames: Empty filename specified for test'; - - $this->setExpectedTriggerError(E_USER_ERROR, $expecting); - $this->template->set_filenames(array('test' => '')); - } public function test_invalid_handle() { - $expecting = 'No file specified for handle test'; - $this->setExpectedTriggerError(E_USER_ERROR, $expecting); + $this->setExpectedException('Twig_Error_Loader'); $this->display('test'); } @@ -338,40 +314,23 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @dataProvider template_data */ - public function test_template($file, array $vars, array $block_vars, array $destroy, $expected) + public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array()) { - $this->run_template($file, $vars, $block_vars, $destroy, $expected); + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $lang_vars); } - /** - * @dataProvider template_data - */ - public function test_assign_display($file, array $vars, array $block_vars, array $destroy, $expected) + public function test_assign_display() { + $this->run_template('basic.html', array(), array(), array(), "pass\npass\npass\n"); + $this->template->set_filenames(array( - 'test' => $file, - 'container' => 'variable.html', + 'test' => 'basic.html', + 'container' => 'variable.html', )); - $this->template->assign_vars($vars); - - foreach ($block_vars as $block => $loops) - { - foreach ($loops as $_vars) - { - $this->template->assign_block_vars($block, $_vars); - } - } - - foreach ($destroy as $block) - { - $this->template->destroy_block_vars($block); - } - - $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)"); $this->template->assign_display('test', 'VARIABLE', false); - $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); + $this->assertEquals("pass\npass\npass\n", $this->display('container'), "Testing assign_display($file)"); } public function test_append_var_without_assign_var() @@ -382,7 +341,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $items = array('This ', 'is ', 'a ', 'test'); $expecting = implode('', $items); - + foreach ($items as $word) { $this->template->append_var('VARIABLE', $word); @@ -400,7 +359,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $start = 'This '; $items = array('is ', 'a ', 'test'); $expecting = $start . implode('', $items); - + $this->template->assign_var('VARIABLE', $start); foreach ($items as $word) { @@ -410,13 +369,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->assertEquals($expecting, $this->display('append_var')); } - public function test_php() - { - $this->setup_engine(array('tpl_allow_php' => true)); - - $this->run_template('php.html', array(), array(), array(), 'test'); - } - public function alter_block_array_data() { return array( @@ -520,10 +472,9 @@ EOT $this->template->assign_block_vars('outer.middle', array()); $this->template->assign_block_vars('outer.middle', array()); - $this->assertEquals("outer - 0\nmiddle - 0\nmiddle - 1\nouter - 1\nmiddle - 0\nmiddle - 1\nouter - 2\nmiddle - 0\nmiddle - 1", $this->display('test'), 'Ensuring template is built correctly before modification'); + $this->assertEquals("outer - 0middle - 0middle - 1outer - 1middle - 0middle - 1outer - 2middle - 0middle - 1", $this->display('test'), 'Ensuring template is built correctly before modification'); $this->template->alter_block_array($alter_block, $vararray, $key, $mode); - $this->assertEquals($expect, $this->display('test'), $description); + $this->assertEquals(str_replace(array("\n", "\r", "\t"), '', $expect), str_replace(array("\n", "\r", "\t"), '', $this->display('test')), $description); } - -} +} \ No newline at end of file diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 23ee8aae04..0a12dff9f4 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -16,6 +16,7 @@ class phpbb_template_template_test_case extends phpbb_test_case protected $template_path; protected $style_resource_locator; protected $style_provider; + protected $user; protected $test_path = 'tests/template'; @@ -59,16 +60,17 @@ class phpbb_template_template_test_case extends phpbb_test_case protected function setup_engine(array $new_config = array()) { - global $phpbb_root_path, $phpEx, $user; + global $phpbb_root_path, $phpEx; $defaults = $this->config_defaults(); $config = new phpbb_config(array_merge($defaults, $new_config)); + $this->user = new phpbb_user; $this->template_path = $this->test_path . '/templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context()); - $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context()); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template); $this->style->set_custom_style('tests', $this->template_path, array(), ''); } @@ -82,10 +84,10 @@ class phpbb_template_template_test_case extends phpbb_test_case protected function tearDown() { - //$this->template->clear_cache(); + $this->template->clear_cache(); } - protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected) + protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array()) { $this->template->set_filenames(array('test' => $file)); $this->template->assign_vars($vars); @@ -103,13 +105,13 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template->destroy_block_vars($block); } - try + foreach ($lang_vars as $name => $value) { - $this->assertEquals($expected, $this->display('test'), "Testing $file"); - } - catch (ErrorException $e) - { - throw $e; + $this->user->lang[$name] = $value; } + + $expected = str_replace(array("\n", "\r", "\t"), '', $expected); + $output = str_replace(array("\n", "\r", "\t"), '', $this->display('test')); + $this->assertEquals($expected, $output, "Testing $file"); } } diff --git a/tests/template/templates/define_unclosed.html b/tests/template/templates/define_unclosed.html deleted file mode 100644 index 1c975eab2b..0000000000 --- a/tests/template/templates/define_unclosed.html +++ /dev/null @@ -1,2 +0,0 @@ - -test diff --git a/tests/template/templates/loop_nested.html b/tests/template/templates/loop_nested.html index 45b1ef85d4..3b5ffa5cac 100644 --- a/tests/template/templates/loop_nested.html +++ b/tests/template/templates/loop_nested.html @@ -1,6 +1,6 @@ - outer - {outer.S_ROW_COUNT} - {outer.VARIABLE} - - middle - {middle.S_ROW_COUNT} - {middle.VARIABLE} - +outer - {outer.S_ROW_COUNT} - {outer.VARIABLE} + +middle - {outer.middle.S_ROW_COUNT} - {outer.middle.VARIABLE} + diff --git a/tests/template/templates/loop_size.html b/tests/template/templates/loop_size.html index f1938441df..8f581cef10 100644 --- a/tests/template/templates/loop_size.html +++ b/tests/template/templates/loop_size.html @@ -36,4 +36,4 @@ in loop - + diff --git a/tests/template/templates/loop_underscore.html b/tests/template/templates/loop_underscore.html index dafce5dea6..4001007868 100644 --- a/tests/template/templates/loop_underscore.html +++ b/tests/template/templates/loop_underscore.html @@ -2,7 +2,7 @@ loop noloop - + loop diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html index d94a0ae0f7..7d86d4b7b6 100644 --- a/tests/template/templates/loop_vars.html +++ b/tests/template/templates/loop_vars.html @@ -11,4 +11,3 @@ last last inner -inner loop From 1b2e5503ac770c1825664507cd4b9407d177a2d9 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 12:07:29 -0500 Subject: [PATCH 354/575] [feature/twig] PHP test moved to a separate file This had to be done because cached template files are available in memory, so Twig doesn't ever reparse a template on the same page load PHPBB3-11598 --- tests/template/template_php_test.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/template/template_php_test.php diff --git a/tests/template/template_php_test.php b/tests/template/template_php_test.php new file mode 100644 index 0000000000..9b5e855757 --- /dev/null +++ b/tests/template/template_php_test.php @@ -0,0 +1,21 @@ +setup_engine(array('tpl_allow_php' => true)); + + $this->run_template('php.html', array(), array(), array(), 'test'); + } +} \ No newline at end of file From e9bbeeb1a4c7d1c4b1d35848ff58f31af4483d07 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 12:23:25 -0500 Subject: [PATCH 355/575] [feature/twig] Fix includephp node PHPBB3-11598 --- phpBB/includes/template/twig/node/includephp.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/includes/template/twig/node/includephp.php index 5315d136d7..33142bf05a 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/includes/template/twig/node/includephp.php @@ -46,19 +46,17 @@ class phpbb_template_twig_node_includephp extends Twig_Node ; } - // Replace variables in the expression - $expr = preg_replace('#{{ ([a-zA-Z0-9_]+) }}#', '\' . ((isset($context["$1"])) ? $context["$1"] : null) . \'', $this->getNode('expr')->getAttribute('value')); - $compiler - ->write("if (phpbb_is_absolute('$expr')) {\n") + ->write("\$location = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("if (phpbb_is_absolute(\$location)) {\n") ->indent() - ->write("require('$expr');\n") + ->write("require(\$location);\n") ->outdent() ->write("} else {\n") ->indent() - ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . '") - ->raw($expr) - ->raw("');\n") + ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n") ->outdent() ->write("}\n") ; From 6c30441ad4a20fe4f154d5a859b9df0f28cbc8e0 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 12:26:01 -0500 Subject: [PATCH 356/575] [feature/twig] Changing INCLUDEJS behavior slightly Automatically parsing inline variables the same way it is done for INCLUDE, INCLUDEPHP PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 1 + .../styles/prosilver/template/memberlist_search.html | 2 +- phpBB/styles/prosilver/template/overall_footer.html | 2 +- phpBB/styles/prosilver/template/posting_buttons.html | 2 +- phpBB/styles/prosilver/template/timezone_option.html | 2 +- .../prosilver/template/ucp_avatar_options.html | 2 +- .../styles/subsilver2/template/timezone_option.html | 2 +- .../subsilver2/template/ucp_groups_manage.html | 2 +- .../subsilver2/template/ucp_profile_avatar.html | 2 +- tests/template/templates/includejs.html | 12 ++++++------ 10 files changed, 15 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 131cf654ef..d9cc6f60ce 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -44,6 +44,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer 'DEFINE.+=', 'INCLUDE', 'INCLUDEPHP', + 'INCLUDEJS', ), $code); // Fix our BEGIN statements diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index 97769b6155..6d2d87a278 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -38,7 +38,7 @@ function insert_single(user) // ]]> - +

      {L_FIND_USERNAME}

      diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 01fc3f83da..5422cc7c10 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -55,7 +55,7 @@ - + {SCRIPTS} diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index b3e2b85492..164e887f75 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -52,7 +52,7 @@ // ]]> - + - + diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html index d71166f517..9b68f81557 100644 --- a/phpBB/styles/subsilver2/template/timezone_option.html +++ b/phpBB/styles/subsilver2/template/timezone_option.html @@ -15,6 +15,6 @@ {S_TZ_OPTIONS} - + diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html index 5595d19b9e..13b8b8c6b7 100644 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html @@ -95,7 +95,7 @@
      {ERROR}
      {L_REPORT_POST}{L_REPORT_MESSAGE}
      {ERROR}
      {L_REPORT_POST_EXPLAIN}{L_REPORT_MESSAGE_EXPLAIN}
      - + diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html index 58ef499c41..885d46ef0b 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html @@ -48,6 +48,6 @@ - + diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index eca6e90637..ef73700eeb 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -1,8 +1,8 @@ - - + + - - - - + + + + {SCRIPTS} From 66118ea49e2dc1a54ce1a76fa4856ff158df9511 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Mon, 1 Jul 2013 13:32:16 -0400 Subject: [PATCH 357/575] [feature/auth-refactor] A possible fix for the functional test failures I don't like this fix as it really shouldn't be needed. But it makes the functional tests pass. PHPBB3-9734 --- phpBB/includes/request/request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/request/request.php b/phpBB/includes/request/request.php index ae3c526d89..c0bb453c7c 100644 --- a/phpBB/includes/request/request.php +++ b/phpBB/includes/request/request.php @@ -79,7 +79,7 @@ class phpbb_request implements phpbb_request_interface // simulate request_order = GP $this->original_request = $this->input[phpbb_request_interface::REQUEST]; - $this->input[phpbb_request_interface::REQUEST] = $this->input[phpbb_request_interface::POST] + $this->input[phpbb_request_interface::GET]; + $this->input[phpbb_request_interface::REQUEST] = (array)$this->input[phpbb_request_interface::POST] + (array)$this->input[phpbb_request_interface::GET]; if ($disable_super_globals) { From 341bae40eb8e8238510a2cb1678f9594a3efd29e Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 12:58:31 -0500 Subject: [PATCH 358/575] [feature/twig] Remove the twig loader class that I started (don't use it) PHPBB3-11598 --- phpBB/includes/template/twig/loader.php | 51 ------------------------- 1 file changed, 51 deletions(-) delete mode 100644 phpBB/includes/template/twig/loader.php diff --git a/phpBB/includes/template/twig/loader.php b/phpBB/includes/template/twig/loader.php deleted file mode 100644 index b153bd81ea..0000000000 --- a/phpBB/includes/template/twig/loader.php +++ /dev/null @@ -1,51 +0,0 @@ -setPaths($paths); - } - - $this->phpbb_locator = $phpbb_locator; - } - - protected function findTemplate($name) - { - $name = (string) $name; - - if (!$name) - { - throw new Twig_Error_Loader(sprintf('Unable to find template "%s".', $name)); - } - - $this->phpbb_locator->set_filenames(array( - 'temp' => $name, - )); - $location = $this->phpbb_locator->get_source_file_for_handle('temp'); - - if (!$location) - { - throw new Twig_Error_Loader(sprintf('Unable to find template "%s".', $name)); - } - - return $this->cache[$name] = $location; - } -} From 6f925552a5a9101b3e8083a0bf27b64b3ffd382a Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:06:37 -0500 Subject: [PATCH 359/575] [feature/twig] Fix includephp_from_subdir_test.php PHPBB3-11598 --- tests/template/subdir/includephp_from_subdir_test.php | 4 +--- tests/template/template_test_case.php | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/template/subdir/includephp_from_subdir_test.php b/tests/template/subdir/includephp_from_subdir_test.php index 517cb85a30..6f9bc1efa6 100644 --- a/tests/template/subdir/includephp_from_subdir_test.php +++ b/tests/template/subdir/includephp_from_subdir_test.php @@ -19,9 +19,7 @@ class phpbb_template_subdir_includephp_from_subdir_test extends phpbb_template_t { $this->setup_engine(array('tpl_allow_php' => true)); - $cache_file = $this->template->cachepath . 'includephp_relative.html.php'; - - $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php", $cache_file); + $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php"); $this->template->set_filenames(array('test' => 'includephp_relative.html')); $this->assertEquals("Path is relative to board root.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP"); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 0a12dff9f4..d3f1cc4646 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -105,9 +105,13 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template->destroy_block_vars($block); } - foreach ($lang_vars as $name => $value) + // Previous functionality was $cachefile (string), which was removed, check to prevent errors + if (is_array($lang_vars)) { - $this->user->lang[$name] = $value; + foreach ($lang_vars as $name => $value) + { + $this->user->lang[$name] = $value; + } } $expected = str_replace(array("\n", "\r", "\t"), '', $expected); From 3060cbe089fcb99ee3e7d66fe5b0e4bce171a88a Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:17:59 -0500 Subject: [PATCH 360/575] [feature/twig] Fix template/template_php_test.php Must create a template file in the cache to load as this causes errors otherwise. The problem was that Twig builds template files into classes, which are always stored in PHP memory after being loaded. Because of this, Twig would never recompile a template that was already compiled on the same page load (so switching enable PHP on/off in two tests would not work). PHPBB3-11598 --- tests/template/template_php_test.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/template/template_php_test.php b/tests/template/template_php_test.php index 9b5e855757..fd4174953c 100644 --- a/tests/template/template_php_test.php +++ b/tests/template/template_php_test.php @@ -14,8 +14,17 @@ class phpbb_template_template_php_test extends phpbb_template_template_test_case { public function test_php() { + $template_text = 'echo "test";'; + + $cache_dir = dirname($this->template->cachepath) . '/'; + $fp = fopen($cache_dir . 'php.html', 'w'); + fputs($fp, $template_text); + fclose($fp); + $this->setup_engine(array('tpl_allow_php' => true)); + $this->style->set_custom_style('tests', $cache_dir, array(), ''); + $this->run_template('php.html', array(), array(), array(), 'test'); } -} \ No newline at end of file +} From 2d9bbe0ef218f56565d70a0e197ba91a80ea378b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:26:00 -0500 Subject: [PATCH 361/575] [feature/twig] Fix template/context.php PHPBB3-11598 --- phpBB/includes/template/context.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/template/context.php b/phpBB/includes/template/context.php index 8585e7d794..e3ad6be46c 100644 --- a/phpBB/includes/template/context.php +++ b/phpBB/includes/template/context.php @@ -181,7 +181,7 @@ class phpbb_template_context } // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blocks[$blockcount]; + $vararray['S_BLOCK_NAME'] = $blockname; // We always assign S_LAST_ROW and remove the entry before $vararray['S_LAST_ROW'] = true; @@ -196,7 +196,7 @@ class phpbb_template_context // Set S_NUM_ROWS foreach ($this->tpldata[$blockname] as &$mod_block) { - $mod_block['S_NUM_ROWS'] = $blockcount; + $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]); } } From bdc05b7dc8ee2363dfe1a7fa70bc4118140ed351 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:28:08 -0500 Subject: [PATCH 362/575] [feature/twig] Remove resource locator dependency from template PHPBB3-11598 --- phpBB/config/services.yml | 1 - phpBB/includes/bbcode.php | 2 +- phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/template/twig/twig.php | 3 +-- phpBB/install/index.php | 2 +- tests/controller/helper_url_test.php | 3 +-- tests/extension/metadata_manager_test.php | 1 - tests/template/template_events_test.php | 2 +- tests/template/template_test_case.php | 2 +- tests/template/template_test_case_with_tree.php | 2 +- 10 files changed, 8 insertions(+), 12 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 4713cb21a6..32bd493743 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -260,7 +260,6 @@ services: - %core.php_ext% - @config - @user - - @style.resource_locator - @template_context - @ext.manager diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 5a4161bb6c..ecbb056045 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -134,7 +134,7 @@ class bbcode $style_resource_locator = new phpbb_style_resource_locator(); $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); - $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager); + $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template); $style->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f0736fbb45..b117fda5b4 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -228,7 +228,7 @@ class messenger { $style_resource_locator = new phpbb_style_resource_locator(); $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); - $tpl = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager); + $tpl = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl); $this->tpl_msg[$template_lang . $template_file] = $tpl; diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 5fe8ba97f6..1d36ceadba 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -96,11 +96,10 @@ class phpbb_template_twig implements phpbb_template * * @param string $phpbb_root_path phpBB root path * @param user $user current user - * @param phpbb_template_locator $locator template locator * @param phpbb_template_context $context template context * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null) + public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/install/index.php b/phpBB/install/index.php index e16109086d..84a2a023f8 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -214,7 +214,7 @@ $config = new phpbb_config(array( $phpbb_style_resource_locator = new phpbb_style_resource_locator(); $phpbb_style_path_provider = new phpbb_style_path_provider(); -$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context()); +$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 42c416b1d2..e376efde66 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -50,10 +50,9 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->user = $this->getMock('phpbb_user'); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context()); + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); } } - diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 9dfb45b38e..bd88f396d9 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -47,7 +47,6 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->phpEx, $this->config, $this->user, - new phpbb_style_resource_locator(), new phpbb_template_context() ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 07181fcc4d..f7bcd2dcc6 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -107,7 +107,7 @@ Zeta test event in all', $this->extension_manager = new phpbb_mock_filesystem_extension_manager( dirname(__FILE__) . "/datasets/$dataset/" ); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context, $this->extension_manager); + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager); $this->style_provider = new phpbb_style_path_provider(); $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); $this->style->set_custom_style('silver', array($this->template_path), $style_names, ''); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index d3f1cc4646..63f0c873b0 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -69,7 +69,7 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->template_path = $this->test_path . '/templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context()); + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template); $this->style->set_custom_style('tests', $this->template_path, array(), ''); } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index e9862bcecc..4b8cbada45 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -22,7 +22,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->parent_template_path = $this->test_path . '/parent_templates'; $this->style_resource_locator = new phpbb_style_resource_locator(); $this->style_provider = new phpbb_style_path_provider(); - $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context()); + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template); $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), ''); } From 793ee3f8d9d1ccc971d7b7118b981463b7de0938 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:32:43 -0500 Subject: [PATCH 363/575] [feature/twig] Remove debug code, set debug/auto reload correctly PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 1d36ceadba..377a0a47a8 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -120,16 +120,12 @@ class phpbb_template_twig implements phpbb_template $loader, array( 'cache' => $this->cachepath, - 'debug' => true, // @todo - 'auto_reload' => true, // @todo + 'debug' => defined('DEBUG'), + 'auto_reload' => (bool) $this->config['load_tplcompile'], 'autoescape' => false, ) ); - // Clear previous cache files (while WIP) - // @todo remove - $this->clear_cache(); - $this->twig->addExtension( new phpbb_template_twig_extension( $this->user From 9fbba760fbb79482976ec9107f70889be2a177fd Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:34:28 -0500 Subject: [PATCH 364/575] [feature/twig] Remove classes related to old template engine PHPBB3-11598 --- phpBB/includes/template/compile.php | 166 --- phpBB/includes/template/filter.php | 1261 ------------------ phpBB/includes/template/phpbb.php | 515 ------- phpBB/includes/template/renderer_eval.php | 60 - phpBB/includes/template/renderer_include.php | 60 - 5 files changed, 2062 deletions(-) delete mode 100644 phpBB/includes/template/compile.php delete mode 100644 phpBB/includes/template/filter.php delete mode 100644 phpBB/includes/template/phpbb.php delete mode 100644 phpBB/includes/template/renderer_eval.php delete mode 100644 phpBB/includes/template/renderer_include.php diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php deleted file mode 100644 index 76cb3011df..0000000000 --- a/phpBB/includes/template/compile.php +++ /dev/null @@ -1,166 +0,0 @@ -filter_params = $this->default_filter_params = array( - 'allow_php' => $allow_php, - 'style_names' => $style_names, - 'locator' => $locator, - 'phpbb_root_path' => $phpbb_root_path, - 'extension_manager' => $extension_manager, - 'user' => $user, - 'template_compile' => $this, - 'cleanup' => true, - ); - } - - /** - * Set filter parameters - * - * @param array $params Array of parameters (will be merged onto $this->filter_params) - */ - public function set_filter_params($params) - { - $this->filter_params = array_merge( - $this->filter_params, - $params - ); - } - - /** - * Reset filter parameters to their default settings - */ - public function reset_filter_params() - { - $this->filter_params = $this->default_filter_params; - } - - /** - * Compiles template in $source_file and writes compiled template to - * cache directory - * - * @param string $handle Template handle to compile - * @param string $source_file Source template file - * @return bool Return true on success otherwise false - */ - public function compile_file_to_file($source_file, $compiled_file) - { - $lock = new phpbb_lock_flock($compiled_file); - $lock->acquire(); - - $source_handle = @fopen($source_file, 'rb'); - $destination_handle = @fopen($compiled_file, 'wb'); - - if (!$source_handle || !$destination_handle) - { - return false; - } - - $this->compile_stream_to_stream($source_handle, $destination_handle); - - @fclose($source_handle); - @fclose($destination_handle); - - phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE); - - $lock->release(); - - clearstatcache(); - - return true; - } - - /** - * Compiles a template located at $source_file. - * - * Returns PHP source suitable for eval(). - * - * @param string $source_file Source template file - * @return string|bool Return compiled code on successful compilation otherwise false - */ - public function compile_file($source_file) - { - $source_handle = @fopen($source_file, 'rb'); - $destination_handle = @fopen('php://temp' ,'r+b'); - - if (!$source_handle || !$destination_handle) - { - return false; - } - - $this->compile_stream_to_stream($source_handle, $destination_handle); - - @fclose($source_handle); - - rewind($destination_handle); - $contents = stream_get_contents($destination_handle); - @fclose($dest_handle); - - return $contents; - } - - /** - * Compiles contents of $source_stream into $dest_stream. - * - * A stream filter is appended to $source_stream as part of the - * process. - * - * @param resource $source_stream Source stream - * @param resource $dest_stream Destination stream - * @return null - */ - private function compile_stream_to_stream($source_stream, $dest_stream) - { - stream_filter_append($source_stream, 'phpbb_template', null, $this->filter_params); - stream_copy_to_stream($source_stream, $dest_stream); - } -} diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php deleted file mode 100644 index 1c0a56c9f5..0000000000 --- a/phpBB/includes/template/filter.php +++ /dev/null @@ -1,1261 +0,0 @@ -'; - - const REGEX_TOKENS = '~|{((?:[a-z_][a-z_0-9]+\.)*\\$?[A-Z][A-Z_0-9]+)}~'; - - /** - * @var array - */ - private $block_names = array(); - - /** - * @var array - */ - private $block_else_level = array(); - - /** - * @var string - */ - private $chunk; - - /** - * @var bool - */ - private $in_php; - - /** - * Whether inline PHP code, and tags - * are allowed. If this is false all PHP code will be silently - * removed from the template during compilation. - * - * @var bool - */ - private $allow_php; - - /** - * Whether cleanup will be performed on resulting code, see compile() - * (Preserve whitespace) - * - * @var bool - */ - private $cleanup = true; - - /** - * Resource locator. - * - * @var phpbb_template_locator - */ - private $locator; - - /** - * @var string phpBB root path - */ - private $phpbb_root_path; - - /** - * Name of the style that the template being compiled and/or rendered - * belongs to, and its parents, in inheritance tree order. - * - * Used to invoke style-specific template events. - * - * @var array - */ - private $style_names; - - /** - * Extension manager. - * - * @var phpbb_extension_manager - */ - private $extension_manager; - - /** - * Current user - * - * @var phpbb_user - */ - private $user; - - /** - * Template compiler. - * - * @var phpbb_template_compile - */ - private $template_compile; - - /** - * Stream filter - * - * Is invoked for evey chunk of the stream, allowing us - * to work on a chunk at a time, which saves memory. - */ - public function filter($in, $out, &$consumed, $closing) - { - $written = false; - $first = false; - - while ($bucket = stream_bucket_make_writeable($in)) - { - $consumed += $bucket->datalen; - - $data = $this->chunk . $bucket->data; - $last_nl = strrpos($data, "\n"); - $this->chunk = substr($data, $last_nl); - $data = substr($data, 0, $last_nl); - - if (!strlen($data)) - { - continue; - } - - $written = true; - - $data = $this->compile($data); - if (!$first) - { - $data = $this->prepend_preamble($data); - $first = false; - } - $bucket->data = $data; - $bucket->datalen = strlen($bucket->data); - stream_bucket_append($out, $bucket); - } - - if ($closing && strlen($this->chunk)) - { - $written = true; - $bucket = stream_bucket_new($this->stream, $this->compile($this->chunk)); - stream_bucket_append($out, $bucket); - } - - return $written ? PSFS_PASS_ON : PSFS_FEED_ME; - } - - /** - * Initializer, called on creation. - * - * Get the allow_php option, style_names, root directory and locator from params, - * which are passed to stream_filter_append. - * - * @return boolean Returns true - */ - public function onCreate() - { - $this->chunk = ''; - $this->in_php = false; - $this->allow_php = $this->params['allow_php']; - $this->locator = $this->params['locator']; - $this->phpbb_root_path = $this->params['phpbb_root_path']; - $this->style_names = $this->params['style_names']; - $this->extension_manager = $this->params['extension_manager']; - $this->cleanup = $this->params['cleanup']; - if (isset($this->params['user'])) - { - $this->user = $this->params['user']; - } - $this->template_compile = $this->params['template_compile']; - return true; - } - - /** - * Compiles a chunk of template. - * - * The chunk must comprise of one or more complete lines from the source - * template. - * - * @param string $data Chunk of source template to compile - * @return string Compiled PHP/HTML code - */ - private function compile($data) - { - $block_start_in_php = $this->in_php; - - $data = preg_replace('#<(?:[\\?%]|script)#s', '', $data); - $data = preg_replace_callback(self::REGEX_TOKENS, array($this, 'replace'), $data); - - // Remove php - if (!$this->allow_php) - { - if ($block_start_in_php - && $this->in_php - && strpos($data, '') === false - && strpos($data, '') === false) - { - // This is just php code - return ''; - } - $data = preg_replace('~^.*?~', '', $data); - $data = preg_replace('~.*?~', '', $data); - $data = preg_replace('~.*?$~', '', $data); - } - - if ($this->cleanup) - { - /* - - Preserve whitespace. - PHP removes a newline after the closing tag (if it's there). - This is by design: - - http://www.php.net/manual/en/language.basic-syntax.phpmode.php - http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php - - - Consider the following template: - - - some content - - - If we were to simply preserve all whitespace, we could simply - replace all "?>" tags with "?>\n". - Doing that, would add additional newlines to the compiled - template in place of the IF and ENDIF statements. These - newlines are unwanted (and one is conditional). The IF and - ENDIF are usually on their own line for ease of reading. - - This replacement preserves newlines only for statements that - are not the only statement on a line. It will NOT preserve - newlines at the end of statements in the above example. - It will preserve newlines in situations like: - - inline content - - */ - - $data = preg_replace('~(?)$~m', "$1\n", $data); - $data = str_replace('/**/?>', "?>\n", $data); - $data = str_replace('?>' . $data); - return $data; - } - - /** - * Callback for replacing matched tokens with compiled template code. - * - * Compiled template code is an HTML stream with embedded PHP. - * - * @param array $matches Regular expression matches - * @return string compiled template code - */ - private function replace($matches) - { - if ($this->in_php && $matches[1] != 'ENDPHP') - { - return ''; - } - - if (isset($matches[3])) - { - return $this->compile_var_tags($matches[0]); - } - - switch ($matches[1]) - { - case 'BEGIN': - $this->block_else_level[] = false; - return 'compile_tag_block($matches[2]) . ' ?>'; - break; - - case 'BEGINELSE': - $this->block_else_level[sizeof($this->block_else_level) - 1] = true; - return ''; - break; - - case 'END': - array_pop($this->block_names); - return 'block_else_level)) ? '}' : '}}') . ' ?>'; - break; - - case 'IF': - return 'compile_tag_if($matches[2], false) . ' ?>'; - break; - - case 'ELSE': - return ''; - break; - - case 'ELSEIF': - return 'compile_tag_if($matches[2], true) . ' ?>'; - break; - - case 'ENDIF': - return ''; - break; - - case 'DEFINE': - return 'compile_tag_define($matches[2], true) . ' ?>'; - break; - - case 'UNDEFINE': - return 'compile_tag_define($matches[2], false) . ' ?>'; - break; - - case 'ENDDEFINE': - return 'compile_tag_enddefine() . ' ?>'; - break; - - case 'INCLUDE': - return 'compile_tag_include($matches[2]) . ' ?>'; - break; - - case 'INCLUDEPHP': - return ($this->allow_php) ? 'compile_tag_include_php($matches[2]) . ' ?>' : ''; - break; - - case 'INCLUDEJS': - return 'compile_tag_include_js($matches[2]) . ' ?>'; - break; - - case 'PHP': - if ($this->allow_php) - { - $this->in_php = true; - return ''; - break; - - case 'ENDPHP': - if ($this->allow_php) - { - $this->in_php = false; - return ' ?>'; - } - return ''; - break; - - case 'EVENT': - return 'compile_tag_event($matches[2]) . '?>'; - break; - - default: - return $matches[0]; - break; - - } - return ''; - } - - /** - * Convert template variables into PHP varrefs - * - * @param string $text_blocks Variable reference in source template - * @param bool $is_expr Returns whether the source was an expression type variable (i.e. S_FIRST_ROW) - * @return string PHP variable name - */ - private function get_varref($text_blocks, &$is_expr) - { - // change template varrefs into PHP varrefs - $varrefs = array(); - - // This one will handle varrefs WITH namespaces - preg_match_all('#\{((?:' . self::REGEX_NS . '\.)+)(\$)?(' . self::REGEX_VAR . ')\}#', $text_blocks, $varrefs, PREG_SET_ORDER); - - foreach ($varrefs as $var_val) - { - $namespace = $var_val[1]; - $varname = $var_val[3]; - $new = $this->generate_block_varref($namespace, $varname, $is_expr, $var_val[2]); - - $text_blocks = str_replace($var_val[0], $new, $text_blocks); - } - - // Language variables cannot be reduced to a single varref, so they must be skipped - // These two replacements would break language variables, so we can only run them on non-language types - if (strpos($text_blocks, '{L_') === false && strpos($text_blocks, '{LA_') === false) - { - // This will handle the remaining root-level varrefs - $text_blocks = preg_replace('#\{(' . self::REGEX_VAR . ')\}#', "\$_rootref['\\1']", $text_blocks); - $text_blocks = preg_replace('#\{\$(' . self::REGEX_VAR . ')\}#', "\$_tpldata['DEFINE']['.']['\\1']", $text_blocks); - } - - return $text_blocks; - } - - /** - * Parse paths of the form {FOO}/a/{BAR}/b - * - * Note: this method assumes at least one variable in the path, this should - * be checked before this method is called. - * - * @param string $path The path to parse - * @param string $include_type The type of template function to call - * @return string An appropriately formatted string to include in the - * template or an empty string if an expression like S_FIRST_ROW was - * incorrectly used - */ - private function parse_dynamic_path($path, $include_type) - { - $matches = array(); - $replace = array(); - $is_expr = true; - - preg_match_all('#\{((?:' . self::REGEX_NS . '\.)*)(\$)?(' . self::REGEX_VAR . ')\}#', $path, $matches); - foreach ($matches[0] as $var_str) - { - $tmp_is_expr = false; - $var = $this->get_varref($var_str, $tmp_is_expr); - $is_expr = $is_expr && $tmp_is_expr; - $replace[] = "' . $var . '"; - } - - if (!$is_expr) - { - return " \$_template->$include_type('" . str_replace($matches[0], $replace, $path) . "', true);"; - } - else - { - return ''; - } - } - - /** - * Compile variables - * - * @param string $text_blocks Variable reference in source template - * @return string compiled template code - */ - private function compile_var_tags(&$text_blocks) - { - $is_expr = null; - $text_blocks = $this->get_varref($text_blocks, $is_expr); - $lang_replaced = $this->compile_language_tags($text_blocks); - - if(!$lang_replaced) - { - $text_blocks = ''; - } - - return $text_blocks; - } - - /** - * Handles special language tags L_ and LA_ - * - * @param string $text_blocks Variable reference in source template - * @return bool Whether a replacement occurred or not - */ - private function compile_language_tags(&$text_blocks) - { - $replacements = 0; - - // transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array - if (strpos($text_blocks, '{L_') !== false) - { - $text_blocks = preg_replace('#\{L_(' . self::REGEX_VAR_SUFFIX . ')\}#', "", $text_blocks, -1, $replacements); - return (bool) $replacements; - } - - // Handle addslashed language variables prefixed with LA_ - // If a template variable already exist, it will be used in favor of it... - if (strpos($text_blocks, '{LA_') !== false) - { - $text_blocks = preg_replace('#\{LA_(' . self::REGEX_VAR_SUFFIX . '+)\}#', "", $text_blocks, -1, $replacements); - return (bool) $replacements; - } - - return false; - } - - /** - * Compile blocks - * - * @param string $tag_args Block contents in source template - * @return string compiled template code - */ - private function compile_tag_block($tag_args) - { - $no_nesting = false; - - // Is the designer wanting to call another loop in a loop? - // - // - // - // - // 'loop2' is actually on the same nesting level as 'loop' you assign - // variables to it with template->assign_block_vars('loop2', array(...)) - if (strpos($tag_args, '!') === 0) - { - // Count the number if ! occurrences (not allowed in vars) - $no_nesting = substr_count($tag_args, '!'); - $tag_args = substr($tag_args, $no_nesting); - } - - // Allow for control of looping (indexes start from zero): - // foo(2) : Will start the loop on the 3rd entry - // foo(-2) : Will start the loop two entries from the end - // foo(3,4) : Will start the loop on the fourth entry and end it on the fifth - // foo(3,-4) : Will start the loop on the fourth entry and end it four from last - $match = array(); - - if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match)) - { - $tag_args = $match[1]; - - if ($match[2] < 0) - { - $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; - } - else - { - $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; - } - - if (!isset($match[3]) || strlen($match[3]) < 1 || $match[3] == -1) - { - $loop_end = '$_' . $tag_args . '_count'; - } - else if ($match[3] >= 0) - { - $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; - } - else //if ($match[3] < -1) - { - $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); - } - } - else - { - $loop_start = 0; - $loop_end = '$_' . $tag_args . '_count'; - } - - $tag_template_php = ''; - array_push($this->block_names, $tag_args); - - if ($no_nesting !== false) - { - // We need to implode $no_nesting times from the end... - $block = array_slice($this->block_names, -$no_nesting); - } - else - { - $block = $this->block_names; - } - - if (sizeof($block) < 2) - { - // Block is not nested. - $tag_template_php = '$_' . $tag_args . "_count = (isset(\$_tpldata['$tag_args'])) ? sizeof(\$_tpldata['$tag_args']) : 0;"; - $varref = "\$_tpldata['$tag_args']"; - } - else - { - // This block is nested. - // Generate a namespace string for this block. - $namespace = implode('.', $block); - - // Get a reference to the data array for this block that depends on the - // current indices of all parent blocks. - $varref = $this->generate_block_data_ref($namespace, false); - - // Create the for loop code to iterate over this block. - $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;'; - } - - $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; - - /** - * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory - * - * if (!$offset) - * { - * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; - * } - * - */ - - $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; - $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; - - return $tag_template_php; - } - - /** - * Compile a general expression - much of this is from Smarty with - * some adaptions for our block level methods - * - * @param string $tag_args Expression (tag arguments) in source template - * @return string compiled template code - */ - private function compile_expression($tag_args) - { - $match = array(); - preg_match_all('/(?: - "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | - \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | - [(),] | - [^\s(),]+)/x', $tag_args, $match); - - $tokens = $match[0]; - $is_arg_stack = array(); - - for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) - { - $token = &$tokens[$i]; - - switch ($token) - { - case '!==': - case '===': - case '<<': - case '>>': - case '|': - case '^': - case '&': - case '~': - case ')': - case ',': - case '+': - case '-': - case '*': - case '/': - case '@': - break; - - case '==': - case 'eq': - $token = '=='; - break; - - case '!=': - case '<>': - case 'ne': - case 'neq': - $token = '!='; - break; - - case '<': - case 'lt': - $token = '<'; - break; - - case '<=': - case 'le': - case 'lte': - $token = '<='; - break; - - case '>': - case 'gt': - $token = '>'; - break; - - case '>=': - case 'ge': - case 'gte': - $token = '>='; - break; - - case '&&': - case 'and': - $token = '&&'; - break; - - case '||': - case 'or': - $token = '||'; - break; - - case '!': - case 'not': - $token = '!'; - break; - - case '%': - case 'mod': - $token = '%'; - break; - - case '(': - array_push($is_arg_stack, $i); - break; - - case 'is': - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; - $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); - - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); - - array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); - - $i = $is_arg_start; - - // no break - - default: - $varrefs = array(); - if (preg_match('#^((?:' . self::REGEX_NS . '\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs)) - { - if (!empty($varrefs[1])) - { - $namespace = substr($varrefs[1], 0, -1); - $dot_pos = strrchr($namespace, '.'); - if ($dot_pos !== false) - { - $namespace = substr($dot_pos, 1); - } - - // S_ROW_COUNT is deceptive, it returns the current row number not the number of rows - // hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM - switch ($varrefs[3]) - { - case 'S_ROW_NUM': - case 'S_ROW_COUNT': - $token = "\$_${namespace}_i"; - break; - - case 'S_NUM_ROWS': - $token = "\$_${namespace}_count"; - break; - - case 'S_FIRST_ROW': - $token = "(\$_${namespace}_i == 0)"; - break; - - case 'S_LAST_ROW': - $token = "(\$_${namespace}_i == \$_${namespace}_count - 1)"; - break; - - case 'S_BLOCK_NAME': - $token = "'$namespace'"; - break; - - default: - $token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']'; - $token = '(isset(' . $token . ') ? ' . $token . ' : null)'; - break; - } - } - else - { - $token = ($varrefs[2]) ? '$_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$_rootref[\'' . $varrefs[3] . '\']'; - $token = '(isset(' . $token . ') ? ' . $token . ' : null)'; - } - - } - else if (preg_match('#^\.((?:' . self::REGEX_NS . '\.?)+)$#s', $token, $varrefs)) - { - // Allow checking if loops are set with .loopname - // It is also possible to check the loop count by doing for example - $blocks = explode('.', $varrefs[1]); - - // If the block is nested, we have a reference that we can grab. - // If the block is not nested, we just go and grab the block from _tpldata - if (sizeof($blocks) > 1) - { - $block = array_pop($blocks); - $namespace = implode('.', $blocks); - $varref = $this->generate_block_data_ref($namespace, true); - - // Add the block reference for the last child. - $varref .= "['" . $block . "']"; - } - else - { - $varref = '$_tpldata'; - - // Add the block reference for the last child. - $varref .= "['" . $blocks[0] . "']"; - } - $token = "(isset($varref) ? sizeof($varref) : 0)"; - } - - break; - } - } - - return $tokens; - } - - /** - * Compile IF tags - * - * @param string $tag_args Expression given with IF in source template - * @param bool $elseif True if compiling an IF tag, false if compiling an ELSEIF tag - * @return string compiled template code - */ - private function compile_tag_if($tag_args, $elseif) - { - $tokens = $this->compile_expression($tag_args); - - $tpl = ($elseif) ? '} else if (' : 'if ('; - - $tpl .= implode(' ', $tokens); - $tpl .= ') { '; - - return $tpl; - } - - /** - * Compile DEFINE tags - * - * @param string $tag_args Expression given with DEFINE in source template - * @param bool $op True if compiling a DEFINE tag, false if compiling an UNDEFINE tag - * @return string compiled template code - */ - private function compile_tag_define($tag_args, $op) - { - $match = array(); - preg_match('#^((?:' . self::REGEX_NS . '\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (.*?))?$#', $tag_args, $match); - - if (!empty($match[2]) && !isset($match[3]) && $op) - { - // DEFINE tag with ENDDEFINE - $array = "\$_tpldata['DEFINE']['.vars']"; - $code = 'ob_start(); '; - $code .= "if (!isset($array)) { $array = array(); } "; - $code .= "{$array}[] = '{$match[2]}'"; - return $code; - } - - if (empty($match[2]) || (!isset($match[3]) && $op)) - { - return ''; - } - - if (!$op) - { - return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');'; - } - - /* - * Define tags that contain template variables (enclosed in curly brackets) - * need to be treated differently. - */ - if (substr($match[3], 1, 1) == '{' && substr($match[3], -2, 1) == '}') - { - $parsed_statement = implode(' ', $this->compile_expression(substr($match[3], 2, -2))); - } - else - { - $parsed_statement = implode(' ', $this->compile_expression($match[3])); - } - - return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $parsed_statement . ';'; - } - - /** - * Compile ENDDEFINE tag - * - * @return string compiled template code - */ - private function compile_tag_enddefine() - { - $array = "\$_tpldata['DEFINE']['.vars']"; - $code = "if (!isset($array) || !sizeof($array)) { trigger_error('ENDDEFINE tag without DEFINE in ' . basename(__FILE__), E_USER_ERROR); }"; - $code .= "\$define_var = array_pop($array); "; - $code .= "\$_tpldata['DEFINE']['.'][\$define_var] = ob_get_clean();"; - return $code; - } - - /** - * Compile INCLUDE tag - * - * @param string $tag_args Expression given with INCLUDE in source template - * @return string compiled template code - */ - private function compile_tag_include($tag_args) - { - // Process dynamic includes - if (strpos($tag_args, '{') !== false) - { - return $this->parse_dynamic_path($tag_args, '_tpl_include'); - } - - return "\$_template->_tpl_include('$tag_args');"; - } - - /** - * Compile INCLUDE_PHP tag - * - * @param string $tag_args Expression given with INCLUDEPHP in source template - * @return string compiled template code - */ - private function compile_tag_include_php($tag_args) - { - if (strpos($tag_args, '{') !== false) - { - return $this->parse_dynamic_path($tag_args, '_php_include'); - } - - return "\$_template->_php_include('$tag_args');"; - } - - /** - * Compile EVENT tag. - * - * $tag_args should be a single string identifying the event. - * The event name can contain letters, numbers and underscores only. - * If an invalid event name is specified, an E_USER_ERROR will be - * triggered. - * - * Event tags are only functional when the template engine has - * an instance of the extension manager. Extension manager would - * be called upon to find all extensions listening for the specified - * event, and to obtain additional template fragments. All such - * template fragments will be compiled and included in the generated - * compiled template code for the current template being compiled. - * - * The above means that whenever an extension is enabled or disabled, - * template cache should be cleared in order to update the compiled - * template code for the active set of template event listeners. - * - * This also means that extensions cannot return different template - * fragments at different times. Once templates are compiled, changing - * such template fragments would have no effect. - * - * @param string $tag_args EVENT tag arguments, as a string - for EVENT this is the event name - * @return string compiled template code - */ - private function compile_tag_event($tag_args) - { - if (!preg_match('/^\w+$/', $tag_args)) - { - // The event location is improperly formatted, - if ($this->user) - { - trigger_error($this->user->lang('ERR_TEMPLATE_EVENT_LOCATION', $tag_args), E_USER_ERROR); - } - else - { - trigger_error(sprintf('The specified template event location [%s] is improperly formatted.', $tag_args), E_USER_ERROR); - } - } - $location = $tag_args; - - if ($this->extension_manager) - { - $finder = $this->extension_manager->get_finder(); - - $files = $finder - ->extension_prefix($location) - ->extension_suffix('.html') - ->extension_directory("/styles/all/template") - ->get_files(); - - foreach ($this->style_names as $style_name) - { - $more_files = $finder - ->extension_prefix($location) - ->extension_suffix('.html') - ->extension_directory("/styles/" . $style_name . "/template") - ->get_files(); - if (!empty($more_files)) - { - $files = array_merge($files, $more_files); - break; - } - } - - $all_compiled = ''; - foreach ($files as $file) - { - $this->template_compile->set_filter_params(array( - 'cleanup' => false, - )); - - $compiled = $this->template_compile->compile_file($file); - - $this->template_compile->reset_filter_params(); - - if ($compiled === false) - { - if ($this->user) - { - trigger_error($this->user->lang('ERR_TEMPLATE_COMPILATION', phpbb_filter_root_path($file)), E_USER_ERROR); - } - else - { - trigger_error(sprintf('The file could not be compiled: %s', phpbb_filter_root_path($file)), E_USER_ERROR); - } - } - - $all_compiled .= $compiled; - } - // Need spaces inside php tags as php cannot grok - // < ?php? > sans the spaces - return ' ?' . '>' . $all_compiled . 'parse_dynamic_path($tag_args, '_js_include'); - } - - // Locate file - $filename = $this->locator->get_first_file_location(array($tag_args), false, true); - - if ($filename === false) - { - // File does not exist, find it during run time - return ' $_template->_js_include(\'' . addslashes($tag_args) . '\', true); '; - } - - if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path) - { - // Absolute path, include as is - return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, false); '; - } - - // Relative path, remove root path from it - $filename = substr($filename, strlen($this->phpbb_root_path)); - return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, true); '; - } - - /** - * Generates a reference to the given variable inside the given (possibly nested) - * block namespace. This is a string of the form: - * ' . $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' - * It's ready to be inserted into an "echo" line in one of the templates. - * - * @param string $namespace Namespace to access (expects a trailing "." on the namespace) - * @param string $varname Variable name to use - * @param bool $expr Returns whether the source was an expression type - * @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable - * @return string Code to access variable or echo it if $echo is true - */ - private function generate_block_varref($namespace, $varname, &$expr, $defop = false) - { - // Strip the trailing period. - $namespace = substr($namespace, 0, -1); - - if (($pos = strrpos($namespace, '.')) !== false) - { - $local_namespace = substr($namespace, $pos + 1); - } - else - { - $local_namespace = $namespace; - } - - $expr = true; - - // S_ROW_COUNT is deceptive, it returns the current row number now the number of rows - // hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM - switch ($varname) - { - case 'S_ROW_NUM': - case 'S_ROW_COUNT': - $varref = "\$_${local_namespace}_i"; - break; - - case 'S_NUM_ROWS': - $varref = "\$_${local_namespace}_count"; - break; - - case 'S_FIRST_ROW': - $varref = "(\$_${local_namespace}_i == 0)"; - break; - - case 'S_LAST_ROW': - $varref = "(\$_${local_namespace}_i == \$_${local_namespace}_count - 1)"; - break; - - case 'S_BLOCK_NAME': - $varref = "'$local_namespace'"; - break; - - default: - // Get a reference to the data block for this namespace. - $varref = $this->generate_block_data_ref($namespace, true, $defop); - // Prepend the necessary code to stick this in an echo line. - - // Append the variable reference. - $varref .= "['$varname']"; - - $expr = false; - break; - } - // @todo Test the !$expr more - - return $varref; - } - - /** - * Generates a reference to the array of data values for the given - * (possibly nested) block namespace. This is a string of the form: - * $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] - * - * @param string $blockname Block to access (does not expect a trailing "." on the blockname) - * @param bool $include_last_iterator If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. - * @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable - * @return string Code to access variable - */ - private function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) - { - // Get an array of the blocks involved. - $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; - - // DEFINE is not an element of any referenced variable, we must use _tpldata to access it - if ($defop) - { - $varref = '$_tpldata[\'DEFINE\']'; - // Build up the string with everything but the last child. - for ($i = 0; $i < $blockcount; $i++) - { - $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]'; - } - // Add the block reference for the last child. - $varref .= "['" . $blocks[$blockcount] . "']"; - // Add the iterator for the last child if requried. - if ($include_last_iterator) - { - $varref .= '[$_' . $blocks[$blockcount] . '_i]'; - } - return $varref; - } - else if ($include_last_iterator) - { - return '$_'. $blocks[$blockcount] . '_val'; - } - else - { - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; - } - } -} diff --git a/phpBB/includes/template/phpbb.php b/phpBB/includes/template/phpbb.php deleted file mode 100644 index 8f4d163f8c..0000000000 --- a/phpBB/includes/template/phpbb.php +++ /dev/null @@ -1,515 +0,0 @@ - $user->img('icon_contact', 'CONTACT', 'full'); -* -* More in-depth... -* yadayada -*/ - -/** -* Base Template class. -* @package phpBB3 -*/ -class phpbb_template_phpbb implements phpbb_template -{ - /** - * Template context. - * Stores template data used during template rendering. - * @var phpbb_template_context - */ - private $context; - - /** - * Path of the cache directory for the template - * @var string - */ - public $cachepath = ''; - - /** - * phpBB root path - * @var string - */ - private $phpbb_root_path; - - /** - * PHP file extension - * @var string - */ - private $php_ext; - - /** - * phpBB config instance - * @var phpbb_config - */ - private $config; - - /** - * Current user - * @var phpbb_user - */ - private $user; - - /** - * Template locator - * @var phpbb_template_locator - */ - private $locator; - - /** - * Extension manager. - * - * @var phpbb_extension_manager - */ - private $extension_manager; - - /** - * Name of the style that the template being compiled and/or rendered - * belongs to, and its parents, in inheritance tree order. - * - * Used to invoke style-specific template events. - * - * @var array - */ - private $style_names; - - /** - * Constructor. - * - * @param string $phpbb_root_path phpBB root path - * @param user $user current user - * @param phpbb_template_locator $locator template locator - * @param phpbb_template_context $context template context - * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked - */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null) - { - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; - $this->config = $config; - $this->user = $user; - $this->locator = $locator; - $this->context = $context; - $this->extension_manager = $extension_manager; - } - - /** - * Sets the template filenames for handles. - * - * @param array $filename_array Should be a hash of handle => filename pairs. - */ - public function set_filenames(array $filename_array) - { - $this->locator->set_filenames($filename_array); - - return true; - } - - /** - * Sets the style names corresponding to style hierarchy being compiled - * and/or rendered. - * - * @param array $style_names List of style names in inheritance tree order - * @return null - */ - public function set_style_names(array $style_names) - { - $this->style_names = $style_names; - } - - /** - * Clears all variables and blocks assigned to this template. - */ - public function destroy() - { - $this->context->clear(); - } - - /** - * Reset/empty complete block - * - * @param string $blockname Name of block to destroy - */ - public function destroy_block_vars($blockname) - { - $this->context->destroy_block_vars($blockname); - } - - /** - * Display a template for provided handle. - * - * The template will be loaded and compiled, if necessary, first. - * - * This function calls hooks. - * - * @param string $handle Handle to display - * @return bool True on success, false on failure - */ - public function display($handle) - { - $result = $this->call_hook($handle, __FUNCTION__); - if ($result !== false) - { - return $result[0]; - } - - return $this->load_and_render($handle); - } - - /** - * Loads a template for $handle, compiling it if necessary, and - * renders the template. - * - * @param string $handle Template handle to render - * @return bool True on success, false on failure - */ - private function load_and_render($handle) - { - $renderer = $this->_tpl_load($handle); - - if ($renderer) - { - $renderer->render($this->context, $this->get_lang()); - return true; - } - else - { - return false; - } - } - - /** - * Calls hook if any is defined. - * - * @param string $handle Template handle being displayed. - * @param string $method Method name of the caller. - */ - private function call_hook($handle, $method) - { - global $phpbb_hook; - - if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this)) - { - if ($phpbb_hook->hook_return(array(__CLASS__, $method))) - { - $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method)); - return array($result); - } - } - - return false; - } - - /** - * Obtains language array. - * This is either lang property of $user property, or if - * it is not set an empty array. - * @return array language entries - */ - public function get_lang() - { - if (isset($this->user->lang)) - { - $lang = $this->user->lang; - } - else - { - $lang = array(); - } - return $lang; - } - - /** - * Display the handle and assign the output to a template variable - * or return the compiled result. - * - * @param string $handle Handle to operate on - * @param string $template_var Template variable to assign compiled handle to - * @param bool $return_content If true return compiled handle, otherwise assign to $template_var - * @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true - */ - public function assign_display($handle, $template_var = '', $return_content = true) - { - ob_start(); - $result = $this->display($handle); - $contents = ob_get_clean(); - if ($result === false) - { - return false; - } - - if ($return_content) - { - return $contents; - } - - $this->assign_var($template_var, $contents); - - return true; - } - - /** - * Obtains a template renderer for a template identified by specified - * handle. The template renderer can display the template later. - * - * Template source will first be compiled into php code. - * If template cache is writable the compiled php code will be stored - * on filesystem and template will not be subsequently recompiled. - * If template cache is not writable template source will be recompiled - * every time it is needed. DEBUG define and load_tplcompile - * configuration setting may be used to force templates to be always - * recompiled. - * - * Returns an object implementing phpbb_template_renderer, or null - * if template loading or compilation failed. Call render() on the - * renderer to display the template. This will result in template - * contents sent to the output stream (unless, of course, output - * buffering is in effect). - * - * @param string $handle Handle of the template to load - * @return phpbb_template_renderer Template renderer object, or null on failure - * @uses phpbb_template_compile is used to compile template source - */ - private function _tpl_load($handle) - { - $output_file = $this->_compiled_file_for_handle($handle); - - $recompile = defined('DEBUG') || - !file_exists($output_file) || - @filesize($output_file) === 0; - - if ($recompile || $this->config['load_tplcompile']) - { - // Set only if a recompile or an mtime check are required. - $source_file = $this->locator->get_source_file_for_handle($handle); - - if (!$recompile && @filemtime($output_file) < @filemtime($source_file)) - { - $recompile = true; - } - } - - // Recompile page if the original template is newer, otherwise load the compiled version - if (!$recompile) - { - return new phpbb_template_renderer_include($output_file, $this); - } - - $compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_names, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user); - - if ($compile->compile_file_to_file($source_file, $output_file) !== false) - { - $renderer = new phpbb_template_renderer_include($output_file, $this); - } - else if (($code = $compile->compile_file($source_file)) !== false) - { - $renderer = new phpbb_template_renderer_eval($code, $this); - } - else - { - $renderer = null; - } - - return $renderer; - } - - /** - * Determines compiled file path for handle $handle. - * - * @param string $handle Template handle (i.e. "friendly" template name) - * @return string Compiled file path - */ - private function _compiled_file_for_handle($handle) - { - $source_file = $this->locator->get_filename_for_handle($handle); - $compiled_file = $this->cachepath . str_replace('/', '.', $source_file) . '.' . $this->php_ext; - return $compiled_file; - } - - /** - * Assign key variable pairs from an array - * - * @param array $vararray A hash of variable name => value pairs - */ - public function assign_vars(array $vararray) - { - foreach ($vararray as $key => $val) - { - $this->assign_var($key, $val); - } - } - - /** - * Assign a single scalar value to a single key. - * - * Value can be a string, an integer or a boolean. - * - * @param string $varname Variable name - * @param string $varval Value to assign to variable - */ - public function assign_var($varname, $varval) - { - $this->context->assign_var($varname, $varval); - } - - /** - * Append text to the string value stored in a key. - * - * Text is appended using the string concatenation operator (.). - * - * @param string $varname Variable name - * @param string $varval Value to append to variable - */ - public function append_var($varname, $varval) - { - $this->context->append_var($varname, $varval); - } - - // Docstring is copied from phpbb_template_context method with the same name. - /** - * Assign key variable pairs from an array to a specified block - * @param string $blockname Name of block to assign $vararray to - * @param array $vararray A hash of variable name => value pairs - */ - public function assign_block_vars($blockname, array $vararray) - { - return $this->context->assign_block_vars($blockname, $vararray); - } - - // Docstring is copied from phpbb_template_context method with the same name. - /** - * Change already assigned key variable pair (one-dimensional - single loop entry) - * - * An example of how to use this function: - * {@example alter_block_array.php} - * - * @param string $blockname the blockname, for example 'loop' - * @param array $vararray the var array to insert/add or merge - * @param mixed $key Key to search for - * - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] - * - * int: Position [the position to change or insert at directly given] - * - * If key is false the position is set to 0 - * If key is true the position is set to the last entry - * - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') - * - * If insert, the vararray is inserted at the given position (position counting from zero). - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). - * - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) - * - * @return bool false on error, true on success - */ - public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') - { - return $this->context->alter_block_array($blockname, $vararray, $key, $mode); - } - - /** - * Include a separate template. - * - * This function is marked public due to the way the template - * implementation uses it. It is actually an implementation function - * and should not be considered part of template class's public API. - * - * @param string $filename Template filename to include - * @param bool $include True to include the file, false to just load it - * @uses template_compile is used to compile uncached templates - */ - public function _tpl_include($filename, $include = true) - { - $this->locator->set_filenames(array($filename => $filename)); - - if (!$this->load_and_render($filename)) - { - // trigger_error cannot be used here, as the output already started - echo 'template->_tpl_include(): Failed including ' . htmlspecialchars($handle) . "\n"; - } - } - - /** - * Include a PHP file. - * - * If a relative path is passed in $filename, it is considered to be - * relative to board root ($phpbb_root_path). Absolute paths are - * also allowed. - * - * This function is marked public due to the way the template - * implementation uses it. It is actually an implementation function - * and should not be considered part of template class's public API. - * - * @param string $filename Path to PHP file to include - */ - public function _php_include($filename) - { - if (phpbb_is_absolute($filename)) - { - $file = $filename; - } - else - { - $file = $this->phpbb_root_path . $filename; - } - - if (!file_exists($file)) - { - // trigger_error cannot be used here, as the output already started - echo 'template->_php_include(): File ' . htmlspecialchars($file) . " does not exist\n"; - return; - } - include($file); - } - - /** - * Include JS file - * - * @param string $file file name - * @param bool $locate True if file needs to be located - * @param bool $relative True if path is relative to phpBB root directory. Ignored if $locate == true - */ - public function _js_include($file, $locate = false, $relative = false) - { - // Locate file - if ($locate) - { - $located = $this->locator->get_first_file_location(array($file), false, true); - if ($located) - { - $file = $located; - } - } - else if ($relative) - { - $file = $this->phpbb_root_path . $file; - } - - $file .= (strpos($file, '?') === false) ? '?' : '&'; - $file .= 'assets_version=' . $this->config['assets_version']; - - // Add HTML code - $code = ''; - $this->context->append_var('SCRIPTS', $code); - } -} diff --git a/phpBB/includes/template/renderer_eval.php b/phpBB/includes/template/renderer_eval.php deleted file mode 100644 index f8e4cb7b10..0000000000 --- a/phpBB/includes/template/renderer_eval.php +++ /dev/null @@ -1,60 +0,0 @@ -code = $code; - $this->template = $template; - } - - /** - * Displays the template managed by this renderer by eval'ing php code - * of the template. - * - * @param phpbb_template_context $context Template context to use - * @param array $lang Language entries to use - */ - public function render($context, $lang) - { - $_template = $this->template; - $_tpldata = &$context->get_data_ref(); - $_rootref = &$context->get_root_ref(); - $_lang = $lang; - - eval(' ?>' . $this->code . 'path = $path; - $this->template = $template; - } - - /** - * Displays the template managed by this renderer by including - * the php file containing the template. - * - * @param phpbb_template_context $context Template context to use - * @param array $lang Language entries to use - */ - public function render($context, $lang) - { - $_template = $this->template; - $_tpldata = &$context->get_data_ref(); - $_rootref = &$context->get_root_ref(); - $_lang = $lang; - - include($this->path); - } -} From d7cff78443465a06d6aab519c3285a9b20b6cd50 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:39:51 -0500 Subject: [PATCH 365/575] [feature/twig] Use adm_relative_path to build admin namespace PHPBB3-11598 --- phpBB/config/services.yml | 1 + phpBB/includes/template/twig/twig.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 32bd493743..23205169b9 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -262,6 +262,7 @@ services: - @user - @template_context - @ext.manager + - %core.adm_relative_path% template_context: class: phpbb_template_context diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 377a0a47a8..b5fb8eb860 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -40,6 +40,12 @@ class phpbb_template_twig implements phpbb_template */ protected $phpbb_root_path; + /** + * adm relative path + * @var string + */ + protected $adm_relative_path; + /** * PHP file extension * @var string @@ -92,16 +98,16 @@ class phpbb_template_twig implements phpbb_template /** * Constructor. * - * @todo remove unnecessary dependencies - * * @param string $phpbb_root_path phpBB root path * @param user $user current user * @param phpbb_template_context $context template context * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked + * @param string $adm_relative_path relative path to adm directory */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null) + public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null) { $this->phpbb_root_path = $phpbb_root_path; + $this->adm_relative_path = $adm_relative_path; $this->php_ext = $php_ext; $this->config = $config; $this->user = $user; @@ -186,10 +192,9 @@ class phpbb_template_twig implements phpbb_template } // Add admin namespace - // @todo use phpbb_admin path - if (is_dir($this->phpbb_root_path . 'adm/style/')) + if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/')) { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . 'adm/style/', 'admin'); + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->adm_relative_path . 'style/', 'admin'); } // Add all namespaces for all extensions From 9e3d5420adeb93fd2d51ce6d8e5f5c91ae8f6382 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 2 Jul 2013 00:10:30 +0530 Subject: [PATCH 366/575] [ticket/11585] Make $auth_admin class property $auth_admin is class property and used via $this reference in all methods PHPBB3-11585 --- phpBB/includes/acp/acp_permission_roles.php | 25 ++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 004187af84..e830479389 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -21,6 +21,7 @@ if (!defined('IN_PHPBB')) class acp_permission_roles { var $u_action; + protected $auth_admin; function main($id, $mode) { @@ -30,7 +31,7 @@ class acp_permission_roles include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); - $auth_admin = new auth_admin(); + $this->auth_admin = new auth_admin(); $user->add_lang('acp/permissions'); add_permission_language(); @@ -210,7 +211,7 @@ class acp_permission_roles } // Now add the auth settings - $auth_admin->acl_set_role($role_id, $auth_settings); + $this->auth_admin->acl_set_role($role_id, $auth_settings); $role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name; add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name); @@ -343,7 +344,7 @@ class acp_permission_roles // Get users/groups/forums using this preset... if ($action == 'edit') { - $hold_ary = $auth_admin->get_role_mask($role_id); + $hold_ary = $this->auth_admin->get_role_mask($role_id); if (sizeof($hold_ary)) { @@ -354,7 +355,7 @@ class acp_permission_roles 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name)) ); - $auth_admin->display_role_mask($hold_ary); + $this->auth_admin->display_role_mask($hold_ary); } } @@ -445,8 +446,8 @@ class acp_permission_roles 'S_DISPLAY_ROLE_MASK' => true) ); - $hold_ary = $auth_admin->get_role_mask($display_item); - $auth_admin->display_role_mask($hold_ary); + $hold_ary = $this->auth_admin->get_role_mask($display_item); + $this->auth_admin->display_role_mask($hold_ary); } } @@ -462,7 +463,7 @@ class acp_permission_roles $auth_options = array(0 => $auth_options); // Making use of auth_admin method here (we do not really want to change two similar code fragments) - auth_admin::build_permission_array($auth_options, $content_array, $categories, $key_sort_array); + $this->auth_admin->build_permission_array($auth_options, $content_array, $categories, $key_sort_array); $content_array = $content_array[0]; @@ -500,8 +501,6 @@ class acp_permission_roles { global $db; - $auth_admin = new auth_admin(); - // Get complete auth array $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " @@ -529,19 +528,19 @@ class acp_permission_roles $db->sql_freeresult($result); // Get role assignments - $hold_ary = $auth_admin->get_role_mask($role_id); + $hold_ary = $this->auth_admin->get_role_mask($role_id); // Re-assign permissions foreach ($hold_ary as $forum_id => $forum_ary) { if (isset($forum_ary['users'])) { - $auth_admin->acl_set('user', $forum_id, $forum_ary['users'], $auth_settings, 0, false); + $this->auth_admin->acl_set('user', $forum_id, $forum_ary['users'], $auth_settings, 0, false); } if (isset($forum_ary['groups'])) { - $auth_admin->acl_set('group', $forum_id, $forum_ary['groups'], $auth_settings, 0, false); + $this->auth_admin->acl_set('group', $forum_id, $forum_ary['groups'], $auth_settings, 0, false); } } @@ -563,6 +562,6 @@ class acp_permission_roles WHERE role_id = ' . $role_id; $db->sql_query($sql); - $auth_admin->acl_clear_prefetch(); + $this->auth_admin->acl_clear_prefetch(); } } From 5ed4dbb5b7aa4a0a00560eb7f3226d81ce54eca5 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 23 Jun 2013 22:40:55 +0530 Subject: [PATCH 367/575] [ticket/10838] separate database used mentioned in unit tests Separate database used for tests which is deleted each time tests are run information is added to unit tests. PHPBB3-10838 --- tests/RUNNING_TESTS.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index bde1455855..49c59fd928 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -47,9 +47,11 @@ Database Tests By default all tests requiring a database connection will use sqlite. If you do not have sqlite installed the tests will be skipped. If you wish to run the tests on a different database you have to create a test_config.php file within -your tests directory following the same format as phpBB's config.php. An -example for mysqli can be found below. More information on configuration -options can be found on the wiki (see below). +your tests directory following the same format as phpBB's config.php. Testing +makes use of a seperate database defined in this config file and before running +the tests each time this database is deleted. An example for mysqli can be +found below. More information on configuration options can be found on the +wiki (see below). Date: Thu, 27 Jun 2013 18:38:44 +0530 Subject: [PATCH 368/575] [ticket/10838] Fix missing data PHPBB3-10838 --- tests/RUNNING_TESTS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index 49c59fd928..d43e503e03 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -130,7 +130,7 @@ Running the tests requires your phpBB3 repository to be accessible through a local web server. As of PHP 5.4 a builtin webserver is available. If you are on PHP 5.3 you will also need to supply the URL to a webserver of your own in the 'tests/test_config.php' file. This is as simple as defining the -'$phpbb_functional_url', which contains the URL for the directory containing +'$phpbb_functional_url' variable, which contains the URL for the directory containing the board. Make sure you include the trailing slash. Note that without extensive changes to the test framework, you cannot use a board outside of the repository on which to run tests. @@ -145,7 +145,7 @@ configure the port the builtin webserver runs on using To then run the tests, you run PHPUnit, but use the phpunit.xml.functional config file instead of the default one. Specify this through the "-c" option: - phpunit -c phpunit.xml.functional + $ phpBB/vendor/bin/phpunit -c phpunit.xml.functional This will change your board's config.php file, but it makes a backup at config_dev.php, so you can restore it after the test run is complete. From 89393e11e8e10632520dc80dab638635d773e643 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 29 Jun 2013 18:42:17 +0530 Subject: [PATCH 369/575] [ticket/10838] Remove php 5.4 and builtin server references PHPBB3-10838 --- tests/RUNNING_TESTS.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index d43e503e03..a6448c9b09 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -127,8 +127,7 @@ Running ======= Running the tests requires your phpBB3 repository to be accessible through a -local web server. As of PHP 5.4 a builtin webserver is available. If you are -on PHP 5.3 you will also need to supply the URL to a webserver of your own in +local web server. You will need to supply the URL to the webserver in the 'tests/test_config.php' file. This is as simple as defining the '$phpbb_functional_url' variable, which contains the URL for the directory containing the board. Make sure you include the trailing slash. Note that without extensive @@ -137,11 +136,6 @@ on which to run tests. $phpbb_functional_url = 'http://localhost/phpBB3/'; -On PHP 5.4 you do not need the $phpbb_functional_url parameter but you can -configure the port the builtin webserver runs on using - - $phpbb_functional_port = 8000; - To then run the tests, you run PHPUnit, but use the phpunit.xml.functional config file instead of the default one. Specify this through the "-c" option: From 440986dc3f941835febf75a30f41b69cb748a15a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 29 Jun 2013 19:32:15 +0530 Subject: [PATCH 370/575] [ticket/10838] Fix URL for wiki and remove irrelevant line PHPBB3-10838 --- tests/RUNNING_TESTS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index a6448c9b09..23c74f4411 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -121,7 +121,7 @@ Functional tests Functional tests test software the way a user would. They simulate a user browsing the website, but they do these steps in an automated way. -phpBB allows you to write such tests. This document will tell you how. +phpBB allows you to write such tests. Running ======= @@ -148,4 +148,4 @@ More Information ================ Further information is available on phpbb wiki: -http://wiki.phpbb.com/Unit_Tests +http://wiki.phpbb.com/Automated_Tests From 1a58d188aab0c22965732621c8d93a00ea7a747e Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 14:42:05 -0500 Subject: [PATCH 371/575] [feature/twig] Prevent errors from empty user->style PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index b5fb8eb860..3cd37e04e9 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -186,7 +186,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->getLoader()->setPaths($style_paths); // Core style namespace from phpbb_style::set_style() - if ($this->user && ($style_names === array($this->user->style['style_path']) || $style_names[0] == $this->user->style['style_path'])) + if (isset($this->user->style['style_path']) && ($style_names === array($this->user->style['style_path']) || $style_names[0] == $this->user->style['style_path'])) { $this->twig->getLoader()->setPaths($style_paths, 'core'); } From 943728d3eff5b14b8936ccacf00dd729c9ac1d40 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 14:58:20 -0500 Subject: [PATCH 372/575] [feature/twig] Fix length replace in lexer PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index d9cc6f60ce..b32a9e4ffa 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -182,7 +182,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer $matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]); // Replace .test with test|length - $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9]+)#', ' $1|length', $matches[1]); + $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]); return ''; }; From 46d6899b466ce57e605ee6cf708204a1dd92004f Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 20:41:36 -0500 Subject: [PATCH 373/575] [feature/twig] Do not assign var by reference PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 3cd37e04e9..89f6189f41 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -265,8 +265,7 @@ class phpbb_template_twig implements phpbb_template return $result[0]; } - $context = &$this->get_template_vars(); - $this->twig->display($this->get_filename_from_handle($handle), $context); + $this->twig->display($this->get_filename_from_handle($handle), $this->get_template_vars()); return true; } @@ -329,7 +328,7 @@ class phpbb_template_twig implements phpbb_template return $this->twig->render($this->get_filename_from_handle($handle)); } - $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle))); + $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars()))); return true; } From 1c7e077fea245448315068bc724d852d2c9b087e Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:11:24 -0500 Subject: [PATCH 374/575] [feature/twig] Remove get_lang function (it's not used anywhere) PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 89f6189f41..496c0b21a8 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -178,7 +178,7 @@ class phpbb_template_twig implements phpbb_template * @param array $style_names List of style names in inheritance tree order * @return phpbb_template $this */ - public function set_style_names(array $style_names, $style_paths = array()) + public function set_style_names(array $style_names, array $style_paths = array()) { $this->style_names = $style_names; @@ -292,26 +292,6 @@ class phpbb_template_twig implements phpbb_template return false; } - /** - * Obtains language array. - * This is either lang property of $user property, or if - * it is not set an empty array. - * @return array language entries - */ - public function get_lang() - { - if (isset($this->user->lang)) - { - $lang = $this->user->lang; - } - else - { - $lang = array(); - } - - return $lang; - } - /** * Display the handle and assign the output to a template variable * or return the compiled result. From 8f303b376b5677bb0203c6ffae9c8c456cf1e075 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:16:36 -0500 Subject: [PATCH 375/575] [feature/twig] Don't forget to set the context when rendering! PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 496c0b21a8..6b0771f77b 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -305,7 +305,7 @@ class phpbb_template_twig implements phpbb_template { if ($return_content) { - return $this->twig->render($this->get_filename_from_handle($handle)); + return $this->twig->render($this->get_filename_from_handle($handle), $this->get_template_vars()); } $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars()))); From 16ebf14653c98cd842ee94a66d69b871a3ec0d25 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:18:09 -0500 Subject: [PATCH 376/575] [feature/twig] Clean up the messenger a little bit This should fix at least one bug, noticed we were using: $this->vars = &$this->tpl_obj->_rootref; Which hasn't been valid for a long+ time PHPBB3-11598 --- phpBB/includes/functions_messenger.php | 103 +++++++++++++++---------- 1 file changed, 61 insertions(+), 42 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index b117fda5b4..5f1251c34e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -27,8 +27,9 @@ class messenger var $mail_priority = MAIL_NORMAL_PRIORITY; var $use_queue = true; - var $tpl_obj = NULL; - var $tpl_msg = array(); + /** @var phpbb_template */ + protected $template; + var $eol = "\n"; /** @@ -210,6 +211,8 @@ class messenger { global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; + $this->setup_template(); + if (!trim($template_file)) { trigger_error('No template file for emailing set.', E_USER_ERROR); @@ -219,46 +222,43 @@ class messenger { // fall back to board default language if the user's language is // missing $template_file. If this does not exist either, - // $tpl->set_filenames will do a trigger_error + // $this->template->set_filenames will do a trigger_error $template_lang = basename($config['default_lang']); } - // tpl_msg now holds a template object we can use to parse the template file - if (!isset($this->tpl_msg[$template_lang . $template_file])) + if ($template_path) { - $style_resource_locator = new phpbb_style_resource_locator(); - $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); - $tpl = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); - $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl); + $template_paths = array( + $template_path, + ); + } + if (!$template_path) + { + $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $template_path .= $template_lang . '/email'; - $this->tpl_msg[$template_lang . $template_file] = $tpl; + $template_paths = array( + $template_path, + ); - $fallback_template_path = false; - - if (!$template_path) + // we can only specify default language fallback when the path is not a custom one for which we + // do not know the default language alternative + if ($template_lang !== basename($config['default_lang'])) { - $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; - $template_path .= $template_lang . '/email'; + $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $fallback_template_path .= basename($config['default_lang']) . '/email'; - // we can only specify default language fallback when the path is not a custom one for which we - // do not know the default language alternative - if ($template_lang !== basename($config['default_lang'])) - { - $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; - $fallback_template_path .= basename($config['default_lang']) . '/email'; - } + $template_paths[] = $fallback_template_path; } - - $style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), array(), ''); - - $tpl->set_filenames(array( - 'body' => $template_file . '.txt', - )); } - $this->tpl_obj = &$this->tpl_msg[$template_lang . $template_file]; - $this->vars = &$this->tpl_obj->_rootref; - $this->tpl_msg = ''; + $this->set_template_paths($template_lang . '_email', $template_paths); + + $this->template->set_filenames(array( + 'body' => $template_file . '.txt', + )); + + $this->vars = $this->template->get_template_vars(); return true; } @@ -268,22 +268,16 @@ class messenger */ function assign_vars($vars) { - if (!is_object($this->tpl_obj)) - { - return; - } + $this->setup_template(); - $this->tpl_obj->assign_vars($vars); + $this->template->assign_vars($vars); } function assign_block_vars($blockname, $vars) { - if (!is_object($this->tpl_obj)) - { - return; - } + $this->setup_template(); - $this->tpl_obj->assign_block_vars($blockname, $vars); + $this->template->assign_block_vars($blockname, $vars); } /** @@ -316,7 +310,7 @@ class messenger } // Parse message through template - $this->msg = trim($this->tpl_obj->assign_display('body')); + $this->msg = trim($this->template->assign_display('body')); // Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding $this->msg = str_replace("\r\n", "\n", $this->msg); @@ -643,6 +637,31 @@ class messenger unset($addresses); return true; } + + /** + * Setup template engine + */ + protected function setup_template() + { + global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; + + if ($this->template instanceof phpbb_template) + { + return; + } + + $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); + } + + /** + * Set template paths to load + */ + protected function set_template_paths($path_name, $paths) + { + $this->setup_template(); + + $this->template->set_style_names(array($path_name), $paths); + } } /** From e0f5e23032ce080c163439c1089a7b4994276da6 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:21:37 -0500 Subject: [PATCH 377/575] [feature/twig] Fixed tabs in environment.php PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 81 ++++++++++---------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index d20da965c3..34e6f09981 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -29,7 +29,7 @@ class phpbb_template_twig_environment extends Twig_Environment /** @var array **/ protected $namespaceLookUpOrder = array('__main__'); - public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) + public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; $this->phpbb_extensions = $phpbb_extensions; @@ -38,19 +38,20 @@ class phpbb_template_twig_environment extends Twig_Environment return parent::__construct($loader, $options); } - /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * - * @return string The cache file name - */ - public function ignoregetCacheFilename($name) - { - if (false === $this->cache) { - return false; - } -// @todo + /** + * Gets the cache filename for a given template. + * + * @param string $name The template name + * + * @return string The cache file name + */ + public function ignoregetCacheFilename($name) + { + if (false === $this->cache) + { + return false; + } + // @todo $file_path = $this->getLoader()->getCacheKey($name); foreach ($this->getLoader()->getNamespaces() as $namespace) { @@ -64,9 +65,9 @@ class phpbb_template_twig_environment extends Twig_Environment } // We probably should never get here under normal circumstances - return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '.php'; - return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '_' . md5($this->getLoader()->getCacheKey($name)) . '.php'; - } + return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '.php'; + return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '_' . md5($this->getLoader()->getCacheKey($name)) . '.php'; + } /** * Get the list of enabled phpBB extensions @@ -112,7 +113,7 @@ class phpbb_template_twig_environment extends Twig_Environment * Set the namespace look up order to load templates from * * @param array $namespace - * @return Twig_Environment + * @return Twig_Environment */ public function setNamespaceLookUpOrder($namespace) { @@ -121,28 +122,28 @@ class phpbb_template_twig_environment extends Twig_Environment return $this; } - /** - * Loads a template by name. - * - * @param string $name The template name - * @param integer $index The index if it is an embedded template - * - * @return Twig_TemplateInterface A template instance representing the given template name - */ - public function loadTemplate($name, $index = null) - { - if (strpos($name, '@') === false) - { - foreach ($this->namespaceLookUpOrder as $namespace) - { - try - { - if ($namespace === '__main__') - { - return parent::loadTemplate($name, $index); + /** + * Loads a template by name. + * + * @param string $name The template name + * @param integer $index The index if it is an embedded template + * + * @return Twig_TemplateInterface A template instance representing the given template name + */ + public function loadTemplate($name, $index = null) + { + if (strpos($name, '@') === false) + { + foreach ($this->namespaceLookUpOrder as $namespace) + { + try + { + if ($namespace === '__main__') + { + return parent::loadTemplate($name, $index); } - return parent::loadTemplate('@' . $namespace . '/' . $name, $index); + return parent::loadTemplate('@' . $namespace . '/' . $name, $index); } catch (Twig_Error_Loader $e) { @@ -154,9 +155,9 @@ class phpbb_template_twig_environment extends Twig_Environment } else { - return parent::loadTemplate($name, $index); + return parent::loadTemplate($name, $index); } - } + } /** * recursive helper to set variables into $context so that Twig can properly fetch them for display From 3dc40ad8443671081adc6f975a155f6f30cf3159 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:22:50 -0500 Subject: [PATCH 378/575] [feature/twig] Use correct case for variable name PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index 34e6f09981..a71958998a 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -27,7 +27,7 @@ class phpbb_template_twig_environment extends Twig_Environment protected $phpbb_root_path; /** @var array **/ - protected $namespaceLookUpOrder = array('__main__'); + protected $namespace_look_up_order = array('__main__'); public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) { @@ -106,7 +106,7 @@ class phpbb_template_twig_environment extends Twig_Environment */ public function getNamespaceLookUpOrder() { - return $this->namespaceLookUpOrder; + return $this->namespace_look_up_order; } /** @@ -117,7 +117,7 @@ class phpbb_template_twig_environment extends Twig_Environment */ public function setNamespaceLookUpOrder($namespace) { - $this->namespaceLookUpOrder = $namespace; + $this->namespace_look_up_order = $namespace; return $this; } From f90252395697aa4f1d0e606e4d92665b2293eb8d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:24:27 -0500 Subject: [PATCH 379/575] [feature/twig] Comments PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index a71958998a..f1ce6da38b 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -39,12 +39,11 @@ class phpbb_template_twig_environment extends Twig_Environment } /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * - * @return string The cache file name - */ + * Gets the cache filename for a given template. + * + * @param string $name The template name + * @return string The cache file name + */ public function ignoregetCacheFilename($name) { if (false === $this->cache) @@ -127,7 +126,6 @@ class phpbb_template_twig_environment extends Twig_Environment * * @param string $name The template name * @param integer $index The index if it is an embedded template - * * @return Twig_TemplateInterface A template instance representing the given template name */ public function loadTemplate($name, $index = null) @@ -160,11 +158,12 @@ class phpbb_template_twig_environment extends Twig_Environment } /** - * recursive helper to set variables into $context so that Twig can properly fetch them for display + * Recursive helper to set variables into $context so that Twig can properly fetch them for display * * @param array $data Data to set at the end of the chain * @param array $blocks Array of blocks to loop into still * @param mixed $current_location Current location in $context (recursive!) + * @return null */ public function context_recursive_loop_builder($data, $blocks, &$current_location) { From 3b9cb7faa7390ce244a69841de3618f4273cf3e0 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:29:15 -0500 Subject: [PATCH 380/575] [feature/twig] Fix call for previous change to var name case PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index f1ce6da38b..73375444da 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -132,7 +132,7 @@ class phpbb_template_twig_environment extends Twig_Environment { if (strpos($name, '@') === false) { - foreach ($this->namespaceLookUpOrder as $namespace) + foreach ($this->getNamespaceLookUpOrder() as $namespace) { try { From f249a527e5b3b07063e2203928677f40d6ba8646 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:32:10 -0500 Subject: [PATCH 381/575] [feature/twig] Should have been else PHPBB3-11598 --- phpBB/includes/functions_messenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 5f1251c34e..0222a57bcc 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -232,7 +232,7 @@ class messenger $template_path, ); } - if (!$template_path) + else { $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; $template_path .= $template_lang . '/email'; From f48effb00197a9ace8de82f3a961992215113257 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Mon, 1 Jul 2013 22:37:55 -0400 Subject: [PATCH 382/575] [feature/auth-refactor] Fix the actual cause of test failures Enables super globals before the new container is instantiated in the final step of installation to prevent issues caused by trying to create a phpbb_request object when super globals are disabled. PHPBB3-9734 --- phpBB/includes/request/request.php | 2 +- phpBB/install/install_install.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/request/request.php b/phpBB/includes/request/request.php index c0bb453c7c..ae3c526d89 100644 --- a/phpBB/includes/request/request.php +++ b/phpBB/includes/request/request.php @@ -79,7 +79,7 @@ class phpbb_request implements phpbb_request_interface // simulate request_order = GP $this->original_request = $this->input[phpbb_request_interface::REQUEST]; - $this->input[phpbb_request_interface::REQUEST] = (array)$this->input[phpbb_request_interface::POST] + (array)$this->input[phpbb_request_interface::GET]; + $this->input[phpbb_request_interface::REQUEST] = $this->input[phpbb_request_interface::POST] + $this->input[phpbb_request_interface::GET]; if ($disable_super_globals) { diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 5bf3f572d9..3d7b6f7c88 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -53,7 +53,7 @@ class install_install extends module function main($mode, $sub) { global $lang, $template, $language, $phpbb_root_path, $phpEx; - global $phpbb_container, $cache, $phpbb_log; + global $phpbb_container, $cache, $phpbb_log, $request; switch ($sub) { @@ -102,6 +102,9 @@ class install_install extends module break; case 'final': + // Enable super globals to prevent issues with the new phpbb_request object + $request->enable_super_globals(); + // Create a normal container now $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); From 883b0a9f8c3e102db8965069899dc2b97d1eb1ff Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 21:44:00 -0500 Subject: [PATCH 383/575] [feature/twig] Update phpbb_template interface Return $this wherever possible PHPBB3-11598 --- phpBB/includes/template/template.php | 34 ++++++++++++++++--------- phpBB/includes/template/twig/twig.php | 36 +++++++++++++++++++-------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index 15f0b6ee60..e506c2c278 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -17,24 +17,36 @@ if (!defined('IN_PHPBB')) interface phpbb_template { + + /** + * Clear the cache + * + * @return phpbb_template + */ + public function clear_cache(); + /** * Sets the template filenames for handles. * * @param array $filename_array Should be a hash of handle => filename pairs. + * @return phpbb_template $this */ public function set_filenames(array $filename_array); /** - * Sets the style names corresponding to style hierarchy being compiled + * Sets the style names/paths corresponding to style hierarchy being compiled * and/or rendered. * * @param array $style_names List of style names in inheritance tree order - * @return null + * @param array $style_paths List of style paths in inheritance tree order + * @return phpbb_template $this */ - public function set_style_names(array $style_names); + public function set_style_names(array $style_names, array $style_paths = array()); /** * Clears all variables and blocks assigned to this template. + * + * @return phpbb_template $this */ public function destroy(); @@ -42,6 +54,7 @@ interface phpbb_template * Reset/empty complete block * * @param string $blockname Name of block to destroy + * @return phpbb_template $this */ public function destroy_block_vars($blockname); @@ -53,7 +66,7 @@ interface phpbb_template * This function calls hooks. * * @param string $handle Handle to display - * @return bool True on success, false on failure + * @return phpbb_template $this */ public function display($handle); @@ -64,7 +77,7 @@ interface phpbb_template * @param string $handle Handle to operate on * @param string $template_var Template variable to assign compiled handle to * @param bool $return_content If true return compiled handle, otherwise assign to $template_var - * @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true + * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this */ public function assign_display($handle, $template_var = '', $return_content = true); @@ -72,6 +85,7 @@ interface phpbb_template * Assign key variable pairs from an array * * @param array $vararray A hash of variable name => value pairs + * @return phpbb_template $this */ public function assign_vars(array $vararray); @@ -82,6 +96,7 @@ interface phpbb_template * * @param string $varname Variable name * @param string $varval Value to assign to variable + * @return phpbb_template $this */ public function assign_var($varname, $varval); @@ -92,6 +107,7 @@ interface phpbb_template * * @param string $varname Variable name * @param string $varval Value to append to variable + * @return phpbb_template $this */ public function append_var($varname, $varval); @@ -99,6 +115,7 @@ interface phpbb_template * Assign key variable pairs from an array to a specified block * @param string $blockname Name of block to assign $vararray to * @param array $vararray A hash of variable name => value pairs + * @return phpbb_template $this */ public function assign_block_vars($blockname, array $vararray); @@ -130,11 +147,4 @@ interface phpbb_template * @return bool false on error, true on success */ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert'); - - /** - * Clear the cache - * - * @return phpbb_template - */ - public function clear_cache(); } diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 6b0771f77b..dbc36ecddf 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -172,10 +172,11 @@ class phpbb_template_twig implements phpbb_template } /** - * Sets the style names corresponding to style hierarchy being compiled + * Sets the style names/paths corresponding to style hierarchy being compiled * and/or rendered. * * @param array $style_names List of style names in inheritance tree order + * @param array $style_paths List of style paths in inheritance tree order * @return phpbb_template $this */ public function set_style_names(array $style_names, array $style_paths = array()) @@ -241,10 +242,13 @@ class phpbb_template_twig implements phpbb_template * Reset/empty complete block * * @param string $blockname Name of block to destroy + * @return phpbb_template $this */ public function destroy_block_vars($blockname) { - return $this->context->destroy_block_vars($blockname); + $this->context->destroy_block_vars($blockname); + + return $this; } /** @@ -255,7 +259,7 @@ class phpbb_template_twig implements phpbb_template * This function calls hooks. * * @param string $handle Handle to display - * @return bool True on success, false on failure + * @return phpbb_template $this */ public function display($handle) { @@ -267,7 +271,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->display($this->get_filename_from_handle($handle), $this->get_template_vars()); - return true; + return $this; } /** @@ -299,7 +303,7 @@ class phpbb_template_twig implements phpbb_template * @param string $handle Handle to operate on * @param string $template_var Template variable to assign compiled handle to * @param bool $return_content If true return compiled handle, otherwise assign to $template_var - * @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true + * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this */ public function assign_display($handle, $template_var = '', $return_content = true) { @@ -310,13 +314,14 @@ class phpbb_template_twig implements phpbb_template $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars()))); - return true; + return $this; } /** * Assign key variable pairs from an array * * @param array $vararray A hash of variable name => value pairs + * @return phpbb_template $this */ public function assign_vars(array $vararray) { @@ -324,6 +329,8 @@ class phpbb_template_twig implements phpbb_template { $this->assign_var($key, $val); } + + return $this; } /** @@ -333,10 +340,13 @@ class phpbb_template_twig implements phpbb_template * * @param string $varname Variable name * @param string $varval Value to assign to variable + * @return phpbb_template $this */ public function assign_var($varname, $varval) { - return $this->context->assign_var($varname, $varval); + $this->context->assign_var($varname, $varval); + + return $this; } /** @@ -346,24 +356,28 @@ class phpbb_template_twig implements phpbb_template * * @param string $varname Variable name * @param string $varval Value to append to variable + * @return phpbb_template $this */ public function append_var($varname, $varval) { - return $this->context->append_var($varname, $varval); + $this->context->append_var($varname, $varval); + + return $this; } - // Docstring is copied from phpbb_template_context method with the same name. /** * Assign key variable pairs from an array to a specified block * @param string $blockname Name of block to assign $vararray to * @param array $vararray A hash of variable name => value pairs + * @return phpbb_template $this */ public function assign_block_vars($blockname, array $vararray) { - return $this->context->assign_block_vars($blockname, $vararray); + $this->context->assign_block_vars($blockname, $vararray); + + return $this; } - // Docstring is copied from phpbb_template_context method with the same name. /** * Change already assigned key variable pair (one-dimensional - single loop entry) * From 274308148991a498eab875826d6c7615acdef108 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 2 Jul 2013 00:04:17 -0400 Subject: [PATCH 384/575] [feature/auth-refactor] Fix comment grammar PHPBB3-9734 --- phpBB/includes/auth/provider_db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/auth/provider_db.php b/phpBB/includes/auth/provider_db.php index a79d031048..894041c9cf 100644 --- a/phpBB/includes/auth/provider_db.php +++ b/phpBB/includes/auth/provider_db.php @@ -147,7 +147,7 @@ class phpbb_auth_provider_db implements phpbb_auth_provider_interface $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 much login attempts, we need to check for an confirm image + // 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) { From 156d5c671fb9db28fbbdcacb974093c2c52b0f5b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 10:13:16 -0500 Subject: [PATCH 385/575] [feature/twig] INCLUDEJS now uses the definition class This had to be done because, like DEFINE, setting variables to $context only affected the local file and any children, not parent templates. PHPBB3-11598 --- phpBB/includes/template/twig/definition.php | 19 +++++++++++++++++++ .../includes/template/twig/node/includejs.php | 4 ++-- .../prosilver/template/overall_footer.html | 2 +- .../subsilver2/template/overall_footer.html | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/includes/template/twig/definition.php index 110437eb32..6557b209eb 100644 --- a/phpBB/includes/template/twig/definition.php +++ b/phpBB/includes/template/twig/definition.php @@ -47,4 +47,23 @@ class phpbb_template_twig_definition return $this; } + + /** + * Append to a variable + * + * @param string $name + * @param string $value + * @return phpbb_template_twig_definition + */ + public function append($name, $value) + { + if (!isset($this->definitions[$name])) + { + $this->definitions[$name] = ''; + } + + $this->definitions[$name] .= $value; + + return $this; + } } diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index f4c26affa4..bba5d4ef91 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -31,9 +31,9 @@ class phpbb_template_twig_node_includejs extends Twig_Node $config = $this->environment->get_phpbb_config(); $compiler - ->write("\$context['SCRIPTS'] .= '';\n\n") + ->raw(" . '?assets_version=" . $config['assets_version'] . "\">');\n") ; } } diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 5422cc7c10..dcb8058ee1 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -56,7 +56,7 @@ -{SCRIPTS} +{$SCRIPTS} diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 3a29a0d752..2d794d9f71 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -14,7 +14,7 @@ -{SCRIPTS} +{$SCRIPTS} From 59d13d0535ab3687725d36f2dbe2ee64de294df8 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 11:02:55 -0500 Subject: [PATCH 386/575] [feature/twig] INCLUDEJS behavior now supports local relative paths This was done because T_TEMPLATE_PATH is not always correct for js files (e.g. the inheriting style does not include these). Now we use the Twig Loader to find the correct file to link to (most specific file first, then parent styles). Also allows using @namespace convention PHPBB3-11598 --- phpBB/includes/template/twig/node/includejs.php | 12 ++++++++++-- .../styles/prosilver/template/memberlist_search.html | 2 +- phpBB/styles/prosilver/template/overall_footer.html | 6 +++--- phpBB/styles/prosilver/template/posting_buttons.html | 2 +- phpBB/styles/prosilver/template/timezone_option.html | 2 +- .../prosilver/template/ucp_avatar_options.html | 2 +- .../styles/subsilver2/template/timezone_option.html | 2 +- .../subsilver2/template/ucp_groups_manage.html | 2 +- .../subsilver2/template/ucp_profile_avatar.html | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index bba5d4ef91..91b24e8068 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -31,9 +31,17 @@ class phpbb_template_twig_node_includejs extends Twig_Node $config = $this->environment->get_phpbb_config(); $compiler - ->write("\$context['definition']->append('SCRIPTS', '');\n") + ->raw(";\n") + ->write("if (!file_exists(\$js_file)) {\n") + ->indent() + ->write("\$js_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$js_file);\n") + ->outdent() + ->write("}\n") + ->write("\$context['definition']->append('SCRIPTS', '\n');\n") ; } } diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index 6d2d87a278..4f029627fc 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -38,7 +38,7 @@ function insert_single(user) // ]]> - +

      {L_FIND_USERNAME}

      diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index dcb8058ee1..5c88209ad8 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -53,9 +53,9 @@ - - - + + + {$SCRIPTS} diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 164e887f75..8a153a5ee8 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -52,7 +52,7 @@ // ]]> - +
      diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index 02c7868afb..072f235eb1 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -47,4 +47,4 @@
      - + diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html index 9b68f81557..0f27719f86 100644 --- a/phpBB/styles/subsilver2/template/timezone_option.html +++ b/phpBB/styles/subsilver2/template/timezone_option.html @@ -15,6 +15,6 @@ {S_TZ_OPTIONS} - + diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html index 13b8b8c6b7..b8e7e29481 100644 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html @@ -95,7 +95,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html index 885d46ef0b..60a816d00a 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html @@ -48,6 +48,6 @@ - + From 02a8150bb615b6319bcdfd170e3febe34117f16c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 11:08:52 -0500 Subject: [PATCH 387/575] [feature/twig] INCLUDEPHP behavior now supports local relative paths As a last resort, now we use the Twig Loader to find the correct file to include to (most specific file first, then parent styles). Also allows using @namespace convention. This is ONLY done if the specified path is not an absolute path AND the file does not exist relative to the phpBB root path. PHPBB3-11598 --- phpBB/includes/template/twig/node/includephp.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/includes/template/twig/node/includephp.php index 33142bf05a..a19ce43653 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/includes/template/twig/node/includephp.php @@ -52,11 +52,18 @@ class phpbb_template_twig_node_includephp extends Twig_Node ->raw(";\n") ->write("if (phpbb_is_absolute(\$location)) {\n") ->indent() + // Absolute path specified ->write("require(\$location);\n") ->outdent() + ->write("} else if (file_exists(\$this->getEnvironment()->get_phpbb_root_path() . \$location)) {\n") + ->indent() + // PHP file relative to phpbb_root_path + ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n") + ->outdent() ->write("} else {\n") ->indent() - ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n") + // Local path (behaves like INCLUDE) + ->write("require(\$this->getEnvironment()->getLoader()->getCacheKey(\$location));\n") ->outdent() ->write("}\n") ; From 9dce2b28af639d74a0e7eb15b7e1d4c29a5396a3 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 11:21:05 -0500 Subject: [PATCH 388/575] [feature/twig] Fix template test case PHPBB3-11598 --- tests/template/template_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 63f0c873b0..3e2cd5a387 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -29,7 +29,7 @@ class phpbb_template_template_test_case extends phpbb_test_case try { - $this->assertTrue($this->template->display($handle, false)); + $this->template->display($handle, false); } catch (Exception $exception) { From c6c064a1360cf6ef488adbe516cea5c4d7138f0c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 11:21:31 -0500 Subject: [PATCH 389/575] [feature/twig] Fix includejs test PHPBB3-11598 --- tests/template/template_includejs_test.php | 12 ++++++------ tests/template/templates/includejs.html | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index c0169bd385..67381b1fd4 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -18,12 +18,12 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes // Prepare correct result $scripts = array( - '', - '', - '', - '', - '', - '', + '', + '', + '', + '', + '', + '', ); // Run test diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index ef73700eeb..229f1ccc19 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -5,4 +5,4 @@ -{SCRIPTS} +{$SCRIPTS} From 709b3e98034e537fb3cbe5cbcb1511002c2d372d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 11:29:32 -0500 Subject: [PATCH 390/575] [feature/twig] Fix BBCode parser PHPBB3-11598 --- phpBB/includes/bbcode.php | 2 +- phpBB/includes/template/template.php | 7 +++++++ phpBB/includes/template/twig/twig.php | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index ecbb056045..fd00728510 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -138,7 +138,7 @@ class bbcode $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template); $style->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); - $this->template_filename = $style_resource_locator->get_source_file_for_handle('bbcode.html'); + $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); } $bbcode_ids = $rowset = $sql = array(); diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index e506c2c278..2b7c36ea7d 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -147,4 +147,11 @@ interface phpbb_template * @return bool false on error, true on success */ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert'); + + /** + * Get path to template for handle (required for BBCode parser) + * + * @return string + */ + public function get_source_file_for_handle($handle); } diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index dbc36ecddf..9d69136e0c 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -444,4 +444,14 @@ class phpbb_template_twig implements phpbb_template { return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle; } + + /** + * Get path to template for handle (required for BBCode parser) + * + * @return string + */ + public function get_source_file_for_handle($handle) + { + return $this->twig->getLoader()->getCacheKey($this->get_filename_from_handle($handle)); + } } From f39edcea3fb12c4f3ce9606772887c93d629f2d4 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:17:56 -0500 Subject: [PATCH 391/575] [feature/twig] Check the template context for language vars We output some language vars to the context (e.g. L_TITLE in the ACP). These do not exist in user->lang, so we must check the context vars first, if not in context, we output the result of user->lang. PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 37 ++++++++++++++++++++-- phpBB/includes/template/twig/twig.php | 1 + 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index 1ea5f7b662..a54c2b2509 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -17,11 +17,15 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_extension extends Twig_Extension { + /** @var phpbb_template_context */ + protected $context; + /** @var phpbb_user */ protected $user; - public function __construct($user) + public function __construct(phpbb_template_context $context, $user) { + $this->context = $context; $this->user = $user; } @@ -69,7 +73,7 @@ class phpbb_template_twig_extension extends Twig_Extension public function getFunctions() { return array( - new Twig_SimpleFunction('lang', array($this->user, 'lang')), + new Twig_SimpleFunction('lang', array($this, 'lang')), ); } @@ -140,4 +144,33 @@ class phpbb_template_twig_extension extends Twig_Extension return twig_slice($env, $item, $start, $end, $preserveKeys); } + + /** + * Get output for a language variable (L_FOO, LA_FOO) + * + * This function checks to see if the language var was outputted to $context + * (e.g. in the ACP, L_TITLE) + * If not, we return the result of $user->lang() + * + * @param string $lang name + * @return string + */ + function lang() + { + $args = func_get_args(); + $key = $args[0]; + + $context = $this->context->get_data_ref(); + $context_vars = $context['.'][0]; + + if (isset($context_vars['L_' . $key])) + { + return $context_vars['L_' . $key]; + } + + // LA_ is transformed into lang(\'$1\')|addslashes, so we should not + // need to check for it + + return call_user_func_array(array($this->user, 'lang'), $args); + } } diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 9d69136e0c..347db0b94c 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -134,6 +134,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->addExtension( new phpbb_template_twig_extension( + $this->context, $this->user ) ); From 985a233a78af7350387dfb9b8a924d09df767f05 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:22:42 -0500 Subject: [PATCH 392/575] [feature/twig] Remove reference to cachepath, it is not used publicly anymore PHPBB3-11598 --- phpBB/includes/style/style.php | 2 -- phpBB/includes/template/twig/twig.php | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index 493c4512a6..29cdcf0f7f 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -160,8 +160,6 @@ class phpbb_style $this->template->set_style_names($names, $appended_paths); } - //$this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_'; - return true; } diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 347db0b94c..98bd1ab89c 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -30,9 +30,12 @@ class phpbb_template_twig implements phpbb_template /** * Path of the cache directory for the template + * + * Cannot be changed during runtime. + * * @var string */ - public $cachepath = ''; + private $cachepath = ''; /** * phpBB root path From f102f609f5f0e424374aab55b8141c4e4a48b0fc Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:23:42 -0500 Subject: [PATCH 393/575] [feature/twig] Remove getCacheFilename function I was working on This can be addressed later if we decide we want to have more nicely named cache files. It does not need to be addressed now PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 30 -------------------- 1 file changed, 30 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index 73375444da..190d43f513 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -38,36 +38,6 @@ class phpbb_template_twig_environment extends Twig_Environment return parent::__construct($loader, $options); } - /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * @return string The cache file name - */ - public function ignoregetCacheFilename($name) - { - if (false === $this->cache) - { - return false; - } - // @todo - $file_path = $this->getLoader()->getCacheKey($name); - foreach ($this->getLoader()->getNamespaces() as $namespace) - { - foreach ($this->getLoader()->getPaths($namespace) as $path) - { - if (strpos($file_path, $path) === 0) - { - //return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $namespace . '/' . $name) . '.php'; - } - } - } - - // We probably should never get here under normal circumstances - return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '.php'; - return $this->getCache() . '/' . preg_replace('#[^a-zA-Z0-9_/]#', '_', $name) . '_' . md5($this->getLoader()->getCacheKey($name)) . '.php'; - } - /** * Get the list of enabled phpBB extensions * From 57c2d99e65ce107208db10721cff5b815ee3403c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:34:16 -0500 Subject: [PATCH 394/575] [feature/twig] Fix indentation PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 11 ++ phpBB/includes/template/twig/node/define.php | 26 ++-- phpBB/includes/template/twig/node/event.php | 54 ++++----- .../node/expression/binary/equalequal.php | 8 +- .../node/expression/binary/notequalequal.php | 8 +- phpBB/includes/template/twig/node/include.php | 28 ++--- .../includes/template/twig/node/includejs.php | 36 +++--- .../template/twig/node/includephp.php | 60 ++++----- phpBB/includes/template/twig/node/php.php | 28 ++--- .../template/twig/tokenparser/define.php | 76 ++++++------ .../template/twig/tokenparser/event.php | 46 +++---- .../includes/template/twig/tokenparser/if.php | 114 +++++++++--------- .../template/twig/tokenparser/include.php | 44 +++---- .../template/twig/tokenparser/includejs.php | 46 +++---- .../template/twig/tokenparser/includephp.php | 58 ++++----- .../template/twig/tokenparser/php.php | 52 ++++---- 16 files changed, 353 insertions(+), 342 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index 190d43f513..acb97cfad2 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -29,6 +29,15 @@ class phpbb_template_twig_environment extends Twig_Environment /** @var array **/ protected $namespace_look_up_order = array('__main__'); + /** + * Constructor + * + * @param phpbb_config $phpbb_config + * @param array $phpbb_extensions Array of enabled extensions (name => path) + * @param string $phpbb_root_path + * @param Twig_LoaderInterface $loader + * @param array $options Array of options to pass to Twig + */ public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; @@ -41,6 +50,8 @@ class phpbb_template_twig_environment extends Twig_Environment /** * Get the list of enabled phpBB extensions * + * Used in EVENT node + * * @return array */ public function get_phpbb_extensions() diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/includes/template/twig/node/define.php index 0c4d400767..499bbdc518 100644 --- a/phpBB/includes/template/twig/node/define.php +++ b/phpBB/includes/template/twig/node/define.php @@ -9,19 +9,19 @@ class phpbb_template_twig_node_define extends Twig_Node { - public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null) - { - parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); - } + public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null) + { + parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); + } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); if ($this->getAttribute('capture')) { $compiler @@ -45,5 +45,5 @@ class phpbb_template_twig_node_define extends Twig_Node ->raw($this->getNode('name')->getAttribute('name')) ->raw("', \$value);\n") ; - } + } } diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/includes/template/twig/node/event.php index 358c68dae5..6de270e19c 100644 --- a/phpBB/includes/template/twig/node/event.php +++ b/phpBB/includes/template/twig/node/event.php @@ -12,39 +12,39 @@ class phpbb_template_twig_node_event extends Twig_Node /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) - { - $this->environment = $environment; + public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) + { + $this->environment = $environment; - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); - $location = $this->getNode('expr')->getAttribute('name'); + $location = $this->getNode('expr')->getAttribute('name'); - foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) - { - $ext_namespace = str_replace('/', '_', $ext_namespace); + foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) + { + $ext_namespace = str_replace('/', '_', $ext_namespace); - if ($this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) - { - $compiler - ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") + if ($this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) + { + $compiler + ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") - // We set the namespace lookup order to be this extension first, then the main path - ->write("\$this->env->setNamespaceLookUpOrder(array('" . $ext_namespace . "', '__main__'));\n") - ->write("\$this->env->loadTemplate('@" . $ext_namespace . "/" . $location . ".html')->display(\$context);\n") - ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") - ; + // We set the namespace lookup order to be this extension first, then the main path + ->write("\$this->env->setNamespaceLookUpOrder(array('" . $ext_namespace . "', '__main__'));\n") + ->write("\$this->env->loadTemplate('@" . $ext_namespace . "/" . $location . ".html')->display(\$context);\n") + ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") + ; } } - } + } } diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/includes/template/twig/node/expression/binary/equalequal.php index 3a0c79c839..054f63ecf9 100644 --- a/phpBB/includes/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/includes/template/twig/node/expression/binary/equalequal.php @@ -9,8 +9,8 @@ class phpbb_template_twig_node_expression_binary_equalequal extends Twig_Node_Expression_Binary { - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('==='); - } + public function operator(Twig_Compiler $compiler) + { + return $compiler->raw('==='); + } } diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/includes/template/twig/node/expression/binary/notequalequal.php index b53bc56b2d..d8a1c411cf 100644 --- a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/includes/template/twig/node/expression/binary/notequalequal.php @@ -9,8 +9,8 @@ class phpbb_template_twig_node_expression_binary_notequalequal extends Twig_Node_Expression_Binary { - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('!=='); - } + public function operator(Twig_Compiler $compiler) + { + return $compiler->raw('!=='); + } } diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/includes/template/twig/node/include.php index 2a90dc19e4..a614cbe20f 100644 --- a/phpBB/includes/template/twig/node/include.php +++ b/phpBB/includes/template/twig/node/include.php @@ -9,14 +9,14 @@ class phpbb_template_twig_node_include extends Twig_Node_Include { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); $compiler ->write("\$location = ") @@ -26,15 +26,15 @@ class phpbb_template_twig_node_include extends Twig_Node_Include ->write("if (strpos(\$location, '@') === 0) {\n") ->indent() ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n") - ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") + ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") - // We set the namespace lookup order to be this namespace first, then the main path - ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n") + // We set the namespace lookup order to be this namespace first, then the main path + ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n") ->outdent() ->write("}\n") ; - parent::compile($compiler); + parent::compile($compiler); $compiler ->write("if (\$namespace) {\n") @@ -42,6 +42,6 @@ class phpbb_template_twig_node_include extends Twig_Node_Include ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") ->outdent() ->write("}\n") - ; - } + ; + } } diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index 91b24e8068..6d0d67c6c9 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -12,27 +12,27 @@ class phpbb_template_twig_node_includejs extends Twig_Node /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) - { - $this->environment = $environment; + public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) + { + $this->environment = $environment; - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); $config = $this->environment->get_phpbb_config(); - $compiler + $compiler ->write("\$js_file = ") - ->subcompile($this->getNode('expr')) + ->subcompile($this->getNode('expr')) ->raw(";\n") ->write("if (!file_exists(\$js_file)) {\n") ->indent() @@ -41,7 +41,7 @@ class phpbb_template_twig_node_includejs extends Twig_Node ->write("}\n") ->write("\$context['definition']->append('SCRIPTS', '\n');\n") - ; - } + ->raw(" . '?assets_version=" . $config['assets_version'] . "\">\n');\n") + ; + } } diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/includes/template/twig/node/includephp.php index a19ce43653..b5bb2ee9c9 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/includes/template/twig/node/includephp.php @@ -12,21 +12,21 @@ class phpbb_template_twig_node_includephp extends Twig_Node /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $ignoreMissing = false, $lineno, $tag = null) - { - $this->environment = $environment; + public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $ignoreMissing = false, $lineno, $tag = null) + { + $this->environment = $environment; - parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); - } + parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); + } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); $config = $this->environment->get_phpbb_config(); @@ -39,12 +39,12 @@ class phpbb_template_twig_node_includephp extends Twig_Node return; } - if ($this->getAttribute('ignore_missing')) { - $compiler - ->write("try {\n") - ->indent() - ; - } + if ($this->getAttribute('ignore_missing')) { + $compiler + ->write("try {\n") + ->indent() + ; + } $compiler ->write("\$location = ") @@ -68,15 +68,15 @@ class phpbb_template_twig_node_includephp extends Twig_Node ->write("}\n") ; - if ($this->getAttribute('ignore_missing')) { - $compiler - ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n\n") - ; - } - } + if ($this->getAttribute('ignore_missing')) { + $compiler + ->outdent() + ->write("} catch (Twig_Error_Loader \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n\n") + ; + } + } } diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/includes/template/twig/node/php.php index 953cd184a7..ebf4947e48 100644 --- a/phpBB/includes/template/twig/node/php.php +++ b/phpBB/includes/template/twig/node/php.php @@ -12,21 +12,21 @@ class phpbb_template_twig_node_php extends Twig_Node /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Text $text, phpbb_template_twig_environment $environment, $lineno, $tag = null) - { - $this->environment = $environment; + public function __construct(Twig_Node_Text $text, phpbb_template_twig_environment $environment, $lineno, $tag = null) + { + $this->environment = $environment; - parent::__construct(array('text' => $text), array(), $lineno, $tag); - } + parent::__construct(array('text' => $text), array(), $lineno, $tag); + } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); $config = $this->environment->get_phpbb_config(); @@ -42,5 +42,5 @@ class phpbb_template_twig_node_php extends Twig_Node $compiler ->raw($this->getNode('text')->getAttribute('data')) ; - } + } } diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/includes/template/twig/tokenparser/define.php index ebf7cb4c4a..ed77699b77 100644 --- a/phpBB/includes/template/twig/tokenparser/define.php +++ b/phpBB/includes/template/twig/tokenparser/define.php @@ -9,49 +9,49 @@ class phpbb_template_twig_tokenparser_define extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $this->parser->getExpressionParser()->parseExpression(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $this->parser->getExpressionParser()->parseExpression(); - $capture = false; - if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { - $stream->next(); - $value = $this->parser->getExpressionParser()->parseExpression(); + $capture = false; + if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { + $stream->next(); + $value = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } else { - $capture = true; + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } else { + $capture = true; - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } + $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } - return new phpbb_template_twig_node_define($capture, $name, $value, $lineno, $this->getTag()); - } + return new phpbb_template_twig_node_define($capture, $name, $value, $lineno, $this->getTag()); + } - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('ENDDEFINE'); - } + public function decideBlockEnd(Twig_Token $token) + { + return $token->test('ENDDEFINE'); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'DEFINE'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'DEFINE'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/includes/template/twig/tokenparser/event.php index 03810454ed..2a6d6b6457 100644 --- a/phpBB/includes/template/twig/tokenparser/event.php +++ b/phpBB/includes/template/twig/tokenparser/event.php @@ -9,30 +9,30 @@ class phpbb_template_twig_tokenparser_event extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream = $this->parser->getStream(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); - } + return new phpbb_template_twig_node_event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'EVENT'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'EVENT'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/if.php b/phpBB/includes/template/twig/tokenparser/if.php index 04ee048f94..939d679030 100644 --- a/phpBB/includes/template/twig/tokenparser/if.php +++ b/phpBB/includes/template/twig/tokenparser/if.php @@ -9,70 +9,70 @@ class phpbb_template_twig_tokenparser_if extends Twig_TokenParser_If { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $lineno = $token->getLine(); + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + $body = $this->parser->subparse(array($this, 'decideIfFork')); + $tests = array($expr, $body); + $else = null; - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'ELSE': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; + $end = false; + while (!$end) { + switch ($stream->next()->getValue()) { + case 'ELSE': + $stream->expect(Twig_Token::BLOCK_END_TYPE); + $else = $this->parser->subparse(array($this, 'decideIfEnd')); + break; - case 'ELSEIF': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; + case 'ELSEIF': + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + $body = $this->parser->subparse(array($this, 'decideIfFork')); + $tests[] = $expr; + $tests[] = $body; + break; - case 'ENDIF': - $end = true; - break; + case 'ENDIF': + $end = true; + break; - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "ELSE", "ELSEIF", or "ENDIF" to close the "IF" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } + default: + throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "ELSE", "ELSEIF", or "ENDIF" to close the "IF" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); + } + } - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } + return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); + } - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('ELSEIF', 'ELSE', 'ENDIF')); - } + public function decideIfFork(Twig_Token $token) + { + return $token->test(array('ELSEIF', 'ELSE', 'ENDIF')); + } - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('ENDIF')); - } + public function decideIfEnd(Twig_Token $token) + { + return $token->test(array('ENDIF')); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'IF'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'IF'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/includes/template/twig/tokenparser/include.php index 0f7e4faf8f..5b5105d23e 100644 --- a/phpBB/includes/template/twig/tokenparser/include.php +++ b/phpBB/includes/template/twig/tokenparser/include.php @@ -9,29 +9,29 @@ class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); - list($variables, $only, $ignoreMissing) = $this->parseArguments(); + list($variables, $only, $ignoreMissing) = $this->parseArguments(); - return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } + return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'INCLUDE'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDE'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/includes/template/twig/tokenparser/includejs.php index 0b46f315d2..962d01ac45 100644 --- a/phpBB/includes/template/twig/tokenparser/includejs.php +++ b/phpBB/includes/template/twig/tokenparser/includejs.php @@ -9,30 +9,30 @@ class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream = $this->parser->getStream(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); - } + return new phpbb_template_twig_node_includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'INCLUDEJS'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEJS'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/includes/template/twig/tokenparser/includephp.php index a81d663c09..57d804183b 100644 --- a/phpBB/includes/template/twig/tokenparser/includephp.php +++ b/phpBB/includes/template/twig/tokenparser/includephp.php @@ -9,39 +9,39 @@ class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); + $stream = $this->parser->getStream(); - $ignoreMissing = false; - if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) { - $stream->next(); - $stream->expect(Twig_Token::NAME_TYPE, 'missing'); + $ignoreMissing = false; + if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) { + $stream->next(); + $stream->expect(Twig_Token::NAME_TYPE, 'missing'); - $ignoreMissing = true; - } + $ignoreMissing = true; + } - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag()); - } + return new phpbb_template_twig_node_includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag()); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'INCLUDEPHP'; - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEPHP'; + } } diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/includes/template/twig/tokenparser/php.php index 7db57081e2..62e1c4fdcd 100644 --- a/phpBB/includes/template/twig/tokenparser/php.php +++ b/phpBB/includes/template/twig/tokenparser/php.php @@ -9,38 +9,38 @@ class phpbb_template_twig_tokenparser_php extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(Twig_Token $token) + { + $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); - } + return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } - public function decideEnd(Twig_Token $token) - { - return $token->test('ENDPHP'); - } + public function decideEnd(Twig_Token $token) + { + return $token->test('ENDPHP'); + } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'PHP'; + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'PHP'; } } From b4947f94ed23270d4dbb498afb31555da2c8af0d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:43:26 -0500 Subject: [PATCH 395/575] [feature/twig] Should compare to $this->test_path rather than hardcoded path PHPBB3-11598 --- tests/template/template_includejs_test.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 67381b1fd4..a57b219150 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -18,12 +18,12 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes // Prepare correct result $scripts = array( - '', - '', - '', - '', - '', - '', + '', + '', + '', + '', + '', + '', ); // Run test From 6bbe92a8d020f1fcfa8de0da50714acf88837295 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:50:55 -0500 Subject: [PATCH 396/575] [feature/twig] Move test_php back to template_test Was originally moved because I thought that a new test file might mean a new instance and the memory would be cleared, fixing the original problem, but that isn't true and it was fixed another way. PHPBB3-11598 --- tests/template/template_php_test.php | 30 ---------------------------- tests/template/template_test.php | 16 +++++++++++++++ 2 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 tests/template/template_php_test.php diff --git a/tests/template/template_php_test.php b/tests/template/template_php_test.php deleted file mode 100644 index fd4174953c..0000000000 --- a/tests/template/template_php_test.php +++ /dev/null @@ -1,30 +0,0 @@ -echo "test";'; - - $cache_dir = dirname($this->template->cachepath) . '/'; - $fp = fopen($cache_dir . 'php.html', 'w'); - fputs($fp, $template_text); - fclose($fp); - - $this->setup_engine(array('tpl_allow_php' => true)); - - $this->style->set_custom_style('tests', $cache_dir, array(), ''); - - $this->run_template('php.html', array(), array(), array(), 'test'); - } -} diff --git a/tests/template/template_test.php b/tests/template/template_test.php index ad4c8fbd17..26cfb3a8e4 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -369,6 +369,22 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->assertEquals($expecting, $this->display('append_var')); } + public function test_php() + { + $template_text = 'echo "test";'; + + $cache_dir = dirname($this->template->cachepath) . '/'; + $fp = fopen($cache_dir . 'php.html', 'w'); + fputs($fp, $template_text); + fclose($fp); + + $this->setup_engine(array('tpl_allow_php' => true)); + + $this->style->set_custom_style('tests', $cache_dir, array(), ''); + + $this->run_template('php.html', array(), array(), array(), 'test'); + } + public function alter_block_array_data() { return array( From 2507c648fe92de5363bd443839d1bb52f55795b4 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 12:59:23 -0500 Subject: [PATCH 397/575] [feature/twig] template->cachepath is now private, missed checking tests PHPBB3-11598 --- tests/template/includephp_test.php | 4 +++- tests/template/template_test.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index edf1e40bb8..a3dc9bd5c5 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -33,11 +33,13 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case public function test_includephp_absolute() { + global $phpbb_root_path; + $path_to_php = str_replace('\\', '/', dirname(__FILE__)) . '/templates/_dummy_include.php.inc'; $this->assertTrue(phpbb_is_absolute($path_to_php)); $template_text = "Path is absolute.\n"; - $cache_dir = dirname($this->template->cachepath) . '/'; + $cache_dir = dirname($phpbb_root_path . 'cache') . '/'; $fp = fopen($cache_dir . 'includephp_absolute.html', 'w'); fputs($fp, $template_text); fclose($fp); diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 26cfb3a8e4..1b3dda9b2a 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -371,9 +371,11 @@ class phpbb_template_template_test extends phpbb_template_template_test_case public function test_php() { + global $phpbb_root_path; + $template_text = 'echo "test";'; - $cache_dir = dirname($this->template->cachepath) . '/'; + $cache_dir = dirname($phpbb_root_path . 'cache') . '/'; $fp = fopen($cache_dir . 'php.html', 'w'); fputs($fp, $template_text); fclose($fp); From f9672e9b45a0f0d26702ca0f55a884a24e21bf77 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 2 Jul 2013 14:03:22 -0400 Subject: [PATCH 398/575] [feature/auth-refactor] Fix code style issue PHPBB3-9734 --- phpBB/includes/acp/acp_board.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 4d07f96c6f..24b913260b 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -660,8 +660,8 @@ class acp_board if ($fields['tpl']) { $template->assign_block_vars('auth_tpl', array( - 'TPL' => $fields['tpl']) - ); + 'TPL' => $fields['tpl'], + )); } unset($fields); } From 52bce2ce11013477f763d0e9fe4f6f724a970f29 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 13:43:02 -0500 Subject: [PATCH 399/575] [feature/twig] Prevent errors from mkdir if the dir already exists PHPBB3-11598 --- tests/test_framework/phpbb_test_case_helpers.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 50b2bf03ec..c4907d5ecf 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -94,7 +94,10 @@ class phpbb_test_case_helpers public function makedirs($path) { - mkdir($path, 0777, true); + if (!is_dir($path)) + { + mkdir($path, 0777, true); + } } static public function get_test_config() From 9652483ef49295379b28bdd842c846c0160fa1a1 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 2 Jul 2013 14:24:48 -0500 Subject: [PATCH 400/575] [feature/twig] Fix begin loop var regex PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index b32a9e4ffa..c7ab1590f5 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -134,10 +134,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer } } - // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar + // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar.VAR foreach ($parent_nodes as $node) { - $body = preg_replace('#([^a-zA-Z0-9])' . $node . '\.#', '$1', $body); + $body = preg_replace('#([^a-zA-Z0-9_])' . $node . '\.([a-zA-Z0-9_]+)\.#', '$1$2.', $body); } // Add current node to list of parent nodes for child nodes From fba3a9d600e9b79c8530b026fa781c99ea9ba833 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 2 Jul 2013 16:52:15 -0700 Subject: [PATCH 401/575] [ticket/11617] Missing U_ACTION in acp_captcha.php http://tracker.phpbb.com/browse/PHPBB3-11617 PHPBB3-11617 --- phpBB/includes/acp/acp_captcha.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 469a367bba..5b553d6a0d 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -124,6 +124,8 @@ class acp_captcha 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id), 'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(), 'CAPTCHA_SELECT' => $captcha_select, + + 'U_ACTION' => $this->u_action, )); } } From 5ef4987ffe15fe1fbafc9d9eae005f29a028dd3e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 2 Jul 2013 18:47:56 -0700 Subject: [PATCH 402/575] [ticket/11617] Remove spaces and tabs from empty lines PHPBB3-11617 --- phpBB/includes/acp/acp_captcha.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 5b553d6a0d..bfec7c27d8 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -124,7 +124,7 @@ class acp_captcha 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id), 'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(), 'CAPTCHA_SELECT' => $captcha_select, - + 'U_ACTION' => $this->u_action, )); } From 950a3a7d952cd361c9dc3c3ff8138b0becea6f74 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 3 Jul 2013 15:31:24 +0200 Subject: [PATCH 403/575] [ticket/11619] Some tests for get_remote_file(). PHPBB3-11619 --- tests/functions/get_remote_file_test.php | 75 ++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/functions/get_remote_file_test.php diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php new file mode 100644 index 0000000000..4032ca5b58 --- /dev/null +++ b/tests/functions/get_remote_file_test.php @@ -0,0 +1,75 @@ +markTestSkipped(sprintf( + 'Could not find a DNS record for hostname %s. ' . + 'Assuming network is down.', + $hostname + )); + } + + $errstr = $errno = null; + $file = get_remote_file($hostname, '/phpbb', '30x.txt', $errstr, $errno); + + $this->assertNotEquals( + 0, + strlen($file), + 'Failed asserting that the response is not empty.' + ); + + $this->assertSame( + '', + $errstr, + 'Failed asserting that the error string is empty.' + ); + + $this->assertSame( + 0, + $errno, + 'Failed asserting that the error number is 0 (i.e. no error occurred).' + ); + + $lines = explode("\n", $file); + + $this->assertGreaterThanOrEqual( + 2, + sizeof($lines), + 'Failed asserting that the version file has at least two lines.' + ); + + $this->assertStringStartsWith( + '3.', + $lines[0], + "Failed asserting that the first line of the version file starts with '3.'" + ); + + $this->assertNotSame( + false, + filter_var($lines[1], FILTER_VALIDATE_URL), + 'Failed asserting that the second line of the version file is a valid URL.' + ); + + $this->assertContains('http', $lines[1]); + $this->assertContains('phpbb.com', $lines[1], '', true); + } +} From 9e845d4641aa7f71ab713434a7a2e1edfd2876b4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 3 Jul 2013 15:31:40 +0200 Subject: [PATCH 404/575] [ticket/11619] Use HTTP/1.0 because of lack of chunked-encoding handling. PHPBB3-11619 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index a9d1db24a5..2f73858ea2 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3121,7 +3121,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) { - @fputs($fsock, "GET $directory/$filename HTTP/1.1\r\n"); + @fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n"); @fputs($fsock, "HOST: $host\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); From f1717412f3c222af5c3cfc0b248842ea9ec88c9f Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 3 Jul 2013 09:31:35 -0500 Subject: [PATCH 405/575] [feature/twig] Debugging test failures PHPBB3-11598 --- tests/test_framework/phpbb_test_case_helpers.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index c4907d5ecf..b83b1ca5ca 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -96,6 +96,12 @@ class phpbb_test_case_helpers { if (!is_dir($path)) { + // Testing + if (file_exists($path)) + { + echo $path; + } + mkdir($path, 0777, true); } } From 36f25ea09bd42de7bc705332edc5ce3c402bd844 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 10:12:09 -0500 Subject: [PATCH 406/575] [feature/twig] Change style->set_style to accept a list of base directories set_style now accepts an array containing a list of paths, e.g. array( 'ext/foo/bar/styles', 'styles'). Default: array('styles') Using this option allows us to set the style based on the user's preferred style (including the full tree), but use one or more base directories to add the paths from. The main use for this ability is so that extensions can call set_style, including their path and the phpBB styles path (or any others) and have their template files loaded from those directories (in the order given). PHPBB3-11598 --- phpBB/includes/style/style.php | 87 ++++++++++++++++----------- phpBB/includes/template/template.php | 2 +- phpBB/includes/template/twig/twig.php | 6 +- 3 files changed, 58 insertions(+), 37 deletions(-) diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index 29cdcf0f7f..b0bf3c1019 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -85,28 +85,56 @@ class phpbb_style } /** - * Set style location based on (current) user's chosen style. + * Get the style tree of the style preferred by the current user + * + * @return array Style tree, most specific first */ - public function set_style() + public function get_user_style() { - $style_path = $this->user->style['style_path']; - $style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array(); + return array_merge(array( + $this->user->style['style_path'], + ), + ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array() + ); + } - $names = array($style_path); - foreach ($style_dirs as $dir) - { - $names[] = $dir; - } - // Add 'all' path, used as last fallback path by events and extensions - //$names[] = 'all'; + /** + * Set style location based on (current) user's chosen style. + * + * @param array $style_directories The directories to add style paths for + * E.g. array('ext/foo/bar/styles', 'styles') + * Default: array('styles') (phpBB's style directory) + * @return bool true + */ + public function set_style($style_directories = array('styles')) + { + $this->names = $this->get_user_style(); $paths = array(); - foreach ($names as $name) + foreach ($style_directories as $directory) { - $paths[] = $this->get_style_path($name); + foreach ($this->names as $name) + { + $path = $this->get_style_path($name, $directory); + + if (is_dir($path)) + { + $paths[] = $path; + } + } } - return $this->set_custom_style($style_path, $paths, $names); + $this->provider->set_styles($paths); + $this->locator->set_paths($this->provider); + + foreach ($paths as &$path) + { + $path .= '/template/'; + } + + $this->template->set_style_names($this->names, $paths, ($style_directories === array('styles'))); + + return true; } /** @@ -118,6 +146,7 @@ class phpbb_style * @param array or string $paths Array of style paths, relative to current root directory * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). + * @return bool true */ public function set_custom_style($name, $paths, $names = array(), $template_path = false) { @@ -138,28 +167,15 @@ class phpbb_style if ($template_path !== false) { $this->locator->set_template_path($template_path); - - $appended_paths = array(); - foreach ($paths as $path) - { - $appended_paths[] = $path . '/' . $template_path; - } - - $this->template->set_style_names($names, $appended_paths); } - else + + foreach ($paths as &$path) { - $this->locator->set_default_template_path(); - - $appended_paths = array(); - foreach ($paths as $path) - { - $appended_paths[] = $path . '/template/'; - } - - $this->template->set_style_names($names, $appended_paths); + $path .= '/' . (($template_path !== false) ? $template_path : 'template/'); } + $this->template->set_style_names($names, $paths); + return true; } @@ -167,11 +183,14 @@ class phpbb_style * Get location of style directory for specific style_path * * @param string $path Style path, such as "prosilver" + * @param string $style_base_directory The base directory the style is in + * E.g. 'styles', 'ext/foo/bar/styles' + * Default: 'styles' * @return string Path to style directory, relative to current path */ - public function get_style_path($path) + public function get_style_path($path, $style_base_directory = 'styles') { - return $this->phpbb_root_path . 'styles/' . $path; + return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; } /** diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index 2b7c36ea7d..89a01e924d 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -41,7 +41,7 @@ interface phpbb_template * @param array $style_paths List of style paths in inheritance tree order * @return phpbb_template $this */ - public function set_style_names(array $style_names, array $style_paths = array()); + public function set_style_names(array $style_names, array $style_paths); /** * Clears all variables and blocks assigned to this template. diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 98bd1ab89c..dd2c1a4023 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -181,9 +181,11 @@ class phpbb_template_twig implements phpbb_template * * @param array $style_names List of style names in inheritance tree order * @param array $style_paths List of style paths in inheritance tree order + * @param bool $is_core True if the style names are the "core" styles for this page load + * Core means the main phpBB template files * @return phpbb_template $this */ - public function set_style_names(array $style_names, array $style_paths = array()) + public function set_style_names(array $style_names, array $style_paths, $is_core = false) { $this->style_names = $style_names; @@ -191,7 +193,7 @@ class phpbb_template_twig implements phpbb_template $this->twig->getLoader()->setPaths($style_paths); // Core style namespace from phpbb_style::set_style() - if (isset($this->user->style['style_path']) && ($style_names === array($this->user->style['style_path']) || $style_names[0] == $this->user->style['style_path'])) + if ($is_core) { $this->twig->getLoader()->setPaths($style_paths, 'core'); } From 884a5b06fa2e300285a67885d0652d201c7a330a Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 10:13:05 -0500 Subject: [PATCH 407/575] [feature/twig] Add set_style function to controller helper PHPBB3-11598 --- phpBB/config/services.yml | 1 + phpBB/includes/controller/helper.php | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 23205169b9..f364bf5574 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -68,6 +68,7 @@ services: controller.helper: class: phpbb_controller_helper arguments: + - @style - @template - @user - %core.root_path% diff --git a/phpBB/includes/controller/helper.php b/phpBB/includes/controller/helper.php index 74410ddfd1..ec09757a5d 100644 --- a/phpBB/includes/controller/helper.php +++ b/phpBB/includes/controller/helper.php @@ -23,6 +23,12 @@ use Symfony\Component\HttpFoundation\Response; */ class phpbb_controller_helper { + /** + * Style object + * @var phpbb_style + */ + protected $style; + /** * Template object * @var phpbb_template @@ -50,19 +56,36 @@ class phpbb_controller_helper /** * Constructor * + * @param phpbb_style $style Style object * @param phpbb_template $template Template object * @param phpbb_user $user User object * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(phpbb_style $style, phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) { + $this->style = $style; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } + /** + * Set style location based on (current) user's chosen style. + * + * @param array $style_directories The directories to add style paths for + * E.g. array('ext/foo/bar/styles', 'styles') + * Default: array('styles') (phpBB's style directory) + * @return phpbb_controller_helper $this + */ + public function set_style($style_base_directory = array('styles')) + { + $this->style->set_style($style_base_directory); + + return $this; + } + /** * Automate setting up the page and creating the response object. * From 5c39f26cd27d5e4a1debfa24407825906f42d346 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 10:13:46 -0500 Subject: [PATCH 408/575] [feature/twig] Call set_style in the foo/bar controller for functional tests PHPBB3-11598 --- tests/functional/fixtures/ext/foo/bar/controller/controller.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php index 5a91b5f681..331f6addfb 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php @@ -9,6 +9,8 @@ class phpbb_ext_foo_bar_controller { $this->template = $template; $this->helper = $helper; + + $this->helper->set_style(array('ext/foo/bar/styles', 'styles')); } public function handle() From 84e0943c7bee5061bc53aed2a14f82751d238bf8 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 10:22:12 -0500 Subject: [PATCH 409/575] [feature/twig] Indentation and comments PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 18 +++++++++--------- phpBB/includes/template/twig/twig.php | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index a54c2b2509..f73b99a4c1 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -59,9 +59,9 @@ class phpbb_template_twig_extension extends Twig_Extension */ public function getFilters() { - return array( - new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), - new Twig_SimpleFilter('addslashes', 'addslashes'), + return array( + new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + new Twig_SimpleFilter('addslashes', 'addslashes'), ); } @@ -72,8 +72,8 @@ class phpbb_template_twig_extension extends Twig_Extension */ public function getFunctions() { - return array( - new Twig_SimpleFunction('lang', array($this, 'lang')), + return array( + new Twig_SimpleFunction('lang', array($this, 'lang')), ); } @@ -86,7 +86,7 @@ class phpbb_template_twig_extension extends Twig_Extension { return array( array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), ), array( // precedence settings are copied from similar operators in Twig core extension @@ -109,9 +109,9 @@ class phpbb_template_twig_extension extends Twig_Extension 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); + 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); } /** diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index dd2c1a4023..621bfe0f4f 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -102,7 +102,9 @@ class phpbb_template_twig implements phpbb_template * Constructor. * * @param string $phpbb_root_path phpBB root path - * @param user $user current user + * @param string $php_ext php extension (typically 'php') + * @param phpbb_config $config + * @param phpbb_user $user * @param phpbb_template_context $context template context * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked * @param string $adm_relative_path relative path to adm directory From 81f27fd87ee2e8ffc1ad1ad06c5b255c5436e86c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 10:40:14 -0500 Subject: [PATCH 410/575] [feature/twig] Add test to make sure nested loops get the correct S_ROW_COUNT PHPBB3-11598 --- tests/template/template_test.php | 7 +++++++ tests/template/templates/loop_nested2.html | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/template/templates/loop_nested2.html diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 1b3dda9b2a..4970ce0363 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -125,6 +125,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", ), + array( + 'loop_nested2.html', + array(), + array('outer' => array(array(), array()), 'outer.middle' => array(array(), array())), + array(), + "o0o1m01m11", + ), array( 'define.html', array(), diff --git a/tests/template/templates/loop_nested2.html b/tests/template/templates/loop_nested2.html new file mode 100644 index 0000000000..3eeeb5e36a --- /dev/null +++ b/tests/template/templates/loop_nested2.html @@ -0,0 +1,6 @@ + +o{outer.S_ROW_COUNT} + +m{outer.middle.S_ROW_COUNT}{outer.S_ROW_COUNT} + + From 2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 11:08:36 -0500 Subject: [PATCH 411/575] [feature/twig] Attempt to automatically set style dir for ext controllers Extension authors can change it themselves if necessary PHPBB3-11598 --- phpBB/config/services.yml | 2 +- phpBB/includes/controller/resolver.php | 28 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index f364bf5574..bb9879601c 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -79,7 +79,7 @@ services: arguments: - @user - @service_container - - @ext.finder + - @style cron.task_collection: class: phpbb_di_service_collection diff --git a/phpBB/includes/controller/resolver.php b/phpBB/includes/controller/resolver.php index ee469aa9c8..2c7d112748 100644 --- a/phpBB/includes/controller/resolver.php +++ b/phpBB/includes/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) { $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 ($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); } From bb56c1a391feff9c54d05f64e49c6d1f93ac2bce Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 11:09:33 -0500 Subject: [PATCH 412/575] Revert "[feature/twig] Call set_style in the foo/bar controller for functional tests" This reverts commit 5c39f26cd27d5e4a1debfa24407825906f42d346. --- tests/functional/fixtures/ext/foo/bar/controller/controller.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php index 331f6addfb..5a91b5f681 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php @@ -9,8 +9,6 @@ class phpbb_ext_foo_bar_controller { $this->template = $template; $this->helper = $helper; - - $this->helper->set_style(array('ext/foo/bar/styles', 'styles')); } public function handle() From 1ce33c1ff62426d030731cca100c4119bcd5265d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 11:12:26 -0500 Subject: [PATCH 413/575] [feature/twig] Safety check for 2fb48d6 PHPBB3-11598 --- phpBB/includes/controller/resolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/controller/resolver.php b/phpBB/includes/controller/resolver.php index 2c7d112748..e44aa14b55 100644 --- a/phpBB/includes/controller/resolver.php +++ b/phpBB/includes/controller/resolver.php @@ -96,7 +96,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface $controller_dir = explode('_', get_class($controller_object)); // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if ($controller_dir[1] === 'ext') + if (isset($controller_dir[3]) && $controller_dir[1] === 'ext') { $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles'; From b7ede06835ba784b81365946f057adf75ae7592b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 11:16:44 -0500 Subject: [PATCH 414/575] [feature/twig] Make style dependency optional for resolver PHPBB3-11598 --- phpBB/includes/controller/resolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/controller/resolver.php b/phpBB/includes/controller/resolver.php index e44aa14b55..95dfc8da8e 100644 --- a/phpBB/includes/controller/resolver.php +++ b/phpBB/includes/controller/resolver.php @@ -50,7 +50,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface * @param ContainerInterface $container ContainerInterface object * @param phpbb_style $style */ - public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style) + public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null) { $this->user = $user; $this->container = $container; @@ -96,7 +96,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface $controller_dir = explode('_', get_class($controller_object)); // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (isset($controller_dir[3]) && $controller_dir[1] === 'ext') + if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') { $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles'; From 5f03321fac6ce888cb870e158c685bf839c25f07 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 12:44:12 -0500 Subject: [PATCH 415/575] [feature/twig] Support using Twig filters on {VAR}, add masks for Twig tags Now we can do {L_TITLE|upper}, {SITENAME|lower}, etc We can also use all the Twig tags in our own syntax. E.g. = {% block foo %]. All tags are the same as the Twig tag names, but are in uppercase. PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 76 ++++++++++++++++++++++++-- phpBB/includes/template/twig/twig.php | 2 +- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index c7ab1590f5..50ef403231 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -19,8 +19,9 @@ class phpbb_template_twig_lexer extends Twig_Lexer { public function tokenize($code, $filename = null) { - $valid_starting_tokens = array( - // Commented out tokens are handled separately from the main replace + // Our phpBB tags + // Commented out tokens are handled separately from the main replace + $phpbb_tags = array( /*'BEGIN', 'BEGINELSE', 'END',*/ @@ -39,6 +40,34 @@ class phpbb_template_twig_lexer extends Twig_Lexer 'EVENT', ); + // Twig tag masks + $twig_tags = array( + 'autoescape', + 'endautoescape', + 'block', + 'endblock', + 'use', + 'extends', + 'embed', + 'filter', + 'endfilter', + 'flush', + 'for', + 'endfor', + 'macro', + 'endmacro', + 'import', + 'from', + 'sandbox', + 'endsandbox', + 'set', + 'endset', + 'spaceless', + 'endspaceless', + 'verbatim', + 'endverbatim', + ); + // Fix tokens that may have inline variables (e.g. with Twig style, {% TOKEN %} // This also strips outer parenthesis, becomes - $code = preg_replace('##', '{% $1 $2 %}', $code); + $code = preg_replace('##', '{% $1 $2 %}', $code); + + // Replace all of our twig masks with Twig code (e.g. with {% block $1 %}) + $code = $this->replace_twig_tag_masks($code, $twig_tags); // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }} - $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)}#', '{{ lang(\'$1\') }}', $code); + // Appends any filters after lang() + $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2 }}', $code); // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)}#', '{{ lang(\'$1\')|addslashes }}', $code); + // Appends any filters after lang(), but before addslashes + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+)?}}#', '{{ lang(\'$1\')$2|addslashes }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} - $code = preg_replace('#{([a-zA-Z0-9_\.]+)}#', '{{ $1 }}', $code); + // Appends any filters + $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ $1$2 }}', $code); return parent::tokenize($code, $filename); } @@ -227,4 +262,33 @@ class phpbb_template_twig_lexer extends Twig_Lexer return $code; } + + /** + * Replace Twig tag masks with Twig tag calls + * + * E.g. with {% block foo %} + * + * @param string $code + * @param array $twig_tags All tags we want to create a mask for + * @return string + */ + protected function replace_twig_tag_masks($code, $twig_tags) + { + $callback = function ($matches) + { + $matches[1] = strtolower($matches[1]); + + return "{% {$matches[1]}{$matches[2]}%}"; + }; + + foreach ($twig_tags as &$tag) + { + $tag = strtoupper($tag); + } + + // twig_tags is an array of the twig tags, which are all lowercase, but we use all uppercase tags + $code = preg_replace_callback('##',$callback, $code); + + return $code; + } } diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 621bfe0f4f..47e346ad1e 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -132,7 +132,7 @@ class phpbb_template_twig implements phpbb_template array( 'cache' => $this->cachepath, 'debug' => defined('DEBUG'), - 'auto_reload' => (bool) $this->config['load_tplcompile'], + 'auto_reload' => true,//(bool) $this->config['load_tplcompile'], 'autoescape' => false, ) ); From 864465761f45fec2732381849ee9959d7ad9b45d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 13:19:03 -0500 Subject: [PATCH 416/575] [feature/twig] Fix debug code PHPBB3-11598 --- phpBB/includes/template/twig/twig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index 47e346ad1e..621bfe0f4f 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -132,7 +132,7 @@ class phpbb_template_twig implements phpbb_template array( 'cache' => $this->cachepath, 'debug' => defined('DEBUG'), - 'auto_reload' => true,//(bool) $this->config['load_tplcompile'], + 'auto_reload' => (bool) $this->config['load_tplcompile'], 'autoescape' => false, ) ); From 4f6cb9acbdc8b3564fa30e8e291e5fa669a409b9 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 13:19:21 -0500 Subject: [PATCH 417/575] [feature/twig] Fix helper URL test PHPBB3-11598 --- tests/controller/helper_url_test.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index e376efde66..3206460caf 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -51,8 +51,11 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $this->style_resource_locator = new phpbb_style_resource_locator(); $this->user = $this->getMock('phpbb_user'); $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context()); + $this->style_resource_locator = new phpbb_style_resource_locator(); + $this->style_provider = new phpbb_style_path_provider(); + $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->style_resource_locator, $this->style_provider, $this->template); - $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php'); + $helper = new phpbb_controller_helper($this->style, $this->template, $this->user, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); } } From fdbdd8bfd92795098b4f9a704a677972e611f455 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 13:22:41 -0500 Subject: [PATCH 418/575] [feature/twig] Fix a regular expression PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 50ef403231..394c3077a6 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -98,7 +98,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} // Appends any filters after lang(), but before addslashes - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+)?}}#', '{{ lang(\'$1\')$2|addslashes }}', $code); + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} // Appends any filters From 8cf6dbd95035f71ea8cff0f2f8d834b91b243429 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 13:25:50 -0500 Subject: [PATCH 419/575] [feature/twig] Trying some new debug code for this mkdir error PHPBB3-11598 --- tests/test_framework/phpbb_test_case_helpers.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index b83b1ca5ca..fdc09fbeec 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -94,16 +94,12 @@ class phpbb_test_case_helpers public function makedirs($path) { - if (!is_dir($path)) + if (is_dir($path) || file_exists($path)) { - // Testing - if (file_exists($path)) - { - echo $path; - } - - mkdir($path, 0777, true); + var_dump($path); + exit; } + mkdir($path, 0777, true); } static public function get_test_config() From 24be21636656bf636738449488da3810e489b4a7 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 13:49:56 -0500 Subject: [PATCH 420/575] [feature/twig] Attempt to automatically set style dir for ext modules Extension authors can change it themselves if necessary PHPBB3-11598 --- phpBB/includes/functions_module.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 0d387ace6d..5a8ac276cd 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -455,7 +455,7 @@ class p_master */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $style; $module_path = $this->include_path . $this->p_class; $icat = request_var('icat', ''); @@ -491,6 +491,24 @@ class p_master $this->module = new $class_name($this); + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('_', get_class($this->module)); + + // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... + if (!is_null($this->style) && isset($module_dir[3]) && $module_dir[1] === 'ext') + { + $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles'; + + if (is_dir($module_style_dir)) + { + $style->set_style(array($module_style_dir, 'styles')); + } + } + // We pre-define the action parameter we are using all over the place if (defined('IN_ADMIN')) { From 38700a80f805ae32632d88254e714699b8435f61 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 14:09:50 -0500 Subject: [PATCH 421/575] [feature/twig] Fix copy/pasted code PHPBB3-11598 --- phpBB/includes/functions_module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 5a8ac276cd..85ff41500f 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -499,7 +499,7 @@ class p_master $module_dir = explode('_', get_class($this->module)); // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (!is_null($this->style) && isset($module_dir[3]) && $module_dir[1] === 'ext') + if (isset($module_dir[3]) && $module_dir[1] === 'ext') { $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles'; From 5afcb1d5f4f642d3ad6d8c1a98295e6b115d9a77 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 4 Jul 2013 21:15:02 +0200 Subject: [PATCH 422/575] [ticket/11600] Remove duplicate test case PHPBB3-11600 --- tests/avatar/manager_test.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index ec2cba3f53..4ebe79c9cd 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -95,7 +95,6 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase array(AVATAR_GALLERY, null), array(AVATAR_UPLOAD, null), array(AVATAR_REMOTE, null), - array(AVATAR_GALLERY, null), ); } @@ -117,7 +116,6 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase array(AVATAR_GALLERY, 'avatar.driver.local'), array(AVATAR_UPLOAD, 'avatar.driver.upload'), array(AVATAR_REMOTE, 'avatar.driver.remote'), - array(AVATAR_GALLERY, 'avatar.driver.local'), ); } From 53496e6a473f1e5563f733365cbeaf275c2fd0af Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 15:21:57 -0500 Subject: [PATCH 423/575] [feature/twig] acp module tpls are in ext/adm, ucp/mcp in styles/ PHPBB3-11598 --- phpBB/includes/functions_module.php | 56 +++++++++++++++++++---------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 85ff41500f..df0327db0f 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -455,7 +455,7 @@ class p_master */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $style; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $phpbb_style; $module_path = $this->include_path . $this->p_class; $icat = request_var('icat', ''); @@ -491,27 +491,27 @@ class p_master $this->module = new $class_name($this); - /* - * If this is an extension module, we'll try to automatically set - * the style paths for the extension (the ext author can change them - * if necessary). - */ - $module_dir = explode('_', get_class($this->module)); - - // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (isset($module_dir[3]) && $module_dir[1] === 'ext') - { - $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles'; - - if (is_dir($module_style_dir)) - { - $style->set_style(array($module_style_dir, 'styles')); - } - } - // We pre-define the action parameter we are using all over the place if (defined('IN_ADMIN')) { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('_', get_class($this->module)); + + // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... + if (isset($module_dir[3]) && $module_dir[1] === 'ext') + { + $module_style_dir = $phpbb_root_path .'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style'; + + if (is_dir($module_style_dir)) + { + $phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), ''); + } + } + // Is first module automatically enabled a duplicate and the category not passed yet? if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate']) { @@ -523,6 +523,24 @@ class p_master } else { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('_', get_class($this->module)); + + // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... + if (isset($module_dir[3]) && $module_dir[1] === 'ext') + { + $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles'; + + if (is_dir($phpbb_root_path . $module_style_dir)) + { + $phpbb_style->set_style(array($module_style_dir, 'styles')); + } + } + // If user specified the module url we will use it... if ($module_url !== false) { From 0f3086a54bf2a9c83876a135738bdf130e0f0844 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 15:24:42 -0500 Subject: [PATCH 424/575] [feature/twig] Spacing PHPBB3-11598 --- phpBB/includes/functions_module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index df0327db0f..99c24fcb19 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -504,7 +504,7 @@ class p_master // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... if (isset($module_dir[3]) && $module_dir[1] === 'ext') { - $module_style_dir = $phpbb_root_path .'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style'; + $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style'; if (is_dir($module_style_dir)) { From 25b4732845941c488f3667ef7ec4afdc0e69d274 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 4 Jul 2013 15:32:04 -0500 Subject: [PATCH 425/575] [feature/twig] Remove debug code PHPBB3-11598 --- tests/test_framework/phpbb_test_case_helpers.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index fdc09fbeec..50b2bf03ec 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -94,11 +94,6 @@ class phpbb_test_case_helpers public function makedirs($path) { - if (is_dir($path) || file_exists($path)) - { - var_dump($path); - exit; - } mkdir($path, 0777, true); } From 5746c8d96ff50b7c520e3070270311992685fcce Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 4 Jul 2013 17:12:55 -0400 Subject: [PATCH 426/575] [feature/auth-refactor] Move auth providers to separate directory Moves the provider files to their own directory per bantu's suggestion. PHPBB3-9734 --- .../auth/{provider_apache.php => provider/apache.php} | 0 .../includes/auth/{provider_db.php => provider/db.php} | 0 phpBB/includes/auth/provider/index.htm | 10 ++++++++++ .../{provider_interface.php => provider/interface.php} | 0 .../auth/{provider_ldap.php => provider/ldap.php} | 0 5 files changed, 10 insertions(+) rename phpBB/includes/auth/{provider_apache.php => provider/apache.php} (100%) rename phpBB/includes/auth/{provider_db.php => provider/db.php} (100%) create mode 100644 phpBB/includes/auth/provider/index.htm rename phpBB/includes/auth/{provider_interface.php => provider/interface.php} (100%) rename phpBB/includes/auth/{provider_ldap.php => provider/ldap.php} (100%) diff --git a/phpBB/includes/auth/provider_apache.php b/phpBB/includes/auth/provider/apache.php similarity index 100% rename from phpBB/includes/auth/provider_apache.php rename to phpBB/includes/auth/provider/apache.php diff --git a/phpBB/includes/auth/provider_db.php b/phpBB/includes/auth/provider/db.php similarity index 100% rename from phpBB/includes/auth/provider_db.php rename to phpBB/includes/auth/provider/db.php diff --git a/phpBB/includes/auth/provider/index.htm b/phpBB/includes/auth/provider/index.htm new file mode 100644 index 0000000000..ee1f723a7d --- /dev/null +++ b/phpBB/includes/auth/provider/index.htm @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpBB/includes/auth/provider_interface.php b/phpBB/includes/auth/provider/interface.php similarity index 100% rename from phpBB/includes/auth/provider_interface.php rename to phpBB/includes/auth/provider/interface.php diff --git a/phpBB/includes/auth/provider_ldap.php b/phpBB/includes/auth/provider/ldap.php similarity index 100% rename from phpBB/includes/auth/provider_ldap.php rename to phpBB/includes/auth/provider/ldap.php From 192c9d8f867a0c7d1a81d23bc4fb11c63fe1ec40 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 09:37:40 -0500 Subject: [PATCH 427/575] [feature/twig] Removing template/renderer.php (no longer used) PHPBB3-11598 --- phpBB/includes/template/renderer.php | 35 ---------------------------- 1 file changed, 35 deletions(-) delete mode 100644 phpBB/includes/template/renderer.php diff --git a/phpBB/includes/template/renderer.php b/phpBB/includes/template/renderer.php deleted file mode 100644 index 30e234a733..0000000000 --- a/phpBB/includes/template/renderer.php +++ /dev/null @@ -1,35 +0,0 @@ - Date: Fri, 5 Jul 2013 09:56:25 -0500 Subject: [PATCH 428/575] [feature/twig] Docs/typehinting for Twig extension PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index f73b99a4c1..5704468013 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -23,12 +23,24 @@ class phpbb_template_twig_extension extends Twig_Extension /** @var phpbb_user */ protected $user; - public function __construct(phpbb_template_context $context, $user) + /** + * Constructor + * + * @param phpbb_template_context $context + * @param phpbb_user $user + * @return phpbb_template_twig_extension + */ + public function __construct(phpbb_template_context $context, phpbb_user $user) { $this->context = $context; $this->user = $user; } + /** + * Get the name of this extension + * + * @return string + */ public function getName() { return 'phpbb'; From c1a600277d07c2dbb3ebd410f87acb22627a9d60 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 09:57:55 -0500 Subject: [PATCH 429/575] [feature/twig] Nicer code for get_user_style.php() PHPBB3-11598 --- phpBB/includes/style/style.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index b0bf3c1019..06c16fdef4 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -91,11 +91,16 @@ class phpbb_style */ public function get_user_style() { - return array_merge(array( - $this->user->style['style_path'], - ), - ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array() + $style_list = array( + $this->user->style['style_path'], ); + + if ($this->user->style['style_parent_id']) + { + $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree']))); + } + + return $style_list; } /** From 2674740573a226dae36dc81faf8eb5453e01a31d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 10:03:48 -0500 Subject: [PATCH 430/575] [feature/twig] Spacing PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index 5704468013..e23dd4f119 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -144,7 +144,7 @@ class phpbb_template_twig_extension extends Twig_Extension { // When end is > 1, subset will end on the last item in an array with the specified $end // This is different from slice in that it is the number we end on rather than the number - // of items to grab (length) + // of items to grab (length) // Start must always be the actual starting number for this calculation (not negative) $start = ($start < 0) ? sizeof($item) + $start : $start; From 81f0715b8ef89e3a03a285a0c0f4639351449e9a Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 10:05:20 -0500 Subject: [PATCH 431/575] [feature/twig] Clarify comment PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index e23dd4f119..6b066f1bd3 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -139,7 +139,7 @@ class phpbb_template_twig_extension extends Twig_Extension */ function loop_subset(Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) { - // We do almost the same thing as array_slice, except when $end is positive + // We do almost the same thing as Twig's slice (array_slice), except when $end is positive if ($end >= 1) { // When end is > 1, subset will end on the last item in an array with the specified $end From 1f4a717f9ec925d84b589547ce6c93a17ae863e9 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 10:29:24 -0500 Subject: [PATCH 432/575] [feature/twig] Add template test for ===, !== PHPBB3-11598 --- tests/template/template_test.php | 22 ++++++++++++++++++---- tests/template/templates/if.html | 8 ++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 4970ce0363..b7c3a08512 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -46,28 +46,42 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array(), array(), - '03', + '03!false', ), array( 'if.html', array('S_VALUE' => true), array(), array(), - '1', + '1!false', ), array( 'if.html', array('S_VALUE' => true, 'S_OTHER_VALUE' => true), array(), array(), - '1', + '1!false', ), array( 'if.html', array('S_VALUE' => false, 'S_OTHER_VALUE' => true), array(), array(), - '2', + '2!false', + ), + array( + 'if.html', + array('S_TEST' => false), + array(), + array(), + '03false', + ), + array( + 'if.html', + array('S_TEST' => 0), + array(), + array(), + '03!false', ), array( 'loop.html', diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html index eed431019e..c010aff7fa 100644 --- a/tests/template/templates/if.html +++ b/tests/template/templates/if.html @@ -9,3 +9,11 @@ 04 + + +false + + + +!false + From 13c356545465a457b8c55dd9638f89165bab6271 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 12:11:59 -0500 Subject: [PATCH 433/575] [feature/twig] Remove style dependency for controller helper If a controller wants to use set_style, it can just use phpbb_style PHPBB3-11598 --- phpBB/config/services.yml | 1 - phpBB/includes/controller/helper.php | 25 +------------------------ tests/controller/helper_url_test.php | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 3d951e2a45..e228b3d83f 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -69,7 +69,6 @@ services: controller.helper: class: phpbb_controller_helper arguments: - - @style - @template - @user - %core.root_path% diff --git a/phpBB/includes/controller/helper.php b/phpBB/includes/controller/helper.php index ec09757a5d..74410ddfd1 100644 --- a/phpBB/includes/controller/helper.php +++ b/phpBB/includes/controller/helper.php @@ -23,12 +23,6 @@ use Symfony\Component\HttpFoundation\Response; */ class phpbb_controller_helper { - /** - * Style object - * @var phpbb_style - */ - protected $style; - /** * Template object * @var phpbb_template @@ -56,36 +50,19 @@ class phpbb_controller_helper /** * Constructor * - * @param phpbb_style $style Style object * @param phpbb_template $template Template object * @param phpbb_user $user User object * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_style $style, phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) { - $this->style = $style; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } - /** - * Set style location based on (current) user's chosen style. - * - * @param array $style_directories The directories to add style paths for - * E.g. array('ext/foo/bar/styles', 'styles') - * Default: array('styles') (phpBB's style directory) - * @return phpbb_controller_helper $this - */ - public function set_style($style_base_directory = array('styles')) - { - $this->style->set_style($style_base_directory); - - return $this; - } - /** * Automate setting up the page and creating the response object. * diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php index 3206460caf..6686b77e8f 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -55,7 +55,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case $this->style_provider = new phpbb_style_path_provider(); $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->style_resource_locator, $this->style_provider, $this->template); - $helper = new phpbb_controller_helper($this->style, $this->template, $this->user, '', 'php'); + $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php'); $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); } } From 05984be2c002133d1dd7f546e4238749b275f9f6 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 12:47:50 -0500 Subject: [PATCH 434/575] [feature/twig] Fix S_NUM_ROWS assignment PHPBB3-11598 --- phpBB/includes/template/context.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/context.php b/phpBB/includes/template/context.php index e3ad6be46c..c5ce7422b9 100644 --- a/phpBB/includes/template/context.php +++ b/phpBB/includes/template/context.php @@ -165,7 +165,7 @@ class phpbb_template_context // Set S_NUM_ROWS foreach ($str[$blocks[$blockcount]] as &$mod_block) { - $mod_block['S_NUM_ROWS'] = $blockcount; + $mod_block['S_NUM_ROWS'] = sizeof($str[$blocks[$blockcount]]); } } else From 9ac61565fdb0fd3464b9c974b506f084f24e0bbd Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 12:48:02 -0500 Subject: [PATCH 435/575] [feature/twig] Add template tests for S_NUM_ROWS and S_BLOCK_NAME PHPBB3-11598 --- tests/template/template_test.php | 33 ++++++++++++++++++++++- tests/template/templates/loop_nested.html | 4 +-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index b7c3a08512..d99e91bae4 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -516,4 +516,35 @@ EOT $this->template->alter_block_array($alter_block, $vararray, $key, $mode); $this->assertEquals(str_replace(array("\n", "\r", "\t"), '', $expect), str_replace(array("\n", "\r", "\t"), '', $this->display('test')), $description); } -} \ No newline at end of file + + public function test_more_alter_block_array() + { + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + $this->template->assign_var('TEST_MORE', true); + + // @todo Change this + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + + $expect = 'outer - 0[outer|3]middle - 0[middle|1]outer - 1[outer|3]middle - 0[middle|2]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring template is built correctly before modification'); + + $this->template->alter_block_array('outer', array()); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion'); + + $this->template->alter_block_array('outer', array('VARIABLE' => 'test'), 2, 'change'); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); + } +} diff --git a/tests/template/templates/loop_nested.html b/tests/template/templates/loop_nested.html index 3b5ffa5cac..cf099ecc15 100644 --- a/tests/template/templates/loop_nested.html +++ b/tests/template/templates/loop_nested.html @@ -1,6 +1,6 @@ -outer - {outer.S_ROW_COUNT} - {outer.VARIABLE} +outer - {outer.S_ROW_COUNT} - {outer.VARIABLE}[{outer.S_BLOCK_NAME}|{outer.S_NUM_ROWS}] -middle - {outer.middle.S_ROW_COUNT} - {outer.middle.VARIABLE} +middle - {outer.middle.S_ROW_COUNT} - {outer.middle.VARIABLE}[{outer.middle.S_BLOCK_NAME}|{outer.middle.S_NUM_ROWS}] From 99ddbe1adc8dad125fa996f1f568bdcfa2b80d95 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 12:55:32 -0500 Subject: [PATCH 436/575] [feature/twig] Can't use typehint here, causes tests to fail PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index 6b066f1bd3..c4d36050f9 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -30,7 +30,7 @@ class phpbb_template_twig_extension extends Twig_Extension * @param phpbb_user $user * @return phpbb_template_twig_extension */ - public function __construct(phpbb_template_context $context, phpbb_user $user) + public function __construct(phpbb_template_context $context, $user) { $this->context = $context; $this->user = $user; From c5c34ff831faf96368d34012dc65bdb9451227aa Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 13:10:35 -0500 Subject: [PATCH 437/575] [feature/twig] Add check for defined IN_PHPBB in all new Twig related files PHPBB3-11598 --- phpBB/includes/template/twig/node/define.php | 9 +++++++++ phpBB/includes/template/twig/node/event.php | 9 +++++++++ .../template/twig/node/expression/binary/equalequal.php | 9 +++++++++ .../twig/node/expression/binary/notequalequal.php | 9 +++++++++ phpBB/includes/template/twig/node/include.php | 9 +++++++++ phpBB/includes/template/twig/node/includejs.php | 9 +++++++++ phpBB/includes/template/twig/node/includephp.php | 9 +++++++++ phpBB/includes/template/twig/node/php.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/define.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/event.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/if.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/include.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/includejs.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/includephp.php | 9 +++++++++ phpBB/includes/template/twig/tokenparser/php.php | 9 +++++++++ 15 files changed, 135 insertions(+) diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/includes/template/twig/node/define.php index 499bbdc518..fcb19cc773 100644 --- a/phpBB/includes/template/twig/node/define.php +++ b/phpBB/includes/template/twig/node/define.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_define extends Twig_Node { public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null) diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/includes/template/twig/node/event.php index 6de270e19c..984ba35244 100644 --- a/phpBB/includes/template/twig/node/event.php +++ b/phpBB/includes/template/twig/node/event.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_event extends Twig_Node { /** @var Twig_Environment */ diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/includes/template/twig/node/expression/binary/equalequal.php index 054f63ecf9..8ec2069114 100644 --- a/phpBB/includes/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/includes/template/twig/node/expression/binary/equalequal.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_expression_binary_equalequal extends Twig_Node_Expression_Binary { public function operator(Twig_Compiler $compiler) diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/includes/template/twig/node/expression/binary/notequalequal.php index d8a1c411cf..96f32c502e 100644 --- a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/includes/template/twig/node/expression/binary/notequalequal.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_expression_binary_notequalequal extends Twig_Node_Expression_Binary { public function operator(Twig_Compiler $compiler) diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/includes/template/twig/node/include.php index a614cbe20f..5c6ae1bbcf 100644 --- a/phpBB/includes/template/twig/node/include.php +++ b/phpBB/includes/template/twig/node/include.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_include extends Twig_Node_Include { /** diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index 6d0d67c6c9..943eb89ace 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_includejs extends Twig_Node { /** @var Twig_Environment */ diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/includes/template/twig/node/includephp.php index b5bb2ee9c9..dbe54f0e1a 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/includes/template/twig/node/includephp.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_includephp extends Twig_Node { /** @var Twig_Environment */ diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/includes/template/twig/node/php.php index ebf4947e48..c11539ea7f 100644 --- a/phpBB/includes/template/twig/node/php.php +++ b/phpBB/includes/template/twig/node/php.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_node_php extends Twig_Node { /** @var Twig_Environment */ diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/includes/template/twig/tokenparser/define.php index ed77699b77..4ea15388c4 100644 --- a/phpBB/includes/template/twig/tokenparser/define.php +++ b/phpBB/includes/template/twig/tokenparser/define.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_define extends Twig_TokenParser { /** diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/includes/template/twig/tokenparser/event.php index 2a6d6b6457..e4dddd6dcc 100644 --- a/phpBB/includes/template/twig/tokenparser/event.php +++ b/phpBB/includes/template/twig/tokenparser/event.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_event extends Twig_TokenParser { /** diff --git a/phpBB/includes/template/twig/tokenparser/if.php b/phpBB/includes/template/twig/tokenparser/if.php index 939d679030..77881ad5f0 100644 --- a/phpBB/includes/template/twig/tokenparser/if.php +++ b/phpBB/includes/template/twig/tokenparser/if.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_if extends Twig_TokenParser_If { /** diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/includes/template/twig/tokenparser/include.php index 5b5105d23e..520f9fd1a0 100644 --- a/phpBB/includes/template/twig/tokenparser/include.php +++ b/phpBB/includes/template/twig/tokenparser/include.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include { /** diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/includes/template/twig/tokenparser/includejs.php index 962d01ac45..b02b2f89ba 100644 --- a/phpBB/includes/template/twig/tokenparser/includejs.php +++ b/phpBB/includes/template/twig/tokenparser/includejs.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser { /** diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/includes/template/twig/tokenparser/includephp.php index 57d804183b..13fe6de8a6 100644 --- a/phpBB/includes/template/twig/tokenparser/includephp.php +++ b/phpBB/includes/template/twig/tokenparser/includephp.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser { /** diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/includes/template/twig/tokenparser/php.php index 62e1c4fdcd..197980a59a 100644 --- a/phpBB/includes/template/twig/tokenparser/php.php +++ b/phpBB/includes/template/twig/tokenparser/php.php @@ -7,6 +7,15 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + + class phpbb_template_twig_tokenparser_php extends Twig_TokenParser { /** From 0ffbdc80d1eafdcbdc6e2aa4c82fa7e081c0a502 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 13:15:10 -0500 Subject: [PATCH 438/575] [feature/twig] context_recursive_loop_builder isn't used anymore, removing it PHPBB3-11598 --- phpBB/includes/template/twig/environment.php | 22 -------------------- 1 file changed, 22 deletions(-) diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/includes/template/twig/environment.php index acb97cfad2..b60cd72325 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/includes/template/twig/environment.php @@ -137,26 +137,4 @@ class phpbb_template_twig_environment extends Twig_Environment return parent::loadTemplate($name, $index); } } - - /** - * Recursive helper to set variables into $context so that Twig can properly fetch them for display - * - * @param array $data Data to set at the end of the chain - * @param array $blocks Array of blocks to loop into still - * @param mixed $current_location Current location in $context (recursive!) - * @return null - */ - public function context_recursive_loop_builder($data, $blocks, &$current_location) - { - $block = array_shift($blocks); - - if (empty($blocks)) - { - $current_location[$block] = $data; - } - else - { - $this->context_recursive_loop_builder($data, $blocks, $current_location[$block]); - } - } } From 8d11a147f5ab05443b243559f248e7e52e2e9faf Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 14:10:57 -0500 Subject: [PATCH 439/575] [feature/twig] Use Twig mask for IF statements instead of our own tokenparser PHPBB3-11598 --- phpBB/includes/template/twig/extension.php | 1 - phpBB/includes/template/twig/lexer.php | 8 +- .../includes/template/twig/tokenparser/if.php | 87 ------------------- 3 files changed, 6 insertions(+), 90 deletions(-) delete mode 100644 phpBB/includes/template/twig/tokenparser/if.php diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index c4d36050f9..5ffc45e75a 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -54,7 +54,6 @@ class phpbb_template_twig_extension extends Twig_Extension public function getTokenParsers() { return array( - new phpbb_template_twig_tokenparser_if, new phpbb_template_twig_tokenparser_define, new phpbb_template_twig_tokenparser_include, new phpbb_template_twig_tokenparser_includejs, diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 394c3077a6..5f76c44481 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -24,12 +24,12 @@ class phpbb_template_twig_lexer extends Twig_Lexer $phpbb_tags = array( /*'BEGIN', 'BEGINELSE', - 'END',*/ + 'END', 'IF', 'ELSE', 'ELSEIF', 'ENDIF', - /*'DEFINE', + 'DEFINE', 'UNDEFINE',*/ 'ENDDEFINE', 'INCLUDE', @@ -44,6 +44,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer $twig_tags = array( 'autoescape', 'endautoescape', + 'if', + 'elseif', + 'else', + 'endif', 'block', 'endblock', 'use', diff --git a/phpBB/includes/template/twig/tokenparser/if.php b/phpBB/includes/template/twig/tokenparser/if.php deleted file mode 100644 index 77881ad5f0..0000000000 --- a/phpBB/includes/template/twig/tokenparser/if.php +++ /dev/null @@ -1,87 +0,0 @@ -getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'ELSE': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'ELSEIF': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'ENDIF': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "ELSE", "ELSEIF", or "ENDIF" to close the "IF" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('ELSEIF', 'ELSE', 'ENDIF')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('ENDIF')); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'IF'; - } -} From 921d44aa4dfa307eb3b7e4f24befabb07e727812 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Jul 2013 14:17:46 -0500 Subject: [PATCH 440/575] [feature/twig] Put $SCRIPTS below overall_footer_after, use includejs for core Moved below overall_footer_after so events can add JS files in that event. PHPBB3-11598 --- phpBB/styles/prosilver/template/overall_footer.html | 4 +++- phpBB/styles/subsilver2/template/overall_footer.html | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 5c88209ad8..eef9f53409 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -56,8 +56,10 @@ -{$SCRIPTS} + +{$SCRIPTS} + diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 2d794d9f71..d2b30c22a0 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -13,9 +13,11 @@ - -{$SCRIPTS} + + +{$SCRIPTS} + From 300867ab1a688449d0a26061fa63155db1bfc101 Mon Sep 17 00:00:00 2001 From: Matthew Fonda Date: Fri, 12 Apr 2013 16:44:36 +0000 Subject: [PATCH 441/575] [ticket/11630] Improvements to the PHP lint pre-commit hook The PHP lint pre-commit hook fails to display any output when an error other than a parse error is decteced. Additionally, the hook may not display any meaningful output depending on php.ini settings. This commit removes the dependency on php.ini. PHPBB3-11630 --- git-tools/hooks/pre-commit | 57 ++++---------------------------------- 1 file changed, 5 insertions(+), 52 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 03babe47cd..06ba15c7fa 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -33,9 +33,7 @@ else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi -error=0 errors="" - if ! which "$PHP_BIN" >/dev/null 2>&1 then echo "PHP Syntax check failed:" @@ -73,63 +71,18 @@ do # check the staged file content for syntax errors # using php -l (lint) - # note: if display_errors=stderr in php.ini, - # parse errors are printed on stderr; otherwise - # they are printed on stdout. - # we filter everything other than parse errors - # with a grep below, therefore it should be safe - # to combine stdout and stderr in all circumstances - result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1) + result=$(git cat-file -p $sha | "$PHP_BIN" -n -l -ddisplay_errors\=1 -derror_reporting\=E_ALL -dlog_errrors\=0 2>&1) if [ $? -ne 0 ] then - error=1 # Swap back in correct filenames - errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g") + errors=$(echo "$errors"; echo "$result" | grep ':' | sed -e "s@in - on@in $filename on@g") fi done unset IFS -if [ $error -eq 1 ] +if [ -n "$errors" ] then - echo "PHP Syntax check failed:" - # php "display errors" (display_errors php.ini value) - # and "log errors" (log_errors php.ini value). - # these are independent settings - see main/main.c in php source. - # the "log errors" setting produces output which - # starts with "PHP Parse error:"; the "display errors" - # setting produces output starting with "Parse error:". - # if both are turned on php dumps the parse error twice. - # therefore here we try to grep for one version and - # if that yields no results grep for the other version. - # - # other fun php facts: - # - # 1. in cli, display_errors and log_errors have different - # destinations by default. display_errors prints to - # standard output and log_errors prints to standard error. - # whether these destinations make sense is left - # as an exercise for the reader. - # 2. as mentioned above, with all output turned on - # php will print parse errors twice, one time on stdout - # and one time on stderr. - # 3. it is possible to set both display_errors and log_errors - # to off. if this is done php will print the text - # "Errors parsing " but will not say what - # the errors are. useful behavior, this. - # 4. on my system display_errors defaults to on and - # log_errors defaults to off, therefore providing - # by default one copy of messages. your mileage may vary. - # 5. by setting display_errors=stderr and log_errors=on, - # both sets of messages will be printed on stderr. - # 6. php-cgi binary, given display_errors=stderr and - # log_errors=on, still prints both sets of messages - # on stderr, but formats one set as an html fragment. - # 7. your entry here? ;) - $echo_e "$errors" | grep "^Parse error:" - if [ $? -ne 0 ] - then - # match failed - $echo_e "$errors" | grep "^PHP Parse error:" - fi + echo "PHP Syntax check failed: " + $echo_e "$errors" exit 1 fi From bdaa40bb550c18f9c7feb4e2448a31a53e2a5bd2 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 6 Jul 2013 12:58:52 -0500 Subject: [PATCH 442/575] [ticket/11420] Fix comments, license link PHPBB3-11420 --- .../310/notification_options_reconvert.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php b/phpBB/includes/db/migration/data/310/notification_options_reconvert.php index 9f2d4b2d75..d994d7ec5f 100644 --- a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php +++ b/phpBB/includes/db/migration/data/310/notification_options_reconvert.php @@ -3,7 +3,7 @@ * * @package migration * @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -31,8 +31,11 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d /** * Perform the conversion (separate for testability) + * + * @param phpbb_db_sql_insert_buffer $insert_buffer + * @param string $insert_table */ - public function perform_conversion($insert_buffer, $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); @@ -58,7 +61,7 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d $notification_methods[] = 'jabber'; } - // Notifications for posts + // Notifications for posts foreach (array('post', 'topic') as $item_type) { $this->add_method_rows( @@ -88,6 +91,15 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d $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( From 9f85a4d118544e6097005ea3ef37e1e627838278 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 6 Jul 2013 12:59:26 -0500 Subject: [PATCH 443/575] [ticket/11420] Use !==, === when comparing strings PHPBB3-11420 --- tests/notification/convert_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index fdd0d19e72..e07c144e16 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -72,7 +72,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case { $return = array(); - if ($method != '') + if ($method !== '') { $return[] = array( 'item_type' => $type, @@ -83,7 +83,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case ); } - if ($method == 'email' || $method == 'both') + if ($method === 'email' || $method === 'both') { $return[] = array( 'item_type' => $type, @@ -94,7 +94,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case ); } - if ($method == 'jabber' || $method == 'both') + if ($method === 'jabber' || $method === 'both') { $return[] = array( 'item_type' => $type, From 0894a1377013965657f29a42202a630ba83daf95 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 6 Jul 2013 16:26:56 -0500 Subject: [PATCH 444/575] [feature/twig] If DEBUG, EVENT will always look for new/missing tpl event files If debug mode is enabled, lets check for new/removed EVENT templates on page load rather than at compile. This is slower, but makes developing extensions easier (no need to purge the cache when a new event template file is added) PHPBB3-11598 --- phpBB/includes/template/twig/node/event.php | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/includes/template/twig/node/event.php index 984ba35244..971dea14fa 100644 --- a/phpBB/includes/template/twig/node/event.php +++ b/phpBB/includes/template/twig/node/event.php @@ -43,17 +43,37 @@ class phpbb_template_twig_node_event extends Twig_Node { $ext_namespace = str_replace('/', '_', $ext_namespace); - if ($this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) + if (defined('DEBUG')) + { + // If debug mode is enabled, lets check for new/removed EVENT + // templates on page load rather than at compile. This is + // slower, but makes developing extensions easier (no need to + // purge the cache when a new event template file is added) + $compiler + ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") + ->indent() + ; + } + + if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) { $compiler ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") // We set the namespace lookup order to be this extension first, then the main path - ->write("\$this->env->setNamespaceLookUpOrder(array('" . $ext_namespace . "', '__main__'));\n") - ->write("\$this->env->loadTemplate('@" . $ext_namespace . "/" . $location . ".html')->display(\$context);\n") + ->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n") + ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n") ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") ; } + + if (defined('DEBUG')) + { + $compiler + ->outdent() + ->write("}\n\n") + ; + } } } } From 70a553e0b5471c32469961be40e408bd544b670f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 8 Jul 2013 15:16:37 -0500 Subject: [PATCH 445/575] [feature/twig] Variable regular expressions should be lazy PHPBB3-11598 --- phpBB/includes/template/twig/lexer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 5f76c44481..d0a84a8b7f 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -98,15 +98,15 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }} // Appends any filters after lang() - $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2 }}', $code); + $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code); // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} // Appends any filters after lang(), but before addslashes - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code); + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} // Appends any filters - $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ $1$2 }}', $code); + $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code); return parent::tokenize($code, $filename); } From 47ec38c011f3d3d86dacdc3126fc36cdec8b1072 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 8 Jul 2013 15:18:40 -0500 Subject: [PATCH 446/575] [feature/twig] Add simple test to make sure Twig filters/tags are working PHPBB3-11598 --- tests/template/template_test.php | 7 +++++++ tests/template/templates/twig.html | 6 ++++++ tests/template/templates/twig_parent.html | 7 +++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/template/templates/twig.html create mode 100644 tests/template/templates/twig_parent.html diff --git a/tests/template/template_test.php b/tests/template/template_test.php index d99e91bae4..fedfeba33a 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -309,6 +309,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "a\nb\nc\nd", ), */ + array( + 'twig.html', + array('VARIABLE' => 'FOObar',), + array(), + array(), + "13FOOBAR|foobar", + ), ); } diff --git a/tests/template/templates/twig.html b/tests/template/templates/twig.html new file mode 100644 index 0000000000..17b94ad8d4 --- /dev/null +++ b/tests/template/templates/twig.html @@ -0,0 +1,6 @@ + + + +3{VARIABLE|upper}|{VARIABLE|lower} + + diff --git a/tests/template/templates/twig_parent.html b/tests/template/templates/twig_parent.html new file mode 100644 index 0000000000..af528e0da4 --- /dev/null +++ b/tests/template/templates/twig_parent.html @@ -0,0 +1,7 @@ + +1 + + + +2 + \ No newline at end of file From 9210d735a53e3c4a4de042b49dae361c436268e1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 19:40:25 +0200 Subject: [PATCH 447/575] [ticket/8319] Do not repeat the replacement PHPBB3-8319 --- phpBB/includes/acp/acp_bbcodes.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index ead716b300..31166a56dc 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -431,15 +431,11 @@ class acp_bbcodes $fp_replace = str_replace($token, $replace, $fp_replace); $sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match); - if ($token_type === 'LOCAL_URL') - { - // Prepend the board url to local relative links - $sp_replace = str_replace($token, generate_board_url() . '/' . '${' . ($n + 1) . '}', $sp_replace); - } - else - { - $sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace); - } + + // Prepend the board url to local relative links + $replace_prepend = ($token_type === 'LOCAL_URL') ? generate_board_url() . '/' : ''; + + $sp_replace = str_replace($token, $replace_prepend . '${' . ($n + 1) . '}', $sp_replace); } $fp_match = '!' . $fp_match . '!' . $modifiers; From 19f7d12328fe1f100cd723fa808a291e634d8737 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Jul 2013 19:56:41 +0200 Subject: [PATCH 448/575] [ticket/8319] Add migration file for update change PHPBB3-8319 --- .../migration/data/30x/local_url_bbcode.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 phpBB/includes/db/migration/data/30x/local_url_bbcode.php diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/includes/db/migration/data/30x/local_url_bbcode.php new file mode 100644 index 0000000000..f324b8880d --- /dev/null +++ b/phpBB/includes/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); + } +} From 9725eb19f8dbc124febe0189799c0b2af0215c63 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Wed, 10 Jul 2013 11:43:52 -0400 Subject: [PATCH 449/575] [feature/twig] Unit tests for includejs PHPBB3-11598 --- tests/template/template_includejs_test.php | 24 ++++++++++++++++------ tests/template/templates/includejs.html | 15 +++++++++++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index a57b219150..0061163eeb 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -18,12 +18,24 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes // Prepare correct result $scripts = array( - '', - '', - '', - '', - '', - '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', ); // Run test diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index 229f1ccc19..dd7b059f12 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -1,8 +1,21 @@ + + + + -{$SCRIPTS} + + + + + + + + + +{SCRIPTS} From ab5a79a823de50667798d4e49fc7758a3fd9f132 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 10 Jul 2013 13:19:34 -0500 Subject: [PATCH 450/575] [ticket/11388] includejs inherit from includeasset Copied from the INCLUDECSS PR, since this needed to be modified. Added checks for argument strings/anchors/http/https paths in asset files to load files properly PHPBB3-11388 --- .../template/twig/node/includeasset.php | 66 +++++++++++++++++++ .../includes/template/twig/node/includejs.php | 38 ++--------- 2 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 phpBB/includes/template/twig/node/includeasset.php diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php new file mode 100644 index 0000000000..181e3b5aa5 --- /dev/null +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -0,0 +1,66 @@ +environment = $environment; + + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $config = $this->environment->get_phpbb_config(); + + $compiler + ->write("\$asset_file = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("\$argument_string = '?assets_version={$config['assets_version']}';\n") + ->write("\$anchor_string = '';\n") + ->write("if ((\$argument_string_start = strpos(\$asset_file, '?')) !== false) {\n") + ->indent() + ->write("\$argument_string = substr(\$asset_file, \$argument_string_start);\n") + ->write("\$asset_file = substr(\$asset_file, 0, \$argument_string_start);\n") + ->write("if ((\$anchor_string_start = strpos(\$argument_string, '#')) !== false) {\n") + ->indent() + ->write("\$anchor_string = substr(\$argument_string, \$anchor_string_start);\n") + ->write("\$argument_string = substr(\$argument_string, 0, \$anchor_string_start);\n") + ->outdent() + ->write("}\n") + ->write("\$argument_string .= '&assets_version=" . $config['assets_version'] . "';\n") + ->outdent() + ->write("}\n") + ->write("if (strpos(\$asset_file, 'http://') !== 0 && strpos(\$asset_file, 'https://') !== 0 && !file_exists(\$asset_file)) {\n") + ->indent() + ->write("\$asset_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_file);\n") + ->outdent() + ->write("}\n") + ->write("\$asset_file .= \$argument_string . \$anchor_string;\n") + ->write("\$context['definition']->append('{$this->get_definition_name()}', '") + ; + + $this->append_asset($compiler); + + $compiler + ->raw("\n');\n") + ; + } +} diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/includes/template/twig/node/includejs.php index 943eb89ace..fdf2bea3ed 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/includes/template/twig/node/includejs.php @@ -7,25 +7,11 @@ * */ -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) +class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset { - exit; -} - - -class phpbb_template_twig_node_includejs extends Twig_Node -{ - /** @var Twig_Environment */ - protected $environment; - - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) + public function get_definition_name() { - $this->environment = $environment; - - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + return 'SCRIPTS'; } /** @@ -33,24 +19,14 @@ class phpbb_template_twig_node_includejs extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + protected function append_asset(Twig_Compiler $compiler) { - $compiler->addDebugInfo($this); - $config = $this->environment->get_phpbb_config(); $compiler - ->write("\$js_file = ") - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ->write("if (!file_exists(\$js_file)) {\n") - ->indent() - ->write("\$js_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$js_file);\n") - ->outdent() - ->write("}\n") - ->write("\$context['definition']->append('SCRIPTS', '\n');\n") + ->raw("\n") ; } } From 8d8979eda76cba8e98e6428542db9aaf00edf2d8 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 10 Jul 2013 13:23:36 -0500 Subject: [PATCH 451/575] [ticket/11388] Fixing includejs test Changed expected output to file?(any supplied argument string)&asset_version =($config['asset_version'])#(any supplied anchor string) Testing lines one at a time to make checking them easier. PHPBB3-11388 --- tests/template/template_includejs_test.php | 105 ++++++++++++++++----- tests/template/templates/includejs.html | 57 ++++++----- 2 files changed, 118 insertions(+), 44 deletions(-) diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 0061163eeb..b644c8b6f0 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -11,34 +11,93 @@ require_once dirname(__FILE__) . '/template_test_case_with_tree.php'; class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree { - public function test_includejs_compilation() + public function template_data() + { + return array( + /* + array( + // vars + // expected + ), + */ + array( + array('TEST' => 1), + '', + ), + array( + array('TEST' => 2), + '', + ), + array( + array('TEST' => 3), + '', + ), + array( + array('TEST' => 4), + '', + ), + array( + array('TEST' => 5), + '', + ), + array( + array('TEST' => 6), + '', + ), + array( + array('TEST' => 7), + '', + ), + array( + array('TEST' => 8), + '', + ), + array( + array('TEST' => 9), + '', + ), + array( + array('TEST' => 10), + '', + ), + array( + array('TEST' => 11), + '', + ), + array( + array('TEST' => 12), + '', + ), + array( + array('TEST' => 13), + '', + ), + array( + array('TEST' => 14), + '', + ), + array( + array('TEST' => 15), + '', + ), + array( + array('TEST' => 16), + '', + ), + ); + } + + /** + * @dataProvider template_data + */ + public function test_includejs_compilation($vars, $expected) { // Reset the engine state $this->setup_engine(array('assets_version' => 1)); - // Prepare correct result - $scripts = array( - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - ); + $this->template->assign_vars($vars); // Run test - $this->run_template('includejs.html', array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), array(), array(), implode('', $scripts)); + $this->run_template('includejs.html', array_merge(array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), $vars), array(), array(), $expected); } } diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index dd7b059f12..030681337b 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -1,21 +1,36 @@ - - - - - - - - - - - - - - - - - - - - -{SCRIPTS} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{$SCRIPTS} From cdb13fc7be4771bc89da624fe0b5f38b0cc3ccd1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 11:52:12 +0200 Subject: [PATCH 452/575] [ticket/9657] Correctly use " vs ' and variables in queries PHPBB3-9657 --- phpBB/includes/content_visibility.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index ac827bd822..88f57a0020 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -126,11 +126,11 @@ class phpbb_content_visibility else { // The user is just a normal user - return "$table_alias{$mode}_visibility = " . ITEM_APPROVED . ' + return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' AND ' . $db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true); } - $where_sql .= "($table_alias{$mode}_visibility = " . ITEM_APPROVED . ' + $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' AND ' . $db->sql_in_set($table_alias . 'forum_id', $forum_ids) . '))'; return $where_sql; @@ -157,12 +157,12 @@ class phpbb_content_visibility if (sizeof($exclude_forum_ids)) { - $where_sqls[] = '(' . $db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . " - AND $table_alias{$mode}_visibility = " . ITEM_APPROVED . ')'; + $where_sqls[] = '(' . $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; + $where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; } if (sizeof($approve_forums)) From dc2f13d55d181c1a927b6daa8652f68ee87b4a90 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 11:56:05 +0200 Subject: [PATCH 453/575] [ticket/9657] Cast topic_id to integer PHPBB3-9657 --- phpBB/includes/content_visibility.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index 88f57a0020..f4126d0fff 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -565,7 +565,7 @@ class phpbb_content_visibility { $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility FROM ' . TOPICS_TABLE . ' - WHERE topic_id = ' . $topic_id; + WHERE topic_id = ' . (int) $topic_id; $result = $db->sql_query($sql); $topic_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -583,7 +583,7 @@ class phpbb_content_visibility // Get user post count information $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' - WHERE topic_id = ' . $topic_id . ' + WHERE topic_id = ' . (int) $topic_id . ' AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . ' GROUP BY poster_id'; From 5b47d731470ddc1b5723ed13b63cc3f90f3e6671 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 12:08:09 +0200 Subject: [PATCH 454/575] [ticket/9657] DO not use \" inside of double quotes PHPBB3-9657 --- phpBB/includes/mcp/mcp_queue.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 29c0375e6c..a253a43136 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -305,7 +305,7 @@ class mcp_queue 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), - 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), + 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '', ''), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '', ''), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), @@ -730,7 +730,7 @@ class mcp_queue $add_message = '

      ' . sprintf($user->lang['RETURN_POST'], '', ''); } - $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message; + $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], '', '') . $add_message; if ($request->is_ajax()) { @@ -877,7 +877,7 @@ class mcp_queue $add_message = '

      ' . sprintf($user->lang['RETURN_TOPIC'], '', ''); } - $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message; + $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], '', '') . $add_message; if ($request->is_ajax()) { @@ -1209,7 +1209,7 @@ class mcp_queue } else { - $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], "", ''); + $message = $user->lang[$success_msg] . '

      ' . sprintf($user->lang['RETURN_PAGE'], '', ''); if ($request->is_ajax()) { From ed151cd6aaa5ec875d56d33e8908771a1244f98a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 12:12:18 +0200 Subject: [PATCH 455/575] [ticket/9657] Add , to last element of an array PHPBB3-9657 --- phpBB/includes/mcp/mcp_queue.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a253a43136..a42ae6c48c 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -182,8 +182,8 @@ class mcp_queue $template->assign_vars(array( 'S_TOPIC_REVIEW' => true, 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], - 'TOPIC_TITLE' => $post_info['topic_title']) - ); + 'TOPIC_TITLE' => $post_info['topic_title'], + )); } $extensions = $attachments = $topic_tracking_info = array(); @@ -246,8 +246,8 @@ class mcp_queue foreach ($attachments as $attachment) { $template->assign_block_vars('attachment', array( - 'DISPLAY_ATTACHMENT' => $attachment) - ); + 'DISPLAY_ATTACHMENT' => $attachment, + )); } } } @@ -922,8 +922,8 @@ class mcp_queue 'mode' => $mode, 'post_id_list' => $post_id_list, 'action' => 'disapprove', - 'redirect' => $redirect) - ); + 'redirect' => $redirect, + )); $notify_poster = $request->is_set('notify_poster'); $disapprove_reason = ''; From fe66f53b0a2399e2fbf08930269c217ddb80702b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 11 Jul 2013 12:28:01 +0200 Subject: [PATCH 456/575] [ticket/9657] Fix labels on confirm_delete_body.html PHPBB3-9657 --- phpBB/styles/prosilver/template/confirm_delete_body.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index 817acbf8ba..759b6b46b2 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -11,7 +11,7 @@ -

    Improvement

      @@ -235,6 +237,7 @@
    • [PHPBB3-11527] - Upgrade composer.phar to 1.0.0-alpha7
    • [PHPBB3-11529] - Rename RUNNING_TESTS file to .md file to render it on GitHub
    • [PHPBB3-11576] - Make phpBB Test Suite MySQL behave at least as strict as phpBB MySQL driver
    • +
    • [PHPBB3-11671] - Add phing/phing to composer.json

    1.ii. Changes since 3.0.10

    From c1bb179914e4f47876d87aba21ab65e01f79d69c Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 13 Jul 2013 13:30:33 -0400 Subject: [PATCH 564/575] [ticket/10999] Fix assets_version in ACP PHPBB3-10999 --- phpBB/adm/style/overall_footer.html | 2 +- phpBB/includes/functions_acp.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 54ed4dcc9e..9202cec06b 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -38,7 +38,7 @@ -{SCRIPTS} +{$SCRIPTS} diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index ff0e2a1ac1..60c44e90e1 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -82,6 +82,8 @@ function adm_page_header($page_title) 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", + 'T_ASSETS_VERSION' => $config['assets_version'], + 'ICON_MOVE_UP' => '' . $user->lang['MOVE_UP'] . '', 'ICON_MOVE_UP_DISABLED' => '' . $user->lang['MOVE_UP'] . '', 'ICON_MOVE_DOWN' => '' . $user->lang['MOVE_DOWN'] . '', From 081350678dcfd88104d885385674b8f4a382aa91 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 13 Jul 2013 14:57:31 -0400 Subject: [PATCH 565/575] [ticket/9649] Display information on index for moderators on unapproved posts PHPBB3-9649 --- phpBB/includes/functions_display.php | 10 +++++++++- phpBB/styles/prosilver/template/forumlist_body.html | 6 +++++- phpBB/styles/subsilver2/template/forumlist_body.html | 9 ++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 143813e4ed..b1dac64bec 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -215,8 +215,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; } - // Count the difference of real to public topics, so we can display an information to moderators + // Lets check whether there are unapproved topics/posts, so we can display an information to moderators $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0; + $row['forum_id_unapproved_posts'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_posts_unapproved']) ? $forum_id : 0; $row['forum_posts'] = $phpbb_content_visibility->get_count('forum_posts', $row, $forum_id); $row['forum_topics'] = $phpbb_content_visibility->get_count('forum_topics', $row, $forum_id); @@ -281,6 +282,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id; } + if (!$forum_rows[$parent_id]['forum_id_unapproved_posts'] && $row['forum_id_unapproved_posts']) + { + $forum_rows[$parent_id]['forum_id_unapproved_posts'] = $forum_id; + } + $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics']; // Do not list redirects in LINK Forums as Posts. @@ -548,6 +554,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'L_MODERATOR_STR' => $l_moderator, 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', + 'U_UNAPPROVED_POSTS' => ($row['forum_id_unapproved_posts']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts&f=' . $row['forum_id_unapproved_posts']) : '', 'U_VIEWFORUM' => $u_viewforum, 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url, @@ -587,6 +594,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), + 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED'), )); if ($return_moderators) diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 0c67de76ec..9fb6b3d951 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -50,7 +50,11 @@
    {forumrow.TOPICS} {L_TOPICS}
    {forumrow.POSTS} {L_POSTS}
    - {UNAPPROVED_IMG} + + {UNAPPROVED_IMG} + + {UNAPPROVED_POST_IMG} + {L_LAST_POST} diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html index 3e30561f3a..a222607ae8 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -64,7 +64,14 @@

    {forumrow.LAST_POST_SUBJECT_TRUNCATED}

    -

    {UNAPPROVED_IMG} {forumrow.LAST_POST_TIME}

    +

    + + {UNAPPROVED_IMG}  + + {UNAPPROVED_POST_IMG}  + + {forumrow.LAST_POST_TIME} +

    {forumrow.LAST_POSTER_FULL} {LAST_POST_IMG}

    From 9f5ee08bae0bd13352dd7a5e59ec959bc17702d4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 13 Jul 2013 16:44:38 -0400 Subject: [PATCH 566/575] [ticket/11690] Old module class names may get autoloaded by class_exists PHPBB3-11690 --- phpBB/includes/acp/acp_modules.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index ab416fb406..a1e681b29c 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -575,13 +575,20 @@ class acp_modules // format. phpbb_acp_info_acp_foo needs to be turned into // acp_foo_info and the respective file has to be included // manually because it does not support auto loading - if (!class_exists($info_class)) + $old_info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module); + $old_info_class = $old_info_class_file . '_info'; + + if (class_exists($old_info_class)) { - $info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module); - $info_class = $info_class_file . '_info'; - if (!class_exists($info_class) && file_exists($directory . $info_class_file . '.' . $phpEx)) + $info_class = $old_info_class; + } + else if (!class_exists($info_class)) + { + $info_class = $old_info_class; + // need to check class exists again because previous checks triggered autoloading + if (!class_exists($info_class) && file_exists($directory . $old_info_class_file . '.' . $phpEx)) { - include($directory . $info_class_file . '.' . $phpEx); + include($directory . $old_info_class_file . '.' . $phpEx); } } From e9cc1e9cd276fa6222e52c7c41feb6ef4829f6e3 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 13 Jul 2013 16:25:08 -0500 Subject: [PATCH 567/575] [ticket/11675] Fix template loop PHPBB3-11675 --- phpBB/adm/style/permission_roles_mask.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/permission_roles_mask.html b/phpBB/adm/style/permission_roles_mask.html index 277310edbf..42a7fc3e4e 100644 --- a/phpBB/adm/style/permission_roles_mask.html +++ b/phpBB/adm/style/permission_roles_mask.html @@ -25,7 +25,7 @@ {role_mask.groups.GROUP_NAME} :: {L_GROUPS_NOT_ASSIGNED} - + From 176729ab001300c295695537803f389e175049cf Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sat, 13 Jul 2013 17:50:35 -0500 Subject: [PATCH 568/575] [ticket/11692] Don't update search_type in dev migration if already appended PHPBB3-11692 --- phpBB/includes/db/migration/data/310/dev.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/includes/db/migration/data/310/dev.php index 13b36bbf30..0fc2950987 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/includes/db/migration/data/310/dev.php @@ -82,7 +82,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + array('if', array( + (strpos('phpbb_search_', $this->config['search_type']) !== 0), + array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + )), array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), From 8d303226351f358b24389fb2fd2d9b6bab7aa565 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 13 Jul 2013 23:15:26 -0400 Subject: [PATCH 569/575] [ticket/11694] Do not locate assets with root path Do not locate assets that start with ./ PHPBB3-11694 --- phpBB/includes/template/twig/node/includeasset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php index ae113cadc8..990b1c984f 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -34,7 +34,7 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->subcompile($this->getNode('expr')) ->raw(";\n") ->write("\$asset = new phpbb_template_asset(\$asset_file);\n") - ->write("if (\$asset->is_relative()) {\n") + ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n") From 7030578bbe9e11c18b5becaf8b06e670e3c2e3cd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 01:32:34 -0400 Subject: [PATCH 570/575] [ticket/11698] Moving all autoloadable files to phpbb/ PHPBB3-11698 --- phpBB/common.php | 6 +++--- phpBB/includes/acp/acp_search.php | 2 +- phpBB/install/database_update.php | 6 +++--- phpBB/install/index.php | 4 ++-- phpBB/install/install_install.php | 6 +++--- phpBB/{includes => phpbb}/auth/auth.php | 0 phpBB/{includes => phpbb}/auth/index.htm | 0 phpBB/{includes => phpbb}/auth/provider/apache.php | 0 phpBB/{includes => phpbb}/auth/provider/base.php | 0 phpBB/{includes => phpbb}/auth/provider/db.php | 0 phpBB/{includes => phpbb}/auth/provider/index.htm | 0 phpBB/{includes => phpbb}/auth/provider/interface.php | 0 phpBB/{includes => phpbb}/auth/provider/ldap.php | 0 phpBB/{includes => phpbb}/avatar/driver/driver.php | 0 phpBB/{includes => phpbb}/avatar/driver/gravatar.php | 0 phpBB/{includes => phpbb}/avatar/driver/interface.php | 0 phpBB/{includes => phpbb}/avatar/driver/local.php | 0 phpBB/{includes => phpbb}/avatar/driver/remote.php | 0 phpBB/{includes => phpbb}/avatar/driver/upload.php | 0 phpBB/{includes => phpbb}/avatar/manager.php | 0 phpBB/{includes => phpbb}/cache/driver/apc.php | 0 phpBB/{includes => phpbb}/cache/driver/base.php | 0 .../{includes => phpbb}/cache/driver/eaccelerator.php | 0 phpBB/{includes => phpbb}/cache/driver/file.php | 0 phpBB/{includes => phpbb}/cache/driver/interface.php | 0 phpBB/{includes => phpbb}/cache/driver/memcache.php | 0 phpBB/{includes => phpbb}/cache/driver/memory.php | 0 phpBB/{includes => phpbb}/cache/driver/null.php | 0 phpBB/{includes => phpbb}/cache/driver/redis.php | 0 phpBB/{includes => phpbb}/cache/driver/wincache.php | 0 phpBB/{includes => phpbb}/cache/driver/xcache.php | 0 phpBB/{includes => phpbb}/cache/service.php | 0 phpBB/{includes => phpbb}/class_loader.php | 0 phpBB/{includes => phpbb}/config/config.php | 0 phpBB/{includes => phpbb}/config/db.php | 0 phpBB/{includes => phpbb}/config/db_text.php | 0 phpBB/{includes => phpbb}/content_visibility.php | 0 phpBB/{includes => phpbb}/controller/exception.php | 0 phpBB/{includes => phpbb}/controller/helper.php | 0 phpBB/{includes => phpbb}/controller/provider.php | 0 phpBB/{includes => phpbb}/controller/resolver.php | 0 phpBB/{includes => phpbb}/cron/manager.php | 0 phpBB/{includes => phpbb}/cron/task/base.php | 0 .../cron/task/core/prune_all_forums.php | 0 .../{includes => phpbb}/cron/task/core/prune_forum.php | 0 phpBB/{includes => phpbb}/cron/task/core/queue.php | 0 .../{includes => phpbb}/cron/task/core/tidy_cache.php | 0 .../cron/task/core/tidy_database.php | 0 .../{includes => phpbb}/cron/task/core/tidy_search.php | 7 +------ .../cron/task/core/tidy_sessions.php | 0 .../cron/task/core/tidy_warnings.php | 0 phpBB/{includes => phpbb}/cron/task/parametrized.php | 0 phpBB/{includes => phpbb}/cron/task/task.php | 0 phpBB/{includes => phpbb}/cron/task/wrapper.php | 0 phpBB/{includes => phpbb}/datetime.php | 0 phpBB/{includes => phpbb}/db/driver/driver.php | 0 phpBB/{includes => phpbb}/db/driver/firebird.php | 0 phpBB/{includes => phpbb}/db/driver/mssql.php | 0 phpBB/{includes => phpbb}/db/driver/mssql_base.php | 0 phpBB/{includes => phpbb}/db/driver/mssql_odbc.php | 0 phpBB/{includes => phpbb}/db/driver/mssqlnative.php | 0 phpBB/{includes => phpbb}/db/driver/mysql.php | 0 phpBB/{includes => phpbb}/db/driver/mysql_base.php | 0 phpBB/{includes => phpbb}/db/driver/mysqli.php | 0 phpBB/{includes => phpbb}/db/driver/oracle.php | 0 phpBB/{includes => phpbb}/db/driver/postgres.php | 0 phpBB/{includes => phpbb}/db/driver/sqlite.php | 0 .../db/migration/data/30x/3_0_1.php | 0 .../db/migration/data/30x/3_0_10.php | 0 .../db/migration/data/30x/3_0_10_rc1.php | 0 .../db/migration/data/30x/3_0_10_rc2.php | 0 .../db/migration/data/30x/3_0_10_rc3.php | 0 .../db/migration/data/30x/3_0_11.php | 0 .../db/migration/data/30x/3_0_11_rc1.php | 0 .../db/migration/data/30x/3_0_11_rc2.php | 0 .../db/migration/data/30x/3_0_12_rc1.php | 0 .../db/migration/data/30x/3_0_1_rc1.php | 0 .../db/migration/data/30x/3_0_2.php | 0 .../db/migration/data/30x/3_0_2_rc1.php | 0 .../db/migration/data/30x/3_0_2_rc2.php | 0 .../db/migration/data/30x/3_0_3.php | 0 .../db/migration/data/30x/3_0_3_rc1.php | 0 .../db/migration/data/30x/3_0_4.php | 0 .../db/migration/data/30x/3_0_4_rc1.php | 0 .../db/migration/data/30x/3_0_5.php | 0 .../db/migration/data/30x/3_0_5_rc1.php | 0 .../db/migration/data/30x/3_0_5_rc1part2.php | 0 .../db/migration/data/30x/3_0_6.php | 0 .../db/migration/data/30x/3_0_6_rc1.php | 0 .../db/migration/data/30x/3_0_6_rc2.php | 0 .../db/migration/data/30x/3_0_6_rc3.php | 0 .../db/migration/data/30x/3_0_6_rc4.php | 0 .../db/migration/data/30x/3_0_7.php | 0 .../db/migration/data/30x/3_0_7_pl1.php | 0 .../db/migration/data/30x/3_0_7_rc1.php | 0 .../db/migration/data/30x/3_0_7_rc2.php | 0 .../db/migration/data/30x/3_0_8.php | 0 .../db/migration/data/30x/3_0_8_rc1.php | 0 .../db/migration/data/30x/3_0_9.php | 0 .../db/migration/data/30x/3_0_9_rc1.php | 0 .../db/migration/data/30x/3_0_9_rc2.php | 0 .../db/migration/data/30x/3_0_9_rc3.php | 0 .../db/migration/data/30x/3_0_9_rc4.php | 0 .../db/migration/data/30x/local_url_bbcode.php | 0 .../db/migration/data/310/avatars.php | 0 .../db/migration/data/310/boardindex.php | 0 .../db/migration/data/310/config_db_text.php | 0 .../{includes => phpbb}/db/migration/data/310/dev.php | 0 .../db/migration/data/310/extensions.php | 0 .../db/migration/data/310/forgot_password.php | 0 .../db/migration/data/310/jquery_update.php | 0 .../data/310/notification_options_reconvert.php | 0 .../db/migration/data/310/notifications.php | 0 .../db/migration/data/310/notifications_schema_fix.php | 0 .../db/migration/data/310/reported_posts_display.php | 0 .../db/migration/data/310/signature_module_auth.php | 0 .../db/migration/data/310/softdelete_p1.php | 0 .../db/migration/data/310/softdelete_p2.php | 0 .../db/migration/data/310/style_update_p1.php | 0 .../db/migration/data/310/style_update_p2.php | 0 .../db/migration/data/310/teampage.php | 0 .../db/migration/data/310/timezone.php | 0 .../db/migration/data/310/timezone_p2.php | 0 phpBB/{includes => phpbb}/db/migration/exception.php | 0 phpBB/{includes => phpbb}/db/migration/migration.php | 0 phpBB/{includes => phpbb}/db/migration/tool/config.php | 0 .../db/migration/tool/interface.php | 0 phpBB/{includes => phpbb}/db/migration/tool/module.php | 0 .../db/migration/tool/permission.php | 0 phpBB/{includes => phpbb}/db/migrator.php | 0 phpBB/{includes => phpbb}/db/sql_insert_buffer.php | 0 phpBB/{includes => phpbb}/di/extension/config.php | 0 phpBB/{includes => phpbb}/di/extension/core.php | 0 phpBB/{includes => phpbb}/di/extension/ext.php | 0 phpBB/{includes => phpbb}/di/pass/collection_pass.php | 0 phpBB/{includes => phpbb}/di/pass/kernel_pass.php | 0 phpBB/{includes => phpbb}/di/service_collection.php | 0 phpBB/{includes => phpbb}/error_collector.php | 0 phpBB/{includes => phpbb}/event/data.php | 0 phpBB/{includes => phpbb}/event/dispatcher.php | 0 .../event/extension_subscriber_loader.php | 0 .../event/kernel_exception_subscriber.php | 0 .../event/kernel_request_subscriber.php | 0 .../event/kernel_terminate_subscriber.php | 0 phpBB/{includes => phpbb}/extension/base.php | 0 phpBB/{includes => phpbb}/extension/exception.php | 0 phpBB/{includes => phpbb}/extension/finder.php | 4 ++-- phpBB/{includes => phpbb}/extension/interface.php | 0 phpBB/{includes => phpbb}/extension/manager.php | 0 .../{includes => phpbb}/extension/metadata_manager.php | 0 phpBB/{includes => phpbb}/extension/provider.php | 0 phpBB/{includes => phpbb}/feed/base.php | 0 phpBB/{includes => phpbb}/feed/factory.php | 0 phpBB/{includes => phpbb}/feed/forum.php | 0 phpBB/{includes => phpbb}/feed/forums.php | 0 phpBB/{includes => phpbb}/feed/helper.php | 0 phpBB/{includes => phpbb}/feed/news.php | 0 phpBB/{includes => phpbb}/feed/overall.php | 0 phpBB/{includes => phpbb}/feed/post_base.php | 0 phpBB/{includes => phpbb}/feed/topic.php | 0 phpBB/{includes => phpbb}/feed/topic_base.php | 0 phpBB/{includes => phpbb}/feed/topics.php | 0 phpBB/{includes => phpbb}/feed/topics_active.php | 0 phpBB/{includes => phpbb}/filesystem.php | 0 phpBB/{includes => phpbb}/groupposition/exception.php | 0 phpBB/{includes => phpbb}/groupposition/interface.php | 0 phpBB/{includes => phpbb}/groupposition/legend.php | 0 phpBB/{includes => phpbb}/groupposition/teampage.php | 0 phpBB/{includes => phpbb}/hook/finder.php | 0 phpBB/{includes => phpbb}/json_response.php | 0 phpBB/{includes => phpbb}/lock/db.php | 0 phpBB/{includes => phpbb}/lock/flock.php | 0 phpBB/{includes => phpbb}/log/interface.php | 0 phpBB/{includes => phpbb}/log/log.php | 0 phpBB/{includes => phpbb}/notification/exception.php | 0 phpBB/{includes => phpbb}/notification/manager.php | 0 phpBB/{includes => phpbb}/notification/method/base.php | 0 .../{includes => phpbb}/notification/method/email.php | 0 .../notification/method/interface.php | 0 .../{includes => phpbb}/notification/method/jabber.php | 0 .../notification/method/messenger_base.php | 0 .../notification/type/approve_post.php | 0 .../notification/type/approve_topic.php | 0 phpBB/{includes => phpbb}/notification/type/base.php | 0 .../{includes => phpbb}/notification/type/bookmark.php | 0 .../notification/type/disapprove_post.php | 0 .../notification/type/disapprove_topic.php | 0 .../notification/type/interface.php | 0 phpBB/{includes => phpbb}/notification/type/pm.php | 0 phpBB/{includes => phpbb}/notification/type/post.php | 0 .../notification/type/post_in_queue.php | 0 phpBB/{includes => phpbb}/notification/type/quote.php | 0 .../notification/type/report_pm.php | 0 .../notification/type/report_pm_closed.php | 0 .../notification/type/report_post.php | 0 .../notification/type/report_post_closed.php | 0 phpBB/{includes => phpbb}/notification/type/topic.php | 0 .../notification/type/topic_in_queue.php | 0 phpBB/{includes => phpbb}/php/ini.php | 0 .../request/deactivated_super_global.php | 0 phpBB/{includes => phpbb}/request/interface.php | 0 phpBB/{includes => phpbb}/request/request.php | 0 phpBB/{includes => phpbb}/request/type_cast_helper.php | 0 .../request/type_cast_helper_interface.php | 0 phpBB/{includes => phpbb}/search/base.php | 0 phpBB/{includes => phpbb}/search/fulltext_mysql.php | 0 phpBB/{includes => phpbb}/search/fulltext_native.php | 0 phpBB/{includes => phpbb}/search/fulltext_postgres.php | 0 phpBB/{includes => phpbb}/search/fulltext_sphinx.php | 0 phpBB/{includes => phpbb}/search/index.htm | 0 phpBB/{includes => phpbb}/search/sphinx/config.php | 0 .../search/sphinx/config_comment.php | 0 .../search/sphinx/config_section.php | 0 .../search/sphinx/config_variable.php | 0 phpBB/{includes => phpbb}/session.php | 0 .../style/extension_path_provider.php | 0 phpBB/{includes => phpbb}/style/path_provider.php | 0 .../style/path_provider_interface.php | 0 phpBB/{includes => phpbb}/style/resource_locator.php | 0 phpBB/{includes => phpbb}/style/style.php | 0 phpBB/{includes => phpbb}/template/asset.php | 0 phpBB/{includes => phpbb}/template/context.php | 0 phpBB/{includes => phpbb}/template/locator.php | 0 phpBB/{includes => phpbb}/template/template.php | 0 phpBB/{includes => phpbb}/template/twig/definition.php | 0 .../{includes => phpbb}/template/twig/environment.php | 0 phpBB/{includes => phpbb}/template/twig/extension.php | 0 phpBB/{includes => phpbb}/template/twig/lexer.php | 0 .../{includes => phpbb}/template/twig/node/define.php | 0 phpBB/{includes => phpbb}/template/twig/node/event.php | 0 .../twig/node/expression/binary/equalequal.php | 0 .../twig/node/expression/binary/notequalequal.php | 0 .../{includes => phpbb}/template/twig/node/include.php | 0 .../template/twig/node/includeasset.php | 0 .../template/twig/node/includecss.php | 0 .../template/twig/node/includejs.php | 0 .../template/twig/node/includephp.php | 0 phpBB/{includes => phpbb}/template/twig/node/php.php | 0 .../template/twig/tokenparser/define.php | 0 .../template/twig/tokenparser/event.php | 0 .../template/twig/tokenparser/include.php | 0 .../template/twig/tokenparser/includecss.php | 0 .../template/twig/tokenparser/includejs.php | 0 .../template/twig/tokenparser/includephp.php | 0 .../template/twig/tokenparser/php.php | 0 phpBB/{includes => phpbb}/template/twig/twig.php | 0 phpBB/{includes => phpbb}/tree/interface.php | 0 phpBB/{includes => phpbb}/tree/nestedset.php | 0 phpBB/{includes => phpbb}/tree/nestedset_forum.php | 0 phpBB/{includes => phpbb}/user.php | 0 phpBB/{includes => phpbb}/user_loader.php | 0 phpunit.xml.all | 5 +++-- phpunit.xml.dist | 5 +++-- phpunit.xml.functional | 5 +++-- tests/bootstrap.php | 4 ++-- tests/class_loader/class_loader_test.php | 10 +++++----- tests/class_loader/{includes => phpbb}/class_name.php | 0 tests/class_loader/{includes => phpbb}/dir.php | 0 .../{includes => phpbb}/dir/class_name.php | 0 .../{includes => phpbb}/dir/subdir/class_name.php | 0 tests/class_loader/{includes => phpbb}/dir2/dir2.php | 0 tests/controller/controller_test.php | 2 +- .../controller/{includes => phpbb}/controller/foo.php | 0 tests/datetime/from_format_test.php | 3 --- tests/dbal/migrator_test.php | 2 -- tests/dbal/migrator_tool_config_test.php | 3 --- tests/dbal/migrator_tool_module_test.php | 2 -- tests/dbal/migrator_tool_permission_test.php | 2 -- tests/error_collector_test.php | 1 - tests/extension/finder_test.php | 8 ++++---- .../{includes => phpbb}/default/implementation.php | 0 tests/log/function_view_log_test.php | 1 - tests/upload/fileupload_test.php | 1 + 273 files changed, 37 insertions(+), 52 deletions(-) rename phpBB/{includes => phpbb}/auth/auth.php (100%) rename phpBB/{includes => phpbb}/auth/index.htm (100%) rename phpBB/{includes => phpbb}/auth/provider/apache.php (100%) rename phpBB/{includes => phpbb}/auth/provider/base.php (100%) rename phpBB/{includes => phpbb}/auth/provider/db.php (100%) rename phpBB/{includes => phpbb}/auth/provider/index.htm (100%) rename phpBB/{includes => phpbb}/auth/provider/interface.php (100%) rename phpBB/{includes => phpbb}/auth/provider/ldap.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/driver.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/gravatar.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/interface.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/local.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/remote.php (100%) rename phpBB/{includes => phpbb}/avatar/driver/upload.php (100%) rename phpBB/{includes => phpbb}/avatar/manager.php (100%) rename phpBB/{includes => phpbb}/cache/driver/apc.php (100%) rename phpBB/{includes => phpbb}/cache/driver/base.php (100%) rename phpBB/{includes => phpbb}/cache/driver/eaccelerator.php (100%) rename phpBB/{includes => phpbb}/cache/driver/file.php (100%) rename phpBB/{includes => phpbb}/cache/driver/interface.php (100%) rename phpBB/{includes => phpbb}/cache/driver/memcache.php (100%) rename phpBB/{includes => phpbb}/cache/driver/memory.php (100%) rename phpBB/{includes => phpbb}/cache/driver/null.php (100%) rename phpBB/{includes => phpbb}/cache/driver/redis.php (100%) rename phpBB/{includes => phpbb}/cache/driver/wincache.php (100%) rename phpBB/{includes => phpbb}/cache/driver/xcache.php (100%) rename phpBB/{includes => phpbb}/cache/service.php (100%) rename phpBB/{includes => phpbb}/class_loader.php (100%) rename phpBB/{includes => phpbb}/config/config.php (100%) rename phpBB/{includes => phpbb}/config/db.php (100%) rename phpBB/{includes => phpbb}/config/db_text.php (100%) rename phpBB/{includes => phpbb}/content_visibility.php (100%) rename phpBB/{includes => phpbb}/controller/exception.php (100%) rename phpBB/{includes => phpbb}/controller/helper.php (100%) rename phpBB/{includes => phpbb}/controller/provider.php (100%) rename phpBB/{includes => phpbb}/controller/resolver.php (100%) rename phpBB/{includes => phpbb}/cron/manager.php (100%) rename phpBB/{includes => phpbb}/cron/task/base.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/prune_all_forums.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/prune_forum.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/queue.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_cache.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_database.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_search.php (90%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_sessions.php (100%) rename phpBB/{includes => phpbb}/cron/task/core/tidy_warnings.php (100%) rename phpBB/{includes => phpbb}/cron/task/parametrized.php (100%) rename phpBB/{includes => phpbb}/cron/task/task.php (100%) rename phpBB/{includes => phpbb}/cron/task/wrapper.php (100%) rename phpBB/{includes => phpbb}/datetime.php (100%) rename phpBB/{includes => phpbb}/db/driver/driver.php (100%) rename phpBB/{includes => phpbb}/db/driver/firebird.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql_base.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssql_odbc.php (100%) rename phpBB/{includes => phpbb}/db/driver/mssqlnative.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysql.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysql_base.php (100%) rename phpBB/{includes => phpbb}/db/driver/mysqli.php (100%) rename phpBB/{includes => phpbb}/db/driver/oracle.php (100%) rename phpBB/{includes => phpbb}/db/driver/postgres.php (100%) rename phpBB/{includes => phpbb}/db/driver/sqlite.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_10_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_11_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_12_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_1_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_2_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_3_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_4_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_5_rc1part2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_6_rc4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_pl1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_7_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_8.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_8_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc3.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/3_0_9_rc4.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/30x/local_url_bbcode.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/avatars.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/boardindex.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/config_db_text.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/dev.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/extensions.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/forgot_password.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/jquery_update.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notification_options_reconvert.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notifications.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/notifications_schema_fix.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/reported_posts_display.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/signature_module_auth.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/softdelete_p1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/softdelete_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/style_update_p1.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/style_update_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/teampage.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/timezone.php (100%) rename phpBB/{includes => phpbb}/db/migration/data/310/timezone_p2.php (100%) rename phpBB/{includes => phpbb}/db/migration/exception.php (100%) rename phpBB/{includes => phpbb}/db/migration/migration.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/config.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/interface.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/module.php (100%) rename phpBB/{includes => phpbb}/db/migration/tool/permission.php (100%) rename phpBB/{includes => phpbb}/db/migrator.php (100%) rename phpBB/{includes => phpbb}/db/sql_insert_buffer.php (100%) rename phpBB/{includes => phpbb}/di/extension/config.php (100%) rename phpBB/{includes => phpbb}/di/extension/core.php (100%) rename phpBB/{includes => phpbb}/di/extension/ext.php (100%) rename phpBB/{includes => phpbb}/di/pass/collection_pass.php (100%) rename phpBB/{includes => phpbb}/di/pass/kernel_pass.php (100%) rename phpBB/{includes => phpbb}/di/service_collection.php (100%) rename phpBB/{includes => phpbb}/error_collector.php (100%) rename phpBB/{includes => phpbb}/event/data.php (100%) rename phpBB/{includes => phpbb}/event/dispatcher.php (100%) rename phpBB/{includes => phpbb}/event/extension_subscriber_loader.php (100%) rename phpBB/{includes => phpbb}/event/kernel_exception_subscriber.php (100%) rename phpBB/{includes => phpbb}/event/kernel_request_subscriber.php (100%) rename phpBB/{includes => phpbb}/event/kernel_terminate_subscriber.php (100%) rename phpBB/{includes => phpbb}/extension/base.php (100%) rename phpBB/{includes => phpbb}/extension/exception.php (100%) rename phpBB/{includes => phpbb}/extension/finder.php (99%) rename phpBB/{includes => phpbb}/extension/interface.php (100%) rename phpBB/{includes => phpbb}/extension/manager.php (100%) rename phpBB/{includes => phpbb}/extension/metadata_manager.php (100%) rename phpBB/{includes => phpbb}/extension/provider.php (100%) rename phpBB/{includes => phpbb}/feed/base.php (100%) rename phpBB/{includes => phpbb}/feed/factory.php (100%) rename phpBB/{includes => phpbb}/feed/forum.php (100%) rename phpBB/{includes => phpbb}/feed/forums.php (100%) rename phpBB/{includes => phpbb}/feed/helper.php (100%) rename phpBB/{includes => phpbb}/feed/news.php (100%) rename phpBB/{includes => phpbb}/feed/overall.php (100%) rename phpBB/{includes => phpbb}/feed/post_base.php (100%) rename phpBB/{includes => phpbb}/feed/topic.php (100%) rename phpBB/{includes => phpbb}/feed/topic_base.php (100%) rename phpBB/{includes => phpbb}/feed/topics.php (100%) rename phpBB/{includes => phpbb}/feed/topics_active.php (100%) rename phpBB/{includes => phpbb}/filesystem.php (100%) rename phpBB/{includes => phpbb}/groupposition/exception.php (100%) rename phpBB/{includes => phpbb}/groupposition/interface.php (100%) rename phpBB/{includes => phpbb}/groupposition/legend.php (100%) rename phpBB/{includes => phpbb}/groupposition/teampage.php (100%) rename phpBB/{includes => phpbb}/hook/finder.php (100%) rename phpBB/{includes => phpbb}/json_response.php (100%) rename phpBB/{includes => phpbb}/lock/db.php (100%) rename phpBB/{includes => phpbb}/lock/flock.php (100%) rename phpBB/{includes => phpbb}/log/interface.php (100%) rename phpBB/{includes => phpbb}/log/log.php (100%) rename phpBB/{includes => phpbb}/notification/exception.php (100%) rename phpBB/{includes => phpbb}/notification/manager.php (100%) rename phpBB/{includes => phpbb}/notification/method/base.php (100%) rename phpBB/{includes => phpbb}/notification/method/email.php (100%) rename phpBB/{includes => phpbb}/notification/method/interface.php (100%) rename phpBB/{includes => phpbb}/notification/method/jabber.php (100%) rename phpBB/{includes => phpbb}/notification/method/messenger_base.php (100%) rename phpBB/{includes => phpbb}/notification/type/approve_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/approve_topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/base.php (100%) rename phpBB/{includes => phpbb}/notification/type/bookmark.php (100%) rename phpBB/{includes => phpbb}/notification/type/disapprove_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/disapprove_topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/interface.php (100%) rename phpBB/{includes => phpbb}/notification/type/pm.php (100%) rename phpBB/{includes => phpbb}/notification/type/post.php (100%) rename phpBB/{includes => phpbb}/notification/type/post_in_queue.php (100%) rename phpBB/{includes => phpbb}/notification/type/quote.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_pm.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_pm_closed.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_post.php (100%) rename phpBB/{includes => phpbb}/notification/type/report_post_closed.php (100%) rename phpBB/{includes => phpbb}/notification/type/topic.php (100%) rename phpBB/{includes => phpbb}/notification/type/topic_in_queue.php (100%) rename phpBB/{includes => phpbb}/php/ini.php (100%) rename phpBB/{includes => phpbb}/request/deactivated_super_global.php (100%) rename phpBB/{includes => phpbb}/request/interface.php (100%) rename phpBB/{includes => phpbb}/request/request.php (100%) rename phpBB/{includes => phpbb}/request/type_cast_helper.php (100%) rename phpBB/{includes => phpbb}/request/type_cast_helper_interface.php (100%) rename phpBB/{includes => phpbb}/search/base.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_mysql.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_native.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_postgres.php (100%) rename phpBB/{includes => phpbb}/search/fulltext_sphinx.php (100%) rename phpBB/{includes => phpbb}/search/index.htm (100%) rename phpBB/{includes => phpbb}/search/sphinx/config.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_comment.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_section.php (100%) rename phpBB/{includes => phpbb}/search/sphinx/config_variable.php (100%) rename phpBB/{includes => phpbb}/session.php (100%) rename phpBB/{includes => phpbb}/style/extension_path_provider.php (100%) rename phpBB/{includes => phpbb}/style/path_provider.php (100%) rename phpBB/{includes => phpbb}/style/path_provider_interface.php (100%) rename phpBB/{includes => phpbb}/style/resource_locator.php (100%) rename phpBB/{includes => phpbb}/style/style.php (100%) rename phpBB/{includes => phpbb}/template/asset.php (100%) rename phpBB/{includes => phpbb}/template/context.php (100%) rename phpBB/{includes => phpbb}/template/locator.php (100%) rename phpBB/{includes => phpbb}/template/template.php (100%) rename phpBB/{includes => phpbb}/template/twig/definition.php (100%) rename phpBB/{includes => phpbb}/template/twig/environment.php (100%) rename phpBB/{includes => phpbb}/template/twig/extension.php (100%) rename phpBB/{includes => phpbb}/template/twig/lexer.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/define.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/event.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/expression/binary/equalequal.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/expression/binary/notequalequal.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/include.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includeasset.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includecss.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includejs.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/includephp.php (100%) rename phpBB/{includes => phpbb}/template/twig/node/php.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/define.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/event.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/include.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includecss.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includejs.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/includephp.php (100%) rename phpBB/{includes => phpbb}/template/twig/tokenparser/php.php (100%) rename phpBB/{includes => phpbb}/template/twig/twig.php (100%) rename phpBB/{includes => phpbb}/tree/interface.php (100%) rename phpBB/{includes => phpbb}/tree/nestedset.php (100%) rename phpBB/{includes => phpbb}/tree/nestedset_forum.php (100%) rename phpBB/{includes => phpbb}/user.php (100%) rename phpBB/{includes => phpbb}/user_loader.php (100%) rename tests/class_loader/{includes => phpbb}/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir.php (100%) rename tests/class_loader/{includes => phpbb}/dir/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir/subdir/class_name.php (100%) rename tests/class_loader/{includes => phpbb}/dir2/dir2.php (100%) rename tests/controller/{includes => phpbb}/controller/foo.php (100%) rename tests/extension/{includes => phpbb}/default/implementation.php (100%) diff --git a/phpBB/common.php b/phpBB/common.php index f6f109c3de..962a1f951f 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -46,7 +46,7 @@ if (!defined('PHPBB_INSTALLED')) $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); // Eliminate . and .. from the path - require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); $phpbb_filesystem = new phpbb_filesystem(); $script_path = $phpbb_filesystem->clean_path($script_path); @@ -71,7 +71,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); @@ -85,7 +85,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 6618e2c3f9..11a2511aee 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -560,7 +560,7 @@ class acp_search return $finder ->extension_suffix('_backend') ->extension_directory('/search') - ->core_path('includes/search/') + ->core_path('phpbb/search/') ->get_classes(); } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b20ca1e4ea..cd6fb7931b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -82,7 +82,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); @@ -95,7 +95,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); // Set up container (must be done here because extensions table may not exist) @@ -217,7 +217,7 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $finder = $phpbb_extension_manager->get_finder(); $migrations = $finder - ->core_path('includes/db/migration/data/') + ->core_path('phpbb/db/migration/data/') ->get_classes(); $migrator->set_migrations($migrations); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 84a2a023f8..45e5777e36 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -78,7 +78,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include essential scripts -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_container.' . $phpEx); @@ -90,7 +90,7 @@ include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 3d7b6f7c88..ea23c318e3 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1435,7 +1435,7 @@ class install_install extends module $db->sql_return_on_error(true); include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx); + include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx); // We need to fill the config to let internal functions correctly work $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); @@ -1888,7 +1888,7 @@ class install_install extends module /** * Populate migrations for the installation * - * This "installs" all migrations from (root path)/includes/db/migrations/data. + * This "installs" all migrations from (root path)/phpbb/db/migrations/data. * "installs" means it adds all migrations to the migrations table, but does not * perform any of the actions in the migrations. * @@ -1900,7 +1900,7 @@ class install_install extends module $finder = $extension_manager->get_finder(); $migrations = $finder - ->core_path('includes/db/migration/data/') + ->core_path('phpbb/db/migration/data/') ->get_classes(); $migrator->populate_migrations($migrations); } diff --git a/phpBB/includes/auth/auth.php b/phpBB/phpbb/auth/auth.php similarity index 100% rename from phpBB/includes/auth/auth.php rename to phpBB/phpbb/auth/auth.php diff --git a/phpBB/includes/auth/index.htm b/phpBB/phpbb/auth/index.htm similarity index 100% rename from phpBB/includes/auth/index.htm rename to phpBB/phpbb/auth/index.htm diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php similarity index 100% rename from phpBB/includes/auth/provider/apache.php rename to phpBB/phpbb/auth/provider/apache.php diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php similarity index 100% rename from phpBB/includes/auth/provider/base.php rename to phpBB/phpbb/auth/provider/base.php diff --git a/phpBB/includes/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php similarity index 100% rename from phpBB/includes/auth/provider/db.php rename to phpBB/phpbb/auth/provider/db.php diff --git a/phpBB/includes/auth/provider/index.htm b/phpBB/phpbb/auth/provider/index.htm similarity index 100% rename from phpBB/includes/auth/provider/index.htm rename to phpBB/phpbb/auth/provider/index.htm diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php similarity index 100% rename from phpBB/includes/auth/provider/interface.php rename to phpBB/phpbb/auth/provider/interface.php diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php similarity index 100% rename from phpBB/includes/auth/provider/ldap.php rename to phpBB/phpbb/auth/provider/ldap.php diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php similarity index 100% rename from phpBB/includes/avatar/driver/driver.php rename to phpBB/phpbb/avatar/driver/driver.php diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php similarity index 100% rename from phpBB/includes/avatar/driver/gravatar.php rename to phpBB/phpbb/avatar/driver/gravatar.php diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php similarity index 100% rename from phpBB/includes/avatar/driver/interface.php rename to phpBB/phpbb/avatar/driver/interface.php diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php similarity index 100% rename from phpBB/includes/avatar/driver/local.php rename to phpBB/phpbb/avatar/driver/local.php diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php similarity index 100% rename from phpBB/includes/avatar/driver/remote.php rename to phpBB/phpbb/avatar/driver/remote.php diff --git a/phpBB/includes/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php similarity index 100% rename from phpBB/includes/avatar/driver/upload.php rename to phpBB/phpbb/avatar/driver/upload.php diff --git a/phpBB/includes/avatar/manager.php b/phpBB/phpbb/avatar/manager.php similarity index 100% rename from phpBB/includes/avatar/manager.php rename to phpBB/phpbb/avatar/manager.php diff --git a/phpBB/includes/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php similarity index 100% rename from phpBB/includes/cache/driver/apc.php rename to phpBB/phpbb/cache/driver/apc.php diff --git a/phpBB/includes/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php similarity index 100% rename from phpBB/includes/cache/driver/base.php rename to phpBB/phpbb/cache/driver/base.php diff --git a/phpBB/includes/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php similarity index 100% rename from phpBB/includes/cache/driver/eaccelerator.php rename to phpBB/phpbb/cache/driver/eaccelerator.php diff --git a/phpBB/includes/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php similarity index 100% rename from phpBB/includes/cache/driver/file.php rename to phpBB/phpbb/cache/driver/file.php diff --git a/phpBB/includes/cache/driver/interface.php b/phpBB/phpbb/cache/driver/interface.php similarity index 100% rename from phpBB/includes/cache/driver/interface.php rename to phpBB/phpbb/cache/driver/interface.php diff --git a/phpBB/includes/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php similarity index 100% rename from phpBB/includes/cache/driver/memcache.php rename to phpBB/phpbb/cache/driver/memcache.php diff --git a/phpBB/includes/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php similarity index 100% rename from phpBB/includes/cache/driver/memory.php rename to phpBB/phpbb/cache/driver/memory.php diff --git a/phpBB/includes/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php similarity index 100% rename from phpBB/includes/cache/driver/null.php rename to phpBB/phpbb/cache/driver/null.php diff --git a/phpBB/includes/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php similarity index 100% rename from phpBB/includes/cache/driver/redis.php rename to phpBB/phpbb/cache/driver/redis.php diff --git a/phpBB/includes/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php similarity index 100% rename from phpBB/includes/cache/driver/wincache.php rename to phpBB/phpbb/cache/driver/wincache.php diff --git a/phpBB/includes/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php similarity index 100% rename from phpBB/includes/cache/driver/xcache.php rename to phpBB/phpbb/cache/driver/xcache.php diff --git a/phpBB/includes/cache/service.php b/phpBB/phpbb/cache/service.php similarity index 100% rename from phpBB/includes/cache/service.php rename to phpBB/phpbb/cache/service.php diff --git a/phpBB/includes/class_loader.php b/phpBB/phpbb/class_loader.php similarity index 100% rename from phpBB/includes/class_loader.php rename to phpBB/phpbb/class_loader.php diff --git a/phpBB/includes/config/config.php b/phpBB/phpbb/config/config.php similarity index 100% rename from phpBB/includes/config/config.php rename to phpBB/phpbb/config/config.php diff --git a/phpBB/includes/config/db.php b/phpBB/phpbb/config/db.php similarity index 100% rename from phpBB/includes/config/db.php rename to phpBB/phpbb/config/db.php diff --git a/phpBB/includes/config/db_text.php b/phpBB/phpbb/config/db_text.php similarity index 100% rename from phpBB/includes/config/db_text.php rename to phpBB/phpbb/config/db_text.php diff --git a/phpBB/includes/content_visibility.php b/phpBB/phpbb/content_visibility.php similarity index 100% rename from phpBB/includes/content_visibility.php rename to phpBB/phpbb/content_visibility.php diff --git a/phpBB/includes/controller/exception.php b/phpBB/phpbb/controller/exception.php similarity index 100% rename from phpBB/includes/controller/exception.php rename to phpBB/phpbb/controller/exception.php diff --git a/phpBB/includes/controller/helper.php b/phpBB/phpbb/controller/helper.php similarity index 100% rename from phpBB/includes/controller/helper.php rename to phpBB/phpbb/controller/helper.php diff --git a/phpBB/includes/controller/provider.php b/phpBB/phpbb/controller/provider.php similarity index 100% rename from phpBB/includes/controller/provider.php rename to phpBB/phpbb/controller/provider.php diff --git a/phpBB/includes/controller/resolver.php b/phpBB/phpbb/controller/resolver.php similarity index 100% rename from phpBB/includes/controller/resolver.php rename to phpBB/phpbb/controller/resolver.php diff --git a/phpBB/includes/cron/manager.php b/phpBB/phpbb/cron/manager.php similarity index 100% rename from phpBB/includes/cron/manager.php rename to phpBB/phpbb/cron/manager.php diff --git a/phpBB/includes/cron/task/base.php b/phpBB/phpbb/cron/task/base.php similarity index 100% rename from phpBB/includes/cron/task/base.php rename to phpBB/phpbb/cron/task/base.php diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php similarity index 100% rename from phpBB/includes/cron/task/core/prune_all_forums.php rename to phpBB/phpbb/cron/task/core/prune_all_forums.php diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php similarity index 100% rename from phpBB/includes/cron/task/core/prune_forum.php rename to phpBB/phpbb/cron/task/core/prune_forum.php diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php similarity index 100% rename from phpBB/includes/cron/task/core/queue.php rename to phpBB/phpbb/cron/task/core/queue.php diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_cache.php rename to phpBB/phpbb/cron/task/core/tidy_cache.php diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_database.php rename to phpBB/phpbb/cron/task/core/tidy_database.php diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php similarity index 90% rename from phpBB/includes/cron/task/core/tidy_search.php rename to phpBB/phpbb/cron/task/core/tidy_search.php index 3ec25aa021..a3d5b7dbd2 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -61,11 +61,6 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base // Select the search method $search_type = basename($this->config['search_type']); - if (!class_exists($search_type)) - { - include($this->phpbb_root_path . "includes/search/$search_type." . $this->php_ext); - } - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user); @@ -90,7 +85,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base // Select the search method $search_type = basename($this->config['search_type']); - return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->php_ext); + return class_exists($search_type); } /** diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_sessions.php rename to phpBB/phpbb/cron/task/core/tidy_sessions.php diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php similarity index 100% rename from phpBB/includes/cron/task/core/tidy_warnings.php rename to phpBB/phpbb/cron/task/core/tidy_warnings.php diff --git a/phpBB/includes/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php similarity index 100% rename from phpBB/includes/cron/task/parametrized.php rename to phpBB/phpbb/cron/task/parametrized.php diff --git a/phpBB/includes/cron/task/task.php b/phpBB/phpbb/cron/task/task.php similarity index 100% rename from phpBB/includes/cron/task/task.php rename to phpBB/phpbb/cron/task/task.php diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php similarity index 100% rename from phpBB/includes/cron/task/wrapper.php rename to phpBB/phpbb/cron/task/wrapper.php diff --git a/phpBB/includes/datetime.php b/phpBB/phpbb/datetime.php similarity index 100% rename from phpBB/includes/datetime.php rename to phpBB/phpbb/datetime.php diff --git a/phpBB/includes/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php similarity index 100% rename from phpBB/includes/db/driver/driver.php rename to phpBB/phpbb/db/driver/driver.php diff --git a/phpBB/includes/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php similarity index 100% rename from phpBB/includes/db/driver/firebird.php rename to phpBB/phpbb/db/driver/firebird.php diff --git a/phpBB/includes/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php similarity index 100% rename from phpBB/includes/db/driver/mssql.php rename to phpBB/phpbb/db/driver/mssql.php diff --git a/phpBB/includes/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php similarity index 100% rename from phpBB/includes/db/driver/mssql_base.php rename to phpBB/phpbb/db/driver/mssql_base.php diff --git a/phpBB/includes/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php similarity index 100% rename from phpBB/includes/db/driver/mssql_odbc.php rename to phpBB/phpbb/db/driver/mssql_odbc.php diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php similarity index 100% rename from phpBB/includes/db/driver/mssqlnative.php rename to phpBB/phpbb/db/driver/mssqlnative.php diff --git a/phpBB/includes/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php similarity index 100% rename from phpBB/includes/db/driver/mysql.php rename to phpBB/phpbb/db/driver/mysql.php diff --git a/phpBB/includes/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php similarity index 100% rename from phpBB/includes/db/driver/mysql_base.php rename to phpBB/phpbb/db/driver/mysql_base.php diff --git a/phpBB/includes/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php similarity index 100% rename from phpBB/includes/db/driver/mysqli.php rename to phpBB/phpbb/db/driver/mysqli.php diff --git a/phpBB/includes/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php similarity index 100% rename from phpBB/includes/db/driver/oracle.php rename to phpBB/phpbb/db/driver/oracle.php diff --git a/phpBB/includes/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php similarity index 100% rename from phpBB/includes/db/driver/postgres.php rename to phpBB/phpbb/db/driver/postgres.php diff --git a/phpBB/includes/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php similarity index 100% rename from phpBB/includes/db/driver/sqlite.php rename to phpBB/phpbb/db/driver/sqlite.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_10_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_11_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_12_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_1_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_2_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_3_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_4.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_4_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_6_rc4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_pl1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_7_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_8.php rename to phpBB/phpbb/db/migration/data/30x/3_0_8.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_8_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc1.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc2.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc3.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/3_0_9_rc4.php rename to phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php similarity index 100% rename from phpBB/includes/db/migration/data/30x/local_url_bbcode.php rename to phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php diff --git a/phpBB/includes/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php similarity index 100% rename from phpBB/includes/db/migration/data/310/avatars.php rename to phpBB/phpbb/db/migration/data/310/avatars.php diff --git a/phpBB/includes/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php similarity index 100% rename from phpBB/includes/db/migration/data/310/boardindex.php rename to phpBB/phpbb/db/migration/data/310/boardindex.php diff --git a/phpBB/includes/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php similarity index 100% rename from phpBB/includes/db/migration/data/310/config_db_text.php rename to phpBB/phpbb/db/migration/data/310/config_db_text.php diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php similarity index 100% rename from phpBB/includes/db/migration/data/310/dev.php rename to phpBB/phpbb/db/migration/data/310/dev.php diff --git a/phpBB/includes/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php similarity index 100% rename from phpBB/includes/db/migration/data/310/extensions.php rename to phpBB/phpbb/db/migration/data/310/extensions.php diff --git a/phpBB/includes/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php similarity index 100% rename from phpBB/includes/db/migration/data/310/forgot_password.php rename to phpBB/phpbb/db/migration/data/310/forgot_password.php diff --git a/phpBB/includes/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php similarity index 100% rename from phpBB/includes/db/migration/data/310/jquery_update.php rename to phpBB/phpbb/db/migration/data/310/jquery_update.php diff --git a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notification_options_reconvert.php rename to phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notifications.php rename to phpBB/phpbb/db/migration/data/310/notifications.php diff --git a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php similarity index 100% rename from phpBB/includes/db/migration/data/310/notifications_schema_fix.php rename to phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php diff --git a/phpBB/includes/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php similarity index 100% rename from phpBB/includes/db/migration/data/310/reported_posts_display.php rename to phpBB/phpbb/db/migration/data/310/reported_posts_display.php diff --git a/phpBB/includes/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php similarity index 100% rename from phpBB/includes/db/migration/data/310/signature_module_auth.php rename to phpBB/phpbb/db/migration/data/310/signature_module_auth.php diff --git a/phpBB/includes/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php similarity index 100% rename from phpBB/includes/db/migration/data/310/softdelete_p1.php rename to phpBB/phpbb/db/migration/data/310/softdelete_p1.php diff --git a/phpBB/includes/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/softdelete_p2.php rename to phpBB/phpbb/db/migration/data/310/softdelete_p2.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php similarity index 100% rename from phpBB/includes/db/migration/data/310/style_update_p1.php rename to phpBB/phpbb/db/migration/data/310/style_update_p1.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/style_update_p2.php rename to phpBB/phpbb/db/migration/data/310/style_update_p2.php diff --git a/phpBB/includes/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php similarity index 100% rename from phpBB/includes/db/migration/data/310/teampage.php rename to phpBB/phpbb/db/migration/data/310/teampage.php diff --git a/phpBB/includes/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php similarity index 100% rename from phpBB/includes/db/migration/data/310/timezone.php rename to phpBB/phpbb/db/migration/data/310/timezone.php diff --git a/phpBB/includes/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php similarity index 100% rename from phpBB/includes/db/migration/data/310/timezone_p2.php rename to phpBB/phpbb/db/migration/data/310/timezone_p2.php diff --git a/phpBB/includes/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php similarity index 100% rename from phpBB/includes/db/migration/exception.php rename to phpBB/phpbb/db/migration/exception.php diff --git a/phpBB/includes/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php similarity index 100% rename from phpBB/includes/db/migration/migration.php rename to phpBB/phpbb/db/migration/migration.php diff --git a/phpBB/includes/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php similarity index 100% rename from phpBB/includes/db/migration/tool/config.php rename to phpBB/phpbb/db/migration/tool/config.php diff --git a/phpBB/includes/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/interface.php similarity index 100% rename from phpBB/includes/db/migration/tool/interface.php rename to phpBB/phpbb/db/migration/tool/interface.php diff --git a/phpBB/includes/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php similarity index 100% rename from phpBB/includes/db/migration/tool/module.php rename to phpBB/phpbb/db/migration/tool/module.php diff --git a/phpBB/includes/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php similarity index 100% rename from phpBB/includes/db/migration/tool/permission.php rename to phpBB/phpbb/db/migration/tool/permission.php diff --git a/phpBB/includes/db/migrator.php b/phpBB/phpbb/db/migrator.php similarity index 100% rename from phpBB/includes/db/migrator.php rename to phpBB/phpbb/db/migrator.php diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php similarity index 100% rename from phpBB/includes/db/sql_insert_buffer.php rename to phpBB/phpbb/db/sql_insert_buffer.php diff --git a/phpBB/includes/di/extension/config.php b/phpBB/phpbb/di/extension/config.php similarity index 100% rename from phpBB/includes/di/extension/config.php rename to phpBB/phpbb/di/extension/config.php diff --git a/phpBB/includes/di/extension/core.php b/phpBB/phpbb/di/extension/core.php similarity index 100% rename from phpBB/includes/di/extension/core.php rename to phpBB/phpbb/di/extension/core.php diff --git a/phpBB/includes/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php similarity index 100% rename from phpBB/includes/di/extension/ext.php rename to phpBB/phpbb/di/extension/ext.php diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php similarity index 100% rename from phpBB/includes/di/pass/collection_pass.php rename to phpBB/phpbb/di/pass/collection_pass.php diff --git a/phpBB/includes/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php similarity index 100% rename from phpBB/includes/di/pass/kernel_pass.php rename to phpBB/phpbb/di/pass/kernel_pass.php diff --git a/phpBB/includes/di/service_collection.php b/phpBB/phpbb/di/service_collection.php similarity index 100% rename from phpBB/includes/di/service_collection.php rename to phpBB/phpbb/di/service_collection.php diff --git a/phpBB/includes/error_collector.php b/phpBB/phpbb/error_collector.php similarity index 100% rename from phpBB/includes/error_collector.php rename to phpBB/phpbb/error_collector.php diff --git a/phpBB/includes/event/data.php b/phpBB/phpbb/event/data.php similarity index 100% rename from phpBB/includes/event/data.php rename to phpBB/phpbb/event/data.php diff --git a/phpBB/includes/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php similarity index 100% rename from phpBB/includes/event/dispatcher.php rename to phpBB/phpbb/event/dispatcher.php diff --git a/phpBB/includes/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php similarity index 100% rename from phpBB/includes/event/extension_subscriber_loader.php rename to phpBB/phpbb/event/extension_subscriber_loader.php diff --git a/phpBB/includes/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_exception_subscriber.php rename to phpBB/phpbb/event/kernel_exception_subscriber.php diff --git a/phpBB/includes/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_request_subscriber.php rename to phpBB/phpbb/event/kernel_request_subscriber.php diff --git a/phpBB/includes/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php similarity index 100% rename from phpBB/includes/event/kernel_terminate_subscriber.php rename to phpBB/phpbb/event/kernel_terminate_subscriber.php diff --git a/phpBB/includes/extension/base.php b/phpBB/phpbb/extension/base.php similarity index 100% rename from phpBB/includes/extension/base.php rename to phpBB/phpbb/extension/base.php diff --git a/phpBB/includes/extension/exception.php b/phpBB/phpbb/extension/exception.php similarity index 100% rename from phpBB/includes/extension/exception.php rename to phpBB/phpbb/extension/exception.php diff --git a/phpBB/includes/extension/finder.php b/phpBB/phpbb/extension/finder.php similarity index 99% rename from phpBB/includes/extension/finder.php rename to phpBB/phpbb/extension/finder.php index 49bb2a514f..155a41cda5 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -275,7 +275,7 @@ class phpbb_extension_finder $classes = array(); foreach ($files as $file => $ext_name) { - $file = preg_replace('#^includes/#', '', $file); + $file = preg_replace('#^(phpbb|includes)/#', '', $file); $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); } @@ -377,7 +377,7 @@ class phpbb_extension_finder return $files; } - + /** * Finds all file system entries matching the configured options for one * specific extension diff --git a/phpBB/includes/extension/interface.php b/phpBB/phpbb/extension/interface.php similarity index 100% rename from phpBB/includes/extension/interface.php rename to phpBB/phpbb/extension/interface.php diff --git a/phpBB/includes/extension/manager.php b/phpBB/phpbb/extension/manager.php similarity index 100% rename from phpBB/includes/extension/manager.php rename to phpBB/phpbb/extension/manager.php diff --git a/phpBB/includes/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php similarity index 100% rename from phpBB/includes/extension/metadata_manager.php rename to phpBB/phpbb/extension/metadata_manager.php diff --git a/phpBB/includes/extension/provider.php b/phpBB/phpbb/extension/provider.php similarity index 100% rename from phpBB/includes/extension/provider.php rename to phpBB/phpbb/extension/provider.php diff --git a/phpBB/includes/feed/base.php b/phpBB/phpbb/feed/base.php similarity index 100% rename from phpBB/includes/feed/base.php rename to phpBB/phpbb/feed/base.php diff --git a/phpBB/includes/feed/factory.php b/phpBB/phpbb/feed/factory.php similarity index 100% rename from phpBB/includes/feed/factory.php rename to phpBB/phpbb/feed/factory.php diff --git a/phpBB/includes/feed/forum.php b/phpBB/phpbb/feed/forum.php similarity index 100% rename from phpBB/includes/feed/forum.php rename to phpBB/phpbb/feed/forum.php diff --git a/phpBB/includes/feed/forums.php b/phpBB/phpbb/feed/forums.php similarity index 100% rename from phpBB/includes/feed/forums.php rename to phpBB/phpbb/feed/forums.php diff --git a/phpBB/includes/feed/helper.php b/phpBB/phpbb/feed/helper.php similarity index 100% rename from phpBB/includes/feed/helper.php rename to phpBB/phpbb/feed/helper.php diff --git a/phpBB/includes/feed/news.php b/phpBB/phpbb/feed/news.php similarity index 100% rename from phpBB/includes/feed/news.php rename to phpBB/phpbb/feed/news.php diff --git a/phpBB/includes/feed/overall.php b/phpBB/phpbb/feed/overall.php similarity index 100% rename from phpBB/includes/feed/overall.php rename to phpBB/phpbb/feed/overall.php diff --git a/phpBB/includes/feed/post_base.php b/phpBB/phpbb/feed/post_base.php similarity index 100% rename from phpBB/includes/feed/post_base.php rename to phpBB/phpbb/feed/post_base.php diff --git a/phpBB/includes/feed/topic.php b/phpBB/phpbb/feed/topic.php similarity index 100% rename from phpBB/includes/feed/topic.php rename to phpBB/phpbb/feed/topic.php diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php similarity index 100% rename from phpBB/includes/feed/topic_base.php rename to phpBB/phpbb/feed/topic_base.php diff --git a/phpBB/includes/feed/topics.php b/phpBB/phpbb/feed/topics.php similarity index 100% rename from phpBB/includes/feed/topics.php rename to phpBB/phpbb/feed/topics.php diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php similarity index 100% rename from phpBB/includes/feed/topics_active.php rename to phpBB/phpbb/feed/topics_active.php diff --git a/phpBB/includes/filesystem.php b/phpBB/phpbb/filesystem.php similarity index 100% rename from phpBB/includes/filesystem.php rename to phpBB/phpbb/filesystem.php diff --git a/phpBB/includes/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php similarity index 100% rename from phpBB/includes/groupposition/exception.php rename to phpBB/phpbb/groupposition/exception.php diff --git a/phpBB/includes/groupposition/interface.php b/phpBB/phpbb/groupposition/interface.php similarity index 100% rename from phpBB/includes/groupposition/interface.php rename to phpBB/phpbb/groupposition/interface.php diff --git a/phpBB/includes/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php similarity index 100% rename from phpBB/includes/groupposition/legend.php rename to phpBB/phpbb/groupposition/legend.php diff --git a/phpBB/includes/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php similarity index 100% rename from phpBB/includes/groupposition/teampage.php rename to phpBB/phpbb/groupposition/teampage.php diff --git a/phpBB/includes/hook/finder.php b/phpBB/phpbb/hook/finder.php similarity index 100% rename from phpBB/includes/hook/finder.php rename to phpBB/phpbb/hook/finder.php diff --git a/phpBB/includes/json_response.php b/phpBB/phpbb/json_response.php similarity index 100% rename from phpBB/includes/json_response.php rename to phpBB/phpbb/json_response.php diff --git a/phpBB/includes/lock/db.php b/phpBB/phpbb/lock/db.php similarity index 100% rename from phpBB/includes/lock/db.php rename to phpBB/phpbb/lock/db.php diff --git a/phpBB/includes/lock/flock.php b/phpBB/phpbb/lock/flock.php similarity index 100% rename from phpBB/includes/lock/flock.php rename to phpBB/phpbb/lock/flock.php diff --git a/phpBB/includes/log/interface.php b/phpBB/phpbb/log/interface.php similarity index 100% rename from phpBB/includes/log/interface.php rename to phpBB/phpbb/log/interface.php diff --git a/phpBB/includes/log/log.php b/phpBB/phpbb/log/log.php similarity index 100% rename from phpBB/includes/log/log.php rename to phpBB/phpbb/log/log.php diff --git a/phpBB/includes/notification/exception.php b/phpBB/phpbb/notification/exception.php similarity index 100% rename from phpBB/includes/notification/exception.php rename to phpBB/phpbb/notification/exception.php diff --git a/phpBB/includes/notification/manager.php b/phpBB/phpbb/notification/manager.php similarity index 100% rename from phpBB/includes/notification/manager.php rename to phpBB/phpbb/notification/manager.php diff --git a/phpBB/includes/notification/method/base.php b/phpBB/phpbb/notification/method/base.php similarity index 100% rename from phpBB/includes/notification/method/base.php rename to phpBB/phpbb/notification/method/base.php diff --git a/phpBB/includes/notification/method/email.php b/phpBB/phpbb/notification/method/email.php similarity index 100% rename from phpBB/includes/notification/method/email.php rename to phpBB/phpbb/notification/method/email.php diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/phpbb/notification/method/interface.php similarity index 100% rename from phpBB/includes/notification/method/interface.php rename to phpBB/phpbb/notification/method/interface.php diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php similarity index 100% rename from phpBB/includes/notification/method/jabber.php rename to phpBB/phpbb/notification/method/jabber.php diff --git a/phpBB/includes/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php similarity index 100% rename from phpBB/includes/notification/method/messenger_base.php rename to phpBB/phpbb/notification/method/messenger_base.php diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php similarity index 100% rename from phpBB/includes/notification/type/approve_post.php rename to phpBB/phpbb/notification/type/approve_post.php diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php similarity index 100% rename from phpBB/includes/notification/type/approve_topic.php rename to phpBB/phpbb/notification/type/approve_topic.php diff --git a/phpBB/includes/notification/type/base.php b/phpBB/phpbb/notification/type/base.php similarity index 100% rename from phpBB/includes/notification/type/base.php rename to phpBB/phpbb/notification/type/base.php diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php similarity index 100% rename from phpBB/includes/notification/type/bookmark.php rename to phpBB/phpbb/notification/type/bookmark.php diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php similarity index 100% rename from phpBB/includes/notification/type/disapprove_post.php rename to phpBB/phpbb/notification/type/disapprove_post.php diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php similarity index 100% rename from phpBB/includes/notification/type/disapprove_topic.php rename to phpBB/phpbb/notification/type/disapprove_topic.php diff --git a/phpBB/includes/notification/type/interface.php b/phpBB/phpbb/notification/type/interface.php similarity index 100% rename from phpBB/includes/notification/type/interface.php rename to phpBB/phpbb/notification/type/interface.php diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php similarity index 100% rename from phpBB/includes/notification/type/pm.php rename to phpBB/phpbb/notification/type/pm.php diff --git a/phpBB/includes/notification/type/post.php b/phpBB/phpbb/notification/type/post.php similarity index 100% rename from phpBB/includes/notification/type/post.php rename to phpBB/phpbb/notification/type/post.php diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php similarity index 100% rename from phpBB/includes/notification/type/post_in_queue.php rename to phpBB/phpbb/notification/type/post_in_queue.php diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php similarity index 100% rename from phpBB/includes/notification/type/quote.php rename to phpBB/phpbb/notification/type/quote.php diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php similarity index 100% rename from phpBB/includes/notification/type/report_pm.php rename to phpBB/phpbb/notification/type/report_pm.php diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php similarity index 100% rename from phpBB/includes/notification/type/report_pm_closed.php rename to phpBB/phpbb/notification/type/report_pm_closed.php diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php similarity index 100% rename from phpBB/includes/notification/type/report_post.php rename to phpBB/phpbb/notification/type/report_post.php diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php similarity index 100% rename from phpBB/includes/notification/type/report_post_closed.php rename to phpBB/phpbb/notification/type/report_post_closed.php diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php similarity index 100% rename from phpBB/includes/notification/type/topic.php rename to phpBB/phpbb/notification/type/topic.php diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php similarity index 100% rename from phpBB/includes/notification/type/topic_in_queue.php rename to phpBB/phpbb/notification/type/topic_in_queue.php diff --git a/phpBB/includes/php/ini.php b/phpBB/phpbb/php/ini.php similarity index 100% rename from phpBB/includes/php/ini.php rename to phpBB/phpbb/php/ini.php diff --git a/phpBB/includes/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php similarity index 100% rename from phpBB/includes/request/deactivated_super_global.php rename to phpBB/phpbb/request/deactivated_super_global.php diff --git a/phpBB/includes/request/interface.php b/phpBB/phpbb/request/interface.php similarity index 100% rename from phpBB/includes/request/interface.php rename to phpBB/phpbb/request/interface.php diff --git a/phpBB/includes/request/request.php b/phpBB/phpbb/request/request.php similarity index 100% rename from phpBB/includes/request/request.php rename to phpBB/phpbb/request/request.php diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php similarity index 100% rename from phpBB/includes/request/type_cast_helper.php rename to phpBB/phpbb/request/type_cast_helper.php diff --git a/phpBB/includes/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php similarity index 100% rename from phpBB/includes/request/type_cast_helper_interface.php rename to phpBB/phpbb/request/type_cast_helper_interface.php diff --git a/phpBB/includes/search/base.php b/phpBB/phpbb/search/base.php similarity index 100% rename from phpBB/includes/search/base.php rename to phpBB/phpbb/search/base.php diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php similarity index 100% rename from phpBB/includes/search/fulltext_mysql.php rename to phpBB/phpbb/search/fulltext_mysql.php diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php similarity index 100% rename from phpBB/includes/search/fulltext_native.php rename to phpBB/phpbb/search/fulltext_native.php diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php similarity index 100% rename from phpBB/includes/search/fulltext_postgres.php rename to phpBB/phpbb/search/fulltext_postgres.php diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php similarity index 100% rename from phpBB/includes/search/fulltext_sphinx.php rename to phpBB/phpbb/search/fulltext_sphinx.php diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/search/index.htm similarity index 100% rename from phpBB/includes/search/index.htm rename to phpBB/phpbb/search/index.htm diff --git a/phpBB/includes/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php similarity index 100% rename from phpBB/includes/search/sphinx/config.php rename to phpBB/phpbb/search/sphinx/config.php diff --git a/phpBB/includes/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php similarity index 100% rename from phpBB/includes/search/sphinx/config_comment.php rename to phpBB/phpbb/search/sphinx/config_comment.php diff --git a/phpBB/includes/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php similarity index 100% rename from phpBB/includes/search/sphinx/config_section.php rename to phpBB/phpbb/search/sphinx/config_section.php diff --git a/phpBB/includes/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php similarity index 100% rename from phpBB/includes/search/sphinx/config_variable.php rename to phpBB/phpbb/search/sphinx/config_variable.php diff --git a/phpBB/includes/session.php b/phpBB/phpbb/session.php similarity index 100% rename from phpBB/includes/session.php rename to phpBB/phpbb/session.php diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php similarity index 100% rename from phpBB/includes/style/extension_path_provider.php rename to phpBB/phpbb/style/extension_path_provider.php diff --git a/phpBB/includes/style/path_provider.php b/phpBB/phpbb/style/path_provider.php similarity index 100% rename from phpBB/includes/style/path_provider.php rename to phpBB/phpbb/style/path_provider.php diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php similarity index 100% rename from phpBB/includes/style/path_provider_interface.php rename to phpBB/phpbb/style/path_provider_interface.php diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php similarity index 100% rename from phpBB/includes/style/resource_locator.php rename to phpBB/phpbb/style/resource_locator.php diff --git a/phpBB/includes/style/style.php b/phpBB/phpbb/style/style.php similarity index 100% rename from phpBB/includes/style/style.php rename to phpBB/phpbb/style/style.php diff --git a/phpBB/includes/template/asset.php b/phpBB/phpbb/template/asset.php similarity index 100% rename from phpBB/includes/template/asset.php rename to phpBB/phpbb/template/asset.php diff --git a/phpBB/includes/template/context.php b/phpBB/phpbb/template/context.php similarity index 100% rename from phpBB/includes/template/context.php rename to phpBB/phpbb/template/context.php diff --git a/phpBB/includes/template/locator.php b/phpBB/phpbb/template/locator.php similarity index 100% rename from phpBB/includes/template/locator.php rename to phpBB/phpbb/template/locator.php diff --git a/phpBB/includes/template/template.php b/phpBB/phpbb/template/template.php similarity index 100% rename from phpBB/includes/template/template.php rename to phpBB/phpbb/template/template.php diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php similarity index 100% rename from phpBB/includes/template/twig/definition.php rename to phpBB/phpbb/template/twig/definition.php diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php similarity index 100% rename from phpBB/includes/template/twig/environment.php rename to phpBB/phpbb/template/twig/environment.php diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php similarity index 100% rename from phpBB/includes/template/twig/extension.php rename to phpBB/phpbb/template/twig/extension.php diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php similarity index 100% rename from phpBB/includes/template/twig/lexer.php rename to phpBB/phpbb/template/twig/lexer.php diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php similarity index 100% rename from phpBB/includes/template/twig/node/define.php rename to phpBB/phpbb/template/twig/node/define.php diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php similarity index 100% rename from phpBB/includes/template/twig/node/event.php rename to phpBB/phpbb/template/twig/node/event.php diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php similarity index 100% rename from phpBB/includes/template/twig/node/expression/binary/equalequal.php rename to phpBB/phpbb/template/twig/node/expression/binary/equalequal.php diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php similarity index 100% rename from phpBB/includes/template/twig/node/expression/binary/notequalequal.php rename to phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php similarity index 100% rename from phpBB/includes/template/twig/node/include.php rename to phpBB/phpbb/template/twig/node/include.php diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php similarity index 100% rename from phpBB/includes/template/twig/node/includeasset.php rename to phpBB/phpbb/template/twig/node/includeasset.php diff --git a/phpBB/includes/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php similarity index 100% rename from phpBB/includes/template/twig/node/includecss.php rename to phpBB/phpbb/template/twig/node/includecss.php diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php similarity index 100% rename from phpBB/includes/template/twig/node/includejs.php rename to phpBB/phpbb/template/twig/node/includejs.php diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php similarity index 100% rename from phpBB/includes/template/twig/node/includephp.php rename to phpBB/phpbb/template/twig/node/includephp.php diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php similarity index 100% rename from phpBB/includes/template/twig/node/php.php rename to phpBB/phpbb/template/twig/node/php.php diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/define.php rename to phpBB/phpbb/template/twig/tokenparser/define.php diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/event.php rename to phpBB/phpbb/template/twig/tokenparser/event.php diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/include.php rename to phpBB/phpbb/template/twig/tokenparser/include.php diff --git a/phpBB/includes/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includecss.php rename to phpBB/phpbb/template/twig/tokenparser/includecss.php diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includejs.php rename to phpBB/phpbb/template/twig/tokenparser/includejs.php diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/includephp.php rename to phpBB/phpbb/template/twig/tokenparser/includephp.php diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php similarity index 100% rename from phpBB/includes/template/twig/tokenparser/php.php rename to phpBB/phpbb/template/twig/tokenparser/php.php diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php similarity index 100% rename from phpBB/includes/template/twig/twig.php rename to phpBB/phpbb/template/twig/twig.php diff --git a/phpBB/includes/tree/interface.php b/phpBB/phpbb/tree/interface.php similarity index 100% rename from phpBB/includes/tree/interface.php rename to phpBB/phpbb/tree/interface.php diff --git a/phpBB/includes/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php similarity index 100% rename from phpBB/includes/tree/nestedset.php rename to phpBB/phpbb/tree/nestedset.php diff --git a/phpBB/includes/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php similarity index 100% rename from phpBB/includes/tree/nestedset_forum.php rename to phpBB/phpbb/tree/nestedset_forum.php diff --git a/phpBB/includes/user.php b/phpBB/phpbb/user.php similarity index 100% rename from phpBB/includes/user.php rename to phpBB/phpbb/user.php diff --git a/phpBB/includes/user_loader.php b/phpBB/phpbb/user_loader.php similarity index 100% rename from phpBB/includes/user_loader.php rename to phpBB/phpbb/user_loader.php diff --git a/phpunit.xml.all b/phpunit.xml.all index d47864e104..d18518d3e3 100644 --- a/phpunit.xml.all +++ b/phpunit.xml.all @@ -27,9 +27,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ac45597b45..c852f91b50 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -34,9 +34,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/phpunit.xml.functional b/phpunit.xml.functional index 3a3d653b47..cd9cc8771f 100644 --- a/phpunit.xml.functional +++ b/phpunit.xml.functional @@ -33,9 +33,10 @@ ./phpBB/includes/ + ./phpBB/phpbb/ - ./phpBB/includes/search/fulltext_native.php - ./phpBB/includes/search/fulltext_mysql.php + ./phpBB/phpbb/search/fulltext_native.php + ./phpBB/phpbb/search/fulltext_mysql.php ./phpBB/includes/captcha/ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index a38740c82d..68cbb64c03 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,13 +14,13 @@ require_once $phpbb_root_path . 'includes/startup.php'; $table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; -require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; +require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; $phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php"); $phpbb_class_loader_mock->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php"); $phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', "php"); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'phpbb/', "php"); $phpbb_class_loader->register(); require_once 'test_framework/phpbb_test_case_helpers.php'; diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index bf27c7c217..2b55c1ff8d 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -30,9 +30,9 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/'); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/'); - $prefix .= 'includes/'; + $prefix .= 'phpbb/'; $this->assertEquals( '', @@ -71,10 +71,10 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $cache = new phpbb_mock_cache($cache_map); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', 'php', $cache); - $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', 'php', $cache); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/', 'php', $cache); + $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'phpbb/', 'php', $cache); - $prefix .= 'includes/'; + $prefix .= 'phpbb/'; $this->assertEquals( $prefix . 'dir/class_name.php', diff --git a/tests/class_loader/includes/class_name.php b/tests/class_loader/phpbb/class_name.php similarity index 100% rename from tests/class_loader/includes/class_name.php rename to tests/class_loader/phpbb/class_name.php diff --git a/tests/class_loader/includes/dir.php b/tests/class_loader/phpbb/dir.php similarity index 100% rename from tests/class_loader/includes/dir.php rename to tests/class_loader/phpbb/dir.php diff --git a/tests/class_loader/includes/dir/class_name.php b/tests/class_loader/phpbb/dir/class_name.php similarity index 100% rename from tests/class_loader/includes/dir/class_name.php rename to tests/class_loader/phpbb/dir/class_name.php diff --git a/tests/class_loader/includes/dir/subdir/class_name.php b/tests/class_loader/phpbb/dir/subdir/class_name.php similarity index 100% rename from tests/class_loader/includes/dir/subdir/class_name.php rename to tests/class_loader/phpbb/dir/subdir/class_name.php diff --git a/tests/class_loader/includes/dir2/dir2.php b/tests/class_loader/phpbb/dir2/dir2.php similarity index 100% rename from tests/class_loader/includes/dir2/dir2.php rename to tests/class_loader/phpbb/dir2/dir2.php diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c06bf7d548..dfc4f80469 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -59,7 +59,7 @@ class phpbb_controller_controller_test extends phpbb_test_case } if (!class_exists('phpbb_controller_foo')) { - include(__DIR__.'/includes/controller/foo.php'); + include(__DIR__.'/phpbb/controller/foo.php'); } $resolver = new phpbb_controller_resolver(new phpbb_user, $container); diff --git a/tests/controller/includes/controller/foo.php b/tests/controller/phpbb/controller/foo.php similarity index 100% rename from tests/controller/includes/controller/foo.php rename to tests/controller/phpbb/controller/foo.php diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index c28925272e..2d97672878 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -7,9 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/user.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/datetime.php'; require_once dirname(__FILE__) . '/../mock/lang.php'; class phpbb_datetime_from_format_test extends phpbb_test_case diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 1e40c9c6d6..07eb666e93 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migrator.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/migration.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/migration/dummy.php'; diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index 7d582f230b..b82d1ef48d 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -7,9 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/config.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; - class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case { public function setup() diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 3303086b26..828fb76c65 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/module.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case { diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index 438ab2b28e..79d9db66da 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/permission.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case { diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index d67dea3719..fceb8aa3d8 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../phpBB/includes/error_collector.php'; class phpbb_error_collector_test extends phpbb_test_case { diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 6f3cebbd7c..3bf2c42573 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -36,7 +36,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_suffix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_suffix('_class') ->get_classes(); @@ -81,7 +81,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_prefix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_prefix('hidden_') ->get_classes(); @@ -98,7 +98,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_directory_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_directory('type') ->get_classes(); @@ -209,7 +209,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_cached_get_files() { $query = array( - 'core_path' => 'includes/foo', + 'core_path' => 'phpbb/foo', 'core_suffix' => false, 'core_prefix' => false, 'core_directory' => 'bar', diff --git a/tests/extension/includes/default/implementation.php b/tests/extension/phpbb/default/implementation.php similarity index 100% rename from tests/extension/includes/default/implementation.php rename to tests/extension/phpbb/default/implementation.php diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 1ab9488568..6827aaa1b6 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -11,7 +11,6 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; require_once dirname(__FILE__) . '/../mock/user.php'; require_once dirname(__FILE__) . '/../mock/cache.php'; diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 1665c493be..8b9df33a63 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -10,6 +10,7 @@ require_once __DIR__ . '/../../phpBB/includes/functions.php'; require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; require_once __DIR__ . '/../../phpBB/includes/functions_upload.php'; +require_once __DIR__ . '/../mock/filespec.php'; class phpbb_fileupload_test extends phpbb_test_case { From 057d860d07fe829104aa938338830787415bc1c6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 00:56:37 -0400 Subject: [PATCH 571/575] [ticket/11696] Rename db_tools.php so it can be autoloaded PHPBB3-11696 --- phpBB/config/services.yml | 1 - phpBB/includes/acp/acp_database.php | 4 ---- .../captcha/plugins/phpbb_captcha_qa_plugin.php | 12 ++---------- phpBB/includes/db/{db_tools.php => tools.php} | 0 phpBB/includes/functions_install.php | 6 ------ phpBB/phpbb/search/fulltext_sphinx.php | 5 ----- tests/dbal/auto_increment_test.php | 1 - tests/dbal/db_tools_test.php | 1 - tests/dbal/migrator_test.php | 2 -- tests/extension/metadata_manager_test.php | 2 -- tests/functional/extension_controller_test.php | 1 - tests/functional/metadata_manager_test.php | 2 -- tests/notification/convert_test.php | 2 -- 13 files changed, 2 insertions(+), 37 deletions(-) rename phpBB/includes/db/{db_tools.php => tools.php} (100%) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 25fff79de3..c1579cfb57 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -126,7 +126,6 @@ services: - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] dbal.tools: - file: %core.root_path%includes/db/db_tools.%core.php_ext% class: phpbb_db_tools arguments: - @dbal.conn diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index ebcbd28a87..5d191b3d0f 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -28,10 +28,6 @@ class acp_database global $cache, $db, $user, $auth, $template, $table_prefix; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - if (!class_exists('phpbb_db_tools')) - { - require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); - } $this->db_tools = new phpbb_db_tools($db); $user->add_lang('acp/database'); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index ec7636f511..6843f25d72 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -110,12 +110,8 @@ class phpbb_captcha_qa */ static public function is_installed() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools', false)) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); @@ -297,12 +293,8 @@ class phpbb_captcha_qa */ function install() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools')) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/tools.php similarity index 100% rename from phpBB/includes/db/db_tools.php rename to phpBB/includes/db/tools.php diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 8978e3fadd..bd0ffaaf00 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -184,12 +184,6 @@ function dbms_select($default = '', $only_20x_options = false) */ function get_tables(&$db) { - if (!class_exists('phpbb_db_tools')) - { - global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); - } - $db_tools = new phpbb_db_tools($db); return $db_tools->sql_list_tables(); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 2f7b236c78..4f3f852664 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -135,11 +135,6 @@ class phpbb_search_fulltext_sphinx $this->db = $db; $this->auth = $auth; - if (!class_exists('phpbb_db_tools')) - { - require($this->phpbb_root_path . 'includes/db/db_tools.' . $this->php_ext); - } - // Initialize phpbb_db_tools object $this->db_tools = new phpbb_db_tools($this->db); diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index e87fc1c6bd..077bfad933 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; class phpbb_dbal_auto_increment_test extends phpbb_database_test_case { diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index c20e46011f..7bdbc696e7 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; class phpbb_dbal_db_tools_test extends phpbb_database_test_case { diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 07eb666e93..9e55e4dd35 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -8,8 +8,6 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - require_once dirname(__FILE__) . '/migration/dummy.php'; require_once dirname(__FILE__) . '/migration/unfulfillable.php'; require_once dirname(__FILE__) . '/migration/if.php'; diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index bd88f396d9..e5bd29092e 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { protected $class_loader; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 9ddf1e3e5c..7d29f0000c 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -6,7 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; /** * @group functional diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index c55e7373ea..651c99a99d 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - /** * @group functional */ diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 4d00fa0a1e..c038020385 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -6,8 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ - -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/../mock/sql_insert_buffer.php'; class phpbb_notification_convert_test extends phpbb_database_test_case From 5d4c443c2df1685578084417123d52b86eb3bfb6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 01:01:53 -0400 Subject: [PATCH 572/575] [ticket/11696] Remove manual loading of db_tools in extension controller test Remember to store the file, before commiting it... PHPBB3-11696 --- tests/functional/extension_module_test.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index c573ea5410..c31a892ce9 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -6,8 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ - -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; /** From 131194d216f85dffe4fb9d8fd64eb15248fd374b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:12:49 -0400 Subject: [PATCH 573/575] [ticket/11696] Rename constructor to __construct() PHPBB3-11696 --- phpBB/includes/db/tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/db/tools.php b/phpBB/includes/db/tools.php index 983cdc18ea..492284ffcd 100644 --- a/phpBB/includes/db/tools.php +++ b/phpBB/includes/db/tools.php @@ -303,7 +303,7 @@ class phpbb_db_tools * @param phpbb_db_driver $db Database connection * @param bool $return_statements True if only statements should be returned and no SQL being executed */ - function phpbb_db_tools(phpbb_db_driver $db, $return_statements = false) + public function __construct(phpbb_db_driver $db, $return_statements = false) { $this->db = $db; $this->return_statements = $return_statements; From f302cbe175e99f90448458f44a499eeb33f75261 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:16:15 -0400 Subject: [PATCH 574/575] [ticket/11696] Move file to new directory PHPBB3-11696 --- phpBB/{includes => phpbb}/db/tools.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpBB/{includes => phpbb}/db/tools.php (100%) diff --git a/phpBB/includes/db/tools.php b/phpBB/phpbb/db/tools.php similarity index 100% rename from phpBB/includes/db/tools.php rename to phpBB/phpbb/db/tools.php From 405b5e54f6e97f70417af38c27f8fa2fb4062c3e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Jul 2013 10:49:23 -0400 Subject: [PATCH 575/575] [ticket/11702] Fix forum_posts left over for link-click counts in viewforum.php PHPBB3-11702 --- phpBB/viewforum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 06af674ee6..5a59e021b3 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -105,7 +105,7 @@ if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) { $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET forum_posts = forum_posts + 1 + SET forum_posts_approved = forum_posts_approved + 1 WHERE forum_id = ' . $forum_id; $db->sql_query($sql); }