From c2866f52453ac8bdfcdde6b541bbba60f1c71d02 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 2 Aug 2011 16:50:17 +0200 Subject: [PATCH 001/325] [ticket/10300] Always set group attributes for teampage and legend The code in acp_groups.php removes unchanged attributes from the group_attributes array, to prevent issues with reapplying avatar/rank and more. This code causes problems with the new teampage/legend feature, because when the attribute is not set, the group is removed from the feature. Therefore I added an array with the keys that need to be set, when calling the function. PHPBB3-10300 --- phpBB/includes/acp/acp_groups.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index dde556c19e..221dea2345 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -415,6 +415,9 @@ class acp_groups // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes // were made. + // However there are some attributes that need to be set everytime, + // otherwise the group gets removed from the feature. + $set_attributes = array('legend', 'teampage'); $group_attributes = array(); $test_variables = array( @@ -435,7 +438,7 @@ class acp_groups foreach ($test_variables as $test => $type) { - if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) + if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || in_array($test, $set_attributes))) { settype($submit_ary[$test], $type); $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; From 81f682a81252fa9199fe140b2b0e1a6caf575f72 Mon Sep 17 00:00:00 2001 From: callumacrae Date: Wed, 24 Aug 2011 09:28:45 +0100 Subject: [PATCH 002/325] [ticket/8599] Added ability to select all to add multiple smilies screen. PHPBB3-8599 --- phpBB/adm/style/acp_icons.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index eedf39b440..a34a91043c 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -74,7 +74,7 @@
{L_TITLE} - +
@@ -94,7 +94,7 @@ - + From 2ffdf56bfe8ad35ac648a22a838b1ef01905b2d4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Aug 2011 20:14:49 +0200 Subject: [PATCH 003/325] [ticket/10278] Also set timeout on stream in get_remote_file(). From the PHP manual for fsockopen(): If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout(), as the timeout parameter to fsockopen() only applies while connecting the socket. http://www.php.net/manual/en/function.fsockopen.php PHPBB3-10278 --- phpBB/includes/functions_admin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f7e19f3e7d..ee146ca214 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3140,6 +3140,8 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port @fputs($fsock, "HOST: $host\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); + stream_set_timeout($fsock, $timeout); + $file_info = ''; $get_info = false; From 29a23ae217efed86e6b5afff4c9a0b1271eb20f4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Aug 2011 20:34:01 +0200 Subject: [PATCH 004/325] [ticket/10278] Return with a timeout error when fread() or fgets() time out. PHPBB3-10278 --- phpBB/includes/functions_admin.php | 8 ++++++++ phpBB/language/en/common.php | 1 + 2 files changed, 9 insertions(+) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ee146ca214..8b9b80b23d 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3164,6 +3164,14 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port return false; } } + + $stream_meta_data = stream_get_meta_data($fsock); + + if (!empty($stream_meta_data['timed_out'])) + { + $errstr = $user->lang['FSOCK_TIMEOUT']; + return false; + } } @fclose($fsock); } diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 1c96818346..2eca49d3e0 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -200,6 +200,7 @@ $lang = array_merge($lang, array( 'FORUM_RULES_LINK' => 'Please click here to view the forum rules', 'FROM' => 'from', 'FSOCK_DISABLED' => 'The operation could not be completed because the fsockopen function has been disabled or the server being queried could not be found.', + 'FSOCK_TIMEOUT' => 'A timeout occurred while reading from the network stream.', 'FTP_FSOCK_HOST' => 'FTP host', 'FTP_FSOCK_HOST_EXPLAIN' => 'FTP server used to connect your site.', From c0507c6a9e26ba250596530f501bf6843250ed36 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Aug 2011 20:38:53 +0200 Subject: [PATCH 005/325] [ticket/10278] Decrease default timeout of get_remote_file() to 6 seconds. PHPBB3-10278 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 8b9b80b23d..bcd477d855 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3130,7 +3130,7 @@ function get_database_size() /** * Retrieve contents from remotely stored file */ -function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10) +function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) { global $user; From 6a2b13632de1ab39cdd126785a4aa2057fa9d6ab Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 27 Aug 2011 00:25:38 +0200 Subject: [PATCH 006/325] [ticket/10344] Add attachment icons to list of reported and queued posts/topics PHPBB3-10344 --- phpBB/includes/mcp/mcp_front.php | 13 ++++++++----- phpBB/includes/mcp/mcp_pm_reports.php | 1 + phpBB/includes/mcp/mcp_queue.php | 9 +++++---- phpBB/includes/mcp/mcp_reports.php | 7 ++++--- phpBB/styles/prosilver/template/mcp_queue.html | 2 +- phpBB/styles/subsilver2/template/mcp_front.html | 6 +++--- phpBB/styles/subsilver2/template/mcp_queue.html | 2 +- phpBB/styles/subsilver2/template/mcp_reports.html | 4 ++-- 8 files changed, 25 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 7375e20d96..7dc0485339 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -81,7 +81,7 @@ function mcp_front_view($id, $mode, $action) if ($total) { - $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id + $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_list) . ' AND t.topic_id = p.topic_id @@ -113,8 +113,9 @@ function mcp_front_view($id, $mode, $action) 'POST_ID' => $row['post_id'], 'TOPIC_TITLE' => $row['topic_title'], 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], - 'POST_TIME' => $user->format_date($row['post_time'])) - ); + 'POST_TIME' => $user->format_date($row['post_time']), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + )); } $db->sql_freeresult($result); } @@ -169,7 +170,7 @@ function mcp_front_view($id, $mode, $action) $global_id = $forum_list[0]; $sql = $db->sql_build_query('SELECT', array( - 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', + 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', 'FROM' => array( REPORTS_TABLE => 'r', @@ -229,6 +230,7 @@ function mcp_front_view($id, $mode, $action) 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'REPORT_TIME' => $user->format_date($row['report_time']), 'POST_TIME' => $user->format_date($row['post_time']), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', )); } } @@ -270,7 +272,7 @@ function mcp_front_view($id, $mode, $action) include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); $sql = $db->sql_build_query('SELECT', array( - 'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id', + 'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, p.message_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id', 'FROM' => array( REPORTS_TABLE => 'r', @@ -320,6 +322,7 @@ function mcp_front_view($id, $mode, $action) 'REPORT_TIME' => $user->format_date($row['report_time']), 'PM_TIME' => $user->format_date($row['message_time']), 'RECIPIENTS' => implode(', ', $address_list[$row['msg_id']]), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', )); } } diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index e61e8390c9..a8136b34df 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -293,6 +293,7 @@ class mcp_pm_reports 'REPORT_TIME' => $user->format_date($row['report_time']), 'RECIPIENTS' => implode(', ', $address_list[$row['msg_id']]), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', )); } } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a5e0e426be..4f90c4f024 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -334,7 +334,7 @@ class mcp_queue if (sizeof($post_ids)) { - $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour + $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND t.topic_id = p.topic_id @@ -366,7 +366,7 @@ class mcp_queue } else { - $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour + $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour FROM ' . TOPICS_TABLE . " t WHERE forum_id IN (0, $forum_list) AND topic_approved = 0 @@ -430,8 +430,9 @@ class mcp_queue 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'TOPIC_TITLE' => $row['topic_title'], - 'POST_TIME' => $user->format_date($row['post_time'])) - ); + 'POST_TIME' => $user->format_date($row['post_time']), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + )); } unset($rowset, $forum_names); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index f6e46b57ee..27659ab6ff 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -368,7 +368,7 @@ class mcp_reports if (sizeof($report_ids)) { - $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id + $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . ' AND t.topic_id = p.topic_id @@ -409,8 +409,9 @@ class mcp_reports 'POST_TIME' => $user->format_date($row['post_time']), 'REPORT_ID' => $row['report_id'], 'REPORT_TIME' => $user->format_date($row['report_time']), - 'TOPIC_TITLE' => $row['topic_title']) - ); + 'TOPIC_TITLE' => $row['topic_title'], + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + )); } $db->sql_freeresult($result); unset($report_ids, $row); diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 1560c6c516..5f16ebe7d0 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -42,7 +42,7 @@
  • - {postrow.POST_SUBJECT}
    + {postrow.POST_SUBJECT} {postrow.ATTACH_ICON_IMG}
    {L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_TIME}
    diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html index ad8b776628..f4b146f4c5 100644 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ b/phpBB/styles/subsilver2/template/mcp_front.html @@ -19,7 +19,7 @@
  • - + @@ -66,7 +66,7 @@ - + @@ -100,7 +100,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/mcp_queue.html b/phpBB/styles/subsilver2/template/mcp_queue.html index 7a35cc8044..6e39ccd272 100644 --- a/phpBB/styles/subsilver2/template/mcp_queue.html +++ b/phpBB/styles/subsilver2/template/mcp_queue.html @@ -18,7 +18,7 @@ - diff --git a/phpBB/styles/subsilver2/template/mcp_reports.html b/phpBB/styles/subsilver2/template/mcp_reports.html index 2e26a3e4cf..cfbd713321 100644 --- a/phpBB/styles/subsilver2/template/mcp_reports.html +++ b/phpBB/styles/subsilver2/template/mcp_reports.html @@ -25,12 +25,12 @@ - - From bcaf65d7cd951b9a453cac413c420cb418b42f8d Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Sat, 3 Sep 2011 17:26:36 -0500 Subject: [PATCH 007/325] [ticket/10349] Unit tests: Remove comments while loading schema files Perform the same operations that the installer does when preparing the schema files. These functions come straight from /includes/functions_install.php and /includes/functions_admin.php. PHPBB3-10349 --- ...phpbb_database_test_connection_manager.php | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index a7559e2183..78be831ecb 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -234,7 +234,12 @@ class phpbb_database_test_connection_manager } $filename = $directory . $schema . '_schema.sql'; - $sql = $this->split_sql(file_get_contents($filename)); + $remove_remarks = $this->dbms['COMMENTS']; + + $queries = file_get_contents($filename); + $this->$remove_remarks($queries); + + $sql = $this->split_sql($queries); foreach ($sql as $query) { @@ -279,6 +284,49 @@ class phpbb_database_test_connection_manager return $data; } + /** + * remove_remarks will strip the sql comment lines out of an uploaded sql file + */ + protected function remove_remarks(&$sql) + { + $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql)); + } + + /** + * remove_comments will strip the sql comment lines out of an uploaded sql file + * specifically for mssql and postgres type files in the install.... + */ + protected function remove_comments(&$output) + { + $lines = explode("\n", $output); + $output = ''; + + // try to keep mem. use down + $linecount = sizeof($lines); + + $in_comment = false; + for ($i = 0; $i < $linecount; $i++) + { + if (trim($lines[$i]) == '/*') + { + $in_comment = true; + } + + if (!$in_comment) + { + $output .= $lines[$i] . "\n"; + } + + if (trim($lines[$i]) == '*/') + { + $in_comment = false; + } + } + + unset($lines); + return $output; + } + /** * Map a phpBB dbms driver name to dbms data array */ @@ -289,46 +337,55 @@ class phpbb_database_test_connection_manager 'SCHEMA' => 'firebird', 'DELIM' => ';;', 'PDO' => 'firebird', + 'COMMENTS' => 'remove_remarks', ), 'mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', 'PDO' => 'mysql', + 'COMMENTS' => 'remove_remarks', ), 'mysql' => array( 'SCHEMA' => 'mysql', 'DELIM' => ';', 'PDO' => 'mysql', + 'COMMENTS' => 'remove_remarks', ), 'mssql' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', + 'COMMENTS' => 'remove_comments', ), 'mssql_odbc'=> array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', + 'COMMENTS' => 'remove_comments', ), 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'sqlsrv', + 'COMMENTS' => 'remove_comments', ), 'oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', 'PDO' => 'oci', + 'COMMENTS' => 'remove_comments', ), 'postgres' => array( 'SCHEMA' => 'postgres', 'DELIM' => ';', 'PDO' => 'pgsql', + 'COMMENTS' => 'remove_comments', ), 'sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', 'PDO' => 'sqlite2', + 'COMMENTS' => 'remove_remarks', ), ); From 5b66413f69db8839a2553ef29f5b2cd947992916 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 14 Aug 2011 20:46:01 +0200 Subject: [PATCH 008/325] [ticket/10315] Add top/bottom margin to the options in ACP to avoid overlapping PHPBB3-10315 --- phpBB/adm/style/admin.css | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 4c3fa51af3..666f4921ba 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -899,12 +899,15 @@ html>body dd label input { vertical-align: text-bottom;} /* Tweak for Moz to ali dd input { font-size: 1.00em; max-width: 100%; + margin: 2px 0; } dd select { font-size: 100%; + font-size: 1em; width: auto; max-width: 100%; + margin: 2px 0; } dd textarea { @@ -912,11 +915,6 @@ dd textarea { width: 90%; } -dd select { - width: auto; - font-size: 1.00em; -} - fieldset dl { margin-bottom: 10px; font-size: 0.85em; From 4bc11db0ffc3b387e4ad38b0d9ceccfa58f2738d Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Tue, 20 Sep 2011 23:23:03 -0500 Subject: [PATCH 009/325] [ticket/10349] Unit tests: Consolidate schema comment removal functions PHPBB3-10349 --- ...phpbb_database_test_connection_manager.php | 69 +++---------------- 1 file changed, 11 insertions(+), 58 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 78be831ecb..547361b41d 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -234,12 +234,11 @@ class phpbb_database_test_connection_manager } $filename = $directory . $schema . '_schema.sql'; - $remove_remarks = $this->dbms['COMMENTS']; $queries = file_get_contents($filename); - $this->$remove_remarks($queries); + $sql = $this->remove_comments($queries); - $sql = $this->split_sql($queries); + $sql = $this->split_sql($sql); foreach ($sql as $query) { @@ -271,60 +270,23 @@ class phpbb_database_test_connection_manager unset($data[key($data)]); } - if ($this->config['dbms'] == 'sqlite') - { - // remove comment lines starting with # - they are not proper sqlite - // syntax and break sqlite2 - foreach ($data as $i => $query) - { - $data[$i] = preg_replace('/^#.*$/m', "\n", $query); - } - } - return $data; } /** - * remove_remarks will strip the sql comment lines out of an uploaded sql file + * Removes comments from schema files + * + * Note: This performs the functions of remove_remarks() and remove_comments() used during installation */ - protected function remove_remarks(&$sql) + protected function remove_comments($sql) { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql); + + // Remove # style comments $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql)); - } - /** - * remove_comments will strip the sql comment lines out of an uploaded sql file - * specifically for mssql and postgres type files in the install.... - */ - protected function remove_comments(&$output) - { - $lines = explode("\n", $output); - $output = ''; - - // try to keep mem. use down - $linecount = sizeof($lines); - - $in_comment = false; - for ($i = 0; $i < $linecount; $i++) - { - if (trim($lines[$i]) == '/*') - { - $in_comment = true; - } - - if (!$in_comment) - { - $output .= $lines[$i] . "\n"; - } - - if (trim($lines[$i]) == '*/') - { - $in_comment = false; - } - } - - unset($lines); - return $output; + return $sql; } /** @@ -337,55 +299,46 @@ class phpbb_database_test_connection_manager 'SCHEMA' => 'firebird', 'DELIM' => ';;', 'PDO' => 'firebird', - 'COMMENTS' => 'remove_remarks', ), 'mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', 'PDO' => 'mysql', - 'COMMENTS' => 'remove_remarks', ), 'mysql' => array( 'SCHEMA' => 'mysql', 'DELIM' => ';', 'PDO' => 'mysql', - 'COMMENTS' => 'remove_remarks', ), 'mssql' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', - 'COMMENTS' => 'remove_comments', ), 'mssql_odbc'=> array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'odbc', - 'COMMENTS' => 'remove_comments', ), 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', 'PDO' => 'sqlsrv', - 'COMMENTS' => 'remove_comments', ), 'oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', 'PDO' => 'oci', - 'COMMENTS' => 'remove_comments', ), 'postgres' => array( 'SCHEMA' => 'postgres', 'DELIM' => ';', 'PDO' => 'pgsql', - 'COMMENTS' => 'remove_comments', ), 'sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', 'PDO' => 'sqlite2', - 'COMMENTS' => 'remove_remarks', ), ); From 25aee49ca510a4b209130d8e39d6d3f614a6ad7b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 21 Sep 2011 13:17:10 +0100 Subject: [PATCH 010/325] [ticket/10375] Use existing method to generate cache file name. PHPBB3-10375 --- phpBB/includes/template/template.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index 0495ade9c5..d1aa67038c 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -307,10 +307,9 @@ class phpbb_template */ private function _tpl_load($handle) { - $virtual_source_file = $this->locator->get_virtual_source_file_for_handle($handle); $source_file = null; - $compiled_path = $this->cachepath . str_replace('/', '.', $virtual_source_file) . '.' . $this->phpEx; + $compiled_path = $this->_compiled_file_for_handle($handle); $recompile = defined('DEBUG_EXTRA') || !file_exists($compiled_path) || From 9d5e9af54b2bf45baa3faa6195c2c185c08a0d4e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 21 Sep 2011 13:17:51 +0100 Subject: [PATCH 011/325] [ticket/10375] Make _tpl_load() a little leaner. - Removed duplicate variables - Set $source_file earlier for cache checks - Fixed useless mtime check PHPBB3-10375 --- phpBB/includes/template/template.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index d1aa67038c..e8220b25bf 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -307,35 +307,22 @@ class phpbb_template */ private function _tpl_load($handle) { - $source_file = null; - - $compiled_path = $this->_compiled_file_for_handle($handle); + $source_file = $this->locator->get_source_file_for_handle($handle); + $output_file = $this->_compiled_file_for_handle($handle); $recompile = defined('DEBUG_EXTRA') || - !file_exists($compiled_path) || - @filesize($compiled_path) === 0 || - ($this->config['load_tplcompile'] && @filemtime($compiled_path) < @filemtime($source_file)); - - if (!$recompile && $this->config['load_tplcompile']) - { - $source_file = $this->locator->get_source_file_for_handle($handle); - $recompile = (@filemtime($compiled_path) < @filemtime($source_file)) ? true : false; - } + !file_exists($output_file) || + @filesize($output_file) === 0 || + ($this->config['load_tplcompile'] && @filemtime($output_file) < @filemtime($source_file)); // Recompile page if the original template is newer, otherwise load the compiled version if (!$recompile) { - return new phpbb_template_renderer_include($compiled_path, $this); - } - - if ($source_file === null) - { - $source_file = $this->locator->get_source_file_for_handle($handle); + return new phpbb_template_renderer_include($output_file, $this); } $compile = new phpbb_template_compile($this->config['tpl_allow_php']); - $output_file = $this->_compiled_file_for_handle($handle); if ($compile->compile_file_to_file($source_file, $output_file) !== false) { $renderer = new phpbb_template_renderer_include($output_file, $this); From 95d24e6fb7389adfeaa46e97a49b1c15b5a740ca Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 21 Sep 2011 13:24:04 +0100 Subject: [PATCH 012/325] [ticket/10375] Rework $source_file setting. Only set the file if an mtime check or recompile are required. PHPBB3-10375 --- phpBB/includes/template/template.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index e8220b25bf..ec5fbe2829 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -307,13 +307,22 @@ class phpbb_template */ private function _tpl_load($handle) { - $source_file = $this->locator->get_source_file_for_handle($handle); $output_file = $this->_compiled_file_for_handle($handle); $recompile = defined('DEBUG_EXTRA') || !file_exists($output_file) || - @filesize($output_file) === 0 || - ($this->config['load_tplcompile'] && @filemtime($output_file) < @filemtime($source_file)); + @filesize($output_file) === 0; + + if ($recompile || $this->config['load_tplcompile']) + { + // Set only if a recompile or an mtime check are required. + $source_file = $this->locator->get_source_file_for_handle($handle); + + if (!$recompile && @filemtime($output_file) < @filemtime($source_file)) + { + $recompile = true; + } + } // Recompile page if the original template is newer, otherwise load the compiled version if (!$recompile) From a1febdd4290cf2b5aabf5fe6b656da1b3ad4f4c9 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 21 Sep 2011 21:19:37 +0100 Subject: [PATCH 013/325] [ticket/10239] Add confirm box to backup restore. PHPBB3-10239 --- phpBB/includes/acp/acp_database.php | 6 +++++- phpBB/language/en/acp/database.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 193dd001c0..1bf10b0e57 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -247,7 +247,7 @@ class acp_database confirm_box(false, $user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); } } - else + else if ($download || confirm_box(true)) { $download = request_var('download', ''); @@ -411,6 +411,10 @@ class acp_database trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); break; } + else if (!$download) + { + confirm_box(false, $user->lang['RESTORE_SELECTED_BACKUP'], build_hidden_fields(array('file' => $file))); + } default: $methods = array('sql'); diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index ae8f76d6b7..9c8ecbf13a 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -59,6 +59,7 @@ $lang = array_merge($lang, array( 'RESTORE_FAILURE' => 'The backup file may be corrupt.', 'RESTORE_OPTIONS' => 'Restore options', + 'RESTORE_SELECTED_BACKUP' => 'Are you sure you want to restore the selected backup?', 'RESTORE_SUCCESS' => 'The database has been successfully restored.

    Your board should be back to the state it was when the backup was made.', 'SELECT_ALL' => 'Select all', From fbb5c641b8163861bcb68b87fc08f0481ee54fac Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 24 Sep 2011 20:48:37 +0100 Subject: [PATCH 014/325] [ticket/10384] Update unit tests to test for failing variable. PHPBB3-10384 --- tests/template/template_test.php | 10 +++++----- tests/template/templates/lang.html | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 28eba05217..8ea21444f3 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -211,21 +211,21 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array(), array(), - "{ VARIABLE }\n{ VARIABLE }", + "{ VARIABLE }\n{ 1_VARIABLE }\n{ VARIABLE }\n{ 1_VARIABLE }", ), array( 'lang.html', - array('L_VARIABLE' => "Value'"), + array('L_VARIABLE' => "Value'", 'L_1_VARIABLE' => "1 O'Clock"), array(), array(), - "Value'\nValue\'", + "Value'\n1 O'Clock\nValue\'\n1 O\'Clock", ), array( 'lang.html', - array('LA_VARIABLE' => "Value'"), + array('LA_VARIABLE' => "Value'", 'LA_1_VARIABLE' => "1 O'Clock"), array(), array(), - "{ VARIABLE }\nValue'", + "{ VARIABLE }\n{ 1_VARIABLE }\nValue'\n1 O'Clock", ), array( 'loop_nested_multilevel_ref.html', diff --git a/tests/template/templates/lang.html b/tests/template/templates/lang.html index 2b5ea1cafe..3eecc298cb 100644 --- a/tests/template/templates/lang.html +++ b/tests/template/templates/lang.html @@ -1,3 +1,5 @@ {L_VARIABLE} +{L_1_VARIABLE} {LA_VARIABLE} +{LA_1_VARIABLE} From e9392bbddebab4cca5f1c5debda40e6156de6aaf Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 24 Sep 2011 20:50:35 +0100 Subject: [PATCH 015/325] [ticket/10384] Language variable replacements should not check for var prefix. PHPBB3-10384 --- phpBB/includes/template/filter.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index f24c3f4d09..d8ea603efd 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -40,6 +40,7 @@ class phpbb_template_filter extends php_user_filter const REGEX_NS = '[a-z_][a-z_0-9]+'; const REGEX_VAR = '[A-Z_][A-Z_0-9]+'; + const REGEX_VAR_SUFFIX = '[A-Z_0-9]+'; const REGEX_TAG = ''; @@ -374,7 +375,7 @@ class phpbb_template_filter extends php_user_filter // transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array if (strpos($text_blocks, '{L_') !== false) { - $text_blocks = preg_replace('#\{L_(' . self::REGEX_VAR . ')\}#', "", $text_blocks, -1, $replacements); + $text_blocks = preg_replace('#\{L_(' . self::REGEX_VAR_SUFFIX . ')\}#', "", $text_blocks, -1, $replacements); return (bool) $replacements; } @@ -382,7 +383,7 @@ class phpbb_template_filter extends php_user_filter // If a template variable already exist, it will be used in favor of it... if (strpos($text_blocks, '{LA_') !== false) { - $text_blocks = preg_replace('#\{LA_(' . self::REGEX_VAR . '+)\}#', "", $text_blocks, -1, $replacements); + $text_blocks = preg_replace('#\{LA_(' . self::REGEX_VAR_SUFFIX . '+)\}#', "", $text_blocks, -1, $replacements); return (bool) $replacements; } From 138d1050fcfa910eb8819e91034741ed74baf4f3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 24 Sep 2011 22:05:40 +0100 Subject: [PATCH 016/325] [ticket/9307] Remove hardcoded chunk size of mass emails. The new config option is 'email_max_chunk_size' I have not added an interface option to change this. PHPBB3-9307 --- phpBB/includes/acp/acp_email.php | 5 +++-- phpBB/install/database_update.php | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 133fe47e09..e98b7a19a5 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -136,8 +136,9 @@ class acp_email $i = $j = 0; - // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit) - $max_chunk_size = 50; + // Send with BCC + // Maximum number of bcc recipients + $max_chunk_size = (int) $config['email_max_chunk_size']; $email_list = array(); $old_lang = $row['user_lang']; $old_notify_type = $row['user_notify_type']; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a167e79308..21246a215e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1994,6 +1994,11 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.9-RC4 to 3.0.9 case '3.0.9-RC4': break; + + // Changes from 3.0.9 to 3.0.10-RC1 + case '3.0.9': + set_config('email_max_chunk_size', '50'); + break; } } From e0869b39a37a2db4ba88070d52e58307e721b336 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 25 Sep 2011 10:59:41 +0800 Subject: [PATCH 017/325] [ticket/9008] Incorrect unread topic tracking for unapproved topics PHPBB3-9008 --- phpBB/includes/functions.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 628f8ee123..c0581c1b1b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1880,7 +1880,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s */ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) { - global $db, $tracking_topics, $user, $config; + global $db, $tracking_topics, $user, $config, $auth; // Determine the users last forum mark time if not given. if ($mark_time_forum === false) @@ -1903,6 +1903,10 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti } } + // Handle update of unapproved topics info. + // Only update for moderators having m_approve permission for the forum. + $sql_update_unapproved = ($auth->acl_get('m_approve', $forum_id)) ? '': 'AND t.topic_approved = 1'; + // Check the forum for any left unread topics. // If there are none, we mark the forum as read. if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -1918,7 +1922,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ') WHERE t.forum_id = ' . $forum_id . ' AND t.topic_last_post_time > ' . $mark_time_forum . ' - AND t.topic_moved_id = 0 + AND t.topic_moved_id = 0 ' . + $sql_update_unapproved . ' AND (tt.topic_id IS NULL OR tt.mark_time < t.topic_last_post_time) GROUP BY t.forum_id'; $result = $db->sql_query_limit($sql, 1); @@ -1942,7 +1947,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . $forum_id . ' AND topic_last_post_time > ' . $mark_time_forum . ' - AND topic_moved_id = 0'; + AND topic_moved_id = 0 ' . + $sql_update_unapproved; $result = $db->sql_query($sql); $check_forum = $tracking_topics['tf'][$forum_id]; From ee5d585fe980763eb6f0144c25b20474989bb32b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 25 Sep 2011 13:11:24 +0100 Subject: [PATCH 018/325] [ticket/10387] Add CURRENT_PAGE var to the template when pagination is used. PHPBB3-10387 --- phpBB/includes/functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5ccb9edd07..822ac5b8d6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1951,6 +1951,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page), $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page), $tpl_prefix . 'TOTAL_PAGES' => $total_pages, + $tpl_prefix . 'CURRENT_PAGE' => $on_page, )); return $page_string; From 81f9385477e1a6b050f447c9659faaf0bc7e871a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 25 Sep 2011 22:13:43 +0100 Subject: [PATCH 019/325] [ticket/9307] Add config variable to installation schema. PHPBB3-9307 --- phpBB/install/schemas/schema_data.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 153ac61157..84b25d676e 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -94,6 +94,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0') INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1'); From 6fce68b9b6f1f47f9f51f8ef1a043b78ac046a3f Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 18 Sep 2011 19:40:04 -0700 Subject: [PATCH 020/325] [ticket/9661] Remove eval() from functions_privmsgs.php Tested by sending messages to myself on a test board. PHPBB3-9661 --- phpBB/includes/functions_privmsgs.php | 113 ++++++++++++++++++-------- 1 file changed, 79 insertions(+), 34 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 9787bdfbc4..32b57a9f2e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -19,7 +19,8 @@ if (!defined('IN_PHPBB')) Ability to simply add own rules by doing three things: 1) Add an appropriate constant 2) Add a new check array to the global_privmsgs_rules variable and the condition array (if one is required) - 3) Add a new language variable to ucp.php + 3) Implement the rule logic in the check_rule() function + 4) Add a new language variable to ucp.php The user is then able to select the new rule. It will be checked against and handled as specified. To add new actions (yes, checks can be added here too) to the rule management, the core code has to be modified. @@ -57,42 +58,42 @@ define('CHECK_TO', 5); */ $global_privmsgs_rules = array( CHECK_SUBJECT => array( - RULE_IS_LIKE => array('check0' => 'message_subject', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'), - RULE_IS_NOT_LIKE => array('check0' => 'message_subject', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'), - RULE_IS => array('check0' => 'message_subject', 'function' => '{CHECK0} == {STRING}'), - RULE_IS_NOT => array('check0' => 'message_subject', 'function' => '{CHECK0} != {STRING}'), - RULE_BEGINS_WITH => array('check0' => 'message_subject', 'function' => 'preg_match("/^" . preg_quote({STRING}, "/") . "/i", {CHECK0})'), - RULE_ENDS_WITH => array('check0' => 'message_subject', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "$/i", {CHECK0})'), + RULE_IS_LIKE => array('check0' => 'message_subject'), + RULE_IS_NOT_LIKE => array('check0' => 'message_subject'), + RULE_IS => array('check0' => 'message_subject'), + RULE_IS_NOT => array('check0' => 'message_subject'), + RULE_BEGINS_WITH => array('check0' => 'message_subject'), + RULE_ENDS_WITH => array('check0' => 'message_subject'), ), CHECK_SENDER => array( - RULE_IS_LIKE => array('check0' => 'username', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'), - RULE_IS_NOT_LIKE => array('check0' => 'username', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'), - RULE_IS => array('check0' => 'username', 'function' => '{CHECK0} == {STRING}'), - RULE_IS_NOT => array('check0' => 'username', 'function' => '{CHECK0} != {STRING}'), - RULE_BEGINS_WITH => array('check0' => 'username', 'function' => 'preg_match("/^" . preg_quote({STRING}, "/") . "/i", {CHECK0})'), - RULE_ENDS_WITH => array('check0' => 'username', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "$/i", {CHECK0})'), - RULE_IS_FRIEND => array('check0' => 'friend', 'function' => '{CHECK0} == 1'), - RULE_IS_FOE => array('check0' => 'foe', 'function' => '{CHECK0} == 1'), - RULE_IS_USER => array('check0' => 'author_id', 'function' => '{CHECK0} == {USER_ID}'), - RULE_IS_GROUP => array('check0' => 'author_in_group', 'function' => 'in_array({GROUP_ID}, {CHECK0})'), + RULE_IS_LIKE => array('check0' => 'username'), + RULE_IS_NOT_LIKE => array('check0' => 'username'), + RULE_IS => array('check0' => 'username'), + RULE_IS_NOT => array('check0' => 'username'), + RULE_BEGINS_WITH => array('check0' => 'username'), + RULE_ENDS_WITH => array('check0' => 'username'), + RULE_IS_FRIEND => array('check0' => 'friend'), + RULE_IS_FOE => array('check0' => 'foe'), + RULE_IS_USER => array('check0' => 'author_id'), + RULE_IS_GROUP => array('check0' => 'author_in_group'), ), CHECK_MESSAGE => array( - RULE_IS_LIKE => array('check0' => 'message_text', 'function' => 'preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0})'), - RULE_IS_NOT_LIKE => array('check0' => 'message_text', 'function' => '!(preg_match("/" . preg_quote({STRING}, "/") . "/i", {CHECK0}))'), - RULE_IS => array('check0' => 'message_text', 'function' => '{CHECK0} == {STRING}'), - RULE_IS_NOT => array('check0' => 'message_text', 'function' => '{CHECK0} != {STRING}'), + RULE_IS_LIKE => array('check0' => 'message_text'), + RULE_IS_NOT_LIKE => array('check0' => 'message_text'), + RULE_IS => array('check0' => 'message_text'), + RULE_IS_NOT => array('check0' => 'message_text'), ), CHECK_STATUS => array( - RULE_ANSWERED => array('check0' => 'pm_replied', 'function' => '{CHECK0} == 1'), - RULE_FORWARDED => array('check0' => 'pm_forwarded', 'function' => '{CHECK0} == 1'), + RULE_ANSWERED => array('check0' => 'pm_replied'), + RULE_FORWARDED => array('check0' => 'pm_forwarded'), ), CHECK_TO => array( - RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group', 'function' => 'in_array("g_" . {CHECK2}, {CHECK0}) || in_array("g_" . {CHECK2}, {CHECK1})'), - RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc', 'function' => 'in_array("u_" . $user_id, {CHECK0}) || in_array("u_" . $user_id, {CHECK1})'), + RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group'), + RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc'), ) ); @@ -260,16 +261,60 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) $check_ary = $rules[$rule_row['rule_check']][$rule_row['rule_connection']]; - // Replace Check Literals - $evaluate = $check_ary['function']; - $evaluate = preg_replace('/{(CHECK[0-9])}/', '$message_row[$check_ary[strtolower("\1")]]', $evaluate); - - // Replace Rule Literals - $evaluate = preg_replace('/{(STRING|USER_ID|GROUP_ID)}/', '$rule_row["rule_" . strtolower("\1")]', $evaluate); - - // Evil Statement $result = false; - eval('$result = (' . $evaluate . ') ? true : false;'); + + $check0 = $message_row[$check_ary['check0']]; + + switch ($rule_row['rule_connection']) + { + case RULE_IS_LIKE: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS_NOT_LIKE: + $result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS: + $result = ($check0 == $rule_row['rule_string']); + break; + + case RULE_IS_NOT: + $result = ($check0 != $rule_row['rule_string']); + break; + + case RULE_BEGINS_WITH: + $result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_ENDS_WITH: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0); + break; + + case RULE_IS_FRIEND: + case RULE_IS_FOE: + case RULE_ANSWERED: + case RULE_FORWARDED: + $result = ($check0 == 1); + break; + + case RULE_IS_USER: + $result = ($check0 == $rule_row['rule_user_id']); + break; + + case RULE_IS_GROUP: + $result = in_array($rule_row['rule_group_id'], $check0); + break; + + case RULE_TO_GROUP: + $result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']])); + break; + + case RULE_TO_ME: + $result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']])); + break; + } + if (!$result) { From 56c6476233646e7c735aa4e3b98c4a6b62df5c7d Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 25 Sep 2011 15:12:56 -0700 Subject: [PATCH 021/325] [ticket/10390] Allow option for jQuery to be hosted by a remote CDN Add an option to the ACP so admins can choose to host jQuery from the local version shipped with phpBB, or via a popular CDN. PHPBB3-10390 --- phpBB/adm/style/install_footer.html | 3 +- phpBB/adm/style/overall_footer.html | 3 +- phpBB/adm/style/simple_footer.html | 3 +- phpBB/includes/acp/acp_board.php | 11 +++++++ phpBB/includes/constants.php | 1 + phpBB/includes/functions.php | 29 +++++++++++++++++++ phpBB/includes/functions_acp.php | 2 ++ phpBB/install/database_update.php | 1 + phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 10 +++++++ .../prosilver/template/overall_footer.html | 3 +- .../prosilver/template/simple_footer.html | 3 +- .../subsilver2/template/overall_footer.html | 3 +- .../subsilver2/template/simple_footer.html | 3 +- 14 files changed, 69 insertions(+), 7 deletions(-) diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html index 1b3134b5e1..a3b2294025 100644 --- a/phpBB/adm/style/install_footer.html +++ b/phpBB/adm/style/install_footer.html @@ -12,7 +12,8 @@ - + + diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index dc03d2cfb5..f05e9c56c5 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -20,7 +20,8 @@ - + + diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index 272fd5e3fb..0d697aec1d 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -16,7 +16,8 @@ - + + diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f27a133eb5..45b6f219ac 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -99,6 +99,7 @@ class acp_board 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_jquery_host' => array('lang' => 'JQUERY_HOST', 'validate' => 'string', 'type' => 'select', 'method' => 'jquery_host_select', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES', ) @@ -997,4 +998,14 @@ class acp_board $cache->destroy('sql', FORUMS_TABLE); } + function jquery_host_select($value, $key = '') + { + global $user; + + return ' + + + '; + } + } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 8ef1a4655d..c3af3d29e1 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -210,6 +210,7 @@ define('CAPTCHA_MAX_CHARS', 7); // Additional constants define('VOTE_CONVERTED', 127); +define('JQUERY_VERSION', '1.6.2'); // Important follow jQuery versioning, ie: 1.6, 1.6.1, 1.6.2 // Table names define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5ccb9edd07..af07938879 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4569,6 +4569,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css', 'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css', 'T_STYLESHEET_NAME' => $user->theme['theme_name'], + 'T_JQUERY_LINK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? remote_jquery_url($config['load_jquery_host']) : "{$web_path}assets/javascript/jquery.js", + 'S_JQUERY_FALLBACK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? true : false, 'T_THEME_NAME' => $user->theme['theme_path'], 'T_THEME_LANG_NAME' => $user->data['user_lang'], @@ -4767,3 +4769,30 @@ function phpbb_pcre_utf8_support() } return $utf8_pcre_properties; } + +/** +* Build jQuery URL for remote CDNs +* Reference: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery +* +* @return string Returns url to a jQuery library +*/ +function remote_jquery_url($host) +{ + switch($host) + { + case 'google': + // Google uses a 1.5.0, 1.5.1 format (it is always a three numbered version) + return '//ajax.googleapis.com/ajax/libs/jquery/' . ((strlen(JQUERY_VERSION) == 3) ? JQUERY_VERSION . '.0' : JQUERY_VERSION) . '/jquery.min.js'; + break; + + case 'microsoft': + // Microsoft uses a 1.5, 1.5.1 format + return 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; + break; + + case 'jquery': + // jQuery uses a 1.5, 1.5.1 format + return 'http://code.jquery.com/jquery-' . JQUERY_VERSION . '.min.js'; + break; + } +} diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index c3806dc786..4f9fa0db5e 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -126,6 +126,8 @@ function adm_page_footer($copyright_html = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, + 'T_JQUERY_LINK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? remote_jquery_url($config['load_jquery_host']) : "{$phpbb_root_path}assets/javascript/jquery.js", + 'S_JQUERY_FALLBACK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? true : false, 'VERSION' => $config['version']) ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 18741191d8..1a47e2a656 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2090,6 +2090,7 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': + set_config('load_jquery_host', 'localhost'); set_config('use_system_cron', 0); $sql = 'UPDATE ' . GROUPS_TABLE . ' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5506922e17..865189f345 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -165,6 +165,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofi INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_track', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_host', 'localhost'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index abf346137d..4da069f68f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -549,3 +549,13 @@ $lang = array_merge($lang, array( 'JAB_USERNAME' => 'Jabber username or JID', 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', )); + +// jQuery settings +$lang = array_merge($lang, array( + 'JQUERY_HOST' => 'jQuery server', + 'JQUERY_HOST_EXPLAIN' => 'Load jQuery from your local server, or choose a remote copy hosted on a CDN (Content Delivery Network). If the CDN fails, phpBB will fall back to the local copy.', + 'JQUERY_HOST_LOCAL' => 'Localhost', + 'JQUERY_HOST_GOOGLE' => 'Google Ajax API CDN', + 'JQUERY_HOST_JQUERY' => 'jQuery CDN', + 'JQUERY_HOST_MS' => 'Microsoft CDN', +)); diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 275e018f43..4456d6b37d 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -33,7 +33,8 @@ {RUN_CRON_TASK} - + + diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 5899da0b7a..3458d02495 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -6,7 +6,8 @@ - + + diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 3cdd071211..9b0b95372e 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -8,7 +8,8 @@
    [ {DEBUG_OUTPUT} ] - + + diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html index f03d1094f2..b51be3ac4c 100644 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ b/phpBB/styles/subsilver2/template/simple_footer.html @@ -5,7 +5,8 @@ Powered by phpBB® Forum Software © phpBB Group - + + From 39840ef36d4b074478de080caddd3e880bdba663 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 25 Sep 2011 18:15:42 -0700 Subject: [PATCH 022/325] [ticket/10390] Move jQuery version definition Move jQuery version definition to its own block PHPBB3-10390 --- phpBB/includes/constants.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index c3af3d29e1..06cbc7120c 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -30,6 +30,9 @@ define('PHPBB_VERSION', '3.1.0-dev'); // QA-related // define('PHPBB_QA', 1); +// jQuery Version +define('JQUERY_VERSION', '1.6.2'); // Important follow jQuery versioning, ie: 1.6, 1.6.1, 1.6.2 + // User related define('ANONYMOUS', 1); @@ -210,7 +213,6 @@ define('CAPTCHA_MAX_CHARS', 7); // Additional constants define('VOTE_CONVERTED', 127); -define('JQUERY_VERSION', '1.6.2'); // Important follow jQuery versioning, ie: 1.6, 1.6.1, 1.6.2 // Table names define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); From abb0f3f96d2fecfe2af2bde539a2b9d3a577e421 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 25 Sep 2011 18:16:25 -0700 Subject: [PATCH 023/325] [ticket/10390] Improve the jQuery CDN url generation function Per p's comments, return the remote url from a variable instead of using multiple returns. Also put the logic for creating Google's version on its own line, and count the version number's dots instead of length so it will be less likely to break if jQuery goes to version 1.10. PHPBB3-10390 --- phpBB/includes/functions.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index af07938879..83cadf426d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4781,18 +4781,21 @@ function remote_jquery_url($host) switch($host) { case 'google': - // Google uses a 1.5.0, 1.5.1 format (it is always a three numbered version) - return '//ajax.googleapis.com/ajax/libs/jquery/' . ((strlen(JQUERY_VERSION) == 3) ? JQUERY_VERSION . '.0' : JQUERY_VERSION) . '/jquery.min.js'; + // Google uses a 1.5.0, 1.5.1 format (it adds a .0 to new 1.X releases) + $version = (substr_count(JQUERY_VERSION, '.') == 1) ? JQUERY_VERSION . '.0' : JQUERY_VERSION; + // HTTP protocol intentionally omitted - its the best way to reference third party content that is available via both HTTP and HTTPS + $url = '//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js'; break; case 'microsoft': // Microsoft uses a 1.5, 1.5.1 format - return 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; + $url = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; break; case 'jquery': // jQuery uses a 1.5, 1.5.1 format - return 'http://code.jquery.com/jquery-' . JQUERY_VERSION . '.min.js'; + $url = 'http://code.jquery.com/jquery-' . JQUERY_VERSION . '.min.js'; break; } + return $url; } From d4fe81f8f0458b46b1bfe086c5a34af38e5af618 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 25 Sep 2011 18:16:46 -0700 Subject: [PATCH 024/325] [ticket/10390] Fix a type-o - captialize AJAX AJAX should be capitalized where it appears in the ACP as the option: "Google AJAX API CDN" PHPBB3-10390 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 4da069f68f..1bab87b37f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -555,7 +555,7 @@ $lang = array_merge($lang, array( 'JQUERY_HOST' => 'jQuery server', 'JQUERY_HOST_EXPLAIN' => 'Load jQuery from your local server, or choose a remote copy hosted on a CDN (Content Delivery Network). If the CDN fails, phpBB will fall back to the local copy.', 'JQUERY_HOST_LOCAL' => 'Localhost', - 'JQUERY_HOST_GOOGLE' => 'Google Ajax API CDN', + 'JQUERY_HOST_GOOGLE' => 'Google AJAX API CDN', 'JQUERY_HOST_JQUERY' => 'jQuery CDN', 'JQUERY_HOST_MS' => 'Microsoft CDN', )); From 0f589d9ce43272153c3b7bd300d1a15fabb87cdd Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 26 Sep 2011 20:52:07 +0100 Subject: [PATCH 025/325] [ticket/10392] Fix access to nested special block variables. PHPBB3-10392 --- phpBB/includes/template/filter.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index f24c3f4d09..1c8b45307c 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -871,6 +871,8 @@ class phpbb_template_filter extends php_user_filter { // Strip the trailing period. $namespace = substr($namespace, 0, -1); + $local_namespace = substr(strrchr($namespace, '.'), 1); + $local_namespace = ($local_namespace) ? $local_namespace : $namespace; $expr = true; @@ -880,19 +882,19 @@ class phpbb_template_filter extends php_user_filter { case 'S_ROW_NUM': case 'S_ROW_COUNT': - $varref = "\$_${namespace}_i"; + $varref = "\$_${local_namespace}_i"; break; case 'S_NUM_ROWS': - $varref = "\$_${namespace}_count"; + $varref = "\$_${local_namespace}_count"; break; case 'S_FIRST_ROW': - $varref = "(\$_${namespace}_i == 0)"; + $varref = "(\$_${local_namespace}_i == 0)"; break; case 'S_LAST_ROW': - $varref = "(\$_${namespace}_i == \$_${namespace}_count - 1)"; + $varref = "(\$_${local_namespace}_i == \$_${local_namespace}_count - 1)"; break; case 'S_BLOCK_NAME': From 02a24e2439a0ae4c23c94a2aacc0fb407d2ccc0f Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 27 Sep 2011 00:50:53 +0100 Subject: [PATCH 026/325] [ticket/10392] Missed fix for S_BLOCK_NAME. PHPBB3-10392 --- phpBB/includes/template/filter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index 1c8b45307c..b6b9a2963e 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -898,7 +898,7 @@ class phpbb_template_filter extends php_user_filter break; case 'S_BLOCK_NAME': - $varref = "'$namespace'"; + $varref = "'$local_namespace'"; break; default: From 118bc6198e87ffd21835d2477039744e23b04cb7 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 27 Sep 2011 01:02:58 +0100 Subject: [PATCH 027/325] [ticket/10392] Test for magic loop variables with nested namespaces. PHPBB3-10392 --- tests/template/template_test.php | 2 +- tests/template/templates/loop_nested_deep_multilevel_ref.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 28eba05217..cf772a5284 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -248,7 +248,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), array(), // I don't completely understand this output, hopefully it's correct - "top-level content\nouter\n\ninner z\nfirst row\n\ninner zz", + "top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz", ), array( 'loop_size.html', diff --git a/tests/template/templates/loop_nested_deep_multilevel_ref.html b/tests/template/templates/loop_nested_deep_multilevel_ref.html index 60fad7b4cd..bcc2a7c07b 100644 --- a/tests/template/templates/loop_nested_deep_multilevel_ref.html +++ b/tests/template/templates/loop_nested_deep_multilevel_ref.html @@ -2,10 +2,11 @@ top-level content outer + {outer.middle.S_BLOCK_NAME} inner {inner.VARIABLE} - first row + first row of {outer.middle.inner.S_NUM_ROWS} in {middle.inner.S_BLOCK_NAME} From 1f140130930e40dcf3e6693feb1b53d14e46d098 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 27 Sep 2011 01:06:43 +0100 Subject: [PATCH 028/325] [ticket/10392] Alter parent namespace stripping. PHPBB3-10392 --- phpBB/includes/template/filter.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index b6b9a2963e..da2cffe64f 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -871,8 +871,15 @@ class phpbb_template_filter extends php_user_filter { // Strip the trailing period. $namespace = substr($namespace, 0, -1); - $local_namespace = substr(strrchr($namespace, '.'), 1); - $local_namespace = ($local_namespace) ? $local_namespace : $namespace; + + if (($pos = strrpos($namespace, '.')) !== false) + { + $local_namespace = substr($namespace, $pos + 1); + } + else + { + $local_namespace = $namespace; + } $expr = true; From b571b3e0326cc6fe987ceb317ee803d4921cc133 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 27 Sep 2011 17:31:24 +0200 Subject: [PATCH 029/325] [ticket/10394] Remove call-time pass by reference from tests for PHP 5.4 PHPBB3-10394 --- tests/profile/custom_test.php | 2 +- tests/utf/normalizer_test.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php index 0e0a851243..585182e583 100644 --- a/tests/profile/custom_test.php +++ b/tests/profile/custom_test.php @@ -48,7 +48,7 @@ class phpbb_profile_custom_test extends phpbb_database_test_case ); $cp = new custom_profile; - $result = $cp->validate_profile_field(FIELD_DROPDOWN, &$field_value, $field_data); + $result = $cp->validate_profile_field(FIELD_DROPDOWN, $field_value, $field_data); $this->assertEquals($expected, $result, $description); } diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php index a0ba470416..f8f2467082 100644 --- a/tests/utf/normalizer_test.php +++ b/tests/utf/normalizer_test.php @@ -102,7 +102,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case foreach ($tests as $test) { $utf_result = $utf_expected; - call_user_func(array('utf_normalizer', $form), &$utf_result); + call_user_func(array('utf_normalizer', $form), $utf_result); $hex_result = $this->utf_to_hexseq($utf_result); $this->assertEquals($utf_expected, $utf_result, "$expected == $form($test) ($hex_expected != $hex_result)"); @@ -154,7 +154,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form) { $utf_result = $utf_expected; - call_user_func(array('utf_normalizer', $form), &$utf_result); + call_user_func(array('utf_normalizer', $form), $utf_result); $hex_result = $this->utf_to_hexseq($utf_result); $this->assertEquals($utf_expected, $utf_result, "$hex_expected == $form($hex_tested) ($hex_expected != $hex_result)"); From 81e8faecbcc4f8c22a1dafdefe848ac548a6c77a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 25 Sep 2011 19:09:29 -0700 Subject: [PATCH 030/325] [ticket/10390] Reword the language for jQuery host/server options Reword some of the language used for the description and pull-down options to try and make it more clear to users that they have the option to use jQuery from their own server with the copy included with phpBB, or from one of the remote CDN servers. PHPBB3-10390 --- phpBB/language/en/acp/board.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 1bab87b37f..7a028b4064 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -552,10 +552,10 @@ $lang = array_merge($lang, array( // jQuery settings $lang = array_merge($lang, array( - 'JQUERY_HOST' => 'jQuery server', - 'JQUERY_HOST_EXPLAIN' => 'Load jQuery from your local server, or choose a remote copy hosted on a CDN (Content Delivery Network). If the CDN fails, phpBB will fall back to the local copy.', - 'JQUERY_HOST_LOCAL' => 'Localhost', - 'JQUERY_HOST_GOOGLE' => 'Google AJAX API CDN', - 'JQUERY_HOST_JQUERY' => 'jQuery CDN', - 'JQUERY_HOST_MS' => 'Microsoft CDN', + 'JQUERY_HOST' => 'Load jQuery from your server or a hosted CDN', + 'JQUERY_HOST_EXPLAIN' => 'Load jQuery from the copy included with phpBB on your local server, or choose a remote copy hosted on a CDN (Content Delivery Network). If the CDN fails, phpBB will fall back to the copy included with phpBB.', + 'JQUERY_HOST_LOCAL' => 'Included with phpBB on my server', + 'JQUERY_HOST_GOOGLE' => 'Hosted CDN: Google AJAX API', + 'JQUERY_HOST_JQUERY' => 'Hosted CDN: jQuery', + 'JQUERY_HOST_MS' => 'Hosted CDN: Microsoft', )); From c6a2d81bd359711aeb9dc36478977e779d3bdfe9 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 26 Sep 2011 11:13:16 -0700 Subject: [PATCH 031/325] [ticket/10390] Drop http protocol for Microsoft's CDN option Like Google, Microsoft supports both http and https protocols, so we can drop the protocol alltogether from the url so the Microsoft CDN will work on both HTTP or HTTPS sites without issue. Also I cleaned up some of the comments here. PHPBB3-10390 --- phpBB/includes/functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 83cadf426d..8cdafbd95e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4773,6 +4773,8 @@ function phpbb_pcre_utf8_support() /** * Build jQuery URL for remote CDNs * Reference: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery +* HTTP protocols intentionally omitted for Google and Microsoft - its the best +* way to reference third party content that is available via both HTTP and HTTPS * * @return string Returns url to a jQuery library */ @@ -4781,15 +4783,14 @@ function remote_jquery_url($host) switch($host) { case 'google': - // Google uses a 1.5.0, 1.5.1 format (it adds a .0 to new 1.X releases) + // Google uses a 1.5.0, 1.5.1 format (we need to add a .0 to new 1.X releases) $version = (substr_count(JQUERY_VERSION, '.') == 1) ? JQUERY_VERSION . '.0' : JQUERY_VERSION; - // HTTP protocol intentionally omitted - its the best way to reference third party content that is available via both HTTP and HTTPS $url = '//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js'; break; case 'microsoft': // Microsoft uses a 1.5, 1.5.1 format - $url = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; + $url = '//ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; break; case 'jquery': From 2a28b6fc401e4481a3a4eb6085b45b9bd7746f43 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 26 Sep 2011 20:21:14 -0700 Subject: [PATCH 032/325] [ticket/10390] Use simpler HTML5 compliant js for the jQuery fallback HTML5 styles (ACP / Prosilver) do not need to use escaped javascript wrapped in an unescape function, so we can simplify it! Only subsilver2 will use the escaped version of the fallback code, because it is still XHTML. PHPBB3-10390 --- phpBB/adm/style/install_footer.html | 2 +- phpBB/adm/style/overall_footer.html | 2 +- phpBB/adm/style/simple_footer.html | 2 +- phpBB/styles/prosilver/template/overall_footer.html | 2 +- phpBB/styles/prosilver/template/simple_footer.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html index a3b2294025..342d8d4151 100644 --- a/phpBB/adm/style/install_footer.html +++ b/phpBB/adm/style/install_footer.html @@ -13,7 +13,7 @@ - + diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index f05e9c56c5..a190b2299a 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -21,7 +21,7 @@ - + diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index 0d697aec1d..5632d3fc9c 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -17,7 +17,7 @@ - + diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 4456d6b37d..67f1b922a4 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -34,7 +34,7 @@ - + diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 3458d02495..75b7480aa7 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -7,7 +7,7 @@ - + From 2dca3c3c278e99cfd6cdbea7149063d160e4cc11 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 26 Sep 2011 20:26:32 -0700 Subject: [PATCH 033/325] [ticket/10390] Serve jQuery from Google CDN Yes/No button in ACP jQuery will now be available via remote CDN from Google. Microsoft and jQuery CDNs have been removed, so we can simplify this option for the user. Default mode is NO so the copy of jQuery included with phpBB is served by default. PHPBB3-10390 --- phpBB/includes/acp/acp_board.php | 12 +-------- phpBB/includes/constants.php | 3 --- phpBB/includes/functions.php | 35 ++------------------------- phpBB/includes/functions_acp.php | 4 +-- phpBB/install/database_update.php | 3 ++- phpBB/install/schemas/schema_data.sql | 3 ++- phpBB/language/en/acp/board.php | 12 ++------- 7 files changed, 11 insertions(+), 61 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 45b6f219ac..352f1abc33 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -99,7 +99,7 @@ class acp_board 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_jquery_host' => array('lang' => 'JQUERY_HOST', 'validate' => 'string', 'type' => 'select', 'method' => 'jquery_host_select', 'explain' => true), + 'load_jquery_cdn' => array('lang' => 'LOAD_JQUERY_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES', ) @@ -998,14 +998,4 @@ class acp_board $cache->destroy('sql', FORUMS_TABLE); } - function jquery_host_select($value, $key = '') - { - global $user; - - return ' - - - '; - } - } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 06cbc7120c..8ef1a4655d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -30,9 +30,6 @@ define('PHPBB_VERSION', '3.1.0-dev'); // QA-related // define('PHPBB_QA', 1); -// jQuery Version -define('JQUERY_VERSION', '1.6.2'); // Important follow jQuery versioning, ie: 1.6, 1.6.1, 1.6.2 - // User related define('ANONYMOUS', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8cdafbd95e..d769ce0374 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4569,8 +4569,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css', 'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css', 'T_STYLESHEET_NAME' => $user->theme['theme_name'], - 'T_JQUERY_LINK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? remote_jquery_url($config['load_jquery_host']) : "{$web_path}assets/javascript/jquery.js", - 'S_JQUERY_FALLBACK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? true : false, + 'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js", + 'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false, 'T_THEME_NAME' => $user->theme['theme_path'], 'T_THEME_LANG_NAME' => $user->data['user_lang'], @@ -4769,34 +4769,3 @@ function phpbb_pcre_utf8_support() } return $utf8_pcre_properties; } - -/** -* Build jQuery URL for remote CDNs -* Reference: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery -* HTTP protocols intentionally omitted for Google and Microsoft - its the best -* way to reference third party content that is available via both HTTP and HTTPS -* -* @return string Returns url to a jQuery library -*/ -function remote_jquery_url($host) -{ - switch($host) - { - case 'google': - // Google uses a 1.5.0, 1.5.1 format (we need to add a .0 to new 1.X releases) - $version = (substr_count(JQUERY_VERSION, '.') == 1) ? JQUERY_VERSION . '.0' : JQUERY_VERSION; - $url = '//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js'; - break; - - case 'microsoft': - // Microsoft uses a 1.5, 1.5.1 format - $url = '//ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; - break; - - case 'jquery': - // jQuery uses a 1.5, 1.5.1 format - $url = 'http://code.jquery.com/jquery-' . JQUERY_VERSION . '.min.js'; - break; - } - return $url; -} diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 4f9fa0db5e..142be083a7 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -126,8 +126,8 @@ function adm_page_footer($copyright_html = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, - 'T_JQUERY_LINK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? remote_jquery_url($config['load_jquery_host']) : "{$phpbb_root_path}assets/javascript/jquery.js", - 'S_JQUERY_FALLBACK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? true : false, + 'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js", + 'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false, 'VERSION' => $config['version']) ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 1a47e2a656..1fa01a534d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2090,7 +2090,8 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': - set_config('load_jquery_host', 'localhost'); + set_config('load_jquery_cdn', 0); + set_config('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); set_config('use_system_cron', 0); $sql = 'UPDATE ' . GROUPS_TABLE . ' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 865189f345..843d6daaa7 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -165,7 +165,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofi INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_track', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_host', 'localhost'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_cdn', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online', '1'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 7a028b4064..07102d4db3 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -356,6 +356,8 @@ $lang = array_merge($lang, array( 'LOAD_CPF_PM' => 'Display custom profile fields in private messages', 'LOAD_CPF_VIEWPROFILE' => 'Display custom profile fields in user profiles', 'LOAD_CPF_VIEWTOPIC' => 'Display custom profile fields on topic pages', + 'LOAD_JQUERY_CDN' => 'Serve jQuery using Google’s CDN', + 'LOAD_JQUERY_CDN_EXPLAIN' => 'If this setting is enabled, jQuery will be served from Google’s AJAX API CDN instead of the copy included with phpBB on your server. If the CDN fails, phpBB will attempt to fallback to the copy included with phpBB.', 'LOAD_USER_ACTIVITY' => 'Show user’s activity', 'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.', 'RECOMPILE_STYLES' => 'Recompile stale style components', @@ -549,13 +551,3 @@ $lang = array_merge($lang, array( 'JAB_USERNAME' => 'Jabber username or JID', 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', )); - -// jQuery settings -$lang = array_merge($lang, array( - 'JQUERY_HOST' => 'Load jQuery from your server or a hosted CDN', - 'JQUERY_HOST_EXPLAIN' => 'Load jQuery from the copy included with phpBB on your local server, or choose a remote copy hosted on a CDN (Content Delivery Network). If the CDN fails, phpBB will fall back to the copy included with phpBB.', - 'JQUERY_HOST_LOCAL' => 'Included with phpBB on my server', - 'JQUERY_HOST_GOOGLE' => 'Hosted CDN: Google AJAX API', - 'JQUERY_HOST_JQUERY' => 'Hosted CDN: jQuery', - 'JQUERY_HOST_MS' => 'Hosted CDN: Microsoft', -)); From b197ea56c23188f4fd160c736c2d1840e987180a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 27 Sep 2011 22:32:20 +0200 Subject: [PATCH 034/325] [ticket/10394] Use call_user_func_array to pass a ref into a dynamic function PHPBB3-10394 --- tests/utf/normalizer_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php index f8f2467082..1dc69e283e 100644 --- a/tests/utf/normalizer_test.php +++ b/tests/utf/normalizer_test.php @@ -102,7 +102,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case foreach ($tests as $test) { $utf_result = $utf_expected; - call_user_func(array('utf_normalizer', $form), $utf_result); + call_user_func_array(array('utf_normalizer', $form), array(&$utf_result)); $hex_result = $this->utf_to_hexseq($utf_result); $this->assertEquals($utf_expected, $utf_result, "$expected == $form($test) ($hex_expected != $hex_result)"); @@ -154,7 +154,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form) { $utf_result = $utf_expected; - call_user_func(array('utf_normalizer', $form), $utf_result); + call_user_func_array(array('utf_normalizer', $form), array(&$utf_result)); $hex_result = $this->utf_to_hexseq($utf_result); $this->assertEquals($utf_expected, $utf_result, "$hex_expected == $form($hex_tested) ($hex_expected != $hex_result)"); From 9bea7c327846c7281dd5d1f78322ac0016c4dfc9 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 27 Sep 2011 20:15:41 -0700 Subject: [PATCH 035/325] [ticket/10390] Fix wording: fallback should be fall back PHPBB3-10390 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 07102d4db3..7ead6c6628 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -357,7 +357,7 @@ $lang = array_merge($lang, array( 'LOAD_CPF_VIEWPROFILE' => 'Display custom profile fields in user profiles', 'LOAD_CPF_VIEWTOPIC' => 'Display custom profile fields on topic pages', 'LOAD_JQUERY_CDN' => 'Serve jQuery using Google’s CDN', - 'LOAD_JQUERY_CDN_EXPLAIN' => 'If this setting is enabled, jQuery will be served from Google’s AJAX API CDN instead of the copy included with phpBB on your server. If the CDN fails, phpBB will attempt to fallback to the copy included with phpBB.', + 'LOAD_JQUERY_CDN_EXPLAIN' => 'If this setting is enabled, jQuery will be served from Google’s AJAX API CDN instead of the copy included with phpBB on your server. If the CDN fails, phpBB will attempt to fall back to the copy included with phpBB.', 'LOAD_USER_ACTIVITY' => 'Show user’s activity', 'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.', 'RECOMPILE_STYLES' => 'Recompile stale style components', From 26e84b12e817dd5e86a82c379a03a67f9f1bacd1 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Wed, 28 Sep 2011 01:52:08 -0500 Subject: [PATCH 036/325] [ticket/10349] Use new schema comment function in installer This is what now runs in the unit tests. The COMMENTS field in the dbms data is no longer needed, so it has been removed. PHPBB3-10349 --- phpBB/includes/functions_admin.php | 35 ---------------------------- phpBB/includes/functions_install.php | 20 +++++++--------- phpBB/install/install_install.php | 6 ++--- 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f7e19f3e7d..0c83674054 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2293,41 +2293,6 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr return; } -/** -* remove_comments will strip the sql comment lines out of an uploaded sql file -* specifically for mssql and postgres type files in the install.... -*/ -function remove_comments(&$output) -{ - $lines = explode("\n", $output); - $output = ''; - - // try to keep mem. use down - $linecount = sizeof($lines); - - $in_comment = false; - for ($i = 0; $i < $linecount; $i++) - { - if (trim($lines[$i]) == '/*') - { - $in_comment = true; - } - - if (!$in_comment) - { - $output .= $lines[$i] . "\n"; - } - - if (trim($lines[$i]) == '*/') - { - $in_comment = false; - } - } - - unset($lines); - return $output; -} - /** * Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username * and group names must be carried through for the moderators table diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 992e8d6bb0..270fa0f0b3 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -50,7 +50,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'firebird', 'MODULE' => 'interbase', 'DELIM' => ';;', - 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'firebird', 'AVAILABLE' => true, '2.0.x' => false, @@ -60,7 +59,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mysql_41', 'MODULE' => 'mysqli', 'DELIM' => ';', - 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysqli', 'AVAILABLE' => true, '2.0.x' => true, @@ -70,7 +68,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mysql', 'MODULE' => 'mysql', 'DELIM' => ';', - 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysql', 'AVAILABLE' => true, '2.0.x' => true, @@ -80,7 +77,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'mssql', 'DELIM' => 'GO', - 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql', 'AVAILABLE' => true, '2.0.x' => true, @@ -90,7 +86,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'odbc', 'DELIM' => 'GO', - 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql_odbc', 'AVAILABLE' => true, '2.0.x' => true, @@ -100,7 +95,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'sqlsrv', 'DELIM' => 'GO', - 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssqlnative', 'AVAILABLE' => true, '2.0.x' => false, @@ -110,7 +104,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'oracle', 'MODULE' => 'oci8', 'DELIM' => '/', - 'COMMENTS' => 'remove_comments', 'DRIVER' => 'oracle', 'AVAILABLE' => true, '2.0.x' => false, @@ -120,7 +113,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'postgres', 'MODULE' => 'pgsql', 'DELIM' => ';', - 'COMMENTS' => 'remove_comments', 'DRIVER' => 'postgres', 'AVAILABLE' => true, '2.0.x' => true, @@ -130,7 +122,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'sqlite', 'MODULE' => 'sqlite', 'DELIM' => ';', - 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'sqlite', 'AVAILABLE' => true, '2.0.x' => false, @@ -514,11 +505,18 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, } /** -* remove_remarks will strip the sql comment lines out of an uploaded sql file +* Removes comments from schema files +* */ -function remove_remarks(&$sql) +function remove_comments($sql) { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql); + + // Remove # style comments $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql)); + + return $sql; } /** diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 9fe0c8aed5..9b37ee2be3 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1173,14 +1173,13 @@ class install_install extends module $dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql'; // How should we treat this schema? - $remove_remarks = $available_dbms[$data['dbms']]['COMMENTS']; $delimiter = $available_dbms[$data['dbms']]['DELIM']; $sql_query = @file_get_contents($dbms_schema); $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); - $remove_remarks($sql_query); + $sql_query = remove_comments($sql_query); $sql_query = split_sql_file($sql_query, $delimiter); @@ -1218,8 +1217,7 @@ class install_install extends module // Change language strings... $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query); - // Since there is only one schema file we know the comment style and are able to remove it directly with remove_remarks - remove_remarks($sql_query); + $sql_query = remove_comments($sql_query); $sql_query = split_sql_file($sql_query, ';'); foreach ($sql_query as $sql) From b4dcd4193e7ea52753eb3957bb247b768dc48d12 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Wed, 28 Sep 2011 11:27:39 -0500 Subject: [PATCH 037/325] [ticket/10349] Update function comment PHPBB3-10349 --- tests/test_framework/phpbb_database_test_connection_manager.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 547361b41d..5feab16496 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -275,8 +275,6 @@ class phpbb_database_test_connection_manager /** * Removes comments from schema files - * - * Note: This performs the functions of remove_remarks() and remove_comments() used during installation */ protected function remove_comments($sql) { From 14f1e581faa3b66e7689c55c1e9c0485c0872b1e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 9 Jun 2011 05:13:26 +0200 Subject: [PATCH 038/325] [feature/extension-manager] Extension Manager & Finder Extensions RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41499 Ticket: http://tracker.phpbb.com/browse/PHPBB3-10323 PHPBB3-10323 --- phpBB/common.php | 2 +- phpBB/develop/create_schema_files.php | 11 + phpBB/download/file.php | 2 +- phpBB/includes/class_loader.php | 28 +- phpBB/includes/constants.php | 1 + phpBB/includes/extension/base.php | 35 ++ phpBB/includes/extension/finder.php | 246 ++++++++++++++ phpBB/includes/extension/interface.php | 27 ++ phpBB/includes/extension/manager.php | 301 ++++++++++++++++++ phpBB/install/database_update.php | 18 +- phpBB/install/index.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 9 + phpBB/install/schemas/mssql_schema.sql | 16 + phpBB/install/schemas/mysql_40_schema.sql | 9 + phpBB/install/schemas/mysql_41_schema.sql | 9 + phpBB/install/schemas/oracle_schema.sql | 13 + phpBB/install/schemas/postgres_schema.sql | 11 + phpBB/install/schemas/sqlite_schema.sql | 9 + tests/bootstrap.php | 2 +- tests/class_loader/class_loader_test.php | 9 +- tests/class_loader/ext/foo/class.php | 6 + tests/extension/ext/bar/my/hidden_class.php | 5 + tests/extension/ext/foo/a_class.php | 5 + tests/extension/ext/foo/b_class.php | 5 + tests/extension/ext/foo/foo.php | 5 + .../ext/foo/sub/type/alternative.php | 5 + tests/extension/ext/foo/type/alternative.php | 5 + tests/extension/ext/foo/typewrong/error.php | 5 + tests/extension/ext/moo/feature_class.php | 5 + tests/extension/finder_test.php | 133 ++++++++ tests/extension/fixtures/extensions.xml | 15 + .../includes/default/implementation.php | 5 + tests/extension/manager_test.php | 89 ++++++ tests/mock/extension_manager.php | 16 + 34 files changed, 1049 insertions(+), 15 deletions(-) create mode 100644 phpBB/includes/extension/base.php create mode 100644 phpBB/includes/extension/finder.php create mode 100644 phpBB/includes/extension/interface.php create mode 100644 phpBB/includes/extension/manager.php create mode 100644 tests/class_loader/ext/foo/class.php create mode 100644 tests/extension/ext/bar/my/hidden_class.php create mode 100644 tests/extension/ext/foo/a_class.php create mode 100644 tests/extension/ext/foo/b_class.php create mode 100644 tests/extension/ext/foo/foo.php create mode 100644 tests/extension/ext/foo/sub/type/alternative.php create mode 100644 tests/extension/ext/foo/type/alternative.php create mode 100644 tests/extension/ext/foo/typewrong/error.php create mode 100644 tests/extension/ext/moo/feature_class.php create mode 100644 tests/extension/finder_test.php create mode 100644 tests/extension/fixtures/extensions.xml create mode 100644 tests/extension/includes/default/implementation.php create mode 100644 tests/extension/manager_test.php create mode 100644 tests/mock/extension_manager.php diff --git a/phpBB/common.php b/phpBB/common.php index 524c05ae70..7ff06e68d7 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -96,7 +96,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); $class_loader->register(); // set up caching diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 2057d292b7..9f2015f38e 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1031,6 +1031,17 @@ function get_schema_struct() ), ); + $schema_data['phpbb_ext'] = array( + 'COLUMNS' => array( + 'ext_name' => array('VCHAR', ''), + 'ext_active' => array('BOOL', 0), + ), + 'KEYS' => array( + 'ext_name' => array('UNIQUE', 'ext_name'), + 'ext_active' => array('INDEX', 'ext_active'), + ), + ); + $schema_data['phpbb_extensions'] = array( 'COLUMNS' => array( 'extension_id' => array('UINT', NULL, 'auto_increment'), diff --git a/phpBB/download/file.php b/phpBB/download/file.php index ec15d36e08..956af75c81 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -46,7 +46,7 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); + $class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); $class_loader->register(); // set up caching diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index a28d745983..bcf1ba1650 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -31,22 +31,25 @@ if (!defined('IN_PHPBB')) */ class phpbb_class_loader { - private $phpbb_root_path; + private $core_path; + private $ext_path; private $php_ext; private $cache; private $cached_paths = array(); /** * Creates a new phpbb_class_loader, which loads files with the given - * file extension from the given phpbb root path. + * file extension from the given core or extension path. * - * @param string $phpbb_root_path phpBB's root directory containing includes/ - * @param string $php_ext The file extension for PHP files + * @param string $core_path phpBB's include directory for core files + * @param string $ext_path phpBB's extension directory + * @param string $php_ext The file extension for PHP files * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) + public function __construct($core_path, $ext_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) { - $this->phpbb_root_path = $phpbb_root_path; + $this->core_path = $core_path; + $this->ext_path = $ext_path; $this->php_ext = $php_ext; $this->set_cache($cache); @@ -100,7 +103,16 @@ class phpbb_class_loader */ public function resolve_path($class) { - $path_prefix = $this->phpbb_root_path . 'includes/'; + if (substr($class, 6, 4) === 'ext_') + { + $path_prefix = $this->ext_path; + $prefix_length = 10; + } + else + { + $path_prefix = $this->core_path; + $prefix_length = 6; + } if (isset($this->cached_paths[$class])) { @@ -112,7 +124,7 @@ class phpbb_class_loader return false; } - $parts = explode('_', substr($class, 6)); + $parts = explode('_', substr($class, $prefix_length)); $dirs = ''; diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 8ef1a4655d..d5b398b7bf 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -226,6 +226,7 @@ define('CONFIG_TABLE', $table_prefix . 'config'); define('CONFIRM_TABLE', $table_prefix . 'confirm'); define('DISALLOW_TABLE', $table_prefix . 'disallow'); define('DRAFTS_TABLE', $table_prefix . 'drafts'); +define('EXT_TABLE', $table_prefix . 'ext'); define('EXTENSIONS_TABLE', $table_prefix . 'extensions'); define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups'); define('FORUMS_TABLE', $table_prefix . 'forums'); diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php new file mode 100644 index 0000000000..0e6c89491d --- /dev/null +++ b/phpBB/includes/extension/base.php @@ -0,0 +1,35 @@ +extension_manager = $extension_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->cache = $cache; + $this->phpEx = $phpEx; + + $this->query = array( + 'default_path' => false, + 'default_suffix' => false, + 'default_directory' => false, + 'suffix' => false, + 'directory' => false, + ); + + $this->cached_queries = ($this->cache) ? $this->cache->get('_extension_finder') : false; + } + + /** + * Sets a default path to be searched in addition to extensions + * + * @param string $default_path The path relative to / + * @return phpbb_extension_finder This object for chaining calls + */ + public function default_path($default_path) + { + $this->query['default_path'] = $default_path; + return $this; + } + + /** + * Sets a suffix all files found in extensions must match + * + * Automatically sets the default_suffix if its value does not differ from + * the current suffix. + * + * @param string $default_path A filename suffix + * @return phpbb_extension_finder This object for chaining calls + */ + public function suffix($suffix) + { + if ($this->query['default_suffix'] === $this->query['suffix']) + { + $this->query['default_suffix'] = $suffix; + } + + $this->query['suffix'] = $suffix; + return $this; + } + + /** + * Sets a suffix all files found in the default path must match + * + * @param string $default_suffix A filename suffix + * @return phpbb_extension_finder This object for chaining calls + */ + public function default_suffix($default_suffix) + { + $this->query['default_suffix'] = $default_suffix; + return $this; + } + + /** + * Sets a directory all files found in extensions must be contained in + * + * Automatically sets the default_directory if its value does not differ from + * the current directory. + * + * @param string $directory + * @return phpbb_extension_finder This object for chaining calls + */ + public function directory($directory) + { + if (strlen($directory) > 1 && $directory[strlen($directory) - 1] === '/') + { + $directory = substr($directory, 0, -1); + } + + if ($this->query['default_directory'] === $this->query['directory']) + { + $this->query['default_directory'] = $directory; + } + + $this->query['directory'] = $directory; + return $this; + } + + /** + * Sets a directory all files found in the default path must be contained in + * + * @param string $default_directory + * @return phpbb_extension_finder This object for chaining calls + */ + public function default_directory($default_directory) + { + if (strlen($default_directory) > 1 && $default_directory[strlen($default_directory) - 1] === '/') + { + $default_directory = substr($default_directory, 0, -1); + } + + $this->query['default_directory'] = $default_directory; + return $this; + } + + /** + * Finds auto loadable php classes matching the configured options. + * + * The php file extension is automatically added to suffixes. + * + * @param bool $cache Whether the result should be cached + * @return array An array of found class names + */ + public function get_classes($cache = true) + { + $this->query['suffix'] .= $this->phpEx; + $this->query['default_suffix'] .= $this->phpEx; + + $files = $this->get_files($cache); + + $classes = array(); + foreach ($files as $file) + { + $file = preg_replace('#^includes/#', '', $file); + + $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen($this->phpEx))); + } + return $classes; + } + + /** + * Finds all files matching the configured options. + * + * @param bool $cache Whether the result should be cached + * @return array An array of found class names + */ + public function get_files($cache = true) + { + $query = md5(serialize($this->query)); + + if ($cache && isset($this->cached_queries[$query])) + { + return $this->cached_queries[$query]; + } + + $files = array(); + + $extensions = $this->extension_manager->all_enabled(); + + if ($this->query['default_path']) + { + $extensions['/'] = $this->phpbb_root_path . $this->query['default_path']; + } + + foreach ($extensions as $name => $path) + { + if (!file_exists($path)) + { + continue; + } + + if ($name === '/') + { + $prefix = $this->query['default_path']; + $name = ''; + $suffix = $this->query['default_suffix']; + $directory = $this->query['default_directory']; + } + else + { + $prefix = 'ext/'; + $name .= '/'; + $suffix = $this->query['suffix']; + $directory = $this->query['directory']; + } + + // match only first directory if leading slash is given + $directory_pattern = ($directory && $directory[0] === '/') ? '#^' : '#' . DIRECTORY_SEPARATOR; + $directory_pattern .= preg_quote($directory . DIRECTORY_SEPARATOR, '#') . '#'; + + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + foreach ($iterator as $file_info) + { + if (!$file_info->isDir()) + { + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + + if ((!$suffix || substr($relative_path, -strlen($suffix)) == $suffix) && + (!$directory || preg_match($directory_pattern, DIRECTORY_SEPARATOR . $relative_path))) + { + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $prefix . $name . $relative_path); + } + } + } + } + + if ($cache && $this->cache) + { + $this->cached_queries[$query] = $files; + $this->cache->put('_extension_finder', $this->cached_queries); + } + + return $files; + } +} diff --git a/phpBB/includes/extension/interface.php b/phpBB/includes/extension/interface.php new file mode 100644 index 0000000000..40a5a066a3 --- /dev/null +++ b/phpBB/includes/extension/interface.php @@ -0,0 +1,27 @@ +phpbb_root_path = $phpbb_root_path; + $this->db = $db; + $this->cache = $cache; + $this->phpEx = $phpEx; + $this->extension_table = $extension_table; + + if (false === ($this->extensions = $this->cache->get('_extensions'))) + { + $this->load_extensions(); + } + } + + /** + * Loads all extension information from the database + * + * @return null + */ + protected function load_extensions() + { + $sql = 'SELECT * + FROM ' . $this->extension_table; + + $result = $this->db->sql_query($sql); + $extensions = $this->db->sql_fetchrowset($result); + + $this->extensions = array(); + foreach ($extensions as $extension) + { + $extension['ext_path'] = $this->get_extension_path($extension['ext_name']); + $this->extensions[$extension['ext_name']] = $extension; + } + + ksort($this->extensions); + $this->cache->put('_extensions', $this->extensions); + } + + /** + * Generates the path to an extension + * + * @param string $name The name of the extension + * @return string Path to an extension + */ + public function get_extension_path($name) + { + return $this->phpbb_root_path . 'ext/' . basename($name) . '/'; + } + + /** + * Instantiates the extension meta class for the given name. + * + * @param string $name The extension name + * @return phpbb_extension_interface Instance of the extension meta class or + * phpbb_extension_base if the class does not exist + */ + public function get_extension($name) + { + $extension_class_name = 'phpbb_ext_' . $name; + + if (class_exists($extension_class_name)) + { + return new $extension_class_name; + } + else + { + return new phpbb_extension_base; + } + } + + /** + * Enables an extension + * + * Calls the enable method on the extension's meta class to allow it to + * make database changes and execute other initialisation code. + * + * @param string $name The extension's name + * @return null + */ + public function enable($name) + { + // ignore extensions that are already enabled + if (isset($this->extensions[$name]) && $this->extensions[$name]['ext_active']) + { + return; + } + + $extension = $this->get_extension($name); + $extension->enable(); + + $extension_data = array( + 'ext_name' => $name, + 'ext_active' => true, + ); + + $this->extensions[$name] = $extension_data; + $this->extensions[$name]['ext_path'] = $this->get_extension_path($extension_data['ext_name']); + ksort($this->extensions); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + if (!$this->db->sql_affectedrows()) + { + $sql = 'INSERT INTO ' . $this->extension_table . ' + ' . $this->db->sql_build_array('INSERT', $extension_data); + $this->db->sql_query($sql); + } + } + + /** + * Disables an extension + * + * Calls the disable method on the extension's meta class to allow it to + * process the event. + * + * @param string $name The extension's name + * @return null + */ + public function disable($name) + { + // ignore extensions that are already disabled + if (!isset($this->extensions[$name]) || !$this->extensions[$name]['ext_active']) + { + return; + } + + $extension = $this->get_extension($name); + $extension->disable(); + + $extension_data = array( + 'ext_active' => false, + ); + $this->extensions[$name]['ext_active'] = false; + ksort($this->extensions); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + } + + /** + * Purge an extension + * + * Disables the extension first if active, and then calls purge on the + * extension's meta class to delete the extension's database content. + * + * @param string $name The extension's name + * @return null + */ + public function purge($name) + { + // ignore extensions that do not exist + if (!isset($this->extensions[$name])) + { + return; + } + + // disable first if necessary + if ($this->extensions[$name]['ext_active']) + { + $this->disable($name); + } + + $extension = $this->get_extension($name); + $extension->purge(); + + unset($this->extensions[$name]); + + $sql = 'DELETE FROM ' . $this->extension_table . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + } + + /** + * Retrieves a list of all available extensions on the filesystem + * + * @return array An array with extension names as keys and paths to the + * extension as values + */ + public function all_available() + { + $available = array(); + + $iterator = new DirectoryIterator($this->phpbb_root_path . 'ext/'); + foreach ($iterator as $file_info) + { + $path = $this->phpbb_root_path . 'ext/' . $file_info->getBasename() . '/'; + if (!$file_info->isDot() && $file_info->isDir() && file_exists($path)) + { + $available[$file_info->getBasename()] = $path; + } + } + ksort($available); + return $available; + } + + /** + * Retrieves all configured extensions. + * + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_configured() + { + return $this->extensions; + } + + /** + * Retrieves all enabled extensions. + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_enabled() + { + $enabled = array(); + foreach ($this->extensions as $name => $data) + { + if ($data['ext_active']) + { + $enabled[$name] = $data['ext_path']; + } + } + return $enabled; + } + + /** + * Retrieves all disabled extensions. + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_disabled() + { + $disabled = array(); + foreach ($this->extensions as $name => $data) + { + if (!$data['ext_active']) + { + $disabled[$name] = $data['ext_path']; + } + } + return $disabled; + } + + /** + * Instantiates a phpbb_extension_finder. + * + * @return phpbb_extension_finder An extension finder instance + */ + public function get_finder() + { + return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->phpEx); + } +} diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 18741191d8..b2419df3c9 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -104,8 +104,12 @@ if (!defined('LOGIN_ATTEMPT_TABLE')) { define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts'); } +if (!defined('EXT_TABLE')) +{ + define('EXT_TABLE', $table_prefix . 'ext'); +} -$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); $class_loader->register(); // set up caching @@ -1048,6 +1052,18 @@ function database_update_info() // Changes from 3.1.0-dev to 3.1.0-A1 '3.1.0-dev' => array( + 'add_tables' => array( + EXT_TABLE => array( + 'COLUMNS' => array( + 'ext_name' => array('VCHAR', ''), + 'ext_active' => array('BOOL', 0), + ), + 'KEYS' => array( + 'ext_name' => array('UNIQUE', 'ext_name'), + 'ext_active' => array('INDEX', 'ext_active'), + ), + ), + ), 'add_columns' => array( GROUPS_TABLE => array( 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), diff --git a/phpBB/install/index.php b/phpBB/install/index.php index a4ff93e701..fbe8ae63a7 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -82,7 +82,7 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); -$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); $class_loader->register(); // set up caching diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 67e5547bb6..5f5aaaaa45 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -281,6 +281,15 @@ BEGIN END;; +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + ext_active INTEGER DEFAULT 0 NOT NULL +);; + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; +CREATE INDEX phpbb_ext_ext_active ON phpbb_ext(ext_active);; + # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( extension_id INTEGER NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index fe69670ded..052531993f 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -358,6 +358,22 @@ CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] GO +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE [phpbb_ext] ( + [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , + [ext_active] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] +GO + +CREATE INDEX [ext_active] ON [phpbb_ext]([ext_active]) ON [PRIMARY] +GO + + /* Table: 'phpbb_extensions' */ diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index da6ce35be3..03402d7ed1 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -191,6 +191,15 @@ CREATE TABLE phpbb_drafts ( ); +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varbinary(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE ext_name (ext_name), + KEY ext_active (ext_active) +); + + # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index cdbe377178..8876b52a30 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -191,6 +191,15 @@ CREATE TABLE phpbb_drafts ( ) CHARACTER SET `utf8` COLLATE `utf8_bin`; +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + UNIQUE ext_name (ext_name), + KEY ext_active (ext_active) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 8797457e87..df31f6d3d6 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -407,6 +407,19 @@ END; / +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar2(255) DEFAULT '' , + ext_active number(1) DEFAULT '0' NOT NULL, + CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) +) +/ + +CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active) +/ + /* Table: 'phpbb_extensions' */ diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 3c79aacd6b..dbe891a3ac 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -312,6 +312,17 @@ CREATE TABLE phpbb_drafts ( CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); +/* + Table: 'phpbb_ext' +*/ +CREATE TABLE phpbb_ext ( + ext_name varchar(255) DEFAULT '' NOT NULL, + ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0) +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); +CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active); + /* Table: 'phpbb_extensions' */ diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index e0631160fd..3c1d476daa 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -186,6 +186,15 @@ CREATE TABLE phpbb_drafts ( CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); +# Table: 'phpbb_ext' +CREATE TABLE phpbb_ext ( + ext_name varchar(255) NOT NULL DEFAULT '', + ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + +CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); +CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active); + # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( extension_id INTEGER PRIMARY KEY NOT NULL , diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b7c3534cde..fbe23c1835 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -32,7 +32,7 @@ else require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; -$class_loader = new phpbb_class_loader($phpbb_root_path, '.php'); +$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.php'); $class_loader->register(); require_once 'test_framework/phpbb_test_case_helpers.php'; diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 0c7fe3f97a..7d5f57aac3 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -26,7 +26,7 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix); + $class_loader = new phpbb_class_loader($prefix . 'includes/', $prefix . 'ext/'); $prefix .= 'includes/'; @@ -56,6 +56,11 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $class_loader->resolve_path('phpbb_dir2'), 'Class with name of dir within dir (short class name)' ); + $this->assertEquals( + dirname(__FILE__) . '/ext/foo/class.php', + $class_loader->resolve_path('phpbb_ext_foo_class'), + 'Extension class' + ); } public function test_resolve_cached() @@ -64,7 +69,7 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $cache = new phpbb_mock_cache($cacheMap); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix, '.php', $cache); + $class_loader = new phpbb_class_loader($prefix . 'includes/', $prefix . 'ext/', '.php', $cache); $prefix .= 'includes/'; diff --git a/tests/class_loader/ext/foo/class.php b/tests/class_loader/ext/foo/class.php new file mode 100644 index 0000000000..7b1555c98d --- /dev/null +++ b/tests/class_loader/ext/foo/class.php @@ -0,0 +1,6 @@ +extension_manager = new phpbb_mock_extension_manager(array( + 'foo' => array( + 'ext_name' => 'foo', + 'ext_active' => '1', + 'ext_path' => dirname(__FILE__) . '/ext/foo/', + ), + 'bar' => array( + 'ext_name' => 'bar', + 'ext_active' => '1', + 'ext_path' => dirname(__FILE__) . '/ext/bar/', + ), + )); + + $this->finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/'); + } + + public function test_suffix_get_classes() + { + $classes = $this->finder + ->default_path('includes/default/') + ->suffix('_class') + ->default_suffix('') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_default_implementation', + 'phpbb_ext_bar_my_hidden_class', + 'phpbb_ext_foo_a_class', + 'phpbb_ext_foo_b_class', + ), + $classes + ); + } + + public function test_directory_get_classes() + { + $classes = $this->finder + ->default_path('includes/default/') + ->directory('type') + ->default_directory('') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_default_implementation', + 'phpbb_ext_foo_sub_type_alternative', + 'phpbb_ext_foo_type_alternative', + ), + $classes + ); + } + + public function test_absolute_directory_get_classes() + { + $classes = $this->finder + ->directory('/type/') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_ext_foo_type_alternative', + ), + $classes + ); + } + + public function test_sub_directory_get_classes() + { + $classes = $this->finder + ->directory('/sub/type') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_ext_foo_sub_type_alternative', + ), + $classes + ); + } + + public function test_cached_get_files() + { + $query = array( + 'default_path' => 'includes/foo', + 'default_suffix' => false, + 'default_directory' => 'bar', + 'suffix' => false, + 'directory' => false, + ); + + + $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', new phpbb_mock_cache(array( + '_extension_finder' => array( + md5(serialize($query)) => array('file_name'), + ), + ))); + + $classes = $finder + ->default_path($query['default_path']) + ->default_directory($query['default_directory']) + ->get_files(); + + sort($classes); + $this->assertEquals( + array('file_name'), + $classes + ); + } +} diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml new file mode 100644 index 0000000000..f3acdd2575 --- /dev/null +++ b/tests/extension/fixtures/extensions.xml @@ -0,0 +1,15 @@ + + +
    {L_CONFIG}{L_ORDER} {L_ADD}{L_ADD} ({L_MARK_ALL})
    {unapproved.FORUM_NAME}{unapproved.FORUM_NAME}
    [ {L_MODERATE} ]
    {unapproved.TOPIC_TITLE}
    [ {L_MODERATE} ]
    {unapproved.SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {unapproved.ATTACH_ICON_IMG} {unapproved.SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {unapproved.AUTHOR_FULL} {unapproved.POST_TIME}
    {report.FORUM_NAME}{report.FORUM_NAME}
    [ {L_MODERATE} ]
    {report.TOPIC_TITLE}
    [ {L_MODERATE} ]
    {report.SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {report.ATTACH_ICON_IMG} {report.SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {report.REPORTER_FULL} {report.REPORT_TIME}
    {pm_report.PM_SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {pm_report.ATTACH_ICON_IMG} {pm_report.PM_SUBJECT}
    [ {L_VIEW_DETAILS} ]
    {pm_report.PM_AUTHOR_FULL} {pm_report.RECIPIENTS} {pm_report.PM_TIME}

    {postrow.POST_SUBJECT}

    +

    {postrow.ATTACH_ICON_IMG} {postrow.POST_SUBJECT}

    {L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME}
    {postrow.POST_AUTHOR_FULL}
    [ {L_VIEW_DETAILS} ]

    {postrow.PM_SUBJECT}

    +

    {postrow.ATTACH_ICON_IMG} {postrow.PM_SUBJECT}

    {L_PM_FROM}: {postrow.PM_AUTHOR_FULL}
    {postrow.RECIPIENTS}
    {L_SENT_AT}: {postrow.PM_TIME}

    {postrow.POST_SUBJECT}

    +

    {postrow.ATTACH_ICON_IMG} {postrow.POST_SUBJECT}

    {L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME}
    {postrow.POST_AUTHOR_FULL}
    {postrow.POST_TIME}
    + ext_name + ext_active + + foo + 1 + + + moo + 0 + +
    + diff --git a/tests/extension/includes/default/implementation.php b/tests/extension/includes/default/implementation.php new file mode 100644 index 0000000000..91d5f8aa2f --- /dev/null +++ b/tests/extension/includes/default/implementation.php @@ -0,0 +1,5 @@ +createXMLDataSet(dirname(__FILE__) . '/fixtures/extensions.xml'); + } + + protected function setUp() + { + parent::setUp(); + + // disable the regular class loader to replace it with one that loads + // test extensions + global $class_loader; + $class_loader->unregister(); + + $prefix = dirname(__FILE__) . '/'; + $this->class_loader = new phpbb_class_loader($prefix . '../../phpBB/includes/', $prefix . 'ext/'); + $this->class_loader->register(); + + $this->extension_manager = new phpbb_extension_manager( + $this->new_dbal(), + 'phpbb_ext', + $prefix, + '.php', + new phpbb_mock_cache + ); + } + + protected function tearDown() + { + global $class_loader; + $class_loader->register(); + } + + public function test_available() + { + $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_available())); + } + + public function test_enabled() + { + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + } + + public function test_configured() + { + $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); + } + + public function test_enable() + { + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->enable('bar'); + $this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_configured())); + } + + public function test_disable() + { + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->disable('foo'); + $this->assertEquals(array(), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); + } + + public function test_purge() + { + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); + $this->extension_manager->purge('moo'); + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured())); + } +} diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php new file mode 100644 index 0000000000..49d727db37 --- /dev/null +++ b/tests/mock/extension_manager.php @@ -0,0 +1,16 @@ +extensions = $extensions; + } +} From fabde989a2676c762f58e17b06772c9a3ba2f85e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 13 Jul 2011 08:22:27 -0400 Subject: [PATCH 039/325] [feature/extension-manager] Porting cron tasks over to the extension finder PHPBB3-10323 --- phpBB/includes/cron/manager.php | 123 ++++-------------- .../testext/cron}/dummy_task.php | 2 +- .../includes/cron/task/core/dummy_task.php | 23 ++++ .../cron/task/core}/second_dummy_task.php | 2 +- tests/cron/manager_test.php | 43 +++--- .../cron/task/core}/simple_not_runnable.php | 2 +- .../includes/cron/task/core/simple_ready.php | 8 ++ .../cron/task/core}/simple_should_not_run.php | 2 +- tests/cron/task2/testmod/simple_ready.php | 8 -- tests/extension/finder_test.php | 28 ++-- tests/mock/extension_manager.php | 4 +- 11 files changed, 100 insertions(+), 145 deletions(-) rename tests/cron/{task/testmod => ext/testext/cron}/dummy_task.php (80%) create mode 100644 tests/cron/includes/cron/task/core/dummy_task.php rename tests/cron/{task/testmod => includes/cron/task/core}/second_dummy_task.php (78%) rename tests/cron/{task2/testmod => root2/includes/cron/task/core}/simple_not_runnable.php (54%) create mode 100644 tests/cron/root2/includes/cron/task/core/simple_ready.php rename tests/cron/{task2/testmod => root2/includes/cron/task/core}/simple_should_not_run.php (53%) delete mode 100644 tests/cron/task2/testmod/simple_ready.php diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 31be1a69cb..ae48e233e0 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -33,126 +33,53 @@ class phpbb_cron_manager protected $tasks = array(); /** - * Path to the root of directory tree with tasks. - * For bundled phpBB tasks, this is the path to includes/cron/tasks - * under phpBB root. - * @var string + * An extension manager to search for cron tasks in extensions. + * @var phpbb_extension_manager */ - protected $task_path; - - /** - * PHP file extension - * @var string - */ - protected $phpEx; - - /** - * Cache driver - * @var phpbb_cache_driver_interface - */ - protected $cache; + protected $extension_manager; /** * Constructor. Loads all available tasks. * - * Tasks will be looked up in directory tree rooted at $task_path. - * Task classes will be autoloaded and must be named according to - * autoloading naming conventions. To load cron tasks shipped with - * phpbb, pass $phpbb_root_path . 'includes/cron/task' as $task_path. + * Tasks will be looked up in the core task directory located in + * includes/cron/task/core/ and in extensions. Task classes will be + * autoloaded and must be named according to autoloading naming conventions. * - * If $cache is given, names of found cron tasks will be cached in it - * for one hour. Note that the cron task names are stored without - * namespacing; if two different phbb_cron_manager instances are - * constructed with different $task_path arguments but the same $cache, - * the second instance will use task names found by the first instance. + * Tasks in extensions must be located in a directory called cron or a subdir + * of a directory called cron. The class and filename must end in a _task + * suffix. * - * @param string $task_path Directory containing cron tasks - * @param string $phpEx PHP file extension - * @param phpbb_cache_driver_interface $cache Cache for task names (optional) - * @return void + * @param phpbb_extension_manager $extension_manager phpBB extension manager */ - public function __construct($task_path, $phpEx, phpbb_cache_driver_interface $cache = null) + public function __construct(phpbb_extension_manager $extension_manager) { - if (DIRECTORY_SEPARATOR != '/') - { - // Need this on some platforms since the code elsewhere uses / - // to separate directory components, but PHP iterators return - // paths with platform-specific directory separators. - $task_path = str_replace('/', DIRECTORY_SEPARATOR, $task_path); - } - - $this->task_path = $task_path; - $this->phpEx = $phpEx; - $this->cache = $cache; + $this->extension_manager = $extension_manager; $task_names = $this->find_cron_task_names(); $this->load_tasks($task_names); } /** - * Finds cron task names. + * Finds cron task names using the extension manager. * - * A cron task file must follow the naming convention: - * includes/cron/task/$mod/$name.php. - * $mod is core for tasks that are part of phpbb. - * Modifications should use their name as $mod. - * $name is the name of the cron task. - * Cron task is expected to be a class named phpbb_cron_task_${mod}_${name}. + * All PHP files in includes/cron/task/core/ are considered tasks. Tasks + * in extensions have to be located in a directory called cron or a subdir + * of a directory called cron. The class and filename must end in a _task + * suffix. * * @return array List of task names */ public function find_cron_task_names() { - if ($this->cache) - { - $task_names = $this->cache->get('_cron_tasks'); + $finder = $this->extension_manager->get_finder(); - if ($task_names !== false) - { - return $task_names; - } - } - - $task_names = array(); - $ext = '.' . $this->phpEx; - $ext_length = strlen($ext); - - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->task_path)); - - foreach ($iterator as $fileinfo) - { - $file = preg_replace('#^' . preg_quote($this->task_path, '#') . '#', '', $fileinfo->getPathname()); - - // skip directories and files direclty in the task root path - if ($fileinfo->isFile() && strpos($file, DIRECTORY_SEPARATOR) !== false) - { - $task_name = str_replace(DIRECTORY_SEPARATOR, '_', substr($file, 0, -$ext_length)); - if (substr($file, -$ext_length) == $ext && $this->is_valid_name($task_name)) - { - $task_names[] = 'phpbb_cron_task_' . $task_name; - } - } - } - - if ($this->cache) - { - $this->cache->put('_cron_tasks', $task_names, 3600); - } - - return $task_names; - } - - /** - * Checks whether $name is a valid identifier, and - * therefore part of valid cron task class name. - * - * @param string $name Name to check - * - * @return bool - */ - public function is_valid_name($name) - { - return (bool) preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $name); + return $finder + ->suffix('_task') + ->directory('/cron') + ->default_path('includes/cron/task/core/') + ->default_suffix('') + ->default_directory('') + ->get_classes(); } /** diff --git a/tests/cron/task/testmod/dummy_task.php b/tests/cron/ext/testext/cron/dummy_task.php similarity index 80% rename from tests/cron/task/testmod/dummy_task.php rename to tests/cron/ext/testext/cron/dummy_task.php index 5941157589..06546ada05 100644 --- a/tests/cron/task/testmod/dummy_task.php +++ b/tests/cron/ext/testext/cron/dummy_task.php @@ -7,7 +7,7 @@ * */ -class phpbb_cron_task_testmod_dummy_task extends phpbb_cron_task_base +class phpbb_ext_testext_cron_dummy_task extends phpbb_cron_task_base { public static $was_run = 0; diff --git a/tests/cron/includes/cron/task/core/dummy_task.php b/tests/cron/includes/cron/task/core/dummy_task.php new file mode 100644 index 0000000000..ddaf6a9b7c --- /dev/null +++ b/tests/cron/includes/cron/task/core/dummy_task.php @@ -0,0 +1,23 @@ +manager = new phpbb_cron_manager(dirname(__FILE__) . '/task/', 'php'); - $this->task_name = 'phpbb_cron_task_testmod_dummy_task'; + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'testext' => array( + 'ext_name' => 'testext', + 'ext_active' => true, + 'ext_path' => dirname(__FILE__) . '/ext/testext/' + ), + )); + $this->manager = new phpbb_cron_manager($this->extension_manager); + $this->task_name = 'phpbb_cron_task_core_dummy_task'; } public function test_manager_finds_shipped_tasks() { $tasks = $this->manager->find_cron_task_names(); - $this->assertEquals(2, sizeof($tasks)); + $this->assertEquals(3, sizeof($tasks)); } public function test_manager_finds_shipped_task_by_name() @@ -45,7 +55,7 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase public function test_manager_finds_all_ready_tasks() { $tasks = $this->manager->find_all_ready_tasks(); - $this->assertEquals(2, sizeof($tasks)); + $this->assertEquals(3, sizeof($tasks)); } public function test_manager_finds_one_ready_task() @@ -54,21 +64,12 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase $this->assertInstanceOf('phpbb_cron_task_wrapper', $task); } - public function test_manager_finds_all_ready_tasks_cached() - { - $cache = new phpbb_mock_cache(array('_cron_tasks' => array($this->task_name))); - $manager = new phpbb_cron_manager(dirname(__FILE__) . '/../../phpBB/', 'php', $cache); - - $tasks = $manager->find_all_ready_tasks(); - $this->assertEquals(1, sizeof($tasks)); - } - public function test_manager_finds_only_ready_tasks() { - $manager = new phpbb_cron_manager(dirname(__FILE__) . '/task2/', 'php'); + $manager = new phpbb_cron_manager(new phpbb_mock_extension_manager(dirname(__FILE__) . '/root2/')); $tasks = $manager->find_all_ready_tasks(); $task_names = $this->tasks_to_names($tasks); - $this->assertEquals(array('phpbb_cron_task_testmod_simple_ready'), $task_names); + $this->assertEquals(array('phpbb_cron_task_core_simple_ready'), $task_names); } private function tasks_to_names($tasks) diff --git a/tests/cron/task2/testmod/simple_not_runnable.php b/tests/cron/root2/includes/cron/task/core/simple_not_runnable.php similarity index 54% rename from tests/cron/task2/testmod/simple_not_runnable.php rename to tests/cron/root2/includes/cron/task/core/simple_not_runnable.php index 54869fa1cc..837f28f1c0 100644 --- a/tests/cron/task2/testmod/simple_not_runnable.php +++ b/tests/cron/root2/includes/cron/task/core/simple_not_runnable.php @@ -1,6 +1,6 @@ extension_manager = new phpbb_mock_extension_manager(array( - 'foo' => array( - 'ext_name' => 'foo', - 'ext_active' => '1', - 'ext_path' => dirname(__FILE__) . '/ext/foo/', - ), - 'bar' => array( - 'ext_name' => 'bar', - 'ext_active' => '1', - 'ext_path' => dirname(__FILE__) . '/ext/bar/', - ), - )); + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'foo' => array( + 'ext_name' => 'foo', + 'ext_active' => '1', + 'ext_path' => dirname(__FILE__) . '/ext/foo/', + ), + 'bar' => array( + 'ext_name' => 'bar', + 'ext_active' => '1', + 'ext_path' => dirname(__FILE__) . '/ext/bar/', + ), + )); - $this->finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/'); + $this->finder = $this->extension_manager->get_finder(); } public function test_suffix_get_classes() diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 49d727db37..5155716181 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -9,8 +9,10 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager { - public function __construct($extensions = array()) + public function __construct($phpbb_root_path, $extensions = array()) { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = '.php'; $this->extensions = $extensions; } } From fb943d4d6b39cea9825aab78e397eefe26cf7bdf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 19:34:30 -0400 Subject: [PATCH 040/325] [feature/extension-manager] Load the extension manager on all pages PHPBB3-10323 --- phpBB/common.php | 5 ++++- phpBB/download/file.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/common.php b/phpBB/common.php index 7ff06e68d7..cc33b29a09 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -124,6 +124,9 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); set_config(null, null, null, $config); set_config_count(null, null, null, $config); +// load extensions +$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + $template_locator = new phpbb_template_locator(); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator); @@ -138,5 +141,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver()); + $cron = new phpbb_cron_manager($phpbb_extension_manager, $cache->get_driver()); } diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 956af75c81..e13524f922 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -73,6 +73,9 @@ if (isset($_GET['avatar'])) set_config(null, null, null, $config); set_config_count(null, null, null, $config); + // load extensions + $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + $filename = request_var('avatar', ''); $avatar_group = false; $exit = false; From dcc5ca53778184f0719b9ac0c221688ad03bd57e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:00:47 -0400 Subject: [PATCH 041/325] [feature/extension-manager] Make search backends loadable from extensions Search backends are now required to be autoloadable. The database updater to 3.1 tries to guess the class name as phpbb_search_ which works for the default backends we ship. PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 29 +++++++++++-------- phpBB/includes/functions_posting.php | 9 ++---- .../includes/search/{search.php => base.php} | 4 +-- phpBB/includes/search/fulltext_mysql.php | 14 ++++----- phpBB/includes/search/fulltext_native.php | 17 +++++------ phpBB/install/database_update.php | 4 +++ phpBB/install/schemas/schema_data.sql | 2 +- phpBB/search.php | 11 +++---- 8 files changed, 44 insertions(+), 46 deletions(-) rename phpBB/includes/search/{search.php => base.php} (99%) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a3061ae2da..a6377f6b49 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -77,7 +77,8 @@ class acp_search continue; } - $name = ucfirst(strtolower(str_replace('_', ' ', $type))); + $name = $search->get_name(); + $selected = ($config['search_type'] == $type) ? ' selected="selected"' : ''; $search_options .= ''; @@ -275,7 +276,7 @@ class acp_search { trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); } - $name = ucfirst(strtolower(str_replace('_', ' ', $this->state[0]))); + $name = $this->search->get_name(); $action = &$this->state[1]; @@ -454,7 +455,7 @@ class acp_search continue; } - $name = ucfirst(strtolower(str_replace('_', ' ', $type))); + $name = $search->get_name(); $data = array(); if (method_exists($search, 'index_stats')) @@ -553,8 +554,19 @@ class acp_search function get_search_types() { - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_extension_manager; + $finder = $phpbb_extension_manager->get_finder(); + + return $finder + ->suffix('_backend') + ->directory('/search') + ->default_path('includes/search/') + ->default_suffix('') + ->default_directory('') + ->get_classes(); + +/* $search_types = array(); $dp = @opendir($phpbb_root_path . 'includes/search'); @@ -574,6 +586,7 @@ class acp_search } return $search_types; +*/ } function get_max_post_id() @@ -610,14 +623,6 @@ class acp_search { global $phpbb_root_path, $phpEx, $user; - if (!preg_match('#^\w+$#', $type) || !file_exists("{$phpbb_root_path}includes/search/$type.$phpEx")) - { - $error = $user->lang['NO_SUCH_SEARCH_MODULE']; - return $error; - } - - include_once("{$phpbb_root_path}includes/search/$type.$phpEx"); - if (!class_exists($type)) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4ca76344de..adc285cf6e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2350,16 +2350,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($update_search_index && $data['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised - $search_type = basename($config['search_type']); - - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) - { - trigger_error('NO_SUCH_SEARCH_MODULE'); - } + $search_type = $config['search_type']; if (!class_exists($search_type)) { - include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + trigger_error('NO_SUCH_SEARCH_MODULE'); } $error = false; diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/base.php similarity index 99% rename from phpBB/includes/search/search.php rename to phpBB/includes/search/base.php index 7c34ce9ff6..bb63957aba 100644 --- a/phpBB/includes/search/search.php +++ b/phpBB/includes/search/base.php @@ -24,12 +24,12 @@ define('SEARCH_RESULT_IN_CACHE', 1); define('SEARCH_RESULT_INCOMPLETE', 2); /** -* search_backend +* phpbb_search_base * optional base class for search plugins providing simple caching based on ACM * and functions to retrieve ignore_words and synonyms * @package search */ -class search_backend +class phpbb_search_base { var $ignore_words = array(); var $match_synonym = array(); diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 827205f20d..b9920da624 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -16,17 +16,12 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @ignore -*/ -include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); - /** * fulltext_mysql * Fulltext search for MySQL * @package search */ -class fulltext_mysql extends search_backend +class phpbb_search_fulltext_mysql extends phpbb_search_base { var $stats = array(); var $word_length = array(); @@ -36,7 +31,7 @@ class fulltext_mysql extends search_backend var $pcre_properties = false; var $mbstring_regex = false; - function fulltext_mysql(&$error) + public function __construct(&$error) { global $config; @@ -57,6 +52,11 @@ class fulltext_mysql extends search_backend $error = false; } + function get_name() + { + return 'MySQL Fulltext'; + } + /** * Checks for correct MySQL version and stores min/max word length in the config */ diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index e749e86f68..7c792bba24 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -16,17 +16,12 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @ignore -*/ -include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); - /** * fulltext_native * phpBB's own db driven fulltext search, version 2 * @package search */ -class fulltext_native extends search_backend +class phpbb_search_fulltext_native extends phpbb_search_base { var $stats = array(); var $word_length = array(); @@ -41,10 +36,8 @@ class fulltext_native extends search_backend * Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded. * * @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure. - * - * @access public */ - function fulltext_native(&$error) + public function __construct(&$error) { global $phpbb_root_path, $phpEx, $config; @@ -58,10 +51,14 @@ class fulltext_native extends search_backend include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); } - $error = false; } + function get_name() + { + return 'phpBB Native Fulltext'; + } + /** * This function fills $this->search_query with the cleaned user search query. * diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b2419df3c9..1f3c01ee3e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2106,6 +2106,10 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': + // try to guess the new auto loaded search class name + // works for native and mysql fulltext + set_config('search_type', 'phpbb_search_' . $config['search_type']); + set_config('use_system_cron', 0); $sql = 'UPDATE ' . GROUPS_TABLE . ' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5506922e17..bd7334f9d4 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -223,7 +223,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size' INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'fulltext_native'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'phpbb_search_fulltext_native'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1'); diff --git a/phpBB/search.php b/phpBB/search.php index 1d35dfb062..c6189051a3 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -73,7 +73,7 @@ switch ($search_id) login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); } break; - + // The "new posts" search uses user_lastvisit which is user based, so it should require user to log in. case 'newposts': if ($user->data['user_id'] == ANONYMOUS) @@ -81,7 +81,7 @@ switch ($search_id) login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']); } break; - + default: // There's nothing to do here for now ;) break; @@ -273,15 +273,12 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Select which method we'll use to obtain the post_id or topic_id information - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error); From 956860c21d2285ac325a48d6caf1e4fa45aca922 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:07:35 -0400 Subject: [PATCH 042/325] [feature/extension-manager] Never cache extension finder queries in debug mode During development the detection of files should happen immediately and performance is less of a concern. PHPBB3-10323 --- phpBB/includes/extension/finder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index fb532e52f8..4180b84dd3 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -179,7 +179,7 @@ class phpbb_extension_finder { $query = md5(serialize($this->query)); - if ($cache && isset($this->cached_queries[$query])) + if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) { return $this->cached_queries[$query]; } From 989bd9cde7314024999f5b92fc2ff4572b9ac937 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:55:29 -0400 Subject: [PATCH 043/325] [feature/extension-manager] Skip phpbb_search_base by checking for get_name() PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a6377f6b49..0c34d02ac7 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -623,7 +623,7 @@ class acp_search { global $phpbb_root_path, $phpEx, $user; - if (!class_exists($type)) + if (!class_exists($type) || !method_exists($type, 'get_name')) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; return $error; From 96209e022477d97b581b79cabace4caddd19501b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 21:38:47 -0400 Subject: [PATCH 044/325] [feature/extension-manager] The class loader no longer knows about extensions Instead the class loader is instantiated twice. Once with the phpbb_ prefix and once with the phpbb_ext_ prefix. PHPBB3-10323 --- phpBB/common.php | 9 +++-- phpBB/download/file.php | 9 +++-- phpBB/includes/class_loader.php | 47 +++++++++--------------- phpBB/install/database_update.php | 9 +++-- phpBB/install/index.php | 9 +++-- tests/bootstrap.php | 6 ++- tests/class_loader/class_loader_test.php | 46 +++++++++++++++-------- tests/class_loader/ext/foo/class.php | 6 --- tests/extension/manager_test.php | 17 +-------- 9 files changed, 77 insertions(+), 81 deletions(-) delete mode 100644 tests/class_loader/ext/foo/class.php diff --git a/phpBB/common.php b/phpBB/common.php index cc33b29a09..61817972f9 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -96,13 +96,16 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); -$class_loader->register(); +$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(); -$class_loader->set_cache($cache->get_driver()); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); // Instantiate some basic classes $request = new phpbb_request(); diff --git a/phpBB/download/file.php b/phpBB/download/file.php index e13524f922..2a9c472ca7 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -46,13 +46,16 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - $class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); - $class_loader->register(); + $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(); - $class_loader->set_cache($cache->get_driver()); + $phpbb_class_loader_ext->set_cache($cache->get_driver()); + $phpbb_class_loader->set_cache($cache->get_driver()); $request = new phpbb_request(); $db = new $sql_db(); diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index bcf1ba1650..46a271471a 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -31,25 +31,25 @@ if (!defined('IN_PHPBB')) */ class phpbb_class_loader { - private $core_path; - private $ext_path; + private $prefix; + private $path; private $php_ext; private $cache; private $cached_paths = array(); /** * Creates a new phpbb_class_loader, which loads files with the given - * file extension from the given core or extension path. + * file extension from the given path. * - * @param string $core_path phpBB's include directory for core files - * @param string $ext_path phpBB's extension directory - * @param string $php_ext The file extension for PHP files + * @param string $prefix Required class name prefix for files to be loaded + * @param string $path Directory to load files from + * @param string $php_ext The file extension for PHP files * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($core_path, $ext_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) + public function __construct($prefix, $path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) { - $this->core_path = $core_path; - $this->ext_path = $ext_path; + $this->prefix = $prefix; + $this->path = $path; $this->php_ext = $php_ext; $this->set_cache($cache); @@ -66,7 +66,7 @@ class phpbb_class_loader { if ($cache) { - $this->cached_paths = $cache->get('class_loader'); + $this->cached_paths = $cache->get('class_loader_' . $this->prefix); if ($this->cached_paths === false) { @@ -103,32 +103,21 @@ class phpbb_class_loader */ public function resolve_path($class) { - if (substr($class, 6, 4) === 'ext_') - { - $path_prefix = $this->ext_path; - $prefix_length = 10; - } - else - { - $path_prefix = $this->core_path; - $prefix_length = 6; - } - if (isset($this->cached_paths[$class])) { - return $path_prefix . $this->cached_paths[$class] . $this->php_ext; + return $this->path . $this->cached_paths[$class] . $this->php_ext; } - if (!preg_match('/phpbb_[a-zA-Z0-9_]+/', $class)) + if (!preg_match('/^' . $this->prefix . '[a-zA-Z0-9_]+$/', $class)) { return false; } - $parts = explode('_', substr($class, $prefix_length)); + $parts = explode('_', substr($class, strlen($this->prefix))); $dirs = ''; - for ($i = 0, $n = sizeof($parts); $i < $n && is_dir($path_prefix . $dirs . $parts[$i]); $i++) + for ($i = 0, $n = sizeof($parts); $i < $n && is_dir($this->path . $dirs . $parts[$i]); $i++) { $dirs .= $parts[$i] . '/'; } @@ -141,7 +130,7 @@ class phpbb_class_loader $relative_path = $dirs . implode(array_slice($parts, $i, sizeof($parts) - $i), '_'); - if (!file_exists($path_prefix . $relative_path . $this->php_ext)) + if (!file_exists($this->path . $relative_path . $this->php_ext)) { return false; } @@ -149,10 +138,10 @@ class phpbb_class_loader if ($this->cache) { $this->cached_paths[$class] = $relative_path; - $this->cache->put('class_loader', $this->cached_paths); + $this->cache->put('class_loader_' . $this->prefix, $this->cached_paths); } - return $path_prefix . $relative_path . $this->php_ext; + return $this->path . $relative_path . $this->php_ext; } /** @@ -162,7 +151,7 @@ class phpbb_class_loader */ public function load_class($class) { - if (substr($class, 0, 6) === 'phpbb_') + if (substr($class, 0, strlen($this->prefix)) === $this->prefix) { $path = $this->resolve_path($class); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 1f3c01ee3e..64dea37ef8 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -109,13 +109,16 @@ if (!defined('EXT_TABLE')) define('EXT_TABLE', $table_prefix . 'ext'); } -$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); -$class_loader->register(); +$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(); -$class_loader->set_cache($cache->get_driver()); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); $request = new phpbb_request(); $user = new user(); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index fbe8ae63a7..0a46a06664 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -82,13 +82,16 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); -$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.' . $phpEx); -$class_loader->register(); +$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('file'); $cache = $cache_factory->get_service(); -$class_loader->set_cache($cache->get_driver()); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); $request = new phpbb_request(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index fbe23c1835..a85091ce23 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -32,8 +32,10 @@ else require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; -$class_loader = new phpbb_class_loader($phpbb_root_path . 'includes/', $phpbb_root_path . 'ext/', '.php'); -$class_loader->register(); +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".php"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".php"); +$phpbb_class_loader->register(); require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 7d5f57aac3..9744a1c703 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -13,20 +13,26 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase { public function setUp() { - global $class_loader; - $class_loader->unregister(); + global $phpbb_class_loader; + $phpbb_class_loader->unregister(); + + global $phpbb_class_loader_ext; + $phpbb_class_loader_ext->unregister(); } public function tearDown() { - global $class_loader; - $class_loader->register(); + global $phpbb_class_loader_ext; + $phpbb_class_loader_ext->register(); + + global $phpbb_class_loader; + $phpbb_class_loader->register(); } public function test_resolve_path() { $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix . 'includes/', $prefix . 'ext/'); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/'); $prefix .= 'includes/'; @@ -56,20 +62,19 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase $class_loader->resolve_path('phpbb_dir2'), 'Class with name of dir within dir (short class name)' ); - $this->assertEquals( - dirname(__FILE__) . '/ext/foo/class.php', - $class_loader->resolve_path('phpbb_ext_foo_class'), - 'Extension class' - ); } public function test_resolve_cached() { - $cacheMap = array('class_loader' => array('phpbb_a_cached_name' => 'a/cached_name')); - $cache = new phpbb_mock_cache($cacheMap); + $cache_map = array( + 'class_loader_phpbb_' => array('phpbb_a_cached_name' => 'a/cached_name'), + 'class_loader_phpbb_ext_' => array('phpbb_ext_foo' => 'foo'), + ); + $cache = new phpbb_mock_cache($cache_map); $prefix = dirname(__FILE__) . '/'; - $class_loader = new phpbb_class_loader($prefix . 'includes/', $prefix . 'ext/', '.php', $cache); + $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', '.php', $cache); + $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', '.php', $cache); $prefix .= 'includes/'; @@ -79,13 +84,22 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase 'Class in a directory' ); + $this->assertFalse($class_loader->resolve_path('phpbb_ext_foo')); + $this->assertFalse($class_loader_ext->resolve_path('phpbb_a_cached_name')); + $this->assertEquals( $prefix . 'a/cached_name.php', $class_loader->resolve_path('phpbb_a_cached_name'), - 'Class in a directory' + 'Cached class found' ); - $cacheMap['class_loader']['phpbb_dir_class_name'] = 'dir/class_name'; - $cache->check($this, $cacheMap); + $this->assertEquals( + $prefix . 'foo.php', + $class_loader_ext->resolve_path('phpbb_ext_foo'), + 'Cached class found in alternative loader' + ); + + $cache_map['class_loader_phpbb_']['phpbb_dir_class_name'] = 'dir/class_name'; + $cache->check($this, $cache_map); } } diff --git a/tests/class_loader/ext/foo/class.php b/tests/class_loader/ext/foo/class.php deleted file mode 100644 index 7b1555c98d..0000000000 --- a/tests/class_loader/ext/foo/class.php +++ /dev/null @@ -1,6 +0,0 @@ -unregister(); - - $prefix = dirname(__FILE__) . '/'; - $this->class_loader = new phpbb_class_loader($prefix . '../../phpBB/includes/', $prefix . 'ext/'); - $this->class_loader->register(); - $this->extension_manager = new phpbb_extension_manager( $this->new_dbal(), 'phpbb_ext', - $prefix, + dirname(__FILE__) . '/', '.php', new phpbb_mock_cache ); } - protected function tearDown() - { - global $class_loader; - $class_loader->register(); - } - public function test_available() { $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_available())); From 5d5030a48be3d65df85d78e26690085c0889c6e3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 21 Aug 2011 02:57:01 -0400 Subject: [PATCH 045/325] [feature/extension-manager] Remove cron's dependency on the extension manager. Instead a separate cron provider supplies the manager with tasks from the extension finder. PHPBB3-10323 --- phpBB/common.php | 2 +- phpBB/cron.php | 2 +- phpBB/includes/cron/manager.php | 48 +--------- phpBB/includes/cron/provider.php | 92 +++++++++++++++++++ tests/cron/manager_test.php | 33 +++---- tests/cron/provider_test.php | 45 +++++++++ .../core => tasks}/simple_not_runnable.php | 0 .../cron/task/core => tasks}/simple_ready.php | 0 .../core => tasks}/simple_should_not_run.php | 0 9 files changed, 156 insertions(+), 66 deletions(-) create mode 100644 phpBB/includes/cron/provider.php create mode 100644 tests/cron/provider_test.php rename tests/cron/{root2/includes/cron/task/core => tasks}/simple_not_runnable.php (100%) rename tests/cron/{root2/includes/cron/task/core => tasks}/simple_ready.php (100%) rename tests/cron/{root2/includes/cron/task/core => tasks}/simple_should_not_run.php (100%) diff --git a/phpBB/common.php b/phpBB/common.php index 61817972f9..3cc9e57e46 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -144,5 +144,5 @@ foreach ($cache->obtain_hooks() as $hook) if (!$config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_extension_manager, $cache->get_driver()); + $cron = new phpbb_cron_manager(new phpbb_cron_provider($phpbb_extension_manager), $cache->get_driver()); } diff --git a/phpBB/cron.php b/phpBB/cron.php index cc5964218a..6633a6c3fd 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -62,7 +62,7 @@ function do_cron($cron_lock, $run_tasks) if ($config['use_system_cron']) { - $cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver()); + $cron = new phpbb_cron_manager(new phpbb_cron_provider($phpbb_extension_manager), $cache->get_driver()); } else { diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index ae48e233e0..a0bf018b33 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -32,65 +32,25 @@ class phpbb_cron_manager */ protected $tasks = array(); - /** - * An extension manager to search for cron tasks in extensions. - * @var phpbb_extension_manager - */ - protected $extension_manager; - /** * Constructor. Loads all available tasks. * - * Tasks will be looked up in the core task directory located in - * includes/cron/task/core/ and in extensions. Task classes will be - * autoloaded and must be named according to autoloading naming conventions. - * - * Tasks in extensions must be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. - * - * @param phpbb_extension_manager $extension_manager phpBB extension manager + * @param array|Traversable $task_names Provides an iterable set of task names */ - public function __construct(phpbb_extension_manager $extension_manager) + public function __construct($task_names) { - $this->extension_manager = $extension_manager; - - $task_names = $this->find_cron_task_names(); $this->load_tasks($task_names); } - /** - * Finds cron task names using the extension manager. - * - * All PHP files in includes/cron/task/core/ are considered tasks. Tasks - * in extensions have to be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. - * - * @return array List of task names - */ - public function find_cron_task_names() - { - $finder = $this->extension_manager->get_finder(); - - return $finder - ->suffix('_task') - ->directory('/cron') - ->default_path('includes/cron/task/core/') - ->default_suffix('') - ->default_directory('') - ->get_classes(); - } - /** * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array $task_names Array of strings + * @param array|Traversable $task_names Array of strings * * @return void */ - public function load_tasks(array $task_names) + public function load_tasks($task_names) { foreach ($task_names as $task_name) { diff --git a/phpBB/includes/cron/provider.php b/phpBB/includes/cron/provider.php new file mode 100644 index 0000000000..9936da3f55 --- /dev/null +++ b/phpBB/includes/cron/provider.php @@ -0,0 +1,92 @@ +extension_manager = $extension_manager; + + $this->task_names = $this->find_cron_task_names(); + } + + /** + * Finds cron task names using the extension manager. + * + * All PHP files in includes/cron/task/core/ are considered tasks. Tasks + * in extensions have to be located in a directory called cron or a subdir + * of a directory called cron. The class and filename must end in a _task + * suffix. + * + * @return array List of task names + */ + public function find_cron_task_names() + { + $finder = $this->extension_manager->get_finder(); + + return $finder + ->suffix('_task') + ->directory('/cron') + ->default_path('includes/cron/task/core/') + ->default_suffix('') + ->default_directory('') + ->get_classes(); + } + + /** + * Retrieve an iterator over all task names + * + * @return ArrayIterator An iterator for the array of task names + */ + public function getIterator() + { + return new ArrayIterator($this->task_names); + } +} diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index 80f2cd55a8..80c92e234b 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -11,33 +11,22 @@ require_once dirname(__FILE__) . '/../mock/extension_manager.php'; require_once dirname(__FILE__) . '/includes/cron/task/core/dummy_task.php'; require_once dirname(__FILE__) . '/includes/cron/task/core/second_dummy_task.php'; require_once dirname(__FILE__) . '/ext/testext/cron/dummy_task.php'; -require_once dirname(__FILE__) . '/root2/includes/cron/task/core/simple_ready.php'; -require_once dirname(__FILE__) . '/root2/includes/cron/task/core/simple_not_runnable.php'; -require_once dirname(__FILE__) . '/root2/includes/cron/task/core/simple_should_not_run.php'; +require_once dirname(__FILE__) . '/tasks/simple_ready.php'; +require_once dirname(__FILE__) . '/tasks/simple_not_runnable.php'; +require_once dirname(__FILE__) . '/tasks/simple_should_not_run.php'; class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase { public function setUp() { - $this->extension_manager = new phpbb_mock_extension_manager( - dirname(__FILE__) . '/', - array( - 'testext' => array( - 'ext_name' => 'testext', - 'ext_active' => true, - 'ext_path' => dirname(__FILE__) . '/ext/testext/' - ), - )); - $this->manager = new phpbb_cron_manager($this->extension_manager); + $this->manager = new phpbb_cron_manager(array( + 'phpbb_cron_task_core_dummy_task', + 'phpbb_cron_task_core_second_dummy_task', + 'phpbb_ext_testext_cron_dummy_task', + )); $this->task_name = 'phpbb_cron_task_core_dummy_task'; } - public function test_manager_finds_shipped_tasks() - { - $tasks = $this->manager->find_cron_task_names(); - $this->assertEquals(3, sizeof($tasks)); - } - public function test_manager_finds_shipped_task_by_name() { $task = $this->manager->find_task($this->task_name); @@ -66,7 +55,11 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase public function test_manager_finds_only_ready_tasks() { - $manager = new phpbb_cron_manager(new phpbb_mock_extension_manager(dirname(__FILE__) . '/root2/')); + $manager = new phpbb_cron_manager(array( + 'phpbb_cron_task_core_simple_ready', + 'phpbb_cron_task_core_simple_not_runnable', + 'phpbb_cron_task_core_simple_should_not_run', + )); $tasks = $manager->find_all_ready_tasks(); $task_names = $this->tasks_to_names($tasks); $this->assertEquals(array('phpbb_cron_task_core_simple_ready'), $task_names); diff --git a/tests/cron/provider_test.php b/tests/cron/provider_test.php new file mode 100644 index 0000000000..781425e6ab --- /dev/null +++ b/tests/cron/provider_test.php @@ -0,0 +1,45 @@ +extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'testext' => array( + 'ext_name' => 'testext', + 'ext_active' => true, + 'ext_path' => dirname(__FILE__) . '/ext/testext/' + ), + )); + $this->provider = new phpbb_cron_provider($this->extension_manager); + } + + public function test_manager_finds_shipped_tasks() + { + $task_iterator = $this->provider->find_cron_task_names(); + + $tasks = array(); + foreach ($task_iterator as $task) + { + $tasks[] = $task; + } + sort($tasks); + + $this->assertEquals(array( + 'phpbb_cron_task_core_dummy_task', + 'phpbb_cron_task_core_second_dummy_task', + 'phpbb_ext_testext_cron_dummy_task', + ), $tasks); + } +} diff --git a/tests/cron/root2/includes/cron/task/core/simple_not_runnable.php b/tests/cron/tasks/simple_not_runnable.php similarity index 100% rename from tests/cron/root2/includes/cron/task/core/simple_not_runnable.php rename to tests/cron/tasks/simple_not_runnable.php diff --git a/tests/cron/root2/includes/cron/task/core/simple_ready.php b/tests/cron/tasks/simple_ready.php similarity index 100% rename from tests/cron/root2/includes/cron/task/core/simple_ready.php rename to tests/cron/tasks/simple_ready.php diff --git a/tests/cron/root2/includes/cron/task/core/simple_should_not_run.php b/tests/cron/tasks/simple_should_not_run.php similarity index 100% rename from tests/cron/root2/includes/cron/task/core/simple_should_not_run.php rename to tests/cron/tasks/simple_should_not_run.php From c6fd8d9c9bfad943b9ed7d8f5f4407c13b8939d9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 21 Aug 2011 03:02:48 -0400 Subject: [PATCH 046/325] [feature/extension-manager] Add missing newlines at end of files PHPBB3-10323 --- tests/extension/ext/bar/my/hidden_class.php | 2 +- tests/extension/ext/foo/a_class.php | 2 +- tests/extension/ext/foo/b_class.php | 2 +- tests/extension/ext/foo/foo.php | 2 +- tests/extension/ext/foo/type/alternative.php | 2 +- tests/extension/ext/moo/feature_class.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/bar/my/hidden_class.php index b3c910a8c2..0261d7c59a 100644 --- a/tests/extension/ext/bar/my/hidden_class.php +++ b/tests/extension/ext/bar/my/hidden_class.php @@ -2,4 +2,4 @@ class phpbb_ext_bar_my_hidden_class { -} \ No newline at end of file +} diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/foo/a_class.php index 03253139f9..b7be1ad654 100644 --- a/tests/extension/ext/foo/a_class.php +++ b/tests/extension/ext/foo/a_class.php @@ -2,4 +2,4 @@ class phpbb_ext_foo_a_class { -} \ No newline at end of file +} diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/foo/b_class.php index 04644a9d9d..4645266122 100644 --- a/tests/extension/ext/foo/b_class.php +++ b/tests/extension/ext/foo/b_class.php @@ -2,4 +2,4 @@ class phpbb_ext_foo_b_class { -} \ No newline at end of file +} diff --git a/tests/extension/ext/foo/foo.php b/tests/extension/ext/foo/foo.php index 78a8c95f65..bbf01606ce 100644 --- a/tests/extension/ext/foo/foo.php +++ b/tests/extension/ext/foo/foo.php @@ -2,4 +2,4 @@ class phpbb_ext_foo extends phpbb_extension_base { -} \ No newline at end of file +} diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/foo/type/alternative.php index b43a293b1d..404b66b965 100644 --- a/tests/extension/ext/foo/type/alternative.php +++ b/tests/extension/ext/foo/type/alternative.php @@ -2,4 +2,4 @@ class phpbb_ext_foo_type_alternative { -} \ No newline at end of file +} diff --git a/tests/extension/ext/moo/feature_class.php b/tests/extension/ext/moo/feature_class.php index 20ea13054f..bf7ba40d84 100644 --- a/tests/extension/ext/moo/feature_class.php +++ b/tests/extension/ext/moo/feature_class.php @@ -2,4 +2,4 @@ class phpbb_ext_moo_feature_class { -} \ No newline at end of file +} From 60ad0e21b5d4f940740650df69b7134a573f2a97 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 21 Aug 2011 03:06:56 -0400 Subject: [PATCH 047/325] [feature/extension-manager] Remove the ext_active index for lack of specificity PHPBB3-10323 --- phpBB/develop/create_schema_files.php | 1 - phpBB/install/database_update.php | 1 - phpBB/install/schemas/firebird_schema.sql | 1 - phpBB/install/schemas/mssql_schema.sql | 3 --- phpBB/install/schemas/mysql_40_schema.sql | 3 +-- phpBB/install/schemas/mysql_41_schema.sql | 3 +-- phpBB/install/schemas/oracle_schema.sql | 2 -- phpBB/install/schemas/postgres_schema.sql | 1 - phpBB/install/schemas/sqlite_schema.sql | 1 - 9 files changed, 2 insertions(+), 14 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 9f2015f38e..bc1e28572d 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1038,7 +1038,6 @@ function get_schema_struct() ), 'KEYS' => array( 'ext_name' => array('UNIQUE', 'ext_name'), - 'ext_active' => array('INDEX', 'ext_active'), ), ); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 64dea37ef8..45de19c918 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1063,7 +1063,6 @@ function database_update_info() ), 'KEYS' => array( 'ext_name' => array('UNIQUE', 'ext_name'), - 'ext_active' => array('INDEX', 'ext_active'), ), ), ), diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 5f5aaaaa45..4952b6bbdf 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -288,7 +288,6 @@ CREATE TABLE phpbb_ext ( );; CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; -CREATE INDEX phpbb_ext_ext_active ON phpbb_ext(ext_active);; # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 052531993f..76f3fc6491 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -370,9 +370,6 @@ GO CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] GO -CREATE INDEX [ext_active] ON [phpbb_ext]([ext_active]) ON [PRIMARY] -GO - /* Table: 'phpbb_extensions' diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 03402d7ed1..a1b282418d 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -195,8 +195,7 @@ CREATE TABLE phpbb_drafts ( CREATE TABLE phpbb_ext ( ext_name varbinary(255) DEFAULT '' NOT NULL, ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE ext_name (ext_name), - KEY ext_active (ext_active) + UNIQUE ext_name (ext_name) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 8876b52a30..2f2de17dcb 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -195,8 +195,7 @@ CREATE TABLE phpbb_drafts ( CREATE TABLE phpbb_ext ( ext_name varchar(255) DEFAULT '' NOT NULL, ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE ext_name (ext_name), - KEY ext_active (ext_active) + UNIQUE ext_name (ext_name) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index df31f6d3d6..f0a958d2f6 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -417,8 +417,6 @@ CREATE TABLE phpbb_ext ( ) / -CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active) -/ /* Table: 'phpbb_extensions' diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index dbe891a3ac..956167ff39 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -321,7 +321,6 @@ CREATE TABLE phpbb_ext ( ); CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); -CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active); /* Table: 'phpbb_extensions' diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 3c1d476daa..223dbc3c02 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -193,7 +193,6 @@ CREATE TABLE phpbb_ext ( ); CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); -CREATE INDEX phpbb_ext_ext_active ON phpbb_ext (ext_active); # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( From f6632fcfd08650f13560529a6a04c152aefd4e3c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 22 Aug 2011 02:17:00 -0400 Subject: [PATCH 048/325] [feature/extension-manager] Add filename prefix matching in extension finder PHPBB3-10323 --- phpBB/includes/extension/finder.php | 47 ++++++++++++++++++++++++++--- tests/extension/finder_test.php | 20 ++++++++++++ 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 4180b84dd3..fbc8a3aefb 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -50,8 +50,10 @@ class phpbb_extension_finder $this->query = array( 'default_path' => false, 'default_suffix' => false, + 'default_prefix' => false, 'default_directory' => false, 'suffix' => false, + 'prefix' => false, 'directory' => false, ); @@ -76,7 +78,7 @@ class phpbb_extension_finder * Automatically sets the default_suffix if its value does not differ from * the current suffix. * - * @param string $default_path A filename suffix + * @param string $suffix A filename suffix * @return phpbb_extension_finder This object for chaining calls */ public function suffix($suffix) @@ -102,6 +104,38 @@ class phpbb_extension_finder return $this; } + /** + * Sets a prefix all files found in extensions must match + * + * Automatically sets the default_prefix if its value does not differ from + * the current prefix. + * + * @param string $prefix A filename prefix + * @return phpbb_extension_finder This object for chaining calls + */ + public function prefix($prefix) + { + if ($this->query['default_prefix'] === $this->query['prefix']) + { + $this->query['default_prefix'] = $prefix; + } + + $this->query['prefix'] = $prefix; + return $this; + } + + /** + * Sets a prefix all files found in the default path must match + * + * @param string $default_prefix A filename prefix + * @return phpbb_extension_finder This object for chaining calls + */ + public function default_prefix($default_prefix) + { + $this->query['default_prefix'] = $default_prefix; + return $this; + } + /** * Sets a directory all files found in extensions must be contained in * @@ -202,16 +236,18 @@ class phpbb_extension_finder if ($name === '/') { - $prefix = $this->query['default_path']; + $location = $this->query['default_path']; $name = ''; $suffix = $this->query['default_suffix']; + $prefix = $this->query['default_prefix']; $directory = $this->query['default_directory']; } else { - $prefix = 'ext/'; + $location = 'ext/'; $name .= '/'; $suffix = $this->query['suffix']; + $prefix = $this->query['prefix']; $directory = $this->query['directory']; } @@ -226,10 +262,11 @@ class phpbb_extension_finder { $relative_path = $iterator->getInnerIterator()->getSubPathname(); - if ((!$suffix || substr($relative_path, -strlen($suffix)) == $suffix) && + if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && + (!$prefix || substr($file_info->getFilename(), 0, strlen($prefix)) === $prefix) && (!$directory || preg_match($directory_pattern, DIRECTORY_SEPARATOR . $relative_path))) { - $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $prefix . $name . $relative_path); + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . $relative_path); } } } diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index b0c98da554..4acfe53937 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -55,6 +55,24 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_prefix_get_classes() + { + $classes = $this->finder + ->default_path('includes/default/') + ->prefix('hidden_') + ->default_prefix('') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + 'phpbb_default_implementation', + 'phpbb_ext_bar_my_hidden_class', + ), + $classes + ); + } + public function test_directory_get_classes() { $classes = $this->finder @@ -109,8 +127,10 @@ class phpbb_extension_finder_test extends phpbb_test_case $query = array( 'default_path' => 'includes/foo', 'default_suffix' => false, + 'default_prefix' => false, 'default_directory' => 'bar', 'suffix' => false, + 'prefix' => false, 'directory' => false, ); From 4844b007771f71973db2fa440d3c8ef9057d1b02 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 22 Aug 2011 03:19:17 -0400 Subject: [PATCH 049/325] [feature/extension-manager] Load (A/U/M)CP modules from extensions To avoid large bc breaking changes, modules in the old includes directory structure still follow the same naming conventions. Modules in extensions have to be placed in an xcp/ folder and need a _module suffix. The corresponding info file is in the same directory but with an _info suffix. PHPBB3-10323 --- phpBB/includes/acp/acp_modules.php | 87 ++++++++++++++++++----------- phpBB/includes/functions_module.php | 86 ++++++++++++++-------------- 2 files changed, 96 insertions(+), 77 deletions(-) diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 52033b590c..2a533056b4 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -316,7 +316,7 @@ class acp_modules } // Name options - $s_name_options .= ''; + $s_name_options .= ''; $template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option))); @@ -480,7 +480,7 @@ class acp_modules foreach ($module_infos as $option => $values) { // Name options - $s_install_options .= ''; + $s_install_options .= ''; // Build module modes foreach ($values['modes'] as $m_mode => $m_values) @@ -539,57 +539,78 @@ class acp_modules if (!$module) { - $dh = @opendir($directory); + global $phpbb_extension_manager; - if (!$dh) - { - return $fileinfo; - } + $finder = $phpbb_extension_manager->get_finder(); - while (($file = readdir($dh)) !== false) + $modules = $finder + ->suffix('_module') + ->directory("/$module_class") + ->default_path("includes/$module_class/info/") + ->default_suffix('') + ->default_prefix($module_class . '_') + ->default_directory('') + ->get_classes(); + + foreach ($modules as $module) { - // Is module? - if (preg_match('/^' . $module_class . '_.+\.' . $phpEx . '$/', $file)) + // If the class does not exist it might be following the old + // format. phpbb_acp_info_acp_foo needs to be turned into + // acp_foo_info and the respective file has to be included + // manually because it does not support auto loading + if (!class_exists($module)) { - $class = str_replace(".$phpEx", '', $file) . '_info'; - - if (!class_exists($class)) + $info_class = str_replace("phpbb_{$module_class}_info_", '', $module) . '_info'; + if (file_exists($directory . $info_class . '.' . $phpEx)) { - include($directory . $file); - } - - // Get module title tag - if (class_exists($class)) - { - $c_class = new $class(); - $module_info = $c_class->module(); - $fileinfo[str_replace($module_class . '_', '', $module_info['filename'])] = $module_info; + include($directory . $info_class . '.' . $phpEx); } } + else + { + $info_class = preg_replace('/_module$/', '_info', $module); + } + + if (class_exists($info_class)) + { + $info = new $info_class(); + $module_info = $info->module(); + + $main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $module; + + $fileinfo[$main_class] = $module_info; + } } - closedir($dh); ksort($fileinfo); } else { - $filename = $module_class . '_' . basename($module); - $class = $module_class . '_' . basename($module) . '_info'; - - if (!class_exists($class)) + if (!class_exists($module)) { - include($directory . $filename . '.' . $phpEx); + if (file_exists($directory . $module . '.' . $phpEx)) + { + include($directory . $module . '.' . $phpEx); + } + $info_class = $module . '_info'; + } + else + { + $info_class = preg_replace('/_module$/', '_info', $module); } // Get module title tag - if (class_exists($class)) + if (class_exists($info_class)) { - $c_class = new $class(); - $module_info = $c_class->module(); - $fileinfo[str_replace($module_class . '_', '', $module_info['filename'])] = $module_info; + $info = new $info_class(); + $module_info = $info->module(); + + $main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $module; + + $fileinfo[$main_class] = $module_info; } } - + return $fileinfo; } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 09c54422b0..1a6b57794a 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -440,7 +440,8 @@ class p_master trigger_error('Module not accessible', E_USER_ERROR); } - if (!class_exists("{$this->p_class}_$this->p_name")) + // new modules use the full class names, old ones are always called _, e.g. acp_board + if (!class_exists($this->p_name) && !class_exists("{$this->p_class}_$this->p_name")) { if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) { @@ -453,62 +454,59 @@ class p_master { trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); } + } - if (!empty($mode)) + if (!empty($mode)) + { + $this->p_mode = $mode; + } + + // Create a new instance of the desired module ... + $class_name = (class_exists($this->p_name)) ? $this->p_name : "{$this->p_class}_$this->p_name"; + + $this->module = new $class_name($this); + + // We pre-define the action parameter we are using all over the place + if (defined('IN_ADMIN')) + { + // Is first module automatically enabled a duplicate and the category not passed yet? + if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate']) { - $this->p_mode = $mode; + $icat = $this->module_ary[$this->active_module_row_id]['parent']; } - // Create a new instance of the desired module ... if it has a - // constructor it will of course be executed - $instance = "{$this->p_class}_$this->p_name"; - - $this->module = new $instance($this); - - // We pre-define the action parameter we are using all over the place - if (defined('IN_ADMIN')) + // Not being able to overwrite ;) + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } + else + { + // If user specified the module url we will use it... + if ($module_url !== false) { - // Is first module automatically enabled a duplicate and the category not passed yet? - if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate']) - { - $icat = $this->module_ary[$this->active_module_row_id]['parent']; - } - - // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = $module_url; } else { - // If user specified the module url we will use it... - if ($module_url !== false) - { - $this->module->u_action = $module_url; - } - else - { - $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; - } - - $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } - // Add url_extra parameter to u_action url - if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra']) - { - $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra']; - } + $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } - // Assign the module path for re-usage - $this->module->module_path = $module_path . '/'; + // Add url_extra parameter to u_action url + if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra']) + { + $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra']; + } - // Execute the main method for the new instance, we send the module id and mode as parameters - // Users are able to call the main method after this function to be able to assign additional parameters manually - if ($execute_module) - { - $this->module->main($this->p_name, $this->p_mode); - } + // Assign the module path for re-usage + $this->module->module_path = $module_path . '/'; - return; + // Execute the main method for the new instance, we send the module id and mode as parameters + // Users are able to call the main method after this function to be able to assign additional parameters manually + if ($execute_module) + { + $this->module->main($this->p_name, $this->p_mode); } } From ade496e0f7da84fb3035a811930792648a8ac442 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 22 Aug 2011 03:20:59 -0400 Subject: [PATCH 050/325] [feature/extension-manager] Fix whitespace in acp_modules PHPBB3-10323 --- phpBB/includes/acp/acp_modules.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 2a533056b4..367eea8e80 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -111,7 +111,7 @@ class acp_modules } break; - + case 'enable': case 'disable': if (!$module_id) @@ -170,7 +170,7 @@ class acp_modules add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname']), $move_module_name); $this->remove_cache_file(); } - + break; case 'quickadd': @@ -207,7 +207,7 @@ class acp_modules if (!sizeof($errors)) { $this->remove_cache_file(); - + trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } } @@ -231,7 +231,7 @@ class acp_modules { trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - + $module_row = $this->get_module_row($module_id); // no break @@ -250,7 +250,7 @@ class acp_modules 'module_auth' => '', ); } - + $module_data = array(); $module_data['module_basename'] = request_var('module_basename', (string) $module_row['module_basename']); @@ -295,7 +295,7 @@ class acp_modules if (!sizeof($errors)) { $this->remove_cache_file(); - + trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } } @@ -327,7 +327,7 @@ class acp_modules { $s_mode_options .= ''; } - + $template->assign_block_vars('m_names.modes', array( 'OPTION' => $m_mode, 'VALUE' => $this->lang_name($m_values['title']), @@ -336,7 +336,7 @@ class acp_modules ); } } - + $s_cat_option = ''; $template->assign_vars(array_merge(array( @@ -349,7 +349,7 @@ class acp_modules 'U_EDIT_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, 'L_TITLE' => $user->lang[strtoupper($action) . '_MODULE'], - + 'MODULENAME' => $this->lang_name($module_data['module_langname']), 'ACTION' => $action, 'MODULE_ID' => $module_id, @@ -516,7 +516,7 @@ class acp_modules $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + if (!$row) { trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); @@ -524,14 +524,14 @@ class acp_modules return $row; } - + /** * Get available module information from module files */ function get_module_infos($module = '', $module_class = false) { global $phpbb_root_path, $phpEx; - + $module_class = ($module_class === false) ? $this->module_class : $module_class; $directory = $phpbb_root_path . 'includes/' . $module_class . '/info/'; @@ -742,7 +742,7 @@ class acp_modules // Sanitise for future path use, it's escaped as appropriate for queries $p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class)); - + $cache->destroy('_modules_' . $p_class); // Additionally remove sql cache From d5a5cdd0d712ff7997f98659525ab98ee45fbe1f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 22 Aug 2011 03:39:07 -0400 Subject: [PATCH 051/325] [feature/extension-manager] Avoid unecessary loading of acp classes PHPBB3-10323 --- phpBB/includes/acp/acp_modules.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 367eea8e80..a4e140ecfe 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -554,11 +554,13 @@ class acp_modules foreach ($modules as $module) { + $info_class = preg_replace('/_module$/', '_info', $module); + // If the class does not exist it might be following the old // format. phpbb_acp_info_acp_foo needs to be turned into // acp_foo_info and the respective file has to be included // manually because it does not support auto loading - if (!class_exists($module)) + if (!class_exists($info_class)) { $info_class = str_replace("phpbb_{$module_class}_info_", '', $module) . '_info'; if (file_exists($directory . $info_class . '.' . $phpEx)) @@ -566,10 +568,6 @@ class acp_modules include($directory . $info_class . '.' . $phpEx); } } - else - { - $info_class = preg_replace('/_module$/', '_info', $module); - } if (class_exists($info_class)) { @@ -586,7 +584,9 @@ class acp_modules } else { - if (!class_exists($module)) + $info_class = preg_replace('/_module$/', '_info', $module); + + if (!class_exists($info_class)) { if (file_exists($directory . $module . '.' . $phpEx)) { @@ -594,10 +594,6 @@ class acp_modules } $info_class = $module . '_info'; } - else - { - $info_class = preg_replace('/_module$/', '_info', $module); - } // Get module title tag if (class_exists($info_class)) From 61df8a87d19c062f5284f06047c1a9093c664cdf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 22 Aug 2011 03:51:03 -0400 Subject: [PATCH 052/325] [feature/extension-manager] Allow extensions to define captcha plugins. The base class for captcha plugins has been renamed, but the old name continues to exist as an empty subclass of it for backwards compatability. PHPBB3-10323 --- phpBB/includes/acp/acp_captcha.php | 4 +- phpBB/includes/captcha/captcha_factory.php | 45 ++++++++++--------- .../captcha/plugins/captcha_abstract.php | 9 +++- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index bef8ae0ea9..f051781547 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -104,13 +104,13 @@ class acp_captcha foreach ($captchas['available'] as $value => $title) { $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; - $captcha_select .= ''; + $captcha_select .= ''; } foreach ($captchas['unavailable'] as $value => $title) { $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; - $captcha_select .= ''; + $captcha_select .= ''; } $demo_captcha = phpbb_captcha_factory::get_instance($selected); diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index c2ec8c5bda..2779a23d34 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -59,38 +59,39 @@ class phpbb_captcha_factory */ function get_captcha_types() { - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_extension_manager; $captchas = array( 'available' => array(), 'unavailable' => array(), ); - $dp = @opendir($phpbb_root_path . 'includes/captcha/plugins'); + $finder = $phpbb_extension_manager->get_finder(); + $captcha_plugin_classes = $finder + ->directory('/captcha') + ->suffix('_plugin') + ->default_path('includes/captcha/plugins/') + ->default_directory('') + ->get_classes(); - if ($dp) + foreach ($captcha_plugin_classes as $class) { - while (($file = readdir($dp)) !== false) + // check if this class needs to be loaded in legacy mode + $old_class = preg_replace('/^phpbb_captcha_plugins_/', '', $class); + if (file_exists($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx") && !class_exists($old_class)) { - if ((preg_match('#_plugin\.' . $phpEx . '$#', $file))) - { - $name = preg_replace('#^(.*?)_plugin\.' . $phpEx . '$#', '\1', $file); - if (!class_exists($name)) - { - include($phpbb_root_path . "includes/captcha/plugins/$file"); - } - - if (call_user_func(array($name, 'is_available'))) - { - $captchas['available'][$name] = call_user_func(array($name, 'get_name')); - } - else - { - $captchas['unavailable'][$name] = call_user_func(array($name, 'get_name')); - } - } + include($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx"); + $class = preg_replace('/_plugin$/', '', $old_class); + } + + if (call_user_func(array($class, 'is_available'))) + { + $captchas['available'][$class] = call_user_func(array($class, 'get_name')); + } + else + { + $captchas['unavailable'][$class] = call_user_func(array($class, 'get_name')); } - closedir($dp); } return $captchas; diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index aea39b3123..07a0ea1279 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package VC */ -class phpbb_default_captcha +class phpbb_captcha_plugins_captcha_abstract { var $confirm_id; var $confirm_code; @@ -364,3 +364,10 @@ class phpbb_default_captcha } } + +/** +* Old class name for legacy use. The new class name is auto loadable. +*/ +class phpbb_default_captcha extends phpbb_captcha_plugins_captcha_abstract +{ +} From 897063d3e269a7c11ef6d6602abc37ec30266a72 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 14:46:38 -0400 Subject: [PATCH 053/325] [feature/extension-manager] Add missing sql_freeresult call PHPBB3-10323 --- phpBB/includes/extension/manager.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 736c706e77..d167bc6847 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -63,6 +63,7 @@ class phpbb_extension_manager $result = $this->db->sql_query($sql); $extensions = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); $this->extensions = array(); foreach ($extensions as $extension) From c7a986eccdac183cc81b3da486092f4ab82109ba Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 17:17:40 -0400 Subject: [PATCH 054/325] [feature/extension-manager] Use an incremental process for enable and purge The enable or purge operation of an extension could take a long time if an expensive operation needs to be executed on a large set of data. To allow this to succeed from a web interface with max_execution_time set in the webserver's php configuration, subsequent requests must continue the operation started earlier. So individual enable and purge implementations must be able to spread their work across multiple steps. PHPBB3-10323 --- phpBB/develop/create_schema_files.php | 1 + phpBB/includes/extension/base.php | 22 +++++- phpBB/includes/extension/interface.php | 39 ++++++++++- phpBB/includes/extension/manager.php | 85 +++++++++++++++++++---- phpBB/install/database_update.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 | 3 +- phpBB/install/schemas/sqlite_schema.sql | 3 +- tests/extension/manager_test.php | 10 +++ 13 files changed, 151 insertions(+), 22 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index bc1e28572d..1828719570 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1035,6 +1035,7 @@ function get_schema_struct() 'COLUMNS' => array( 'ext_name' => array('VCHAR', ''), 'ext_active' => array('BOOL', 0), + 'ext_state' => array('TEXT', ''), ), 'KEYS' => array( 'ext_name' => array('UNIQUE', 'ext_name'), diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php index 0e6c89491d..8228364d44 100644 --- a/phpBB/includes/extension/base.php +++ b/phpBB/includes/extension/base.php @@ -16,20 +16,38 @@ if (!defined('IN_PHPBB')) } /** +* A base class for extensions without custom enable/disbale/purge code. * * @package extension */ class phpbb_extension_base implements phpbb_extension_interface { - public function enable() + /** + * Single enable step that does nothing + * + * @return false Indicates no further steps are required + */ + public function enable_step($old_state) { + return false; } + /** + * Empty disable method + * + * @return null + */ public function disable() { } - public function purge() + /** + * Single purge step that does nothing + * + * @return false Indicates no further steps are required + */ + public function purge_step($old_state) { + return false; } } diff --git a/phpBB/includes/extension/interface.php b/phpBB/includes/extension/interface.php index 40a5a066a3..7d0ecd72c7 100644 --- a/phpBB/includes/extension/interface.php +++ b/phpBB/includes/extension/interface.php @@ -16,12 +16,47 @@ if (!defined('IN_PHPBB')) } /** +* The interface extension meta classes have to implement to run custom code +* on enable/disable/purge. * * @package extension */ interface phpbb_extension_interface { - public function enable(); + /** + * enable_step is executed on enabling an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function enable_step($old_state); + + /** + * Disables the extension. + * + * Must be a quick operation, that finishes within max_execution_time. + * + * @return null + */ public function disable(); - public function purge(); + + /** + * purge_step is executed on purging an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function purge_step($old_state); } diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index d167bc6847..a1863040d0 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -109,28 +109,34 @@ class phpbb_extension_manager } /** - * Enables an extension + * Runs a step of the extension enabling process. * - * Calls the enable method on the extension's meta class to allow it to - * make database changes and execute other initialisation code. + * Allows the exentension to enable in a long running script that works + * in multiple steps across requests. State is kept for the extension + * in the extensions table. * - * @param string $name The extension's name - * @return null + * @param string $name The extension's name + * @return bool Whether another run of enable_step is required */ - public function enable($name) + public function enable_step($name) { // ignore extensions that are already enabled if (isset($this->extensions[$name]) && $this->extensions[$name]['ext_active']) { - return; + return false; } + $old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false; + $extension = $this->get_extension($name); - $extension->enable(); + $state = $extension->enable_step($old_state); + + $active = ($state === false); $extension_data = array( - 'ext_name' => $name, - 'ext_active' => true, + 'ext_name' => $name, + 'ext_active' => $active, + 'ext_state' => serialize($state), ); $this->extensions[$name] = $extension_data; @@ -148,6 +154,22 @@ class phpbb_extension_manager ' . $this->db->sql_build_array('INSERT', $extension_data); $this->db->sql_query($sql); } + + return !$active; + } + + /** + * Enables an extension + * + * This method completely enables an extension. But it could be long running + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function enable($name) + { + while ($this->enable_step($name)); } /** @@ -172,9 +194,10 @@ class phpbb_extension_manager $extension_data = array( 'ext_active' => false, + 'ext_state' => serialize(false), ); $this->extensions[$name]['ext_active'] = false; - ksort($this->extensions); + $this->extensions[$name]['ext_state'] = serialize(false); $sql = 'UPDATE ' . $this->extension_table . ' SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " @@ -191,12 +214,12 @@ class phpbb_extension_manager * @param string $name The extension's name * @return null */ - public function purge($name) + public function purge_step($name) { // ignore extensions that do not exist if (!isset($this->extensions[$name])) { - return; + return false; } // disable first if necessary @@ -205,14 +228,48 @@ class phpbb_extension_manager $this->disable($name); } + $old_state = unserialize($this->extensions[$name]['ext_state']); + $extension = $this->get_extension($name); - $extension->purge(); + $state = $extension->purge_step($old_state); + + // continue until the state is false + if ($state !== false) + { + $extension_data = array( + 'ext_state' => serialize($state), + ); + $this->extensions[$name]['ext_state'] = serialize($state); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + return true; + } unset($this->extensions[$name]); $sql = 'DELETE FROM ' . $this->extension_table . " WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + + return false; + } + + /** + * Purge an extension + * + * Purges an extension completely at once. This process could run for a while + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function purge($name) + { + while ($this->purge_step($name)); } /** diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 45de19c918..9a7231040b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1060,6 +1060,7 @@ function database_update_info() 'COLUMNS' => array( 'ext_name' => array('VCHAR', ''), 'ext_active' => array('BOOL', 0), + 'ext_state' => array('TEXT', ''), ), 'KEYS' => array( 'ext_name' => array('UNIQUE', 'ext_name'), diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 4952b6bbdf..9bebf11c4b 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -284,7 +284,8 @@ END;; # Table: 'phpbb_ext' CREATE TABLE phpbb_ext ( ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - ext_active INTEGER DEFAULT 0 NOT NULL + ext_active INTEGER DEFAULT 0 NOT NULL, + ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL );; CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 76f3fc6491..bf137b89f4 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -363,7 +363,8 @@ GO */ CREATE TABLE [phpbb_ext] ( [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , - [ext_active] [int] DEFAULT (0) NOT NULL + [ext_active] [int] DEFAULT (0) NOT NULL , + [ext_state] [varchar] (8000) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index a1b282418d..54504beb1c 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -195,6 +195,7 @@ CREATE TABLE phpbb_drafts ( CREATE TABLE phpbb_ext ( ext_name varbinary(255) DEFAULT '' NOT NULL, ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state blob NOT NULL, UNIQUE ext_name (ext_name) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 2f2de17dcb..139833b7b9 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -195,6 +195,7 @@ CREATE TABLE phpbb_drafts ( CREATE TABLE phpbb_ext ( ext_name varchar(255) DEFAULT '' NOT NULL, ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, + ext_state text NOT NULL, UNIQUE ext_name (ext_name) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index f0a958d2f6..2f958b835b 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -413,6 +413,7 @@ END; CREATE TABLE phpbb_ext ( ext_name varchar2(255) DEFAULT '' , ext_active number(1) DEFAULT '0' NOT NULL, + ext_state clob DEFAULT '' , CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 956167ff39..86ee044913 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -317,7 +317,8 @@ CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); */ CREATE TABLE phpbb_ext ( ext_name varchar(255) DEFAULT '' NOT NULL, - ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0) + ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0), + ext_state varchar(8000) DEFAULT '' NOT NULL ); CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 223dbc3c02..94e192fc0c 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -189,7 +189,8 @@ CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); # Table: 'phpbb_ext' CREATE TABLE phpbb_ext ( ext_name varchar(255) NOT NULL DEFAULT '', - ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0' + ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0', + ext_state text(65535) NOT NULL DEFAULT '' ); CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 2035264559..70c3543a69 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -8,6 +8,8 @@ */ require_once dirname(__FILE__) . '/../mock/cache.php'; +require_once dirname(__FILE__) . '/ext/bar/bar.php'; +require_once dirname(__FILE__) . '/ext/moo/moo.php'; class phpbb_extension_manager_test extends phpbb_database_test_case { @@ -49,10 +51,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_enable() { + phpbb_ext_bar::$state = 0; + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->extension_manager->enable('bar'); $this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_configured())); + + $this->assertEquals(4, phpbb_ext_bar::$state); } public function test_disable() @@ -65,10 +71,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_purge() { + phpbb_ext_moo::$purged = false; + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); $this->extension_manager->purge('moo'); $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured())); + + $this->assertTrue(phpbb_ext_moo::$purged); } } From 24ddef2230b63dd752e8b3bb33ae6b651f9e8b5e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:10:50 -0400 Subject: [PATCH 055/325] [feature/extension-manager] Remove 5.2 incompatible \ in front of SPL classname PHPBB-10323 --- phpBB/includes/cron/provider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/cron/provider.php b/phpBB/includes/cron/provider.php index 9936da3f55..ee0f93a308 100644 --- a/phpBB/includes/cron/provider.php +++ b/phpBB/includes/cron/provider.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_provider implements \IteratorAggregate +class phpbb_cron_provider implements IteratorAggregate { /** * Array holding all found task class names. From 7435f344e20ae4dce875b46746f46ddc874e41f3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:16:57 -0400 Subject: [PATCH 056/325] [feature/extension-manager] Add docblocks for query members of extension finder PHPBB3-10323 --- phpBB/includes/extension/finder.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index fbc8a3aefb..b3cdbd6ab9 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -27,7 +27,16 @@ class phpbb_extension_finder protected $cache; protected $phpEx; + /** + * @var array An associative array, containing all search parameters set in + * methods + */ protected $query; + + /** + * @var array A map from md5 hashes of serialized queries to their + * previously retrieved results. + */ protected $cached_queries; /** From 34f11a1039745ee1de48f1818f781ae1ee2b85ac Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:24:15 -0400 Subject: [PATCH 057/325] [feature/extension-manager] Correct usage of false cache return value PHPBB3-10323 --- phpBB/includes/extension/finder.php | 5 +++++ phpBB/includes/extension/manager.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index b3cdbd6ab9..d25823ca43 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -283,6 +283,11 @@ class phpbb_extension_finder if ($cache && $this->cache) { + if ($this->cached_queries === false) + { + $this->cached_queries = array(); + } + $this->cached_queries[$query] = $files; $this->cache->put('_extension_finder', $this->cached_queries); } diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index a1863040d0..e1e7571573 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -45,7 +45,9 @@ class phpbb_extension_manager $this->phpEx = $phpEx; $this->extension_table = $extension_table; - if (false === ($this->extensions = $this->cache->get('_extensions'))) + $this->extensions = $this->cache->get('_extensions'); + + if ($this->extensions === false) { $this->load_extensions(); } From 64827a6623c9a916d41c2ef5bf2c2092a3008722 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:43:45 -0400 Subject: [PATCH 058/325] [feature/extension-manager] Test creation of new extension finder cache PHPBB3-10323 --- phpBB/includes/extension/finder.php | 5 ----- tests/extension/finder_test.php | 31 ++++++++++++++++++++++++++++- tests/mock/cache.php | 12 +++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index d25823ca43..b3cdbd6ab9 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -283,11 +283,6 @@ class phpbb_extension_finder if ($cache && $this->cache) { - if ($this->cached_queries === false) - { - $this->cached_queries = array(); - } - $this->cached_queries[$query] = $files; $this->cache->put('_extension_finder', $this->cached_queries); } diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 4acfe53937..fb2faaf5c0 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -122,6 +122,36 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_get_classes_create_cache() + { + $cache = new phpbb_mock_cache; + $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', $cache); + $files = $finder->suffix('_class.php')->get_files(); + + sort($files); + + $expected_files = array( + 'ext/bar/my/hidden_class.php', + 'ext/foo/a_class.php', + 'ext/foo/b_class.php', + ); + + $query = array( + 'default_path' => false, + 'default_suffix' => '_class.php', + 'default_prefix' => false, + 'default_directory' => false, + 'suffix' => '_class.php', + 'prefix' => false, + 'directory' => false, + ); + + $this->assertEquals($expected_files, $files); + $cache->checkAssociativeVar($this, '_extension_finder', array( + md5(serialize($query)) => $expected_files, + )); + } + public function test_cached_get_files() { $query = array( @@ -134,7 +164,6 @@ class phpbb_extension_finder_test extends phpbb_test_case 'directory' => false, ); - $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', new phpbb_mock_cache(array( '_extension_finder' => array( md5(serialize($query)) => array('file_name'), diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 989180c256..b745123801 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -59,6 +59,18 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface $test->assertEquals($data, $this->data[$var_name]); } + public function checkAssociativeVar(PHPUnit_Framework_Assert $test, $var_name, $data) + { + $test->assertTrue(isset($this->data[$var_name])); + + foreach ($this->data[$var_name] as &$content) + { + sort($content); + } + + $test->assertEquals($data, $this->data[$var_name]); + } + public function checkVarUnset(PHPUnit_Framework_Assert $test, $var_name) { $test->assertFalse(isset($this->data[$var_name])); From bd1366d62d018c6b71ea24b1f9915d89d4a240a5 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:44:43 -0400 Subject: [PATCH 059/325] [feature/extension-manager] Use _ext for cache - avoids conflict with file ext PHPBB3-10323 --- phpBB/includes/extension/finder.php | 4 ++-- phpBB/includes/extension/manager.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index b3cdbd6ab9..7ba477582c 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -66,7 +66,7 @@ class phpbb_extension_finder 'directory' => false, ); - $this->cached_queries = ($this->cache) ? $this->cache->get('_extension_finder') : false; + $this->cached_queries = ($this->cache) ? $this->cache->get('_ext_finder') : false; } /** @@ -284,7 +284,7 @@ class phpbb_extension_finder if ($cache && $this->cache) { $this->cached_queries[$query] = $files; - $this->cache->put('_extension_finder', $this->cached_queries); + $this->cache->put('_ext_finder', $this->cached_queries); } return $files; diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index e1e7571573..45250e623a 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -45,7 +45,7 @@ class phpbb_extension_manager $this->phpEx = $phpEx; $this->extension_table = $extension_table; - $this->extensions = $this->cache->get('_extensions'); + $this->extensions = $this->cache->get('_ext'); if ($this->extensions === false) { @@ -75,7 +75,7 @@ class phpbb_extension_manager } ksort($this->extensions); - $this->cache->put('_extensions', $this->extensions); + $this->cache->put('_ext', $this->extensions); } /** From 739e9eb58e7e9b899955b714aa3fc8bbe6a30ebc Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 18:57:21 -0400 Subject: [PATCH 060/325] [feature/extension-manager] Make the cache variable name for extensions dynamic Allows multiple instances to use cache simultaneously. PHPBB3-10323 --- phpBB/includes/extension/finder.php | 10 +++++++--- phpBB/includes/extension/manager.php | 11 +++++++---- tests/extension/finder_test.php | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 7ba477582c..e94a94c733 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -26,6 +26,7 @@ class phpbb_extension_finder protected $phpbb_root_path; protected $cache; protected $phpEx; + protected $cache_name; /** * @var array An associative array, containing all search parameters set in @@ -48,13 +49,16 @@ class phpbb_extension_finder * @param string $phpbb_root_path Path to the phpbb root directory * @param phpbb_cache_driver_interface $cache A cache instance or null * @param string $phpEx php file extension + * @param string $cache_name The name of the cache variable, defaults to + * _ext_finder */ - public function __construct(phpbb_extension_manager $extension_manager, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $phpEx = '.php') + public function __construct(phpbb_extension_manager $extension_manager, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $phpEx = '.php', $cache_name = '_ext_finder') { $this->extension_manager = $extension_manager; $this->phpbb_root_path = $phpbb_root_path; $this->cache = $cache; $this->phpEx = $phpEx; + $this->cache_name = $cache_name; $this->query = array( 'default_path' => false, @@ -66,7 +70,7 @@ class phpbb_extension_finder 'directory' => false, ); - $this->cached_queries = ($this->cache) ? $this->cache->get('_ext_finder') : false; + $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; } /** @@ -284,7 +288,7 @@ class phpbb_extension_finder if ($cache && $this->cache) { $this->cached_queries[$query] = $files; - $this->cache->put('_ext_finder', $this->cached_queries); + $this->cache->put($this->cache_name, $this->cached_queries); } return $files; diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 45250e623a..443eaf011b 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -27,6 +27,7 @@ class phpbb_extension_manager protected $extensions; protected $extension_table; protected $phpbb_root_path; + protected $cache_name; /** * Creates a manager and loads information from database @@ -36,16 +37,18 @@ class phpbb_extension_manager * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpEx php file extension * @param phpbb_cache_driver_interface $cache A cache instance or null + * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(dbal $db, $extension_table, $phpbb_root_path, $phpEx = '.php', phpbb_cache_driver_interface $cache = null) + public function __construct(dbal $db, $extension_table, $phpbb_root_path, $phpEx = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext') { $this->phpbb_root_path = $phpbb_root_path; $this->db = $db; $this->cache = $cache; $this->phpEx = $phpEx; $this->extension_table = $extension_table; + $this->cache_name = $cache_name; - $this->extensions = $this->cache->get('_ext'); + $this->extensions = $this->cache->get($this->cache_name); if ($this->extensions === false) { @@ -75,7 +78,7 @@ class phpbb_extension_manager } ksort($this->extensions); - $this->cache->put('_ext', $this->extensions); + $this->cache->put($this->cache_name, $this->extensions); } /** @@ -356,6 +359,6 @@ class phpbb_extension_manager */ public function get_finder() { - return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->phpEx); + return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->phpEx, $this->cache_name . '_finder'); } } diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index fb2faaf5c0..cae11a5bfa 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -125,7 +125,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_get_classes_create_cache() { $cache = new phpbb_mock_cache; - $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', $cache); + $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', $cache, '.php', '_custom_cache_name'); $files = $finder->suffix('_class.php')->get_files(); sort($files); @@ -147,7 +147,7 @@ class phpbb_extension_finder_test extends phpbb_test_case ); $this->assertEquals($expected_files, $files); - $cache->checkAssociativeVar($this, '_extension_finder', array( + $cache->checkAssociativeVar($this, '_custom_cache_name', array( md5(serialize($query)) => $expected_files, )); } @@ -165,7 +165,7 @@ class phpbb_extension_finder_test extends phpbb_test_case ); $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', new phpbb_mock_cache(array( - '_extension_finder' => array( + '_ext_finder' => array( md5(serialize($query)) => array('file_name'), ), ))); From 48391d2dde8f40e3c7e7d4a41b8ff1c32508ffc1 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 20:05:46 -0400 Subject: [PATCH 061/325] [feature/extension-manager] Create an extension manager on update and install It's required when adding modules PHPBB3-10323 --- phpBB/install/database_update.php | 8 +++++++- phpBB/install/install_install.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 9a7231040b..2635396af0 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -678,7 +678,13 @@ function _write_result($no_updates, $errored, $error_ary) function _add_modules($modules_to_install) { - global $phpbb_root_path, $phpEx, $db; + global $phpbb_root_path, $phpEx, $db, $phpbb_extension_manager; + + // modules require an extension manager + if (empty($phpbb_extension_manager)) + { + $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx"); + } include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f8c54678bf..c6b315ae6c 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1483,7 +1483,13 @@ class install_install extends module */ function add_modules($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx; + global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager; + + // modules require an extension manager + if (empty($phpbb_extension_manager)) + { + $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx"); + } include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); From 018a8359974273b65a3e6bd8aeca75396fd36a5b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 20:06:17 -0400 Subject: [PATCH 062/325] [feature/extension-manager] The default fulltext native backend was renamed This was done to make it autoloadable. PHPBB3-10323 --- phpBB/install/install_install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index c6b315ae6c..5ea3525edd 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1465,7 +1465,7 @@ class install_install extends module set_config_count(null, null, null, $config); $error = false; - $search = new fulltext_native($error); + $search = new phpbb_search_fulltext_native($error); $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id FROM ' . POSTS_TABLE; From c785ef7aa7953c5e533e48b11ef13d6b1f344813 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 20:14:23 -0400 Subject: [PATCH 063/325] [feature/extension-manager] Make sure the extension manager works without cache Includes a test for manager without a cache PHPBB3-10323 --- phpBB/includes/extension/manager.php | 8 ++++++-- tests/extension/manager_test.php | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 443eaf011b..a6c8ebb3d0 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -48,7 +48,7 @@ class phpbb_extension_manager $this->extension_table = $extension_table; $this->cache_name = $cache_name; - $this->extensions = $this->cache->get($this->cache_name); + $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; if ($this->extensions === false) { @@ -78,7 +78,11 @@ class phpbb_extension_manager } ksort($this->extensions); - $this->cache->put($this->cache_name, $this->extensions); + + if ($this->cache) + { + $this->cache->put($this->cache_name, $this->extensions); + } } /** diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 70c3543a69..52be88330a 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -81,4 +81,17 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $this->assertTrue(phpbb_ext_moo::$purged); } + + public function test_enabled_no_cache() + { + $extension_manager = new phpbb_extension_manager( + $this->new_dbal(), + 'phpbb_ext', + dirname(__FILE__) . '/', + '.php' + ); + + $this->assertEquals(array('foo'), array_keys($extension_manager->all_enabled())); + } + } From fe4b8818ec1f448d5625534e5027cfbc1177ab9a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 20:54:42 -0400 Subject: [PATCH 064/325] [feature/extension-manager] Always store the full class name as module basename The updater swaps out all basenames. PHPBB3-10323 --- phpBB/includes/functions_module.php | 15 +++++++------ phpBB/install/database_update.php | 35 +++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 1a6b57794a..4d575a7e3a 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -441,18 +441,19 @@ class p_master } // new modules use the full class names, old ones are always called _, e.g. acp_board - if (!class_exists($this->p_name) && !class_exists("{$this->p_class}_$this->p_name")) + if (!class_exists($this->p_name)) { - if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) + if (!file_exists("$module_path/{$this->p_name}.$phpEx")) { - trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR); + + trigger_error("Cannot find module $module_path/{$this->p_name}.$phpEx", E_USER_ERROR); } - include("$module_path/{$this->p_class}_$this->p_name.$phpEx"); + include("$module_path/{$this->p_name}.$phpEx"); - if (!class_exists("{$this->p_class}_$this->p_name")) + if (!class_exists($this->p_name)) { - trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); + trigger_error("Module file $module_path/{$this->p_name}.$phpEx does not contain correct class [{$this->p_name}]", E_USER_ERROR); } } @@ -462,7 +463,7 @@ class p_master } // Create a new instance of the desired module ... - $class_name = (class_exists($this->p_name)) ? $this->p_name : "{$this->p_class}_$this->p_name"; + $class_name = $this->p_name; $this->module = new $class_name($this); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 2635396af0..221f6b1344 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2115,6 +2115,37 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': + + // rename all module basenames to full classname + $sql = 'SELECT module_id, module_basename, module_class + FROM ' . MODULES_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $module_id = (int) $row['module_id']; + unset($row['module_id']); + + if (!empty($row['module_basename']) && !empty($row['module_class'])) + { + // all the class names start with class name or with phpbb_ for auto loading + if (strpos($row['module_basename'], $row['module_class'] . '_') !== 0 && + strpos($row['module_basename'], 'phpbb_') !== 0) + { + $row['module_basename'] = $row['module_class'] . '_' . $row['module_basename']; + + $sql_update = $db->sql_build_array('UPDATE', $row); + + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET ' . $sql_update . ' + WHERE module_id = ' . $module_id; + _sql($sql, $errored, $error_ary); + } + } + } + + $db->sql_freeresult($result); + // try to guess the new auto loaded search class name // works for native and mysql fulltext set_config('search_type', 'phpbb_search_' . $config['search_type']); @@ -2159,14 +2190,14 @@ function change_database_data(&$no_updates, $version) // Install modules $modules_to_install = array( 'position' => array( - 'base' => 'groups', + 'base' => 'acp_groups', 'class' => 'acp', 'title' => 'ACP_GROUPS_POSITION', 'auth' => 'acl_a_group', 'cat' => 'ACP_GROUPS', ), 'manage' => array( - 'base' => 'attachments', + 'base' => 'acp_attachments', 'class' => 'acp', 'title' => 'ACP_MANAGE_ATTACHMENTS', 'auth' => 'acl_a_attach', From 0ea4de41711e1b4be601d01882ff52011cf9bf48 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 22:21:20 -0400 Subject: [PATCH 065/325] [feature/extension-manager] Add support for directories to the extension finder PHPBB3-10323 --- phpBB/includes/extension/finder.php | 51 +++++++++++++++++++++++++---- tests/extension/finder_test.php | 14 ++++++++ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index e94a94c733..bcdcc61d76 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -216,14 +216,38 @@ class phpbb_extension_finder return $classes; } + /** + * Finds all directories matching the configured options + * + * @param bool $cache Whether the result should be cached + * @return array An array of paths to found directories + */ + public function get_directories($cache = true) + { + return $this->find($cache, true); + } + /** * Finds all files matching the configured options. * * @param bool $cache Whether the result should be cached - * @return array An array of found class names + * @return array An array of paths to found files */ public function get_files($cache = true) { + return $this->find($cache, false); + } + + /** + * Finds all file system entries matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Whether the found items should be directories + * @return array An array of paths to found items + */ + protected function find($cache = true, $is_dir = false) + { + $this->query['is_dir'] = $is_dir; $query = md5(serialize($this->query)); if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) @@ -265,18 +289,33 @@ class phpbb_extension_finder } // match only first directory if leading slash is given - $directory_pattern = ($directory && $directory[0] === '/') ? '#^' : '#' . DIRECTORY_SEPARATOR; - $directory_pattern .= preg_quote($directory . DIRECTORY_SEPARATOR, '#') . '#'; + if ($directory === '/') + { + $directory_pattern = '^' . preg_quote(DIRECTORY_SEPARATOR, '#'); + } + else if ($directory && $directory[0] === '/') + { + $directory_pattern = '^' . preg_quote($directory . DIRECTORY_SEPARATOR, '#'); + } + else + { + $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR, '#'); + } + $directory_pattern = '#' . $directory_pattern . '#'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $file_info) { - if (!$file_info->isDir()) + if ($file_info->isDir() == $is_dir) { - $relative_path = $iterator->getInnerIterator()->getSubPathname(); + $relative_path = ($is_dir) ? $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR: + $iterator->getInnerIterator()->getSubPathname(); + + $item_name = ($is_dir) ? basename($iterator->getInnerIterator()->getSubPath()) : + $file_info->getFilename(); if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && - (!$prefix || substr($file_info->getFilename(), 0, strlen($prefix)) === $prefix) && + (!$prefix || substr($item_name, 0, strlen($prefix)) === $prefix) && (!$directory || preg_match($directory_pattern, DIRECTORY_SEPARATOR . $relative_path))) { $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . $relative_path); diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index cae11a5bfa..b8ce8909ee 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -55,6 +55,18 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_prefix_get_directories() + { + $dirs = $this->finder + ->directory('/type') + ->get_directories(); + + sort($dirs); + $this->assertEquals(array( + 'ext/foo/type/', + ), $dirs); + } + public function test_prefix_get_classes() { $classes = $this->finder @@ -144,6 +156,7 @@ class phpbb_extension_finder_test extends phpbb_test_case 'suffix' => '_class.php', 'prefix' => false, 'directory' => false, + 'is_dir' => false, ); $this->assertEquals($expected_files, $files); @@ -162,6 +175,7 @@ class phpbb_extension_finder_test extends phpbb_test_case 'suffix' => false, 'prefix' => false, 'directory' => false, + 'is_dir' => false, ); $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', new phpbb_mock_cache(array( From fd4259919188df2d7e4667108bf86d9bd22a8e2b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 22:32:20 -0400 Subject: [PATCH 066/325] [feature/extension-manager] Correct formatting of documentation PHPBB3-10323 --- phpBB/includes/extension/finder.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index bcdcc61d76..1c1f150673 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -29,14 +29,15 @@ class phpbb_extension_finder protected $cache_name; /** - * @var array An associative array, containing all search parameters set in - * methods + * An associative array, containing all search parameters set in methods. + * @var array */ protected $query; /** - * @var array A map from md5 hashes of serialized queries to their - * previously retrieved results. + * A map from md5 hashes of serialized queries to their previously retrieved + * results. + * @var array */ protected $cached_queries; From 7d16007d6a1c042389039ab9ab59c073ecd7c933 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 29 Aug 2011 22:51:15 -0400 Subject: [PATCH 067/325] [feature/extension-manager] Prepend the phpbb_root_path if necessary. PHPBB3-10323 --- phpBB/includes/extension/finder.php | 26 +++++++++++++++++++++++--- tests/extension/finder_test.php | 9 ++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 1c1f150673..ee08b0a82a 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -205,7 +205,7 @@ class phpbb_extension_finder $this->query['suffix'] .= $this->phpEx; $this->query['default_suffix'] .= $this->phpEx; - $files = $this->get_files($cache); + $files = $this->find($cache, false); $classes = array(); foreach ($files as $file) @@ -225,7 +225,7 @@ class phpbb_extension_finder */ public function get_directories($cache = true) { - return $this->find($cache, true); + return $this->find_with_root_path($cache, true); } /** @@ -236,7 +236,27 @@ class phpbb_extension_finder */ public function get_files($cache = true) { - return $this->find($cache, false); + return $this->find_with_root_path($cache, false); + } + + /** + * A wrapper around the general find which prepends a root path to results + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Whether the found items should be directories + * @return array An array of paths to found items + */ + protected function find_with_root_path($cache = true, $is_dir = false) + { + $items = $this->find($cache, $is_dir); + + $result = array(); + foreach ($items as $item) + { + $result[] = $this->phpbb_root_path . $item; + } + + return $result; } /** diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index b8ce8909ee..8d7d38d4d8 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -63,7 +63,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($dirs); $this->assertEquals(array( - 'ext/foo/type/', + dirname(__FILE__) . '/ext/foo/type/', ), $dirs); } @@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_get_classes_create_cache() { $cache = new phpbb_mock_cache; - $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', $cache, '.php', '_custom_cache_name'); + $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name'); $files = $finder->suffix('_class.php')->get_files(); sort($files); @@ -159,7 +159,6 @@ class phpbb_extension_finder_test extends phpbb_test_case 'is_dir' => false, ); - $this->assertEquals($expected_files, $files); $cache->checkAssociativeVar($this, '_custom_cache_name', array( md5(serialize($query)) => $expected_files, )); @@ -178,7 +177,7 @@ class phpbb_extension_finder_test extends phpbb_test_case 'is_dir' => false, ); - $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/includes/', new phpbb_mock_cache(array( + $finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/', new phpbb_mock_cache(array( '_ext_finder' => array( md5(serialize($query)) => array('file_name'), ), @@ -191,7 +190,7 @@ class phpbb_extension_finder_test extends phpbb_test_case sort($classes); $this->assertEquals( - array('file_name'), + array(dirname(__FILE__) . '/file_name'), $classes ); } From 6c6a7d7992460e301615bcc1e13bee92ecc65724 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 30 Aug 2011 00:06:15 -0400 Subject: [PATCH 068/325] [feature/extension-manager] Extract extension provider functionality from cron PHPBB3-10323 --- phpBB/includes/cron/provider.php | 50 ++------------------- phpBB/includes/extension/provider.php | 65 +++++++++++++++++++++++++++ tests/cron/provider_test.php | 4 +- 3 files changed, 70 insertions(+), 49 deletions(-) create mode 100644 phpBB/includes/extension/provider.php diff --git a/phpBB/includes/cron/provider.php b/phpBB/includes/cron/provider.php index ee0f93a308..42552e1d8e 100644 --- a/phpBB/includes/cron/provider.php +++ b/phpBB/includes/cron/provider.php @@ -22,52 +22,20 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_provider implements IteratorAggregate +class phpbb_cron_provider extends phpbb_extension_provider { - /** - * Array holding all found task class names. - * - * @var array - */ - protected $task_names = array(); - - /** - * An extension manager to search for cron tasks in extensions. - * @var phpbb_extension_manager - */ - protected $extension_manager; - - /** - * Constructor. Loads all available tasks. - * - * Tasks will be looked up in the core task directory located in - * includes/cron/task/core/ and in extensions. Task classes will be - * autoloaded and must be named according to autoloading naming conventions. - * - * Tasks in extensions must be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. - * - * @param phpbb_extension_manager $extension_manager phpBB extension manager - */ - public function __construct(phpbb_extension_manager $extension_manager) - { - $this->extension_manager = $extension_manager; - - $this->task_names = $this->find_cron_task_names(); - } - /** * Finds cron task names using the extension manager. * * All PHP files in includes/cron/task/core/ are considered tasks. Tasks * in extensions have to be located in a directory called cron or a subdir * of a directory called cron. The class and filename must end in a _task - * suffix. + * suffix. Additionally all PHP files in includes/cron/task/core/ are + * tasks. * * @return array List of task names */ - public function find_cron_task_names() + public function find() { $finder = $this->extension_manager->get_finder(); @@ -79,14 +47,4 @@ class phpbb_cron_provider implements IteratorAggregate ->default_directory('') ->get_classes(); } - - /** - * Retrieve an iterator over all task names - * - * @return ArrayIterator An iterator for the array of task names - */ - public function getIterator() - { - return new ArrayIterator($this->task_names); - } } diff --git a/phpBB/includes/extension/provider.php b/phpBB/includes/extension/provider.php new file mode 100644 index 0000000000..9b5ec56d30 --- /dev/null +++ b/phpBB/includes/extension/provider.php @@ -0,0 +1,65 @@ +extension_manager = $extension_manager; + + $this->items = $this->find(); + } + + /** + * Finds template paths using the extension manager. + * + * @return array List of task names + */ + abstract function find(); + + /** + * Retrieve an iterator over all items + * + * @return ArrayIterator An iterator for the array of template paths + */ + public function getIterator() + { + return new ArrayIterator($this->items); + } +} diff --git a/tests/cron/provider_test.php b/tests/cron/provider_test.php index 781425e6ab..3a0545ffc6 100644 --- a/tests/cron/provider_test.php +++ b/tests/cron/provider_test.php @@ -27,10 +27,8 @@ class phpbb_cron_provider_test extends PHPUnit_Framework_TestCase public function test_manager_finds_shipped_tasks() { - $task_iterator = $this->provider->find_cron_task_names(); - $tasks = array(); - foreach ($task_iterator as $task) + foreach ($this->provider as $task) { $tasks[] = $task; } From 6ea6d50ccb9607429486a01d3144c7d32322e1b5 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 30 Aug 2011 01:15:43 -0400 Subject: [PATCH 069/325] [feature/extension-manager] Don't cache the phpbb_root_path in the ext manager Otherwise the paths are incorrect from e.g. adm/ PHPBB3-10323 --- phpBB/includes/extension/finder.php | 2 ++ phpBB/includes/extension/manager.php | 14 ++++++++++---- tests/cron/provider_test.php | 2 +- tests/extension/finder_test.php | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index ee08b0a82a..9a0727a50c 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -161,6 +161,8 @@ class phpbb_extension_finder */ public function directory($directory) { + $directory = preg_replace('#(?:^|/)\./#', '/', $directory); + if (strlen($directory) > 1 && $directory[strlen($directory) - 1] === '/') { $directory = substr($directory, 0, -1); diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index a6c8ebb3d0..ef714638c3 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -93,7 +93,7 @@ class phpbb_extension_manager */ public function get_extension_path($name) { - return $this->phpbb_root_path . 'ext/' . basename($name) . '/'; + return 'ext/' . basename($name) . '/'; } /** @@ -315,7 +315,13 @@ class phpbb_extension_manager */ public function all_configured() { - return $this->extensions; + $configured = array(); + foreach ($this->extensions as $name => $data) + { + $data['ext_path'] = $this->phpbb_root_path . $data['ext_path']; + $configured[$name] = $data; + } + return $configured; } /** @@ -331,7 +337,7 @@ class phpbb_extension_manager { if ($data['ext_active']) { - $enabled[$name] = $data['ext_path']; + $enabled[$name] = $this->phpbb_root_path . $data['ext_path']; } } return $enabled; @@ -350,7 +356,7 @@ class phpbb_extension_manager { if (!$data['ext_active']) { - $disabled[$name] = $data['ext_path']; + $disabled[$name] = $this->phpbb_root_path . $data['ext_path']; } } return $disabled; diff --git a/tests/cron/provider_test.php b/tests/cron/provider_test.php index 3a0545ffc6..662bb34c13 100644 --- a/tests/cron/provider_test.php +++ b/tests/cron/provider_test.php @@ -19,7 +19,7 @@ class phpbb_cron_provider_test extends PHPUnit_Framework_TestCase 'testext' => array( 'ext_name' => 'testext', 'ext_active' => true, - 'ext_path' => dirname(__FILE__) . '/ext/testext/' + 'ext_path' => 'ext/testext/' ), )); $this->provider = new phpbb_cron_provider($this->extension_manager); diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 8d7d38d4d8..9031e1cb47 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -23,12 +23,12 @@ class phpbb_extension_finder_test extends phpbb_test_case 'foo' => array( 'ext_name' => 'foo', 'ext_active' => '1', - 'ext_path' => dirname(__FILE__) . '/ext/foo/', + 'ext_path' => 'ext/foo/', ), 'bar' => array( 'ext_name' => 'bar', 'ext_active' => '1', - 'ext_path' => dirname(__FILE__) . '/ext/bar/', + 'ext_path' => 'ext/bar/', ), )); From ea46feb11542a9cf54ce083ee0ad03f4c5e02a1e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 30 Aug 2011 01:32:11 -0400 Subject: [PATCH 070/325] [feature/extension-manager] Add support for templates in extensions. This commit adds a template path provider to separate the process of locating (cached) paths in extensions from the template engine. The locator is supplied with a list of paths from the path provider. Admin templates can now be created in ext//adm/style/ and regular templates go into ext//styles/ + + + + + + +{META} +{SITENAME} • {PAGE_TITLE} + - - - - - - - - - - - - -
    {SITENAME}
    {L_PRIVATE_MESSAGING}

    {SUBJECT}
    {PAGE_NUMBER}
    + +
    + -
    + \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html index 6753a5bc33..24194e4c26 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html @@ -61,7 +61,7 @@ hr.sep { - + From 160e89aa06cf75e28b01311489e5b9b16bb2651b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 14 Nov 2011 18:49:07 +0100 Subject: [PATCH 166/325] [ticket/10457] Undefined variable $request, when print-viewing PMs PHPBB3-10457 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index c9451bd202..0458ff6579 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { global $user, $template, $auth, $db, $cache; - global $phpbb_root_path, $phpEx, $config; + global $phpbb_root_path, $request, $phpEx, $config; $user->add_lang(array('viewtopic', 'memberlist')); From 14af18cb1b81e5dcee70c9eccb35d19f17af6948 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 14 Oct 2011 16:23:16 +0200 Subject: [PATCH 167/325] [ticket/9361] View correct error messages when editing account information Currently the "current password" is only checked, when you change something. This means you get "Your profile has been updated." although you enter a wrong password. I also added proper error messages, when you leave the confirm fields empty, and sorted them in the order of the field appearances on the html page. PHPBB3-9361 --- phpBB/includes/ucp/ucp_profile.php | 12 ++++++------ phpBB/language/en/ucp.php | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index c099e3b3fa..65b32bd0c4 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -78,14 +78,14 @@ class ucp_profile $error = validate_data($data, $check_ary); - if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) + if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) { - $error[] = 'NEW_PASSWORD_ERROR'; + $error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY'; } - if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) { - $error[] = 'CUR_PASSWORD_ERROR'; + $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; } // Only check the new password against the previous password if there have been no errors @@ -94,9 +94,9 @@ class ucp_profile $error[] = 'SAME_PASSWORD_ERROR'; } - if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) + if (!phpbb_check_hash($data['cur_password'], $user->data['user_password'])) { - $error[] = 'NEW_EMAIL_ERROR'; + $error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY'; } if (!check_form_key('ucp_reg_details')) diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index c1e3c06c43..3ebc863447 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -138,6 +138,7 @@ $lang = array_merge($lang, array( 'CURRENT_IMAGE' => 'Current image', 'CURRENT_PASSWORD' => 'Current password', 'CURRENT_PASSWORD_EXPLAIN' => 'You must confirm your current password if you wish to change it, alter your e-mail address or username.', + 'CUR_PASSWORD_EMPTY' => 'You did not enter your current password.', 'CUR_PASSWORD_ERROR' => 'The current password you entered is incorrect.', 'CUSTOM_DATEFORMAT' => 'Custom…', @@ -268,9 +269,11 @@ $lang = array_merge($lang, array( 'MOVE_TO_FOLDER' => 'Move to folder', 'MOVE_UP' => 'Move up', + 'NEW_EMAIL_CONFIRM_EMPTY' => 'You did not enter a confirm e-mail address.', 'NEW_EMAIL_ERROR' => 'The e-mail addresses you entered do not match.', 'NEW_FOLDER_NAME' => 'New folder name', 'NEW_PASSWORD' => 'New password', + 'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.', 'NEW_PASSWORD_ERROR' => 'The passwords you entered do not match.', 'NOTIFY_METHOD' => 'Notification method', 'NOTIFY_METHOD_BOTH' => 'Both', From f1a53659bdacdc045943b8a09240e6ecadcc5360 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 15 Nov 2011 22:33:11 +0800 Subject: [PATCH 168/325] [ticket/10419] Reword the language strings PHPBB3-10419 --- phpBB/language/en/acp/common.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 85da6fbd79..ef8d6f1cb3 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -328,14 +328,14 @@ $lang = array_merge($lang, array( 'DATABASE_SIZE' => 'Database size', // Enviroment configuration checks, mbstring related - 'ERROR_MBSTRING_FUNC_OVERLOAD' => 'Function overloading setting is invalid', - 'ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4. You can check current value on PHP information page.', - 'ERROR_MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding setting is invalid', - 'ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0. You can check current value on PHP information page.', - 'ERROR_MBSTRING_HTTP_INPUT' => 'HTTP input character conversion setting is invalid', - 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass. You can check current value on PHP information page.', - 'ERROR_MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion setting is invalid', - 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass. You can check current value on PHP information page.', + 'ERROR_MBSTRING_FUNC_OVERLOAD' => 'Function overloading is improperly configured', + 'ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding is improperly configured', + 'ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_INPUT' => 'HTTP input character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass. You can check the current value on the PHP information page.', 'FILES_PER_DAY' => 'Attachments per day', 'FORUM_STATS' => 'Board statistics', From 815dd3591b2618f072791aeb7bf6d87492e690b0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 15 Nov 2011 17:23:55 +0100 Subject: [PATCH 169/325] [ticket/10185] Always set board startdate on conversion The board startdate should always be set to first user registration date. The current code did not do anything at all, as the board_startdate was always set on installation before running the convertor. PHPBB3-10185 --- phpBB/install/install_convert.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 814b50cf68..62efc3e46b 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -1716,19 +1716,16 @@ class install_convert extends module fix_empty_primary_groups(); - if (!isset($config['board_startdate'])) - { - $sql = 'SELECT MIN(user_regdate) AS board_startdate - FROM ' . USERS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $sql = 'SELECT MIN(user_regdate) AS board_startdate + FROM ' . USERS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0) || !isset($config['board_startdate'])) - { - set_config('board_startdate', $row['board_startdate']); - $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS); - } + if (!isset($config['board_startdate']) || ($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0)) + { + set_config('board_startdate', $row['board_startdate']); + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS); } update_dynamic_config(); From e8686d9dad6522b30c2aeafb0e6e8dbe91cfb8db Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 15 Nov 2011 22:14:28 +0100 Subject: [PATCH 170/325] [ticket/10296] Add unit test for CROSS JOIN with INNER JOIN PHPBB3-10296 --- tests/dbal/cross_join_test.php | 55 ++++++++++++++++++++++ tests/dbal/fixtures/massmail_crossjoin.xml | 43 +++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 tests/dbal/cross_join_test.php create mode 100644 tests/dbal/fixtures/massmail_crossjoin.xml diff --git a/tests/dbal/cross_join_test.php b/tests/dbal/cross_join_test.php new file mode 100644 index 0000000000..7110c7a2ea --- /dev/null +++ b/tests/dbal/cross_join_test.php @@ -0,0 +1,55 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/massmail_crossjoin.xml'); + } + + public function test_cross_join() + { + $db = $this->new_dbal(); + + // http://tracker.phpbb.com/browse/PHPBB3-10296 + // Test CROSS JOIN with INNER JOIN + // Failed on Postgres, MSSQL and Oracle + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.username', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array( + 'phpbb_banlist' => 'b', + ), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => 'ug.group_id = 1 + AND u.user_id = ug.user_id + AND b.ban_id IS NULL', + 'ORDER_BY' => 'u.username', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array(array('username' => 'mass email')), $db->sql_fetchrowset($result)); + } +} diff --git a/tests/dbal/fixtures/massmail_crossjoin.xml b/tests/dbal/fixtures/massmail_crossjoin.xml new file mode 100644 index 0000000000..801205eb81 --- /dev/null +++ b/tests/dbal/fixtures/massmail_crossjoin.xml @@ -0,0 +1,43 @@ + + +
    {SITENAME}
    {L_PRIVATE_MESSAGING}
    {SITENAME}
    {L_PRIVATE_MESSAGING}

    + ban_id + ban_userid + + 1 + 2 + +
    + + user_id + username + username_clean + + 1 + mass email + mass email + + + 2 + banned + banned + + + 3 + not in group + not in group + +
    + + user_id + group_id + + 1 + 1 + + + 2 + 1 + +
    + From 3d893c8222646e95aeae0301d954cfe62aa8486a Mon Sep 17 00:00:00 2001 From: dmauri Date: Tue, 15 Nov 2011 22:19:45 +0100 Subject: [PATCH 171/325] [ticket/10296] Fix CROSS JOIN with INNER JOIN on MSSQL, Postgres and Oracle PHPBB3-10296 --- phpBB/includes/db/dbal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 9b45c085a2..b4c1a72e1c 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -609,7 +609,7 @@ class dbal } } - $sql .= $this->_sql_custom_build('FROM', implode(', ', $table_array)); + $sql .= $this->_sql_custom_build('FROM', implode(' CROSS JOIN ', $table_array)); if (!empty($array['LEFT_JOIN'])) { From b2b057910e57961b3d31432267fadb4ddc922783 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 29 Oct 2011 23:04:18 +0200 Subject: [PATCH 172/325] [ticket/10157] Add notification to update cpfs when installing a language. We currently just copy the language-strings from the default language. But the admin should be reminded to change them. PHPBB3-10157 --- phpBB/includes/acp/acp_language.php | 9 ++++++++- phpBB/language/en/acp/language.php | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 598b390302..d560cdd0c5 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -919,6 +919,9 @@ class acp_language $default_lang_id = (int) $db->sql_fetchfield('lang_id'); $db->sql_freeresult($result); + // We want to notify the admin that custom profile fields need to be updated for the new language. + $notify_cpf_update = false; + // From the mysql documentation: // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. // Due to this we stay on the safe side if we do the insertion "the manual way" @@ -932,6 +935,7 @@ class acp_language { $row['lang_id'] = $lang_id; $db->sql_query('INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row)); + $notify_cpf_update = true; } $db->sql_freeresult($result); @@ -944,12 +948,15 @@ class acp_language { $row['lang_id'] = $lang_id; $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row)); + $notify_cpf_update = true; } $db->sql_freeresult($result); add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); - trigger_error(sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']) . adm_back_link($this->u_action)); + $message = sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']); + $message .= ($notify_cpf_update) ? '

    ' . $user->lang['LANGUAGE_PACK_CPF_UPDATE'] : ''; + trigger_error($message . adm_back_link($this->u_action)); break; diff --git a/phpBB/language/en/acp/language.php b/phpBB/language/en/acp/language.php index 4d11309ebb..dde4e3d722 100644 --- a/phpBB/language/en/acp/language.php +++ b/phpBB/language/en/acp/language.php @@ -59,6 +59,7 @@ $lang = array_merge($lang, array( 'LANGUAGE_PACK_DELETED' => 'The language pack %s has been removed successfully. All users using this language have been reset to the boards default language.', 'LANGUAGE_PACK_DETAILS' => 'Language pack details', 'LANGUAGE_PACK_INSTALLED' => 'The language pack %s has been successfully installed.', + 'LANGUAGE_PACK_CPF_UPDATE' => 'The custom profile fields’ language strings were copied from the default language. Please change them if necessary.', 'LANGUAGE_PACK_ISO' => 'ISO', 'LANGUAGE_PACK_LOCALNAME' => 'Local name', 'LANGUAGE_PACK_NAME' => 'Name', From 3091efc501c7e0d5d0a49cb496364f373a4d0184 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 17 Nov 2011 00:56:38 +0800 Subject: [PATCH 173/325] [ticket/9416] HTML entities in poll titles and options incorrectly re-encoded PHPBB3-9416 --- phpBB/install/convertors/convert_phpbb20.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 7f6e3c0250..789773e349 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -504,7 +504,7 @@ if (!$get_info) array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'), array('topic_first_post_id', 'topics.topic_first_post_id', ''), array('topic_last_view_time', 'posts.post_time', 'intval'), - array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')), + array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')), array('poll_start', 'vote_desc.vote_start', 'null_to_zero'), array('poll_length', 'vote_desc.vote_length', 'null_to_zero'), array('poll_max_options', 1, ''), @@ -537,7 +537,7 @@ if (!$get_info) array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'), array('topic_first_post_id', 'topics.topic_first_post_id', ''), - array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')), + array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')), array('poll_start', 'vote_desc.vote_start', 'null_to_zero'), array('poll_length', 'vote_desc.vote_length', 'null_to_zero'), array('poll_max_options', 1, ''), @@ -582,7 +582,7 @@ if (!$get_info) array('poll_option_id', 'vote_results.vote_option_id', ''), array('topic_id', 'vote_desc.topic_id', ''), array('', 'topics.topic_poster AS poster_id', 'phpbb_user_id'), - array('poll_option_text', 'vote_results.vote_option_text', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')), + array('poll_option_text', 'vote_results.vote_option_text', array('function1' => 'phpbb_set_encoding', 'function2' => 'htmlspecialchars_decode', 'function3' => 'utf8_htmlspecialchars')), array('poll_option_total', 'vote_results.vote_result', ''), 'where' => 'vote_results.vote_id = vote_desc.vote_id', From 64bf03f4ca363f0f4b237a4cb32cde4f48cd158e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 13:07:14 +0100 Subject: [PATCH 174/325] [feature/extension-manager] Fix "disbale" typo in comment PHPBB3-10323 --- phpBB/includes/extension/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php index 8228364d44..fed120c51b 100644 --- a/phpBB/includes/extension/base.php +++ b/phpBB/includes/extension/base.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) } /** -* A base class for extensions without custom enable/disbale/purge code. +* A base class for extensions without custom enable/disable/purge code. * * @package extension */ From 7ee9a07179d880c788b6ccb0a136c9a957fd918c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 13:10:09 +0100 Subject: [PATCH 175/325] [feature/extension-manager] Correct default path comment & remove double strlen PHPBB3-10323 --- phpBB/includes/extension/finder.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 6084d2672a..d84d27b9c4 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -77,7 +77,7 @@ class phpbb_extension_finder /** * Sets a default path to be searched in addition to extensions * - * @param string $default_path The path relative to / + * @param string $default_path The path relative to phpbb_root_path * @return phpbb_extension_finder This object for chaining calls */ public function default_path($default_path) @@ -162,8 +162,9 @@ class phpbb_extension_finder public function directory($directory) { $directory = preg_replace('#(?:^|/)\./#', '/', $directory); + $dir_len = strlen($directory); - if (strlen($directory) > 1 && $directory[strlen($directory) - 1] === '/') + if ($dir_len > 1 && $directory[$dir_len - 1] === '/') { $directory = substr($directory, 0, -1); } From ef33bd72d04cf778ced3432c026e982cd3571dab Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 13:14:15 +0100 Subject: [PATCH 176/325] [feature/extension-manager] Clarify class finding method docblock PHPBB3-10323 --- phpBB/includes/extension/finder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index d84d27b9c4..d6d3b176d3 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -196,10 +196,13 @@ class phpbb_extension_finder } /** - * Finds auto loadable php classes matching the configured options. + * Finds classes matching the configured options if they follow phpBB naming rules. * * The php file extension is automatically added to suffixes. * + * Note: If a file is matched but contains a class name not following the + * phpBB naming rules an incorrect class name will be returned. + * * @param bool $cache Whether the result should be cached * @return array An array of found class names */ From acc42bb2e9ea2556b47030c3c83c0bfac551eea5 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 13:16:32 +0100 Subject: [PATCH 177/325] [feature/extension-manager] Clarify is_dir parameter description PHPBB3-10323 --- phpBB/includes/extension/finder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index d6d3b176d3..ee8ff2ccf4 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -249,7 +249,8 @@ class phpbb_extension_finder * A wrapper around the general find which prepends a root path to results * * @param bool $cache Whether the result should be cached - * @param bool $is_dir Whether the found items should be directories + * @param bool $is_dir Directories will be returned when true, only files + * otherwise * @return array An array of paths to found items */ protected function find_with_root_path($cache = true, $is_dir = false) @@ -269,7 +270,8 @@ class phpbb_extension_finder * Finds all file system entries matching the configured options * * @param bool $cache Whether the result should be cached - * @param bool $is_dir Whether the found items should be directories + * @param bool $is_dir Directories will be returned when true, only files + * otherwise * @return array An array of paths to found items */ public function find($cache = true, $is_dir = false) From 10fa711f0046b667c3291c36f210f1c740fb685a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 14:37:57 +0100 Subject: [PATCH 178/325] [feature/extension-manager] Add more info on suffixes in extension finder PHPBB3-10323 --- phpBB/includes/extension/finder.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index ee8ff2ccf4..f3a9900a67 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -87,7 +87,11 @@ class phpbb_extension_finder } /** - * Sets a suffix all files found in extensions must match + * Sets a suffix all files found in extensions must match. + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. * * Automatically sets the default_suffix if its value does not differ from * the current suffix. @@ -109,6 +113,10 @@ class phpbb_extension_finder /** * Sets a suffix all files found in the default path must match * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * * @param string $default_suffix A filename suffix * @return phpbb_extension_finder This object for chaining calls */ From eab7374f3ff157d7606f16ff548219430417e68b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 14:38:31 +0100 Subject: [PATCH 179/325] [feature/extension-manager] Clarify comment on ext meta class instantiator PHPBB3-10323 --- phpBB/includes/extension/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 981fa43ab2..29cd89fb34 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -100,7 +100,7 @@ class phpbb_extension_manager } /** - * Instantiates the extension meta class for the given name. + * Instantiates the extension meta class for the extension with the given name * * @param string $name The extension name * @return phpbb_extension_interface Instance of the extension meta class or From 81ac3698089ce86c1e8a44bafacf881d6d8def4a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 14:43:38 +0100 Subject: [PATCH 180/325] [feature/extension-manager] Add docblocks to new methods in functions_module PHPBB3-10323 --- phpBB/includes/functions_module.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index e2b2d80b3e..ce49c3a798 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -884,7 +884,14 @@ class p_master } } - function get_short_name($basename) + /** + * Retrieve shortened module basename for legacy basenames (with xcp_ prefix) + * + * @param string $basename A module basename + * @return string The basename if it starts with phpbb_ or the basename with + * the current p_class (e.g. acp_) stripped. + */ + protected function get_short_name($basename) { if (substr($basename, 0, 6) === 'phpbb_') { @@ -895,7 +902,13 @@ class p_master return substr($basename, strlen($this->p_class) + 1); } - function is_full_class($basename) + /** + * Checks whether the given module basename is a correct class name + * + * @param string $basename A module basename + * @return bool True if the basename starts with phpbb_ or (x)cp_, false otherwise + */ + protected function is_full_class($basename) { return (substr($basename, 0, 6) === 'phpbb_' || substr($basename, 0, strlen($this->p_class) + 1) === $this->p_class . '_'); } From 121cab1c2932b2de7fa45183501ac6e760953319 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 14:46:30 +0100 Subject: [PATCH 181/325] [feature/extension-manager] Add docblocks to new search backend methods PHPBB3-10323 --- phpBB/includes/search/fulltext_mysql.php | 7 ++++++- phpBB/includes/search/fulltext_native.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index b9920da624..4214de3d97 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -52,7 +52,12 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $error = false; } - function get_name() + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() { return 'MySQL Fulltext'; } diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 7c792bba24..a335ddab6e 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -54,7 +54,12 @@ class phpbb_search_fulltext_native extends phpbb_search_base $error = false; } - function get_name() + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() { return 'phpBB Native Fulltext'; } From 8be1500048c2ae811f30e0bd402d7596b60fc2d9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 14:48:39 +0100 Subject: [PATCH 182/325] [feature/extension-manager] Use "core files" instead of "global files" in docs PHPBB3-10323 --- phpBB/includes/session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index cbef1af30a..497aaf1141 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1901,7 +1901,7 @@ class user extends session * @param mixed $lang_set specifies the language entries to include * @param bool $use_db internal variable for recursion, do not use * @param bool $use_help internal variable for recursion, do not use - * @param string $ext_name The extension to load language from, or empty for global files + * @param string $ext_name The extension to load language from, or empty for core files * * Examples: * @@ -1952,7 +1952,7 @@ class user extends session /** * Add Language Items from an extension - use_db and use_help are assigned where needed (only use them to force inclusion) * - * @param string $ext_name The extension to load language from, or empty for global files + * @param string $ext_name The extension to load language from, or empty for core files * @param mixed $lang_set specifies the language entries to include * @param bool $use_db internal variable for recursion, do not use * @param bool $use_help internal variable for recursion, do not use From 7cdc4bba2512089a02fbfa5cf4e5babbf9e20475 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 15:29:32 +0100 Subject: [PATCH 183/325] [feature/extension-manager] Clear up docs of extension related template changes PHPBB3-10323 --- .../template/extension_path_provider.php | 43 +++++++++++++------ phpBB/includes/template/locator.php | 4 +- phpBB/includes/template/path_provider.php | 3 ++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/phpBB/includes/template/extension_path_provider.php b/phpBB/includes/template/extension_path_provider.php index 9578702b65..0feeaafed0 100644 --- a/phpBB/includes/template/extension_path_provider.php +++ b/phpBB/includes/template/extension_path_provider.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) } /** -* Provides a template locator with template paths and extension template paths +* Provides a template locator with core template paths and extension template paths * * Finds installed template paths and makes them available to the locator. * @@ -24,24 +24,41 @@ if (!defined('IN_PHPBB')) */ class phpbb_template_extension_path_provider extends phpbb_extension_provider implements phpbb_template_path_provider_interface { + /** + * Optional prefix for template paths searched within extensions. + * + * Empty by default. Relative to the extension directory. As an example, it + * could be adm/ for admin templates. + * + * @var string + */ protected $ext_dir_prefix = ''; - protected $base_paths; + + /** + * A provider of paths to be searched for templates + * @var phpbb_template_path_provider + */ + protected $base_path_provider; /** * Constructor stores extension manager * * @param phpbb_extension_manager $extension_manager phpBB extension manager - * @param phpbb_template_path_provider $base_paths A simple path provider + * @param phpbb_template_path_provider $base_path_provider A simple path provider * to provide paths to be located in extensions */ - public function __construct(phpbb_extension_manager $extension_manager, phpbb_template_path_provider $base_paths) + public function __construct(phpbb_extension_manager $extension_manager, phpbb_template_path_provider $base_path_provider) { parent::__construct($extension_manager); - $this->base_paths = $base_paths; + $this->base_path_provider = $base_path_provider; } /** - * Defines a prefix to use for template paths in extensions + * Sets a prefix for template paths searched within extensions. + * + * The prefix is inserted between the extension's path e.g. ext/foo/ and + * the looked up template path, e.g. styles/bar/template/some.html. So it + * should not have a leading slash, but should have a trailing slash. * * @param string $ext_dir_prefix The prefix including trailing slash * @return null @@ -54,9 +71,9 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im /** * Finds template paths using the extension manager * - * Finds paths with the same name (e.g. styles/prosilver/template/) in all - * active extensions. Then appends the actual template paths based in the - * current working directory. + * Locates a path (e.g. styles/prosilver/template/) in all active extensions. + * Then appends the core template paths based in the current working + * directory. * * @return array List of template paths */ @@ -65,7 +82,7 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im $directories = array(); $finder = $this->extension_manager->get_finder(); - foreach ($this->base_paths as $path) + foreach ($this->base_path_provider as $path) { if ($path && !phpbb_is_absolute($path)) { @@ -76,7 +93,7 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im } } - foreach ($this->base_paths as $path) + foreach ($this->base_path_provider as $path) { $directories[] = $path; } @@ -97,7 +114,7 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im */ public function set_templates(array $templates, $style_root_path) { - $this->base_paths->set_templates($templates, $style_root_path); + $this->base_path_provider->set_templates($templates, $style_root_path); $this->items = null; } @@ -108,6 +125,6 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im */ public function get_main_template_path() { - return $this->base_paths->get_main_template_path(); + return $this->base_path_provider->get_main_template_path(); } } diff --git a/phpBB/includes/template/locator.php b/phpBB/includes/template/locator.php index 44cd2cd7b9..ee9bfa7d48 100644 --- a/phpBB/includes/template/locator.php +++ b/phpBB/includes/template/locator.php @@ -71,8 +71,8 @@ class phpbb_template_locator * Sets the list of template paths * * These paths will be searched for template files in the provided order. - * Paths may be outside of phpBB, but will still be cached to phpBB cache - * directory. + * Paths may be outside of phpBB, but templates loaded from these paths + * will still be cached. * * @param array $template_paths An array of paths to template directories * @return null diff --git a/phpBB/includes/template/path_provider.php b/phpBB/includes/template/path_provider.php index a56269d3c8..c243d1b115 100644 --- a/phpBB/includes/template/path_provider.php +++ b/phpBB/includes/template/path_provider.php @@ -40,6 +40,9 @@ class phpbb_template_path_provider implements IteratorAggregate, phpbb_template_ /** * Overwrites the current template names and paths * + * The first element of the passed templates map, is considered the main + * template and can be retrieved through get_main_template_path(). + * * @param array $templates An associative map from template names to paths. * The first element is the main template. * If the path is false, it will be generated from From 91c0a0d426571e0642c894a921a39f19fbd2e435 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 15:57:51 +0100 Subject: [PATCH 184/325] [feature/extension-manager] Add docblock to cached paths map in class loader PHPBB3-10323 --- phpBB/includes/class_loader.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index 46a271471a..2db807eb77 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -35,6 +35,11 @@ class phpbb_class_loader private $path; private $php_ext; private $cache; + + /** + * A map of looked up class names to paths relative to $this->path. + * @var array + */ private $cached_paths = array(); /** From d8e5783e8c341e38a0b8d572c8482b264cacb9c0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 16:00:22 +0100 Subject: [PATCH 185/325] [feature/extension-manager] Document what the class loader stores in cache PHPBB3-10323 --- phpBB/includes/class_loader.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index 2db807eb77..bc268d342e 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -38,6 +38,8 @@ class phpbb_class_loader /** * A map of looked up class names to paths relative to $this->path. + * This map is stored in cache and looked up if the cache is available. + * * @var array */ private $cached_paths = array(); From 0d296785b2364f894f34171d054341cc4979223f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 16:42:53 +0100 Subject: [PATCH 186/325] [feature/extension-manager] Rename default methods to core methods on finder. There are now extension_ and core_ methods for all finder settings as well as a generic method which overwrites both. PHPBB3-10323 --- phpBB/includes/acp/acp_modules.php | 10 +- phpBB/includes/acp/acp_search.php | 8 +- phpBB/includes/captcha/captcha_factory.php | 5 +- phpBB/includes/cron/task/provider.php | 8 +- phpBB/includes/extension/finder.php | 178 ++++++++++++--------- phpBB/includes/functions_module.php | 5 +- tests/extension/finder_test.php | 47 +++--- 7 files changed, 139 insertions(+), 122 deletions(-) diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index a4e140ecfe..e51b440d4d 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -544,12 +544,10 @@ class acp_modules $finder = $phpbb_extension_manager->get_finder(); $modules = $finder - ->suffix('_module') - ->directory("/$module_class") - ->default_path("includes/$module_class/info/") - ->default_suffix('') - ->default_prefix($module_class . '_') - ->default_directory('') + ->extension_suffix('_module') + ->extension_directory("/$module_class") + ->core_path("includes/$module_class/info/") + ->core_prefix($module_class . '_') ->get_classes(); foreach ($modules as $module) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 0c34d02ac7..049a70647f 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -559,11 +559,9 @@ class acp_search $finder = $phpbb_extension_manager->get_finder(); return $finder - ->suffix('_backend') - ->directory('/search') - ->default_path('includes/search/') - ->default_suffix('') - ->default_directory('') + ->extension_suffix('_backend') + ->extension_directory('/search') + ->core_path('includes/search/') ->get_classes(); /* diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 2779a23d34..e039e92054 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -68,10 +68,9 @@ class phpbb_captcha_factory $finder = $phpbb_extension_manager->get_finder(); $captcha_plugin_classes = $finder - ->directory('/captcha') + ->extension_directory('/captcha') ->suffix('_plugin') - ->default_path('includes/captcha/plugins/') - ->default_directory('') + ->core_path('includes/captcha/plugins/') ->get_classes(); foreach ($captcha_plugin_classes as $class) diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php index 3f07bac051..e6ae0f75ec 100644 --- a/phpBB/includes/cron/task/provider.php +++ b/phpBB/includes/cron/task/provider.php @@ -40,11 +40,9 @@ class phpbb_cron_task_provider extends phpbb_extension_provider $finder = $this->extension_manager->get_finder(); return $finder - ->suffix('_task') - ->directory('/cron') - ->default_path('includes/cron/task/core/') - ->default_suffix('') - ->default_directory('') + ->extension_suffix('_task') + ->extension_directory('/cron') + ->core_path('includes/cron/task/core/') ->get_classes(); } } diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index f3a9900a67..5850ebe406 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -62,112 +62,163 @@ class phpbb_extension_finder $this->cache_name = $cache_name; $this->query = array( - 'default_path' => false, - 'default_suffix' => false, - 'default_prefix' => false, - 'default_directory' => false, - 'suffix' => false, - 'prefix' => false, - 'directory' => false, + 'core_path' => false, + 'core_suffix' => false, + 'core_prefix' => false, + 'core_directory' => false, + 'extension_suffix' => false, + 'extension_prefix' => false, + 'extension_directory' => false, ); $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; } /** - * Sets a default path to be searched in addition to extensions + * Sets a core path to be searched in addition to extensions * - * @param string $default_path The path relative to phpbb_root_path + * @param string $core_path The path relative to phpbb_root_path * @return phpbb_extension_finder This object for chaining calls */ - public function default_path($default_path) + public function core_path($core_path) { - $this->query['default_path'] = $default_path; + $this->query['core_path'] = $core_path; return $this; } /** - * Sets a suffix all files found in extensions must match. + * Sets the suffix all files found in extensions and core must match. * * There is no default file extension, so to find PHP files only, you will * have to specify .php as a suffix. However when using get_classes, the .php * file extension is automatically added to suffixes. * - * Automatically sets the default_suffix if its value does not differ from - * the current suffix. - * * @param string $suffix A filename suffix * @return phpbb_extension_finder This object for chaining calls */ public function suffix($suffix) { - if ($this->query['default_suffix'] === $this->query['suffix']) - { - $this->query['default_suffix'] = $suffix; - } - - $this->query['suffix'] = $suffix; + $this->core_suffix($suffix); + $this->extension_suffix($suffix); return $this; } /** - * Sets a suffix all files found in the default path must match + * Sets a suffix all files found in extensions must match * * There is no default file extension, so to find PHP files only, you will * have to specify .php as a suffix. However when using get_classes, the .php * file extension is automatically added to suffixes. * - * @param string $default_suffix A filename suffix + * @param string $extension_suffix A filename suffix * @return phpbb_extension_finder This object for chaining calls */ - public function default_suffix($default_suffix) + public function extension_suffix($extension_suffix) { - $this->query['default_suffix'] = $default_suffix; + $this->query['extension_suffix'] = $extension_suffix; return $this; } /** - * Sets a prefix all files found in extensions must match + * Sets a suffix all files found in the core path must match * - * Automatically sets the default_prefix if its value does not differ from - * the current prefix. + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $core_suffix A filename suffix + * @return phpbb_extension_finder This object for chaining calls + */ + public function core_suffix($core_suffix) + { + $this->query['core_suffix'] = $core_suffix; + return $this; + } + + /** + * Sets the prefix all files found in extensions and core must match * * @param string $prefix A filename prefix * @return phpbb_extension_finder This object for chaining calls */ public function prefix($prefix) { - if ($this->query['default_prefix'] === $this->query['prefix']) - { - $this->query['default_prefix'] = $prefix; - } - - $this->query['prefix'] = $prefix; + $this->core_prefix($prefix); + $this->extension_prefix($prefix); return $this; } /** - * Sets a prefix all files found in the default path must match + * Sets a prefix all files found in extensions must match * - * @param string $default_prefix A filename prefix + * @param string $extension_prefix A filename prefix * @return phpbb_extension_finder This object for chaining calls */ - public function default_prefix($default_prefix) + public function extension_prefix($extension_prefix) { - $this->query['default_prefix'] = $default_prefix; + $this->query['extension_prefix'] = $extension_prefix; return $this; } /** - * Sets a directory all files found in extensions must be contained in + * Sets a prefix all files found in the core path must match * - * Automatically sets the default_directory if its value does not differ from + * @param string $core_prefix A filename prefix + * @return phpbb_extension_finder This object for chaining calls + */ + public function core_prefix($core_prefix) + { + $this->query['core_prefix'] = $core_prefix; + return $this; + } + + /** + * Sets a directory all files found in extensions and core must be contained in + * + * Automatically sets the core_directory if its value does not differ from * the current directory. * * @param string $directory * @return phpbb_extension_finder This object for chaining calls */ public function directory($directory) + { + $this->core_directory($directory); + $this->extension_directory($directory); + return $this; + } + + /** + * Sets a directory all files found in extensions must be contained in + * + * @param string $extension_directory + * @return phpbb_extension_finder This object for chaining calls + */ + public function extension_directory($extension_directory) + { + $this->query['extension_directory'] = $this->sanitise_directory($extension_directory); + return $this; + } + + /** + * Sets a directory all files found in the core path must be contained in + * + * @param string $core_directory + * @return phpbb_extension_finder This object for chaining calls + */ + public function core_directory($core_directory) + { + $this->query['core_directory'] = $this->sanitise_directory($core_directory); + return $this; + } + + /** + * Removes occurances of /./ and makes sure path ends without trailing slash + * + * @param string $directory A directory pattern + * @return string A cleaned up directory pattern + */ + protected function sanitise_directory($directory) { $directory = preg_replace('#(?:^|/)\./#', '/', $directory); $dir_len = strlen($directory); @@ -177,30 +228,7 @@ class phpbb_extension_finder $directory = substr($directory, 0, -1); } - if ($this->query['default_directory'] === $this->query['directory']) - { - $this->query['default_directory'] = $directory; - } - - $this->query['directory'] = $directory; - return $this; - } - - /** - * Sets a directory all files found in the default path must be contained in - * - * @param string $default_directory - * @return phpbb_extension_finder This object for chaining calls - */ - public function default_directory($default_directory) - { - if (strlen($default_directory) > 1 && $default_directory[strlen($default_directory) - 1] === '/') - { - $default_directory = substr($default_directory, 0, -1); - } - - $this->query['default_directory'] = $default_directory; - return $this; + return $directory; } /** @@ -216,8 +244,8 @@ class phpbb_extension_finder */ public function get_classes($cache = true) { - $this->query['suffix'] .= $this->phpEx; - $this->query['default_suffix'] .= $this->phpEx; + $this->query['extension_suffix'] .= $this->phpEx; + $this->query['core_suffix'] .= $this->phpEx; $files = $this->find($cache, false); @@ -296,9 +324,9 @@ class phpbb_extension_finder $extensions = $this->extension_manager->all_enabled(); - if ($this->query['default_path']) + if ($this->query['core_path']) { - $extensions['/'] = $this->phpbb_root_path . $this->query['default_path']; + $extensions['/'] = $this->phpbb_root_path . $this->query['core_path']; } foreach ($extensions as $name => $path) @@ -312,19 +340,19 @@ class phpbb_extension_finder if ($name === '/') { - $location = $this->query['default_path']; + $location = $this->query['core_path']; $name = ''; - $suffix = $this->query['default_suffix']; - $prefix = $this->query['default_prefix']; - $directory = $this->query['default_directory']; + $suffix = $this->query['core_suffix']; + $prefix = $this->query['core_prefix']; + $directory = $this->query['core_directory']; } else { $location = 'ext/'; $name .= '/'; - $suffix = $this->query['suffix']; - $prefix = $this->query['prefix']; - $directory = $this->query['directory']; + $suffix = $this->query['extension_suffix']; + $prefix = $this->query['extension_prefix']; + $directory = $this->query['extension_directory']; } // match only first directory if leading slash is given diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index ce49c3a798..1f451d392d 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -873,9 +873,8 @@ class p_master $lang_files = $finder ->prefix('info_' . strtolower($module_class) . '_') ->suffix(".$phpEx") - ->directory('/language/' . $user->lang_name) - ->default_path('language/' . $user->lang_name . '/mods/') - ->default_directory('') + ->extension_directory('/language/' . $user->lang_name) + ->core_path('language/' . $user->lang_name . '/mods/') ->find(); foreach ($lang_files as $lang_file => $ext_name) diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 26dd50ed12..03615bbfc0 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -38,9 +38,8 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_suffix_get_classes() { $classes = $this->finder - ->default_path('includes/default/') - ->suffix('_class') - ->default_suffix('') + ->core_path('includes/default/') + ->extension_suffix('_class') ->get_classes(); sort($classes); @@ -84,9 +83,8 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_prefix_get_classes() { $classes = $this->finder - ->default_path('includes/default/') - ->prefix('hidden_') - ->default_prefix('') + ->core_path('includes/default/') + ->extension_prefix('hidden_') ->get_classes(); sort($classes); @@ -102,9 +100,8 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_directory_get_classes() { $classes = $this->finder - ->default_path('includes/default/') - ->directory('type') - ->default_directory('') + ->core_path('includes/default/') + ->extension_directory('type') ->get_classes(); sort($classes); @@ -161,13 +158,13 @@ class phpbb_extension_finder_test extends phpbb_test_case ); $query = array( - 'default_path' => false, - 'default_suffix' => '_class.php', - 'default_prefix' => false, - 'default_directory' => false, - 'suffix' => '_class.php', - 'prefix' => false, - 'directory' => false, + 'core_path' => false, + 'core_suffix' => '_class.php', + 'core_prefix' => false, + 'core_directory' => false, + 'extension_suffix' => '_class.php', + 'extension_prefix' => false, + 'extension_directory' => false, 'is_dir' => false, ); @@ -179,13 +176,13 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_cached_get_files() { $query = array( - 'default_path' => 'includes/foo', - 'default_suffix' => false, - 'default_prefix' => false, - 'default_directory' => 'bar', - 'suffix' => false, - 'prefix' => false, - 'directory' => false, + 'core_path' => 'includes/foo', + 'core_suffix' => false, + 'core_prefix' => false, + 'core_directory' => 'bar', + 'extension_suffix' => false, + 'extension_prefix' => false, + 'extension_directory' => false, 'is_dir' => false, ); @@ -196,8 +193,8 @@ class phpbb_extension_finder_test extends phpbb_test_case ))); $classes = $finder - ->default_path($query['default_path']) - ->default_directory($query['default_directory']) + ->core_path($query['core_path']) + ->core_directory($query['core_directory']) ->get_files(); sort($classes); From 0c443a089c9884fc18566e8d184a199a0c03eb43 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 17:09:53 +0100 Subject: [PATCH 187/325] [feature/extension-manager] Reference correct new module basenames in install PHPBB3-10323 --- phpBB/install/install_install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 5ea3525edd..038a409c8f 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1604,7 +1604,7 @@ class install_install extends module // Move main module 4 up... $sql = 'SELECT * FROM ' . MODULES_TABLE . " - WHERE module_basename = 'main' + WHERE module_basename = 'acp_main' AND module_class = 'acp' AND module_mode = 'main'"; $result = $db->sql_query($sql); @@ -1616,7 +1616,7 @@ class install_install extends module // Move permissions intro screen module 4 up... $sql = 'SELECT * FROM ' . MODULES_TABLE . " - WHERE module_basename = 'permissions' + WHERE module_basename = 'acp_permissions' AND module_class = 'acp' AND module_mode = 'intro'"; $result = $db->sql_query($sql); @@ -1628,7 +1628,7 @@ class install_install extends module // Move manage users screen module 5 up... $sql = 'SELECT * FROM ' . MODULES_TABLE . " - WHERE module_basename = 'users' + WHERE module_basename = 'acp_users' AND module_class = 'acp' AND module_mode = 'overview'"; $result = $db->sql_query($sql); @@ -1643,7 +1643,7 @@ class install_install extends module // Move attachment module 4 down... $sql = 'SELECT * FROM ' . MODULES_TABLE . " - WHERE module_basename = 'attachments' + WHERE module_basename = 'ucp_attachments' AND module_class = 'ucp' AND module_mode = 'attachments'"; $result = $db->sql_query($sql); From 21117c69f313929d23592e3e705de3e4974afaa0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 17:30:23 +0100 Subject: [PATCH 188/325] [feature/extension-manager] Add documentation on caching in ext finder PHPBB3-10323 --- phpBB/includes/extension/finder.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 5850ebe406..a1e6b2b347 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -26,6 +26,13 @@ class phpbb_extension_finder protected $phpbb_root_path; protected $cache; protected $phpEx; + + /** + * The cache variable name used to store $this->cached_queries in $this->cache. + * + * Allows the use of multiple differently configured finders with the same cache. + * @var string + */ protected $cache_name; /** From 5068c0588733f80a8433aea1cd6f763819caa9f7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 18:15:39 +0100 Subject: [PATCH 189/325] [feature/extension-manager] Split disabling extensions up into steps as well PHPBB3-10323 --- phpBB/includes/extension/base.php | 10 ++++-- phpBB/includes/extension/interface.php | 7 ++-- phpBB/includes/extension/manager.php | 46 ++++++++++++++++++++++---- tests/extension/ext/foo/ext.php | 8 +++++ tests/extension/manager_test.php | 5 +++ 5 files changed, 65 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php index fed120c51b..d9159d57d2 100644 --- a/phpBB/includes/extension/base.php +++ b/phpBB/includes/extension/base.php @@ -25,6 +25,7 @@ class phpbb_extension_base implements phpbb_extension_interface /** * Single enable step that does nothing * + * @param mixed $old_state State returned by previous call of this method * @return false Indicates no further steps are required */ public function enable_step($old_state) @@ -33,17 +34,20 @@ class phpbb_extension_base implements phpbb_extension_interface } /** - * Empty disable method + * Single disable step that does nothing * - * @return null + * @param mixed $old_state State returned by previous call of this method + * @return false Indicates no further steps are required */ - public function disable() + public function disable_step($old_state) { + return false; } /** * Single purge step that does nothing * + * @param mixed $old_state State returned by previous call of this method * @return false Indicates no further steps are required */ public function purge_step($old_state) diff --git a/phpBB/includes/extension/interface.php b/phpBB/includes/extension/interface.php index 7d0ecd72c7..b37cd24d77 100644 --- a/phpBB/includes/extension/interface.php +++ b/phpBB/includes/extension/interface.php @@ -40,11 +40,14 @@ interface phpbb_extension_interface /** * Disables the extension. * - * Must be a quick operation, that finishes within max_execution_time. + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call * @return null */ - public function disable(); + public function disable_step($old_state); /** * purge_step is executed on purging an extension until it returns false. diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 29cd89fb34..bcdd21f7f1 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -128,7 +128,7 @@ class phpbb_extension_manager * in the extensions table. * * @param string $name The extension's name - * @return bool Whether another run of enable_step is required + * @return bool False if enabling is finished, true otherwise */ public function enable_step($name) { @@ -191,18 +191,36 @@ class phpbb_extension_manager * process the event. * * @param string $name The extension's name - * @return null + * @return bool False if disabling is finished, true otherwise */ - public function disable($name) + public function disable_step($name) { // ignore extensions that are already disabled if (!isset($this->extensions[$name]) || !$this->extensions[$name]['ext_active']) { - return; + return false; } + $old_state = unserialize($this->extensions[$name]['ext_state']); + $extension = $this->get_extension($name); - $extension->disable(); + $state = $extension->disable_step($old_state); + + // continue until the state is false + if ($state !== false) + { + $extension_data = array( + 'ext_state' => serialize($state), + ); + $this->extensions[$name]['ext_state'] = serialize($state); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + return true; + } $extension_data = array( 'ext_active' => false, @@ -215,6 +233,22 @@ class phpbb_extension_manager SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; $this->db->sql_query($sql); + + return false; + } + + /** + * Disables an extension + * + * Disables an extension completely at once. This process could run for a + * while so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function disable($name) + { + while ($this->disable_step($name)); } /** @@ -224,7 +258,7 @@ class phpbb_extension_manager * extension's meta class to delete the extension's database content. * * @param string $name The extension's name - * @return null + * @return bool False if purging is finished, true otherwise */ public function purge_step($name) { diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/foo/ext.php index 2968a64a97..60b3ad1f16 100644 --- a/tests/extension/ext/foo/ext.php +++ b/tests/extension/ext/foo/ext.php @@ -2,4 +2,12 @@ class phpbb_ext_foo_ext extends phpbb_extension_base { + static public $disabled; + + public function disable_step($old_state) + { + self::$disabled = true; + + return false; + } } diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index ba7f227a56..891f1b287a 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -9,6 +9,7 @@ require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/ext/bar/ext.php'; +require_once dirname(__FILE__) . '/ext/foo/ext.php'; require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php'; class phpbb_extension_manager_test extends phpbb_database_test_case @@ -63,10 +64,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_disable() { + phpbb_ext_foo_ext::$disabled = false; + $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->extension_manager->disable('foo'); $this->assertEquals(array(), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + + $this->assertTrue(phpbb_ext_foo_ext::$disabled); } public function test_purge() From 5f48f55cca5d0a6a2c51cdcc8a60b475354f50b1 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 19:57:20 +0100 Subject: [PATCH 190/325] [feature/extension-manager] Removing now unused acp_search code PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 049a70647f..ab604cd7cd 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -563,28 +563,6 @@ class acp_search ->extension_directory('/search') ->core_path('includes/search/') ->get_classes(); - -/* - $search_types = array(); - - $dp = @opendir($phpbb_root_path . 'includes/search'); - - if ($dp) - { - while (($file = readdir($dp)) !== false) - { - if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx")) - { - $search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } - closedir($dp); - - sort($search_types); - } - - return $search_types; -*/ } function get_max_post_id() From 4fae5eef6829b997e39099e561cb88cb5d248ff8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 13 Oct 2011 19:25:15 +0200 Subject: [PATCH 191/325] [ticket/9776] Delete poll if no poll options were submitted. PHPBB3-9776 --- phpBB/includes/functions_posting.php | 8 ++++---- phpBB/posting.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index a641afbaed..77d92e26e2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1870,9 +1870,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'edit_topic': case 'edit_first_post': - if (isset($poll['poll_options']) && !empty($poll['poll_options'])) + if (isset($poll['poll_options'])) { - $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time; + $poll_start = ($poll['poll_start'] || empty($poll['poll_options'])) ? $poll['poll_start'] : $current_time; $poll_length = $poll['poll_length'] * 86400; if ($poll_length < 0) { @@ -2075,11 +2075,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Update Poll Tables - if (isset($poll['poll_options']) && !empty($poll['poll_options'])) + if (isset($poll['poll_options'])) { $cur_poll_options = array(); - if ($poll['poll_start'] && $mode == 'edit') + if ($mode == 'edit') { $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . ' diff --git a/phpBB/posting.php b/phpBB/posting.php index 1bc498efe7..ea3b53e939 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -904,6 +904,23 @@ if ($submit || $preview || $refresh) $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; }*/ } + else if ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id)) + { + // The user removed all poll options, this is equal to deleting the poll. + $poll = array( + 'poll_title' => '', + 'poll_length' => 0, + 'poll_max_options' => 0, + 'poll_option_text' => '', + 'poll_start' => 0, + 'poll_last_vote' => 0, + 'poll_vote_change' => 0, + 'poll_options' => array(), + ); + + $post_data['poll_options'] = $post_data['poll_title'] = ''; + $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; + } else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != '')) { // We have a poll but the editing user is not permitted to create/edit it. From 810016ce944a0fbec70187c9d87c9124ecdccb3a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 18 Nov 2011 21:29:02 +0000 Subject: [PATCH 192/325] [ticket/10239] Correct undefined variable error. PHPBB3-10239 --- phpBB/includes/acp/acp_database.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 1bf10b0e57..62bcd43a47 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -221,6 +221,7 @@ class acp_database case 'submit': $delete = request_var('delete', ''); $file = request_var('file', ''); + $download = request_var('download', ''); if (!preg_match('#^backup_\d{10,}_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) { @@ -249,8 +250,6 @@ class acp_database } else if ($download || confirm_box(true)) { - $download = request_var('download', ''); - if ($download) { $name = $matches[0]; From eb1f15bc8b7b7a284b25b2c9b9942714b6848ebc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 12 Nov 2011 14:59:11 +0100 Subject: [PATCH 193/325] [ticket/8996] Also fix the BBCode bug in subsilver2 and acp --- phpBB/adm/style/editor.js | 68 ++++++++------- phpBB/styles/prosilver/template/editor.js | 61 +++++++------- phpBB/styles/subsilver2/template/editor.js | 96 +++++++++++----------- 3 files changed, 117 insertions(+), 108 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 217aa699e2..600fa254cf 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; if(document.forms[form_name]) @@ -66,7 +66,7 @@ function bbstyle(bbnumber) else { insert_text('[*]'); - document.forms[form_name].elements[text_name].focus(); + document.forms[form_name].elements[text_name].focus(); } } @@ -76,7 +76,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -84,14 +84,10 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - theSelection = document.selection.createRange().text; - - if (theSelection) + if (textarea.createTextRange && textarea.caretPos) { - // Add tags around selection - document.selection.createRange().text = bbopen + theSelection + bbclose; - document.forms[form_name].elements[text_name].focus(); - theSelection = ''; + textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; + textarea.focus(); return; } } @@ -102,10 +98,10 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; - var new_pos = caret_pos + bbopen.length; + var new_pos = caret_pos + bbopen.length; // Open tag insert_text(bbopen + bbclose); @@ -116,12 +112,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", bbopen.length); range.select(); storeCaret(textarea); } @@ -136,7 +132,7 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - + if (!popup) { textarea = document.forms[form_name].elements[text_name]; @@ -159,18 +155,18 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } - + } + else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); } var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; - + } else { @@ -233,7 +229,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(//ig, '\n'); theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); - theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/&\;/ig, '&'); theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) @@ -268,7 +264,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -292,7 +288,17 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - if (textEl.createTextRange) + var keyCode = false; + if (is_ie) + { + keyCode = (event.keyCode) ? event.keyCode : event.charCode; + } + + // Did the user press Shift (16), Ctrl (17) or Alt (18)? + // If so, we do not update the caretPos, so BBCodes can still be applied correctly. + var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); + + if ((!is_ie || !is_control_key) && (textEl.createTextRange)) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -328,7 +334,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -368,9 +374,9 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (txtarea.selectionStart || txtarea.selectionStart == 0) + if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; @@ -384,19 +390,19 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; - caretPos.end = txtarea.sel_start; + caretPos.end = txtarea.sel_start; } return caretPos; diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 957c39b568..5aa486d320 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -37,7 +37,7 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -86,10 +86,10 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - textarea = document.forms[form_name].elements[text_name]; if (textarea.createTextRange && textarea.caretPos) { textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; + textarea.focus(); return; } } @@ -100,7 +100,7 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; var new_pos = caret_pos + bbopen.length; @@ -114,12 +114,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -134,16 +134,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -161,7 +161,7 @@ function insert_text(text, spaces, popup) } else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); @@ -174,7 +174,7 @@ function insert_text(text, spaces, popup) { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); } @@ -291,7 +291,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -319,7 +319,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -351,7 +351,9 @@ function storeCaret(textEl) // Did the user press Shift (16), Ctrl (17) or Alt (18)? // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - if ((!is_ie || (keyCode != 16 && keyCode != 17 && keyCode != 18)) && (textEl.createTextRange)) + var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); + + if ((!is_ie || !is_control_key) && (textEl.createTextRange)) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -387,7 +389,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -427,33 +429,32 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if(!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if(document.selection) + else if (document.selection) { - // get current selection var range = document.selection.createRange(); // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; caretPos.end = txtarea.sel_start; diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 7cc5de9034..5aa486d320 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -6,8 +6,8 @@ // Startup variables var imageTag = false; var theSelection = false; -var bbcodeEnabled = true; +var bbcodeEnabled = true; // Check for Browser & Platform for PC & IE specific bits // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html var clientPC = navigator.userAgent.toLowerCase(); // Get client info @@ -15,7 +15,6 @@ var clientVer = parseInt(navigator.appVersion); // Get browser version var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1)); var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); - var baseHeight; /** @@ -29,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -38,14 +37,15 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } var textarea = doc.forms[form_name].elements[text_name]; + if (is_ie && typeof(baseHeight) != 'number') - { + { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -78,7 +78,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -86,14 +86,10 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - theSelection = document.selection.createRange().text; - - if (theSelection) + if (textarea.createTextRange && textarea.caretPos) { - // Add tags around selection - document.selection.createRange().text = bbopen + theSelection + bbclose; - document.forms[form_name].elements[text_name].focus(); - theSelection = ''; + textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; + textarea.focus(); return; } } @@ -104,7 +100,7 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; var new_pos = caret_pos + bbopen.length; @@ -118,12 +114,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -138,16 +134,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -162,28 +158,26 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } - + } else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); - } + } + var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; - } else { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); - } - + } } /** @@ -279,7 +273,6 @@ function addquote(post_id, username, l_wrote) return; } - function split_lines(text) { var lines = text.split('\n'); @@ -298,7 +291,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -316,7 +309,6 @@ function split_lines(text) } return splitLines; } - /** * From http://www.massless.org/mozedit/ */ @@ -327,7 +319,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -351,7 +343,17 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - if (textEl.createTextRange) + var keyCode = false; + if (is_ie) + { + keyCode = (event.keyCode) ? event.keyCode : event.charCode; + } + + // Did the user press Shift (16), Ctrl (17) or Alt (18)? + // If so, we do not update the caretPos, so BBCodes can still be applied correctly. + var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); + + if ((!is_ie || !is_control_key) && (textEl.createTextRange)) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -387,7 +389,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -427,15 +429,15 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if(txtarea.selectionStart || txtarea.selectionStart == 0) + if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if(document.selection) + else if (document.selection) { // get current selection var range = document.selection.createRange(); @@ -443,16 +445,16 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; caretPos.end = txtarea.sel_start; From 658db65cb477b790f217e0b8c6d202fbb1a8836c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 19 Nov 2011 22:04:43 +0100 Subject: [PATCH 194/325] [ticket/10323] make finder work with PHP 5.2 PHPBB3-10323 --- phpBB/includes/extension/finder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index a1e6b2b347..11eb682f46 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -377,9 +377,14 @@ class phpbb_extension_finder } $directory_pattern = '#' . $directory_pattern . '#'; - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST); + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { + if (in_array($file_info, array('.', '..'))) + { + continue; + } + if ($file_info->isDir() == $is_dir) { if ($is_dir) From 813b5344e6fa245f174692de71a4fb44f239786d Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 20 Nov 2011 02:08:37 +0100 Subject: [PATCH 195/325] [ticket/10323] slight potential performance improvement PHPBB3-10323 --- phpBB/includes/extension/finder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php index 11eb682f46..f4a0b7a371 100644 --- a/phpBB/includes/extension/finder.php +++ b/phpBB/includes/extension/finder.php @@ -380,7 +380,8 @@ class phpbb_extension_finder $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { - if (in_array($file_info, array('.', '..'))) + $filename = $file_info->getFilename(); + if ($filename == '.' || $filename == '..') { continue; } @@ -389,7 +390,7 @@ class phpbb_extension_finder { if ($is_dir) { - $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($file_info->getFilename()) . DIRECTORY_SEPARATOR; + $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; if ($relative_path[0] !== DIRECTORY_SEPARATOR) { $relative_path = DIRECTORY_SEPARATOR . $relative_path; @@ -399,10 +400,9 @@ class phpbb_extension_finder { $relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname(); } - $item_name = $file_info->getFilename(); if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && - (!$prefix || substr($item_name, 0, strlen($prefix)) === $prefix) && + (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && (!$directory || preg_match($directory_pattern, $relative_path))) { $files[str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1))] = $ext_name; From 64d62038cd8e2e69eb101c5256ea458cff98ae10 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 20 Nov 2011 04:15:44 -0500 Subject: [PATCH 196/325] [ticket/10446] DRY X-AntiAbuse header addition. PHPBB3-10446 --- phpBB/includes/acp/acp_email.php | 5 +---- phpBB/includes/acp/acp_inactive.php | 10 ++-------- phpBB/includes/acp/acp_users.php | 10 ++-------- phpBB/includes/functions_messenger.php | 12 ++++++++++++ phpBB/includes/ucp/ucp_activate.php | 5 +---- phpBB/includes/ucp/ucp_profile.php | 5 +---- phpBB/includes/ucp/ucp_register.php | 9 +++------ phpBB/includes/ucp/ucp_resend.php | 10 ++-------- phpBB/install/install_install.php | 5 +---- phpBB/memberlist.php | 5 +---- 10 files changed, 26 insertions(+), 50 deletions(-) diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index e98b7a19a5..29d6903691 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -195,10 +195,7 @@ class acp_email $messenger->template('admin_send_email', $used_lang); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index c93cbc457f..a4b2a3ca2f 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -118,10 +118,7 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username'])) @@ -209,10 +206,7 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index abf1481000..590103d519 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -348,10 +348,7 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), @@ -406,10 +403,7 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username'])) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 08c686d9e3..04b2502210 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -162,6 +162,18 @@ class messenger $this->extra_headers[] = trim($headers); } + /** + * Adds X-AntiAbuse headers + */ + function anti_abuse_headers($headers) + { + global $config, $user; + $this->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $this->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $this->headers('X-AntiAbuse: User IP - ' . $user->ip); + } + /** * Set the email priority */ diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index b00c1b9f52..a1468895a9 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -117,10 +117,7 @@ class ucp_activate $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username'])) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 65b32bd0c4..03a0e3d746 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -150,10 +150,7 @@ class ucp_profile $messenger->to($data['email'], $data['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 13b9945851..e3e719d63c 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -155,8 +155,8 @@ class ucp_register $this->tpl_name = 'ucp_agreement'; return; } - - + + // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. if ($config['enable_confirm']) { @@ -366,10 +366,7 @@ class ucp_register $messenger->to($data['email'], $data['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 39e9be24a1..c1f9effb01 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -94,10 +94,7 @@ class ucp_resend $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), @@ -133,10 +130,7 @@ class ucp_resend $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index ccdcf211f1..4a988bb80a 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1945,10 +1945,7 @@ class install_install extends module $messenger->to($data['board_email1'], $data['admin_name']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['admin_name']), diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 8169ee7a3e..f3af8fd44c 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -899,10 +899,7 @@ switch ($mode) $notify_type = NOTIFY_EMAIL; } - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); - $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); - $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->anti_abuse_headers(); $messenger->assign_vars(array( 'BOARD_CONTACT' => $config['board_contact'], From c68973a9e04c51e4a2eeec9c3276c9a89baa09e5 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 20 Nov 2011 04:17:42 -0500 Subject: [PATCH 197/325] [ticket/10446] RFC2047 encode user/server names in X-AntiAbuse headers. PHPBB3-10446 --- phpBB/includes/functions_messenger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 04b2502210..a2ad51a42e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -168,9 +168,9 @@ class messenger function anti_abuse_headers($headers) { global $config, $user; - $this->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $this->headers('X-AntiAbuse: Board servername - ' . mail_encode($config['server_name'])); $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); - $this->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $this->headers('X-AntiAbuse: Username - ' . mail_encode($user->data['username'])); $this->headers('X-AntiAbuse: User IP - ' . $user->ip); } From a7077c91495521a8015a2e1dbbe587b2d97a8edc Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Nov 2011 14:02:22 +0100 Subject: [PATCH 198/325] [ticket/10446] Remove leftover $headers parameter from anti_abuse_headers(). PHPBB3-10446 --- phpBB/includes/functions_messenger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index a2ad51a42e..9087b1c8aa 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -165,9 +165,10 @@ class messenger /** * Adds X-AntiAbuse headers */ - function anti_abuse_headers($headers) + function anti_abuse_headers() { global $config, $user; + $this->headers('X-AntiAbuse: Board servername - ' . mail_encode($config['server_name'])); $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $this->headers('X-AntiAbuse: Username - ' . mail_encode($user->data['username'])); From 37c766819346b830cf184fdfae9407006a621b17 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Nov 2011 16:35:31 +0100 Subject: [PATCH 199/325] [ticket/10446] Pass $config and $user via parameter to anti_abuse_headers(). PHPBB3-10446 --- phpBB/includes/acp/acp_email.php | 2 +- phpBB/includes/acp/acp_inactive.php | 4 ++-- phpBB/includes/acp/acp_users.php | 4 ++-- phpBB/includes/functions_messenger.php | 9 ++++++--- phpBB/includes/ucp/ucp_activate.php | 2 +- phpBB/includes/ucp/ucp_profile.php | 2 +- phpBB/includes/ucp/ucp_register.php | 2 +- phpBB/includes/ucp/ucp_resend.php | 4 ++-- phpBB/install/install_install.php | 2 +- phpBB/memberlist.php | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 29d6903691..df0d44c0c5 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -195,7 +195,7 @@ class acp_email $messenger->template('admin_send_email', $used_lang); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index a4b2a3ca2f..f3f332d707 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -118,7 +118,7 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username'])) @@ -206,7 +206,7 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 590103d519..4f58434a43 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -348,7 +348,7 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), @@ -403,7 +403,7 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username'])) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 9087b1c8aa..91b361183c 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -164,11 +164,14 @@ class messenger /** * Adds X-AntiAbuse headers + * + * @param array $config Configuration array + * @param user $user A user object + * + * @return null */ - function anti_abuse_headers() + function anti_abuse_headers($config, $user) { - global $config, $user; - $this->headers('X-AntiAbuse: Board servername - ' . mail_encode($config['server_name'])); $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $this->headers('X-AntiAbuse: Username - ' . mail_encode($user->data['username'])); diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index a1468895a9..82c1937919 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -117,7 +117,7 @@ class ucp_activate $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username'])) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 03a0e3d746..d35d13b6c1 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -150,7 +150,7 @@ class ucp_profile $messenger->to($data['email'], $data['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index e3e719d63c..4e8729db56 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -366,7 +366,7 @@ class ucp_register $messenger->to($data['email'], $data['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index c1f9effb01..4d181dba49 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -94,7 +94,7 @@ class ucp_resend $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), @@ -130,7 +130,7 @@ class ucp_resend $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4a988bb80a..8b073df44c 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1945,7 +1945,7 @@ class install_install extends module $messenger->to($data['board_email1'], $data['admin_name']); - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['admin_name']), diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index f3af8fd44c..b3c0bae16a 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -899,7 +899,7 @@ switch ($mode) $notify_type = NOTIFY_EMAIL; } - $messenger->anti_abuse_headers(); + $messenger->anti_abuse_headers($config, $user); $messenger->assign_vars(array( 'BOARD_CONTACT' => $config['board_contact'], From 06ae98b1e557661528f53be08244f6fa7338d9b6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Nov 2011 21:41:24 +0100 Subject: [PATCH 200/325] [develop-olympus] Bumping version numbers to final for 3.0.10 releases. --- phpBB/docs/INSTALL.html | 4 ++-- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/styles/prosilver/imageset/imageset.cfg | 2 +- phpBB/styles/prosilver/style.cfg | 2 +- phpBB/styles/prosilver/template/template.cfg | 2 +- phpBB/styles/prosilver/theme/theme.cfg | 2 +- phpBB/styles/subsilver2/imageset/imageset.cfg | 2 +- phpBB/styles/subsilver2/style.cfg | 2 +- phpBB/styles/subsilver2/template/template.cfg | 2 +- phpBB/styles/subsilver2/theme/theme.cfg | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 3c3ccf9f28..e5ba479d9e 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -274,7 +274,7 @@

    This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.

    -

    This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.8 you should select the phpBB-3.0.8_to_3.0.9.zip/tar.gz file.

    +

    This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.9 you should select the phpBB-3.0.9_to_3.0.10.zip/tar.gz file.

    The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

    @@ -286,7 +286,7 @@

    The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

    -

    A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.8 you need the phpBB-3.0.8_to_3.0.9.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

    +

    A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.9 you need the phpBB-3.0.9_to_3.0.10.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

    If you do get failures you should look at using the Changed files only package to replace the files which failed to patch, please note that you will need to manually re-add any Modifications (MODs) to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.

    diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 789773e349..81cc2f68f3 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -32,7 +32,7 @@ unset($dbpasswd); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.0.9', + 'phpbb_version' => '3.0.10', 'author' => 'phpBB Group', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg index 72252079d6..5a703d9e47 100644 --- a/phpBB/styles/prosilver/imageset/imageset.cfg +++ b/phpBB/styles/prosilver/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.9 +version = 3.0.10 # Images img_site_logo = site_logo.gif*52*139 diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 83e762f65b..95d8d287e4 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.9 \ No newline at end of file +version = 3.0.10 \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index 42383a022f..d31dcb7356 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -19,7 +19,7 @@ # General Information about this template name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.9 +version = 3.0.10 # Defining a different template bitfield template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg index 4270094eab..e8698f7fe4 100644 --- a/phpBB/styles/prosilver/theme/theme.cfg +++ b/phpBB/styles/prosilver/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.9 +version = 3.0.10 # Some configuration options diff --git a/phpBB/styles/subsilver2/imageset/imageset.cfg b/phpBB/styles/subsilver2/imageset/imageset.cfg index d8cfabcb02..75a4aad038 100644 --- a/phpBB/styles/subsilver2/imageset/imageset.cfg +++ b/phpBB/styles/subsilver2/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.9 +version = 3.0.10 # Images img_site_logo = site_logo.gif*94*170 diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 0cdb7204bb..13e44435c6 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Group -version = 3.0.9 +version = 3.0.10 diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 92ccfef35a..4e5c36af99 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -19,5 +19,5 @@ # General Information about this template name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.9 +version = 3.0.10 diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg index 94e2f6d53d..d7837a3766 100644 --- a/phpBB/styles/subsilver2/theme/theme.cfg +++ b/phpBB/styles/subsilver2/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.9 +version = 3.0.10 # Some configuration options From 3e43b53a63743a81b27b53c01d57e4b73d994ae9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Nov 2011 21:50:29 +0100 Subject: [PATCH 201/325] [develop-olympus] Bump version numbers for 3.0.10-RC1 release. --- build/build.xml | 6 +++--- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 8 +++++--- phpBB/install/schemas/schema_data.sql | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build/build.xml b/build/build.xml index eb63bde034..fbc1a91e1b 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - - - + + + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 03b1102602..ec7b8c7123 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-dev'); +define('PHPBB_VERSION', '3.0.10-RC1'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 21246a215e..9ca011c8aa 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-dev'); +define('UPDATES_TO_VERSION', '3.0.10-RC1'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -951,7 +951,7 @@ function database_update_info() // this column was removed from the database updater // after 3.0.9-RC3 was released. It might still exist // in 3.0.9-RCX installations and has to be dropped in - // 3.0.10 after the db_tools class is capable of properly + // 3.0.11 after the db_tools class is capable of properly // removing a primary key. // 'attempt_id' => array('UINT', NULL, 'auto_increment'), 'attempt_ip' => array('VCHAR:40', ''), @@ -985,8 +985,10 @@ function database_update_info() '3.0.9-RC3' => array(), // No changes from 3.0.9-RC4 to 3.0.9 '3.0.9-RC4' => array(), + // No changes from 3.0.9 to 3.0.10-RC1 + '3.0.9' => array(), - /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.10-RC1 */ + /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 84b25d676e..4f5bf23c58 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From f5633d281e04d93f5e4c0e0a01ffc82c9df12a8f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 21 Nov 2011 00:08:49 +0100 Subject: [PATCH 202/325] [develop-olympus] Add changelog for 3.0.10-RC1 --- phpBB/docs/CHANGELOG.html | 162 +++++++++++++++++++++++++++++++++----- 1 file changed, 144 insertions(+), 18 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6437fef1d5..a4ed1b5c86 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
    1. Changelog
        +
      1. Changes since 3.0.9
      2. Changes since 3.0.8
      3. Changes since 3.0.7-PL1
      4. Changes since 3.0.7
      5. @@ -90,7 +91,132 @@
        -

        1.i. Changes since 3.0.8

        +

        1.i. Changes since 3.0.9

        + +

        Bug

        +
          +
        • [PHPBB3-5506] - Deleting all items from last page results in empty list display
        • +
        • [PHPBB3-6458] - Width of Topics and Posts columns in Board Index is causing problems with language packs
        • +
        • [PHPBB3-6632] - Better viewing of topics for wide screen displays
        • +
        • [PHPBB3-7138] - Cannot display simple header/footer with trigger_error()
        • +
        • [PHPBB3-7291] - Broken links of char selection in memberlist
        • +
        • [PHPBB3-7932] - Fix font size in select boxes
        • +
        • [PHPBB3-8094] - Text in the forums.php and install.php not matching
        • +
        • [PHPBB3-8173] - Redundant BBCode helpline in JS
        • +
        • [PHPBB3-8177] - February 29th birthdays not shown in non-leap year
        • +
        • [PHPBB3-8571] - Users can make their age a negative number on memberlist
        • +
        • [PHPBB3-8691] - Error creating log_time index
        • +
        • [PHPBB3-8937] - Code tags - single space indent
        • +
        • [PHPBB3-8996] - Wrong position when adding BBCodes with accesskey in IE
        • +
        • [PHPBB3-9008] - Incorrect unread topic tracking for unapproved topics
        • +
        • [PHPBB3-9066] - Invalid Prefix Names Allowed
        • +
        • [PHPBB3-9416] - HTML entities in poll titles and options incorrectly re-encoded
        • +
        • [PHPBB3-9525] - Minimum characters per post/message should never be '0'
        • +
        • [PHPBB3-9645] - XHTML error on phpinfo page in ACP
        • +
        • [PHPBB3-9776] - When deleting and recreating a poll, old options aren't deleted and reappear with the new ones
        • +
        • [PHPBB3-9956] - No error message displayed when disapprove reason is invalid or empty
        • +
        • [PHPBB3-9976] - Direct post links open the wrong page of viewtopic when multiple posts are posted in the same second
        • +
        • [PHPBB3-9978] - Missing semicolons in // <![CDATA[ part of overall_header.html
        • +
        • [PHPBB3-10087] - Limited browser support for ban exclusion emphasis
        • +
        • [PHPBB3-10157] - Missing error handling when a custom profile field is not defined for current language
        • +
        • [PHPBB3-10166] - Post-admin activation email confusingly refers to username
        • +
        • [PHPBB3-10187] - XHTML error in ucp_groups_manage.html
        • +
        • [PHPBB3-10190] - Misleading information about permissions displayed after editing forum settings
        • +
        • [PHPBB3-10212] - Captcha not displayed when username not exists
        • +
        • [PHPBB3-10216] - Updater's failed query language grammatically incorrect
        • +
        • [PHPBB3-10226] - Mysqli dbal extension does not allow connection via pipes
        • +
        • [PHPBB3-10227] - Mysqli dbal extension does not allow persistent connection for PHP >= 5.3.0
        • +
        • [PHPBB3-10237] - Unwatching a forum/topic does not check for correct hash parameter
        • +
        • [PHPBB3-10240] - Word filter evasion
        • +
        • [PHPBB3-10253] - IE9 Quote problem
        • +
        • [PHPBB3-10255] - gitignore ignores too much
        • +
        • [PHPBB3-10257] - AAAA record parsing fails on older versions of Windows
        • +
        • [PHPBB3-10259] - Incorrect email on joining Open group
        • +
        • [PHPBB3-10265] - Unit test tests/random/mt_rand.php is not run because of missing _test suffix.
        • +
        • [PHPBB3-10266] - Poor navigation links after reporting a post
        • +
        • [PHPBB3-10267] - Missing strlen() on $table_prefix in db tools index name length check
        • +
        • [PHPBB3-10274] - Hardcoded module ID in "Re-check version" link on ACP front page
        • +
        • [PHPBB3-10275] - Wrong information about sent passwords in FAQ
        • +
        • [PHPBB3-10292] - Whitespace inconsistency in acp_ranks
        • +
        • [PHPBB3-10293] - Jumpbox allows jumping to invalid forums in prosilver
        • +
        • [PHPBB3-10294] - sqlsrv_rows_affected non-functional in MSSQLNative.php
        • +
        • [PHPBB3-10296] - incorrect cross join in SQL Server
        • +
        • [PHPBB3-10298] - EMBED Tag Not Closed Properly In subSilver2 attachment.html
        • +
        • [PHPBB3-10299] - Typo in comment about $max_store_length in truncate_string() (in functions_content.php)
        • +
        • [PHPBB3-10303] - send_status_line() doesn't validate user input
        • +
        • [PHPBB3-10304] - Bad url in U_ICQ on /ucp_mp_viewmessage.php
        • +
        • [PHPBB3-10307] - Return value of $db->sql_fetchrow() on empty tables is not consistent
        • +
        • [PHPBB3-10309] - Utf tests download data into temporary locations deep in source tree
        • +
        • [PHPBB3-10320] - "Most active topic" can leak topic title of topics in password-protected forums
        • +
        • [PHPBB3-10321] - Link to page 1 of the Memberlist has a useless question mark at the end
        • +
        • [PHPBB3-10324] - XHTML error in Prosilver - MCP - User Notes
        • +
        • [PHPBB3-10339] - Typo in prosilver's mcp_front.html
        • +
        • [PHPBB3-10341] - Topic title of "0" does not show as "Most active topic"
        • +
        • [PHPBB3-10351] - Invalid syntax for Oracle's sql_column_remove()
        • +
        • [PHPBB3-10352] - Missing break for Oracle's sql_table_drop()
        • +
        • [PHPBB3-10365] - Moderators can view forbidden information
        • +
        • [PHPBB3-10377] - All moderators can change topic type
        • +
        • [PHPBB3-10394] - Tests use call-time pass by reference which results in Fatal error on PHP 5.4
        • +
        • [PHPBB3-10397] - Pagination code inconsistency
        • +
        • [PHPBB3-10400] - '0' (zero) not allowed as forum name
        • +
        • [PHPBB3-10408] - Layout of topics/attachments list is broken in UCP and MCP
        • +
        • [PHPBB3-10413] - Make create_schema_files usable
        • +
        • [PHPBB3-10416] - Use dbport in phpbb_database_test_connection_manager::connect()
        • +
        • [PHPBB3-10420] - Update startup to account for PHP 5.4
        • +
        • [PHPBB3-10421] - Interchanged parameters in includes/acp/acp_users.php
        • +
        • [PHPBB3-10422] - Unnecessary <!-- IF --> statement in viewtopic_body.html
        • +
        • [PHPBB3-10435] - Topic count mismatch on viewforum
        • +
        • [PHPBB3-10437] - Announcements on moderation queue are not hidden
        • +
        • [PHPBB3-10446] - Unencoded 8bit characters in email headers
        • +
        • [PHPBB3-10452] - XHTML error when printing a PM
        • +
        +

        Improvement

        +
          +
        • [PHPBB3-8616] - Add direct link to PM to notification message
        • +
        • [PHPBB3-9036] - Forums that can be listed but not red expose forum information
        • +
        • [PHPBB3-9297] - Add support for Extended Passive Mode (EPSV) in class ftp_fsock to better support IPv6 connections.
        • +
        • [PHPBB3-9307] - Mass email $max_chunk_size
        • +
        • [PHPBB3-9361] - Edit account settings - Improved clarification needed
        • +
        • [PHPBB3-9778] - Member Search from the Admin Control Panel is not Intuitive
        • +
        • [PHPBB3-9898] - Readme needs updating to reflect more opening for patches
        • +
        • [PHPBB3-9995] - Unnecessary coding in display_forums() in functions_display.php
        • +
        • [PHPBB3-10032] - BBCode Add List Item Control Name Contains Typo
        • +
        • [PHPBB3-10074] - Change default value of 'Set as special rank' to No for Add new rank
        • +
        • [PHPBB3-10185] - Board startdate not being set
        • +
        • [PHPBB3-10189] - Add "automatically generated" comment into schema-files.
        • +
        • [PHPBB3-10199] - Performance: viewtopic has a useless join
        • +
        • [PHPBB3-10222] - Also build language and styles changes in diff/patch format
        • +
        • [PHPBB3-10239] - Add "Are you sure" confirmation to backup restore in ACP
        • +
        • [PHPBB3-10243] - Add gmgetdate() wrapper for getdate() which returns dates in UTC.
        • +
        • [PHPBB3-10245] - Messenger uses output buffering for error collection, should use error collector instead
        • +
        • [PHPBB3-10246] - Remove VCS section from docs/coding-guidelines.html
        • +
        • [PHPBB3-10254] - Remove style names from themes and fix some information on it
        • +
        • [PHPBB3-10263] - Add phpbb_version_compare() wrapper for version_compare()
        • +
        • [PHPBB3-10278] - Improve timeout handling in get_remote_file()
        • +
        • [PHPBB3-10315] - Radio Buttons in ACP are clipped in Safari - Fix suggested
        • +
        • [PHPBB3-10327] - Use "ALTER TABLE ... ADD INDEX" instead of "CREATE INDEX"
        • +
        • [PHPBB3-10334] - Birthday List display not dependent on user privileges
        • +
        • [PHPBB3-10335] - Responses to bots should have extra header to be used by reverse proxies
        • +
        • [PHPBB3-10346] - Add drop_tables key for database updater
        • +
        • [PHPBB3-10354] - When template tests are skipped because cache is not writable, print cache directory path
        • +
        • [PHPBB3-10369] - Change error collector to always report errfile and errline
        • +
        • [PHPBB3-10370] - Various improvements for get_backtrace()
        • +
        • [PHPBB3-10402] - Displaying report texts with linebreaks and clickable links
        • +
        • [PHPBB3-10419] - Add mbstring PHP ini parameters checks to ACP
        • +
        • [PHPBB3-10430] - Some typos and the like in docs/coding-guidelines.html
        • +
        +

        New Feature

        +
          +
        • [PHPBB3-8240] - Request: db_tools to have two additional functions, table list and column list
        • +
        +

        Task

        + + +

        1.ii. Changes since 3.0.8

        Bug

        @@ -458,7 +584,7 @@ -

        1.ii. Changes since 3.0.7-PL1

        +

        1.iii. Changes since 3.0.7-PL1

        Security

          @@ -916,13 +1042,13 @@
        -

        1.iii. Changes since 3.0.7

        +

        1.iiv. Changes since 3.0.7

        • [Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
        -

        1.iv. Changes since 3.0.6

        +

        1.v. Changes since 3.0.6

        • [Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)
        • @@ -1026,7 +1152,7 @@
        -

        1.v. Changes since 3.0.5

        +

        1.vi. Changes since 3.0.5

        • [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
        • @@ -1248,7 +1374,7 @@
        • [Feature] Send anonymous statistical information to phpBB on installation and update (optional).
        -

        1.vi. Changes since 3.0.4

        +

        1.vii. Changes since 3.0.4

        • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
        • @@ -1337,7 +1463,7 @@
        • [Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)
        -

        1.vii. Changes since 3.0.3

        +

        1.viii. Changes since 3.0.3

        • [Fix] Allow mixed-case template directories to be inherited (Bug #36725)
        • @@ -1369,7 +1495,7 @@
        • [Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
        -

        1.viii. Changes since 3.0.2

        +

        1.ix. Changes since 3.0.2

        • [Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
        • @@ -1468,7 +1594,7 @@
        • [Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
        -

        1.ix. Changes since 3.0.1

        +

        1.x. Changes since 3.0.1

        • [Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
        • @@ -1516,7 +1642,7 @@
        • [Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
        -

        1.x Changes since 3.0.0

        +

        1.xi Changes since 3.0.0

        • [Change] Validate birthdays (Bug #15004)
        • @@ -1587,7 +1713,7 @@
        • [Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
        -

        1.xi. Changes since 3.0.RC8

        +

        1.xii. Changes since 3.0.RC8

        • [Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
        • @@ -1596,7 +1722,7 @@
        • [Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
        -

        1.xii. Changes since 3.0.RC7

        +

        1.xiii. Changes since 3.0.RC7

        • [Fix] Fixed MSSQL related bug in the update system
        • @@ -1631,7 +1757,7 @@
        • [Fix] No duplication of active topics (Bug #15474)
        -

        1.xiii. Changes since 3.0.RC6

        +

        1.xiv. Changes since 3.0.RC6

        • [Fix] Submitting language changes using acp_language (Bug #14736)
        • @@ -1641,7 +1767,7 @@
        • [Fix] Able to request new password (Bug #14743)
        -

        1.xiv. Changes since 3.0.RC5

        +

        1.xv. Changes since 3.0.RC5

        • [Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
        • @@ -1704,7 +1830,7 @@
        • [Sec] New password hashing mechanism for storing passwords (#i42)
        -

        1.xv. Changes since 3.0.RC4

        +

        1.xvi. Changes since 3.0.RC4

        • [Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
        • @@ -1755,7 +1881,7 @@
        • [Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
        -

        1.xvi. Changes since 3.0.RC3

        +

        1.xvii. Changes since 3.0.RC3

        • [Fix] Fixing some subsilver2 and prosilver style issues
        • @@ -1864,7 +1990,7 @@
        -

        1.xvii. Changes since 3.0.RC2

        +

        1.xviii. Changes since 3.0.RC2

        • [Fix] Re-allow searching within the memberlist
        • @@ -1910,7 +2036,7 @@
        -

        1.xviii. Changes since 3.0.RC1

        +

        1.xix. Changes since 3.0.RC1

        • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
        • From c4d3c5320e03f3adbbae90b4c04ff1a8783d51b6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 00:12:44 +0100 Subject: [PATCH 203/325] [ticket/10479] Remove PostgreSQL version numbers from driver's language string The versions should be removed like for all other DBMS so we don't have to add each new version. PHPBB3-10479 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f038177df4..c4b100187f 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -151,7 +151,7 @@ $lang = array_merge($lang, array( 'DLL_MYSQL' => 'MySQL', 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', 'DLL_ORACLE' => 'Oracle', - 'DLL_POSTGRES' => 'PostgreSQL 7.x/8.x', + 'DLL_POSTGRES' => 'PostgreSQL', 'DLL_SQLITE' => 'SQLite', 'DLL_XML' => 'XML support [ Jabber ]', 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', From a9d7b1f9a144a6354638e6ef30e42cec2463f1b8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 21 Nov 2011 00:57:53 +0100 Subject: [PATCH 204/325] [develop-olympus] Increment version number to 3.0.11-dev in develop-olympus. --- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ec7b8c7123..a0444ea594 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-RC1'); +define('PHPBB_VERSION', '3.0.11-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 9ca011c8aa..1d96f40fdf 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-RC1'); +define('UPDATES_TO_VERSION', '3.0.11-dev'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 4f5bf23c58..fcc372ae93 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.11-dev'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From aef3652d7a11c956f0a16b3773fb59abc7b6d280 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 21 Nov 2011 13:09:27 +0100 Subject: [PATCH 205/325] [ticket/10483] Fix test suite when running with MySQL strict mode PHPBB3-10483 --- tests/dbal/fixtures/massmail_crossjoin.xml | 16 ++++++++++++++++ tests/dbal/fixtures/three_users.xml | 16 ++++++++++++++++ tests/session/fixtures/sessions_empty.xml | 16 ++++++++++++++++ tests/session/fixtures/sessions_full.xml | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/tests/dbal/fixtures/massmail_crossjoin.xml b/tests/dbal/fixtures/massmail_crossjoin.xml index 801205eb81..ef0a2b7149 100644 --- a/tests/dbal/fixtures/massmail_crossjoin.xml +++ b/tests/dbal/fixtures/massmail_crossjoin.xml @@ -12,20 +12,36 @@ user_id username username_clean + user_permissions + user_sig + user_occ + user_interests 1 mass email mass email + + + + 2 banned banned + + + + 3 not in group not in group + + + + diff --git a/tests/dbal/fixtures/three_users.xml b/tests/dbal/fixtures/three_users.xml index a6789f4a01..a50e3e8634 100644 --- a/tests/dbal/fixtures/three_users.xml +++ b/tests/dbal/fixtures/three_users.xml @@ -3,17 +3,33 @@
          user_idusername_clean + user_permissions + user_sig + user_occ + user_interests 1 barfoo + + + + 2 foobar + + + + 3 bertie + + + +
          diff --git a/tests/session/fixtures/sessions_empty.xml b/tests/session/fixtures/sessions_empty.xml index f94337314e..0e6ddccd88 100644 --- a/tests/session/fixtures/sessions_empty.xml +++ b/tests/session/fixtures/sessions_empty.xml @@ -3,17 +3,33 @@ user_idusername_clean + user_permissions + user_sig + user_occ + user_interests 1 anonymous + + + + 3 foo + + + + 4 bar + + + +
          diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml index bf6fc65997..509687f4d2 100644 --- a/tests/session/fixtures/sessions_full.xml +++ b/tests/session/fixtures/sessions_full.xml @@ -3,17 +3,33 @@
          user_idusername_clean + user_permissions + user_sig + user_occ + user_interests 1 anonymous + + + + 3 foo + + + + 4 bar + + + +
          From 4c77903129749008cd08c346006d2a57cf6ff544 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 16:22:07 +0100 Subject: [PATCH 206/325] [ticket/10484] Use variables for sql_build_query() calls It's easier for mods/extensions to extend the arrays. PHPBB3-10484 --- phpBB/includes/functions_admin.php | 20 +++++++++++--------- phpBB/includes/functions_display.php | 5 +++-- phpBB/includes/functions_posting.php | 11 ++++++----- phpBB/includes/mcp/mcp_front.php | 22 ++++++++++++---------- phpBB/ucp.php | 11 ++++++----- phpBB/viewforum.php | 5 +++-- phpBB/viewtopic.php | 11 ++++++----- 7 files changed, 47 insertions(+), 38 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3f9e517fdf..419460c79e 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2366,7 +2366,7 @@ function cache_moderators() $ug_id_ary = array_keys($hold_ary); // Remove users who have group memberships with DENY moderator permissions - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', 'FROM' => array( @@ -2379,8 +2379,8 @@ function cache_moderators() 'LEFT_JOIN' => array( array( 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), - 'ON' => 'a.auth_role_id = r.role_id' - ) + 'ON' => 'a.auth_role_id = r.role_id', + ), ), 'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id) @@ -2392,7 +2392,8 @@ function cache_moderators() AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " AND ug.user_pending = 0 AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), - )); + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -2792,18 +2793,18 @@ function update_foes($group_id = false, $user_id = false) if (is_array($group_id) && sizeof($group_id)) { // Grab group settings... - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => 'a.group_id', 'FROM' => array( ACL_OPTIONS_TABLE => 'ao', - ACL_GROUPS_TABLE => 'a' + ACL_GROUPS_TABLE => 'a', ), 'LEFT_JOIN' => array( array( 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), - 'ON' => 'a.auth_role_id = r.role_id' + 'ON' => 'a.auth_role_id = r.role_id', ), ), @@ -2811,8 +2812,9 @@ function update_foes($group_id = false, $user_id = false) AND ' . $db->sql_in_set('a.group_id', $group_id) . " AND ao.auth_option IN ('a_', 'm_')", - 'GROUP_BY' => 'a.group_id' - )); + 'GROUP_BY' => 'a.group_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $groups = array(); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 39d0793030..2b871a21ec 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -110,7 +110,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $sql_array['SELECT'] .= ', fa.user_id'; } - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], @@ -118,8 +118,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'WHERE' => $sql_where, 'ORDER_BY' => 'f.left_id', - )); + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $forum_tracking_info = array(); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4ca76344de..cb4fc86f21 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1005,7 +1005,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $mode = 'post_review'; } - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array( @@ -1016,14 +1016,15 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'LEFT_JOIN' => array( array( 'FROM' => array(ZEBRA_TABLE => 'z'), - 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' - ) + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), ), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' - AND u.user_id = p.poster_id' - )); + AND u.user_id = p.poster_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $bbcode_bitfield = ''; diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index eca67c5ac1..3942ff7910 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -158,7 +158,7 @@ function mcp_front_view($id, $mode, $action) if ($total) { - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', 'FROM' => array( @@ -166,14 +166,14 @@ function mcp_front_view($id, $mode, $action) REPORTS_REASONS_TABLE => 'rr', TOPICS_TABLE => 't', USERS_TABLE => array('u', 'u2'), - POSTS_TABLE => 'p' + POSTS_TABLE => 'p', ), 'LEFT_JOIN' => array( array( 'FROM' => array(FORUMS_TABLE => 'f'), - 'ON' => 'f.forum_id = p.forum_id' - ) + 'ON' => 'f.forum_id = p.forum_id', + ), ), 'WHERE' => 'r.post_id = p.post_id @@ -185,8 +185,9 @@ function mcp_front_view($id, $mode, $action) AND p.poster_id = u2.user_id AND ' . $db->sql_in_set('p.forum_id', $forum_list), - 'ORDER_BY' => 'p.post_time DESC' - )); + 'ORDER_BY' => 'p.post_time DESC', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, 5); while ($row = $db->sql_fetchrow($result)) @@ -253,14 +254,14 @@ function mcp_front_view($id, $mode, $action) { include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id', 'FROM' => array( REPORTS_TABLE => 'r', REPORTS_REASONS_TABLE => 'rr', USERS_TABLE => array('u', 'u2'), - PRIVMSGS_TABLE => 'p' + PRIVMSGS_TABLE => 'p', ), 'WHERE' => 'r.pm_id = p.msg_id @@ -270,8 +271,9 @@ function mcp_front_view($id, $mode, $action) AND r.user_id = u.user_id AND p.author_id = u2.user_id', - 'ORDER_BY' => 'p.message_time DESC' - )); + 'ORDER_BY' => 'p.message_time DESC', + ); + $sql_ary = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, 5); $pm_by_id = $pm_list = array(); diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 505dbb998b..c8a0795bcb 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -274,19 +274,19 @@ if ($module->is_active('zebra', 'friends')) // Output listing of friends online $update_time = $config['load_online_time'] * 60; - $sql = $db->sql_build_query('SELECT_DISTINCT', array( + $sql_ary = array( 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', 'FROM' => array( USERS_TABLE => 'u', - ZEBRA_TABLE => 'z' + ZEBRA_TABLE => 'z', ), 'LEFT_JOIN' => array( array( 'FROM' => array(SESSIONS_TABLE => 's'), - 'ON' => 's.session_user_id = z.zebra_id' - ) + 'ON' => 's.session_user_id = z.zebra_id', + ), ), 'WHERE' => 'z.user_id = ' . $user->data['user_id'] . ' @@ -296,8 +296,9 @@ if ($module->is_active('zebra', 'friends')) 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', 'ORDER_BY' => 'u.username_clean ASC', - )); + ); + $sql = $db->sql_build_query('SELECT_DISTINCT', $sql_ary); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index caed794671..3b10d828d3 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -375,7 +375,7 @@ if ($forum_data['forum_type'] == FORUM_POST) $sql_anounce_array['SELECT'] = $sql_array['SELECT'] . ', f.forum_name'; // Obtain announcements ... removed sort ordering, sort by time in all cases - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => $sql_anounce_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_anounce_array['LEFT_JOIN'], @@ -386,7 +386,8 @@ if ($forum_data['forum_type'] == FORUM_POST) AND t.topic_type = ' . POST_GLOBAL . ')', 'ORDER_BY' => 't.topic_time DESC', - )); + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ceb9f3ea1c..e78ba73cd7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -943,7 +943,7 @@ if (!sizeof($post_list)) // We need to grab it because we do reverse ordering sometimes $max_post_time = 0; -$sql = $db->sql_build_query('SELECT', array( +$sql_ary = array( 'SELECT' => 'u.*, z.friend, z.foe, p.*', 'FROM' => array( @@ -954,14 +954,15 @@ $sql = $db->sql_build_query('SELECT', array( 'LEFT_JOIN' => array( array( 'FROM' => array(ZEBRA_TABLE => 'z'), - 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' - ) + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), ), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' - AND u.user_id = p.poster_id' -)); + AND u.user_id = p.poster_id', +); +$sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst); From c67633577f276727e1d15106a87517b97c8a4d1a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 23:23:02 +0100 Subject: [PATCH 207/325] [ticket/10485] Fix invalid HTML5 markup introduced in PHPBB3-6632 Remove the previous fix and fix it the way we did it in PHPBB3-10360 for 3.1 PHPBB3-6632 PHPBB3-10485 --- phpBB/styles/prosilver/template/forumlist_body.html | 10 +++++----- phpBB/styles/prosilver/template/search_results.html | 10 +++++----- phpBB/styles/prosilver/template/viewforum_body.html | 10 +++++----- phpBB/styles/prosilver/theme/content.css | 12 ++++++++++-- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 2c2a242a9f..bf672e16fc 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -11,9 +11,9 @@
            -
          • +
          • -
            +
            {forumrow.FORUM_NAME}{L_FORUM}
            {L_TOPICS}
            {L_POSTS}
            {L_LAST_POST}
            @@ -25,8 +25,8 @@
          • -
            -
            +
            +
            {forumrow.FORUM_IMAGE} @@ -36,7 +36,7 @@
            {forumrow.L_MODERATOR_STR}: {forumrow.MODERATORS}
            {forumrow.L_SUBFORUM_STR} {forumrow.SUBFORUMS} -
            +
            {L_REDIRECTS}: {forumrow.CLICKS}
            diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index f2a4435103..014b39de87 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -39,8 +39,8 @@
            • -
              -
              {L_TOPICS}
              +
              +
              {L_TOPICS}
              {L_REPLIES}
              {L_VIEWS}
              {L_LAST_POST}
              @@ -51,8 +51,8 @@
            • -
              -
              style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> +
              +
              style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> {NEWEST_POST_IMG} {searchresults.TOPIC_TITLE} {searchresults.ATTACH_ICON_IMG} {searchresults.UNAPPROVED_IMG} @@ -60,7 +60,7 @@ {searchresults.PAGINATION} {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} {L_IN} {searchresults.FORUM_TITLE} ({L_GLOBAL}) -
              +
              {searchresults.TOPIC_REPLIES}
              {searchresults.TOPIC_VIEWS}
              diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 4ad0990d98..d2952bff2a 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -126,8 +126,8 @@
              • -
                -
                {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                +
                +
                {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                {L_REPLIES}
                {L_VIEWS}
                {L_LAST_POST}
                @@ -138,13 +138,13 @@
              • -
                - style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
                {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} +
                + style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">{NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {REPORTED_IMG}
                {topicrow.PAGINATION} {topicrow.ATTACH_ICON_IMG} {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} -
                +
                {topicrow.REPLIES} {L_REPLIES}
                {topicrow.VIEWS} {L_VIEWS}
                {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index c278a16dc5..696d5e1cc0 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -29,14 +29,19 @@ ul.topiclist li.row dl { ul.topiclist dt { display: block; float: left; - width: 100%; + width: 50%; font-size: 1.1em; padding-left: 5px; padding-right: 5px; +} + +ul.topiclist .widescreen-optimised dt { + width: 100%; margin-right: -465px; } -ul.topiclist dt .wrap-content { +ul.topiclist .widescreen-optimised dt .wrap-content { + display: block; padding-right: 465px; } @@ -101,6 +106,9 @@ li.header dt, li.header dd { li.header dt { font-weight: bold; +} + +li.header .widescreen-optimised dt { margin-right: -465px; } From 0d3697e40caadc07bf9165d8d2f2436efffd543a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 22 Nov 2011 20:59:51 +0100 Subject: [PATCH 208/325] [ticket/10486] Create git shortlog and git diff --stat in build script. PHPBB3-10486 --- build/build.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/build.xml b/build/build.xml index fbc1a91e1b..c942142b5e 100644 --- a/build/build.xml +++ b/build/build.xml @@ -119,6 +119,7 @@ + @@ -128,6 +129,13 @@ + + + - + - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ec7b8c7123..2ade1ac95e 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-RC1'); +define('PHPBB_VERSION', '3.0.10-RC2'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 57e2ef73b8..bbc4261adc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-RC1'); +define('UPDATES_TO_VERSION', '3.0.10-RC2'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -987,6 +987,9 @@ function database_update_info() '3.0.9-RC4' => array(), // No changes from 3.0.9 to 3.0.10-RC1 '3.0.9' => array(), + // No changes from 3.0.10-RC1 to 3.0.10-RC2 + '3.0.10-RC1' => array(), + /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); @@ -2006,6 +2009,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.10-RC1 to 3.0.10-RC2 + case '3.0.10-RC1': + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 4f5bf23c58..5cbaba3d1f 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC2'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From 0cb83f99abd67c33fecc511b2e7ac6a49acf058d Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 26 Nov 2011 17:32:40 -0500 Subject: [PATCH 230/325] [ticket/10093] Document phpbb.hooks.commit-msg.fatal setting. PHPBB3-10093 --- git-tools/hooks/commit-msg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 4f6ae71d4b..03a602c16c 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -11,6 +11,11 @@ # # ln -s ../../git-tools/hooks/commit-msg \\ # .git/hooks/commit-msg +# +# You can configure whether invalid commit messages abort commits: +# +# git config phpbb.hooks.commit-msg.fatal true (abort, this is the default) +# git config phpbb.hooks.commit-msg.fatal false (warn only, do not abort) config_ns="phpbb.hooks.commit-msg"; From 26d01d4408a25d70e2bbe32992a1c348ddefff04 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 26 Nov 2011 17:35:10 -0500 Subject: [PATCH 231/325] [ticket/10093] Respect phpbb.hooks.commit-msg.fatal on syntax errors. PHPBB3-10093 --- git-tools/hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 03a602c16c..39d5bb3350 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -254,7 +254,7 @@ do echo ">> $line" >&2; echo -n "Expecting: " >&2; echo "$expecting" | sed 's/ /, /g' >&2; - exit $err; + quit $err; fi i=$(( $i + 1 )); From 6a3ee0996e1b4faf765d72e7249f505fafd5812d Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 26 Nov 2011 17:41:25 -0500 Subject: [PATCH 232/325] [ticket/10093] Refactor complaining in commit-msg hook for color support. PHPBB3-10093 --- git-tools/hooks/commit-msg | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 39d5bb3350..5c51127dcc 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -60,6 +60,11 @@ quit() fi } +complain() +{ + echo "$@" +} + # Check for empty commit message if ! grep -qv '^#' "$1" then @@ -75,9 +80,9 @@ msg=$(grep -v '^#' "$1" |grep -nE '.{81,}') if [ $? -eq 0 ] then - echo "The following lines are greater than 80 characters long:" >&2; - echo >&2 - echo "$msg" >&2; + complain "The following lines are greater than 80 characters long:" >&2; + complain >&2 + complain "$msg" >&2; quit $ERR_LENGTH; fi @@ -131,9 +136,9 @@ do # Don't be too strict. # Commits may be temporary, intended to be squashed later. # Just issue a warning here. - echo "Warning: heading should be a sentence beginning with a capital letter." 1>&2 - echo "You entered:" 1>&2 - echo "$line" 1>&2 + complain "Warning: heading should be a sentence beginning with a capital letter." 1>&2 + complain "You entered:" 1>&2 + complain "$line" 1>&2 fi # restore exit code (exit $result) @@ -165,7 +170,7 @@ do echo "$line" | grep -Eq "^#"; ;; *) - echo "Unrecognised token $expect" >&2; + complain "Unrecognised token $expect" >&2; quit $err; ;; esac @@ -236,7 +241,7 @@ do expecting="eof"; ;; *) - echo "Unrecognised token $expect" >&2; + complain "Unrecognised token $expect" >&2; quit 254; ;; esac @@ -250,10 +255,10 @@ do else # None of the expected line formats matched # Guess we'll call it a day here then - echo "Syntax error on line $i:" >&2; - echo ">> $line" >&2; - echo -n "Expecting: " >&2; - echo "$expecting" | sed 's/ /, /g' >&2; + complain "Syntax error on line $i:" >&2; + complain ">> $line" >&2; + complain -n "Expecting: " >&2; + complain "$expecting" | sed 's/ /, /g' >&2; quit $err; fi @@ -263,7 +268,7 @@ done # If EOF is expected exit cleanly echo "$expecting" | grep -q "eof" || ( # Unexpected EOF, error - echo "Unexpected EOF encountered" >&2; + complain "Unexpected EOF encountered" >&2; quit $ERR_EOF; ) && ( # Do post scan checks @@ -274,8 +279,8 @@ echo "$expecting" | grep -q "eof" || ( if [ ! -z "$dupes" ] then - echo "The following tickets are repeated:" >&2; - echo "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2; + complain "The following tickets are repeated:" >&2; + complain "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2; quit $ERR_FOOTER; fi fi @@ -283,8 +288,8 @@ echo "$expecting" | grep -q "eof" || ( if [ $ticket -gt 0 ] then echo "$tickets" | grep -Eq "\bPHPBB3-$ticket\b" || ( - echo "Ticket ID [$ticket] of branch missing from list of tickets:" >&2; - echo "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2; + complain "Ticket ID [$ticket] of branch missing from list of tickets:" >&2; + complain "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2; quit $ERR_FOOTER; ) || exit $?; fi From 92cdf08d48cba4eac30708ab089aae917db13970 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 26 Nov 2011 18:04:03 -0500 Subject: [PATCH 233/325] [ticket/10093] Use color in commit-msg hook warning/error messages. By default color is used if the message is printed to a tty, phpbb.hooks.commit-msg.color configuration setting can override this. PHPBB3-10093 --- git-tools/hooks/commit-msg | 51 +++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 5c51127dcc..959c4e3979 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -16,6 +16,13 @@ # # git config phpbb.hooks.commit-msg.fatal true (abort, this is the default) # git config phpbb.hooks.commit-msg.fatal false (warn only, do not abort) +# +# Warning/error messages use color by default if the output is a terminal +# ("output" here is normally standard error when you run git commit). +# To force or disable the use of color: +# +# git config phpbb.hooks.commit-msg.color true (force color output) +# git config phpbb.hooks.commit-msg.color false (disable color output) config_ns="phpbb.hooks.commit-msg"; @@ -60,9 +67,51 @@ quit() fi } +use_color() +{ + if [ -z "$use_color_cached" ] + then + case $(git config --bool $config_ns.color) + in + false) + use_color_cached=1 + ;; + true) + use_color_cached=0 + ;; + *) + # tty detection in shell: + # http://hwi.ath.cx/jsh/list/shext/isatty.sh.html + tty 0>/dev/stdout >/dev/null 2>&1 + use_color_cached=$? + ;; + esac + fi + # return value is the flag inverted - + # if return value is 0, this means use color + return $use_color_cached +} + complain() { - echo "$@" + if use_color + then + # Careful: our argument may include arguments to echo like -n + # ANSI color codes: + # http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html + printf "\033[31m\033[1m" + if [ "$1" = "-n" ] + then + echo "$@" + printf "\033[10m" + else + # This will print one trailing space. + # Not sure how to avoid this at the moment. + echo "$@" $(printf "\033[10m") + fi + else + echo "$@" + fi } # Check for empty commit message From 77e00d14a196d14910bdf2275ab01380b7b7f18f Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 26 Nov 2011 01:30:03 +0800 Subject: [PATCH 234/325] [ticket/10497] Fix SQL error when guest visits forum with unread topic Regression from the ticket PHPBB3-9008 fix. When topic marking was enabled for guests, and a guest visited a forum with a new topic which is marked unread, the built SQL missed an alias for a TOPICS_TABLE which resulted in the following error: Unknown column 't.topic_approved' in 'where clause' [1054] The fix is to add an alias for the table. PHPBB3-10497 PHPBB3-9008 --- phpBB/includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 944e53052b..7ce83b871a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1943,11 +1943,11 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti } else { - $sql = 'SELECT topic_id - FROM ' . TOPICS_TABLE . ' - WHERE forum_id = ' . $forum_id . ' - AND topic_last_post_time > ' . $mark_time_forum . ' - AND topic_moved_id = 0 ' . + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_last_post_time > ' . $mark_time_forum . ' + AND t.topic_moved_id = 0 ' . $sql_update_unapproved; $result = $db->sql_query($sql); From 799be4469a99176bc14cf602c16995c260b10162 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Nov 2011 16:23:15 +0100 Subject: [PATCH 235/325] [prep-release-3.0.10] Update Changelog for 3.0.10-RC2 release. --- phpBB/docs/CHANGELOG.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a4ed1b5c86..a58c384f04 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -169,6 +169,12 @@
              • [PHPBB3-10437] - Announcements on moderation queue are not hidden
              • [PHPBB3-10446] - Unencoded 8bit characters in email headers
              • [PHPBB3-10452] - XHTML error when printing a PM
              • +
              • [PHPBB3-10461] - MCP's recent actions list is empty
              • +
              • [PHPBB3-10479] - Remove PostgreSQL version numbers from driver's language string
              • +
              • [PHPBB3-10485] - XHTML error in Prosilver - index and viewforum
              • +
              • [PHPBB3-10488] - Database updater for 3.0.10-RC1 overwrites config variable email_max_chunk_size without checking for custom value
              • +
              • [PHPBB3-10490] - MCP Layout broken in ProSilver when screen is resized to less 1200 pixels
              • +
              • [PHPBB3-10497] - SQL error when guest visits forum with unread topic

              Improvement

                @@ -214,6 +220,8 @@
              • [PHPBB3-9689] - Scripts and utilities
              • [PHPBB3-10003] - Resolve db_tools proliferation
              • [PHPBB3-10313] - Include slow unit tests when running build script
              • +
              • [PHPBB3-10483] - Test suite does not run with MySQL strict mode
              • +
              • [PHPBB3-10486] - Create git shortlog and git diff --stat in build script

              1.ii. Changes since 3.0.8

              From 2fac1d4c2323797dc4ef977cea4dc3fb894f895a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 27 Nov 2011 21:41:22 +0100 Subject: [PATCH 236/325] [ticket/10345] Fix parsing error in language/en/viewtopic.php PHPBB3-10345 --- phpBB/language/en/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 5bfc4907ce..e59b33d0a8 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -56,7 +56,7 @@ $lang = array_merge($lang, array( 'EDITED_TIMES_TOTAL' => array( 1 => 'Last edited by %2$s on %3$s, edited %1$d time in total.', 2 => 'Last edited by %2$s on %3$s, edited %1$d times in total.', - ) + ), 'EMAIL_TOPIC' => 'E-mail friend', 'ERROR_NO_ATTACHMENT' => 'The selected attachment does not exist anymore.', From 6472a270e0faf39c7dd9b73a8948f19254e0a17e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 27 Nov 2011 21:43:07 +0100 Subject: [PATCH 237/325] [ticket/10345] Add cases for 1 pixel height on MAX_FLASH and MAX_IMG sizes PHPBB3-10345 --- phpBB/language/en/posting.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 0c8824aabf..9119b97ebe 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -123,15 +123,19 @@ $lang = array_merge($lang, array( 'MAX_FONT_SIZE_EXCEEDED' => 'You may only use fonts up to size %d.', 'MAX_FLASH_HEIGHT_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel high.', 2 => 'Your flash files may only be up to %d pixels high.', ), 'MAX_FLASH_WIDTH_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel wide.', 2 => 'Your flash files may only be up to %d pixels wide.', ), 'MAX_IMG_HEIGHT_EXCEEDED' => array( + 1 => 'Your images may only be up to %1$d pixel high.', 2 => 'Your images may only be up to %1$d pixels high.', ), 'MAX_IMG_WIDTH_EXCEEDED' => array( + 1 => 'Your images may only be up to %d pixel wide.', 2 => 'Your images may only be up to %d pixels wide.', ), From f88e89900f34f6165a9002c3a2cb3307310584ee Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 28 Nov 2011 10:35:43 +0100 Subject: [PATCH 238/325] [ticket/10503] Debug error "Invalid arguments" when previewing edits Empty value of poll_options should be an empty array, so that sizeof() is 0. PHPBB3-9776 PHPBB3-10503 --- phpBB/posting.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index ea3b53e939..76c8100c78 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -895,7 +895,7 @@ if ($submit || $preview || $refresh) $message_parser->parse_poll($poll); - $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : ''; + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; /* We reset votes, therefore also allow removing options @@ -918,7 +918,8 @@ if ($submit || $preview || $refresh) 'poll_options' => array(), ); - $post_data['poll_options'] = $post_data['poll_title'] = ''; + $post_data['poll_options'] = array(); + $post_data['poll_title'] = ''; $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; } else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != '')) @@ -934,7 +935,7 @@ if ($submit || $preview || $refresh) $message_parser->parse_poll($poll); - $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : ''; + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; } else From cb4e72298b58e6bbb8ced3cf05384239bf285773 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 28 Nov 2011 11:21:43 +0100 Subject: [PATCH 239/325] [ticket/10501] Fix description of table prefixes They must start with a letter, not an alphanumeric character PHPBB3-10501 --- phpBB/language/en/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index c4b100187f..f69ca40613 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -232,7 +232,7 @@ $lang = array_merge($lang, array( 'INST_ERR' => 'Installation error', 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', - 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with an alphanumeric character and must only contain alphanumeric characters, numbers and underscores.', + 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', 'INST_ERR_DB_NO_ERROR' => 'No error message given.', 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension†option you have selected. Please try the “MySQL†option instead.', 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', @@ -353,7 +353,7 @@ $lang = array_merge($lang, array( 'TABLES_MISSING' => 'Could not find these tables
              » %s.', 'TABLE_PREFIX' => 'Prefix for tables in database', - 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with an alphanumeric character and must only contain alphanumeric characters, numbers and underscores.', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
              » Specified table prefix was %s.', 'TESTS_PASSED' => 'Tests passed', 'TESTS_FAILED' => 'Tests failed', From 593ac9ed4318c68e56bb2bdfa42adb2126aae994 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 28 Nov 2011 23:10:01 +0100 Subject: [PATCH 240/325] [prep-release-3.0.10] Remove duplicate ticket PHPBB3-10490 from changelog. --- phpBB/docs/CHANGELOG.html | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a58c384f04..39d3e24b13 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -173,7 +173,6 @@
            • [PHPBB3-10479] - Remove PostgreSQL version numbers from driver's language string
            • [PHPBB3-10485] - XHTML error in Prosilver - index and viewforum
            • [PHPBB3-10488] - Database updater for 3.0.10-RC1 overwrites config variable email_max_chunk_size without checking for custom value
            • -
            • [PHPBB3-10490] - MCP Layout broken in ProSilver when screen is resized to less 1200 pixels
            • [PHPBB3-10497] - SQL error when guest visits forum with unread topic

            Improvement

            From 8f1f42cc6cfeca5bf0f9b4f5ff963227fc090fd2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 29 Nov 2011 19:59:31 +0100 Subject: [PATCH 241/325] [ticket/10502] Fix typo in changelog. 'red' should have been 'read'. PHPBB3-10502 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 39d3e24b13..a4bbfb7d7f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -178,7 +178,7 @@

            Improvement

            • [PHPBB3-8616] - Add direct link to PM to notification message
            • -
            • [PHPBB3-9036] - Forums that can be listed but not red expose forum information
            • +
            • [PHPBB3-9036] - Forums that can be listed but not read expose forum information
            • [PHPBB3-9297] - Add support for Extended Passive Mode (EPSV) in class ftp_fsock to better support IPv6 connections.
            • [PHPBB3-9307] - Mass email $max_chunk_size
            • [PHPBB3-9361] - Edit account settings - Improved clarification needed
            • From 4cf059e38f65330a553c2f5c8428c32ce17ab4d3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 28 Nov 2011 22:58:29 +0100 Subject: [PATCH 242/325] [ticket/10480] Add a build script for exporting the changelog from tracker. PHPBB3-10480 --- build/build_changelog.php | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 build/build_changelog.php diff --git a/build/build_changelog.php b/build/build_changelog.php new file mode 100755 index 0000000000..4eb5ebd83b --- /dev/null +++ b/build/build_changelog.php @@ -0,0 +1,53 @@ +#!/usr/bin/env php +xpath('//item') as $item) +{ + $key = (string) $item->key; + + $keyUrl = 'http://tracker.phpbb.com/browse/' . $key; + $keyLink = '' . $key . ''; + + $value = str_replace($key, $keyLink, htmlspecialchars($item->title)); + $value = str_replace(']', '] -', $value); + + $types[(string) $item->type][$key] = $value; +} + +ksort($types); +foreach ($types as $type => $tickets) +{ + echo "

              $type

              \n"; + echo "
                \n"; + + uksort($tickets, 'strnatcasecmp'); + + foreach ($tickets as $ticket) + { + echo "
              • $ticket
              • \n"; + } + echo "
              \n"; +} From f3519141379504a5c676fbb8026f71aa93d67da2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 28 Nov 2011 23:04:17 +0100 Subject: [PATCH 243/325] [ticket/10480] Add a build target for changelog building. PHPBB3-10480 --- build/build.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/build.xml b/build/build.xml index 18b03243c2..2c42e1e162 100644 --- a/build/build.xml +++ b/build/build.xml @@ -138,6 +138,12 @@ save/save_${prevversion}_to_${newversion}/phpbb-${prevversion}_to_${newversion}_git_diffstat.txt" /> + + + + - + - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 2ade1ac95e..3a798fc1ce 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-RC2'); +define('PHPBB_VERSION', '3.0.10-RC3'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index bbc4261adc..eeadc9f862 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-RC2'); +define('UPDATES_TO_VERSION', '3.0.10-RC3'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -989,7 +989,8 @@ function database_update_info() '3.0.9' => array(), // No changes from 3.0.10-RC1 to 3.0.10-RC2 '3.0.10-RC1' => array(), - + // No changes from 3.0.10-RC2 to 3.0.10-RC3 + '3.0.10-RC2' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); @@ -2013,6 +2014,10 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.10-RC1 to 3.0.10-RC2 case '3.0.10-RC1': break; + + // No changes from 3.0.10-RC2 to 3.0.10-RC3 + case '3.0.10-RC2': + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5cbaba3d1f..eb90d3a06d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC2'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From 1842323ca9a59b8cc34c1af43db6d703cf996d33 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 4 Dec 2011 11:43:55 +0200 Subject: [PATCH 256/325] [ticket/10399] Correctly encoding template component urls (3.0) Changes in style.php PHPBB3-10399 --- phpBB/style.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/style.php b/phpBB/style.php index 916aa8ce5c..f1b41c6a85 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -216,10 +216,10 @@ if ($id) // Parse Theme Data $replace = array( - '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme', - '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template', - '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset', - '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user_image_lang, + '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['theme_path']) . '/theme', + '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['template_path']) . '/template', + '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['imageset_path']) . '/imageset', + '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . rawurlencode($theme['imageset_path']) . '/imageset/' . $user_image_lang, '{T_STYLESHEET_NAME}' => $theme['theme_name'], '{S_USER_LANG}' => $user['user_lang'] ); @@ -248,7 +248,7 @@ if ($id) $img_data = &$img_array[$img]; $imgsrc = ($img_data['image_lang'] ? $img_data['image_lang'] . '/' : '') . $img_data['image_filename']; $imgs[$img] = array( - 'src' => $phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $imgsrc, + 'src' => $phpbb_root_path . 'styles/' . rawurlencode($theme['imageset_path']) . '/imageset/' . $imgsrc, 'width' => $img_data['image_width'], 'height' => $img_data['image_height'], ); From 1a09f9005c7784dfbee641a41935a7973e761f45 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 1 Dec 2011 11:14:06 +0100 Subject: [PATCH 257/325] [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-10485 Revert "[ticket/10485] Fix invalid HTML5 markup introduced in PHPBB3-6632" This reverts commit c67633577f276727e1d15106a87517b97c8a4d1a. PHPBB3-6632 PHPBB3-10485 PHPBB3-10504 --- phpBB/styles/prosilver/template/forumlist_body.html | 10 +++++----- phpBB/styles/prosilver/template/search_results.html | 10 +++++----- phpBB/styles/prosilver/template/viewforum_body.html | 10 +++++----- phpBB/styles/prosilver/theme/content.css | 12 ++---------- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index bf672e16fc..2c2a242a9f 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -11,9 +11,9 @@
                -
              • +
              • -
                {forumrow.FORUM_NAME}{L_FORUM}
                +
                {L_TOPICS}
                {L_POSTS}
                {L_LAST_POST}
                @@ -25,8 +25,8 @@
              • -
                -
                +
                +
                {forumrow.FORUM_IMAGE} @@ -36,7 +36,7 @@
                {forumrow.L_MODERATOR_STR}: {forumrow.MODERATORS}
                {forumrow.L_SUBFORUM_STR} {forumrow.SUBFORUMS} -
                +
              {L_REDIRECTS}: {forumrow.CLICKS}
              diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 014b39de87..f2a4435103 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -39,8 +39,8 @@
              • -
                -
                {L_TOPICS}
                +
                +
                {L_TOPICS}
                {L_REPLIES}
                {L_VIEWS}
                {L_LAST_POST}
                @@ -51,8 +51,8 @@
              • -
                -
                style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> +
                +
                style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> {NEWEST_POST_IMG} {searchresults.TOPIC_TITLE} {searchresults.ATTACH_ICON_IMG} {searchresults.UNAPPROVED_IMG} @@ -60,7 +60,7 @@ {searchresults.PAGINATION} {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} {L_IN} {searchresults.FORUM_TITLE} ({L_GLOBAL}) -
                +
                {searchresults.TOPIC_REPLIES}
                {searchresults.TOPIC_VIEWS}
                diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index d2952bff2a..4ad0990d98 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -126,8 +126,8 @@
                • -
                  -
                  {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                  +
                  +
                  {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                  {L_REPLIES}
                  {L_VIEWS}
                  {L_LAST_POST}
                  @@ -138,13 +138,13 @@
                • -
                  - style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">{NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} +
                  + style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
                  {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {REPORTED_IMG}
                  {topicrow.PAGINATION} {topicrow.ATTACH_ICON_IMG} {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} - +
                  {topicrow.REPLIES} {L_REPLIES}
                  {topicrow.VIEWS} {L_VIEWS}
                  {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 696d5e1cc0..c278a16dc5 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -29,19 +29,14 @@ ul.topiclist li.row dl { ul.topiclist dt { display: block; float: left; - width: 50%; + width: 100%; font-size: 1.1em; padding-left: 5px; padding-right: 5px; -} - -ul.topiclist .widescreen-optimised dt { - width: 100%; margin-right: -465px; } -ul.topiclist .widescreen-optimised dt .wrap-content { - display: block; +ul.topiclist dt .wrap-content { padding-right: 465px; } @@ -106,9 +101,6 @@ li.header dt, li.header dd { li.header dt { font-weight: bold; -} - -li.header .widescreen-optimised dt { margin-right: -465px; } From e3d81812facb205bdad7a8b7fcdd08855c130c6c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 1 Dec 2011 11:15:10 +0100 Subject: [PATCH 258/325] [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-10408 Revert "[ticket/10408] Layout of topics/attachments list is broken in UCP and MCP" This reverts commit 88aacd0f2cffdf75af71d749c6ea602ed3912651. PHPBB3-6632 PHPBB3-10408 PHPBB3-10504 --- phpBB/styles/prosilver/template/ucp_attachments.html | 4 ++-- phpBB/styles/prosilver/theme/content.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html index c76316d93e..8052fdc435 100644 --- a/phpBB/styles/prosilver/template/ucp_attachments.html +++ b/phpBB/styles/prosilver/template/ucp_attachments.html @@ -20,7 +20,7 @@
                  • -
                    {L_FILENAME}
                    +
                    {L_FILENAME}
                    {L_DOWNLOADS}
                    {L_POST_TIME}
                    {L_MARK}
                    @@ -32,7 +32,7 @@
                  • -
                    {attachrow.FILENAME} ({attachrow.SIZE})
                    +
                    {attachrow.FILENAME} ({attachrow.SIZE})
                    {L_PM}: {L_TOPIC}: {attachrow.TOPIC_TITLE}
                    {attachrow.DOWNLOAD_COUNT}
                    {attachrow.POST_TIME}
                    diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index c278a16dc5..529a065e97 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -184,7 +184,7 @@ dd.extra { dd.mark { float: right !important; - width: 90px; + width: 9%; text-align: center; line-height: 200%; font-size: 1.2em; From 8af9a0054ccf7df26c8b9057f1d2fb2f32fd5253 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 1 Dec 2011 11:15:44 +0100 Subject: [PATCH 259/325] [ticket/10504] Revert the changes for widescreen optimisation PHPBB3-6632 Revert "[ticket/6632] Better viewing of topics for wide screen displays" This reverts commit bb733b0204aef71c40290a9c8db8ad0a7e3e3d0a. PHPBB3-6632 PHPBB3-10504 --- phpBB/styles/prosilver/template/forumlist_body.html | 6 +++--- phpBB/styles/prosilver/template/viewforum_body.html | 6 +++--- phpBB/styles/prosilver/theme/content.css | 12 +++--------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 2c2a242a9f..e9ed5d9daf 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -13,7 +13,7 @@
                    • -
                      +
                      {forumrow.FORUM_NAME}{L_FORUM}
                      {L_TOPICS}
                      {L_POSTS}
                      {L_LAST_POST}
                      @@ -26,7 +26,7 @@
                    • -
                      +
                      {forumrow.FORUM_IMAGE} @@ -36,7 +36,7 @@
                      {forumrow.L_MODERATOR_STR}: {forumrow.MODERATORS}
                      {forumrow.L_SUBFORUM_STR} {forumrow.SUBFORUMS} -
                +
                {L_REDIRECTS}: {forumrow.CLICKS}
                diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 4ad0990d98..02f42fa097 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -127,7 +127,7 @@
                • -
                  {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                  +
                  {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                  {L_REPLIES}
                  {L_VIEWS}
                  {L_LAST_POST}
                  @@ -139,12 +139,12 @@
                • - style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
                  {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} + style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">{NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {REPORTED_IMG}
                  {topicrow.PAGINATION} {topicrow.ATTACH_ICON_IMG} {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} -
                  +
                  {topicrow.REPLIES} {L_REPLIES}
                  {topicrow.VIEWS} {L_VIEWS}
                  {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 529a065e97..5f627c8f77 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -29,15 +29,10 @@ ul.topiclist li.row dl { ul.topiclist dt { display: block; float: left; - width: 100%; + width: 50%; font-size: 1.1em; padding-left: 5px; padding-right: 5px; - margin-right: -465px; -} - -ul.topiclist dt .wrap-content { - padding-right: 465px; } ul.topiclist dd { @@ -101,7 +96,6 @@ li.header dt, li.header dd { li.header dt { font-weight: bold; - margin-right: -465px; } li.header dd { @@ -132,7 +126,7 @@ dl.icon dt { } dd.posts, dd.topics, dd.views { - width: 90px; + width: 8%; text-align: center; line-height: 2.2em; font-size: 1.2em; @@ -151,7 +145,7 @@ dl.icon dt li { } dd.lastpost { - width: 230px; + width: 25%; font-size: 1.1em; } From dfb7cc625a37c6345fa647ee3a21f890ba5c9649 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 8 Dec 2011 23:35:26 +0200 Subject: [PATCH 260/325] [ticket/10319] Missing hidden fields in search form Missing hidden fields in search form (bug added in 3.0.9) PHPBB3-10319 --- phpBB/includes/functions.php | 11 ++++++++++- phpBB/viewforum.php | 9 +++++++++ phpBB/viewtopic.php | 9 +++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7ce83b871a..01b3ca92a9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4378,7 +4378,7 @@ function phpbb_http_login($param) */ function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') { - global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path; + global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; if (defined('HEADER_INC')) { @@ -4531,6 +4531,15 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 $s_search_hidden_fields['sid'] = $_SID; } + if (!empty($_EXTRA_URL)) + { + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } + } + // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( 'SITENAME' => $config['sitename'], diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 8a6b777bea..588f60b589 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -273,6 +273,15 @@ if ($_SID) $s_search_hidden_fields['sid'] = $_SID; } +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + $template->assign_vars(array( 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index df631a474c..01cd6a28a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -602,6 +602,15 @@ if ($_SID) $s_search_hidden_fields['sid'] = $_SID; } +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, From b05c325dd2d27b839a6bdce20d4e59a6fbc0c960 Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 12 Dec 2011 20:23:20 +0000 Subject: [PATCH 261/325] [ticket/10524] Changed Olympus to Ascraeus in Coding Docs in 3 places PHPBB3-10524 --- phpBB/docs/coding-guidelines.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index f835068be9..cf40173154 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -3,7 +3,7 @@ - + phpBB3 • Coding Guidelines @@ -21,7 +21,7 @@

                  Coding Guidelines

                  -

                  Olympus coding guidelines document

                  +

                  Ascraeus coding guidelines document

                  Skip

                  @@ -35,7 +35,7 @@ -

                  These are the phpBB Coding Guidelines for Olympus, all attempts should be made to follow them as closely as possible.

                  +

                  These are the phpBB Coding Guidelines for Ascraeus, all attempts should be made to follow them as closely as possible.

                  Coding Guidelines

                  From cd4958f72c249b9254f7038432cbe7a390dd93bf Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 15 Dec 2011 14:44:09 +0200 Subject: [PATCH 262/325] [ticket/10507] Sort styles in acp Sort styles by name in admin control panel PHPBB3-10507 --- phpBB/includes/acp/acp_styles.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3bc8c86500..38f4c57bd8 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -540,6 +540,7 @@ parse_css_file = {PARSE_CSS_FILE} global $user, $template, $db, $config, $phpbb_root_path, $phpEx; $sql_from = ''; + $sql_sort = 'LOWER(' . $mode . '_name)'; $style_count = array(); switch ($mode) @@ -571,6 +572,9 @@ parse_css_file = {PARSE_CSS_FILE} case 'imageset': $sql_from = STYLES_IMAGESET_TABLE; break; + + default: + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } $l_prefix = strtoupper($mode); @@ -594,7 +598,8 @@ parse_css_file = {PARSE_CSS_FILE} ); $sql = "SELECT * - FROM $sql_from"; + FROM $sql_from + ORDER BY $sql_sort ASC"; $result = $db->sql_query($sql); $installed = array(); From a3e8d3b00b4f43be8dd0a4c109eacb51677e53e2 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 15 Dec 2011 13:22:04 +0000 Subject: [PATCH 263/325] [ticket/10463] removed extra comma in malformed query in acp_styles.php PHPBB3-10463 --- phpBB/includes/acp/acp_styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index fc9acbbcb8..c480021507 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2400,7 +2400,7 @@ version = {VERSION} $select_bf = ''; } - $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, $select_bf + $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path $select_bf FROM $sql_from WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "' AND {$mode}_inherits_id = 0"; From 80149d0c872292cf7cf7be8aa1eca5641f7cd708 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 15 Dec 2011 16:18:52 +0200 Subject: [PATCH 264/325] [ticket/10507] DBAL unit test Unit test for ORDER BY LOWER(style_name) PHPBB3-10507 --- tests/dbal/fixtures/styles.xml | 39 +++++++++++++++++++++ tests/dbal/order_lower_test.php | 62 +++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 tests/dbal/fixtures/styles.xml create mode 100644 tests/dbal/order_lower_test.php diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml new file mode 100644 index 0000000000..47b384c47f --- /dev/null +++ b/tests/dbal/fixtures/styles.xml @@ -0,0 +1,39 @@ + + +
          + style_id + style_name + style_copyright + style_active + template_id + theme_id + imageset_id + + 1 + prosilver + &copy; phpBB Group + 1 + 1 + 1 + 1 + + + 2 + prosilver2 + &copy; phpBB Group + 0 + 2 + 2 + 2 + + + 3 + Prosilver1 + &copy; phpBB Group + 0 + 3 + 3 + 3 + +
          + diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php new file mode 100644 index 0000000000..fd1c950252 --- /dev/null +++ b/tests/dbal/order_lower_test.php @@ -0,0 +1,62 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/styles.xml'); + } + + public function test_cross_join() + { + $db = $this->new_dbal(); + + // http://tracker.phpbb.com/browse/PHPBB3-10507 + // Test ORDER BY LOWER(style_name) + $db->sql_return_on_error(true); + + $sql = 'SELECT * FROM phpbb_styles ORDER BY LOWER(style_name)'; + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array( + 'style_id' => 1, + 'style_name' => 'prosilver', + 'style_copyright' => '© phpBB Group', + 'style_active' => 1, + 'template_id' => 1, + 'theme_id' => 1, + 'imageset_id' => 1 + ), + array( + 'style_id' => 3, + 'style_name' => 'Prosilver1', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 3, + 'theme_id' => 3, + 'imageset_id' => 3 + ), + array( + 'style_id' => 2, + 'style_name' => 'prosilver2', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 2, + 'theme_id' => 2, + 'imageset_id' => 2 + ) + ), + $db->sql_fetchrowset($result) + ); + } +} From 18aa4e4ecd55b846ead8e15853164bb5742099ef Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 15 Dec 2011 15:13:11 +0000 Subject: [PATCH 265/325] [ticket/10535] Remove email confirm check on registration form PHPBB3-10535 --- phpBB/includes/ucp/ucp_register.php | 9 --------- phpBB/styles/prosilver/template/ucp_register.html | 4 ---- phpBB/styles/subsilver2/template/ucp_register.html | 4 ---- 3 files changed, 17 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index fe09d0a9fe..56efc4706f 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -100,7 +100,6 @@ class ucp_register $s_hidden_fields = array_merge($s_hidden_fields, array( 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => strtolower(request_var('email', '')), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => $user->lang_name, 'tz' => request_var('tz', (float) $config['board_timezone']), )); @@ -189,7 +188,6 @@ class ucp_register 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), 'email' => strtolower(request_var('email', '')), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => basename(request_var('lang', $user->lang_name)), 'tz' => request_var('tz', (float) $timezone), ); @@ -208,7 +206,6 @@ class ucp_register 'email' => array( array('string', false, 6, 60), array('email')), - 'email_confirm' => array('string', false, 6, 60), 'tz' => array('num', false, -14, 14), 'lang' => array('language_iso_name'), )); @@ -253,11 +250,6 @@ class ucp_register { $error[] = $user->lang['NEW_PASSWORD_ERROR']; } - - if ($data['email'] != $data['email_confirm']) - { - $error[] = $user->lang['NEW_EMAIL_ERROR']; - } } if (!sizeof($error)) @@ -472,7 +464,6 @@ class ucp_register 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'EMAIL' => $data['email'], - 'EMAIL_CONFIRM' => $data['email_confirm'], 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index dd0e5ad02a..30ed37eecc 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -38,10 +38,6 @@
          -
          -
          -
          -

          {L_PASSWORD_EXPLAIN}
          diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index ad6fb8d056..0c3533292d 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -41,10 +41,6 @@ {L_EMAIL_ADDRESS}: - - {L_CONFIRM_EMAIL}: - - {L_PASSWORD}:
          {L_PASSWORD_EXPLAIN} From 730d2d5d19741508f243d61f47c28af2564be6b1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Dec 2011 22:14:59 +0100 Subject: [PATCH 266/325] [ticket/8996] Revert initial fix to keep old behaviour on empty selection Revert "[ticket/8996] Also fix the BBCode bug in subsilver2 and acp" This reverts commit eb1f15bc8b7b7a284b25b2c9b9942714b6848ebc. PHPBB3-8996 --- phpBB/adm/style/editor.js | 68 +++++++-------- phpBB/styles/prosilver/template/editor.js | 61 +++++++------- phpBB/styles/subsilver2/template/editor.js | 96 +++++++++++----------- 3 files changed, 108 insertions(+), 117 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 600fa254cf..217aa699e2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; if(document.forms[form_name]) @@ -66,7 +66,7 @@ function bbstyle(bbnumber) else { insert_text('[*]'); - document.forms[form_name].elements[text_name].focus(); + document.forms[form_name].elements[text_name].focus(); } } @@ -76,7 +76,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -84,10 +84,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -98,10 +102,10 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; - var new_pos = caret_pos + bbopen.length; + var new_pos = caret_pos + bbopen.length; // Open tag insert_text(bbopen + bbclose); @@ -112,12 +116,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", bbopen.length); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -132,7 +136,7 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - + if (!popup) { textarea = document.forms[form_name].elements[text_name]; @@ -155,18 +159,18 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } - + } + else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); } var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; - + } else { @@ -229,7 +233,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(//ig, '\n'); theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); - theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/&\;/ig, '&'); theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) @@ -264,7 +268,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -288,17 +292,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -334,7 +328,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -374,9 +368,9 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if (txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; @@ -390,19 +384,19 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; - caretPos.end = txtarea.sel_start; + caretPos.end = txtarea.sel_start; } return caretPos; diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 5aa486d320..957c39b568 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -28,8 +28,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -37,7 +37,7 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -86,10 +86,10 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection + textarea = document.forms[form_name].elements[text_name]; if (textarea.createTextRange && textarea.caretPos) { textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); return; } } @@ -100,7 +100,7 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; var new_pos = caret_pos + bbopen.length; @@ -114,12 +114,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -134,16 +134,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -161,7 +161,7 @@ function insert_text(text, spaces, popup) } else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); @@ -174,7 +174,7 @@ function insert_text(text, spaces, popup) { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); } @@ -291,7 +291,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -319,7 +319,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -351,9 +351,7 @@ function storeCaret(textEl) // Did the user press Shift (16), Ctrl (17) or Alt (18)? // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if ((!is_ie || (keyCode != 16 && keyCode != 17 && keyCode != 18)) && (textEl.createTextRange)) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -389,7 +387,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -429,32 +427,33 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if(!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if (document.selection) + else if(document.selection) { + // get current selection var range = document.selection.createRange(); // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; caretPos.end = txtarea.sel_start; diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 5aa486d320..7cc5de9034 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -6,8 +6,8 @@ // Startup variables var imageTag = false; var theSelection = false; - var bbcodeEnabled = true; + // Check for Browser & Platform for PC & IE specific bits // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html var clientPC = navigator.userAgent.toLowerCase(); // Get client info @@ -15,6 +15,7 @@ var clientVer = parseInt(navigator.appVersion); // Get browser version var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1)); var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); + var baseHeight; /** @@ -28,8 +29,8 @@ function helpline(help) /** * Fix a bug involving the TextRange object. From * http://www.frostjedi.com/terra/scripts/demo/caretBug.html -*/ -function initInsertions() +*/ +function initInsertions() { var doc; @@ -37,15 +38,14 @@ function initInsertions() { doc = document; } - else + else { doc = opener.document; } var textarea = doc.forms[form_name].elements[text_name]; - if (is_ie && typeof(baseHeight) != 'number') - { + { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; @@ -60,12 +60,12 @@ function initInsertions() * bbstyle */ function bbstyle(bbnumber) -{ +{ if (bbnumber != -1) { bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); - } - else + } + else { insert_text('[*]'); document.forms[form_name].elements[text_name].focus(); @@ -78,7 +78,7 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - + var textarea = document.forms[form_name].elements[text_name]; textarea.focus(); @@ -86,10 +86,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; - textarea.focus(); + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -100,7 +104,7 @@ function bbfontstyle(bbopen, bbclose) theSelection = ''; return; } - + //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; var new_pos = caret_pos + bbopen.length; @@ -114,12 +118,12 @@ function bbfontstyle(bbopen, bbclose) { textarea.selectionStart = new_pos; textarea.selectionEnd = new_pos; - } + } // IE else if (document.selection) { - var range = textarea.createTextRange(); - range.move("character", new_pos); + var range = textarea.createTextRange(); + range.move("character", new_pos); range.select(); storeCaret(textarea); } @@ -134,16 +138,16 @@ function bbfontstyle(bbopen, bbclose) function insert_text(text, spaces, popup) { var textarea; - - if (!popup) + + if (!popup) { textarea = document.forms[form_name].elements[text_name]; - } - else + } + else { textarea = opener.document.forms[form_name].elements[text_name]; } - if (spaces) + if (spaces) { text = ' ' + text + ' '; } @@ -158,26 +162,28 @@ function insert_text(text, spaces, popup) mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; - } + } + else if (textarea.createTextRange && textarea.caretPos) { - if (baseHeight != textarea.caretPos.boundingHeight) + if (baseHeight != textarea.caretPos.boundingHeight) { textarea.focus(); storeCaret(textarea); - } - + } var caret_pos = textarea.caretPos; caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; + } else { textarea.value = textarea.value + text; } - if (!popup) + if (!popup) { textarea.focus(); - } + } + } /** @@ -273,6 +279,7 @@ function addquote(post_id, username, l_wrote) return; } + function split_lines(text) { var lines = text.split('\n'); @@ -291,7 +298,7 @@ function split_lines(text) do { var splitAt = line.indexOf(' ', 80); - + if (splitAt == -1) { splitLines[j] = line; @@ -309,6 +316,7 @@ function split_lines(text) } return splitLines; } + /** * From http://www.massless.org/mozedit/ */ @@ -319,7 +327,7 @@ function mozWrap(txtarea, open, close) var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd == 1 || selEnd == 2) + if (selEnd == 1 || selEnd == 2) { selEnd = selLength; } @@ -343,17 +351,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - var is_control_key = (keyCode == 16 || keyCode == 17 || keyCode == 18); - - if ((!is_ie || !is_control_key) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -389,7 +387,7 @@ function colorPalette(dir, width, height) { document.writeln(''); } - + for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); @@ -429,15 +427,15 @@ function caretPosition() function getCaretPosition(txtarea) { var caretPos = new caretPosition(); - + // simple Gecko/Opera way - if (!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if(txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way - else if (document.selection) + else if(document.selection) { // get current selection var range = document.selection.createRange(); @@ -445,16 +443,16 @@ function getCaretPosition(txtarea) // a new selection of the whole textarea var range_all = document.body.createTextRange(); range_all.moveToElementText(txtarea); - + // calculate selection start point by moving beginning of range_all to beginning of range var sel_start; for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) - { + { range_all.moveStart('character', 1); } - + txtarea.sel_start = sel_start; - + // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; caretPos.end = txtarea.sel_start; From 2bf4e8d3d0ad86038fe5ff84d3b48517b8033fc8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Dec 2011 22:17:39 +0100 Subject: [PATCH 267/325] [ticket/8996] Revert initial fix to keep old behaviour on empty selection Part2 Revert "[ticket/8996] Correctly apply BBCodes in IE6-9 when applying with accesskey" This reverts commit 219bdbaf7044bd203755ed138d109cf39ccdb837. PHPBB3-8996 --- phpBB/styles/prosilver/template/editor.js | 26 ++++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 957c39b568..cfdb54f54b 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -86,10 +86,14 @@ function bbfontstyle(bbopen, bbclose) if ((clientVer >= 4) && is_ie && is_win) { // Get text selection - textarea = document.forms[form_name].elements[text_name]; - if (textarea.createTextRange && textarea.caretPos) + theSelection = document.selection.createRange().text; + + if (theSelection) { - textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose; + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + document.forms[form_name].elements[text_name].focus(); + theSelection = ''; return; } } @@ -103,7 +107,7 @@ function bbfontstyle(bbopen, bbclose) //The new position for the cursor after adding the bbcode var caret_pos = getCaretPosition(textarea).start; - var new_pos = caret_pos + bbopen.length; + var new_pos = caret_pos + bbopen.length; // Open tag insert_text(bbopen + bbclose); @@ -343,15 +347,7 @@ function mozWrap(txtarea, open, close) */ function storeCaret(textEl) { - var keyCode = false; - if (is_ie) - { - keyCode = (event.keyCode) ? event.keyCode : event.charCode; - } - - // Did the user press Shift (16), Ctrl (17) or Alt (18)? - // If so, we do not update the caretPos, so BBCodes can still be applied correctly. - if ((!is_ie || (keyCode != 16 && keyCode != 17 && keyCode != 18)) && (textEl.createTextRange)) + if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); } @@ -429,7 +425,7 @@ function getCaretPosition(txtarea) var caretPos = new caretPosition(); // simple Gecko/Opera way - if(!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0)) + if(txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; @@ -456,7 +452,7 @@ function getCaretPosition(txtarea) // we ignore the end value for IE, this is already dirty enough and we don't need it caretPos.start = txtarea.sel_start; - caretPos.end = txtarea.sel_start; + caretPos.end = txtarea.sel_start; } return caretPos; From 0cfa843677eaac952df910c19df345452680d2ce Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Dec 2011 23:17:16 +0100 Subject: [PATCH 268/325] [ticket/10531] Disallow deleting of the last style Regression from PHPBB3-9675 commit 0e02f5cb0b7f615f1eadd6606a89bfd1b28f0d0d PHPBB3-9675 PHPBB3-10531 --- phpBB/includes/acp/acp_styles.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3bc8c86500..5300265686 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1634,6 +1634,13 @@ parse_css_file = {PARSE_CSS_FILE} trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } + $s_only_component = $this->display_component_options($mode, $style_row[$mode . '_id'], $style_row); + + if ($s_only_component) + { + trigger_error($user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); + } + if ($update) { if ($mode == 'style') @@ -1678,8 +1685,6 @@ parse_css_file = {PARSE_CSS_FILE} trigger_error($user->lang[$message] . adm_back_link($this->u_action)); } - $this->display_component_options($mode, $style_row[$mode . '_id'], $style_row); - $this->page_title = 'DELETE_' . $l_prefix; $template->assign_vars(array( @@ -1765,11 +1770,14 @@ parse_css_file = {PARSE_CSS_FILE} /** * Display the options which can be used to replace a style/template/theme/imageset + * + * @return boolean Returns true if the component is the only component and can not be deleted. */ function display_component_options($component, $component_id, $style_row = false, $style_id = false) { global $db, $template, $user; + $is_only_component = true; $component_in_use = array(); if ($component != 'style') { @@ -1801,6 +1809,9 @@ parse_css_file = {PARSE_CSS_FILE} $s_options = ''; if (($component != 'style') && empty($component_in_use)) { + // If it is not in use, there must be another component + $is_only_component = false; + $sql = "SELECT {$component}_id, {$component}_name FROM $sql_from WHERE {$component}_id = {$component_id}"; @@ -1824,6 +1835,7 @@ parse_css_file = {PARSE_CSS_FILE} { if ($row[$component . '_id'] != $component_id) { + $is_only_component = false; $s_options .= ''; } else if ($component != 'style') @@ -1851,6 +1863,8 @@ parse_css_file = {PARSE_CSS_FILE} } } } + + return $is_only_component; } /** From d73c3a297e1f31320c054685d5e38cb72a6357f3 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 15 Dec 2011 23:15:24 +0000 Subject: [PATCH 269/325] [ticket/10535] Removed email confirm from UCP, removed unused language entries PHPBB3-10535 --- phpBB/includes/ucp/ucp_profile.php | 7 ------- phpBB/language/en/ucp.php | 4 ---- .../styles/prosilver/template/ucp_profile_reg_details.html | 6 ------ 3 files changed, 17 deletions(-) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 6eb11e6e59..2bc438e042 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -47,7 +47,6 @@ class ucp_profile $data = array( 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 'email' => strtolower(request_var('email', $user->data['user_email'])), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'cur_password' => request_var('cur_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), @@ -66,7 +65,6 @@ class ucp_profile 'email' => array( array('string', false, 6, 60), array('email')), - 'email_confirm' => array('string', true, 6, 60), ); if ($auth->acl_get('u_chgname') && $config['allow_namechange']) @@ -79,11 +77,6 @@ class ucp_profile $error = validate_data($data, $check_ary); - if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) - { - $error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY'; - } - if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) { $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 59e5cb1952..227b1c92a3 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -123,8 +123,6 @@ $lang = array_merge($lang, array( 'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s†folder%2$s', 'CONFIRMATION' => 'Confirmation of registration', 'CONFIRM_CHANGES' => 'Confirm changes', - 'CONFIRM_EMAIL' => 'Confirm e-mail address', - 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your e-mail address.', 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', 'VC_REFRESH' => 'Refresh confirmation code', 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code you can request a new one by clicking the button.', @@ -283,8 +281,6 @@ $lang = array_merge($lang, array( 'MOVE_TO_FOLDER' => 'Move to folder', 'MOVE_UP' => 'Move up', - 'NEW_EMAIL_CONFIRM_EMPTY' => 'You did not enter a confirm e-mail address.', - 'NEW_EMAIL_ERROR' => 'The e-mail addresses you entered do not match.', 'NEW_FOLDER_NAME' => 'New folder name', 'NEW_PASSWORD' => 'New password', 'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.', diff --git a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html index 9c3e98d053..9d4a9e3463 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html +++ b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html @@ -20,12 +20,6 @@
          {EMAIL}
          - -
          -

          {L_CONFIRM_EMAIL_EXPLAIN}
          -
          -
          -

          {L_CHANGE_PASSWORD_EXPLAIN}
          From fd58a0ad374cfd535b0aff2f4bf1564a479fcdd0 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 15 Dec 2011 23:17:21 +0000 Subject: [PATCH 270/325] [ticket/10535] Forgot a subsilver2 change. *doh* PHPBB3-10535 --- .../styles/subsilver2/template/ucp_profile_reg_details.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html index 1b1c28fa3b..96e2e26683 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html @@ -22,12 +22,6 @@ {L_EMAIL_ADDRESS}: {EMAIL} - - - {L_CONFIRM_EMAIL}:
          {L_CONFIRM_EMAIL_EXPLAIN} - - - {L_NEW_PASSWORD}:
          {L_CHANGE_PASSWORD_EXPLAIN} From ba576f823b612b441f221b12be525e9638016910 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 16 Dec 2011 18:03:46 +0100 Subject: [PATCH 271/325] [prep-release-3.0.10] Update Changelog for 3.0.10-RC3 release. --- phpBB/docs/CHANGELOG.html | 238 +++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 117 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a4bbfb7d7f..a0690819d2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -95,132 +95,136 @@

          Bug

            -
          • [PHPBB3-5506] - Deleting all items from last page results in empty list display
          • -
          • [PHPBB3-6458] - Width of Topics and Posts columns in Board Index is causing problems with language packs
          • -
          • [PHPBB3-6632] - Better viewing of topics for wide screen displays
          • -
          • [PHPBB3-7138] - Cannot display simple header/footer with trigger_error()
          • -
          • [PHPBB3-7291] - Broken links of char selection in memberlist
          • -
          • [PHPBB3-7932] - Fix font size in select boxes
          • -
          • [PHPBB3-8094] - Text in the forums.php and install.php not matching
          • -
          • [PHPBB3-8173] - Redundant BBCode helpline in JS
          • -
          • [PHPBB3-8177] - February 29th birthdays not shown in non-leap year
          • -
          • [PHPBB3-8571] - Users can make their age a negative number on memberlist
          • -
          • [PHPBB3-8691] - Error creating log_time index
          • -
          • [PHPBB3-8937] - Code tags - single space indent
          • -
          • [PHPBB3-8996] - Wrong position when adding BBCodes with accesskey in IE
          • -
          • [PHPBB3-9008] - Incorrect unread topic tracking for unapproved topics
          • -
          • [PHPBB3-9066] - Invalid Prefix Names Allowed
          • -
          • [PHPBB3-9416] - HTML entities in poll titles and options incorrectly re-encoded
          • -
          • [PHPBB3-9525] - Minimum characters per post/message should never be '0'
          • -
          • [PHPBB3-9645] - XHTML error on phpinfo page in ACP
          • -
          • [PHPBB3-9776] - When deleting and recreating a poll, old options aren't deleted and reappear with the new ones
          • -
          • [PHPBB3-9956] - No error message displayed when disapprove reason is invalid or empty
          • -
          • [PHPBB3-9976] - Direct post links open the wrong page of viewtopic when multiple posts are posted in the same second
          • -
          • [PHPBB3-9978] - Missing semicolons in // <![CDATA[ part of overall_header.html
          • -
          • [PHPBB3-10087] - Limited browser support for ban exclusion emphasis
          • -
          • [PHPBB3-10157] - Missing error handling when a custom profile field is not defined for current language
          • -
          • [PHPBB3-10166] - Post-admin activation email confusingly refers to username
          • -
          • [PHPBB3-10187] - XHTML error in ucp_groups_manage.html
          • -
          • [PHPBB3-10190] - Misleading information about permissions displayed after editing forum settings
          • -
          • [PHPBB3-10212] - Captcha not displayed when username not exists
          • -
          • [PHPBB3-10216] - Updater's failed query language grammatically incorrect
          • -
          • [PHPBB3-10226] - Mysqli dbal extension does not allow connection via pipes
          • -
          • [PHPBB3-10227] - Mysqli dbal extension does not allow persistent connection for PHP >= 5.3.0
          • -
          • [PHPBB3-10237] - Unwatching a forum/topic does not check for correct hash parameter
          • -
          • [PHPBB3-10240] - Word filter evasion
          • -
          • [PHPBB3-10253] - IE9 Quote problem
          • -
          • [PHPBB3-10255] - gitignore ignores too much
          • -
          • [PHPBB3-10257] - AAAA record parsing fails on older versions of Windows
          • -
          • [PHPBB3-10259] - Incorrect email on joining Open group
          • -
          • [PHPBB3-10265] - Unit test tests/random/mt_rand.php is not run because of missing _test suffix.
          • -
          • [PHPBB3-10266] - Poor navigation links after reporting a post
          • -
          • [PHPBB3-10267] - Missing strlen() on $table_prefix in db tools index name length check
          • -
          • [PHPBB3-10274] - Hardcoded module ID in "Re-check version" link on ACP front page
          • -
          • [PHPBB3-10275] - Wrong information about sent passwords in FAQ
          • -
          • [PHPBB3-10292] - Whitespace inconsistency in acp_ranks
          • -
          • [PHPBB3-10293] - Jumpbox allows jumping to invalid forums in prosilver
          • -
          • [PHPBB3-10294] - sqlsrv_rows_affected non-functional in MSSQLNative.php
          • -
          • [PHPBB3-10296] - incorrect cross join in SQL Server
          • -
          • [PHPBB3-10298] - EMBED Tag Not Closed Properly In subSilver2 attachment.html
          • -
          • [PHPBB3-10299] - Typo in comment about $max_store_length in truncate_string() (in functions_content.php)
          • -
          • [PHPBB3-10303] - send_status_line() doesn't validate user input
          • -
          • [PHPBB3-10304] - Bad url in U_ICQ on /ucp_mp_viewmessage.php
          • -
          • [PHPBB3-10307] - Return value of $db->sql_fetchrow() on empty tables is not consistent
          • -
          • [PHPBB3-10309] - Utf tests download data into temporary locations deep in source tree
          • -
          • [PHPBB3-10320] - "Most active topic" can leak topic title of topics in password-protected forums
          • -
          • [PHPBB3-10321] - Link to page 1 of the Memberlist has a useless question mark at the end
          • -
          • [PHPBB3-10324] - XHTML error in Prosilver - MCP - User Notes
          • -
          • [PHPBB3-10339] - Typo in prosilver's mcp_front.html
          • -
          • [PHPBB3-10341] - Topic title of "0" does not show as "Most active topic"
          • -
          • [PHPBB3-10351] - Invalid syntax for Oracle's sql_column_remove()
          • -
          • [PHPBB3-10352] - Missing break for Oracle's sql_table_drop()
          • -
          • [PHPBB3-10365] - Moderators can view forbidden information
          • -
          • [PHPBB3-10377] - All moderators can change topic type
          • -
          • [PHPBB3-10394] - Tests use call-time pass by reference which results in Fatal error on PHP 5.4
          • -
          • [PHPBB3-10397] - Pagination code inconsistency
          • -
          • [PHPBB3-10400] - '0' (zero) not allowed as forum name
          • -
          • [PHPBB3-10408] - Layout of topics/attachments list is broken in UCP and MCP
          • -
          • [PHPBB3-10413] - Make create_schema_files usable
          • -
          • [PHPBB3-10416] - Use dbport in phpbb_database_test_connection_manager::connect()
          • -
          • [PHPBB3-10420] - Update startup to account for PHP 5.4
          • -
          • [PHPBB3-10421] - Interchanged parameters in includes/acp/acp_users.php
          • -
          • [PHPBB3-10422] - Unnecessary <!-- IF --> statement in viewtopic_body.html
          • -
          • [PHPBB3-10435] - Topic count mismatch on viewforum
          • -
          • [PHPBB3-10437] - Announcements on moderation queue are not hidden
          • -
          • [PHPBB3-10446] - Unencoded 8bit characters in email headers
          • -
          • [PHPBB3-10452] - XHTML error when printing a PM
          • -
          • [PHPBB3-10461] - MCP's recent actions list is empty
          • -
          • [PHPBB3-10479] - Remove PostgreSQL version numbers from driver's language string
          • -
          • [PHPBB3-10485] - XHTML error in Prosilver - index and viewforum
          • -
          • [PHPBB3-10488] - Database updater for 3.0.10-RC1 overwrites config variable email_max_chunk_size without checking for custom value
          • -
          • [PHPBB3-10497] - SQL error when guest visits forum with unread topic
          • +
          • [PHPBB3-5506] - Deleting all items from last page results in empty list display
          • +
          • [PHPBB3-6458] - Width of Topics and Posts columns in Board Index is causing problems with language packs
          • +
          • [PHPBB3-7138] - Cannot display simple header/footer with trigger_error()
          • +
          • [PHPBB3-7291] - Broken links of char selection in memberlist
          • +
          • [PHPBB3-7932] - Fix font size in select boxes
          • +
          • [PHPBB3-8094] - Text in the forums.php and install.php not matching
          • +
          • [PHPBB3-8173] - Redundant BBCode helpline in JS
          • +
          • [PHPBB3-8177] - February 29th birthdays not shown in non-leap year
          • +
          • [PHPBB3-8571] - Users can make their age a negative number on memberlist
          • +
          • [PHPBB3-8691] - Error creating log_time index
          • +
          • [PHPBB3-8937] - Code tags - single space indent
          • +
          • [PHPBB3-9008] - Incorrect unread topic tracking for unapproved topics
          • +
          • [PHPBB3-9066] - Invalid Prefix Names Allowed
          • +
          • [PHPBB3-9416] - HTML entities in poll titles and options incorrectly re-encoded
          • +
          • [PHPBB3-9525] - Minimum characters per post/message should never be '0'
          • +
          • [PHPBB3-9645] - XHTML error on phpinfo page in ACP
          • +
          • [PHPBB3-9776] - When deleting and recreating a poll, old options aren't deleted and reappear with the new ones
          • +
          • [PHPBB3-9956] - No error message displayed when disapprove reason is invalid or empty
          • +
          • [PHPBB3-9976] - Direct post links open the wrong page of viewtopic when multiple posts are posted in the same second
          • +
          • [PHPBB3-9978] - Missing semicolons in // <![CDATA[ part of overall_header.html
          • +
          • [PHPBB3-10087] - Limited browser support for ban exclusion emphasis
          • +
          • [PHPBB3-10157] - Missing error handling when a custom profile field is not defined for current language
          • +
          • [PHPBB3-10166] - Post-admin activation email confusingly refers to username
          • +
          • [PHPBB3-10187] - XHTML error in ucp_groups_manage.html
          • +
          • [PHPBB3-10190] - Misleading information about permissions displayed after editing forum settings
          • +
          • [PHPBB3-10212] - Captcha not displayed when username not exists
          • +
          • [PHPBB3-10216] - Updater's failed query language grammatically incorrect
          • +
          • [PHPBB3-10226] - Mysqli dbal extension does not allow connection via pipes
          • +
          • [PHPBB3-10227] - Mysqli dbal extension does not allow persistent connection for PHP >= 5.3.0
          • +
          • [PHPBB3-10237] - Unwatching a forum/topic does not check for correct hash parameter
          • +
          • [PHPBB3-10240] - Word filter evasion
          • +
          • [PHPBB3-10253] - IE9 Quote problem
          • +
          • [PHPBB3-10255] - gitignore ignores too much
          • +
          • [PHPBB3-10257] - AAAA record parsing fails on older versions of Windows
          • +
          • [PHPBB3-10259] - Incorrect email on joining Open group
          • +
          • [PHPBB3-10265] - Unit test tests/random/mt_rand.php is not run because of missing _test suffix.
          • +
          • [PHPBB3-10266] - Poor navigation links after reporting a post
          • +
          • [PHPBB3-10267] - Missing strlen() on $table_prefix in db tools index name length check
          • +
          • [PHPBB3-10274] - Hardcoded module ID in "Re-check version" link on ACP front page
          • +
          • [PHPBB3-10275] - Wrong information about sent passwords in FAQ
          • +
          • [PHPBB3-10292] - Whitespace inconsistency in acp_ranks
          • +
          • [PHPBB3-10293] - Jumpbox allows jumping to invalid forums in prosilver
          • +
          • [PHPBB3-10294] - sqlsrv_rows_affected non-functional in MSSQLNative.php
          • +
          • [PHPBB3-10296] - incorrect cross join in SQL Server
          • +
          • [PHPBB3-10298] - EMBED Tag Not Closed Properly In subSilver2 attachment.html
          • +
          • [PHPBB3-10299] - Typo in comment about $max_store_length in truncate_string() (in functions_content.php)
          • +
          • [PHPBB3-10303] - send_status_line() doesn't validate user input
          • +
          • [PHPBB3-10304] - Bad url in U_ICQ on /ucp_mp_viewmessage.php
          • +
          • [PHPBB3-10307] - Return value of $db->sql_fetchrow() on empty tables is not consistent
          • +
          • [PHPBB3-10309] - Utf tests download data into temporary locations deep in source tree
          • +
          • [PHPBB3-10320] - "Most active topic" can leak topic title of topics in password-protected forums
          • +
          • [PHPBB3-10321] - Link to page 1 of the Memberlist has a useless question mark at the end
          • +
          • [PHPBB3-10324] - XHTML error in Prosilver - MCP - User Notes
          • +
          • [PHPBB3-10339] - Typo in prosilver's mcp_front.html
          • +
          • [PHPBB3-10341] - Topic title of "0" does not show as "Most active topic"
          • +
          • [PHPBB3-10351] - Invalid syntax for Oracle's sql_column_remove()
          • +
          • [PHPBB3-10352] - Missing break for Oracle's sql_table_drop()
          • +
          • [PHPBB3-10365] - Moderators can view forbidden information
          • +
          • [PHPBB3-10377] - All moderators can change topic type
          • +
          • [PHPBB3-10394] - Tests use call-time pass by reference which results in Fatal error on PHP 5.4
          • +
          • [PHPBB3-10397] - Pagination code inconsistency
          • +
          • [PHPBB3-10400] - '0' (zero) not allowed as forum name
          • +
          • [PHPBB3-10413] - Make create_schema_files usable
          • +
          • [PHPBB3-10416] - Use dbport in phpbb_database_test_connection_manager::connect()
          • +
          • [PHPBB3-10420] - Update startup to account for PHP 5.4
          • +
          • [PHPBB3-10421] - Interchanged parameters in includes/acp/acp_users.php
          • +
          • [PHPBB3-10422] - Unnecessary <!-- IF --> statement in viewtopic_body.html
          • +
          • [PHPBB3-10435] - Topic count mismatch on viewforum
          • +
          • [PHPBB3-10437] - Announcements on moderation queue are not hidden
          • +
          • [PHPBB3-10446] - Unencoded 8bit characters in email headers
          • +
          • [PHPBB3-10452] - XHTML error when printing a PM
          • +
          • [PHPBB3-10461] - MCP's recent actions list is empty
          • +
          • [PHPBB3-10479] - Remove PostgreSQL version numbers from driver's language string
          • +
          • [PHPBB3-10485] - XHTML error in Prosilver - index and viewforum
          • +
          • [PHPBB3-10488] - Database updater for 3.0.10-RC1 overwrites config variable email_max_chunk_size without checking for custom value
          • +
          • [PHPBB3-10497] - SQL error when guest visits forum with unread topic
          • +
          • [PHPBB3-10319] - Missing hidden fields in search form
          • +
          • [PHPBB3-10501] - Description of table prefix is wrong
          • +
          • [PHPBB3-10502] - CHANGELOG.html has a typo: 'red' should be 'read'.
          • +
          • [PHPBB3-10503] - Debug error when previewing edits
          • +
          • [PHPBB3-10504] - MCP Layout STILL broken in ProSilver when screen is resized to less 1200 pixels
          • +
          • [PHPBB3-10531] - Last remaining style can be uninstalled

          Improvement

            -
          • [PHPBB3-8616] - Add direct link to PM to notification message
          • -
          • [PHPBB3-9036] - Forums that can be listed but not read expose forum information
          • -
          • [PHPBB3-9297] - Add support for Extended Passive Mode (EPSV) in class ftp_fsock to better support IPv6 connections.
          • -
          • [PHPBB3-9307] - Mass email $max_chunk_size
          • -
          • [PHPBB3-9361] - Edit account settings - Improved clarification needed
          • -
          • [PHPBB3-9778] - Member Search from the Admin Control Panel is not Intuitive
          • -
          • [PHPBB3-9898] - Readme needs updating to reflect more opening for patches
          • -
          • [PHPBB3-9995] - Unnecessary coding in display_forums() in functions_display.php
          • -
          • [PHPBB3-10032] - BBCode Add List Item Control Name Contains Typo
          • -
          • [PHPBB3-10074] - Change default value of 'Set as special rank' to No for Add new rank
          • -
          • [PHPBB3-10185] - Board startdate not being set
          • -
          • [PHPBB3-10189] - Add "automatically generated" comment into schema-files.
          • -
          • [PHPBB3-10199] - Performance: viewtopic has a useless join
          • -
          • [PHPBB3-10222] - Also build language and styles changes in diff/patch format
          • -
          • [PHPBB3-10239] - Add "Are you sure" confirmation to backup restore in ACP
          • -
          • [PHPBB3-10243] - Add gmgetdate() wrapper for getdate() which returns dates in UTC.
          • -
          • [PHPBB3-10245] - Messenger uses output buffering for error collection, should use error collector instead
          • -
          • [PHPBB3-10246] - Remove VCS section from docs/coding-guidelines.html
          • -
          • [PHPBB3-10254] - Remove style names from themes and fix some information on it
          • -
          • [PHPBB3-10263] - Add phpbb_version_compare() wrapper for version_compare()
          • -
          • [PHPBB3-10278] - Improve timeout handling in get_remote_file()
          • -
          • [PHPBB3-10315] - Radio Buttons in ACP are clipped in Safari - Fix suggested
          • -
          • [PHPBB3-10327] - Use "ALTER TABLE ... ADD INDEX" instead of "CREATE INDEX"
          • -
          • [PHPBB3-10334] - Birthday List display not dependent on user privileges
          • -
          • [PHPBB3-10335] - Responses to bots should have extra header to be used by reverse proxies
          • -
          • [PHPBB3-10346] - Add drop_tables key for database updater
          • -
          • [PHPBB3-10354] - When template tests are skipped because cache is not writable, print cache directory path
          • -
          • [PHPBB3-10369] - Change error collector to always report errfile and errline
          • -
          • [PHPBB3-10370] - Various improvements for get_backtrace()
          • -
          • [PHPBB3-10402] - Displaying report texts with linebreaks and clickable links
          • -
          • [PHPBB3-10419] - Add mbstring PHP ini parameters checks to ACP
          • -
          • [PHPBB3-10430] - Some typos and the like in docs/coding-guidelines.html
          • +
          • [PHPBB3-8616] - Add direct link to PM to notification message
          • +
          • [PHPBB3-9036] - Forums that can be listed but not read expose forum information
          • +
          • [PHPBB3-9297] - Add support for Extended Passive Mode (EPSV) in class ftp_fsock to better support IPv6 connections.
          • +
          • [PHPBB3-9307] - Mass email $max_chunk_size
          • +
          • [PHPBB3-9361] - Edit account settings - Improved clarification needed
          • +
          • [PHPBB3-9778] - Member Search from the Admin Control Panel is not Intuitive
          • +
          • [PHPBB3-9898] - Readme needs updating to reflect more opening for patches
          • +
          • [PHPBB3-9995] - Unnecessary coding in display_forums() in functions_display.php
          • +
          • [PHPBB3-10032] - BBCode Add List Item Control Name Contains Typo
          • +
          • [PHPBB3-10074] - Change default value of 'Set as special rank' to No for Add new rank
          • +
          • [PHPBB3-10185] - Board startdate not being set
          • +
          • [PHPBB3-10189] - Add "automatically generated" comment into schema-files.
          • +
          • [PHPBB3-10199] - Performance: viewtopic has a useless join
          • +
          • [PHPBB3-10222] - Also build language and styles changes in diff/patch format
          • +
          • [PHPBB3-10239] - Add "Are you sure" confirmation to backup restore in ACP
          • +
          • [PHPBB3-10243] - Add gmgetdate() wrapper for getdate() which returns dates in UTC.
          • +
          • [PHPBB3-10245] - Messenger uses output buffering for error collection, should use error collector instead
          • +
          • [PHPBB3-10246] - Remove VCS section from docs/coding-guidelines.html
          • +
          • [PHPBB3-10254] - Remove style names from themes and fix some information on it
          • +
          • [PHPBB3-10263] - Add phpbb_version_compare() wrapper for version_compare()
          • +
          • [PHPBB3-10278] - Improve timeout handling in get_remote_file()
          • +
          • [PHPBB3-10315] - Radio Buttons in ACP are clipped in Safari - Fix suggested
          • +
          • [PHPBB3-10327] - Use "ALTER TABLE ... ADD INDEX" instead of "CREATE INDEX"
          • +
          • [PHPBB3-10334] - Birthday List display not dependent on user privileges
          • +
          • [PHPBB3-10335] - Responses to bots should have extra header to be used by reverse proxies
          • +
          • [PHPBB3-10346] - Add drop_tables key for database updater
          • +
          • [PHPBB3-10354] - When template tests are skipped because cache is not writable, print cache directory path
          • +
          • [PHPBB3-10369] - Change error collector to always report errfile and errline
          • +
          • [PHPBB3-10370] - Various improvements for get_backtrace()
          • +
          • [PHPBB3-10402] - Displaying report texts with linebreaks and clickable links
          • +
          • [PHPBB3-10419] - Add mbstring PHP ini parameters checks to ACP
          • +
          • [PHPBB3-10430] - Some typos and the like in docs/coding-guidelines.html

          New Feature

            -
          • [PHPBB3-8240] - Request: db_tools to have two additional functions, table list and column list
          • +
          • [PHPBB3-8240] - Request: db_tools to have two additional functions, table list and column list

          Task

          1.ii. Changes since 3.0.8

          From 82fff947c641665b80941814813e07e898a7676c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 19 Dec 2011 14:24:39 +0100 Subject: [PATCH 272/325] [ticket/10538] Call htmlspecialchars_decode() on Jabber and SMTP passwords. PHPBB3-10538 --- phpBB/includes/functions_messenger.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 91b361183c..6549693333 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -568,7 +568,7 @@ class messenger if (!$use_queue) { include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']); if (!$this->jabber->connect()) { @@ -769,7 +769,7 @@ class queue } include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']); if (!$this->jabber->connect()) { @@ -1022,7 +1022,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } // Let me in. This function handles the complete authentication process - if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], $config['smtp_password'], $config['smtp_auth_method'])) + if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], htmlspecialchars_decode($config['smtp_password']), $config['smtp_auth_method'])) { $smtp->close_session($err_msg); return false; From 53617dfce57ba23caa163a871797cec26b88403b Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 21 Dec 2011 03:28:00 +0000 Subject: [PATCH 273/325] [ticket/10541] Fixed empty drop-down menu bug PHPBB3-10541 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c1ad28ca14..631d3bf272 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -120,7 +120,7 @@ class acp_users // Build modes dropdown list $sql = 'SELECT module_mode, module_auth FROM ' . MODULES_TABLE . " - WHERE module_basename = 'users' + WHERE module_basename = 'acp_users' AND module_enabled = 1 AND module_class = 'acp' ORDER BY left_id, module_mode"; From fa2edf518748e3ec812857cf913235793216a027 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 23 Dec 2011 00:26:26 -0500 Subject: [PATCH 274/325] [ticket/10546] Add missing argument to adm_back_link in acp_captcha. PHPBB3-10546 --- phpBB/includes/acp/acp_captcha.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 1893eed14f..469a367bba 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -96,7 +96,7 @@ class acp_captcha } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link(), E_USER_WARNING); + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } else { From 7779dae2cc256eafb6fa9dc1bc882b52c4b1d8ca Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 25 Jun 2010 15:19:10 +0200 Subject: [PATCH 275/325] [ticket/9681] Add password length to security settings PHPBB3-9681 --- phpBB/includes/acp/acp_board.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 8c761e51fe..f437dca8f9 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -383,6 +383,8 @@ class acp_board 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), From 4baa2bb52c47b0b0e316c3a25f34e7bc27075ffd Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 23 Dec 2011 21:55:49 +0000 Subject: [PATCH 276/325] [ticket/10535] Removed email confirm field from acp_users module PHPBB3-10535 --- phpBB/adm/style/acp_users_overview.html | 4 ---- phpBB/includes/acp/acp_users.php | 7 ------- 2 files changed, 11 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 9237e45daf..1f10e7f66e 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -45,10 +45,6 @@
          -
          -

          {L_CONFIRM_EMAIL_EXPLAIN}
          -
          -

          {L_CHANGE_PASSWORD_EXPLAIN}
          diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c1ad28ca14..cf5650a901 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -757,7 +757,6 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), ); @@ -789,7 +788,6 @@ class acp_users array('string', false, 6, 60), array('email', $user_row['user_email']) ), - 'email_confirm' => array('string', true, 6, 60) ); } @@ -800,11 +798,6 @@ class acp_users $error[] = 'NEW_PASSWORD_ERROR'; } - if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email']) - { - $error[] = 'NEW_EMAIL_ERROR'; - } - if (!check_form_key($form_name)) { $error[] = 'FORM_INVALID'; From d9fef488af150107b753b3c30e15ab5bf6d9da38 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 26 Jul 2011 17:48:17 +0200 Subject: [PATCH 277/325] [ticket/9079] Display backtrace on all E_USER_ERROR errors, not only SQL errors PHPBB3-9079 --- phpBB/includes/db/dbal.php | 5 ----- phpBB/includes/functions.php | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index b4c1a72e1c..230c9c8ed7 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -662,12 +662,7 @@ class dbal // The DEBUG_EXTRA constant is for development only! if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG_EXTRA')) { - // Print out a nice backtrace... - $backtrace = get_backtrace(); - $message .= ($sql) ? '

          SQL

          ' . htmlspecialchars($sql) : ''; - $message .= ($backtrace) ? '

          BACKTRACE
          ' . $backtrace : ''; - $message .= '
          '; } else { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 852fc683f2..f625f70c0f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3853,6 +3853,13 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } } + if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_')) + { + $backtrace = get_backtrace(); + $msg_text .= ($backtrace) ? '

          BACKTRACE
          ' . $backtrace : ''; + $msg_text .= '
          '; + } + if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops From b6999237f456443b0b325f2ebee1f990ee7f5116 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 24 Dec 2011 01:24:09 -0500 Subject: [PATCH 278/325] [ticket/9079] Always log backtrace to error log when logging errors. PHPBB3-9079 --- phpBB/includes/functions.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f625f70c0f..1eefaee651 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3853,18 +3853,23 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } } + $log_text = $msg_text; + $backtrace = get_backtrace(); + if ($backtrace) + { + $log_text .= '

          BACKTRACE
          ' . $backtrace; + } + if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_')) { - $backtrace = get_backtrace(); - $msg_text .= ($backtrace) ? '

          BACKTRACE
          ' . $backtrace : ''; - $msg_text .= '
          '; + $msg_text = $log_text; } if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); - add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $msg_text); + add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $log_text); $db->sql_return_on_error(false); } From fa003bb5fd2fa87f5fec2b19d14fcd4a4eb9b052 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Thu, 22 Dec 2011 00:45:16 -0500 Subject: [PATCH 279/325] [ticket/10542] Remove class="postlink" in subsilver2 faq_body.html class="postlink" is not defined in stylesheet.css so remove it from styles/subsilver2/template/faq_body.html PHPBB3-10542 --- phpBB/styles/subsilver2/template/faq_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/faq_body.html b/phpBB/styles/subsilver2/template/faq_body.html index bbd9b82b19..6a4df3659c 100644 --- a/phpBB/styles/subsilver2/template/faq_body.html +++ b/phpBB/styles/subsilver2/template/faq_body.html @@ -13,7 +13,7 @@ {faq_block.BLOCK_TITLE}
          - {faq_block.faq_row.FAQ_QUESTION}
          + {faq_block.faq_row.FAQ_QUESTION}

          From ff3132a9c63be07ba0db0132faad89364da373e4 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 24 Dec 2011 21:25:18 -0500 Subject: [PATCH 280/325] [ticket/10507] develop does not have imagesets, fix lower test. PHPBB3-10507 --- tests/dbal/fixtures/styles.xml | 4 ---- tests/dbal/order_lower_test.php | 3 --- 2 files changed, 7 deletions(-) diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml index 47b384c47f..36fc22a48f 100644 --- a/tests/dbal/fixtures/styles.xml +++ b/tests/dbal/fixtures/styles.xml @@ -7,7 +7,6 @@ style_active template_id theme_id - imageset_id 1 prosilver @@ -15,7 +14,6 @@ 1 1 1 - 1 2 @@ -24,7 +22,6 @@ 0 2 2 - 2 3 @@ -33,7 +30,6 @@ 0 3 3 - 3 diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php index fd1c950252..712efd2d2b 100644 --- a/tests/dbal/order_lower_test.php +++ b/tests/dbal/order_lower_test.php @@ -35,7 +35,6 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case 'style_active' => 1, 'template_id' => 1, 'theme_id' => 1, - 'imageset_id' => 1 ), array( 'style_id' => 3, @@ -44,7 +43,6 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case 'style_active' => 0, 'template_id' => 3, 'theme_id' => 3, - 'imageset_id' => 3 ), array( 'style_id' => 2, @@ -53,7 +51,6 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case 'style_active' => 0, 'template_id' => 2, 'theme_id' => 2, - 'imageset_id' => 2 ) ), $db->sql_fetchrowset($result) From 38c2d4da35b6c00e2ef2f6b271eda2c020974eee Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 23 Dec 2011 02:24:11 -0500 Subject: [PATCH 281/325] [ticket/10428] Compare $data to false strictly. Users may pass 0 or '' for $data, this should cause the user-specified $data code path to be taken. PHPBB3-10428 --- phpBB/includes/acp/acp_users.php | 8 ++++---- phpBB/includes/session.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4f58434a43..724d450c99 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2345,7 +2345,7 @@ class acp_users { global $user; - $var = ($data) ? $data : $user_row['user_options']; + $var = ($data !== false) ? $data : $user_row['user_options']; if ($value && !($var & 1 << $user->keyoptions[$key])) { @@ -2357,10 +2357,10 @@ class acp_users } else { - return ($data) ? $var : false; + return ($data !== false) ? $var : false; } - if (!$data) + if ($data === false) { $user_row['user_options'] = $var; return true; @@ -2378,7 +2378,7 @@ class acp_users { global $user; - $var = ($data) ? $data : $user_row['user_options']; + $var = ($data !== false) ? $data : $user_row['user_options']; return ($var & 1 << $user->keyoptions[$key]) ? true : false; } } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index caadcbafaa..50b6ac7406 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2343,7 +2343,7 @@ class user extends session { if (!isset($this->keyvalues[$key])) { - $var = ($data) ? $data : $this->data['user_options']; + $var = ($data !== false) ? $data : $this->data['user_options']; $this->keyvalues[$key] = ($var & 1 << $this->keyoptions[$key]) ? true : false; } @@ -2355,7 +2355,7 @@ class user extends session */ function optionset($key, $value, $data = false) { - $var = ($data) ? $data : $this->data['user_options']; + $var = ($data !== false) ? $data : $this->data['user_options']; if ($value && !($var & 1 << $this->keyoptions[$key])) { @@ -2367,10 +2367,10 @@ class user extends session } else { - return ($data) ? $var : false; + return ($data !== false) ? $var : false; } - if (!$data) + if ($data === false) { $this->data['user_options'] = $var; return true; From 16ae99eec8e34ec6d542c1e4d82bd288bc0d0026 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 23 Dec 2011 02:29:48 -0500 Subject: [PATCH 282/325] [ticket/10428] Dispose of $this->keyvalues cache for optionget. It does not work properly when custom $data is provided, and making it work will make the code so complicated that any benefits from having this cache in the first place will be nullified. Just get rid of it. PHPBB3-10428 --- phpBB/includes/session.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 50b6ac7406..d988426a87 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1507,7 +1507,6 @@ class user extends session // Able to add new options (up to id 31) var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); - var $keyvalues = array(); /** * Constructor to set the lang path @@ -2341,13 +2340,8 @@ class user extends session */ function optionget($key, $data = false) { - if (!isset($this->keyvalues[$key])) - { - $var = ($data !== false) ? $data : $this->data['user_options']; - $this->keyvalues[$key] = ($var & 1 << $this->keyoptions[$key]) ? true : false; - } - - return $this->keyvalues[$key]; + $var = ($data !== false) ? $data : $this->data['user_options']; + return ($var & 1 << $this->keyoptions[$key]) ? true : false; } /** From 99c102344ebe3b4a6c18e36c8bea8f3bdd997f2e Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 23 Dec 2011 12:52:51 -0500 Subject: [PATCH 283/325] [ticket/10428] Use phpbb_optionget/set in optionget/set for DRYness. PHPBB3-10428 --- phpBB/includes/acp/acp_users.php | 28 ++++++++++++---------------- phpBB/includes/session.php | 28 ++++++++++++---------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 724d450c99..e433c46db3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2347,27 +2347,23 @@ class acp_users $var = ($data !== false) ? $data : $user_row['user_options']; - if ($value && !($var & 1 << $user->keyoptions[$key])) - { - $var += 1 << $user->keyoptions[$key]; - } - else if (!$value && ($var & 1 << $user->keyoptions[$key])) - { - $var -= 1 << $user->keyoptions[$key]; - } - else - { - return ($data !== false) ? $var : false; - } + $new_var = phpbb_optionset($user->keyoptions[$key], $value, $var); if ($data === false) { - $user_row['user_options'] = $var; - return true; + if ($new_var != $var) + { + $user_row['user_options'] = $new_var; + return true; + } + else + { + return false; + } } else { - return $var; + return $new_var; } } @@ -2379,7 +2375,7 @@ class acp_users global $user; $var = ($data !== false) ? $data : $user_row['user_options']; - return ($var & 1 << $user->keyoptions[$key]) ? true : false; + return phpbb_optionget($user->keyoptions[$key], $var); } } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index d988426a87..457071e01e 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2341,7 +2341,7 @@ class user extends session function optionget($key, $data = false) { $var = ($data !== false) ? $data : $this->data['user_options']; - return ($var & 1 << $this->keyoptions[$key]) ? true : false; + return phpbb_optionget($this->keyoptions[$key], $var); } /** @@ -2351,27 +2351,23 @@ class user extends session { $var = ($data !== false) ? $data : $this->data['user_options']; - if ($value && !($var & 1 << $this->keyoptions[$key])) - { - $var += 1 << $this->keyoptions[$key]; - } - else if (!$value && ($var & 1 << $this->keyoptions[$key])) - { - $var -= 1 << $this->keyoptions[$key]; - } - else - { - return ($data !== false) ? $var : false; - } + $new_var = phpbb_optionset($this->keyoptions[$key], $value, $var); if ($data === false) { - $this->data['user_options'] = $var; - return true; + if ($new_var != $var) + { + $this->data['user_options'] = $new_var; + return true; + } + else + { + return false; + } } else { - return $var; + return $new_var; } } From 10453b67525a0e26a3c859df4dab46907189af72 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 23 Dec 2011 22:59:55 -0500 Subject: [PATCH 284/325] [ticket/10428] Documentation for optionget/optionset functions. PHPBB3-10428 --- phpBB/includes/acp/acp_users.php | 23 +++++++++++++++++++++-- phpBB/includes/session.php | 17 +++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e433c46db3..363c900edc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2339,7 +2339,19 @@ class acp_users } /** - * Optionset replacement for this module based on $user->optionset + * Set option bit field for user options in a user row array. + * + * Optionset replacement for this module based on $user->optionset. + * + * @param array $user_row Row from the users table. + * @param int $key Option key, as defined in $user->keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $user_row['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $user_row['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. */ function optionset(&$user_row, $key, $value, $data = false) { @@ -2368,7 +2380,14 @@ class acp_users } /** - * Optionget replacement for this module based on $user->optionget + * Get option bit field from user options in a user row array. + * + * Optionget replacement for this module based on $user->optionget. + * + * @param array $user_row Row from the users table. + * @param int $key option key, as defined in $user->keyoptions property. + * @param int $data bit field value to use, or false to use $user_row['user_options'] + * @return bool true if the option is set in the bit field, false otherwise */ function optionget(&$user_row, $key, $data = false) { diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 457071e01e..a894242a39 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2336,7 +2336,11 @@ class user extends session } /** - * Get option bit field from user options + * Get option bit field from user options. + * + * @param int $key option key, as defined in $keyoptions property. + * @param int $data bit field value to use, or false to use $this->data['user_options'] + * @return bool true if the option is set in the bit field, false otherwise */ function optionget($key, $data = false) { @@ -2345,7 +2349,16 @@ class user extends session } /** - * Set option bit field for user options + * Set option bit field for user options. + * + * @param int $key Option key, as defined in $keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $this->data['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $this->data['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. */ function optionset($key, $value, $data = false) { From fc297a710e56d938afce83de401b103c72218a1b Mon Sep 17 00:00:00 2001 From: p Date: Fri, 23 Dec 2011 22:10:34 +0000 Subject: [PATCH 285/325] [ticket/10535] Delete email confirm from installer PHPBB3-10535 --- phpBB/install/install_install.php | 23 +++++++------------ phpBB/language/en/install.php | 1 - .../phpbb_functional_test_case.php | 3 +-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 21fe355447..cfef1861cf 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -690,7 +690,7 @@ class install_install extends module $error = array(); // Check the entered email address and password - if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email1'] == '' || $data['board_email2'] == '') + if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '') { $error[] = $lang['INST_ERR_MISSING_DATA']; } @@ -722,12 +722,7 @@ class install_install extends module $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; } - if ($data['board_email1'] != $data['board_email2'] && $data['board_email1'] != '') - { - $error[] = $lang['INST_ERR_EMAIL_MISMATCH']; - } - - if ($data['board_email1'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email1'])) + if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email'])) { $error[] = $lang['INST_ERR_EMAIL_INVALID']; } @@ -1251,11 +1246,11 @@ class install_install extends module WHERE config_name = 'server_port'", 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email1']) . "' + SET config_value = '" . $db->sql_escape($data['board_email']) . "' WHERE config_name = 'board_email'", 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email1']) . "' + SET config_value = '" . $db->sql_escape($data['board_email']) . "' WHERE config_name = 'board_contact'", 'UPDATE ' . $data['table_prefix'] . "config @@ -1315,7 +1310,7 @@ class install_install extends module WHERE config_name = 'avatar_salt'", 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' + SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' WHERE username = 'Admin'", 'UPDATE ' . $data['table_prefix'] . "moderator_cache @@ -1831,7 +1826,7 @@ class install_install extends module $messenger->template('installed', $data['language']); - $messenger->to($data['board_email1'], $data['admin_name']); + $messenger->to($data['board_email'], $data['admin_name']); $messenger->anti_abuse_headers($config, $user); @@ -1890,8 +1885,7 @@ class install_install extends module 'admin_name' => utf8_normalize_nfc(request_var('admin_name', '', true)), 'admin_pass1' => request_var('admin_pass1', '', true), 'admin_pass2' => request_var('admin_pass2', '', true), - 'board_email1' => strtolower(request_var('board_email1', '')), - 'board_email2' => strtolower(request_var('board_email2', '')), + 'board_email' => strtolower(request_var('board_email', '')), 'img_imagick' => request_var('img_imagick', ''), 'ftp_path' => request_var('ftp_path', ''), 'ftp_user' => request_var('ftp_user', ''), @@ -1930,8 +1924,7 @@ class install_install extends module 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), - 'board_email1' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false), - 'board_email2' => array('lang' => 'CONTACT_EMAIL_CONFIRM', 'type' => 'text:25:100', 'explain' => false), + 'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false), ); var $advanced_config_options = array( 'legend1' => 'ACP_EMAIL_SETTINGS', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 57a5de07eb..2ceb14a3d8 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -72,7 +72,6 @@ $lang = array_merge($lang, array( 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s†is empty.', 'CONFIG_RETRY' => 'Retry', - 'CONTACT_EMAIL_CONFIRM' => 'Confirm contact e-mail', 'CONTINUE_CONVERT' => 'Continue conversion', 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', 'CONTINUE_LAST' => 'Continue last statements', diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 63b9d52bf0..9c9fa4fcee 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -102,8 +102,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'admin_name' => 'admin', 'admin_pass1' => 'admin', 'admin_pass2' => 'admin', - 'board_email1' => 'nobody@example.com', - 'board_email2' => 'nobody@example.com', + 'board_email' => 'nobody@example.com', )); $parseURL = parse_url(self::$config['phpbb_functional_url']); From 2b88114365470c545ccf4aa5a83eeae607d72d3d Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Dec 2011 18:52:33 +0000 Subject: [PATCH 286/325] [ticket/10557] Added IN_PHPBB check to functions_acp.php PHPBB3-10557 --- phpBB/includes/functions_acp.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 4702f9939d..b65d6e6b5f 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -8,6 +8,14 @@ * */ +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + /** * Header for acp pages */ From d5dc70cbe3be0f18666a0dc7e972b9d6766291af Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Thu, 29 Dec 2011 16:27:48 -0500 Subject: [PATCH 287/325] [ticket/10407] Fix check for empty image paths in convertor This applies to avatar_path,avatar_gallery_path,smilies_path and upload_path. Currently, the convertor gets each path from the config table and adds a trailing slash. If there is no entry in the config table for the path, the path can never be empty because of the added trailing slash. This patch will temporarily remove the trailing slash, then check if the path is empty. PHPBB3-10407 --- phpBB/includes/functions_convert.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 4a359dcade..4663fe46cc 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -424,7 +424,10 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $relative_path = empty($convert->convertor['source_path_absolute']); - if (empty($convert->convertor['avatar_gallery_path'])) + // strip trailing slash + $trimmed_avatar_gallery_path = rtrim($convert->convertor['avatar_gallery_path'], '/'); + + if (empty($trimmed_avatar_gallery_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'import_avatar_gallery()'), __LINE__, __FILE__); } @@ -588,7 +591,10 @@ function import_attachment($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - if (empty($convert->convertor['upload_path'])) + // strip trailing slash + $trimmed_upload_path = rtrim($convert->convertor['upload_path'], '/'); + + if (empty($trimmed_upload_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment()'), __LINE__, __FILE__); } @@ -647,7 +653,10 @@ function import_smiley($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - if (!isset($convert->convertor['smilies_path'])) + // strip trailing slash + $trimmed_smilies_path = rtrim($convert->convertor['smilies_path'], '/'); + + if (empty($trimmed_smilies_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'import_smiley()'), __LINE__, __FILE__); } @@ -667,7 +676,10 @@ function import_avatar($source, $use_target = false, $user_id = false) global $convert, $phpbb_root_path, $config, $user; - if (!isset($convert->convertor['avatar_path'])) + // strip trailing slash + $trimmed_avatar_path = rtrim($convert->convertor['avatar_path'], '/'); + + if (empty($trimmed_avatar_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); } From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [PATCH 288/325] [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/adm/index.php | 3 +-- phpBB/adm/swatch.php | 3 +-- phpBB/common.php | 3 +-- phpBB/cron.php | 3 +-- phpBB/download/file.php | 3 +-- phpBB/faq.php | 3 +-- phpBB/feed.php | 3 +-- phpBB/includes/acp/acp_attachments.php | 3 +-- phpBB/includes/acp/acp_ban.php | 3 +-- phpBB/includes/acp/acp_bbcodes.php | 3 +-- phpBB/includes/acp/acp_board.php | 3 +-- phpBB/includes/acp/acp_bots.php | 3 +-- phpBB/includes/acp/acp_captcha.php | 3 +-- phpBB/includes/acp/acp_database.php | 3 +-- phpBB/includes/acp/acp_disallow.php | 3 +-- phpBB/includes/acp/acp_email.php | 3 +-- phpBB/includes/acp/acp_forums.php | 3 +-- phpBB/includes/acp/acp_groups.php | 3 +-- phpBB/includes/acp/acp_icons.php | 3 +-- phpBB/includes/acp/acp_inactive.php | 3 +-- phpBB/includes/acp/acp_jabber.php | 3 +-- phpBB/includes/acp/acp_language.php | 6 ++---- phpBB/includes/acp/acp_logs.php | 3 +-- phpBB/includes/acp/acp_main.php | 3 +-- phpBB/includes/acp/acp_modules.php | 3 +-- phpBB/includes/acp/acp_permission_roles.php | 3 +-- phpBB/includes/acp/acp_permissions.php | 3 +-- phpBB/includes/acp/acp_php_info.php | 3 +-- phpBB/includes/acp/acp_profile.php | 3 +-- phpBB/includes/acp/acp_prune.php | 3 +-- phpBB/includes/acp/acp_ranks.php | 3 +-- phpBB/includes/acp/acp_reasons.php | 3 +-- phpBB/includes/acp/acp_search.php | 3 +-- phpBB/includes/acp/acp_send_statistics.php | 3 +-- phpBB/includes/acp/acp_styles.php | 3 +-- phpBB/includes/acp/acp_update.php | 3 +-- phpBB/includes/acp/acp_users.php | 3 +-- phpBB/includes/acp/acp_words.php | 3 +-- phpBB/includes/acp/auth.php | 3 +-- phpBB/includes/acp/info/acp_attachments.php | 3 +-- phpBB/includes/acp/info/acp_ban.php | 3 +-- phpBB/includes/acp/info/acp_bbcodes.php | 3 +-- phpBB/includes/acp/info/acp_board.php | 3 +-- phpBB/includes/acp/info/acp_bots.php | 3 +-- phpBB/includes/acp/info/acp_captcha.php | 3 +-- phpBB/includes/acp/info/acp_database.php | 3 +-- phpBB/includes/acp/info/acp_disallow.php | 3 +-- phpBB/includes/acp/info/acp_email.php | 3 +-- phpBB/includes/acp/info/acp_forums.php | 3 +-- phpBB/includes/acp/info/acp_groups.php | 3 +-- phpBB/includes/acp/info/acp_icons.php | 3 +-- phpBB/includes/acp/info/acp_inactive.php | 3 +-- phpBB/includes/acp/info/acp_jabber.php | 3 +-- phpBB/includes/acp/info/acp_language.php | 3 +-- phpBB/includes/acp/info/acp_logs.php | 3 +-- phpBB/includes/acp/info/acp_main.php | 3 +-- phpBB/includes/acp/info/acp_modules.php | 3 +-- phpBB/includes/acp/info/acp_permission_roles.php | 3 +-- phpBB/includes/acp/info/acp_permissions.php | 3 +-- phpBB/includes/acp/info/acp_php_info.php | 3 +-- phpBB/includes/acp/info/acp_profile.php | 3 +-- phpBB/includes/acp/info/acp_prune.php | 3 +-- phpBB/includes/acp/info/acp_ranks.php | 3 +-- phpBB/includes/acp/info/acp_reasons.php | 3 +-- phpBB/includes/acp/info/acp_search.php | 3 +-- phpBB/includes/acp/info/acp_send_statistics.php | 3 +-- phpBB/includes/acp/info/acp_styles.php | 3 +-- phpBB/includes/acp/info/acp_update.php | 3 +-- phpBB/includes/acp/info/acp_users.php | 3 +-- phpBB/includes/acp/info/acp_words.php | 3 +-- phpBB/includes/auth.php | 3 +-- phpBB/includes/auth/auth_apache.php | 3 +-- phpBB/includes/auth/auth_db.php | 3 +-- phpBB/includes/auth/auth_ldap.php | 3 +-- phpBB/includes/bbcode.php | 3 +-- phpBB/includes/cache/driver/apc.php | 3 +-- phpBB/includes/cache/driver/base.php | 3 +-- phpBB/includes/cache/driver/eaccelerator.php | 3 +-- phpBB/includes/cache/driver/file.php | 3 +-- phpBB/includes/cache/driver/interface.php | 2 +- phpBB/includes/cache/driver/memcache.php | 3 +-- phpBB/includes/cache/driver/memory.php | 3 +-- phpBB/includes/cache/driver/null.php | 3 +-- phpBB/includes/cache/driver/redis.php | 2 +- phpBB/includes/cache/driver/wincache.php | 2 +- phpBB/includes/cache/driver/xcache.php | 3 +-- phpBB/includes/cache/factory.php | 3 +-- phpBB/includes/cache/service.php | 2 +- phpBB/includes/captcha/captcha_factory.php | 3 +-- phpBB/includes/captcha/captcha_gd.php | 3 +-- phpBB/includes/captcha/captcha_gd_wave.php | 3 +-- phpBB/includes/captcha/captcha_non_gd.php | 3 +-- phpBB/includes/captcha/plugins/captcha_abstract.php | 3 +-- phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php | 3 +-- .../captcha/plugins/phpbb_captcha_gd_wave_plugin.php | 3 +-- .../includes/captcha/plugins/phpbb_captcha_nogd_plugin.php | 3 +-- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 3 +-- phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 3 +-- phpBB/includes/class_loader.php | 3 +-- phpBB/includes/config/config.php | 2 +- phpBB/includes/config/db.php | 2 +- phpBB/includes/constants.php | 3 +-- phpBB/includes/cron/manager.php | 2 +- phpBB/includes/cron/task/base.php | 2 +- phpBB/includes/cron/task/core/prune_all_forums.php | 2 +- phpBB/includes/cron/task/core/prune_forum.php | 2 +- phpBB/includes/cron/task/core/queue.php | 2 +- phpBB/includes/cron/task/core/tidy_cache.php | 2 +- phpBB/includes/cron/task/core/tidy_database.php | 2 +- phpBB/includes/cron/task/core/tidy_search.php | 2 +- phpBB/includes/cron/task/core/tidy_sessions.php | 2 +- phpBB/includes/cron/task/core/tidy_warnings.php | 2 +- phpBB/includes/cron/task/parametrized.php | 2 +- phpBB/includes/cron/task/provider.php | 2 +- phpBB/includes/cron/task/task.php | 2 +- phpBB/includes/cron/task/wrapper.php | 2 +- phpBB/includes/db/db_tools.php | 3 +-- phpBB/includes/db/dbal.php | 3 +-- phpBB/includes/db/firebird.php | 3 +-- phpBB/includes/db/mssql.php | 3 +-- phpBB/includes/db/mssql_odbc.php | 3 +-- phpBB/includes/db/mssqlnative.php | 3 +-- phpBB/includes/db/mysql.php | 3 +-- phpBB/includes/db/mysqli.php | 3 +-- phpBB/includes/db/oracle.php | 3 +-- phpBB/includes/db/postgres.php | 3 +-- phpBB/includes/db/sqlite.php | 3 +-- phpBB/includes/diff/diff.php | 3 +-- phpBB/includes/diff/engine.php | 3 +-- phpBB/includes/diff/renderer.php | 3 +-- phpBB/includes/error_collector.php | 3 +-- phpBB/includes/extension/base.php | 2 +- phpBB/includes/extension/finder.php | 2 +- phpBB/includes/extension/interface.php | 2 +- phpBB/includes/extension/manager.php | 2 +- phpBB/includes/extension/provider.php | 2 +- phpBB/includes/functions.php | 3 +-- phpBB/includes/functions_acp.php | 3 +-- phpBB/includes/functions_admin.php | 3 +-- phpBB/includes/functions_compress.php | 3 +-- phpBB/includes/functions_content.php | 3 +-- phpBB/includes/functions_convert.php | 3 +-- phpBB/includes/functions_display.php | 3 +-- phpBB/includes/functions_download.php | 2 +- phpBB/includes/functions_install.php | 3 +-- phpBB/includes/functions_jabber.php | 3 +-- phpBB/includes/functions_messenger.php | 3 +-- phpBB/includes/functions_module.php | 3 +-- phpBB/includes/functions_posting.php | 3 +-- phpBB/includes/functions_privmsgs.php | 3 +-- phpBB/includes/functions_profile_fields.php | 3 +-- phpBB/includes/functions_transfer.php | 3 +-- phpBB/includes/functions_upload.php | 3 +-- phpBB/includes/functions_user.php | 3 +-- phpBB/includes/group_positions.php | 2 +- phpBB/includes/hooks/index.php | 3 +-- phpBB/includes/lock/db.php | 2 +- phpBB/includes/mcp/info/mcp_ban.php | 3 +-- phpBB/includes/mcp/info/mcp_logs.php | 3 +-- phpBB/includes/mcp/info/mcp_main.php | 3 +-- phpBB/includes/mcp/info/mcp_notes.php | 3 +-- phpBB/includes/mcp/info/mcp_pm_reports.php | 3 +-- phpBB/includes/mcp/info/mcp_queue.php | 3 +-- phpBB/includes/mcp/info/mcp_reports.php | 3 +-- phpBB/includes/mcp/info/mcp_warn.php | 3 +-- phpBB/includes/mcp/mcp_ban.php | 3 +-- phpBB/includes/mcp/mcp_forum.php | 3 +-- phpBB/includes/mcp/mcp_front.php | 3 +-- phpBB/includes/mcp/mcp_logs.php | 3 +-- phpBB/includes/mcp/mcp_main.php | 3 +-- phpBB/includes/mcp/mcp_notes.php | 3 +-- phpBB/includes/mcp/mcp_pm_reports.php | 3 +-- phpBB/includes/mcp/mcp_post.php | 3 +-- phpBB/includes/mcp/mcp_queue.php | 3 +-- phpBB/includes/mcp/mcp_reports.php | 3 +-- phpBB/includes/mcp/mcp_topic.php | 3 +-- phpBB/includes/mcp/mcp_warn.php | 3 +-- phpBB/includes/message_parser.php | 3 +-- phpBB/includes/questionnaire/questionnaire.php | 3 +-- phpBB/includes/request/deactivated_super_global.php | 2 +- phpBB/includes/request/interface.php | 2 +- phpBB/includes/request/request.php | 2 +- phpBB/includes/request/type_cast_helper.php | 2 +- phpBB/includes/request/type_cast_helper_interface.php | 2 +- phpBB/includes/search/base.php | 3 +-- phpBB/includes/search/fulltext_mysql.php | 3 +-- phpBB/includes/search/fulltext_native.php | 3 +-- phpBB/includes/session.php | 3 +-- phpBB/includes/startup.php | 2 +- phpBB/includes/template/compile.php | 2 +- phpBB/includes/template/context.php | 2 +- phpBB/includes/template/extension_path_provider.php | 2 +- phpBB/includes/template/filter.php | 2 +- phpBB/includes/template/locator.php | 2 +- phpBB/includes/template/path_provider.php | 2 +- phpBB/includes/template/path_provider_interface.php | 2 +- phpBB/includes/template/renderer.php | 2 +- phpBB/includes/template/renderer_eval.php | 2 +- phpBB/includes/template/renderer_include.php | 2 +- phpBB/includes/template/template.php | 2 +- phpBB/includes/ucp/info/ucp_attachments.php | 3 +-- phpBB/includes/ucp/info/ucp_groups.php | 3 +-- phpBB/includes/ucp/info/ucp_main.php | 3 +-- phpBB/includes/ucp/info/ucp_pm.php | 3 +-- phpBB/includes/ucp/info/ucp_prefs.php | 3 +-- phpBB/includes/ucp/info/ucp_profile.php | 3 +-- phpBB/includes/ucp/info/ucp_zebra.php | 3 +-- phpBB/includes/ucp/ucp_activate.php | 3 +-- phpBB/includes/ucp/ucp_attachments.php | 3 +-- phpBB/includes/ucp/ucp_confirm.php | 3 +-- phpBB/includes/ucp/ucp_groups.php | 3 +-- phpBB/includes/ucp/ucp_main.php | 3 +-- phpBB/includes/ucp/ucp_pm.php | 3 +-- phpBB/includes/ucp/ucp_pm_compose.php | 3 +-- phpBB/includes/ucp/ucp_pm_options.php | 3 +-- phpBB/includes/ucp/ucp_pm_viewfolder.php | 3 +-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 3 +-- phpBB/includes/ucp/ucp_prefs.php | 3 +-- phpBB/includes/ucp/ucp_profile.php | 3 +-- phpBB/includes/ucp/ucp_register.php | 3 +-- phpBB/includes/ucp/ucp_remind.php | 3 +-- phpBB/includes/ucp/ucp_resend.php | 3 +-- phpBB/includes/ucp/ucp_zebra.php | 3 +-- phpBB/includes/utf/utf_normalizer.php | 3 +-- phpBB/includes/utf/utf_tools.php | 3 +-- phpBB/index.php | 3 +-- phpBB/install/convertors/convert_phpbb20.php | 3 +-- phpBB/install/convertors/functions_phpbb20.php | 3 +-- phpBB/install/data/confusables.php | 3 +-- phpBB/install/data/new_normalizer.php | 3 +-- phpBB/install/database_update.php | 2 +- phpBB/install/index.php | 3 +-- phpBB/install/install_convert.php | 3 +-- phpBB/install/install_install.php | 3 +-- phpBB/install/install_main.php | 3 +-- phpBB/install/install_update.php | 3 +-- phpBB/language/en/acp/attachments.php | 3 +-- phpBB/language/en/acp/ban.php | 3 +-- phpBB/language/en/acp/board.php | 3 +-- phpBB/language/en/acp/bots.php | 3 +-- phpBB/language/en/acp/common.php | 3 +-- phpBB/language/en/acp/database.php | 3 +-- phpBB/language/en/acp/email.php | 3 +-- phpBB/language/en/acp/forums.php | 3 +-- phpBB/language/en/acp/groups.php | 3 +-- phpBB/language/en/acp/language.php | 3 +-- phpBB/language/en/acp/modules.php | 3 +-- phpBB/language/en/acp/permissions.php | 3 +-- phpBB/language/en/acp/permissions_phpbb.php | 3 +-- phpBB/language/en/acp/posting.php | 3 +-- phpBB/language/en/acp/profile.php | 3 +-- phpBB/language/en/acp/prune.php | 3 +-- phpBB/language/en/acp/search.php | 3 +-- phpBB/language/en/acp/styles.php | 3 +-- phpBB/language/en/acp/users.php | 3 +-- phpBB/language/en/captcha_qa.php | 3 +-- phpBB/language/en/captcha_recaptcha.php | 3 +-- phpBB/language/en/common.php | 3 +-- phpBB/language/en/groups.php | 3 +-- phpBB/language/en/help_bbcode.php | 3 +-- phpBB/language/en/help_faq.php | 3 +-- phpBB/language/en/install.php | 3 +-- phpBB/language/en/mcp.php | 3 +-- phpBB/language/en/memberlist.php | 3 +-- phpBB/language/en/posting.php | 3 +-- phpBB/language/en/search.php | 3 +-- phpBB/language/en/search_ignore_words.php | 3 +-- phpBB/language/en/search_synonyms.php | 3 +-- phpBB/language/en/ucp.php | 3 +-- phpBB/language/en/viewforum.php | 3 +-- phpBB/language/en/viewtopic.php | 3 +-- phpBB/mcp.php | 3 +-- phpBB/memberlist.php | 3 +-- phpBB/posting.php | 3 +-- phpBB/report.php | 3 +-- phpBB/search.php | 3 +-- phpBB/ucp.php | 3 +-- phpBB/viewforum.php | 3 +-- phpBB/viewonline.php | 3 +-- phpBB/viewtopic.php | 3 +-- 280 files changed, 281 insertions(+), 516 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index cb9e07bd70..e7168b210b 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -2,9 +2,8 @@ /** * * @package acp -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index 3696740200..434b00e542 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/common.php b/phpBB/common.php index a5e0de4510..b308037a0e 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * * Minimum Requirement: PHP 5.2.0 */ diff --git a/phpBB/cron.php b/phpBB/cron.php index 4f246048da..36b771f1b7 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2a9c472ca7..2baa9d6c8a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/faq.php b/phpBB/faq.php index 79c0de3123..052f78816e 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/feed.php b/phpBB/feed.php index e490363594..00247c1958 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -1,9 +1,8 @@ Date: Sun, 1 Jan 2012 16:00:17 +0100 Subject: [PATCH 289/325] [prep-release-3.0.10] Bumping version number for 3.0.10 final. --- build/build.xml | 4 ++-- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 8 +++++++- phpBB/install/schemas/schema_data.sql | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/build.xml b/build/build.xml index bf4c97297b..3d8d3de640 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - + - + diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 3a798fc1ce..b70cf5bc59 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.10-RC3'); +define('PHPBB_VERSION', '3.0.10'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index eeadc9f862..5694c6e29f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -define('UPDATES_TO_VERSION', '3.0.10-RC3'); +define('UPDATES_TO_VERSION', '3.0.10'); // Enter any version to update from to test updates. The version within the db will not be updated. define('DEBUG_FROM_VERSION', false); @@ -991,6 +991,8 @@ function database_update_info() '3.0.10-RC1' => array(), // No changes from 3.0.10-RC2 to 3.0.10-RC3 '3.0.10-RC2' => array(), + // No changes from 3.0.10-RC3 to 3.0.10 + '3.0.10-RC3' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); @@ -2018,6 +2020,10 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.10-RC2 to 3.0.10-RC3 case '3.0.10-RC2': break; + + // No changes from 3.0.10-RC3 to 3.0.10 + case '3.0.10-RC3': + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index eb90d3a06d..d7433d52fd 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); From 17991823ea72ef973852fd9d0a9c516703f2137e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 16:05:02 +0000 Subject: [PATCH 290/325] [ticket/9916] Updating License in the header PHPBB3-9916 --- tests/bbcode/url_bbcode_test.php | 2 +- tests/bootstrap.php | 2 +- tests/dbal/cross_join_test.php | 2 +- tests/dbal/db_tools_test.php | 2 +- tests/dbal/order_lower_test.php | 2 +- tests/dbal/select_test.php | 2 +- tests/dbal/write_test.php | 2 +- tests/error_collector_test.php | 2 +- tests/mock/cache.php | 2 +- tests/mock/session_testable.php | 2 +- tests/mock_user.php | 2 +- tests/network/checkdnsrr_test.php | 2 +- tests/network/ftp_fsock_pasv_epsv_test.php | 2 +- tests/profile/custom_test.php | 2 +- tests/random/gen_rand_string_test.php | 2 +- tests/regex/censor_test.php | 2 +- tests/regex/email_test.php | 2 +- tests/regex/ipv4_test.php | 2 +- tests/regex/ipv6_test.php | 2 +- tests/regex/password_complexity_test.php | 2 +- tests/regex/table_prefix_test.php | 2 +- tests/regex/url_test.php | 2 +- tests/request/request_var_test.php | 2 +- tests/security/base.php | 2 +- tests/security/extract_current_page_test.php | 2 +- tests/security/hash_test.php | 2 +- tests/security/redirect_test.php | 2 +- tests/session/append_sid_test.php | 2 +- tests/session/continue_test.php | 2 +- tests/session/init_test.php | 2 +- tests/session/testable_factory.php | 2 +- tests/template/template_test.php | 2 +- tests/test_framework/phpbb_database_test_case.php | 2 +- tests/test_framework/phpbb_database_test_connection_manager.php | 2 +- tests/test_framework/phpbb_test_case.php | 2 +- tests/test_framework/phpbb_test_case_helpers.php | 2 +- tests/text_processing/censor_text_test.php | 2 +- tests/text_processing/make_clickable_test.php | 2 +- tests/user/lang_test.php | 2 +- tests/utf/normalizer_test.php | 2 +- tests/utf/utf8_clean_string_test.php | 2 +- tests/utf/utf8_wordwrap_test.php | 2 +- tests/wrapper/gmgetdate_test.php | 2 +- tests/wrapper/mt_rand_test.php | 2 +- tests/wrapper/version_compare_test.php | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php index cd85dbd0d9..15bdfc434f 100644 --- a/tests/bbcode/url_bbcode_test.php +++ b/tests/bbcode/url_bbcode_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6f3c93a374..16aed68405 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/cross_join_test.php b/tests/dbal/cross_join_test.php index 7110c7a2ea..6c6b8a8449 100644 --- a/tests/dbal/cross_join_test.php +++ b/tests/dbal/cross_join_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index c0c66b5be7..fbde636b58 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php index fd1c950252..b50494d506 100644 --- a/tests/dbal/order_lower_test.php +++ b/tests/dbal/order_lower_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 8ddd27465d..05b0e68e29 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index 4709d45fa5..596c50a220 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index e1ac32f5ac..d67dea3719 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 020574b0bb..650545c3d6 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index 47089cb94b..70a58fb6cc 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock_user.php b/tests/mock_user.php index 5b89ea3e19..ec14ce430e 100644 --- a/tests/mock_user.php +++ b/tests/mock_user.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/network/checkdnsrr_test.php b/tests/network/checkdnsrr_test.php index 5a756dcef8..1942a50f06 100644 --- a/tests/network/checkdnsrr_test.php +++ b/tests/network/checkdnsrr_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/network/ftp_fsock_pasv_epsv_test.php b/tests/network/ftp_fsock_pasv_epsv_test.php index 6ad811e3ca..22f17785b8 100644 --- a/tests/network/ftp_fsock_pasv_epsv_test.php +++ b/tests/network/ftp_fsock_pasv_epsv_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php index 585182e583..1f33b45ba9 100644 --- a/tests/profile/custom_test.php +++ b/tests/profile/custom_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/random/gen_rand_string_test.php b/tests/random/gen_rand_string_test.php index 115c55e4e2..3317c78ed9 100644 --- a/tests/random/gen_rand_string_test.php +++ b/tests/random/gen_rand_string_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php index fa9104e71d..5929092e07 100644 --- a/tests/regex/censor_test.php +++ b/tests/regex/censor_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php index 0695b801d5..17f93259c3 100644 --- a/tests/regex/email_test.php +++ b/tests/regex/email_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php index 9829547508..38a3aa4a8e 100644 --- a/tests/regex/ipv4_test.php +++ b/tests/regex/ipv4_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php index 1b2018403c..d24217b346 100644 --- a/tests/regex/ipv6_test.php +++ b/tests/regex/ipv6_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/password_complexity_test.php b/tests/regex/password_complexity_test.php index 21e8d12a0a..07453555ee 100644 --- a/tests/regex/password_complexity_test.php +++ b/tests/regex/password_complexity_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/table_prefix_test.php b/tests/regex/table_prefix_test.php index 67a18b4fbc..33bdd4ae2d 100644 --- a/tests/regex/table_prefix_test.php +++ b/tests/regex/table_prefix_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php index c3a336063a..b395f5cae2 100644 --- a/tests/regex/url_test.php +++ b/tests/regex/url_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index fa17b1909f..8e609c00af 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/security/base.php b/tests/security/base.php index db9c884cf4..2658798237 100644 --- a/tests/security/base.php +++ b/tests/security/base.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index 71c7a3a397..4911f7b452 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php index 19a3822145..0c2580c19b 100644 --- a/tests/security/hash_test.php +++ b/tests/security/hash_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 70ba8527b1..4848a938c6 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 1a3ad633e3..88f6f0718e 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/continue_test.php b/tests/session/continue_test.php index 6737562a0a..c4f7f8d75b 100644 --- a/tests/session/continue_test.php +++ b/tests/session/continue_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/init_test.php b/tests/session/init_test.php index 1181fab636..2ce6c4a4ac 100644 --- a/tests/session/init_test.php +++ b/tests/session/init_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index f3ef19a257..00f79738ef 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 5005710220..aaee7bb4a0 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index e1b368dcea..fdb662b284 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 7a45d87583..c734c90a1a 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php index f189da3671..8b16f02638 100644 --- a/tests/test_framework/phpbb_test_case.php +++ b/tests/test_framework/phpbb_test_case.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 0acdce32e0..9a7ab2d237 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php index 2843f0b20b..8fcdb7ef85 100644 --- a/tests/text_processing/censor_text_test.php +++ b/tests/text_processing/censor_text_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index 29b982d709..8697907311 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 6c60583a7b..d33f430955 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php index 1dc69e283e..92230cfcc9 100644 --- a/tests/utf/normalizer_test.php +++ b/tests/utf/normalizer_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index e5a771eafa..70bd549d5b 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/utf/utf8_wordwrap_test.php b/tests/utf/utf8_wordwrap_test.php index 03fa9dc38c..39fdf73308 100644 --- a/tests/utf/utf8_wordwrap_test.php +++ b/tests/utf/utf8_wordwrap_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php index 0b4c3378a9..a838cfdba9 100644 --- a/tests/wrapper/gmgetdate_test.php +++ b/tests/wrapper/gmgetdate_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/mt_rand_test.php b/tests/wrapper/mt_rand_test.php index c8bcb3d14c..eba0bf2faa 100644 --- a/tests/wrapper/mt_rand_test.php +++ b/tests/wrapper/mt_rand_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index f718cfd16b..8b42eb4bee 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ From 0fc37fb3972845f76848c1e64d5edfe4b8cd0972 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 1 Jan 2012 10:35:50 +0000 Subject: [PATCH 291/325] [ticket/9916] Changing coding guidelines license PHPBB3-9916 --- phpBB/docs/coding-guidelines.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 7d51b26dca..cd113a7226 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -129,9 +129,8 @@ /** * * @package {PACKAGENAME} -* @version $Id: $ * @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */
        @@ -2322,7 +2321,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
        -

        This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        +

        This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        From 5e52734c240e5ecfb812202cd4cae305be9290c5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 2 Jan 2012 15:09:38 +0000 Subject: [PATCH 292/325] [ticket/9916] Changing header in non-distributed files PHPBB3-9916 --- build/build_changelog.php | 2 +- build/build_diff.php | 5 ++--- build/build_helper.php | 3 +-- build/diff_class.php | 3 +-- build/package.php | 3 +-- git-tools/merge.php | 2 +- git-tools/setup_github_network.php | 2 +- phpBB/develop/change_smiley_ref.php | 2 -- phpBB/develop/check_flash_bbcodes.php | 3 +-- phpBB/develop/create_schema_files.php | 3 +-- phpBB/develop/create_search_index.php | 2 +- phpBB/develop/create_variable_overview.php | 2 -- phpBB/develop/fill.php | 2 -- phpBB/develop/generate_utf_casefold.php | 3 +-- phpBB/develop/generate_utf_confusables.php | 3 +-- phpBB/develop/generate_utf_tables.php | 3 +-- phpBB/develop/merge_post_tables.php | 1 - phpBB/develop/mysql_upgrader.php | 3 +-- phpBB/develop/utf_normalizer_test.php | 3 +-- phpBB/docs/AUTHORS | 2 +- phpBB/docs/CHANGELOG.html | 2 +- phpBB/docs/FAQ.html | 4 ++-- phpBB/docs/INSTALL.html | 4 ++-- phpBB/docs/README.html | 2 +- phpBB/docs/auth_api.html | 2 +- phpBB/docs/hook_system.html | 2 +- 26 files changed, 25 insertions(+), 43 deletions(-) diff --git a/build/build_changelog.php b/build/build_changelog.php index 4eb5ebd83b..1e80959adf 100755 --- a/build/build_changelog.php +++ b/build/build_changelog.php @@ -4,7 +4,7 @@ * * @package build * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU General Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/build/build_diff.php b/build/build_diff.php index 6a6070228f..0824b53caa 100755 --- a/build/build_diff.php +++ b/build/build_diff.php @@ -3,9 +3,8 @@ /** * * @package build -* @version $Id$ * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -388,7 +387,7 @@ function build_header($mode, $filenames, $header) $html .= "## {$filename['phpbb_filename']}\n"; } } - $html .= "## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 \n"; + $html .= "## License: http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 \n"; $html .= "############################################################## \n"; $html .= "\n"; diff --git a/build/build_helper.php b/build/build_helper.php index 2d9b86b3c3..d6169b913b 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -2,9 +2,8 @@ /** * * @package build -* @version $Id$ * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/build/diff_class.php b/build/diff_class.php index 4625ffde24..2d8555400d 100644 --- a/build/diff_class.php +++ b/build/diff_class.php @@ -2,10 +2,9 @@ /** * * @package build -* @version $Id$ * @copyright (c) 2000 Geoffrey T. Dairiki * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/build/package.php b/build/package.php index 4ce644e8ca..48f42b3572 100755 --- a/build/package.php +++ b/build/package.php @@ -3,9 +3,8 @@ /** * * @package build -* @version $Id$ * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/git-tools/merge.php b/git-tools/merge.php index cbd84b896f..034bd2032c 100755 --- a/git-tools/merge.php +++ b/git-tools/merge.php @@ -4,7 +4,7 @@ * * @package phpBB3 * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index e4e212eef6..5f2e1609a7 100755 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -4,7 +4,7 @@ * * @package phpBB3 * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php index db65dd52d4..3d6dd45d6f 100644 --- a/phpBB/develop/change_smiley_ref.php +++ b/phpBB/develop/change_smiley_ref.php @@ -5,8 +5,6 @@ * begin : Tuesday, February 25, 2003 * copyright : (C) 2003 The phpBB Group * email : support@phpbb.com - * - * $Id$ * ***************************************************************************/ diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php index b0fa399209..2ce288ee3e 100644 --- a/phpBB/develop/check_flash_bbcodes.php +++ b/phpBB/develop/check_flash_bbcodes.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2009, 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 7f37b94453..d44efb8870 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * * This file creates new schema files for every database. * The filenames will be prefixed with an underscore to not overwrite the current schema files. diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index 374a4cf0a1..28001035f6 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -3,7 +3,7 @@ * * @package phpBB3 * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index fe7cacf0d1..a786fc6866 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -1,8 +1,6 @@ . +* along with this program. If not, see * */ diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a0690819d2..2d3b6a6809 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -2182,7 +2182,7 @@
        -

        This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        +

        This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index 83d7a342e0..dbcefc44c1 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -110,7 +110,7 @@ I want to sue you because i think you host an illegal board!
        -

        We provide the software, we have absolutely nothing to do with any board that runs it (beyond phpbb.com of course!) and we also do not host any site. The GPL grants the user an unlimited right of use subject to their adherence of that licence. Therefore we cannot prevent, dictate, control or otherwise limit the use of phpBB software. So please do not contact us for such matters.

        +

        We provide the software, we have absolutely nothing to do with any board that runs it (beyond phpbb.com of course!) and we also do not host any site. The GPL grants the user an unlimited right of use subject to their adherence of that license. Therefore we cannot prevent, dictate, control or otherwise limit the use of phpBB software. So please do not contact us for such matters.

        If you have a problem with a given board please take it up with them, not us. We are not and cannot be held legally responsible for any third party use of this software (much like Microsoft et al cannot be held responsible for the use of Windows in illegal activities, etc.). Additionally we do not track the use of phpBB software in any way. So please do not ask us for details on a "given" board we will not be able to help you. If any law firms or lawyers out there send us writs, cease and desist orders, etc. for third party website use of this software we reserve the right to charge for time wasted dealing with such issues...

        @@ -328,7 +328,7 @@ I want to sue you because i think you host an illegal board!
        -

        This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        +

        This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

        diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index e5ba479d9e..c54e408be2 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -82,7 +82,7 @@
      6. Webserver configuration
    2. -
    3. Disclaimer
    4. +
    5. Copyright and disclaimer
    @@ -431,7 +431,7 @@
    -

    This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    +

    This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 7ceb698ac4..aa60d7dd25 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -339,7 +339,7 @@
    -

    This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    +

    This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index 88618fa640..29469c21ac 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -275,7 +275,7 @@ $auth_admin = new auth_admin();
    -

    This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    +

    This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html index a5fad0d530..1b8131efaf 100644 --- a/phpBB/docs/hook_system.html +++ b/phpBB/docs/hook_system.html @@ -867,7 +867,7 @@ function phpbb_hook_register(&$hook)
    -

    This application is opensource software released under the GPL. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    +

    This application is opensource software released under the GNU General Public License v2. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) phpBB Group, All Rights Reserved.

    From 24cf7f1d29bdfba636d9692a02188b9cddba4e1f Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Mon, 2 Jan 2012 13:09:21 -0500 Subject: [PATCH 293/325] [ticket/10407] Fix check for empty image paths in convertor This applies to avatar_path,avatar_gallery_path,smilies_path and upload_path. Currently, the convertor gets each path from the config table and adds a trailing slash. If there is no entry in the config table for the path, the path can never be empty because of the added trailing slash. This patch will check the path without the trailing slash to see if the path is actually empty. PHPBB3-10407 --- phpBB/includes/functions_convert.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 4663fe46cc..3b26f417e9 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -424,10 +424,8 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $relative_path = empty($convert->convertor['source_path_absolute']); - // strip trailing slash - $trimmed_avatar_gallery_path = rtrim($convert->convertor['avatar_gallery_path'], '/'); - - if (empty($trimmed_avatar_gallery_path)) + // check for trailing slash + if (rtrim($convert->convertor['avatar_gallery_path'], '/') === '') { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'import_avatar_gallery()'), __LINE__, __FILE__); } @@ -591,10 +589,8 @@ function import_attachment($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - // strip trailing slash - $trimmed_upload_path = rtrim($convert->convertor['upload_path'], '/'); - - if (empty($trimmed_upload_path)) + // check for trailing slash + if (rtrim($convert->convertor['upload_path'], '/') === '') { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment()'), __LINE__, __FILE__); } @@ -653,10 +649,8 @@ function import_smiley($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - // strip trailing slash - $trimmed_smilies_path = rtrim($convert->convertor['smilies_path'], '/'); - - if (empty($trimmed_smilies_path)) + // check for trailing slash + if (rtrim($convert->convertor['smilies_path'], '/') === '') { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'import_smiley()'), __LINE__, __FILE__); } @@ -676,10 +670,8 @@ function import_avatar($source, $use_target = false, $user_id = false) global $convert, $phpbb_root_path, $config, $user; - // strip trailing slash - $trimmed_avatar_path = rtrim($convert->convertor['avatar_path'], '/'); - - if (empty($trimmed_avatar_path)) + // check for trailing slash + if (rtrim($convert->convertor['avatar_path'], '/') === '') { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); } From 656a8ece6f2d52d35dfecb4a27c3709379583f48 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [PATCH 294/325] [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/develop/lang_duplicates.php | 4 +--- phpBB/develop/remove-php-end-tags.py | 2 +- phpBB/includes/acp/acp_styles.php | 2 +- phpBB/language/en/ucp.php | 2 +- phpBB/styles/prosilver/style.cfg | 2 +- phpBB/styles/prosilver/template/template.cfg | 2 +- phpBB/styles/prosilver/theme/theme.cfg | 2 +- phpBB/styles/subsilver2/style.cfg | 2 +- phpBB/styles/subsilver2/template/template.cfg | 2 +- phpBB/styles/subsilver2/theme/theme.cfg | 2 +- 10 files changed, 10 insertions(+), 12 deletions(-) diff --git a/phpBB/develop/lang_duplicates.php b/phpBB/develop/lang_duplicates.php index 3ea841b6d6..02852798b6 100644 --- a/phpBB/develop/lang_duplicates.php +++ b/phpBB/develop/lang_duplicates.php @@ -15,10 +15,8 @@ die("Please read the first lines of this script for instructions on how to enabl // ------------------------------------------------------------- // -// $Id$ -// // @copyright (c) 2005 phpBB Group -// @license http://opensource.org/licenses/gpl-license.php GNU Public License +// @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 // // ------------------------------------------------------------- // Thanks to arod-1 diff --git a/phpBB/develop/remove-php-end-tags.py b/phpBB/develop/remove-php-end-tags.py index 1707c6d519..89b9ee5032 100755 --- a/phpBB/develop/remove-php-end-tags.py +++ b/phpBB/develop/remove-php-end-tags.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Remove ending PHP tags '?>' # @author Oleg Pudeyev -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 import sys, os, os.path, optparse diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 4f6b22fa14..f8a3b8e47e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -61,7 +61,7 @@ class acp_styles # # @package phpBB3 # @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 38f202b392..264b6ed4d8 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -38,7 +38,7 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s†(hereinafter “weâ€, “usâ€, “ourâ€, “%1$sâ€, “%2$sâ€), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$sâ€. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s†after changes mean you agree to be legally bound by these terms as they are updated and/or amended.

    - Our forums are powered by phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Groupâ€, “phpBB Teamsâ€) which is a bulletin board solution released under the “General Public License†(hereinafter “GPLâ€) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: http://www.phpbb.com/.
    + Our forums are powered by phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Groupâ€, “phpBB Teamsâ€) which is a bulletin board solution released under the “GNU General Public License v2†(hereinafter “GPLâ€) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: http://www.phpbb.com/.

    You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s†is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s†have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s†nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised. ', diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 0c53211969..538e167df6 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index eaaceea9e2..8d976247bc 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2006 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg index e27ba1c3a6..eced2a665e 100644 --- a/phpBB/styles/prosilver/theme/theme.cfg +++ b/phpBB/styles/prosilver/theme/theme.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2006 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index fc76c884e0..0804a27082 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 29361a59ff..82d3d2681b 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg index c560dabae2..16d66c844a 100644 --- a/phpBB/styles/subsilver2/theme/theme.cfg +++ b/phpBB/styles/subsilver2/theme/theme.cfg @@ -3,7 +3,7 @@ # # @package phpBB3 # @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # # # At the left is the name, please do not change this From 66c50f6b30400b729d3fea4fb06dad5eb559aa51 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 2 Jan 2012 17:14:00 +0000 Subject: [PATCH 295/325] [ticket/9916] Updating license in non-distributed files PHPBB3-9916 --- code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php | 2 +- code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php | 2 +- code_sniffer/phpbb/phpbbCodingStandard.php | 2 +- tests/bbcode/parser_test.php | 2 +- tests/cache/cache_test.php | 2 +- tests/class_loader/class_loader_test.php | 2 +- tests/config/config_test.php | 2 +- tests/config/db_test.php | 2 +- tests/cron/ext/testext/cron/dummy_task.php | 2 +- tests/cron/includes/cron/task/core/dummy_task.php | 2 +- tests/cron/includes/cron/task/core/second_dummy_task.php | 2 +- tests/cron/manager_test.php | 2 +- tests/cron/task_provider_test.php | 2 +- tests/dbal/schema_test.php | 2 +- tests/download/http_byte_range_test.php | 2 +- tests/extension/finder_test.php | 2 +- tests/extension/manager_test.php | 2 +- tests/functional/browse_test.php | 2 +- tests/functions_acp/build_cfg_template_test.php | 2 +- tests/functions_acp/build_select_test.php | 2 +- tests/functions_acp/h_radio_test.php | 2 +- tests/functions_acp/validate_config_vars_test.php | 2 +- tests/functions_acp/validate_range_test.php | 2 +- tests/group_positions/group_positions_test.php | 2 +- tests/lock/db_test.php | 2 +- tests/mock/extension_manager.php | 2 +- tests/mock/lang.php | 2 +- tests/mock/request.php | 2 +- tests/network/inet_ntop_pton_test.php | 2 +- tests/network/ip_normalise_test.php | 2 +- tests/request/deactivated_super_global_test.php | 2 +- tests/request/request_test.php | 2 +- tests/request/type_cast_helper_test.php | 2 +- tests/template/includephp_test.php | 2 +- tests/template/renderer_eval_test.php | 2 +- tests/template/subdir/includephp_from_subdir_test.php | 2 +- tests/template/template_compile_test.php | 2 +- tests/template/template_inheritance_test.php | 2 +- tests/template/template_test_case.php | 2 +- tests/test_framework/phpbb_functional_test_case.php | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php index af267747d3..ba2b40ecba 100644 --- a/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php +++ b/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php @@ -4,7 +4,7 @@ * @package code_sniffer * @version $Id: $ * @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php b/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php index 925a9c4036..affa27b56c 100644 --- a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php +++ b/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php @@ -4,7 +4,7 @@ * @package code_sniffer * @version $Id: $ * @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/code_sniffer/phpbb/phpbbCodingStandard.php b/code_sniffer/phpbb/phpbbCodingStandard.php index cd9b68846a..adbba9d915 100644 --- a/code_sniffer/phpbb/phpbbCodingStandard.php +++ b/code_sniffer/phpbb/phpbbCodingStandard.php @@ -4,7 +4,7 @@ * @package code_sniffer * @version $Id: $ * @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php index 9423383938..8c7fbc7128 100644 --- a/tests/bbcode/parser_test.php +++ b/tests/bbcode/parser_test.php @@ -4,7 +4,7 @@ * @package testing * @version $Id$ * @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cache/cache_test.php b/tests/cache/cache_test.php index b127c507f0..564bd35863 100644 --- a/tests/cache/cache_test.php +++ b/tests/cache/cache_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 9744a1c703..80f0b38095 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/config/config_test.php b/tests/config/config_test.php index 9c91d9eb87..5845cc4590 100644 --- a/tests/config/config_test.php +++ b/tests/config/config_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/config/db_test.php b/tests/config/db_test.php index e817545a54..a9a53541a5 100644 --- a/tests/config/db_test.php +++ b/tests/config/db_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cron/ext/testext/cron/dummy_task.php b/tests/cron/ext/testext/cron/dummy_task.php index 06546ada05..996f5b39cf 100644 --- a/tests/cron/ext/testext/cron/dummy_task.php +++ b/tests/cron/ext/testext/cron/dummy_task.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cron/includes/cron/task/core/dummy_task.php b/tests/cron/includes/cron/task/core/dummy_task.php index ddaf6a9b7c..6e2e2db636 100644 --- a/tests/cron/includes/cron/task/core/dummy_task.php +++ b/tests/cron/includes/cron/task/core/dummy_task.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cron/includes/cron/task/core/second_dummy_task.php b/tests/cron/includes/cron/task/core/second_dummy_task.php index 36c3912c30..8cd0bddfc0 100644 --- a/tests/cron/includes/cron/task/core/second_dummy_task.php +++ b/tests/cron/includes/cron/task/core/second_dummy_task.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index 80c92e234b..f433fc9a9b 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php index 5565d0f64c..4547c61a55 100644 --- a/tests/cron/task_provider_test.php +++ b/tests/cron/task_provider_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/dbal/schema_test.php b/tests/dbal/schema_test.php index 2475a85708..2a332fddba 100644 --- a/tests/dbal/schema_test.php +++ b/tests/dbal/schema_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/download/http_byte_range_test.php b/tests/download/http_byte_range_test.php index 36cbcab0b0..b93c1b630c 100644 --- a/tests/download/http_byte_range_test.php +++ b/tests/download/http_byte_range_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 03615bbfc0..f7e9bd57bb 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 891f1b287a..0a689916c7 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index 9c1d04f35d..723cf93232 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index 76e133181f..bb479ffac9 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functions_acp/build_select_test.php b/tests/functions_acp/build_select_test.php index 7079e69f12..782acae1fa 100644 --- a/tests/functions_acp/build_select_test.php +++ b/tests/functions_acp/build_select_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functions_acp/h_radio_test.php b/tests/functions_acp/h_radio_test.php index 18cb5d031e..02b2444a9e 100644 --- a/tests/functions_acp/h_radio_test.php +++ b/tests/functions_acp/h_radio_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php index 761788e264..55441561a6 100644 --- a/tests/functions_acp/validate_config_vars_test.php +++ b/tests/functions_acp/validate_config_vars_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index 11b7f87957..34ce848e76 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/group_positions/group_positions_test.php b/tests/group_positions/group_positions_test.php index b68f205b37..fd9f57e78f 100644 --- a/tests/group_positions/group_positions_test.php +++ b/tests/group_positions/group_positions_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/lock/db_test.php b/tests/lock/db_test.php index ed15423314..f7b1557a0c 100644 --- a/tests/lock/db_test.php +++ b/tests/lock/db_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 5155716181..77f799dd3b 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock/lang.php b/tests/mock/lang.php index 17a39629c1..781b3d060e 100644 --- a/tests/mock/lang.php +++ b/tests/mock/lang.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/mock/request.php b/tests/mock/request.php index 8b2708304c..946dfdada9 100644 --- a/tests/mock/request.php +++ b/tests/mock/request.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/network/inet_ntop_pton_test.php b/tests/network/inet_ntop_pton_test.php index d3332f20c0..a59c2103bd 100644 --- a/tests/network/inet_ntop_pton_test.php +++ b/tests/network/inet_ntop_pton_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/network/ip_normalise_test.php b/tests/network/ip_normalise_test.php index dce0774d85..28059f376a 100644 --- a/tests/network/ip_normalise_test.php +++ b/tests/network/ip_normalise_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php index 995f93443d..2e19928a5a 100644 --- a/tests/request/deactivated_super_global_test.php +++ b/tests/request/deactivated_super_global_test.php @@ -4,7 +4,7 @@ * @package testing * @version $Id$ * @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/request/request_test.php b/tests/request/request_test.php index e492fa5cf1..bca5125b7a 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -4,7 +4,7 @@ * @package testing * @version $Id$ * @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php index 06cf2e1bf6..d553d5b8cd 100644 --- a/tests/request/type_cast_helper_test.php +++ b/tests/request/type_cast_helper_test.php @@ -4,7 +4,7 @@ * @package testing * @version $Id$ * @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index aac9cccc8a..28ea118a13 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/renderer_eval_test.php b/tests/template/renderer_eval_test.php index c30516ba97..7ebb8b9bda 100644 --- a/tests/template/renderer_eval_test.php +++ b/tests/template/renderer_eval_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/subdir/includephp_from_subdir_test.php b/tests/template/subdir/includephp_from_subdir_test.php index 3cc632485d..517cb85a30 100644 --- a/tests/template/subdir/includephp_from_subdir_test.php +++ b/tests/template/subdir/includephp_from_subdir_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/template_compile_test.php b/tests/template/template_compile_test.php index 8c136c9985..a5e8a5e87a 100644 --- a/tests/template/template_compile_test.php +++ b/tests/template/template_compile_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index 93b01ae381..3a03de6427 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 4e36912e01..a78837516b 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 63b9d52bf0..ca52d24b7e 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ From 23363efaaacd2bec39a51c27db51a2777e7a4c21 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Mon, 2 Jan 2012 21:07:40 +0200 Subject: [PATCH 296/325] [ticket/10563] Show deactivated styles below active styles in acp Separates active and deactivated styles in styles list in acp PHPBB3-10563 --- phpBB/adm/style/acp_styles.html | 6 ++++++ phpBB/includes/acp/acp_styles.php | 3 +++ phpBB/language/en/acp/styles.php | 1 + 3 files changed, 10 insertions(+) diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 098cc723d9..6aa1c0ccc9 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -402,6 +402,12 @@ {L_INSTALLED} + + + + {L_INACTIVE_STYLES} + + {installed.NAME} * diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index e25061d6f0..5a7902755e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -547,6 +547,7 @@ parse_css_file = {PARSE_CSS_FILE} { case 'style': $sql_from = STYLES_TABLE; + $sql_sort = 'style_active DESC, ' . $sql_sort; $sql = 'SELECT user_style, COUNT(user_style) AS style_count FROM ' . USERS_TABLE . ' @@ -635,6 +636,8 @@ parse_css_file = {PARSE_CSS_FILE} 'NAME' => $row[$mode . '_name'], 'STYLE_COUNT' => ($mode == 'style' && isset($style_count[$row['style_id']])) ? $style_count[$row['style_id']] : 0, + + 'S_INACTIVE' => ($mode == 'style' && !$row['style_active']) ? true : false, ) ); } diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 3c8c4a328f..3194a2ebd6 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -267,6 +267,7 @@ $lang = array_merge($lang, array( 'IMG_USER_ICON9' => 'User defined image 9', 'IMG_USER_ICON10' => 'User defined image 10', + 'INACTIVE_STYLES' => 'Inactive styles', 'INCLUDE_DIMENSIONS' => 'Include dimensions', 'INCLUDE_IMAGESET' => 'Include imageset', 'INCLUDE_TEMPLATE' => 'Include template', From ffde8c8e06c4d37bef5cde280d520c0791ed2c67 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 6 Jan 2012 17:20:41 +0100 Subject: [PATCH 297/325] [ticket/10477] Normalize loaded module names to be class names or xcp_ prefixed PHPBB3-10477 --- phpBB/includes/functions_module.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index d810285313..a6015b1eac 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -804,6 +804,13 @@ class p_master */ function load($class, $name, $mode = false) { + // new modules use the full class names, old ones are always called _, e.g. acp_board + // in the latter case this function may be called as load(acp, board) + if (!class_exists($name) && substr($name, 0, strlen($class) + 1) !== $class . '_') + { + $name = $class . '_' . $name; + } + $this->p_class = $class; $this->p_name = $name; From 3e36ac6678affa5f8578d29aee6bd2c27fb766b7 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 12 Jan 2012 22:25:14 -0500 Subject: [PATCH 298/325] [ticket/10579] Delete extra v2 from license block. PHPBB3-10579 --- phpBB/includes/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index f1e45c57cc..5372cfac7b 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -3,7 +3,7 @@ * * @package search * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 v2 +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ From 3f754d118d8fbd36dcefbeea470ecb267e87ace6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 12 Jan 2012 22:13:28 -0500 Subject: [PATCH 299/325] [ticket/10477] Document parameters to p_master#load. PHPBB3-10477 --- phpBB/includes/functions_module.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index a6015b1eac..653623a336 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -438,6 +438,8 @@ class p_master * Loads currently active module * * This method loads a given module, passing it the relevant id and mode. + * + * @param string $mode mode, as passed through to the module */ function load_active($mode = false, $module_url = false, $execute_module = true) { @@ -801,11 +803,16 @@ class p_master /** * Load module as the current active one without the need for registering it + * + * @param string $class module class (acp/mcp/ucp) + * @param string $name module name (e.g. zebra for the ucp_zebra module) + * @param string $mode mode, as passed through to the module + * */ function load($class, $name, $mode = false) { // new modules use the full class names, old ones are always called _, e.g. acp_board - // in the latter case this function may be called as load(acp, board) + // in the latter case this function may be called as load('acp', 'board') if (!class_exists($name) && substr($name, 0, strlen($class) + 1) !== $class . '_') { $name = $class . '_' . $name; From 82c05a7ed6cde2ce1a217b988382167aa94fcf03 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 13 Jan 2012 12:59:29 +0100 Subject: [PATCH 300/325] [ticket/10477] Correctly document module (base)name parameter PHPBB3-10477 --- phpBB/includes/functions_module.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 653623a336..b7bb770031 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -805,7 +805,8 @@ class p_master * Load module as the current active one without the need for registering it * * @param string $class module class (acp/mcp/ucp) - * @param string $name module name (e.g. zebra for the ucp_zebra module) + * @param string $name module name (class name of the module, or its basename + * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) * @param string $mode mode, as passed through to the module * */ From aa21bc2a733c1690ad7a371f962c244542135a43 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 15 Jan 2012 18:18:04 +0800 Subject: [PATCH 301/325] [ticket/10589] Add alias to 'user_birthday' in $leap_year_birthdays definition PHPBB3-10589 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index 0105a0a1bd..46694a6ec2 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -89,7 +89,7 @@ if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets(' $leap_year_birthdays = ''; if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L')) { - $leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; + $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; } $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday From 2cf586a37206df3528237a2c91e255539c95a513 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Tue, 17 Jan 2012 12:31:27 -0500 Subject: [PATCH 302/325] [ticket/10580] Remove checking of server timezone and DST when registering Remove checking of server timezone and DST. It causes a problem by selecting the wrong timezone when registering when the board_timezone is 1 hour less than the server timezone. PHPBB3-10580 --- phpBB/includes/ucp/ucp_register.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 4e8729db56..6ad3a55589 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -165,24 +165,8 @@ class ucp_register $captcha->init(CONFIRM_REG); } - // Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1 - $timezone = date('Z') / 3600; - $is_dst = date('I'); - - if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1)) - { - $timezone = ($is_dst) ? $timezone - 1 : $timezone; - - if (!isset($user->lang['tz_zones'][(string) $timezone])) - { - $timezone = $config['board_timezone']; - } - } - else - { - $is_dst = $config['board_dst']; - $timezone = $config['board_timezone']; - } + $is_dst = $config['board_dst']; + $timezone = $config['board_timezone']; $data = array( 'username' => utf8_normalize_nfc(request_var('username', '', true)), From ac492d8f1e7ef3420ebaee35131e342a39dfda10 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 22 Aug 2011 23:33:34 +0200 Subject: [PATCH 303/325] [ticket/10076] Move EHLO/HELO code into its own method. PHPBB3-10076 --- phpBB/includes/functions_messenger.php | 62 ++++++++++++++++---------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 13d9b6a5cb..ccc17865f6 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1286,30 +1286,10 @@ class smtp_class } } - // Try EHLO first - $this->server_send("EHLO {$local_host}"); - if ($err_msg = $this->server_parse('250', __LINE__)) + $hello_result = $this->hello($local_host); + if (!is_null($hello_result)) { - // a 503 response code means that we're already authenticated - if ($this->numeric_response_code == 503) - { - return false; - } - - // If EHLO fails, we try HELO - $this->server_send("HELO {$local_host}"); - if ($err_msg = $this->server_parse('250', __LINE__)) - { - return ($this->numeric_response_code == 503) ? false : $err_msg; - } - } - - foreach ($this->responses as $response) - { - $response = explode(' ', $response); - $response_code = $response[0]; - unset($response[0]); - $this->commands[$response_code] = implode(' ', $response); + return $hello_result; } // If we are not authenticated yet, something might be wrong if no username and passwd passed @@ -1355,6 +1335,42 @@ class smtp_class return $this->$method($username, $password); } + /** + * SMTP EHLO/HELO + * + * @return mixed Null if the authentication process is supposed to continue + * False if already authenticated + * Error message (string) otherwise + */ + protected function hello($hostname) + { + // Try EHLO first + $this->server_send("EHLO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + // a 503 response code means that we're already authenticated + if ($this->numeric_response_code == 503) + { + return false; + } + + // If EHLO fails, we try HELO + $this->server_send("HELO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + } + + foreach ($this->responses as $response) + { + $response = explode(' ', $response); + $response_code = $response[0]; + unset($response[0]); + $this->commands[$response_code] = implode(' ', $response); + } + } + /** * Pop before smtp authentication */ From 237ddf9d22e0aeccad5e1db022de3a890871849f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 22 Aug 2011 23:50:02 +0200 Subject: [PATCH 304/325] [ticket/10076] STARTTLS support for SMTP via smtp_class. PHPBB3-10076 --- phpBB/includes/functions_messenger.php | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ccc17865f6..f4e49b1b18 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1136,6 +1136,7 @@ class smtp_class { var $server_response = ''; var $socket = 0; + protected $socket_tls = false; var $responses = array(); var $commands = array(); var $numeric_response_code = 0; @@ -1292,6 +1293,25 @@ class smtp_class return $hello_result; } + // SMTP STARTTLS (RFC 3207) + if (!$this->socket_tls) + { + $this->socket_tls = $this->starttls(); + + if ($this->socket_tls) + { + // Switched to TLS + // RFC 3207: "The client MUST discard any knowledge obtained from the server, [...]" + // So say hello again + $hello_result = $this->hello($local_host); + + if (!is_null($hello_result)) + { + return $hello_result; + } + } + } + // If we are not authenticated yet, something might be wrong if no username and passwd passed if (!$username || !$password) { @@ -1371,6 +1391,43 @@ class smtp_class } } + /** + * SMTP STARTTLS (RFC 3207) + * + * @return bool Returns true if TLS was started + * Otherwise false + */ + protected function starttls() + { + if (!function_exists('stream_socket_enable_crypto')) + { + return false; + } + + if (!isset($this->commands['STARTTLS'])) + { + return false; + } + + $this->server_send('STARTTLS'); + + if ($err_msg = $this->server_parse('220', __LINE__)) + { + return false; + } + + $result = false; + $stream_meta = stream_get_meta_data($this->socket); + + if (socket_set_blocking($this->socket, 1)); + { + $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + socket_set_blocking($this->socket, (int) $stream_meta['blocked']); + } + + return $result; + } + /** * Pop before smtp authentication */ From 879c92e8a2b27586d6531de705ded49c6f662ffa Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 3 Feb 2012 15:38:52 +0200 Subject: [PATCH 305/325] [ticket/10569] Invalid string comparison in subsilver2 Fixing invalid string comparison in ucp_main_front.html in subsilver2 PHPBB3-10569 --- phpBB/styles/subsilver2/template/ucp_main_front.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index fdef0bd949..dc945c83d6 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -48,11 +48,11 @@ {L_ACTIVE_IN_FORUM}: - {ACTIVE_FORUM}
    [ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]- + {ACTIVE_FORUM}
    [ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]- {L_ACTIVE_IN_TOPIC}: - {ACTIVE_TOPIC}
    [ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]- + {ACTIVE_TOPIC}
    [ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]- From d2a34961498a03b77885af6a20497e87d36ad7ef Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 3 Feb 2012 16:00:14 +0200 Subject: [PATCH 306/325] [ticket/10616] Add template inheritance to default styles Adding template inheritance field to prosilver and subsilver2 PHPBB3-10616 --- phpBB/styles/prosilver/template/template.cfg | 5 +++++ phpBB/styles/subsilver2/template/template.cfg | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index d31dcb7356..0b0533573a 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -23,3 +23,8 @@ version = 3.0.10 # Defining a different template bitfield template_bitfield = lNg= + +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty to ignore template inheritance +inherit_from = prosilver diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 4e5c36af99..d557edba87 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -21,3 +21,7 @@ name = subsilver2 copyright = © phpBB Group, 2003 version = 3.0.10 +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty to ignore template inheritance +inherit_from = subsilver2 From 4aef6ea979befe9c40b3253ed10678a4eeb74160 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 3 Feb 2012 16:09:48 +0200 Subject: [PATCH 307/325] [ticket/10616] Ignore template inheritance that points to self Ignore template inheritance if it points to self PHPBB3-10616 --- phpBB/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1eefaee651..4d2a00f2db 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3322,6 +3322,11 @@ function parse_cfg_file($filename, $lines = false) $parsed_items[$key] = $value; } + + if (isset($parsed_items['inherit_from']) && isset($parsed_items['name']) && $parsed_items['inherit_from'] == $parsed_items['name']) + { + unset($parsed_items['inherit_from']); + } return $parsed_items; } From 326ff46ef7812f9f725e680e5202364c6b25bb4b Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 3 Feb 2012 16:19:42 +0200 Subject: [PATCH 308/325] [ticket/10616] Add template inheritance to exported template Add template inheritance when exporting template.cfg PHPBB3-10616 --- phpBB/includes/acp/acp_styles.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5a7902755e..d7b0484af8 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -99,11 +99,11 @@ parse_css_file = {PARSE_CSS_FILE} $this->template_cfg .= ' # Some configuration options -# -# You can use this function to inherit templates from another template. -# The template of the given name has to be installed. -# Templates cannot inherit from inheriting templates. -#'; +# Template inheritance +# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/ +# Set value to empty or this template name to ignore template inheritance. +inherit_from = {INHERIT_FROM} +'; $this->imageset_keys = array( 'logos' => array( @@ -2047,9 +2047,7 @@ parse_css_file = {PARSE_CSS_FILE} // Export template core code if ($mode == 'template' || $inc_template) { - $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version']), $this->template_cfg); - - $use_template_name = ''; + $use_template_name = $style_row['template_name']; // Add the inherit from variable, depending on it's use... if ($style_row['template_inherits_id']) @@ -2063,7 +2061,8 @@ parse_css_file = {PARSE_CSS_FILE} $db->sql_freeresult($result); } - $template_cfg .= ($use_template_name) ? "\ninherit_from = $use_template_name" : "\n#inherit_from = "; + $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}', '{INHERIT_FROM}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version'], $use_template_name), $this->template_cfg); + $template_cfg .= "\n\nbbcode_bitfield = {$style_row['bbcode_bitfield']}"; $data[] = array( From 225892f506e0a109e710534fee64a11614921d88 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 3 Feb 2012 16:14:48 +0000 Subject: [PATCH 309/325] [ticket/9914] Add backup warning to updater. PHPBB3-9914 --- phpBB/adm/style/install_update.html | 5 +++++ phpBB/language/en/install.php | 1 + 2 files changed, 6 insertions(+) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index 22d21d8314..818889c89b 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -43,6 +43,11 @@

    {WARNING_MSG}

    + +
    +

    {L_NOTICE}

    +

    {L_BACKUP_NOTICE}

    +
    diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f69ca40613..bbf407f1dc 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -52,6 +52,7 @@ $lang = array_merge($lang, array( 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', 'BOARD_NOT_INSTALLED' => 'No installation found', 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', + 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', 'CATEGORY' => 'Category', 'CACHE_STORE' => 'Cache type', From ccf0cf649daabc600e8a79680e29c7bfbba32cac Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 3 Feb 2012 15:55:44 -0500 Subject: [PATCH 310/325] [ticket/10535] Delete no longer needed email confirm language entries. PHPBB3-10535 --- phpBB/language/en/common.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index b51d34335f..bec4bd9ef7 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -614,7 +614,6 @@ $lang = array_merge($lang, array( 'TOO_LONG_USER_PASSWORD' => 'The password you entered is too long.', 'TOO_LONG_USERNAME' => 'The username you entered is too long.', 'TOO_LONG_EMAIL' => 'The e-mail address you entered is too long.', - 'TOO_LONG_EMAIL_CONFIRM' => 'The e-mail address confirmation you entered is too long.', 'TOO_LONG_WEBSITE' => 'The website address you entered is too long.', 'TOO_LONG_YIM' => 'The Yahoo! Messenger name you entered is too long.', @@ -636,7 +635,6 @@ $lang = array_merge($lang, array( 'TOO_SHORT_USER_PASSWORD' => 'The password you entered is too short.', 'TOO_SHORT_USERNAME' => 'The username you entered is too short.', 'TOO_SHORT_EMAIL' => 'The e-mail address you entered is too short.', - 'TOO_SHORT_EMAIL_CONFIRM' => 'The e-mail address confirmation you entered is too short.', 'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.', 'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.', From c0b3239bf39f6a052dd8f481561ca0442f19ede8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 4 Feb 2012 00:31:59 +0100 Subject: [PATCH 311/325] [ticket/10512] Call startup.php from tests/bootstrap.php PHPBB3-10512 --- tests/bootstrap.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 16aed68405..2fb805043e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,25 +10,9 @@ define('IN_PHPBB', true); $phpbb_root_path = 'phpBB/'; $phpEx = 'php'; +require_once $phpbb_root_path . 'includes/startup.php'; + $table_prefix = 'phpbb_'; - -if (!defined('E_DEPRECATED')) -{ - define('E_DEPRECATED', 8192); -} -error_reporting(E_ALL & ~E_DEPRECATED); - -// If we are on PHP >= 6.0.0 we do not need some code -if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) -{ - define('STRIP', false); -} -else -{ - @set_magic_quotes_runtime(0); - define('STRIP', (get_magic_quotes_gpc()) ? true : false); -} - require_once $phpbb_root_path . 'includes/constants.php'; require_once 'test_framework/phpbb_test_case_helpers.php'; From 42d9edc4f268d4f0894bc140c2aefffbd87e3361 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 4 Feb 2012 00:57:39 +0100 Subject: [PATCH 312/325] [ticket/10495] Update request/type_cast_helper for PHP 5.4 magic_quotes_gpc drop PHPBB3-10495 --- phpBB/includes/request/type_cast_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/includes/request/type_cast_helper.php index 5aa0372328..561e8fc251 100644 --- a/phpBB/includes/request/type_cast_helper.php +++ b/phpBB/includes/request/type_cast_helper.php @@ -34,7 +34,7 @@ class phpbb_request_type_cast_helper implements phpbb_request_type_cast_helper_i */ public function __construct() { - if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) + if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) { $this->strip = false; } From 62288b3c05049cb02732204af062e0baa1191992 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 7 Feb 2012 22:03:24 +0200 Subject: [PATCH 313/325] [ticket/10569] Invalid string comparison in prosilver Fixing invalid string comparison in ucp_main_front.html in prosilver PHPBB3-10569 --- phpBB/styles/prosilver/template/ucp_main_front.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 39c5d4f396..4a6fa3bf86 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -34,8 +34,8 @@
    {L_JOINED}:
    {JOINED}
    {L_VISITED}:
    {LAST_VISIT_YOU}
    {L_TOTAL_POSTS}:
    {POSTS} | {L_SEARCH_YOUR_POSTS}
    ({POSTS_DAY} / {POSTS_PCT}){POSTS}
    -
    {L_ACTIVE_IN_FORUM}:
    {ACTIVE_FORUM}
    ({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
    -
    {L_ACTIVE_IN_TOPIC}:
    {ACTIVE_TOPIC}
    ({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
    +
    {L_ACTIVE_IN_FORUM}:
    {ACTIVE_FORUM}
    ({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
    +
    {L_ACTIVE_IN_TOPIC}:
    {ACTIVE_TOPIC}
    ({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
    {L_YOUR_WARNINGS}:
    {WARNING_IMG} [{WARNINGS}]
    From 6cf7f205903767bf44d1ee1de796d5f3a00774cd Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 01:34:37 +0200 Subject: [PATCH 314/325] [ticket/10634] Changing p_master::is_full_class Changing p_master::is_full_class to check allow all module types, not only current type PHPBB3-10634 --- phpBB/includes/functions_module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index b7bb770031..db7defdc48 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -923,6 +923,6 @@ class p_master */ protected function is_full_class($basename) { - return (substr($basename, 0, 6) === 'phpbb_' || substr($basename, 0, strlen($this->p_class) + 1) === $this->p_class . '_'); + return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename)); } } From ad8ab099301c283b3606459dc9a84f08793f42e5 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 01:34:50 +0200 Subject: [PATCH 315/325] [ticket/10634] Specify module type when viewing profile Specify module type when checking for enabled modules when viewing user's profile PHPBB3-10634 --- phpBB/memberlist.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 1201aceff9..cf2cb5b06d 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -571,11 +571,11 @@ switch ($mode) $module->list_modules('ucp'); $module->list_modules('mcp'); - $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; - $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; - $zebra_enabled = ($module->loaded('zebra')) ? true : false; - $friends_enabled = ($module->loaded('zebra', 'friends')) ? true : false; - $foes_enabled = ($module->loaded('zebra', 'foes')) ? true : false; + $user_notes_enabled = ($module->loaded('mcp_notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('mcp_warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('ucp_zebra')) ? true : false; + $friends_enabled = ($module->loaded('ucp_zebra', 'friends')) ? true : false; + $foes_enabled = ($module->loaded('ucp_zebra', 'foes')) ? true : false; unset($module); } From 6858485964fda2d43fd7622123ffce796b2fd365 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 9 Feb 2012 14:08:58 +0100 Subject: [PATCH 316/325] [ticket/10636] Resolve variable name ($sql_ary) conflict in cache_moderators(). Regression from 4c77903129749008cd08c346006d2a57cf6ff544. PHPBB3-10636 --- phpBB/includes/functions_admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 7fdf874456..2fd58a11e9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2330,7 +2330,7 @@ function cache_moderators() $ug_id_ary = array_keys($hold_ary); // Remove users who have group memberships with DENY moderator permissions - $sql_ary = array( + $sql_ary_deny = array( 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', 'FROM' => array( @@ -2357,7 +2357,7 @@ function cache_moderators() AND ug.user_pending = 0 AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), ); - $sql = $db->sql_build_query('SELECT', $sql_ary); + $sql = $db->sql_build_query('SELECT', $sql_ary_deny); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) From f894da0d25f2ecc4c8f3c039dd9f40607137d4ca Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 9 Feb 2012 15:13:29 +0100 Subject: [PATCH 317/325] [ticket/10633] Stop leaking filename of attachments when thumbnail is requested While filenames are chosen at random and there is no correlation between the original filename and the new filesystem filename, there is a correlation between filesystem filename and filesytem filename of thumbnails. Adjust error message to no longer include the physical filename and make it consistent with the error message that is shown when there is no attachment at all. This information was mostly useless for regular users (i.e. non-admins) anyway. PHPBB3-10633 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index c17f0cf018..bf277c69fa 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -424,7 +424,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) if (!@file_exists($filename)) { send_status_line(404, 'Not Found'); - trigger_error($user->lang['ERROR_NO_ATTACHMENT'] . '

    ' . sprintf($user->lang['FILE_NOT_FOUND_404'], $filename)); + trigger_error('ERROR_NO_ATTACHMENT'); } // Correct the mime type - we force application/octetstream for all files, except images From 35d5d527dbe2de1a608e6af4b004ed807ff22743 Mon Sep 17 00:00:00 2001 From: James King Date: Wed, 8 Feb 2012 01:33:08 +0000 Subject: [PATCH 318/325] [ticket/10606] Fix incorrect hidden fields array name in page_header(). Regression from dfb7cc625a37c6345fa647ee3a21f890ba5c9649. PHPBB3-10606 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4d2a00f2db..0320230a7d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4553,7 +4553,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } From a962e788542dac43a365afde295babf3ee681535 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 9 Feb 2012 15:29:21 +0100 Subject: [PATCH 319/325] [ticket/10606] Also correctly use $s_search_hidden_fields in view(forum|topic). Regression from dfb7cc625a37c6345fa647ee3a21f890ba5c9649. PHPBB3-10606 --- phpBB/viewforum.php | 2 +- phpBB/viewtopic.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 588f60b589..6fec662b02 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -278,7 +278,7 @@ if (!empty($_EXTRA_URL)) foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 01cd6a28a8..74420a25c7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -607,7 +607,7 @@ if (!empty($_EXTRA_URL)) foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } From 11606c86073db42b0455a654d35d6ff38fb70105 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 21:58:39 +0200 Subject: [PATCH 320/325] [ticket/10637] Leftovers from implementation of extensions Replacing code in includes/functions_admin.php that was missed in ticket 10323 PHPBB3-10637 --- phpBB/includes/functions_admin.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 7fdf874456..7b4393f383 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -847,15 +847,13 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Remove the message from the search index - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - $error = false; $search = new $search_type($error); From 1d72a47ea6f47ec95b201ea4a3b9a9e0ea34da9a Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 22:13:13 +0200 Subject: [PATCH 321/325] [ticket/10637] Leftovers from implementation of extensions in mcp_main Replacing code in includes/mcp/mcp_main.php that was missed in ticket 10323 PHPBB3-10637 --- phpBB/includes/mcp/mcp_main.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 10e5956fc2..a21c67924d 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -907,16 +907,11 @@ function mcp_fork_topic($topic_ids) if (!isset($search_type) && $topic_row['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised - $search_type = basename($config['search_type']); - - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) - { - trigger_error('NO_SUCH_SEARCH_MODULE'); - } + $search_type = $config['search_type']; if (!class_exists($search_type)) { - include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + trigger_error('NO_SUCH_SEARCH_MODULE'); } $error = false; From 92303d2dacdd7be3fad4d2ffba84c0d30fcadeaf Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 22:17:33 +0200 Subject: [PATCH 322/325] [ticket/10637] Leftovers from implementation of extensions in mcp_post Replacing code in includes/mcp/mcp_post.php that was missed in ticket 10323 PHPBB3-10637 --- phpBB/includes/mcp/mcp_post.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index ee79928eb1..2a52a858b3 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -464,12 +464,10 @@ function change_poster(&$post_info, $userdata) } // refresh search cache of this post - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (class_exists($search_type)) { - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error); From a1a1b61ae8507276f7191be84a8782c0b0218f9c Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 22:22:32 +0200 Subject: [PATCH 323/325] [ticket/10637] Leftovers from implementation of extensions in develop tools Replacing code in development tools that was missed in ticket 10323 PHPBB3-10637 --- phpBB/develop/create_search_index.php | 1 - phpBB/develop/search_fill.php | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index 28001035f6..1de20f3099 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -25,7 +25,6 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($phpbb_root_path . 'common.' . $phpEx); require($phpbb_root_path . 'includes/acp/acp_search.' . $phpEx); -require($phpbb_root_path . 'includes/search/' . $class_name . '.' . $phpEx); $user->session_begin(); $auth->acl($user->data); diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 371c8c74cc..4c0b607778 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -34,13 +34,11 @@ $user->setup(); $search_type = $config['search_type']; -if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) +if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } -require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); - $error = false; $search = new $search_type($error); From caeadf85d00ce90b8ea141bcb9a05d229ff1b5b4 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 9 Feb 2012 22:24:46 +0200 Subject: [PATCH 324/325] [ticket/10637] Leftovers from implementation of extensions in convertor Replacing code in convertor that was missed in ticket 10323 PHPBB3-10637 --- phpBB/install/install_convert.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 5a868004ef..db974f9903 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -735,22 +735,20 @@ class install_convert extends module $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->options['forum_path']), __LINE__, __FILE__); } - $search_type = basename(trim($config['search_type'])); + $search_type = $config['search_type']; // For conversions we are a bit less strict and set to a search backend we know exist... - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { - $search_type = 'fulltext_native'; + $search_type = 'phpbb_search_fulltext_native'; set_config('search_type', $search_type); } - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); - $error = false; $convert->fulltext_search = new $search_type($error); From 2a5e30db9e13bc5c8895774291137a9dccb3a2c4 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Sat, 11 Feb 2012 01:40:01 -0600 Subject: [PATCH 325/325] [ticket/10641] Update MCP template with new plurality forms Updates the MCP template according to PHPBB3-10345 PHPBB3-10641 --- phpBB/styles/prosilver/template/mcp_front.html | 12 +++--------- .../styles/subsilver2/template/mcp_front.html | 18 ------------------ 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index 21431b4bc1..e9635e528c 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -10,7 +10,7 @@

    {L_LATEST_UNAPPROVED}

    -

    {L_UNAPPROVED_TOTAL}

    +

    {L_UNAPPROVED_TOTAL}

      @@ -40,8 +40,6 @@
    - -

    {L_UNAPPROVED_POSTS_ZERO_TOTAL}

    @@ -64,7 +62,7 @@

    {L_LATEST_REPORTED}

    -

    {L_REPORTS_TOTAL}

    +

    {L_REPORTS_TOTAL}

      @@ -92,8 +90,6 @@
    - -

    {L_REPORTS_ZERO_TOTAL}

    @@ -105,7 +101,7 @@

    {L_LATEST_REPORTED_PMS}

    -

    {L_PM_REPORTS_TOTAL}

    +

    {L_PM_REPORTS_TOTAL}

      @@ -133,8 +129,6 @@
    - -

    {L_PM_REPORTS_ZERO_TOTAL}

    diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html index f4b146f4c5..7c17e13c52 100644 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ b/phpBB/styles/subsilver2/template/mcp_front.html @@ -24,16 +24,10 @@ {unapproved.POST_TIME} - - - {L_UNAPPROVED_POSTS_ZERO_TOTAL} - - {L_UNAPPROVED_TOTAL} - {S_HIDDEN_FIELDS}   @@ -70,16 +64,10 @@ {report.REPORTER_FULL} {report.REPORT_TIME} - - - {L_REPORTS_ZERO_TOTAL} - - {L_REPORTS_TOTAL} -

    @@ -107,16 +95,10 @@ {pm_report.REPORTER_FULL} {pm_report.REPORT_TIME} - - - {L_PM_REPORTS_ZERO_TOTAL} - - {L_PM_REPORTS_TOTAL} -