From 246be1cb08dff57899fdafaf0ccfb3cd1913d1f5 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sun, 5 Feb 2012 14:09:28 +0200 Subject: [PATCH 01/65] [feature/prosilver-cleanup/css-reset-v2] CSS reset Adding proper CSS reset to prosilver PHPBB3-10617 --- phpBB/styles/prosilver/theme/common.css | 81 +++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 8b5e09297e..9dce127d66 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1,12 +1,51 @@ -/* General Markup Styles +/* CSS Reset http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 ---------------------------------------- */ - -* { - /* Reset browsers default margin, padding and font sizes */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { margin: 0; padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; } +/* General Markup Styles +---------------------------------------- */ html { font-size: 100%; /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ @@ -20,6 +59,7 @@ body { background-color: #FFFFFF; /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */ font-size: 10px; + line-height: normal; margin: 0; padding: 12px 0; } @@ -99,6 +139,39 @@ p.right { text-align: right; } +b, strong { + font-weight: bold; +} + +i, em { + font-style: italic; +} + +u { + text-decoration: underline; +} + +ul { + list-style-type: disc; +} + +ol { + list-style-type: decimal; +} + +li { + display: list-item; +} + +ul ul, ol ul { + list-style-type: circle; +} + +ol ol ul, ol ul ul, ul ol ul, ul ul ul { + list-style-type: square; +} + + /* Main blocks ---------------------------------------- */ #wrap { From 8e1e48a7b69b78e10297869e3aaf224e5c12e493 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Feb 2012 10:55:57 +0100 Subject: [PATCH 02/65] [ticket/8636] Add resync option to topic_view moderation page PHPBB3-8636 --- phpBB/includes/mcp/mcp_topic.php | 11 +++++++++++ phpBB/styles/prosilver/template/mcp_topic.html | 1 + phpBB/styles/subsilver2/template/mcp_topic.html | 1 + 3 files changed, 13 insertions(+) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index d7cc1e795a..7d4edaf362 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -50,6 +50,16 @@ function mcp_topic_view($id, $mode, $action) $submitted_id_list = request_var('post_ids', array(0)); $checked_ids = $post_id_list = request_var('post_id_list', array(0)); + // Resync Topic? + if ($action == 'resync') + { + if (!function_exists('mcp_resync_topics')) + { + include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + } + mcp_resync_topics(array($topic_id)); + } + // Split Topic? if ($action == 'split_all' || $action == 'split_beyond') { @@ -320,6 +330,7 @@ function mcp_topic_view($id, $mode, $action) 'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false, 'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false, 'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false, + 'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']), 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, 'S_MERGE_VIEW' => ($action == 'merge') ? true : false, 'S_SPLIT_VIEW' => ($action == 'split') ? true : false, diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index a4d2a0f600..2a5f52f038 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -158,6 +158,7 @@ onload_functions.push('subPanels()'); +  
{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index 13865d26ee..f9f9382ff2 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -135,6 +135,7 @@ +   From 025de9ee191654825f6ba09a4804e6ef3633b8cb Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 8 Mar 2012 14:57:47 +0800 Subject: [PATCH 03/65] [ticket/10684] Send notifications for users with stale bans PHPBB3-10684 --- phpBB/includes/functions_posting.php | 36 +++++++++++++++------------- phpBB/includes/functions_user.php | 29 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f920be9c4b..faf904467f 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1180,28 +1180,23 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id $topic_title = ($topic_notification) ? $topic_title : $subject; $topic_title = censor_text($topic_title); - // Get banned User ID's - $sql = 'SELECT ban_userid - FROM ' . BANLIST_TABLE . ' - WHERE ban_userid <> 0 - AND ban_exclude <> 1'; - $result = $db->sql_query($sql); - - $sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id']; - while ($row = $db->sql_fetchrow($result)) + // Exclude guests, current user and banned users from notifications + if (!function_exists('phpbb_get_banned_users_ids')) { - $sql_ignore_users .= ', ' . (int) $row['ban_userid']; + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - $db->sql_freeresult($result); + $sql_ignore_users = phpbb_get_banned_users_ids(); + $sql_ignore_users[ANONYMOUS] = ANONYMOUS; + $sql_ignore_users[$user->data['user_id']] = $user->data['user_id']; $notify_rows = array(); // -- get forum_userids || topic_userids $sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber FROM ' . (($topic_notification) ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u - WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . " - AND w.user_id NOT IN ($sql_ignore_users) - AND w.notify_status = " . NOTIFY_YES . ' + WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . ' + AND ' . $db->sql_in_set('w.user_id', $sql_ignore_users, true) . ' + AND w.notify_status = ' . NOTIFY_YES . ' AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') AND u.user_id = w.user_id'; $result = $db->sql_query($sql); @@ -1225,16 +1220,23 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id // forum notification is sent to those not already receiving topic notifications if ($topic_notification) { + // Add users who has been already notified to ignore list if (sizeof($notify_rows)) { - $sql_ignore_users .= ', ' . implode(', ', array_keys($notify_rows)); + foreach ($notify_rows as $user_id => $row) + { + if (!isset($sql_ignore_users[$user_id])) + { + $sql_ignore_users[$user_id] = $user_id; + } + } } $sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u WHERE fw.forum_id = $forum_id - AND fw.user_id NOT IN ($sql_ignore_users) - AND fw.notify_status = " . NOTIFY_YES . ' + AND " . $db->sql_in_set('fw.user_id', $sql_ignore_users, true) . ' + AND fw.notify_status = ' . NOTIFY_YES . ' AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') AND u.user_id = fw.user_id'; $result = $db->sql_query($sql); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6b5cca8abb..aea94a0d34 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3587,4 +3587,33 @@ function remove_newly_registered($user_id, $user_data = false) return $user_data['group_id']; } +/** +* Get a list of banned users' ids, ignoring stale buns which were not wiped yet. +* +* @return array Array of banned users' ids if any, empty array otherwise +*/ +function phpbb_get_banned_users_ids() +{ + global $db; + + // Get banned User ID's + // Ignore stale bans which were not wiped yet + $banned_ids_list = array(); + $sql = 'SELECT ban_userid + FROM ' . BANLIST_TABLE . ' + WHERE ban_userid <> 0 + AND ban_exclude <> 1 + AND (ban_end > ' . time() . ' + OR ban_end = 0)'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_id = (int) $row['ban_userid']; + $banned_ids_list[$user_id] = $user_id; + } + $db->sql_freeresult($result); + + return $banned_ids_list; +} + ?> \ No newline at end of file From ee6783109ad7af70665c98d6bbc12d170bc0f892 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 9 Mar 2012 16:41:49 +0800 Subject: [PATCH 04/65] [ticket/10684] Fix 2 typos in comment lines. PHPBB3-10684 --- phpBB/includes/functions_posting.php | 2 +- phpBB/includes/functions_user.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index faf904467f..ce9762284d 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1220,7 +1220,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id // forum notification is sent to those not already receiving topic notifications if ($topic_notification) { - // Add users who has been already notified to ignore list + // Add users who have been already notified to ignore list if (sizeof($notify_rows)) { foreach ($notify_rows as $user_id => $row) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index aea94a0d34..dec8d09082 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3588,7 +3588,7 @@ function remove_newly_registered($user_id, $user_data = false) } /** -* Get a list of banned users' ids, ignoring stale buns which were not wiped yet. +* Get a list of banned users' ids, ignoring stale bans which were not wiped yet. * * @return array Array of banned users' ids if any, empty array otherwise */ From f563647e4b97fc62aa91bc3bf7c81fcc715f17c3 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 9 Mar 2012 22:35:13 +0800 Subject: [PATCH 05/65] [ticket/10684] Remove isset() for $sql_ignore_users update PHPBB3-10684 --- phpBB/includes/functions_posting.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index ce9762284d..c9b4267c35 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1225,10 +1225,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id { foreach ($notify_rows as $user_id => $row) { - if (!isset($sql_ignore_users[$user_id])) - { - $sql_ignore_users[$user_id] = $user_id; - } + $sql_ignore_users[$user_id] = $user_id; } } From fbe8086697481f5068a9897c9e629f048a553ee4 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 9 Mar 2012 16:10:02 +0000 Subject: [PATCH 06/65] [ticket/10694] Update PHP warning to 5.3.2 PHPBB3-10694 --- phpBB/includes/acp/acp_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index c8df21f5a9..5ecf54a9bc 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -398,7 +398,7 @@ class acp_main // Version check $user->add_lang('install'); - if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.2.0', '<')) + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.2', '<')) { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, From 89a6cb2886dfd4659e6db67e27e42c4df763f723 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 10 Mar 2012 00:17:39 +0800 Subject: [PATCH 07/65] [ticket/10684] Refactor $sql_ignore_users array update PHPBB3-10684 --- phpBB/includes/functions_posting.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index c9b4267c35..af26d8ed0f 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1214,21 +1214,15 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id 'method' => $row['user_notify_type'], 'allowed' => false ); + + // Add users who have been already notified to ignore list + $sql_ignore_users[$row['user_id']] = $row['user_id']; } $db->sql_freeresult($result); // forum notification is sent to those not already receiving topic notifications if ($topic_notification) { - // Add users who have been already notified to ignore list - if (sizeof($notify_rows)) - { - foreach ($notify_rows as $user_id => $row) - { - $sql_ignore_users[$user_id] = $user_id; - } - } - $sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u WHERE fw.forum_id = $forum_id @@ -1272,7 +1266,6 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id } } - // Now, we have to do a little step before really sending, we need to distinguish our users a little bit. ;) $msg_users = $delete_ids = $update_notification = array(); foreach ($notify_rows as $user_id => $row) From 668c61686b09e12e7f245fc6a402a1b1f6272f1c Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Sat, 10 Mar 2012 16:47:07 +0000 Subject: [PATCH 08/65] [ticket/10694] Adjusting details link to 5.3 announcement PHPBB3-10694 --- phpBB/includes/acp/acp_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 5ecf54a9bc..e529ae0e5a 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -402,7 +402,7 @@ class acp_main { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, - 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '', ''), + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '', ''), )); } From a79b3490c2b21d283d7bc1f15c4923180e0f10b2 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 11 Mar 2012 00:56:07 +0800 Subject: [PATCH 09/65] [ticket/10684] Cast user_id to integer PHPBB3-10684 --- phpBB/includes/functions_posting.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index af26d8ed0f..073ce1ff4e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1203,8 +1203,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id while ($row = $db->sql_fetchrow($result)) { - $notify_rows[$row['user_id']] = array( - 'user_id' => $row['user_id'], + $notify_user_id = (int) $row['user_id']; + $notify_rows[$notify_user_id] = array( + 'user_id' => $notify_user_id, 'username' => $row['username'], 'user_email' => $row['user_email'], 'user_jabber' => $row['user_jabber'], @@ -1216,7 +1217,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id ); // Add users who have been already notified to ignore list - $sql_ignore_users[$row['user_id']] = $row['user_id']; + $sql_ignore_users[$notify_user_id] = $notify_user_id; } $db->sql_freeresult($result); @@ -1234,8 +1235,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id while ($row = $db->sql_fetchrow($result)) { - $notify_rows[$row['user_id']] = array( - 'user_id' => $row['user_id'], + $notify_user_id = (int) $row['user_id']; + $notify_rows[$notify_user_id] = array( + 'user_id' => $notify_user_id, 'username' => $row['username'], 'user_email' => $row['user_email'], 'user_jabber' => $row['user_jabber'], From 321d0d9b56011e049b245b6d54975b6c67b3b15b Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 12 Mar 2012 01:44:00 +0800 Subject: [PATCH 10/65] [ticket/10684] Adjust pm_notifications() to handle stale bans - Add parameter (array) to the function phpbb_get_banned_users_ids() - Fix function pm_notification() to handle users with stale bans PHPBB3-10684 --- phpBB/includes/functions_privmsgs.php | 17 ++++++----------- phpBB/includes/functions_user.php | 14 +++++++++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index c40ceb088f..8303fc3754 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1622,6 +1622,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i $subject = censor_text($subject); + // Exclude guests, current user and banned users from notifications unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]); if (!sizeof($recipients)) @@ -1629,18 +1630,12 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i return; } - // Get banned User ID's - $sql = 'SELECT ban_userid - FROM ' . BANLIST_TABLE . ' - WHERE ' . $db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . ' - AND ban_exclude = 0'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) + if (!function_exists('phpbb_get_banned_users_ids')) { - unset($recipients[$row['ban_userid']]); + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - $db->sql_freeresult($result); + $banned_users = phpbb_get_banned_users_ids(array_keys($recipients)); + $recipients = array_diff(array_map('intval', array_keys($recipients)), $banned_users); if (!sizeof($recipients)) { @@ -1649,7 +1644,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i $sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($recipients))); + WHERE ' . $db->sql_in_set('user_id', $recipients); $result = $db->sql_query($sql); $msg_list_ary = array(); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index dec8d09082..8f40401f0b 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3588,22 +3588,26 @@ function remove_newly_registered($user_id, $user_data = false) } /** -* Get a list of banned users' ids, ignoring stale bans which were not wiped yet. +* Get a list of banned users' ids, ignoring stale bans which were not cleaned yet. * +* @param array $users_ids_array Array of users' ids to check for banning, +* leave empty to get complete list of banned ids * @return array Array of banned users' ids if any, empty array otherwise */ -function phpbb_get_banned_users_ids() +function phpbb_get_banned_users_ids($users_ids_array = array()) { global $db; + $sql_users_ids = (!empty($users_ids_array)) ? $db->sql_in_set('ban_userid', $users_ids_array) : 'ban_userid <> 0'; + // Get banned User ID's // Ignore stale bans which were not wiped yet $banned_ids_list = array(); $sql = 'SELECT ban_userid - FROM ' . BANLIST_TABLE . ' - WHERE ban_userid <> 0 + FROM ' . BANLIST_TABLE . " + WHERE $sql_users_ids AND ban_exclude <> 1 - AND (ban_end > ' . time() . ' + AND (ban_end > " . time() . ' OR ban_end = 0)'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) From da395edbca3e25d1758a6b8c26d14c2e48f112d9 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 12 Mar 2012 01:47:28 +0800 Subject: [PATCH 11/65] [ticket/10684] Remove intval mapping for array keys PHP manual for arrays http://php.net/manual/en/language.types.array.php states that the following key cast will occur: Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. Thus, no intval mapping for numeric array keys is needed. PHPBB3-10684 --- phpBB/includes/functions_privmsgs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 8303fc3754..4ea8f74153 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1635,7 +1635,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } $banned_users = phpbb_get_banned_users_ids(array_keys($recipients)); - $recipients = array_diff(array_map('intval', array_keys($recipients)), $banned_users); + $recipients = array_diff(array_keys($recipients), $banned_users); if (!sizeof($recipients)) { From ff8d5237688beee9ea36848e1ac49565e538c2cd Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 12 Mar 2012 01:57:51 +0800 Subject: [PATCH 12/65] [ticket/10684] Rename function phpbb_get_banned_users_ids() parameter PHPBB3-10684 --- phpBB/includes/functions_user.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8f40401f0b..8c42a5bb42 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3590,15 +3590,15 @@ function remove_newly_registered($user_id, $user_data = false) /** * Get a list of banned users' ids, ignoring stale bans which were not cleaned yet. * -* @param array $users_ids_array Array of users' ids to check for banning, -* leave empty to get complete list of banned ids +* @param array $users_ids Array of users' ids to check for banning, +* leave empty to get complete list of banned ids * @return array Array of banned users' ids if any, empty array otherwise */ -function phpbb_get_banned_users_ids($users_ids_array = array()) +function phpbb_get_banned_users_ids($users_ids = array()) { global $db; - $sql_users_ids = (!empty($users_ids_array)) ? $db->sql_in_set('ban_userid', $users_ids_array) : 'ban_userid <> 0'; + $sql_users_ids = (!empty($users_ids)) ? $db->sql_in_set('ban_userid', $users_ids) : 'ban_userid <> 0'; // Get banned User ID's // Ignore stale bans which were not wiped yet From 3b7a6a3eface3389b48358206fff3cb22615dc30 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 12 Mar 2012 00:39:12 +0100 Subject: [PATCH 13/65] [ticket/10689] Fix "First character"-option in "Find a member"-search PHPBB3-10689 --- phpBB/memberlist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b3c0bae16a..2a2ee407a0 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1346,6 +1346,7 @@ switch ($mode) if ($mode) { $params[] = "mode=$mode"; + $u_first_char_params[] = "mode=$mode"; } $sort_params[] = "mode=$mode"; From 33dce916e2ed58f1823f3b3fc1b2d72ae3c6686a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Mar 2012 22:22:22 +0100 Subject: [PATCH 14/65] [ticket/10690] Fix undefined UNAPPROVED_POSTS_ZERO_TOTAL in queue PHPBB3-10690 --- phpBB/language/en/mcp.php | 1 + phpBB/styles/prosilver/template/mcp_queue.html | 2 +- phpBB/styles/subsilver2/template/mcp_queue.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index 664365b1ec..bd25d403ab 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -238,6 +238,7 @@ $lang = array_merge($lang, array( 'NO_POST' => 'You have to select a post in order to warn the user for a post.', 'NO_POST_REPORT' => 'This post was not reported.', 'NO_POST_SELECTED' => 'You must select at least one post to perform this action.', + 'NO_POSTS_QUEUE' => 'There are no posts waiting for approval.', 'NO_REASON_DISAPPROVAL' => 'Please give an appropriate reason for disapproval.', 'NO_REPORT' => 'No report found', 'NO_REPORTS' => 'No reports found', diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 5f16ebe7d0..f86678ebe4 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -78,7 +78,7 @@ -

{L_NO_TOPICS_QUEUE}{L_UNAPPROVED_POSTS_ZERO_TOTAL}

+

{L_NO_TOPICS_QUEUE}{L_NO_POSTS_QUEUE}

diff --git a/phpBB/styles/subsilver2/template/mcp_queue.html b/phpBB/styles/subsilver2/template/mcp_queue.html index 6e39ccd272..d13af91888 100644 --- a/phpBB/styles/subsilver2/template/mcp_queue.html +++ b/phpBB/styles/subsilver2/template/mcp_queue.html @@ -27,7 +27,7 @@ - {L_NO_TOPICS_QUEUE}{L_UNAPPROVED_POSTS_ZERO_TOTAL} + {L_NO_TOPICS_QUEUE}{L_NO_POSTS_QUEUE} From 71afba0dedd2fcc4e478e191acc23277df8209c9 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 15 Mar 2012 22:46:06 -0400 Subject: [PATCH 15/65] [task/php54] Refactor error_reporting call slightly. Separate error level assignment into a variable in this commit so that the only difference between Olympus and Ascraeus is the addition of logic altering $level. PHPBB3-10615 --- phpBB/includes/startup.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index bbe2f127f1..178fb30435 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -19,7 +19,8 @@ if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 8192); } -error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); +$level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; +error_reporting($level); /* * Remove variables created by register_globals from the global scope From 5efdbfa5e4e3c00c08167cdfff912ee4937f4fd2 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 15 Mar 2012 22:47:42 -0400 Subject: [PATCH 16/65] [task/php54] Disable E_STRICT in Olympus when running on PHP 5.4. We cannot use static in Olympus because it must be PHP 4 compatible. Therefore disable E_STRICT for Olympus. This commit should be reverted for Ascraeus. PHPBB3-10615 --- phpBB/includes/startup.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 178fb30435..cf216a65db 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -20,6 +20,21 @@ if (!defined('E_DEPRECATED')) define('E_DEPRECATED', 8192); } $level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; +if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) +{ + // PHP 5.4 adds E_STRICT to E_ALL. + // Our utf8 normalizer triggers E_STRICT output on PHP 5.4. + // Unfortunately it cannot be made E_STRICT-clean while + // continuing to work on PHP 4. + // Therefore, in phpBB 3.0.x we disable E_STRICT on PHP 5.4+, + // while phpBB 3.1 will fix utf8 normalizer. + // E_STRICT is defined starting with PHP 5 + if (!defined('E_STRICT')) + { + define('E_STRICT', 2048); + } + $level &= ~E_STRICT; +} error_reporting($level); /* From ccdd176b72250be2e8f72bd13147679a5f2a263b Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 16 Mar 2012 04:56:41 -0400 Subject: [PATCH 17/65] [task/php54-ascraeus] Bring p_master#module_auth into PHP 5 era. Split module_auth into a static and a non-static version. Call the static version statically and the non-static version non-statically. PHPBB3-10615 --- phpBB/includes/acp/acp_users.php | 2 +- phpBB/includes/functions_module.php | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 97f4b1b5fd..cf6716c322 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -128,7 +128,7 @@ class acp_users $dropdown_modes = array(); while ($row = $db->sql_fetchrow($result)) { - if (!$this->p_master->module_auth($row['module_auth'])) + if (!$this->p_master->module_auth_self($row['module_auth'])) { continue; } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index db7defdc48..1c1bc42a11 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -128,7 +128,7 @@ class p_master foreach ($this->module_cache['modules'] as $key => $row) { // Not allowed to view module? - if (!$this->module_auth($row['module_auth'])) + if (!$this->module_auth_self($row['module_auth'])) { unset($this->module_cache['modules'][$key]); continue; @@ -315,9 +315,23 @@ class p_master } /** - * Check module authorisation + * Check module authorisation. + * + * This is a non-static version that uses $this->acl_forum_id + * for the forum id. */ - function module_auth($module_auth, $forum_id = false) + function module_auth_self($module_auth) + { + return self::module_auth($module_auth, $this->acl_forum_id); + } + + /** + * Check module authorisation. + * + * This is a static version, it must be given $forum_id. + * See also module_auth_self. + */ + static function module_auth($module_auth, $forum_id) { global $auth, $config; global $request; @@ -365,8 +379,6 @@ class p_master // Make sure $id seperation is working fine $module_auth = str_replace(' , ', ',', $module_auth); - $forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id; - $is_auth = false; eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '$request->variable(\'\\1\', false)'), $module_auth) . ');'); From c551b46115c889ac955649fe5513fb1d39d9979e Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Mon, 19 Mar 2012 17:11:30 +0530 Subject: [PATCH 18/65] [ticket/10691] Fixed the speed of creating search index $time is now initialized after each batch iteration. Speed for each batch iteration of creating search index is fixed. PHPBB3-10691 --- phpBB/develop/create_search_index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index 28001035f6..c1a7125d61 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -36,7 +36,6 @@ $search_errors = array(); $search = new $class_name($search_errors); $batch_size = isset($argv[2]) ? $argv[2] : 2000; -$time = time(); if (method_exists($search, 'create_index')) { @@ -68,6 +67,7 @@ else while ($post_counter <= $max_post_id) { $row_count = 0; + $time = time(); printf("Processing posts with %d <= post_id <= %d\n", $post_counter + 1, From 95b5109c622f8acd2d57343b97e3c2b6b157863a Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 25 Jan 2012 14:30:52 +0000 Subject: [PATCH 19/65] [feature/save-post-on-report] The complete changes for this feature This covers all the changes so that when a report is made, the post itself is copied and displayed in the MCP instead of the current post. Unfortunatly, I made all commits in the wrong way and they were lost. Now I have only the final files. --- phpBB/includes/mcp/mcp_reports.php | 4 ++-- phpBB/install/database_update.php | 3 +++ phpBB/report.php | 10 +++++++--- .../prosilver/template/posting_topic_review.html | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 95e84e816b..c848175c79 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -71,7 +71,7 @@ class mcp_reports // closed reports are accessed by report id $report_id = request_var('r', 0); - $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour + $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id @@ -226,7 +226,7 @@ class mcp_reports 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), - 'POST_PREVIEW' => $message, + 'POST_PREVIEW' => $report['reported_text'], 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 843e8c2f23..0a2c3998c4 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1088,6 +1088,9 @@ function database_update_info() PROFILE_FIELDS_TABLE => array( 'field_show_on_pm' => array('BOOL', 0), ), + REPORTS_TABLE => array( + 'reported_post' => array('TEXT', ''), + ), ), 'change_columns' => array( GROUPS_TABLE => array( diff --git a/phpBB/report.php b/phpBB/report.php index e29001d389..ab4de68cea 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -71,8 +71,9 @@ if ($post_id) trigger_error('POST_NOT_EXIST'); } - $forum_id = (int) $report_data['forum_id']; - $topic_id = (int) $report_data['topic_id']; + $forum_id = (int) $report_data['forum_id']; + $topic_id = (int) $report_data['topic_id']; + $reported_text = $report_data['post_text']; $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' @@ -130,6 +131,8 @@ else $message .= '

' . sprintf($user->lang['RETURN_PM'], '', ''); trigger_error($message); } + + $reported_text = $report_data['message_text']; } // Submit report? @@ -155,7 +158,8 @@ if ($submit && $reason_id) 'user_notify' => (int) $user_notify, 'report_closed' => 0, 'report_time' => (int) time(), - 'report_text' => (string) $report_text + 'report_text' => (string) $report_text, + 'reported_text' => $reported_text, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 67627f9785..a022048c34 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@
{topic_review_row.L_IGNORE_POST} -
+
From c241a4a2b484b561b5515c6f8211a21d39fd8d78 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 3 Feb 2012 20:54:24 +0000 Subject: [PATCH 20/65] [feature/save-post-on-report] Saves the post reported when a report is creat A problem when creating a report is that the report may be made and then the post changed. After the changes, if the report is seen the message it shows may not be correct to be reported. With these changes, when a report is created the system copies the post that was reported and shows it in the report details in the MCP PHPBB3-10600 --- phpBB/develop/create_schema_files.php | 1 + phpBB/install/schemas/firebird_schema.sql | 3 ++- phpBB/install/schemas/mssql_schema.sql | 3 ++- phpBB/install/schemas/mysql_40_schema.sql | 1 + phpBB/install/schemas/mysql_41_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 1 + phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/sqlite_schema.sql | 3 ++- phpBB/styles/subsilver2/template/posting_topic_review.html | 1 + 9 files changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 80d6e05d09..a4738df5bf 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1528,6 +1528,7 @@ function get_schema_struct() 'report_closed' => array('BOOL', 0), 'report_time' => array('TIMESTAMP', 0), 'report_text' => array('MTEXT_UNI', ''), + 'reported_post' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index daeba45864..518f1bcd4f 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -909,7 +909,8 @@ CREATE TABLE phpbb_reports ( user_notify INTEGER DEFAULT 0 NOT NULL, report_closed INTEGER DEFAULT 0 NOT NULL, report_time INTEGER DEFAULT 0 NOT NULL, - report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL + report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reported_post BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL );; ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 736917fdcb..526ce0f65b 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1108,7 +1108,8 @@ CREATE TABLE [phpbb_reports] ( [user_notify] [int] DEFAULT (0) NOT NULL , [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , - [report_text] [text] DEFAULT ('') NOT NULL + [report_text] [text] DEFAULT ('') NOT NULL , + [reported_post] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 97c378621b..22276b0d1f 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports ( report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumblob NOT NULL, + reported_post mediumblob NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 9615905625..7513b4518d 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports ( report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumtext NOT NULL, + reported_post mediumtext NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 5d60d2a19e..3982686c0d 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1214,6 +1214,7 @@ CREATE TABLE phpbb_reports ( report_closed number(1) DEFAULT '0' NOT NULL, report_time number(11) DEFAULT '0' NOT NULL, report_text clob DEFAULT '' , + reported_post clob DEFAULT '' , CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index d7377ac2e6..69685e45aa 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -853,6 +853,7 @@ CREATE TABLE phpbb_reports ( report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), report_text TEXT DEFAULT '' NOT NULL, + reported_post TEXT DEFAULT '' NOT NULL, PRIMARY KEY (report_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 257937275c..3916493bea 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -627,7 +627,8 @@ CREATE TABLE phpbb_reports ( user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_text mediumtext(16777215) NOT NULL DEFAULT '' + report_text mediumtext(16777215) NOT NULL DEFAULT '', + reported_post mediumtext(16777215) NOT NULL DEFAULT '' ); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 2bfa95f3d4..92f71c2307 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,6 +51,7 @@
+ {REPORTED_IMG}
{topic_review_row.MESSAGE}
From 6f5c0dddfcd2a1b56fe1e8cf783f48ecfc8561e9 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Tue, 14 Feb 2012 07:58:30 +0000 Subject: [PATCH 21/65] [feature/save-post-on-report] Bug fix table name There was a bug in the previous commit. I changed the name of the colon of the table and forgot to update the database_update.php now it's fixed. PHPBB3-10600 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0a2c3998c4..7240e899a6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_post' => array('TEXT', ''), + 'reported_text' => array('TEXT', ''), ), ), 'change_columns' => array( From 18373035c3299e80b2c075cfc3d475c89af3cc73 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Wed, 15 Feb 2012 22:03:32 +0000 Subject: [PATCH 22/65] [feature/save-post-on-report] Changed the name of the column The name of the column was changed from reported_post AND reported_text to reported_post_text. This change was made by request PHPBB3-10600 --- phpBB/develop/create_schema_files.php | 2 +- phpBB/includes/mcp/mcp_reports.php | 4 ++-- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 2 +- phpBB/install/schemas/mysql_40_schema.sql | 2 +- phpBB/install/schemas/mysql_41_schema.sql | 2 +- phpBB/install/schemas/oracle_schema.sql | 2 +- phpBB/install/schemas/postgres_schema.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 2 +- phpBB/report.php | 10 +++++----- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index a4738df5bf..987c9152d4 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1528,7 +1528,7 @@ function get_schema_struct() 'report_closed' => array('BOOL', 0), 'report_time' => array('TIMESTAMP', 0), 'report_text' => array('MTEXT_UNI', ''), - 'reported_post' => array('MTEXT_UNI', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index c848175c79..b4756b2600 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -71,7 +71,7 @@ class mcp_reports // closed reports are accessed by report id $report_id = request_var('r', 0); - $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour + $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id @@ -226,7 +226,7 @@ class mcp_reports 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), - 'POST_PREVIEW' => $report['reported_text'], + 'POST_PREVIEW' => $report['reported_post_text'], 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7240e899a6..2fdbd16e4a 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_text' => array('TEXT', ''), + 'reported_post_text' => array('TEXT', ''), ), ), 'change_columns' => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 518f1bcd4f..b88ed0a64a 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -910,7 +910,7 @@ CREATE TABLE phpbb_reports ( report_closed INTEGER DEFAULT 0 NOT NULL, report_time INTEGER DEFAULT 0 NOT NULL, report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL + reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL );; ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 526ce0f65b..a0399756e9 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1109,7 +1109,7 @@ CREATE TABLE [phpbb_reports] ( [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , [report_text] [text] DEFAULT ('') NOT NULL , - [reported_post] [text] DEFAULT ('') NOT NULL + [reported_post_text] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 22276b0d1f..69648c6b14 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -647,7 +647,7 @@ CREATE TABLE phpbb_reports ( report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumblob NOT NULL, - reported_post mediumblob NOT NULL, + reported_post_text mediumblob NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 7513b4518d..9b32ee19c6 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -647,7 +647,7 @@ CREATE TABLE phpbb_reports ( report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumtext NOT NULL, - reported_post mediumtext NOT NULL, + reported_post_text mediumtext NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 3982686c0d..032c8633dd 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1214,7 +1214,7 @@ CREATE TABLE phpbb_reports ( report_closed number(1) DEFAULT '0' NOT NULL, report_time number(11) DEFAULT '0' NOT NULL, report_text clob DEFAULT '' , - reported_post clob DEFAULT '' , + reported_post_text clob DEFAULT '' , CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 69685e45aa..f482920776 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -853,7 +853,7 @@ CREATE TABLE phpbb_reports ( report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), report_text TEXT DEFAULT '' NOT NULL, - reported_post TEXT DEFAULT '' NOT NULL, + reported_post_text TEXT DEFAULT '' NOT NULL, PRIMARY KEY (report_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 3916493bea..56468bcdd9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -628,7 +628,7 @@ CREATE TABLE phpbb_reports ( report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', report_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post mediumtext(16777215) NOT NULL DEFAULT '' + reported_post_text mediumtext(16777215) NOT NULL DEFAULT '' ); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); diff --git a/phpBB/report.php b/phpBB/report.php index ab4de68cea..29b46a6211 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -71,9 +71,9 @@ if ($post_id) trigger_error('POST_NOT_EXIST'); } - $forum_id = (int) $report_data['forum_id']; - $topic_id = (int) $report_data['topic_id']; - $reported_text = $report_data['post_text']; + $forum_id = (int) $report_data['forum_id']; + $topic_id = (int) $report_data['topic_id']; + $reported_post_text = $report_data['post_text']; $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' @@ -132,7 +132,7 @@ else trigger_error($message); } - $reported_text = $report_data['message_text']; + $reported_post_text = $report_data['message_text']; } // Submit report? @@ -159,7 +159,7 @@ if ($submit && $reason_id) 'report_closed' => 0, 'report_time' => (int) time(), 'report_text' => (string) $report_text, - 'reported_text' => $reported_text, + 'reported_post_text' => $reported_post_text, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); From 165a2d1aa879f1fc65448721da5f6d143aff91fe Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 8 Mar 2012 09:16:36 +0000 Subject: [PATCH 23/65] [feature/save-post-on-report] Change the column type of reported text What ever it said. I changed the type of data in the column reported_post_text to match what was requested by p PHPBB3-10600 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 2fdbd16e4a..8a7ec1004e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1089,7 +1089,7 @@ function database_update_info() 'field_show_on_pm' => array('BOOL', 0), ), REPORTS_TABLE => array( - 'reported_post_text' => array('TEXT', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), ), 'change_columns' => array( From 28c6b95100014bc9237c50c16e6b69a96102e7c6 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 8 Mar 2012 22:04:56 +0000 Subject: [PATCH 24/65] [feature/save-post-on-report] bbcode_nl2br missing. New lines were missing in the reported_post_text. By adding the bbcode_nl2br() became as it is supposed to. PHPBB3-10600 --- phpBB/includes/mcp/mcp_reports.php | 7 ++++--- phpBB/styles/prosilver/template/posting_topic_review.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index b4756b2600..69c6a4cfff 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -116,8 +116,9 @@ class mcp_reports $template->assign_vars(array( 'S_TOPIC_REVIEW' => true, 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], - 'TOPIC_TITLE' => $post_info['topic_title']) - ); + 'TOPIC_TITLE' => $post_info['topic_title'], + 'REPORTED_POST_ID' => $post_id, + )); } $topic_tracking_info = $extensions = $attachments = array(); @@ -226,7 +227,7 @@ class mcp_reports 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), - 'POST_PREVIEW' => $report['reported_post_text'], + 'POST_PREVIEW' => bbcode_nl2br($report['reported_post_text']), 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index a022048c34..1c4b67044d 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@
{topic_review_row.L_IGNORE_POST} -
+
From 3a044b4b3ef6b5a7c27ea357bc3b7d7dd101a262 Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Fri, 9 Mar 2012 15:56:43 +0000 Subject: [PATCH 25/65] [feature/save-post-on-report] Changed mark in subsilver2 to look like viewtopic As cyberalien requested. This was changed to match better the idea behind what was made in prosilver to subsilver2. PHPBB3-10600 --- .../styles/subsilver2/template/posting_topic_review.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 92f71c2307..cbd6746a8a 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,7 +51,13 @@
- {REPORTED_IMG} + + + + {REPORTED_IMG} + +
+
{topic_review_row.MESSAGE}
From a0131b45f56847f7e5c44a6db66cd7359967585f Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 8 Feb 2012 00:08:17 -0500 Subject: [PATCH 26/65] [ticket/10586] Extension front controller Handle extension front pages PHPBB3-10586 --- .../extension/controller_interface.php | 31 +++++++++++++++ phpBB/includes/extension/manager.php | 22 +++++++++++ phpBB/index.php | 39 +++++++++++++++++++ phpBB/language/en/common.php | 4 ++ 4 files changed, 96 insertions(+) create mode 100644 phpBB/includes/extension/controller_interface.php diff --git a/phpBB/includes/extension/controller_interface.php b/phpBB/includes/extension/controller_interface.php new file mode 100644 index 0000000000..bcc8972db4 --- /dev/null +++ b/phpBB/includes/extension/controller_interface.php @@ -0,0 +1,31 @@ +phpbb_root_path . "ext/$name/"); + } + + /** + * Check to see if a given extension is enabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is enabled + */ + public function enabled($name) + { + return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active']; + } /** * Instantiates a phpbb_extension_finder. diff --git a/phpBB/index.php b/phpBB/index.php index f1243bb336..a206ed4d37 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -24,6 +24,45 @@ $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); +// If given an extension, look for a front controller +if ($ext = $request->variable('ext', '')) +{ + // The class to load + $class = "phpbb_ext_{$ext}_controller"; + + // Make sure the specified extension is enabled + // and that it has a controller class + if (!$phpbb_extension_manager->available($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DOES_NOT_EXIST', $ext)); + } + else if (!$phpbb_extension_manager->enabled($ext)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_DISABLED', $ext)); + } + else if (!file_exists("{$phpbb_root_path}ext/$ext/controller.$phpEx") || !class_exists($class)) + { + send_status_line(404, 'Not Found'); + trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); + } + + // Instantiate the extension controller + $controller = new $class; + + // But let's make sure it's actually a proper controller + if (!($controller instanceof phpbb_extension_controller_interface)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang('EXTENSION_CLASS_WRONG_TYPE', $class)); + } + + // Let's get it started... + $controller->handle(); + exit_handler(); +} + display_forums('', $config['load_moderators']); $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7741ff8d1f..94edddc6f5 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -185,7 +185,11 @@ $lang = array_merge($lang, array( 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', + 'EXTENSION_CONTROLLER_MISSING' => 'The extension %s is missing a controller class and cannot be accessed through the front-end.', + 'EXTENSION_CLASS_WRONG_TYPE' => 'The extension controller class %s is not an instance of the phpbb_extension_controller_interface.', + 'EXTENSION_DISABLED' => 'The extension %s is not enabled.', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed.', + 'EXTENSION_DOES_NOT_EXIST' => 'The extension %s does not exist.', 'FAQ' => 'FAQ', 'FAQ_EXPLAIN' => 'Frequently Asked Questions', From 969c6d42e390fe05960d9dd3b97b230d4e7830a0 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 17 Feb 2012 14:21:28 -0500 Subject: [PATCH 27/65] [ticket/10586] Removed file_exists() check because class_exists() covers that. PHPBB3-10586 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index a206ed4d37..575134f6b1 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -42,7 +42,7 @@ if ($ext = $request->variable('ext', '')) send_status_line(404, 'Not Found'); trigger_error($user->lang('EXTENSION_DISABLED', $ext)); } - else if (!file_exists("{$phpbb_root_path}ext/$ext/controller.$phpEx") || !class_exists($class)) + else if (!class_exists($class)) { send_status_line(404, 'Not Found'); trigger_error($user->lang('EXTENSION_CONTROLLER_MISSING', $ext)); From e45452d1b3d39220ebd9b20390b9cc23ef64d3dd Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 18 Feb 2012 11:24:27 -0500 Subject: [PATCH 28/65] [ticket/10586] Sanitize periods from class names, use manager to get path. PHPBB3-10586 --- phpBB/includes/extension/manager.php | 2 +- phpBB/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index b94379141c..6f1c885ea9 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -437,7 +437,7 @@ class phpbb_extension_manager */ public function available($name) { - return file_exists($this->phpbb_root_path . "ext/$name/"); + return file_exists($this->get_extension_path($name, true)); } /** diff --git a/phpBB/index.php b/phpBB/index.php index 575134f6b1..e6a472ce31 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -28,7 +28,7 @@ $user->setup('viewforum'); if ($ext = $request->variable('ext', '')) { // The class to load - $class = "phpbb_ext_{$ext}_controller"; + $class = 'phpbb_ext_' . str_replace('/', '_', $name) . '_controller'; // Make sure the specified extension is enabled // and that it has a controller class From e5ce9646567e6b3441c21ab960f8a77f1281c72b Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 18 Feb 2012 11:34:07 -0500 Subject: [PATCH 29/65] [ticket/10586] Copy/paste fail fixed PHPBB3-10586 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index e6a472ce31..2500774f67 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -28,7 +28,7 @@ $user->setup('viewforum'); if ($ext = $request->variable('ext', '')) { // The class to load - $class = 'phpbb_ext_' . str_replace('/', '_', $name) . '_controller'; + $class = 'phpbb_ext_' . str_replace('/', '_', $ext) . '_controller'; // Make sure the specified extension is enabled // and that it has a controller class From 401de113f9a0cec57c9648a079303d30fdb23666 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 19 Feb 2012 15:26:20 -0500 Subject: [PATCH 30/65] [ticket/10586] test stuff. does not work yet, still need to put phpBB objects in bootstrap.php --- .../functional/extension_controller_test.php | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/functional/extension_controller_test.php diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php new file mode 100644 index 0000000000..7f0bccc485 --- /dev/null +++ b/tests/functional/extension_controller_test.php @@ -0,0 +1,96 @@ +enable('foobar'); + $phpbb_extension_manager->enable('foo_bar'); + $phpbb_extension_manager->enable('error_class'); + $phpbb_extension_manager->enable('error_classtype'); + } + + public function tearDown() + { + global $db, $cache; + $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + + $phpbb_extension_manager->purge('foobar'); + $phpbb_extension_manager->purge('foo_bar'); + $phpbb_extension_manager->purge('error_class'); + $phpbb_extension_manager->purge('error_classtype'); + } + + /** + * Check an extension at ./ext/foobar/ which should have the class + * phpbb_ext_foobar_controller + */ + public function test_foobar() + { + $crawler = $this->request('GET', 'index.php?ext=foobar'); + $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + } + + /** + * Check an extension at ./ext/foo/bar/ which should have the class + * phpbb_ext_foo_bar_controller + */ + public function test_foo_bar() + { + $crawler = $this->request('GET', 'index.php?ext=foo/bar'); + $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + } + + /** + * Check the error produced by extension at ./ext/error/class which has class + * phpbb_ext_foobar_controller + */ + public function test_error_class_name() + { + $crawler = $this->request('GET', 'index.php?ext=error/class'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_class is missing a controller class and cannot be accessed through the front-end.")')->count()); + } + + /** + * Check the error produced by extension at ./ext/error/classtype which has class + * phpbb_ext_error_classtype_controller but does not implement phpbb_extension_controller_interface + */ + public function test_error_class_type() + { + $crawler = $this->request('GET', 'index.php?ext=error/classtype'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.")')->count()); + } + + /** + * Check the error produced by extension at ./ext/error/disabled that is (obviously) + * a disabled extension + */ + public function test_error_ext_disabled() + { + $crawler = $this->request('GET', 'index.php?ext=error/disabled'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_classtype is not enabled.")')->count()); + } + + /** + * Check the error produced by extension at ./ext/error/404 that is (obviously) + * not existant + */ + public function test_error_ext_missing() + { + $crawler = $this->request('GET', 'index.php?ext=error/404'); + $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_404 does not exist.")')->count()); + } +} From 9212466626a3d80a90cab1f23cf423a1c4e20655 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 09:38:53 -0500 Subject: [PATCH 31/65] [ticket/10586] some bootstrap additions and test changes to try and make it work PHPBB3-10586 --- tests/bootstrap.php | 36 +++++++++++++++++++ .../functional/extension_controller_test.php | 6 ++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 302701e3b3..e98ec384e6 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,6 +26,42 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; +// For functional tests, we need to make available the phpBB objects +require_once $phpbb_root_path . 'config.php'; +// Setup class loader first +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); +$phpbb_class_loader_ext->register(); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); +$phpbb_class_loader->register(); + +// set up caching +$cache_factory = new phpbb_cache_factory($acm_type); +$cache = $cache_factory->get_service(); +$phpbb_class_loader_ext->set_cache($cache->get_driver()); +$phpbb_class_loader->set_cache($cache->get_driver()); + +// We have to include this because the class loader doesn't +// recognize classes without the phpbb_ prefix +// So user and auth and the DBAL aren't found unless we require these files +require($phpbb_root_path . 'includes/session.' . $phpEx); +require($phpbb_root_path . 'includes/auth.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); +// Instantiate some basic classes +$user = new user(); +$auth = new auth(); +$db = new $sql_db(); + +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); + +// We do not need this any longer, unset for safety purposes +unset($dbpasswd); + +// Grab global variables, re-cache if necessary +$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); + +// load extensions +$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) { require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 7f0bccc485..430d93f9bf 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -14,8 +14,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { public function setUp() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->enable('foobar'); $phpbb_extension_manager->enable('foo_bar'); @@ -25,8 +24,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function tearDown() { - global $db, $cache; - $phpbb_extension_manager = new phpbb_extension_manager($db, 'phpbb_ext', '.php', $cache, '_cache'); + global $phpbb_extension_manager; $phpbb_extension_manager->purge('foobar'); $phpbb_extension_manager->purge('foo_bar'); From a37a28b48546afc880446db7e4b2fd87c70a6cda Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 10:53:22 -0500 Subject: [PATCH 32/65] [ticket/10586] Now tests run, but fail. But here is what I have. PHPBB3-10586 --- tests/bootstrap.php | 36 ------------------- .../functional/extension_controller_test.php | 6 ++-- .../phpbb_functional_test_case.php | 20 +++++++++++ 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e98ec384e6..302701e3b3 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,42 +26,6 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; -// For functional tests, we need to make available the phpBB objects -require_once $phpbb_root_path . 'config.php'; -// Setup class loader first -$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); -$phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); -$phpbb_class_loader->register(); - -// set up caching -$cache_factory = new phpbb_cache_factory($acm_type); -$cache = $cache_factory->get_service(); -$phpbb_class_loader_ext->set_cache($cache->get_driver()); -$phpbb_class_loader->set_cache($cache->get_driver()); - -// We have to include this because the class loader doesn't -// recognize classes without the phpbb_ prefix -// So user and auth and the DBAL aren't found unless we require these files -require($phpbb_root_path . 'includes/session.' . $phpEx); -require($phpbb_root_path . 'includes/auth.' . $phpEx); -require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); -// Instantiate some basic classes -$user = new user(); -$auth = new auth(); -$db = new $sql_db(); - -$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); - -// We do not need this any longer, unset for safety purposes -unset($dbpasswd); - -// Grab global variables, re-cache if necessary -$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); - -// load extensions -$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); - if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) { require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 430d93f9bf..7e50eb7d91 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -14,7 +14,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { public function setUp() { - global $phpbb_extension_manager; + parent::setUp(); + $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foobar'); $phpbb_extension_manager->enable('foo_bar'); @@ -24,7 +25,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function tearDown() { - global $phpbb_extension_manager; + parent::tearDown(); + $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->purge('foobar'); $phpbb_extension_manager->purge('foo_bar'); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b5e6f7e377..b2ae215d91 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -66,6 +66,26 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function get_db() + { + global $phpbb_root_path, $phpEx; + if (!class_exists('dbal_' . self::$config['dbms'])) + { + include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + } + $sql_db = 'dbal_' . self::$config['dbms']; + $db = new $sql_db(); + $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); + return $db; + } + + protected function get_ext_manager() + { + global $phpbb_root_path, $phpEx; + + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_null); + } + protected function install_board() { global $phpbb_root_path, $phpEx; From d235262bc21657f0693501ac1154e1443578d507 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Feb 2012 11:17:21 -0500 Subject: [PATCH 33/65] [ticket/10586] Adding the extensions used by the tests PHPBB3-10586 --- .../fixtures/ext/error/class/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/class/ext.php | 6 ++++++ .../ext/error/classtype/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/classtype/ext.php | 6 ++++++ .../fixtures/ext/error/disabled/controller.php | 17 +++++++++++++++++ .../fixtures/ext/error/disabled/ext.php | 6 ++++++ .../fixtures/ext/foo/bar/controller.php | 17 +++++++++++++++++ tests/functional/fixtures/ext/foo/bar/ext.php | 6 ++++++ .../styles/prosilver/template/index_body.html | 5 +++++ .../fixtures/ext/foobar/controller.php | 17 +++++++++++++++++ tests/functional/fixtures/ext/foobar/ext.php | 6 ++++++ .../styles/prosilver/template/index_body.html | 5 +++++ .../phpbb_functional_test_case.php | 18 ++++++++++++------ 13 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 tests/functional/fixtures/ext/error/class/controller.php create mode 100644 tests/functional/fixtures/ext/error/class/ext.php create mode 100644 tests/functional/fixtures/ext/error/classtype/controller.php create mode 100644 tests/functional/fixtures/ext/error/classtype/ext.php create mode 100644 tests/functional/fixtures/ext/error/disabled/controller.php create mode 100644 tests/functional/fixtures/ext/error/disabled/ext.php create mode 100644 tests/functional/fixtures/ext/foo/bar/controller.php create mode 100644 tests/functional/fixtures/ext/foo/bar/ext.php create mode 100644 tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html create mode 100644 tests/functional/fixtures/ext/foobar/controller.php create mode 100644 tests/functional/fixtures/ext/foobar/ext.php create mode 100644 tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html diff --git a/tests/functional/fixtures/ext/error/class/controller.php b/tests/functional/fixtures/ext/error/class/controller.php new file mode 100644 index 0000000000..eb2ae362a6 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/controller.php @@ -0,0 +1,17 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/class/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/class/ext.php b/tests/functional/fixtures/ext/error/class/ext.php new file mode 100644 index 0000000000..f97ad2b838 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/classtype/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/classtype/ext.php b/tests/functional/fixtures/ext/error/classtype/ext.php new file mode 100644 index 0000000000..35b1cd15a2 --- /dev/null +++ b/tests/functional/fixtures/ext/error/classtype/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/disabled/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/disabled/ext.php b/tests/functional/fixtures/ext/error/disabled/ext.php new file mode 100644 index 0000000000..aec8051848 --- /dev/null +++ b/tests/functional/fixtures/ext/error/disabled/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php new file mode 100644 index 0000000000..3a2068631e --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/ext.php @@ -0,0 +1,6 @@ + + +
This is for testing purposes.
+ + diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php new file mode 100644 index 0000000000..c3ef29ffef --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -0,0 +1,17 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php new file mode 100644 index 0000000000..7b3f37cbfb --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -0,0 +1,6 @@ + + +
This is for testing purposes.
+ + diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b2ae215d91..9797ecfef8 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,8 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $db = null; + static protected $config = array(); static protected $already_installed = false; @@ -69,14 +71,18 @@ class phpbb_functional_test_case extends phpbb_test_case protected function get_db() { global $phpbb_root_path, $phpEx; - if (!class_exists('dbal_' . self::$config['dbms'])) + // so we don't reopen an open connection + if (!($this->db instanceof dbal)) { - include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + if (!class_exists('dbal_' . self::$config['dbms'])) + { + include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + } + $sql_db = 'dbal_' . self::$config['dbms']; + $this->db = new $sql_db(); + $this->db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); } - $sql_db = 'dbal_' . self::$config['dbms']; - $db = new $sql_db(); - $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); - return $db; + return $this->db; } protected function get_ext_manager() From 7b44d6f21a5a8be289bf6810f2c38d580647581e Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 15:35:01 -0400 Subject: [PATCH 34/65] [ticket/10586] initial work on copying fixtures. Note that this depends on 10706 PHPBB3-10586 --- .../functional/extension_controller_test.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 7e50eb7d91..b52174bbd5 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -12,6 +12,39 @@ */ class phpbb_functional_extension_controller_test extends phpbb_functional_test_case { + /** + * This should only be called once before the tests are run. + * This is used to copy the fixtures to the phpBB install + */ + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + // When you add new tests that require new fixtures, add them to the array. + $fixtures = array( + 'error/class/controller.php', + 'error/class/ext.php', + 'error/classtype/controller.php', + 'error/classtype/ext.php', + 'error/disabled/controller.php', + 'error/disabled/ext.php', + 'foo/bar/controller.php', + 'foo/bar/ext.php', + 'foo/bar/styles/prosilver/template/index_body.html', + 'foobar/controller.php', + 'foobar/ext.php', + 'foobar/styles/prosilver/template/index_body.html', + ); + + foreach ($fixtures as $fixture) + { + // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes + if(!copy("tests/functional/fixtures/ext/$fixture", self::$config['phpbb_functional_url'] . "/ext/$fixture")) + { + echo 'Could not copy file ' . $fixture; + } + } + } + public function setUp() { parent::setUp(); From 66b45318efea886ac6afc1f332cc94ee2af1c494 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 16:42:29 -0400 Subject: [PATCH 35/65] [ticket/10586] browse tests now work, but mine dont. at least we are making progress PHPBB3-10586 --- tests/functional/browse_test.php | 11 ++++++++++ .../functional/extension_controller_test.php | 22 ++++++++++++++++++- .../phpbb_test_case_helpers.php | 12 ++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index 723cf93232..d119787d13 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -12,6 +12,17 @@ */ class phpbb_functional_browse_test extends phpbb_functional_test_case { + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + $f_path = self::$config['phpbb_functional_path']; + // we cannot run these tests correctly if the install directory is present + if (is_dir($f_path . 'install/')) + { + rename($f_path . 'install/', $f_path . 'install_/'); + } + // NOTE: this will need to be renamed back again later if you wish to test again + } public function test_index() { $crawler = $this->request('GET', 'index.php'); diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index b52174bbd5..50710d0347 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,7 +19,27 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c static public function setUpBeforeClass() { parent::setUpBeforeClass(); + $f_path = self::$config['phpbb_functional_path']; + + // these directories need to be created before the files can be copied + $directories = array( + $f_path . 'ext/error/class/', + $f_path . 'ext/error/classtype/', + $f_path . 'ext/error/disabled/', + $f_path . 'ext/foo/bar/', + $f_path . 'ext/foo/bar/styles/prosilver/template/', + $f_path . 'ext/foobar/', + $f_path . 'ext/foobar/styles/prosilver/template/', + ); // When you add new tests that require new fixtures, add them to the array. + foreach ($directories as $dir) + { + if (!is_dir($dir)) + { + mkdir($dir, 0777, true); + } + } + $fixtures = array( 'error/class/controller.php', 'error/class/ext.php', @@ -38,7 +58,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c foreach ($fixtures as $fixture) { // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes - if(!copy("tests/functional/fixtures/ext/$fixture", self::$config['phpbb_functional_url'] . "/ext/$fixture")) + if(!copy("tests/functional/fixtures/ext/$fixture", "{$f_path}ext/$fixture")) { echo 'Could not copy file ' . $fixture; } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 9c91778cb0..51b04db263 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -80,6 +80,11 @@ class phpbb_test_case_helpers { $config['phpbb_functional_url'] = $phpbb_functional_url; } + + if (isset($phpbb_functional_path)) + { + $config['phpbb_functional_path'] = $phpbb_functional_path; + } } if (isset($_SERVER['PHPBB_TEST_DBMS'])) @@ -101,6 +106,13 @@ class phpbb_test_case_helpers )); } + if (isset($_SERVER['PHPBB_FUNCTIONAL_PATH'])) + { + $config = array_merge($config, array( + 'phpbb_functional_path' => isset($_SERVER['PHPBB_FUNCTIONAL_PATH']) ? $_SERVER['PHPBB_FUNCTIONAL_PATH'] : '', + )); + } + return $config; } } From e78585c973d260651dd8487d586facd2ab9e1e51 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 16 Mar 2012 17:18:08 -0400 Subject: [PATCH 36/65] [ticket/10586] Rename install directory back to install/ after tests PHPBB3-10586 --- tests/functional/extension_controller_test.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 50710d0347..f137a49bf4 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -65,6 +65,17 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c } } + public static function tearDownAfterClass() + { + $f_path = self::$config['phpbb_functional_path']; + // first we rename the install_ directory back to install + rename($f_path . 'install_/', $f_path . 'install/'); + + // @todo delete the fixtures from the $f_path board + // Note that it might be best to find a public domain function + // and port it into here instead of writing it from scratch + } + public function setUp() { parent::setUp(); From 4100b312bb0eb7246e9057461b6f8f3c66fdad60 Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 17 Mar 2012 22:12:50 -0400 Subject: [PATCH 37/65] [ticket/10586] Tests are coming along, just a little more to go PHPBB3-10586 --- .../functional/extension_controller_test.php | 56 +++++++++---------- .../fixtures/ext/foo/bar/controller.php | 2 +- .../{index_body.html => foobar_body.html} | 0 .../fixtures/ext/foobar/controller.php | 2 +- .../{index_body.html => foobar_body.html} | 0 5 files changed, 28 insertions(+), 32 deletions(-) rename tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/{index_body.html => foobar_body.html} (100%) rename tests/functional/fixtures/ext/foobar/styles/prosilver/template/{index_body.html => foobar_body.html} (100%) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index f137a49bf4..cb27511be1 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -49,10 +49,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c 'error/disabled/ext.php', 'foo/bar/controller.php', 'foo/bar/ext.php', - 'foo/bar/styles/prosilver/template/index_body.html', + 'foo/bar/styles/prosilver/template/foobar_body.html', 'foobar/controller.php', 'foobar/ext.php', - 'foobar/styles/prosilver/template/index_body.html', + 'foobar/styles/prosilver/template/foobar_body.html', ); foreach ($fixtures as $fixture) @@ -76,36 +76,20 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c // and port it into here instead of writing it from scratch } - public function setUp() - { - parent::setUp(); - $phpbb_extension_manager = $this->get_ext_manager(); - - $phpbb_extension_manager->enable('foobar'); - $phpbb_extension_manager->enable('foo_bar'); - $phpbb_extension_manager->enable('error_class'); - $phpbb_extension_manager->enable('error_classtype'); - } - - public function tearDown() - { - parent::tearDown(); - $phpbb_extension_manager = $this->get_ext_manager(); - - $phpbb_extension_manager->purge('foobar'); - $phpbb_extension_manager->purge('foo_bar'); - $phpbb_extension_manager->purge('error_class'); - $phpbb_extension_manager->purge('error_classtype'); - } - /** * Check an extension at ./ext/foobar/ which should have the class * phpbb_ext_foobar_controller */ public function test_foobar() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('foobar'); $crawler = $this->request('GET', 'index.php?ext=foobar'); - $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) + { + $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); + } + $phpbb_extension_manager->purge('foobar'); } /** @@ -114,8 +98,14 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_foo_bar() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('foo/bar'); $crawler = $this->request('GET', 'index.php?ext=foo/bar'); - $this->assertGreaterThan(0, $crawler->filter('#welcome')->count()); + if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) + { + $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); + } + $phpbb_extension_manager->purge('foo_bar'); } /** @@ -124,8 +114,11 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_name() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('error/class'); $crawler = $this->request('GET', 'index.php?ext=error/class'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_class is missing a controller class and cannot be accessed through the front-end.")')->count()); + $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); + $phpbb_extension_manager->purge('error_class'); } /** @@ -134,8 +127,11 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_type() { + $phpbb_extension_manager = $this->get_ext_manager(); + $phpbb_extension_manager->enable('error/classtype'); $crawler = $this->request('GET', 'index.php?ext=error/classtype'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.")')->count()); + $this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text()); + $phpbb_extension_manager->purge('error_classtype'); } /** @@ -145,7 +141,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function test_error_ext_disabled() { $crawler = $this->request('GET', 'index.php?ext=error/disabled'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_classtype is not enabled.")')->count()); + $this->assertContains("The extension error/disabled is not enabled", $crawler->filter('#message')->text()); } /** @@ -155,6 +151,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function test_error_ext_missing() { $crawler = $this->request('GET', 'index.php?ext=error/404'); - $this->assertGreaterThan(0, $crawler->filter('html:contains("The extension error_404 does not exist.")')->count()); + $this->assertContains("The extension error/404 does not exist.", $crawler->filter('#message')->text()); } } diff --git a/tests/functional/fixtures/ext/foo/bar/controller.php b/tests/functional/fixtures/ext/foo/bar/controller.php index 93d1f099c9..24d218c412 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller.php @@ -8,7 +8,7 @@ class phpbb_ext_foo_bar_controller implements phpbb_extension_controller_interfa $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); $template->set_filenames(array( - 'body' => 'index_body.html' + 'body' => 'foobar_body.html' )); page_header('Test extension'); diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html similarity index 100% rename from tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/index_body.html rename to tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar_body.html diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php index c3ef29ffef..bf8d8139ae 100644 --- a/tests/functional/fixtures/ext/foobar/controller.php +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -8,7 +8,7 @@ class phpbb_ext_foobar_controller implements phpbb_extension_controller_interfac $template->set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); $template->set_filenames(array( - 'body' => 'index_body.html' + 'body' => 'foobar_body.html' )); page_header('Test extension'); diff --git a/tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html b/tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html similarity index 100% rename from tests/functional/fixtures/ext/foobar/styles/prosilver/template/index_body.html rename to tests/functional/fixtures/ext/foobar/styles/prosilver/template/foobar_body.html From 7d1e4bca334dc9fcef3eb6e62cb412226ebc7ca4 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 18 Mar 2012 14:44:37 -0400 Subject: [PATCH 38/65] [ticket/10586] more work on getting tests to pass PHPBB3-10586 --- tests/functional/extension_controller_test.php | 16 +++++----------- .../phpbb_functional_test_case.php | 2 +- tests/test_framework/phpbb_test_case_helpers.php | 8 +++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index cb27511be1..46f3dc6f96 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -85,10 +85,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foobar'); $crawler = $this->request('GET', 'index.php?ext=foobar'); - if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) - { - $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); - } + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); $phpbb_extension_manager->purge('foobar'); } @@ -101,11 +98,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager = $this->get_ext_manager(); $phpbb_extension_manager->enable('foo/bar'); $crawler = $this->request('GET', 'index.php?ext=foo/bar'); - if($this->assertGreaterThan(0, $crawler->filter('#welcome')->count())) - { - $this->assertContains("This is for testing purposes.", $crawler->filter('#welcome')->text()); - } - $phpbb_extension_manager->purge('foo_bar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $phpbb_extension_manager->purge('foo/bar'); } /** @@ -118,7 +112,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager->enable('error/class'); $crawler = $this->request('GET', 'index.php?ext=error/class'); $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); - $phpbb_extension_manager->purge('error_class'); + $phpbb_extension_manager->purge('error/class'); } /** @@ -131,7 +125,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $phpbb_extension_manager->enable('error/classtype'); $crawler = $this->request('GET', 'index.php?ext=error/classtype'); $this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text()); - $phpbb_extension_manager->purge('error_classtype'); + $phpbb_extension_manager->purge('error/classtype'); } /** diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 9797ecfef8..b3376891bc 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -89,7 +89,7 @@ class phpbb_functional_test_case extends phpbb_test_case { global $phpbb_root_path, $phpEx; - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_null); + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_file); } protected function install_board() diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 51b04db263..4aec07a8fb 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -81,7 +81,7 @@ class phpbb_test_case_helpers $config['phpbb_functional_url'] = $phpbb_functional_url; } - if (isset($phpbb_functional_path)) + if (!empty($phpbb_functional_path)) { $config['phpbb_functional_path'] = $phpbb_functional_path; } @@ -106,11 +106,9 @@ class phpbb_test_case_helpers )); } - if (isset($_SERVER['PHPBB_FUNCTIONAL_PATH'])) + if (!empty($_SERVER['PHPBB_FUNCTIONAL_PATH'])) { - $config = array_merge($config, array( - 'phpbb_functional_path' => isset($_SERVER['PHPBB_FUNCTIONAL_PATH']) ? $_SERVER['PHPBB_FUNCTIONAL_PATH'] : '', - )); + $config['phpbb_functional_path'] = $_SERVER['PHPBB_FUNCTIONAL_PATH']; } return $config; From 76e61951942048e3e98dbe60a3683d5269a4fa0e Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 18 Mar 2012 16:50:41 -0400 Subject: [PATCH 39/65] [ticket/10586] trying to get tests to work PHPBB3-10586 --- .../functional/extension_controller_test.php | 28 +++++++++++-------- .../phpbb_functional_test_case.php | 5 ++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 46f3dc6f96..4123853151 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -12,6 +12,7 @@ */ class phpbb_functional_extension_controller_test extends phpbb_functional_test_case { + protected $phpbb_extension_manager; /** * This should only be called once before the tests are run. * This is used to copy the fixtures to the phpBB install @@ -76,17 +77,23 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c // and port it into here instead of writing it from scratch } + public function setUp() + { + parent::setUp(); + $this->phpbb_extension_manager = !($this->phpbb_extension_manager instanceof phpbb_extension_manager) ? $this->get_ext_manager() : $this->phpbb_extension_manager; + $this->cache->purge('_ext'); + } + /** * Check an extension at ./ext/foobar/ which should have the class * phpbb_ext_foobar_controller */ public function test_foobar() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('foobar'); + $this->phpbb_extension_manager->enable('foobar'); $crawler = $this->request('GET', 'index.php?ext=foobar'); $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); - $phpbb_extension_manager->purge('foobar'); + $this->phpbb_extension_manager->purge('foobar'); } /** @@ -95,11 +102,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_foo_bar() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('foo/bar'); + $this->phpbb_extension_manager->enable('foo/bar'); $crawler = $this->request('GET', 'index.php?ext=foo/bar'); $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); - $phpbb_extension_manager->purge('foo/bar'); + $this->phpbb_extension_manager->purge('foo/bar'); } /** @@ -108,11 +114,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_name() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('error/class'); + $this->phpbb_extension_manager->enable('error/class'); $crawler = $this->request('GET', 'index.php?ext=error/class'); $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); - $phpbb_extension_manager->purge('error/class'); + $this->phpbb_extension_manager->purge('error/class'); } /** @@ -121,11 +126,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ public function test_error_class_type() { - $phpbb_extension_manager = $this->get_ext_manager(); - $phpbb_extension_manager->enable('error/classtype'); + $this->phpbb_extension_manager->enable('error/classtype'); $crawler = $this->request('GET', 'index.php?ext=error/classtype'); $this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text()); - $phpbb_extension_manager->purge('error/classtype'); + $this->phpbb_extension_manager->purge('error/classtype'); } /** diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b3376891bc..d569556d02 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,7 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $cache = null; protected $db = null; static protected $config = array(); @@ -88,8 +89,8 @@ class phpbb_functional_test_case extends phpbb_test_case protected function get_ext_manager() { global $phpbb_root_path, $phpEx; - - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", new phpbb_cache_driver_file); + $this->cache = ($this->cache instanceof phpbb_cache_driver_null) ? $this->cache : new phpbb_cache_driver_null; + return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache); } protected function install_board() From 1bbb32a5cffeff4875c4ed0566999cbee8919c86 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 18 Mar 2012 22:57:37 +0100 Subject: [PATCH 40/65] [ticket/10586] Correctly purge board cache and don't rename install directory PHPBB3-10586 --- tests/functional/browse_test.php | 11 ------ .../functional/extension_controller_test.php | 8 ++-- tests/functional/fixtures/ext/foobar/ext.php | 4 +- .../phpbb_functional_test_case.php | 37 +++++++++++++++++-- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index d119787d13..723cf93232 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -12,17 +12,6 @@ */ class phpbb_functional_browse_test extends phpbb_functional_test_case { - public static function setUpBeforeClass() - { - parent::setUpBeforeClass(); - $f_path = self::$config['phpbb_functional_path']; - // we cannot run these tests correctly if the install directory is present - if (is_dir($f_path . 'install/')) - { - rename($f_path . 'install/', $f_path . 'install_/'); - } - // NOTE: this will need to be renamed back again later if you wish to test again - } public function test_index() { $crawler = $this->request('GET', 'index.php'); diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 4123853151..dd8aa1181b 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -69,8 +69,6 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public static function tearDownAfterClass() { $f_path = self::$config['phpbb_functional_path']; - // first we rename the install_ directory back to install - rename($f_path . 'install_/', $f_path . 'install/'); // @todo delete the fixtures from the $f_path board // Note that it might be best to find a public domain function @@ -80,8 +78,10 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public function setUp() { parent::setUp(); - $this->phpbb_extension_manager = !($this->phpbb_extension_manager instanceof phpbb_extension_manager) ? $this->get_ext_manager() : $this->phpbb_extension_manager; - $this->cache->purge('_ext'); + + $this->phpbb_extension_manager = $this->get_extension_manager(); + + $this->purge_cache(); } /** diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php index 7b3f37cbfb..7cf443d369 100644 --- a/tests/functional/fixtures/ext/foobar/ext.php +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -1,6 +1,6 @@ db; } - protected function get_ext_manager() + protected function get_cache_driver() + { + if (!$this->cache) + { + $this->cache = new phpbb_cache_driver_file; + } + + return $this->cache; + } + + protected function purge_cache() + { + $cache = $this->get_cache_driver(); + + $cache->purge(); + $cache->unload(); + $cache->load(); + } + + protected function get_extension_manager() { global $phpbb_root_path, $phpEx; - $this->cache = ($this->cache instanceof phpbb_cache_driver_null) ? $this->cache : new phpbb_cache_driver_null; - return new phpbb_extension_manager($this->get_db(), self::$config['table_prefix'] . 'ext', $phpbb_root_path, ".$phpEx", $this->cache); + + if (!$this->extension_manager) + { + $this->extension_manager = new phpbb_extension_manager( + $this->get_db(), + self::$config['table_prefix'] . 'ext', + $phpbb_root_path, + ".$phpEx", + $this->get_cache_driver() + ); + } + + return $this->extension_manager; } protected function install_board() From 6a0bad8c0b7bdb261c0ee72b850bc727de6d019b Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 19 Mar 2012 09:56:48 -0400 Subject: [PATCH 41/65] [ticket/10586] Tests finally work (thanks naderman) PHPBB3-10586 --- .../functional/extension_controller_test.php | 25 +++++++++---------- .../phpbb_test_case_helpers.php | 10 -------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index dd8aa1181b..263d48c034 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,20 +19,20 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c */ static public function setUpBeforeClass() { + global $phpbb_root_path; parent::setUpBeforeClass(); - $f_path = self::$config['phpbb_functional_path']; // these directories need to be created before the files can be copied $directories = array( - $f_path . 'ext/error/class/', - $f_path . 'ext/error/classtype/', - $f_path . 'ext/error/disabled/', - $f_path . 'ext/foo/bar/', - $f_path . 'ext/foo/bar/styles/prosilver/template/', - $f_path . 'ext/foobar/', - $f_path . 'ext/foobar/styles/prosilver/template/', + $phpbb_root_path . 'ext/error/class/', + $phpbb_root_path . 'ext/error/classtype/', + $phpbb_root_path . 'ext/error/disabled/', + $phpbb_root_path . 'ext/foo/bar/', + $phpbb_root_path . 'ext/foo/bar/styles/prosilver/template/', + $phpbb_root_path . 'ext/foobar/', + $phpbb_root_path . 'ext/foobar/styles/prosilver/template/', ); - // When you add new tests that require new fixtures, add them to the array. + foreach ($directories as $dir) { if (!is_dir($dir)) @@ -58,8 +58,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c foreach ($fixtures as $fixture) { - // we have to use self::$config['phpbb_functional_url'] because $this->root_url is not available in static classes - if(!copy("tests/functional/fixtures/ext/$fixture", "{$f_path}ext/$fixture")) + if(!copy("tests/functional/fixtures/ext/$fixture", "{$phpbb_root_path}ext/$fixture")) { echo 'Could not copy file ' . $fixture; } @@ -68,9 +67,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c public static function tearDownAfterClass() { - $f_path = self::$config['phpbb_functional_path']; + $phpbb_root_path = self::$config['phpbb_functional_path']; - // @todo delete the fixtures from the $f_path board + // @todo delete the fixtures from the $phpbb_root_path board // Note that it might be best to find a public domain function // and port it into here instead of writing it from scratch } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 4aec07a8fb..9c91778cb0 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -80,11 +80,6 @@ class phpbb_test_case_helpers { $config['phpbb_functional_url'] = $phpbb_functional_url; } - - if (!empty($phpbb_functional_path)) - { - $config['phpbb_functional_path'] = $phpbb_functional_path; - } } if (isset($_SERVER['PHPBB_TEST_DBMS'])) @@ -106,11 +101,6 @@ class phpbb_test_case_helpers )); } - if (!empty($_SERVER['PHPBB_FUNCTIONAL_PATH'])) - { - $config['phpbb_functional_path'] = $_SERVER['PHPBB_FUNCTIONAL_PATH']; - } - return $config; } } From 70d88965c795a5e392605fe556df580773a505c3 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Mon, 19 Mar 2012 23:19:21 -0400 Subject: [PATCH 42/65] [ticket/10708] Check converted passwords for multi-byte characters Check for multi-byte characters in converted passwords. PHPBB3-10708 --- phpBB/includes/auth/auth_db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index c20196d019..1c6cdf7832 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -163,7 +163,7 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; $password_new_format = ''; - set_var($password_new_format, stripslashes($password_old_format), 'string'); + set_var($password_new_format, stripslashes($password_old_format), 'string', true); if ($password == $password_new_format) { From 2005c339ff26bf189fb818f0e25d6c0954b9702a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Mar 2012 17:45:08 +0100 Subject: [PATCH 43/65] =?UTF-8?q?[ticket/10717]=20Fix=20profile=20field=20?= =?UTF-8?q?sample=20in=20prosilver=C2=B4s=20memberlist=5Fview.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHPBB3-10717 --- phpBB/styles/prosilver/template/memberlist_view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index cfec07cff0..2758a7e6cc 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -69,7 +69,7 @@
{L_JABBER}:
{L_SEND_JABBER_MESSAGE}
{L_JABBER}:
{USER_JABBER}
-
{postrow.PROFILE_FIELD1_NAME}:
{postrow.PROFILE_FIELD1_VALUE}
+
{PROFILE_FIELD1_NAME}:
{PROFILE_FIELD1_VALUE}
From 92f771eb82b64bb35e0cd42534ddd0306a6aef68 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Thu, 22 Mar 2012 03:10:14 +0530 Subject: [PATCH 44/65] [ticket/10704] minor typo in a comment Make sure $id separation is working fine PHPBB3-10704 --- 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 db7defdc48..ae4f0f238e 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -362,7 +362,7 @@ class p_master $module_auth = implode(' ', $tokens); - // Make sure $id seperation is working fine + // Make sure $id separation is working fine $module_auth = str_replace(' , ', ',', $module_auth); $forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id; From 4dafcc2525fa72f2bd91760fae49e51ff9d1a0ef Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Wed, 21 Mar 2012 22:57:29 +0000 Subject: [PATCH 45/65] [task/travis] Adding Travis Continuous Intergration Support PHPBB3-10718 --- .travis.yml | 33 +++++++++++++++++++++++++++++++++ travis/mysql.travis.xml | 28 ++++++++++++++++++++++++++++ travis/postgres.travis.xml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .travis.yml create mode 100644 travis/mysql.travis.xml create mode 100644 travis/postgres.travis.xml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..e091954e0e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: php +php: + - 5.2 + - 5.3 + - 5.4 + +env: + - DB=mysql + - DB=postgres + +before_script: + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3' ]; then pyrus install --force phpunit/DbUnit; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ]; then pyrus install --force phpunit/DbUnit; fi" + - phpenv rehash + +script: + - phpunit --configuration travis/$DB.travis.xml + +notifications: + email: + recipients: + - m@michaelcullum.com + on_success: never + on_failure: always + +branches: + only: + develop + task/travis diff --git a/travis/mysql.travis.xml b/travis/mysql.travis.xml new file mode 100644 index 0000000000..a849f50136 --- /dev/null +++ b/travis/mysql.travis.xml @@ -0,0 +1,28 @@ + + + + + ../tests/ + + + + + + + + + + + + + diff --git a/travis/postgres.travis.xml b/travis/postgres.travis.xml new file mode 100644 index 0000000000..e44696a335 --- /dev/null +++ b/travis/postgres.travis.xml @@ -0,0 +1,30 @@ + + + + + ../tests/ + + + + + + + + + + + + + + + From 9120c7691e28ca298eb83ebbe12a82c2723cfeee Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Wed, 21 Mar 2012 23:25:50 +0000 Subject: [PATCH 46/65] [task/travis] Removing development information PHPBB3-10718 --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e091954e0e..8e870ca9c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,11 +23,12 @@ script: notifications: email: recipients: - - m@michaelcullum.com + - dev-team@phpbb.com on_success: never - on_failure: always + on_failure: change branches: only: develop + develop-olympus task/travis From 4325bbf4c601332614f456df969983d85829e931 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Wed, 21 Mar 2012 23:30:56 +0000 Subject: [PATCH 47/65] [task/travis] Add automated testing to readme PHPBB3-10718 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6b94f898a3..f7dfc4926e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the dev 3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git) 4. Send us a pull request +## AUTOMATED TESTING + +We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis build below. +Develop - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop)](http://travis-ci.org/phpbb/phpbb3) +Develop-Olympus - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop-olympus)](http://travis-ci.org/phpbb/phpbb3) + ## LICENSE [GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php) From 5a9dd1994fc20aaebe3145540b630826d7333998 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 22 Mar 2012 21:19:01 +0800 Subject: [PATCH 48/65] [ticket/10684] Adjust function and parameter name, minor changes. PHPBB3-10684 --- phpBB/includes/functions_posting.php | 4 ++-- phpBB/includes/functions_privmsgs.php | 4 ++-- phpBB/includes/functions_user.php | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 073ce1ff4e..7f45b2da8c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1181,11 +1181,11 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id $topic_title = censor_text($topic_title); // Exclude guests, current user and banned users from notifications - if (!function_exists('phpbb_get_banned_users_ids')) + if (!function_exists('phpbb_get_banned_user_ids')) { include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - $sql_ignore_users = phpbb_get_banned_users_ids(); + $sql_ignore_users = phpbb_get_banned_user_ids(); $sql_ignore_users[ANONYMOUS] = ANONYMOUS; $sql_ignore_users[$user->data['user_id']] = $user->data['user_id']; diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 4ea8f74153..447920cfd5 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1630,11 +1630,11 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i return; } - if (!function_exists('phpbb_get_banned_users_ids')) + if (!function_exists('phpbb_get_banned_user_ids')) { include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - $banned_users = phpbb_get_banned_users_ids(array_keys($recipients)); + $banned_users = phpbb_get_banned_user_ids(array_keys($recipients)); $recipients = array_diff(array_keys($recipients), $banned_users); if (!sizeof($recipients)) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8c42a5bb42..10fb57ea97 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3588,24 +3588,24 @@ function remove_newly_registered($user_id, $user_data = false) } /** -* Get a list of banned users' ids, ignoring stale bans which were not cleaned yet. +* Gets user ids of currently banned registered users. * -* @param array $users_ids Array of users' ids to check for banning, +* @param array $user_ids Array of users' ids to check for banning, * leave empty to get complete list of banned ids * @return array Array of banned users' ids if any, empty array otherwise */ -function phpbb_get_banned_users_ids($users_ids = array()) +function phpbb_get_banned_user_ids($user_ids = array()) { global $db; - $sql_users_ids = (!empty($users_ids)) ? $db->sql_in_set('ban_userid', $users_ids) : 'ban_userid <> 0'; + $sql_user_ids = (!empty($user_ids)) ? $db->sql_in_set('ban_userid', $user_ids) : 'ban_userid <> 0'; // Get banned User ID's // Ignore stale bans which were not wiped yet $banned_ids_list = array(); $sql = 'SELECT ban_userid FROM ' . BANLIST_TABLE . " - WHERE $sql_users_ids + WHERE $sql_user_ids AND ban_exclude <> 1 AND (ban_end > " . time() . ' OR ban_end = 0)'; From d1980f6ad616e800ff82299ceafc5c8c763c6570 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 13:32:58 +0000 Subject: [PATCH 49/65] [task/travis] Fixing some travis issues PHPBB3-10718 --- .travis.yml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e870ca9c2..bf97a20850 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ notifications: email: recipients: - dev-team@phpbb.com - on_success: never + on_success: change on_failure: change branches: diff --git a/README.md b/README.md index f7dfc4926e..51e65176c6 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the dev ## AUTOMATED TESTING We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis build below. -Develop - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop)](http://travis-ci.org/phpbb/phpbb3) -Develop-Olympus - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop-olympus)](http://travis-ci.org/phpbb/phpbb3) +develop - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop)](http://travis-ci.org/phpbb/phpbb3) +develop-olympus - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop-olympus)](http://travis-ci.org/phpbb/phpbb3) ## LICENSE From c7f65fba627680e7de81ae6c7ea9c1e0fc4359ea Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 14:13:25 +0000 Subject: [PATCH 50/65] [task/travis] Rename travis phpunit config files PHPBB3-10718 --- .travis.yml | 2 +- travis/{mysql.travis.xml => phpunit-mysql-travis.xml} | 0 travis/{postgres.travis.xml => phpunit-postgres-travis.xml} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename travis/{mysql.travis.xml => phpunit-mysql-travis.xml} (100%) rename travis/{postgres.travis.xml => phpunit-postgres-travis.xml} (100%) diff --git a/.travis.yml b/.travis.yml index bf97a20850..d638e1cccd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: - phpenv rehash script: - - phpunit --configuration travis/$DB.travis.xml + - phpunit --configuration travis/phpunit-$DB-travis.xml notifications: email: diff --git a/travis/mysql.travis.xml b/travis/phpunit-mysql-travis.xml similarity index 100% rename from travis/mysql.travis.xml rename to travis/phpunit-mysql-travis.xml diff --git a/travis/postgres.travis.xml b/travis/phpunit-postgres-travis.xml similarity index 100% rename from travis/postgres.travis.xml rename to travis/phpunit-postgres-travis.xml From 115ee7f3b815567cf598178225022b2d7d7f5310 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 14:44:36 +0000 Subject: [PATCH 51/65] [task/travis] Some more small travis fixes PHPBB3-10718 --- .travis.yml | 6 ------ travis/phpunit-mysql-travis.xml | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index d638e1cccd..78221d588c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,9 +26,3 @@ notifications: - dev-team@phpbb.com on_success: change on_failure: change - -branches: - only: - develop - develop-olympus - task/travis diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml index a849f50136..807dfbcdaa 100644 --- a/travis/phpunit-mysql-travis.xml +++ b/travis/phpunit-mysql-travis.xml @@ -8,7 +8,7 @@ processIsolation="false" stopOnFailure="false" syntaxCheck="true" - strict="true" + strict="true" bootstrap="../tests/bootstrap.php"> From 4000d8051d4e7c07338d48023c4f4c82610a2ddb Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Wed, 21 Mar 2012 23:33:13 +0000 Subject: [PATCH 52/65] [task/travis] Dropping support for 5.2 in develop branch PHPBB3-10718 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 78221d588c..e2cb463911 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - 5.2 - 5.3 - 5.4 From e034eb96b777978c4b32dad89b46a7fc6e85f52e Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 14:56:55 +0000 Subject: [PATCH 53/65] [task/travis-develop2] Update version from 5.3 to 5.3.2 PHPBB3-10718 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2cb463911..8c07f48372 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 5.3 + - 5.3.2 - 5.4 env: From 0172ced4e202e5d8dfb0086a0370007113f39c5b Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 00:06:46 +0000 Subject: [PATCH 54/65] [ticket/10719] Revert "Skip functional tests on PHP 5.2" This reverts commit 9c861a0350ae67f06a38ee6efc890412a32751f4. PHPBB3-10719 --- phpunit.xml.all | 4 ---- phpunit.xml.dist | 4 ---- phpunit.xml.functional | 4 ---- tests/bootstrap.php | 6 +----- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/phpunit.xml.all b/phpunit.xml.all index b835a38c20..fde3bbb1a7 100644 --- a/phpunit.xml.all +++ b/phpunit.xml.all @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/phpunit.xml.dist b/phpunit.xml.dist index da31dce5e3..27dee48aac 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/phpunit.xml.functional b/phpunit.xml.functional index 91d569e65b..9facbcff8b 100644 --- a/phpunit.xml.functional +++ b/phpunit.xml.functional @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 302701e3b3..f103d8f15a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -25,8 +25,4 @@ require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; - -if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) -{ - require_once 'test_framework/phpbb_functional_test_case.php'; -} +require_once 'test_framework/phpbb_functional_test_case.php'; From 0ed66ad0e8d11c802520046b446aa5622a637df9 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 16:00:10 +0000 Subject: [PATCH 55/65] [task/travis] Exclude functional and slow tests PHPBB3-10718 --- travis/phpunit-mysql-travis.xml | 6 ++++++ travis/phpunit-postgres-travis.xml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml index 807dfbcdaa..79215c8de1 100644 --- a/travis/phpunit-mysql-travis.xml +++ b/travis/phpunit-mysql-travis.xml @@ -16,6 +16,12 @@ + + + slow + + + diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index e44696a335..02db76ae78 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -16,6 +16,12 @@ + + + slow + + + From 841d11c6cd90d331c2923ba7851dd5f813203ddf Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 22 Mar 2012 16:09:58 +0000 Subject: [PATCH 56/65] [task/travis] Refactor php version check for dbunit install PHPBB3-10718 --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78221d588c..d73bbd2a48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,7 @@ before_script: - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3' ]; then pyrus install --force phpunit/DbUnit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ]; then pyrus install --force phpunit/DbUnit; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; else pyrus install --force phpunit/DbUnit; fi" - phpenv rehash script: From 18c541dfee6ec7db0e04c939bc103cefe9dab9d7 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 23 Mar 2012 00:27:29 +0530 Subject: [PATCH 57/65] [ticket/10703] Added a condition to check if ext directory exists The existence of ext directory is checked, if not present a proper error message that file doesn't exist is printed out. No Fatal Error messages. PHPBB3-10703 --- phpBB/develop/extensions.php | 8 +++++++- phpBB/includes/extension/manager.php | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/extensions.php b/phpBB/develop/extensions.php index 2f7c3d1167..43621f3080 100644 --- a/phpBB/develop/extensions.php +++ b/phpBB/develop/extensions.php @@ -37,6 +37,13 @@ function list_extensions() global $phpbb_extension_manager; $phpbb_extension_manager->load_extensions(); + $all = array_keys($phpbb_extension_manager->all_available()); + + if (empty($all)) + { + echo "There were no extensions found.\n"; + exit(3); + } echo "Enabled:\n"; $enabled = array_keys($phpbb_extension_manager->all_enabled()); @@ -49,7 +56,6 @@ function list_extensions() echo "\n"; echo "Available:\n"; - $all = array_keys($phpbb_extension_manager->all_available()); $purged = array_diff($all, $enabled, $disabled); print_extensions($purged); } diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index c38f0df32e..dac0e5f947 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -352,6 +352,10 @@ class phpbb_extension_manager public function all_available() { $available = array(); + if (!is_dir($this->phpbb_root_path . 'ext/')) + { + return $available; + } $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'), From 5bcdfe94dd487441565c00450b3a8efcaeecd840 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 23 Mar 2012 06:40:15 +0000 Subject: [PATCH 58/65] [ticket/10723] Stop Travis running all tests on sqlite Correct information so all tests don't run on sqlite PHPBB3-10723 --- travis/phpunit-mysql-travis.xml | 14 +++++++------- travis/phpunit-postgres-travis.xml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml index 79215c8de1..36845a7f71 100644 --- a/travis/phpunit-mysql-travis.xml +++ b/travis/phpunit-mysql-travis.xml @@ -23,12 +23,12 @@ - - - - - - - + + + + + + + diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 02db76ae78..461a53bcb1 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -25,12 +25,12 @@ - - - - - - - + + + + + + + From 75e731e14b219d5b926755e01b957a5640f26ac8 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 8 Mar 2012 17:31:19 -0500 Subject: [PATCH 59/65] [task/php5.3] Changed minimum PHP requirement for Ascraeus to 5.3.2 PHPBB3-10693 --- phpBB/install/install_install.php | 2 +- phpBB/language/en/install.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4663b5204e..361376763d 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -140,7 +140,7 @@ class install_install extends module // Test the minimum PHP version $php_version = PHP_VERSION; - if (version_compare($php_version, '5.2.0') < 0) + if (version_compare($php_version, '5.3.2') < 0) { $result = '' . $lang['NO'] . ''; } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 254db4a5c1..ca6045a921 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -300,10 +300,10 @@ $lang = array_merge($lang, array( 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', 'PHP_SAFE_MODE' => 'Safe mode', 'PHP_SETTINGS' => 'PHP version and settings', - 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.2.0 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', + 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.2 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting allow_url_fopen is enabled', 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', - 'PHP_VERSION_REQD' => 'PHP version >= 5.2.0', + 'PHP_VERSION_REQD' => 'PHP version >= 5.3.2', 'POST_ID' => 'Post ID', 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', From 063f6893af754cc992e487d323f766889bebba01 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 8 Mar 2012 18:04:24 -0500 Subject: [PATCH 60/65] [task/php5.3] Looks like I missed a few places that needed PHP 5.2 changed to PHP 5.3.2 PHPBB3-10693 --- phpBB/common.php | 2 +- phpBB/docs/INSTALL.html | 2 +- phpBB/docs/README.html | 2 +- phpBB/docs/coding-guidelines.html | 6 +++--- phpBB/install/index.php | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index b308037a0e..8e149fef57 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -5,7 +5,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * -* Minimum Requirement: PHP 5.2.0 +* Minimum Requirement: PHP 5.3.2 */ /** diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 9b27ac06bc..e3d56baa36 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -138,7 +138,7 @@
  • Oracle
  • -
  • PHP 5.2.0+ with support for the database you intend to use.
  • +
  • PHP 5.3.2+ with support for the database you intend to use.
  • getimagesize() function need to be enabled.
  • These optional presence of the following modules within PHP will provide access to additional features, but they are not required.
      diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 592d2be76e..952f312652 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -306,7 +306,7 @@
      -

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

      +

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

      Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.

      diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 55fbf6d4e8..5581c10786 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2347,7 +2347,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version < 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version < 5.3.2.<br />
       	Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      @@ -2356,7 +2356,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version &lt; 5.3.2.<br />
       	Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      @@ -2365,7 +2365,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
       	...
      -'FOO_BAR'	=>	'PHP version &lt; 5.2.0.<br />
      +'FOO_BAR'	=>	'PHP version &lt; 5.3.2.<br />
       	Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.',
       	...
       	
      diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 9d003ba6ab..f180511e46 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -17,9 +17,9 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (version_compare(PHP_VERSION, '5.2.0') < 0) +if (version_compare(PHP_VERSION, '5.3.2') < 0) { - die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install phpBB 3.1'); + die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.2 or higher before trying to install phpBB 3.1'); } function phpbb_require_updated($path, $optional = false) From 9bcf53057eafbe481deda2b8e02f876f58b4176d Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 26 Mar 2012 17:56:10 -0400 Subject: [PATCH 61/65] [task/php5.3] Updated range of tested PHP versions PHPBB3-10693 --- phpBB/docs/README.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 952f312652..ccd368fbde 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -310,7 +310,7 @@

      Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.

      -

      This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 7.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 5.2.0 to 5.3.x without problem.

      +

      This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 7.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 5.3.2 to 5.4.x without problem.

      7.i. Notice on PHP security issues

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

      {postrow.POST_SUBJECT}

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