From fbe8086697481f5068a9897c9e629f048a553ee4 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 9 Mar 2012 16:10:02 +0000 Subject: [PATCH 01/35] [ticket/10694] Update PHP warning to 5.3.2 PHPBB3-10694 --- phpBB/includes/acp/acp_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index c8df21f5a9..5ecf54a9bc 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -398,7 +398,7 @@ 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, From 668c61686b09e12e7f245fc6a402a1b1f6272f1c Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Sat, 10 Mar 2012 16:47:07 +0000 Subject: [PATCH 02/35] [ticket/10694] Adjusting details link to 5.3 announcement PHPBB3-10694 --- phpBB/includes/acp/acp_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 5ecf54a9bc..e529ae0e5a 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -402,7 +402,7 @@ class acp_main { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, - 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '', ''), + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '', ''), )); } From 95b5109c622f8acd2d57343b97e3c2b6b157863a Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 25 Jan 2012 14:30:52 +0000 Subject: [PATCH 03/35] [feature/save-post-on-report] The complete changes for this feature This covers all the changes so that when a report is made, the post itself is copied and displayed in the MCP instead of the current post. Unfortunatly, I made all commits in the wrong way and they were lost. Now I have only the final files. --- phpBB/includes/mcp/mcp_reports.php | 4 ++-- phpBB/install/database_update.php | 3 +++ phpBB/report.php | 10 +++++++--- .../prosilver/template/posting_topic_review.html | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 95e84e816b..c848175c79 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_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 @@ -226,7 +226,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' => $report['reported_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/install/database_update.php b/phpBB/install/database_update.php index 843e8c2f23..0a2c3998c4 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1088,6 +1088,9 @@ function database_update_info() PROFILE_FIELDS_TABLE => array( 'field_show_on_pm' => array('BOOL', 0), ), + REPORTS_TABLE => array( + 'reported_post' => array('TEXT', ''), + ), ), 'change_columns' => array( GROUPS_TABLE => array( diff --git a/phpBB/report.php b/phpBB/report.php index e29001d389..ab4de68cea 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_text = $report_data['post_text']; $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' @@ -130,6 +131,8 @@ else $message .= '

' . sprintf($user->lang['RETURN_PM'], '', ''); trigger_error($message); } + + $reported_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_text' => $reported_text, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 67627f9785..a022048c34 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@
{topic_review_row.L_IGNORE_POST} -
+
From c241a4a2b484b561b5515c6f8211a21d39fd8d78 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 3 Feb 2012 20:54:24 +0000 Subject: [PATCH 04/35] [feature/save-post-on-report] Saves the post reported when a report is creat A problem when creating a report is that the report may be made and then the post changed. After the changes, if the report is seen the message it shows may not be correct to be reported. With these changes, when a report is created the system copies the post that was reported and shows it in the report details in the MCP PHPBB3-10600 --- phpBB/develop/create_schema_files.php | 1 + phpBB/install/schemas/firebird_schema.sql | 3 ++- phpBB/install/schemas/mssql_schema.sql | 3 ++- phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 1 + phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 3 ++- phpBB/styles/subsilver2/template/posting_topic_review.html | 1 + 9 files changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 80d6e05d09..a4738df5bf 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' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index daeba45864..518f1bcd4f 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 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..526ce0f65b 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] 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..22276b0d1f 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 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..7513b4518d 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 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..3982686c0d 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 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..69685e45aa 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 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..3916493bea 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 mediumtext(16777215) NOT NULL DEFAULT '' ); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 2bfa95f3d4..92f71c2307 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,6 +51,7 @@
+ {REPORTED_IMG}
{topic_review_row.MESSAGE}
From 6f5c0dddfcd2a1b56fe1e8cf783f48ecfc8561e9 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 14 Feb 2012 07:58:30 +0000 Subject: [PATCH 05/35] [feature/save-post-on-report] Bug fix table name There was a bug in the previous commit. I changed the name of the colon of the table and forgot to update the database_update.php now it's fixed. PHPBB3-10600 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0a2c3998c4..7240e899a6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_post' => array('TEXT', ''), + 'reported_text' => array('TEXT', ''), ), ), 'change_columns' => array( From 18373035c3299e80b2c075cfc3d475c89af3cc73 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 15 Feb 2012 22:03:32 +0000 Subject: [PATCH 06/35] [feature/save-post-on-report] Changed the name of the column The name of the column was changed from reported_post AND reported_text to reported_post_text. This change was made by request PHPBB3-10600 --- phpBB/develop/create_schema_files.php | 2 +- phpBB/includes/mcp/mcp_reports.php | 4 ++-- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 2 +- phpBB/install/schemas/mysql_40_schema.sql | 2 +- phpBB/install/schemas/mysql_41_schema.sql | 2 +- phpBB/install/schemas/oracle_schema.sql | 2 +- phpBB/install/schemas/postgres_schema.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 2 +- phpBB/report.php | 10 +++++----- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index a4738df5bf..987c9152d4 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1528,7 +1528,7 @@ function get_schema_struct() 'report_closed' => array('BOOL', 0), 'report_time' => array('TIMESTAMP', 0), 'report_text' => array('MTEXT_UNI', ''), - 'reported_post' => array('MTEXT_UNI', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index c848175c79..b4756b2600 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, r.reported_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 @@ -226,7 +226,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' => $report['reported_text'], + 'POST_PREVIEW' => $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/install/database_update.php b/phpBB/install/database_update.php index 7240e899a6..2fdbd16e4a 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_text' => array('TEXT', ''), + 'reported_post_text' => array('TEXT', ''), ), ), 'change_columns' => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 518f1bcd4f..b88ed0a64a 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -910,7 +910,7 @@ CREATE TABLE phpbb_reports ( 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 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 526ce0f65b..a0399756e9 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1109,7 +1109,7 @@ CREATE TABLE [phpbb_reports] ( [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , [report_text] [text] DEFAULT ('') NOT NULL , - [reported_post] [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 22276b0d1f..69648c6b14 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -647,7 +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 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 7513b4518d..9b32ee19c6 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -647,7 +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 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 3982686c0d..032c8633dd 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1214,7 +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 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 69685e45aa..f482920776 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -853,7 +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 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 3916493bea..56468bcdd9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -628,7 +628,7 @@ CREATE TABLE phpbb_reports ( 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 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/report.php b/phpBB/report.php index ab4de68cea..29b46a6211 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -71,9 +71,9 @@ if ($post_id) trigger_error('POST_NOT_EXIST'); } - $forum_id = (int) $report_data['forum_id']; - $topic_id = (int) $report_data['topic_id']; - $reported_text = $report_data['post_text']; + $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 . ' @@ -132,7 +132,7 @@ else trigger_error($message); } - $reported_text = $report_data['message_text']; + $reported_post_text = $report_data['message_text']; } // Submit report? @@ -159,7 +159,7 @@ if ($submit && $reason_id) 'report_closed' => 0, 'report_time' => (int) time(), 'report_text' => (string) $report_text, - 'reported_text' => $reported_text, + 'reported_post_text' => $reported_post_text, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); From 165a2d1aa879f1fc65448721da5f6d143aff91fe Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 8 Mar 2012 09:16:36 +0000 Subject: [PATCH 07/35] [feature/save-post-on-report] Change the column type of reported text What ever it said. I changed the type of data in the column reported_post_text to match what was requested by p PHPBB3-10600 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 2fdbd16e4a..8a7ec1004e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_post_text' => array('TEXT', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), ), 'change_columns' => array( From 28c6b95100014bc9237c50c16e6b69a96102e7c6 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 8 Mar 2012 22:04:56 +0000 Subject: [PATCH 08/35] [feature/save-post-on-report] bbcode_nl2br missing. New lines were missing in the reported_post_text. By adding the bbcode_nl2br() became as it is supposed to. PHPBB3-10600 --- phpBB/includes/mcp/mcp_reports.php | 7 ++++--- phpBB/styles/prosilver/template/posting_topic_review.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index b4756b2600..69c6a4cfff 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -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' => $report['reported_post_text'], + '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/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index a022048c34..1c4b67044d 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@
{topic_review_row.L_IGNORE_POST} -
+
From 3a044b4b3ef6b5a7c27ea357bc3b7d7dd101a262 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 9 Mar 2012 15:56:43 +0000 Subject: [PATCH 09/35] [feature/save-post-on-report] Changed mark in subsilver2 to look like viewtopic As cyberalien requested. This was changed to match better the idea behind what was made in prosilver to subsilver2. PHPBB3-10600 --- .../styles/subsilver2/template/posting_topic_review.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 92f71c2307..cbd6746a8a 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,7 +51,13 @@
- {REPORTED_IMG} + + + + {REPORTED_IMG} + +
+
{topic_review_row.MESSAGE}
From a0131b45f56847f7e5c44a6db66cd7359967585f Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 8 Feb 2012 00:08:17 -0500 Subject: [PATCH 10/35] [ticket/10586] Extension front controller Handle extension front pages PHPBB3-10586 --- .../extension/controller_interface.php | 31 +++++++++++++++ phpBB/includes/extension/manager.php | 22 +++++++++++ phpBB/index.php | 39 +++++++++++++++++++ phpBB/language/en/common.php | 4 ++ 4 files changed, 96 insertions(+) create mode 100644 phpBB/includes/extension/controller_interface.php 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 @@ +phpbb_root_path . "ext/$name/"); + } + + /** + * 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/index.php b/phpBB/index.php index f1243bb336..a206ed4d37 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -24,6 +24,45 @@ $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); +// If given an extension, look for a front controller +if ($ext = $request->variable('ext', '')) +{ + // The class to load + $class = "phpbb_ext_{$ext}_controller"; + + // Make sure the specified extension is enabled + // and that it has a controller class + 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 (!file_exists("{$phpbb_root_path}ext/$ext/controller.$phpEx") || !class_exists($class)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); + } + + // Instantiate the extension controller + $controller = new $class; + + // But let's make sure it's actually a proper controller + if (!($controller instanceof phpbb_extension_controller_interface)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang('EXTENSION_CLASS_WRONG_TYPE', $class)); + } + + // Let's get it started... + $controller->handle(); + exit_handler(); +} + display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; 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 %s is missing a controller class and cannot be accessed through the front-end.', + 'EXTENSION_CLASS_WRONG_TYPE' => 'The extension controller class %s is not an instance of the phpbb_extension_controller_interface.', + 'EXTENSION_DISABLED' => 'The extension %s is not enabled.', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed.', + 'EXTENSION_DOES_NOT_EXIST' => 'The extension %s does not exist.', 'FAQ' => 'FAQ', 'FAQ_EXPLAIN' => 'Frequently Asked Questions', From 969c6d42e390fe05960d9dd3b97b230d4e7830a0 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 17 Feb 2012 14:21:28 -0500 Subject: [PATCH 11/35] [ticket/10586] Removed file_exists() check because class_exists() covers that. PHPBB3-10586 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index a206ed4d37..575134f6b1 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -42,7 +42,7 @@ if ($ext = $request->variable('ext', '')) send_status_line(404, 'Not Found'); trigger_error($user->lang('EXTENSION_DISABLED', $ext)); } - else if (!file_exists("{$phpbb_root_path}ext/$ext/controller.$phpEx") || !class_exists($class)) + else if (!class_exists($class)) { send_status_line(404, 'Not Found'); trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); From e45452d1b3d39220ebd9b20390b9cc23ef64d3dd Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 18 Feb 2012 11:24:27 -0500 Subject: [PATCH 12/35] [ticket/10586] Sanitize periods from class names, use manager to get path. PHPBB3-10586 --- phpBB/includes/extension/manager.php | 2 +- phpBB/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index b94379141c..6f1c885ea9 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -437,7 +437,7 @@ class phpbb_extension_manager */ public function available($name) { - return file_exists($this->phpbb_root_path . "ext/$name/"); + return file_exists($this->get_extension_path($name, true)); } /** diff --git a/phpBB/index.php b/phpBB/index.php index 575134f6b1..e6a472ce31 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -28,7 +28,7 @@ $user->setup('viewforum'); if ($ext = $request->variable('ext', '')) { // The class to load - $class = "phpbb_ext_{$ext}_controller"; + $class = 'phpbb_ext_' . str_replace('/', '_', $name) . '_controller'; // Make sure the specified extension is enabled // and that it has a controller class From e5ce9646567e6b3441c21ab960f8a77f1281c72b Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 18 Feb 2012 11:34:07 -0500 Subject: [PATCH 13/35] [ticket/10586] Copy/paste fail fixed PHPBB3-10586 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index e6a472ce31..2500774f67 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -28,7 +28,7 @@ $user->setup('viewforum'); if ($ext = $request->variable('ext', '')) { // The class to load - $class = 'phpbb_ext_' . str_replace('/', '_', $name) . '_controller'; + $class = 'phpbb_ext_' . str_replace('/', '_', $ext) . '_controller'; // Make sure the specified extension is enabled // and that it has a controller class From 401de113f9a0cec57c9648a079303d30fdb23666 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 19 Feb 2012 15:26:20 -0500 Subject: [PATCH 14/35] [ticket/10586] test stuff. does not work yet, still need to put phpBB objects in bootstrap.php --- .../functional/extension_controller_test.php | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/functional/extension_controller_test.php diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php new file mode 100644 index 0000000000..7f0bccc485 --- /dev/null +++ b/tests/functional/extension_controller_test.php @@ -0,0 +1,96 @@ +enable('foobar'); + $phpbb_extension_manager->enable('foo_bar'); + $phpbb_extension_manager->enable('error_class'); + $phpbb_extension_manager->enable('error_classtype'); + } + + public function tearDown() + { + global $db, $cache; + $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + + $phpbb_extension_manager->purge('foobar'); + $phpbb_extension_manager->purge('foo_bar'); + $phpbb_extension_manager->purge('error_class'); + $phpbb_extension_manager->purge('error_classtype'); + } + + /** + * Check an extension at ./ext/foobar/ which should have the class + * phpbb_ext_foobar_controller + */ + public function test_foobar() + { + $crawler = $this->request('GET', 'index.php?ext=foobar'); + $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + } + + /** + * Check an extension at ./ext/foo/bar/ which should have the class + * phpbb_ext_foo_bar_controller + */ + public function test_foo_bar() + { + $crawler = $this->request('GET', 'index.php?ext=foo/bar'); + $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + } + + /** + * Check the error produced by extension at ./ext/error/class which has class + * phpbb_ext_foobar_controller + */ + public function test_error_class_name() + { + $crawler = $this->request('GET', 'index.php?ext=error/class'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_class is missing a controller class and cannot be accessed through the front-end.")')->count()); + } + + /** + * 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() + { + $crawler = $this->request('GET', 'index.php?ext=error/classtype'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.")')->count()); + } + + /** + * 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->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_classtype is not enabled.")')->count()); + } + + /** + * 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->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_404 does not exist.")')->count()); + } +} From 9212466626a3d80a90cab1f23cf423a1c4e20655 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 09:38:53 -0500 Subject: [PATCH 15/35] [ticket/10586] some bootstrap additions and test changes to try and make it work PHPBB3-10586 --- tests/bootstrap.php | 36 +++++++++++++++++++ .../functional/extension_controller_test.php | 6 ++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 302701e3b3..e98ec384e6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,6 +26,42 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; +// For functional tests, we need to make available the phpBB objects +require_once $phpbb_root_path . 'config.php'; +// Setup class loader first +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); +$phpbb_class_loader->register(); + +// set up caching +$cache_factory = new phpbb_cache_factory($acm_type); +$cache = $cache_factory->get_service(); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); + +// We have to include this because the class loader doesn't +// recognize classes without the phpbb_ prefix +// So user and auth and the DBAL aren't found unless we require these files +require($phpbb_root_path . 'includes/session.' . $phpEx); +require($phpbb_root_path . 'includes/auth.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); +// Instantiate some basic classes +$user = new user(); +$auth = new auth(); +$db = new $sql_db(); + +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); + +// We do not need this any longer, unset for safety purposes +unset($dbpasswd); + +// Grab global variables, re-cache if necessary +$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); + +// load extensions +$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) { require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 7f0bccc485..430d93f9bf 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -14,8 +14,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { public function setUp() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->enable('foobar'); $phpbb_extension_manager->enable('foo_bar'); @@ -25,8 +24,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function tearDown() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->purge('foobar'); $phpbb_extension_manager->purge('foo_bar'); From a37a28b48546afc880446db7e4b2fd87c70a6cda Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 10:53:22 -0500 Subject: [PATCH 16/35] [ticket/10586] Now tests run, but fail. But here is what I have. PHPBB3-10586 --- tests/bootstrap.php | 36 ------------------- .../functional/extension_controller_test.php | 6 ++-- .../phpbb_functional_test_case.php | 20 +++++++++++ 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e98ec384e6..302701e3b3 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,42 +26,6 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; -// For functional tests, we need to make available the phpBB objects -require_once $phpbb_root_path . 'config.php'; -// Setup class loader first -$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); -$phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); -$phpbb_class_loader->register(); - -// set up caching -$cache_factory = new phpbb_cache_factory($acm_type); -$cache = $cache_factory->get_service(); -$phpbb_class_loader_ext->set_cache($cache->get_driver()); -$phpbb_class_loader->set_cache($cache->get_driver()); - -// We have to include this because the class loader doesn't -// recognize classes without the phpbb_ prefix -// So user and auth and the DBAL aren't found unless we require these files -require($phpbb_root_path . 'includes/session.' . $phpEx); -require($phpbb_root_path . 'includes/auth.' . $phpEx); -require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); -// Instantiate some basic classes -$user = new user(); -$auth = new auth(); -$db = new $sql_db(); - -$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); - -// We do not need this any longer, unset for safety purposes -unset($dbpasswd); - -// Grab global variables, re-cache if necessary -$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); - -// load extensions -$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); - if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) { require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 430d93f9bf..7e50eb7d91 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -14,7 +14,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { public function setUp() { - global $phpbb_extension_manager; + parent::setUp(); + $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foobar'); $phpbb_extension_manager->enable('foo_bar'); @@ -24,7 +25,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function tearDown() { - global $phpbb_extension_manager; + parent::tearDown(); + $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->purge('foobar'); $phpbb_extension_manager->purge('foo_bar'); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b5e6f7e377..b2ae215d91 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -66,6 +66,26 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function get_db() + { + global $phpbb_root_path, $phpEx; + if (!class_exists('dbal_' . self::$config['dbms'])) + { + include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + } + $sql_db = 'dbal_' . self::$config['dbms']; + $db = new $sql_db(); + $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); + return $db; + } + + protected function get_ext_manager() + { + global $phpbb_root_path, $phpEx; + + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_null); + } + protected function install_board() { global $phpbb_root_path, $phpEx; From d235262bc21657f0693501ac1154e1443578d507 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 11:17:21 -0500 Subject: [PATCH 17/35] [ticket/10586] Adding the extensions used by the tests PHPBB3-10586 --- .../fixtures/ext/error/class/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/class/ext.php | 6 ++++++ .../ext/error/classtype/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/classtype/ext.php | 6 ++++++ .../fixtures/ext/error/disabled/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/disabled/ext.php | 6 ++++++ .../fixtures/ext/foo/bar/controller.php | 17 +++++++++++++++++ tests/functional/fixtures/ext/foo/bar/ext.php | 6 ++++++ .../styles/prosilver/template/index_body.html | 5 +++++ .../fixtures/ext/foobar/controller.php | 17 +++++++++++++++++ tests/functional/fixtures/ext/foobar/ext.php | 6 ++++++ .../styles/prosilver/template/index_body.html | 5 +++++ .../phpbb_functional_test_case.php | 18 ++++++++++++------ 13 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 tests/functional/fixtures/ext/error/class/controller.php create mode 100644 tests/functional/fixtures/ext/error/class/ext.php create mode 100644 tests/functional/fixtures/ext/error/classtype/controller.php create mode 100644 tests/functional/fixtures/ext/error/classtype/ext.php create mode 100644 tests/functional/fixtures/ext/error/disabled/controller.php create mode 100644 tests/functional/fixtures/ext/error/disabled/ext.php create mode 100644 tests/functional/fixtures/ext/foo/bar/controller.php create mode 100644 tests/functional/fixtures/ext/foo/bar/ext.php create mode 100644 tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html create mode 100644 tests/functional/fixtures/ext/foobar/controller.php create mode 100644 tests/functional/fixtures/ext/foobar/ext.php create mode 100644 tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html 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 @@ +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 @@ +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 @@ +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 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); + + $template->set_filenames(array( + 'body' => 'index_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 @@ + + +
This is for testing purposes.
+ + diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php new file mode 100644 index 0000000000..c3ef29ffef --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -0,0 +1,17 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); + + $template->set_filenames(array( + 'body' => 'index_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..7b3f37cbfb --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -0,0 +1,6 @@ + + +
This is for testing purposes.
+ + diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b2ae215d91..9797ecfef8 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,8 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $db = null; + static protected $config = array(); static protected $already_installed = false; @@ -69,14 +71,18 @@ class phpbb_functional_test_case extends phpbb_test_case protected function get_db() { global $phpbb_root_path, $phpEx; - if (!class_exists('dbal_' . self::$config['dbms'])) + // so we don't reopen an open connection + if (!($this->db instanceof dbal)) { - include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + 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']); } - $sql_db = 'dbal_' . self::$config['dbms']; - $db = new $sql_db(); - $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); - return $db; + return $this->db; } protected function get_ext_manager() From 7b44d6f21a5a8be289bf6810f2c38d580647581e Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 15:35:01 -0400 Subject: [PATCH 18/35] [ticket/10586] initial work on copying fixtures. Note that this depends on 10706 PHPBB3-10586 --- .../functional/extension_controller_test.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 7e50eb7d91..b52174bbd5 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -12,6 +12,39 @@ */ class phpbb_functional_extension_controller_test extends phpbb_functional_test_case { + /** + * 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() + { + parent::setUpBeforeClass(); + // When you add new tests that require new fixtures, add them to the array. + $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/index_body.html', + 'foobar/controller.php', + 'foobar/ext.php', + 'foobar/styles/prosilver/template/index_body.html', + ); + + foreach ($fixtures as $fixture) + { + // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes + if(!copy("tests/functional/fixtures/ext/$fixture", self::$config['phpbb_functional_url'] . "/ext/$fixture")) + { + echo 'Could not copy file ' . $fixture; + } + } + } + public function setUp() { parent::setUp(); From 66b45318efea886ac6afc1f332cc94ee2af1c494 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 16:42:29 -0400 Subject: [PATCH 19/35] [ticket/10586] browse tests now work, but mine dont. at least we are making progress PHPBB3-10586 --- tests/functional/browse_test.php | 11 ++++++++++ .../functional/extension_controller_test.php | 22 ++++++++++++++++++- .../phpbb_test_case_helpers.php | 12 ++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index 723cf93232..d119787d13 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -12,6 +12,17 @@ */ class phpbb_functional_browse_test extends phpbb_functional_test_case { + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + $f_path = self::$config['phpbb_functional_path']; + // we cannot run these tests correctly if the install directory is present + if (is_dir($f_path . 'install/')) + { + rename($f_path . 'install/', $f_path . 'install_/'); + } + // NOTE: this will need to be renamed back again later if you wish to test again + } public function test_index() { $crawler = $this->request('GET', 'index.php'); diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index b52174bbd5..50710d0347 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,7 +19,27 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c static public function setUpBeforeClass() { parent::setUpBeforeClass(); + $f_path = self::$config['phpbb_functional_path']; + + // these directories need to be created before the files can be copied + $directories = array( + $f_path . 'ext/error/class/', + $f_path . 'ext/error/classtype/', + $f_path . 'ext/error/disabled/', + $f_path . 'ext/foo/bar/', + $f_path . 'ext/foo/bar/styles/prosilver/template/', + $f_path . 'ext/foobar/', + $f_path . 'ext/foobar/styles/prosilver/template/', + ); // When you add new tests that require new fixtures, add them to the array. + foreach ($directories as $dir) + { + if (!is_dir($dir)) + { + mkdir($dir, 0777, true); + } + } + $fixtures = array( 'error/class/controller.php', 'error/class/ext.php', @@ -38,7 +58,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c foreach ($fixtures as $fixture) { // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes - if(!copy("tests/functional/fixtures/ext/$fixture", self::$config['phpbb_functional_url'] . "/ext/$fixture")) + if(!copy("tests/functional/fixtures/ext/$fixture", "{$f_path}ext/$fixture")) { echo 'Could not copy file ' . $fixture; } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 9c91778cb0..51b04db263 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -80,6 +80,11 @@ class phpbb_test_case_helpers { $config['phpbb_functional_url'] = $phpbb_functional_url; } + + if (isset($phpbb_functional_path)) + { + $config['phpbb_functional_path'] = $phpbb_functional_path; + } } if (isset($_SERVER['PHPBB_TEST_DBMS'])) @@ -101,6 +106,13 @@ class phpbb_test_case_helpers )); } + if (isset($_SERVER['PHPBB_FUNCTIONAL_PATH'])) + { + $config = array_merge($config, array( + 'phpbb_functional_path' => isset($_SERVER['PHPBB_FUNCTIONAL_PATH']) ? $_SERVER['PHPBB_FUNCTIONAL_PATH'] : '', + )); + } + return $config; } } From e78585c973d260651dd8487d586facd2ab9e1e51 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 17:18:08 -0400 Subject: [PATCH 20/35] [ticket/10586] Rename install directory back to install/ after tests PHPBB3-10586 --- tests/functional/extension_controller_test.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 50710d0347..f137a49bf4 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -65,6 +65,17 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c } } + public static function tearDownAfterClass() + { + $f_path = self::$config['phpbb_functional_path']; + // first we rename the install_ directory back to install + rename($f_path . 'install_/', $f_path . 'install/'); + + // @todo delete the fixtures from the $f_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(); From 4100b312bb0eb7246e9057461b6f8f3c66fdad60 Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 17 Mar 2012 22:12:50 -0400 Subject: [PATCH 21/35] [ticket/10586] Tests are coming along, just a little more to go PHPBB3-10586 --- .../functional/extension_controller_test.php | 56 +++++++++---------- .../fixtures/ext/foo/bar/controller.php | 2 +- .../{index_body.html => foobar_body.html} | 0 .../fixtures/ext/foobar/controller.php | 2 +- .../{index_body.html => foobar_body.html} | 0 5 files changed, 28 insertions(+), 32 deletions(-) rename tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/{index_body.html => foobar_body.html} (100%) rename tests/functional/fixtures/ext/foobar/styles/prosilver/template/{index_body.html => foobar_body.html} (100%) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index f137a49bf4..cb27511be1 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -49,10 +49,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c 'error/disabled/ext.php', 'foo/bar/controller.php', 'foo/bar/ext.php', - 'foo/bar/styles/prosilver/template/index_body.html', + 'foo/bar/styles/prosilver/template/foobar_body.html', 'foobar/controller.php', 'foobar/ext.php', - 'foobar/styles/prosilver/template/index_body.html', + 'foobar/styles/prosilver/template/foobar_body.html', ); foreach ($fixtures as $fixture) @@ -76,36 +76,20 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c // and port it into here instead of writing it from scratch } - public function setUp() - { - parent::setUp(); - $phpbb_extension_manager = $this->get_ext_manager(); - - $phpbb_extension_manager->enable('foobar'); - $phpbb_extension_manager->enable('foo_bar'); - $phpbb_extension_manager->enable('error_class'); - $phpbb_extension_manager->enable('error_classtype'); - } - - public function tearDown() - { - parent::tearDown(); - $phpbb_extension_manager = $this->get_ext_manager(); - - $phpbb_extension_manager->purge('foobar'); - $phpbb_extension_manager->purge('foo_bar'); - $phpbb_extension_manager->purge('error_class'); - $phpbb_extension_manager->purge('error_classtype'); - } - /** * Check an extension at ./ext/foobar/ which should have the class * phpbb_ext_foobar_controller */ public function test_foobar() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('foobar'); $crawler = $this->request('GET', 'index.php?ext=foobar'); - $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) + { + $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); + } + $phpbb_extension_manager->purge('foobar'); } /** @@ -114,8 +98,14 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_foo_bar() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('foo/bar'); $crawler = $this->request('GET', 'index.php?ext=foo/bar'); - $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) + { + $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); + } + $phpbb_extension_manager->purge('foo_bar'); } /** @@ -124,8 +114,11 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_name() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('error/class'); $crawler = $this->request('GET', 'index.php?ext=error/class'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_class is missing a controller class and cannot be accessed through the front-end.")')->count()); + $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); + $phpbb_extension_manager->purge('error_class'); } /** @@ -134,8 +127,11 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_type() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('error/classtype'); $crawler = $this->request('GET', 'index.php?ext=error/classtype'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.")')->count()); + $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()); + $phpbb_extension_manager->purge('error_classtype'); } /** @@ -145,7 +141,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function test_error_ext_disabled() { $crawler = $this->request('GET', 'index.php?ext=error/disabled'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_classtype is not enabled.")')->count()); + $this->assertContains("The extension error/disabled is not enabled", $crawler->filter('#message')->text()); } /** @@ -155,6 +151,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function test_error_ext_missing() { $crawler = $this->request('GET', 'index.php?ext=error/404'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_404 does not exist.")')->count()); + $this->assertContains("The extension error/404 does not exist.", $crawler->filter('#message')->text()); } } diff --git a/tests/functional/fixtures/ext/foo/bar/controller.php b/tests/functional/fixtures/ext/foo/bar/controller.php index 93d1f099c9..24d218c412 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller.php @@ -8,7 +8,7 @@ class phpbb_ext_foo_bar_controller implements phpbb_extension_controller_interfa $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); $template->set_filenames(array( - 'body' => 'index_body.html' + 'body' => 'foobar_body.html' )); page_header('Test extension'); diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html similarity index 100% rename from tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html rename to tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php index c3ef29ffef..bf8d8139ae 100644 --- a/tests/functional/fixtures/ext/foobar/controller.php +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -8,7 +8,7 @@ class phpbb_ext_foobar_controller implements phpbb_extension_controller_interfac $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); $template->set_filenames(array( - 'body' => 'index_body.html' + 'body' => 'foobar_body.html' )); page_header('Test extension'); diff --git a/tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html similarity index 100% rename from tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html rename to tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html From 7d1e4bca334dc9fcef3eb6e62cb412226ebc7ca4 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 18 Mar 2012 14:44:37 -0400 Subject: [PATCH 22/35] [ticket/10586] more work on getting tests to pass PHPBB3-10586 --- tests/functional/extension_controller_test.php | 16 +++++----------- .../phpbb_functional_test_case.php | 2 +- tests/test_framework/phpbb_test_case_helpers.php | 8 +++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index cb27511be1..46f3dc6f96 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -85,10 +85,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foobar'); $crawler = $this->request('GET', 'index.php?ext=foobar'); - if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) - { - $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); - } + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); $phpbb_extension_manager->purge('foobar'); } @@ -101,11 +98,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foo/bar'); $crawler = $this->request('GET', 'index.php?ext=foo/bar'); - if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) - { - $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); - } - $phpbb_extension_manager->purge('foo_bar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $phpbb_extension_manager->purge('foo/bar'); } /** @@ -118,7 +112,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $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()); - $phpbb_extension_manager->purge('error_class'); + $phpbb_extension_manager->purge('error/class'); } /** @@ -131,7 +125,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $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()); - $phpbb_extension_manager->purge('error_classtype'); + $phpbb_extension_manager->purge('error/classtype'); } /** diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 9797ecfef8..b3376891bc 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -89,7 +89,7 @@ class phpbb_functional_test_case extends phpbb_test_case { global $phpbb_root_path, $phpEx; - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_null); + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_file); } protected function install_board() diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 51b04db263..4aec07a8fb 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -81,7 +81,7 @@ class phpbb_test_case_helpers $config['phpbb_functional_url'] = $phpbb_functional_url; } - if (isset($phpbb_functional_path)) + if (!empty($phpbb_functional_path)) { $config['phpbb_functional_path'] = $phpbb_functional_path; } @@ -106,11 +106,9 @@ class phpbb_test_case_helpers )); } - if (isset($_SERVER['PHPBB_FUNCTIONAL_PATH'])) + if (!empty($_SERVER['PHPBB_FUNCTIONAL_PATH'])) { - $config = array_merge($config, array( - 'phpbb_functional_path' => isset($_SERVER['PHPBB_FUNCTIONAL_PATH']) ? $_SERVER['PHPBB_FUNCTIONAL_PATH'] : '', - )); + $config['phpbb_functional_path'] = $_SERVER['PHPBB_FUNCTIONAL_PATH']; } return $config; From 76e61951942048e3e98dbe60a3683d5269a4fa0e Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 18 Mar 2012 16:50:41 -0400 Subject: [PATCH 23/35] [ticket/10586] trying to get tests to work PHPBB3-10586 --- .../functional/extension_controller_test.php | 28 +++++++++++-------- .../phpbb_functional_test_case.php | 5 ++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 46f3dc6f96..4123853151 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -12,6 +12,7 @@ */ 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 @@ -76,17 +77,23 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c // and port it into here instead of writing it from scratch } + public function setUp() + { + parent::setUp(); + $this->phpbb_extension_manager = !($this->phpbb_extension_manager instanceof phpbb_extension_manager) ? $this->get_ext_manager() : $this->phpbb_extension_manager; + $this->cache->purge('_ext'); + } + /** * Check an extension at ./ext/foobar/ which should have the class * phpbb_ext_foobar_controller */ public function test_foobar() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('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()); - $phpbb_extension_manager->purge('foobar'); + $this->phpbb_extension_manager->purge('foobar'); } /** @@ -95,11 +102,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_foo_bar() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('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()); - $phpbb_extension_manager->purge('foo/bar'); + $this->phpbb_extension_manager->purge('foo/bar'); } /** @@ -108,11 +114,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_name() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('error/class'); + $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()); - $phpbb_extension_manager->purge('error/class'); + $this->phpbb_extension_manager->purge('error/class'); } /** @@ -121,11 +126,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_type() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('error/classtype'); + $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()); - $phpbb_extension_manager->purge('error/classtype'); + $this->phpbb_extension_manager->purge('error/classtype'); } /** diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b3376891bc..d569556d02 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,7 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $cache = null; protected $db = null; static protected $config = array(); @@ -88,8 +89,8 @@ class phpbb_functional_test_case extends phpbb_test_case protected function get_ext_manager() { global $phpbb_root_path, $phpEx; - - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_file); + $this->cache = ($this->cache instanceof phpbb_cache_driver_null) ? $this->cache : new phpbb_cache_driver_null; + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache); } protected function install_board() From 1bbb32a5cffeff4875c4ed0566999cbee8919c86 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 18 Mar 2012 22:57:37 +0100 Subject: [PATCH 24/35] [ticket/10586] Correctly purge board cache and don't rename install directory PHPBB3-10586 --- tests/functional/browse_test.php | 11 ------ .../functional/extension_controller_test.php | 8 ++-- tests/functional/fixtures/ext/foobar/ext.php | 4 +- .../phpbb_functional_test_case.php | 37 +++++++++++++++++-- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index d119787d13..723cf93232 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -12,17 +12,6 @@ */ class phpbb_functional_browse_test extends phpbb_functional_test_case { - public static function setUpBeforeClass() - { - parent::setUpBeforeClass(); - $f_path = self::$config['phpbb_functional_path']; - // we cannot run these tests correctly if the install directory is present - if (is_dir($f_path . 'install/')) - { - rename($f_path . 'install/', $f_path . 'install_/'); - } - // NOTE: this will need to be renamed back again later if you wish to test again - } public function test_index() { $crawler = $this->request('GET', 'index.php'); diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 4123853151..dd8aa1181b 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -69,8 +69,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public static function tearDownAfterClass() { $f_path = self::$config['phpbb_functional_path']; - // first we rename the install_ directory back to install - rename($f_path . 'install_/', $f_path . 'install/'); // @todo delete the fixtures from the $f_path board // Note that it might be best to find a public domain function @@ -80,8 +78,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function setUp() { parent::setUp(); - $this->phpbb_extension_manager = !($this->phpbb_extension_manager instanceof phpbb_extension_manager) ? $this->get_ext_manager() : $this->phpbb_extension_manager; - $this->cache->purge('_ext'); + + $this->phpbb_extension_manager = $this->get_extension_manager(); + + $this->purge_cache(); } /** diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php index 7b3f37cbfb..7cf443d369 100644 --- a/tests/functional/fixtures/ext/foobar/ext.php +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -1,6 +1,6 @@ db; } - protected function get_ext_manager() + 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; - $this->cache = ($this->cache instanceof phpbb_cache_driver_null) ? $this->cache : new phpbb_cache_driver_null; - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache); + + 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() From 6a0bad8c0b7bdb261c0ee72b850bc727de6d019b Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 19 Mar 2012 09:56:48 -0400 Subject: [PATCH 25/35] [ticket/10586] Tests finally work (thanks naderman) PHPBB3-10586 --- .../functional/extension_controller_test.php | 25 +++++++++---------- .../phpbb_test_case_helpers.php | 10 -------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index dd8aa1181b..263d48c034 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,20 +19,20 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ static public function setUpBeforeClass() { + global $phpbb_root_path; parent::setUpBeforeClass(); - $f_path = self::$config['phpbb_functional_path']; // these directories need to be created before the files can be copied $directories = array( - $f_path . 'ext/error/class/', - $f_path . 'ext/error/classtype/', - $f_path . 'ext/error/disabled/', - $f_path . 'ext/foo/bar/', - $f_path . 'ext/foo/bar/styles/prosilver/template/', - $f_path . 'ext/foobar/', - $f_path . 'ext/foobar/styles/prosilver/template/', + $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/', ); - // When you add new tests that require new fixtures, add them to the array. + foreach ($directories as $dir) { if (!is_dir($dir)) @@ -58,8 +58,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c foreach ($fixtures as $fixture) { - // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes - if(!copy("tests/functional/fixtures/ext/$fixture", "{$f_path}ext/$fixture")) + if(!copy("tests/functional/fixtures/ext/$fixture", "{$phpbb_root_path}ext/$fixture")) { echo 'Could not copy file ' . $fixture; } @@ -68,9 +67,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public static function tearDownAfterClass() { - $f_path = self::$config['phpbb_functional_path']; + $phpbb_root_path = self::$config['phpbb_functional_path']; - // @todo delete the fixtures from the $f_path board + // @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 } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 4aec07a8fb..9c91778cb0 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -80,11 +80,6 @@ class phpbb_test_case_helpers { $config['phpbb_functional_url'] = $phpbb_functional_url; } - - if (!empty($phpbb_functional_path)) - { - $config['phpbb_functional_path'] = $phpbb_functional_path; - } } if (isset($_SERVER['PHPBB_TEST_DBMS'])) @@ -106,11 +101,6 @@ class phpbb_test_case_helpers )); } - if (!empty($_SERVER['PHPBB_FUNCTIONAL_PATH'])) - { - $config['phpbb_functional_path'] = $_SERVER['PHPBB_FUNCTIONAL_PATH']; - } - return $config; } } From 70d88965c795a5e392605fe556df580773a505c3 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Mon, 19 Mar 2012 23:19:21 -0400 Subject: [PATCH 26/35] [ticket/10708] Check converted passwords for multi-byte characters Check for multi-byte characters in converted passwords. PHPBB3-10708 --- phpBB/includes/auth/auth_db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index c20196d019..1c6cdf7832 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -163,7 +163,7 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; $password_new_format = ''; - set_var($password_new_format, stripslashes($password_old_format), 'string'); + set_var($password_new_format, stripslashes($password_old_format), 'string', true); if ($password == $password_new_format) { From 18c541dfee6ec7db0e04c939bc103cefe9dab9d7 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 23 Mar 2012 00:27:29 +0530 Subject: [PATCH 27/35] [ticket/10703] Added a condition to check if ext directory exists The existence of ext directory is checked, if not present a proper error message that file doesn't exist is printed out. No Fatal Error messages. PHPBB3-10703 --- phpBB/develop/extensions.php | 8 +++++++- phpBB/includes/extension/manager.php | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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/includes/extension/manager.php b/phpBB/includes/extension/manager.php index c38f0df32e..dac0e5f947 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/'), From 2768db44f557cd5db4b54a287ecb1d2fcbe94140 Mon Sep 17 00:00:00 2001 From: HTF Date: Sat, 24 Mar 2012 15:13:04 +0000 Subject: [PATCH 28/35] [ticket/10129] Remove apostrophes and plurals in ACP user management -> permissions language file as per ticket. PHPBB3-10129 --- phpBB/language/en/acp/common.php | 8 ++++---- phpBB/language/en/acp/permissions.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 958b9c7598..e64ba3c371 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -96,10 +96,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_ICONS' => 'Topic icons', 'ACP_ICONS_SMILIES' => 'Topic icons/smilies', @@ -172,9 +172,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 016be51282..c0396cc247 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -40,10 +40,10 @@ $lang = array_merge($lang, array(

Permissions are highly granular and grouped into four major sections, which are:

Global Permissions

-

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.

+

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.

Forum Based Permissions

-

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.

+

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.

Permission Roles

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.

@@ -83,13 +83,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.', @@ -225,8 +225,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 NO (unset). So the permission can be overwritten by other settings.', 'TRACE_FOR' => 'Trace for', From 75e731e14b219d5b926755e01b957a5640f26ac8 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 8 Mar 2012 17:31:19 -0500 Subject: [PATCH 29/35] [task/php5.3] Changed minimum PHP requirement for Ascraeus to 5.3.2 PHPBB3-10693 --- phpBB/install/install_install.php | 2 +- phpBB/language/en/install.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 = '' . $lang['NO'] . ''; } 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' => 'Required - You must be running at least version 5.2.0 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', + 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.2 of PHP in order to install phpBB. If safe mode 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 allow_url_fopen is enabled', 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - 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 %s as table prefix.', 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', From 063f6893af754cc992e487d323f766889bebba01 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 8 Mar 2012 18:04:24 -0500 Subject: [PATCH 30/35] [task/php5.3] Looks like I missed a few places that needed PHP 5.2 changed to PHP 5.3.2 PHPBB3-10693 --- phpBB/common.php | 2 +- phpBB/docs/INSTALL.html | 2 +- phpBB/docs/README.html | 2 +- phpBB/docs/coding-guidelines.html | 6 +++--- phpBB/install/index.php | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index b308037a0e..8e149fef57 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/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 @@
  • Oracle
  • -
  • PHP 5.2.0+ with support for the database you intend to use.
  • +
  • PHP 5.3.2+ with support for the database you intend to use.
  • getimagesize() function need to be enabled.
  • These optional presence of the following modules within PHP will provide access to additional features, but they are not required.
      diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 592d2be76e..952f312652 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -306,7 +306,7 @@
      -

      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.

      +

      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.

      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.

      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))
       	...
      -'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>.',
       	...
       	
      @@ -2356,7 +2356,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'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>.',
       	...
       	
      @@ -2365,7 +2365,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'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>.',
       	...
       	
      diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 9d003ba6ab..f180511e46 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) From 9bcf53057eafbe481deda2b8e02f876f58b4176d Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 26 Mar 2012 17:56:10 -0400 Subject: [PATCH 31/35] [task/php5.3] Updated range of tested PHP versions PHPBB3-10693 --- phpBB/docs/README.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 952f312652..ccd368fbde 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -310,7 +310,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.

      -

      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.

      +

      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.

      7.i. Notice on PHP security issues

      From 56f75dbf93b0476f88c866abcae129fa3b61fc2c Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 27 Mar 2012 19:57:32 -0400 Subject: [PATCH 32/35] [ticket/10586] Tidy up comments PHPBB3-10586 --- phpBB/includes/extension/manager.php | 2 +- phpBB/index.php | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 6f1c885ea9..f103983fcd 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -432,7 +432,7 @@ class phpbb_extension_manager /** * Check to see if a given extension is available on the filesystem * - * @param string $name Extension name to check + * @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) diff --git a/phpBB/index.php b/phpBB/index.php index 2500774f67..d71878a885 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -24,14 +24,11 @@ $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); -// If given an extension, look for a front controller +// Handle the display of extension front pages if ($ext = $request->variable('ext', '')) { - // The class to load $class = 'phpbb_ext_' . str_replace('/', '_', $ext) . '_controller'; - // Make sure the specified extension is enabled - // and that it has a controller class if (!$phpbb_extension_manager->available($ext)) { send_status_line(404, 'Not Found'); @@ -48,17 +45,14 @@ if ($ext = $request->variable('ext', '')) trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); } - // Instantiate the extension controller $controller = new $class; - // But let's make sure it's actually a proper controller if (!($controller instanceof phpbb_extension_controller_interface)) { send_status_line(500, 'Internal Server Error'); trigger_error($user->lang('EXTENSION_CLASS_WRONG_TYPE', $class)); } - // Let's get it started... $controller->handle(); exit_handler(); } From 7c3ebcc3ff16950f76f857381222070c36a76fc3 Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 15:34:24 -0400 Subject: [PATCH 33/35] [ticket/10586] Added space in if statement PHPBB3-10586 --- tests/functional/extension_controller_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 263d48c034..4ee0e68718 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -58,7 +58,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c foreach ($fixtures as $fixture) { - if(!copy("tests/functional/fixtures/ext/$fixture", "{$phpbb_root_path}ext/$fixture")) + if (!copy("tests/functional/fixtures/ext/$fixture", "{$phpbb_root_path}ext/$fixture")) { echo 'Could not copy file ' . $fixture; } From 1789e0948bd3a06392d8f919d80889ed5bbf2583 Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 17:05:45 -0400 Subject: [PATCH 34/35] [ticket/10732] Add config_dev.php and config_test.php to .gitignore PHPBB3-10732 --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d875beb784..e6e017f85e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ /phpBB/cache/*.php /phpBB/cache/queue.php.lock /phpBB/config.php +/phpBB/config_dev.php +/phpBB/config_test.php /phpBB/ext/* /phpBB/files/* /phpBB/images/avatars/gallery/* From fff9f6611eddffb4c509d6e5126c0b0c9723f345 Mon Sep 17 00:00:00 2001 From: Jan Schejbal Date: Thu, 29 Mar 2012 04:16:34 +0200 Subject: [PATCH 35/35] [ticket/10730] Added label tag around "select" text in post splitting UI Added label tags around the "select" text in the post splitting UI in the MCP. Had to add IDs based on the post ID to the select boxes to allow label to work. Tested in Firefox and Chrome. PHPBB3-10730 --- phpBB/styles/prosilver/template/mcp_topic.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 2a5f52f038..5dbc8d670c 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()');
      - +

      {postrow.POST_SUBJECT}

      {postrow.MINI_POST_IMG} {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} [ {L_POST_DETAILS} ]