diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-03-30 14:05:40 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-30 14:05:40 +0200 |
commit | d4f1bdea3bdd27f7c9f99d6121b2762482fc1707 (patch) | |
tree | b730fdcc1fe5c486806728474b20944c982dfa75 | |
parent | cab437ae83297a8fc092fe77fdae8eb66d3b93a1 (diff) | |
parent | 29a904ce45f16eac928aa516be366780f05c0950 (diff) | |
download | forums-d4f1bdea3bdd27f7c9f99d6121b2762482fc1707.tar forums-d4f1bdea3bdd27f7c9f99d6121b2762482fc1707.tar.gz forums-d4f1bdea3bdd27f7c9f99d6121b2762482fc1707.tar.bz2 forums-d4f1bdea3bdd27f7c9f99d6121b2762482fc1707.tar.xz forums-d4f1bdea3bdd27f7c9f99d6121b2762482fc1707.zip |
Merge remote-tracking branch 'upstream/develop' into feature/event-dispatcher
* upstream/develop: (35 commits)
[ticket/10730] Added label tag around "select" text in post splitting UI
[ticket/10732] Add config_dev.php and config_test.php to .gitignore
[ticket/10586] Added space in if statement
[ticket/10586] Tidy up comments
[task/php5.3] Updated range of tested PHP versions
[task/php5.3] Looks like I missed a few places that needed PHP 5.2 changed to PHP 5.3.2
[task/php5.3] Changed minimum PHP requirement for Ascraeus to 5.3.2
[ticket/10129] Remove apostrophes and plurals in ACP user management -> permissions language file as per ticket.
[ticket/10703] Added a condition to check if ext directory exists
[ticket/10708] Check converted passwords for multi-byte characters
[ticket/10586] Tests finally work (thanks naderman)
[ticket/10586] Correctly purge board cache and don't rename install directory
[ticket/10586] trying to get tests to work
[ticket/10586] more work on getting tests to pass
[ticket/10586] Tests are coming along, just a little more to go
[ticket/10586] Rename install directory back to install/ after tests
[ticket/10586] browse tests now work, but mine dont. at least we are making progress
[ticket/10586] initial work on copying fixtures. Note that this depends on 10706
[ticket/10586] Adding the extensions used by the tests
[ticket/10586] Now tests run, but fail. But here is what I have.
...
44 files changed, 498 insertions, 37 deletions
diff --git a/.gitignore b/.gitignore index c6db64b115..4093aeb56d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /phpBB/cache/queue.php.lock /phpBB/composer.phar /phpBB/config.php +/phpBB/config_dev.php +/phpBB/config_test.php /phpBB/ext/* /phpBB/files/* /phpBB/images/avatars/gallery/* diff --git a/phpBB/common.php b/phpBB/common.php index fafcb81feb..129f7e4881 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -5,7 +5,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * -* Minimum Requirement: PHP 5.2.0 +* Minimum Requirement: PHP 5.3.2 */ /** diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 80d6e05d09..987c9152d4 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1528,6 +1528,7 @@ function get_schema_struct() 'report_closed' => array('BOOL', 0), 'report_time' => array('TIMESTAMP', 0), 'report_text' => array('MTEXT_UNI', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/develop/extensions.php b/phpBB/develop/extensions.php index 2f7c3d1167..43621f3080 100644 --- a/phpBB/develop/extensions.php +++ b/phpBB/develop/extensions.php @@ -37,6 +37,13 @@ function list_extensions() global $phpbb_extension_manager; $phpbb_extension_manager->load_extensions(); + $all = array_keys($phpbb_extension_manager->all_available()); + + if (empty($all)) + { + echo "There were no extensions found.\n"; + exit(3); + } echo "Enabled:\n"; $enabled = array_keys($phpbb_extension_manager->all_enabled()); @@ -49,7 +56,6 @@ function list_extensions() echo "\n"; echo "Available:\n"; - $all = array_keys($phpbb_extension_manager->all_available()); $purged = array_diff($all, $enabled, $disabled); print_extensions($purged); } diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 9b27ac06bc..e3d56baa36 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -138,7 +138,7 @@ <li>Oracle</li> </ul> </li> - <li><strong>PHP 5.2.0+</strong> with support for the database you intend to use.</li> + <li><strong>PHP 5.3.2+</strong> with support for the database you intend to use.</li> <li>getimagesize() function need to be enabled.</li> <li>These optional presence of the following modules within PHP will provide access to additional features, but they are not required. <ul> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 592d2be76e..ccd368fbde 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -306,11 +306,11 @@ <div class="content"> - <p>phpBB is no longer supported on PHP4 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 5.2.0.</p> + <p>phpBB is no longer supported on PHP4 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 5.3.2.</p> <p>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.</p> - <p>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 5.2.0 to 5.3.x without problem.</p> + <p>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 5.3.2 to 5.4.x without problem.</p> <a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 55fbf6d4e8..5581c10786 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2347,7 +2347,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="codebox"><pre> ... -'FOO_BAR' => 'PHP version < 5.2.0.<br /> +'FOO_BAR' => 'PHP version < 5.3.2.<br /> Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.', ... </pre></div> @@ -2356,7 +2356,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="codebox"><pre> ... -'FOO_BAR' => 'PHP version &lt; 5.2.0.<br /> +'FOO_BAR' => 'PHP version &lt; 5.3.2.<br /> Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.', ... </pre></div> @@ -2365,7 +2365,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="codebox"><pre> ... -'FOO_BAR' => 'PHP version &lt; 5.2.0.<br /> +'FOO_BAR' => 'PHP version &lt; 5.3.2.<br /> Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.', ... </pre></div> diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index b30c294ce2..88c29702d4 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -397,11 +397,11 @@ class acp_main // Version check $user->add_lang('install'); - if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.2.0', '<')) + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.2', '<')) { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, - 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&t=1958605">', '</a>'), + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&t=2152375">', '</a>'), )); } diff --git a/phpBB/includes/extension/controller_interface.php b/phpBB/includes/extension/controller_interface.php new file mode 100644 index 0000000000..bcc8972db4 --- /dev/null +++ b/phpBB/includes/extension/controller_interface.php @@ -0,0 +1,31 @@ +<?php +/** +* +* @package extension +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* The interface that extension classes have to implement to run front pages +* +* @package extension +*/ +interface phpbb_extension_controller_interface +{ + /** + * handle the request to display a page from an extension + * + * @return null + */ + public function handle(); +} diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index c38f0df32e..537c19aff8 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -352,6 +352,10 @@ class phpbb_extension_manager public function all_available() { $available = array(); + if (!is_dir($this->phpbb_root_path . 'ext/')) + { + return $available; + } $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'), @@ -428,6 +432,28 @@ class phpbb_extension_manager } return $disabled; } + + /** + * Check to see if a given extension is available on the filesystem + * + * @param string $name Extension name to check NOTE: Can be user input + * @return bool Depending on whether or not the extension is available + */ + public function available($name) + { + return file_exists($this->get_extension_path($name, true)); + } + + /** + * Check to see if a given extension is enabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is enabled + */ + public function enabled($name) + { + return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active']; + } /** * Instantiates a phpbb_extension_finder. diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 95e84e816b..69c6a4cfff 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -71,7 +71,7 @@ class mcp_reports // closed reports are accessed by report id $report_id = request_var('r', 0); - $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour + $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id @@ -116,8 +116,9 @@ class mcp_reports $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'], + 'REPORTED_POST_ID' => $post_id, + )); } $topic_tracking_info = $extensions = $attachments = array(); @@ -226,7 +227,7 @@ class mcp_reports 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), - 'POST_PREVIEW' => $message, + 'POST_PREVIEW' => bbcode_nl2br($report['reported_post_text']), 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], diff --git a/phpBB/index.php b/phpBB/index.php index f1243bb336..d71878a885 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -24,6 +24,39 @@ $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); +// Handle the display of extension front pages +if ($ext = $request->variable('ext', '')) +{ + $class = 'phpbb_ext_' . str_replace('/', '_', $ext) . '_controller'; + + if (!$phpbb_extension_manager->available($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DOES_NOT_EXIST', $ext)); + } + else if (!$phpbb_extension_manager->enabled($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DISABLED', $ext)); + } + else if (!class_exists($class)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); + } + + $controller = new $class; + + if (!($controller instanceof phpbb_extension_controller_interface)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang('EXTENSION_CLASS_WRONG_TYPE', $class)); + } + + $controller->handle(); + exit_handler(); +} + display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c2b36f5992..25b6387485 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,6 +1089,9 @@ function database_update_info() PROFILE_FIELDS_TABLE => array( 'field_show_on_pm' => array('BOOL', 0), ), + REPORTS_TABLE => array( + 'reported_post_text' => array('MTEXT_UNI', ''), + ), ), 'change_columns' => array( GROUPS_TABLE => array( diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 8191288f9d..a196a429e4 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -17,9 +17,9 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (version_compare(PHP_VERSION, '5.2.0') < 0) +if (version_compare(PHP_VERSION, '5.3.2') < 0) { - die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install phpBB 3.1'); + die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.2 or higher before trying to install phpBB 3.1'); } function phpbb_require_updated($path, $optional = false) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4663b5204e..361376763d 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -140,7 +140,7 @@ class install_install extends module // Test the minimum PHP version $php_version = PHP_VERSION; - if (version_compare($php_version, '5.2.0') < 0) + if (version_compare($php_version, '5.3.2') < 0) { $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index daeba45864..b88ed0a64a 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -909,7 +909,8 @@ CREATE TABLE phpbb_reports ( 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 + 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);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 736917fdcb..a0399756e9 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1108,7 +1108,8 @@ CREATE TABLE [phpbb_reports] ( [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 + [report_text] [text] DEFAULT ('') NOT NULL , + [reported_post_text] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 97c378621b..69648c6b14 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports ( 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) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 9615905625..9b32ee19c6 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports ( 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) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 5d60d2a19e..032c8633dd 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1214,6 +1214,7 @@ CREATE TABLE phpbb_reports ( 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) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index d7377ac2e6..f482920776 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -853,6 +853,7 @@ CREATE TABLE phpbb_reports ( 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) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 257937275c..56468bcdd9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -627,7 +627,8 @@ CREATE TABLE phpbb_reports ( 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 '' + 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); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 7f1ecb5c01..242329a041 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -95,10 +95,10 @@ $lang = array_merge($lang, array( 'ACP_GLOBAL_MODERATORS' => 'Global moderators', 'ACP_GLOBAL_PERMISSIONS' => 'Global permissions', 'ACP_GROUPS' => 'Groups', - 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Groups’ forum permissions', + 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Group forum permissions', 'ACP_GROUPS_MANAGE' => 'Manage groups', 'ACP_GROUPS_MANAGEMENT' => 'Group management', - 'ACP_GROUPS_PERMISSIONS' => 'Groups’ permissions', + 'ACP_GROUPS_PERMISSIONS' => 'Group permissions', 'ACP_GROUPS_POSITION' => 'Manage group positions', 'ACP_ICONS' => 'Topic icons', @@ -175,9 +175,9 @@ $lang = array_merge($lang, array( 'ACP_THEMES' => 'Themes', 'ACP_UPDATE' => 'Updating', - 'ACP_USERS_FORUM_PERMISSIONS' => 'Users’ forum permissions', + 'ACP_USERS_FORUM_PERMISSIONS' => 'User forum permissions', 'ACP_USERS_LOGS' => 'User logs', - 'ACP_USERS_PERMISSIONS' => 'Users’ permissions', + 'ACP_USERS_PERMISSIONS' => 'User permissions', 'ACP_USER_ATTACH' => 'Attachments', 'ACP_USER_AVATAR' => 'Avatar', 'ACP_USER_FEEDBACK' => 'Feedback', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 7f7ecacfcf..2a8d857197 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -39,10 +39,10 @@ $lang = array_merge($lang, array( <p>Permissions are highly granular and grouped into four major sections, which are:</p> <h2>Global Permissions</h2> - <p>These are used to control access on a global level and apply to the entire bulletin board. They are further divided into Users’ Permissions, Groups’ Permissions, Administrators and Global Moderators.</p> + <p>These are used to control access on a global level and apply to the entire bulletin board. They are further divided into User Permissions, Group Permissions, Administrators and Global Moderators.</p> <h2>Forum Based Permissions</h2> - <p>These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, Users’ Forum Permissions and Groups’ Forum Permissions.</p> + <p>These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, User Forum Permissions and Group Forum Permissions.</p> <h2>Permission Roles</h2> <p>These are used to create different sets of permissions for the different permission types later being able to be assigned on a role-based basis. The default roles should cover the administration of bulletin boards large and small, though within each of the four divisions, you can add/edit/delete roles as you see fit.</p> @@ -82,13 +82,13 @@ $lang = array_merge($lang, array( 'ACP_FORUM_PERMISSIONS_COPY_EXPLAIN' => 'Here you can copy forum permissions from one forum to one or more other forums.', 'ACP_GLOBAL_MODERATORS_EXPLAIN' => 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.', 'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to groups.', - 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual users permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.', + 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual user permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', 'ACP_ADMIN_ROLES_EXPLAIN' => 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_FORUM_ROLES_EXPLAIN' => 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_MOD_ROLES_EXPLAIN' => 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_USER_ROLES_EXPLAIN' => 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', 'ACP_USERS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to users.', - 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User’s permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.', + 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', 'ACP_VIEW_ADMIN_PERMISSIONS_EXPLAIN' => 'Here you can view the effective administrative permissions assigned to the selected users/groups.', 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the global moderative permissions assigned to the selected users/groups.', 'ACP_VIEW_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can view the forum permissions assigned to the selected users/groups and forums.', @@ -224,8 +224,8 @@ $lang = array_merge($lang, array( 'SELECT_TYPE' => 'Select type', 'SET_PERMISSIONS' => 'Set permissions', 'SET_ROLE_PERMISSIONS' => 'Set role permissions', - 'SET_USERS_PERMISSIONS' => 'Set users permissions', - 'SET_USERS_FORUM_PERMISSIONS' => 'Set users forum permissions', + 'SET_USERS_PERMISSIONS' => 'Set user permissions', + 'SET_USERS_FORUM_PERMISSIONS' => 'Set user forum permissions', 'TRACE_DEFAULT' => 'By default every permission is <samp>NO</samp> (unset). So the permission can be overwritten by other settings.', 'TRACE_FOR' => 'Trace for', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7741ff8d1f..94edddc6f5 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -185,7 +185,11 @@ $lang = array_merge($lang, array( 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', + 'EXTENSION_CONTROLLER_MISSING' => 'The extension <strong>%s</strong> is missing a controller class and cannot be accessed through the front-end.', + 'EXTENSION_CLASS_WRONG_TYPE' => 'The extension controller class <strong>%s</strong> is not an instance of the phpbb_extension_controller_interface.', + 'EXTENSION_DISABLED' => 'The extension <strong>%s</strong> is not enabled.', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension <strong>%s</strong> has been deactivated and can no longer be displayed.', + 'EXTENSION_DOES_NOT_EXIST' => 'The extension <strong>%s</strong> does not exist.', 'FAQ' => 'FAQ', 'FAQ_EXPLAIN' => 'Frequently Asked Questions', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 254db4a5c1..ca6045a921 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -300,10 +300,10 @@ $lang = array_merge($lang, array( 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', 'PHP_SAFE_MODE' => 'Safe mode', 'PHP_SETTINGS' => 'PHP version and settings', - 'PHP_SETTINGS_EXPLAIN' => '<strong>Required</strong> - You must be running at least version 5.2.0 of PHP in order to install phpBB. If <var>safe mode</var> is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', + 'PHP_SETTINGS_EXPLAIN' => '<strong>Required</strong> - You must be running at least version 5.3.2 of PHP in order to install phpBB. If <var>safe mode</var> is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting <var>allow_url_fopen</var> is enabled', 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => '<strong>Optional</strong> - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', - 'PHP_VERSION_REQD' => 'PHP version >= 5.2.0', + 'PHP_VERSION_REQD' => 'PHP version >= 5.3.2', 'POST_ID' => 'Post ID', 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using <strong>%s</strong> as table prefix.', 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', diff --git a/phpBB/report.php b/phpBB/report.php index e29001d389..29b46a6211 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -71,8 +71,9 @@ if ($post_id) trigger_error('POST_NOT_EXIST'); } - $forum_id = (int) $report_data['forum_id']; - $topic_id = (int) $report_data['topic_id']; + $forum_id = (int) $report_data['forum_id']; + $topic_id = (int) $report_data['topic_id']; + $reported_post_text = $report_data['post_text']; $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' @@ -130,6 +131,8 @@ else $message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } + + $reported_post_text = $report_data['message_text']; } // Submit report? @@ -155,7 +158,8 @@ if ($submit && $reason_id) 'user_notify' => (int) $user_notify, 'report_closed' => 0, 'report_time' => (int) time(), - 'report_text' => (string) $report_text + 'report_text' => (string) $report_text, + 'reported_post_text' => $reported_post_text, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 85c87b8cca..ab0c83a56f 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -106,7 +106,7 @@ onload_functions.push('subPanels()'); <div class="inner"><span class="corners-top"><span></span></span> <div class="postbody" id="pr{postrow.POST_ID}"> - <ul class="profile-icons"><li class="info-icon"><a href="{postrow.U_POST_DETAILS}" title="{L_POST_DETAILS}"><span>{L_POST_DETAILS}</span></a></li><li>{L_SELECT}: <input type="checkbox" name="post_id_list[]" value="{postrow.POST_ID}"<!-- IF postrow.S_CHECKED --> checked="checked"<!-- ENDIF --> /></li></ul> + <ul class="profile-icons"><li class="info-icon"><a href="{postrow.U_POST_DETAILS}" title="{L_POST_DETAILS}"><span>{L_POST_DETAILS}</span></a></li><li><label for="post_id_list_select_{postrow.POST_ID}">{L_SELECT}: <input type="checkbox" id="post_id_list_select_{postrow.POST_ID}" name="post_id_list[]" value="{postrow.POST_ID}"<!-- IF postrow.S_CHECKED --> checked="checked"<!-- ENDIF --> /></label></li></ul> <h3><a href="{postrow.U_POST_DETAILS}">{postrow.POST_SUBJECT}</a></h3> <p class="author"><a href="#pr{postrow.POST_ID}">{postrow.MINI_POST_IMG}</a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></p> diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 67627f9785..1c4b67044d 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@ <div class="inner"><span class="corners-top"><span></span></span> {topic_review_row.L_IGNORE_POST} <!-- ELSE --> - <div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> + <div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF topic_review_row.POST_ID == REPORTED_POST_ID --> reported<!-- ENDIF -->"> <div class="inner"><span class="corners-top"><span></span></span> <!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 2bfa95f3d4..cbd6746a8a 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,6 +51,13 @@ <table width="100%" cellspacing="0" cellpadding="2"> <tr> <td> + <!-- IF topic_review_row.POST_ID == REPORTED_POST_ID --> + <table width="100%" cellspacing="0"> + <tr> + <span class="postreported">{REPORTED_IMG}</span> + </tr> + </table> + <!-- ENDIF --> <div class="postbody">{topic_review_row.MESSAGE}</div> <!-- IF topic_review_row.S_HAS_ATTACHMENTS --> diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php new file mode 100644 index 0000000000..4ee0e68718 --- /dev/null +++ b/tests/functional/extension_controller_test.php @@ -0,0 +1,153 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_extension_controller_test extends phpbb_functional_test_case +{ + protected $phpbb_extension_manager; + /** + * This should only be called once before the tests are run. + * This is used to copy the fixtures to the phpBB install + */ + static public function setUpBeforeClass() + { + global $phpbb_root_path; + parent::setUpBeforeClass(); + + // these directories need to be created before the files can be copied + $directories = array( + $phpbb_root_path . 'ext/error/class/', + $phpbb_root_path . 'ext/error/classtype/', + $phpbb_root_path . 'ext/error/disabled/', + $phpbb_root_path . 'ext/foo/bar/', + $phpbb_root_path . 'ext/foo/bar/styles/prosilver/template/', + $phpbb_root_path . 'ext/foobar/', + $phpbb_root_path . 'ext/foobar/styles/prosilver/template/', + ); + + foreach ($directories as $dir) + { + if (!is_dir($dir)) + { + mkdir($dir, 0777, true); + } + } + + $fixtures = array( + 'error/class/controller.php', + 'error/class/ext.php', + 'error/classtype/controller.php', + 'error/classtype/ext.php', + 'error/disabled/controller.php', + 'error/disabled/ext.php', + 'foo/bar/controller.php', + 'foo/bar/ext.php', + 'foo/bar/styles/prosilver/template/foobar_body.html', + 'foobar/controller.php', + 'foobar/ext.php', + 'foobar/styles/prosilver/template/foobar_body.html', + ); + + foreach ($fixtures as $fixture) + { + if (!copy("tests/functional/fixtures/ext/$fixture", "{$phpbb_root_path}ext/$fixture")) + { + echo 'Could not copy file ' . $fixture; + } + } + } + + public static function tearDownAfterClass() + { + $phpbb_root_path = self::$config['phpbb_functional_path']; + + // @todo delete the fixtures from the $phpbb_root_path board + // Note that it might be best to find a public domain function + // and port it into here instead of writing it from scratch + } + + public function setUp() + { + parent::setUp(); + + $this->phpbb_extension_manager = $this->get_extension_manager(); + + $this->purge_cache(); + } + + /** + * Check an extension at ./ext/foobar/ which should have the class + * phpbb_ext_foobar_controller + */ + public function test_foobar() + { + $this->phpbb_extension_manager->enable('foobar'); + $crawler = $this->request('GET', 'index.php?ext=foobar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $this->phpbb_extension_manager->purge('foobar'); + } + + /** + * Check an extension at ./ext/foo/bar/ which should have the class + * phpbb_ext_foo_bar_controller + */ + public function test_foo_bar() + { + $this->phpbb_extension_manager->enable('foo/bar'); + $crawler = $this->request('GET', 'index.php?ext=foo/bar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $this->phpbb_extension_manager->purge('foo/bar'); + } + + /** + * Check the error produced by extension at ./ext/error/class which has class + * phpbb_ext_foobar_controller + */ + public function test_error_class_name() + { + $this->phpbb_extension_manager->enable('error/class'); + $crawler = $this->request('GET', 'index.php?ext=error/class'); + $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); + $this->phpbb_extension_manager->purge('error/class'); + } + + /** + * Check the error produced by extension at ./ext/error/classtype which has class + * phpbb_ext_error_classtype_controller but does not implement phpbb_extension_controller_interface + */ + public function test_error_class_type() + { + $this->phpbb_extension_manager->enable('error/classtype'); + $crawler = $this->request('GET', 'index.php?ext=error/classtype'); + $this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text()); + $this->phpbb_extension_manager->purge('error/classtype'); + } + + /** + * Check the error produced by extension at ./ext/error/disabled that is (obviously) + * a disabled extension + */ + public function test_error_ext_disabled() + { + $crawler = $this->request('GET', 'index.php?ext=error/disabled'); + $this->assertContains("The extension error/disabled is not enabled", $crawler->filter('#message')->text()); + } + + /** + * Check the error produced by extension at ./ext/error/404 that is (obviously) + * not existant + */ + public function test_error_ext_missing() + { + $crawler = $this->request('GET', 'index.php?ext=error/404'); + $this->assertContains("The extension error/404 does not exist.", $crawler->filter('#message')->text()); + } +} diff --git a/tests/functional/fixtures/ext/error/class/controller.php b/tests/functional/fixtures/ext/error/class/controller.php new file mode 100644 index 0000000000..eb2ae362a6 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/controller.php @@ -0,0 +1,17 @@ +<?php + +class phpbb_ext_foobar_controller implements phpbb_extension_controller_interface +{ + public function handle() + { + global $template; + $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/class/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/class/ext.php b/tests/functional/fixtures/ext/error/class/ext.php new file mode 100644 index 0000000000..f97ad2b838 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/ext.php @@ -0,0 +1,6 @@ +<?php + +class phpbb_ext_error_class_ext extends phpbb_extension_base +{ + +} diff --git a/tests/functional/fixtures/ext/error/classtype/controller.php b/tests/functional/fixtures/ext/error/classtype/controller.php new file mode 100644 index 0000000000..2276548b55 --- /dev/null +++ b/tests/functional/fixtures/ext/error/classtype/controller.php @@ -0,0 +1,17 @@ +<?php + +class phpbb_ext_error_classtype_controller +{ + public function handle() + { + global $template; + $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/classtype/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/classtype/ext.php b/tests/functional/fixtures/ext/error/classtype/ext.php new file mode 100644 index 0000000000..35b1cd15a2 --- /dev/null +++ b/tests/functional/fixtures/ext/error/classtype/ext.php @@ -0,0 +1,6 @@ +<?php + +class phpbb_ext_error_classtype_ext extends phpbb_extension_base +{ + +} diff --git a/tests/functional/fixtures/ext/error/disabled/controller.php b/tests/functional/fixtures/ext/error/disabled/controller.php new file mode 100644 index 0000000000..b83a949020 --- /dev/null +++ b/tests/functional/fixtures/ext/error/disabled/controller.php @@ -0,0 +1,17 @@ +<?php + +class phpbb_ext_error_disabled_controller implements phpbb_extension_controller_interface +{ + public function handle() + { + global $template; + $template->set_ext_dir_prefix($phpbb_root_path . 'ext/error/disabled/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/disabled/ext.php b/tests/functional/fixtures/ext/error/disabled/ext.php new file mode 100644 index 0000000000..aec8051848 --- /dev/null +++ b/tests/functional/fixtures/ext/error/disabled/ext.php @@ -0,0 +1,6 @@ +<?php + +class phpbb_ext_error_disabled_ext extends phpbb_extension_base +{ + +} diff --git a/tests/functional/fixtures/ext/foo/bar/controller.php b/tests/functional/fixtures/ext/foo/bar/controller.php new file mode 100644 index 0000000000..24d218c412 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/controller.php @@ -0,0 +1,17 @@ +<?php + +class phpbb_ext_foo_bar_controller implements phpbb_extension_controller_interface +{ + public function handle() + { + global $template; + $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); + + $template->set_filenames(array( + 'body' => 'foobar_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php new file mode 100644 index 0000000000..3a2068631e --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/ext.php @@ -0,0 +1,6 @@ +<?php + +class phpbb_ext_foo_bar_ext extends phpbb_extension_base +{ + +} diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html new file mode 100644 index 0000000000..4addf2666f --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html @@ -0,0 +1,5 @@ +<!-- INCLUDE overall_header.html --> + +<div id="welcome">This is for testing purposes.</div> + +<!-- INCLUDE overall_footer.html --> diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php new file mode 100644 index 0000000000..bf8d8139ae --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -0,0 +1,17 @@ +<?php + +class phpbb_ext_foobar_controller implements phpbb_extension_controller_interface +{ + public function handle() + { + global $template; + $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); + + $template->set_filenames(array( + 'body' => 'foobar_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php new file mode 100644 index 0000000000..7cf443d369 --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -0,0 +1,6 @@ +<?php + +class phpbb_ext_foobar_ext extends phpbb_extension_base +{ + +} diff --git a/tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html new file mode 100644 index 0000000000..4addf2666f --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html @@ -0,0 +1,5 @@ +<!-- INCLUDE overall_header.html --> + +<div id="welcome">This is for testing purposes.</div> + +<!-- INCLUDE overall_footer.html --> diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b5e6f7e377..69c62af297 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,10 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $cache = null; + protected $db = null; + protected $extension_manager = null; + static protected $config = array(); static protected $already_installed = false; @@ -66,6 +70,60 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function get_db() + { + global $phpbb_root_path, $phpEx; + // so we don't reopen an open connection + if (!($this->db instanceof dbal)) + { + if (!class_exists('dbal_' . self::$config['dbms'])) + { + include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + } + $sql_db = 'dbal_' . self::$config['dbms']; + $this->db = new $sql_db(); + $this->db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); + } + return $this->db; + } + + protected function get_cache_driver() + { + if (!$this->cache) + { + $this->cache = new phpbb_cache_driver_file; + } + + return $this->cache; + } + + protected function purge_cache() + { + $cache = $this->get_cache_driver(); + + $cache->purge(); + $cache->unload(); + $cache->load(); + } + + protected function get_extension_manager() + { + global $phpbb_root_path, $phpEx; + + if (!$this->extension_manager) + { + $this->extension_manager = new phpbb_extension_manager( + $this->get_db(), + self::$config['table_prefix'] . 'ext', + $phpbb_root_path, + ".$phpEx", + $this->get_cache_driver() + ); + } + + return $this->extension_manager; + } + protected function install_board() { global $phpbb_root_path, $phpEx; |