aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_attachments.html2
-rw-r--r--phpBB/adm/style/acp_inactive.html4
-rw-r--r--phpBB/adm/style/acp_logs.html3
-rw-r--r--phpBB/adm/style/acp_main.html4
-rw-r--r--phpBB/adm/style/admin.css66
-rw-r--r--phpBB/assets/javascript/core.js155
-rw-r--r--phpBB/config/parameters.yml1
-rw-r--r--phpBB/config/services.yml4
-rw-r--r--phpBB/feed.php2
-rw-r--r--phpBB/includes/functions.php12
-rw-r--r--phpBB/includes/functions_acp.php2
-rw-r--r--phpBB/includes/functions_download.php10
-rw-r--r--phpBB/includes/functions_posting.php8
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php3
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php10
-rw-r--r--phpBB/install/database_update.php14
-rw-r--r--phpBB/install/index.php2
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php9
-rw-r--r--phpBB/phpbb/controller/helper.php49
-rw-r--r--phpBB/phpbb/extension/base.php21
-rw-r--r--phpBB/posting.php10
-rw-r--r--phpBB/styles/prosilver/template/ajax.js8
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/styles/prosilver/template/pagination.html2
-rw-r--r--phpBB/styles/prosilver/theme/tweaks.css79
-rw-r--r--tests/bootstrap.php1
-rw-r--r--tests/controller/helper_route_test.php280
-rw-r--r--tests/extension/ext/vendor2/bar/migration/migration.php18
-rw-r--r--tests/extension/ext/vendor2/bar/migrations/migration.php18
-rw-r--r--tests/extension/ext/vendor2/foo/migrations/migration.php18
-rw-r--r--tests/extension/ext/vendor3/bar/migration/migration.php18
-rw-r--r--tests/extension/extension_base_test.php85
-rw-r--r--tests/mock/controller_helper.php4
-rw-r--r--tests/mock/extension_manager.php3
-rw-r--r--tests/mock/migrator.php55
-rw-r--r--tests/pagination/pagination_test.php59
38 files changed, 746 insertions, 299 deletions
diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html
index 59b10f597e..da8a0096ea 100644
--- a/phpBB/adm/style/acp_attachments.html
+++ b/phpBB/adm/style/acp_attachments.html
@@ -284,8 +284,6 @@
</fieldset>
</form>
- <br />
-
<form id="change_ext" method="post" action="{U_ACTION}">
<fieldset class="tabulated">
diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html
index 1cdc1abe6b..409ea46de5 100644
--- a/phpBB/adm/style/acp_inactive.html
+++ b/phpBB/adm/style/acp_inactive.html
@@ -2,14 +2,12 @@
<a id="maincontent"></a>
-<h2>{L_INACTIVE_USERS}</h2>
+<h1>{L_INACTIVE_USERS}</h1>
<p>{L_INACTIVE_USERS_EXPLAIN}</p>
<form id="inactive" method="post" action="{U_ACTION}">
-<div class="clearfix"></div>
-
<!-- IF .pagination -->
<div class="pagination">
<!-- INCLUDE pagination.html -->
diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html
index ec2065f906..4f67f46e24 100644
--- a/phpBB/adm/style/acp_logs.html
+++ b/phpBB/adm/style/acp_logs.html
@@ -18,9 +18,6 @@
</div>
<!-- ENDIF -->
-<div class="clearfix">&nbsp;</div>
-<div><br style="clear: both;" /></div>
-
<!-- IF .log -->
<table class="table1 zebra-table fixed-width-table">
<thead>
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index 9a9b3ff2b9..065dd7ac4f 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -243,9 +243,6 @@
<!-- END log -->
</tbody>
</table>
-
- <br />
-
<!-- ENDIF -->
<!-- IF S_INACTIVE_USERS -->
@@ -287,7 +284,6 @@
<!-- END inactive -->
</tbody>
</table>
-
<!-- ENDIF -->
<!-- ENDIF -->
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index b8f55e66c5..b83750875a 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -154,6 +154,10 @@ a:active {
font-weight: bold;
}
+a#maincontent, a#acl, a#assigned_to {
+ display: block;
+}
+
/* List items */
ul, ol {
list-style-position: inside;
@@ -174,7 +178,6 @@ li {
}
#page-header {
- clear: both;
text-align: right;
background: url("../images/phpbb_logo.png") top left no-repeat;
height: 54px;
@@ -203,14 +206,9 @@ li {
}
#page-body {
- clear: both;
min-width: 650px;
}
-#page-footer {
- clear: both;
-}
-
.copyright {
font-size: 0.75em;
text-align: center;
@@ -335,12 +333,6 @@ li {
padding: 0;
}
-#tabs > ul:after {
- content: '';
- display: block;
- clear: both;
-}
-
#tabs .tab {
display: inline-block;
float: left;
@@ -475,7 +467,6 @@ li {
/* Main Panel
---------------------------------------- */
#acp {
- clear: both;
position: relative;
top: -2px;
margin: 0 0 2px;
@@ -723,6 +714,7 @@ td {
.table1 {
border-collapse: separate;
border-spacing: 1px;
+ clear: both;
}
dt#color_palette_placeholder table {
@@ -862,10 +854,10 @@ table.zebra-table tbody tr:nth-child(even) {
}
/* Deactivated row */
-.row-inactive {
- color: #999;
+.row-inactive {
+ color: #999;
}
-.row-inactive a, .row-inactive strong {
+.row-inactive a, .row-inactive strong {
color: #888;
}
.row-inactive a:hover {
@@ -1132,6 +1124,11 @@ input.langvalue, textarea.langvalue {
width: 90%;
}
+input[type="number"] {
+ width: 60px;
+ -moz-padding-end: 0;
+}
+
optgroup, select {
background-color: #FAFAFA;
border: 1px solid #666666;
@@ -1226,8 +1223,8 @@ fieldset.quick legend {
fieldset.tabulated {
background: none;
margin: 0;
+ margin-top: 5px;
padding: 0;
- padding-top: 5px;
border: 0;
}
@@ -1464,7 +1461,7 @@ input:focus, textarea:focus {
{
select, dd select, dd input {
max-width: 240px;
- }
+ }
}
/* Submit button fieldset or paragraph
@@ -1676,12 +1673,12 @@ input.button1:focus, input.button2:focus {
height: 1%; /* IE tweak (holly hack) */
width: auto;
text-align: right;
- margin-top: 5px;
+ margin: 5px 0;
}
.top-pagination {
float: right;
- margin: 15px 0 2px 0;
+ margin: 15px 0 5px 0;
}
.rtl .pagination {
@@ -1877,17 +1874,7 @@ li.pagination ul {
vertical-align: middle;
}
-/* Nice method for clearing floated blocks without having to insert any extra markup
- From http://www.positioniseverything.net/easyclearing.html
-.clearfix:after, #tabs:after, .row:after, #content:after, fieldset dl:after, #page-body:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
-}*/
-
-.clearfix, .row, #content, fieldset dl, #page-body {
+.row, fieldset dl {
overflow: hidden;
}
@@ -2470,3 +2457,20 @@ fieldset.permissions .padding {
.responsive-show-inline { display: inline !important; }
.responsive-show-inline-block { display: inline-block !important; }
}
+
+.clearfix {
+ overflow: hidden;
+}
+
+.pagination:after,
+#page-header:after,
+#page-body:after,
+#tabs:after,
+#tabs > ul:after,
+#tabs li:after,
+#acp:after,
+#content:after {
+ content: '';
+ clear: both;
+ display: block;
+}
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 802b4dd7c8..b5187991f9 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -79,40 +79,27 @@ phpbb.alert = function(title, msg, fadedark) {
$alert.find('.alert_title').html(title);
$alert.find('.alert_text').html(msg);
- if (!$dark.is(':visible')) {
- $dark.fadeIn(phpbb.alertTime);
- }
-
- $alert.on('click', function(e) {
- e.stopPropagation();
- });
- $dark.one('click', function(e) {
- var fade;
-
- $alert.find('.alert_close').off('click');
- fade = (typeof fadedark !== 'undefined' && !fadedark) ? $alert : $dark;
- fade.fadeOut(phpbb.alertTime, function() {
- $alert.hide();
- });
-
- e.preventDefault();
- e.stopPropagation();
- });
-
- $(document).keydown(function(e) {
- if ((e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) && $dark.is(':visible')) {
- $dark.trigger('click');
-
+ $(document).on('keydown.phpbb.alert', function(e) {
+ if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
+ phpbb.alert.close($alert, true);
e.preventDefault();
e.stopPropagation();
}
});
+ phpbb.alert.open($alert);
- $alert.find('.alert_close').one('click', function(e) {
- $dark.trigger('click');
+ return $alert;
+};
- e.preventDefault();
- });
+/**
+* Handler for opening an alert box.
+*
+* @param jQuery $alert jQuery object.
+*/
+phpbb.alert.open = function($alert) {
+ if (!$dark.is(':visible')) {
+ $dark.fadeIn(phpbb.alertTime);
+ }
if ($loadingIndicator.is(':visible')) {
$loadingIndicator.fadeOut(phpbb.alertTime, function() {
@@ -128,7 +115,37 @@ phpbb.alert = function(title, msg, fadedark) {
$dark.fadeIn(phpbb.alertTime);
}
- return $alert;
+ $alert.on('click', function(e) {
+ e.stopPropagation();
+ });
+
+ $dark.one('click', function(e) {
+ phpbb.alert.close($alert, true);
+ e.preventDefault();
+ e.stopPropagation();
+ });
+
+ $alert.find('.alert_close').one('click', function(e) {
+ phpbb.alert.close($alert, true);
+ e.preventDefault();
+ });
+};
+
+/**
+* Handler for closing an alert box.
+*
+* @param jQuery $alert jQuery object.
+* @param bool fadedark Whether to remove dark background.
+*/
+phpbb.alert.close = function($alert, fadedark) {
+ var $fade = (fadedark) ? $dark : $alert;
+
+ $fade.fadeOut(phpbb.alertTime, function() {
+ $alert.hide();
+ });
+
+ $alert.find('.alert_close').off('click');
+ $(document).off('keydown.phpbb.alert');
};
/**
@@ -147,77 +164,32 @@ phpbb.alert = function(title, msg, fadedark) {
phpbb.confirm = function(msg, callback, fadedark) {
var $confirmDiv = $('#phpbb_confirm');
$confirmDiv.find('.alert_text').html(msg);
+ fadedark = fadedark || true;
- if (!$dark.is(':visible')) {
- $dark.fadeIn(phpbb.alertTime);
- }
-
- $confirmDiv.on('click', function(e) {
- e.stopPropagation();
- });
-
- var clickHandler = function(e) {
- var res = this.name === 'confirm';
- var $fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? $confirmDiv : $dark;
- $fade.fadeOut(phpbb.alertTime, function() {
- $confirmDiv.hide();
- });
- $confirmDiv.find('input[type="button"]').off('click', clickHandler);
- callback(res);
+ $(document).on('keydown.phpbb.alert', function(e) {
+ if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
+ var name = (e.keyCode === keymap.ENTER) ? 'confirm' : 'cancel';
- if (e) {
+ $('input[name="' + name + '"]').trigger('click');
e.preventDefault();
e.stopPropagation();
}
- };
- $confirmDiv.find('input[type="button"]').one('click', clickHandler);
-
- $dark.one('click', function(e) {
- $confirmDiv.find('.alert_close').off('click');
- $dark.fadeOut(phpbb.alertTime, function() {
- $confirmDiv.hide();
- });
- callback(false);
-
- e.preventDefault();
- e.stopPropagation();
});
- $(document).on('keydown', function(e) {
- if (e.keyCode === keymap.ENTER) {
- $('input[name="confirm"]').trigger('click');
- e.preventDefault();
- e.stopPropagation();
- } else if (e.keyCode === keymap.ESC) {
- $('input[name="cancel"]').trigger('click');
- e.preventDefault();
- e.stopPropagation();
- }
- });
+ $confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) {
+ var confirmed = this.name === 'confirm';
- $confirmDiv.find('.alert_close').one('click', function(e) {
- var $fade = (typeof fadedark !== 'undefined' && fadedark) ? $confirmDiv : $dark;
- $fade.fadeOut(phpbb.alertTime, function() {
- $confirmDiv.hide();
- });
- callback(false);
+ if (confirmed) {
+ callback(true);
+ }
+ $confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox');
+ phpbb.alert.close($confirmDiv, fadedark || !confirmed);
e.preventDefault();
+ e.stopPropagation();
});
- if ($loadingIndicator.is(':visible')) {
- $loadingIndicator.fadeOut(phpbb.alertTime, function() {
- $dark.append($confirmDiv);
- $confirmDiv.fadeIn(phpbb.alertTime);
- });
- } else if ($dark.is(':visible')) {
- $dark.append($confirmDiv);
- $confirmDiv.fadeIn(phpbb.alertTime);
- } else {
- $dark.append($confirmDiv);
- $confirmDiv.show();
- $dark.fadeIn(phpbb.alertTime);
- }
+ phpbb.alert.open($confirmDiv);
return $confirmDiv;
};
@@ -810,12 +782,7 @@ phpbb.timezoneSwitchDate = function(keepSelection) {
.insertAfter('#timezone');
} else {
// Copy the content of our backup, so we can remove all unneeded options
- var $replacement = $timezoneCopy.clone();
- $replacement.attr('id', 'timezone')
- .css('display', 'block')
- .attr('name', 'tz');
-
- $timezone.replaceWith($replacement);
+ $timezone.html($timezoneCopy.html());
}
if ($tzDate.val() !== '') {
diff --git a/phpBB/config/parameters.yml b/phpBB/config/parameters.yml
index 5bf2c678ee..b076ea3ecb 100644
--- a/phpBB/config/parameters.yml
+++ b/phpBB/config/parameters.yml
@@ -1,2 +1,3 @@
parameters:
+ core.disable_super_globals: true
datetime.class: \phpbb\datetime
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index a588046245..95a1210045 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -100,6 +100,7 @@ services:
- @controller.provider
- @ext.manager
- @symfony_request
+ - @filesystem
- %core.root_path%
- %core.php_ext%
@@ -328,6 +329,9 @@ services:
request:
class: phpbb\request\request
+ arguments:
+ - null
+ - %core.disable_super_globals%
symfony_request:
class: phpbb\symfony_request
diff --git a/phpBB/feed.php b/phpBB/feed.php
index 8971bae768..d4dfb15928 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -164,7 +164,7 @@ if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_'))
{
header('Content-type: text/html; charset=UTF-8');
header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header('Pragma: no-cache');
$mtime = explode(' ', microtime());
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 1de70d4210..a61518401c 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1989,6 +1989,9 @@ function tracking_unserialize($string, $max_depth = 3)
* @param mixed $params String or array of additional url parameters
* @param bool $is_amp Is url using &amp; (true) or & (false)
* @param string $session_id Possibility to use a custom session id instead of the global one
+* @param bool $is_route Is url generated by a route.
+*
+* @return string The corrected url.
*
* Examples:
* <code>
@@ -1999,7 +2002,7 @@ function tracking_unserialize($string, $max_depth = 3)
* </code>
*
*/
-function append_sid($url, $params = false, $is_amp = true, $session_id = false)
+function append_sid($url, $params = false, $is_amp = true, $session_id = false, $is_route = false)
{
global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper;
global $phpbb_dispatcher;
@@ -2011,7 +2014,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
}
// Update the root path with the correct relative web path
- if ($phpbb_path_helper instanceof \phpbb\path_helper)
+ if (!$is_route && $phpbb_path_helper instanceof \phpbb\path_helper)
{
$url = $phpbb_path_helper->update_web_root_path($url);
}
@@ -2037,9 +2040,10 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
* the global one (false)
* @var bool|string append_sid_overwrite Overwrite function (string
* URL) or not (false)
+ * @var bool is_route Is url generated by a route.
* @since 3.1.0-a1
*/
- $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite');
+ $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite', 'is_route');
extract($phpbb_dispatcher->trigger_event('core.append_sid', compact($vars)));
if ($append_sid_overwrite)
@@ -5058,7 +5062,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
// application/xhtml+xml not used because of IE
'Content-type' => 'text/html; charset=UTF-8',
'Cache-Control' => 'private, no-cache="set-cookie"',
- 'Expires' => '0',
+ 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT',
'Pragma' => 'no-cache',
);
if (!empty($user->data['is_bot']))
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index d9dc11239c..da8d756db9 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -112,7 +112,7 @@ function adm_page_header($page_title)
// application/xhtml+xml not used because of IE
'Content-type' => 'text/html; charset=UTF-8',
'Cache-Control' => 'private, no-cache="set-cookie"',
- 'Expires' => '0',
+ 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT',
'Pragma' => 'no-cache',
);
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 4ff3994f4c..3be84299f0 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -56,17 +56,17 @@ function send_avatar_to_browser($file, $browser)
if (strpos(strtolower($browser), 'msie 6.0') !== false)
{
- header('Expires: -1');
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
}
else
{
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
}
}
else
{
header('Content-Disposition: inline; ' . header_filename($file));
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
}
$size = @filesize($file_path);
@@ -197,7 +197,7 @@ function send_file_to_browser($attachment, $upload_dir, $category)
header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename'])));
if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false))
{
- header('expires: -1');
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
}
}
else
@@ -421,7 +421,7 @@ function set_modified_headers($stamp, $browser)
send_status_line(304, 'Not Modified');
// seems that we need those too ... browsers
header('Pragma: public');
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
return true;
}
else
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 768011fa5b..1fdc7ee9ea 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2538,7 +2538,7 @@ function phpbb_upload_popup($forum_style = 0)
/**
* Do the various checks required for removing posts as well as removing it
*/
-function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '')
+function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '')
{
global $user, $auth, $config, $request;
global $phpbb_root_path, $phpEx;
@@ -2571,19 +2571,19 @@ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $
'post_postcount' => $post_data['post_postcount'],
);
- $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason);
+ $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason);
$post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username'];
if ($next_post_id === false)
{
- add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_delete_reason);
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $delete_reason);
$meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
$message = $user->lang['POST_DELETED'];
}
else
{
- add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_delete_reason);
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $delete_reason);
$meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id") . "#p$next_post_id";
$message = $user->lang['POST_DELETED'];
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index de0cccd234..d09f71ae22 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -896,8 +896,7 @@ if (!$get_info)
array('user_regdate', 'users.user_regdate', ''),
array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang
array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')),
- array('user_password', 'users.user_password', 'phpbb_hash'),
- array('user_pass_convert', 1, ''),
+ array('user_password', 'users.user_password', 'phpbb_convert_password_hash'),
array('user_posts', 'users.user_posts', 'intval'),
array('user_email', 'users.user_email', 'strtolower'),
array('user_email_hash', 'users.user_email', 'gen_email_hash'),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 01447a6232..817c007274 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -1969,3 +1969,13 @@ function phpbb_add_notification_options($user_notify_pm)
$sql = $db->sql_multi_insert(USER_NOTIFICATIONS_TABLE, $rows);
}
+
+function phpbb_convert_password_hash($hash)
+{
+ global $phpbb_container;
+
+ $manager = $phpbb_container->get('passwords.manager');
+ $hash = $manager->hash($hash, '$H$');
+
+ return '$CP$' . $hash;
+}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 6a91033dbb..5cf01fec79 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -177,11 +177,21 @@ $migrator = $phpbb_container->get('migrator');
$migrator->create_migrations_table();
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
-$finder = $phpbb_extension_manager->get_finder();
-$migrations = $finder
+$migrations = $phpbb_extension_manager
+ ->get_finder()
->core_path('phpbb/db/migration/data/')
+ ->extension_directory('/migration')
->get_classes();
+
+// @deprecated 3.1.0-RC4 (To be removed: 3.2.0)
+$migrations_deprecated = $phpbb_extension_manager
+ ->get_finder()
+ ->extension_directory('/migrations')
+ ->get_classes();
+
+$migrations = array_merge($migrations, $migrations_deprecated);
+
$migrator->set_migrations($migrations);
// What is a safe limit of execution time? Half the max execution time should be safe.
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 2e497da3db..5531a98c09 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -445,7 +445,7 @@ class module
header('Content-type: text/html; charset=UTF-8');
header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header('Pragma: no-cache');
return;
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 2cd6ec59cc..924395ed44 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -93,7 +93,7 @@ $lang = array_merge($lang, array(
'DELETE_POST_PERMANENTLY' => 'Permanently delete this post so it can not be recovered',
'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?',
'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete these posts?',
- 'DELETE_REASON' => 'Soft delete reason',
+ 'DELETE_REASON' => 'Reason for deletion',
'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.',
'DELETE_POST_WARN' => 'Delete this post',
'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index c3caae5f70..68638a9515 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -117,8 +117,17 @@ class migrate extends \phpbb\console\command\command
$migrations = $this->extension_manager
->get_finder()
->core_path('phpbb/db/migration/data/')
+ ->extension_directory('/migration')
+ ->get_classes();
+
+ // @deprecated 3.1.0-RC4 (To be removed: 3.2.0)
+ $migrations_deprecated = $this->extension_manager
+ ->get_finder()
->extension_directory('/migrations')
->get_classes();
+
+ $migrations = array_merge($migrations, $migrations_deprecated);
+
$this->migrator->set_migrations($migrations);
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index dd89d0504a..e2932086db 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -15,6 +15,7 @@ namespace phpbb\controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
+use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
/**
@@ -44,6 +45,11 @@ class helper
protected $symfony_request;
/**
+ * @var \phpbb\filesystem The filesystem object
+ */
+ protected $filesystem;
+
+ /**
* phpBB root path
* @var string
*/
@@ -64,15 +70,17 @@ class helper
* @param \phpbb\controller\provider $provider Path provider
* @param \phpbb\extension\manager $manager Extension manager object
* @param \phpbb\symfony_request $symfony_request Symfony Request object
+ * @param \phpbb\filesystem $filesystem The filesystem object
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
*/
- public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
$this->config = $config;
$this->symfony_request = $symfony_request;
+ $this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$provider->find_routing_files($manager->get_finder());
@@ -108,10 +116,11 @@ class helper
* @param string $route Name of the route to travel
* @param array $params String or array of additional url parameters
* @param bool $is_amp Is url using &amp; (true) or & (false)
- * @param string|bool $session_id Possibility to use a custom session id instead of the global one
+ * @param string|bool $session_id Possibility to use a custom session id instead of the global one
+ * @param bool|string $reference_type The type of reference to be generated (one of the constants)
* @return string The URL already passed through append_sid()
*/
- public function route($route, array $params = array(), $is_amp = true, $session_id = false)
+ public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
{
$anchor = '';
if (isset($params['#']))
@@ -119,27 +128,39 @@ class helper
$anchor = '#' . $params['#'];
unset($params['#']);
}
- $url_generator = new UrlGenerator($this->route_collection, new RequestContext());
- $route_url = $url_generator->generate($route, $params);
- if (strpos($route_url, '/') === 0)
- {
- $route_url = substr($route_url, 1);
- }
+ $context = new RequestContext();
+ $context->fromRequest($this->symfony_request);
+
+ $script_name = $this->symfony_request->getScriptName();
+ $page_name = substr($script_name, -1, 1) == '/' ? '' : utf8_basename($script_name);
+
+ $base_url = $context->getBaseUrl();
+
+ // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
+ $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
+
+ // We need to update the base url to move to the directory of the app.php file.
+ $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url);
+
+ $base_url = $this->filesystem->clean_path($base_url);
+
+ $context->setBaseUrl($base_url);
+
+ $url_generator = new UrlGenerator($this->route_collection, $context);
+ $route_url = $url_generator->generate($route, $params, $reference_type);
if ($is_amp)
{
$route_url = str_replace(array('&amp;', '&'), array('&', '&amp;'), $route_url);
}
- // If enable_mod_rewrite is false, we need to include app.php
- $route_prefix = $this->phpbb_root_path;
- if (empty($this->config['enable_mod_rewrite']))
+ if ($reference_type === UrlGeneratorInterface::RELATIVE_PATH && empty($this->config['enable_mod_rewrite']))
{
- $route_prefix .= 'app.' . $this->php_ext . '/';
+ $route_url = 'app.' . $this->php_ext . '/' . $route_url;
}
- return append_sid($route_prefix . $route_url . $anchor, false, $is_amp, $session_id);
+ return append_sid($route_url . $anchor, false, $is_amp, $session_id, true);
}
/**
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index 288fb7d19c..b74026e6ab 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -35,6 +35,9 @@ class base implements \phpbb\extension\extension_interface
/** @var string */
protected $extension_path;
+ /** @var string[] */
+ private $migrations = false;
+
/**
* Constructor
*
@@ -122,19 +125,27 @@ class base implements \phpbb\extension\extension_interface
*/
protected function get_migration_file_list()
{
- static $migrations = false;
-
- if ($migrations !== false)
+ if ($this->migrations !== false)
{
- return $migrations;
+ return $this->migrations;
}
// Only have the finder search in this extension path directory
$migrations = $this->extension_finder
- ->extension_directory('/migrations')
+ ->extension_directory('/migration')
->find_from_extension($this->extension_name, $this->extension_path);
+
$migrations = $this->extension_finder->get_classes_from_files($migrations);
+ // @deprecated 3.1.0-RC4 (To be removed: 3.2.0)
+ $migrations_deprecated = $this->extension_finder
+ ->extension_directory('/migrations')
+ ->find_from_extension($this->extension_name, $this->extension_path);
+
+ $migrations_deprecated = $this->extension_finder->get_classes_from_files($migrations_deprecated);
+
+ $migrations = array_merge($migrations, $migrations_deprecated);
+
return $migrations;
}
}
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 4c3d012ca5..18572a3a6c 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -436,9 +436,8 @@ if ($mode == 'delete' || $mode == 'soft_delete')
trigger_error('NO_POST');
}
- $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id));
- $soft_delete_reason = ($mode == 'soft_delete' && $allow_reason) ? $request->variable('delete_reason', '', true) : '';
- phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason);
+ $delete_reason = $request->variable('delete_reason', '', true);
+ phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $delete_reason);
return;
}
@@ -1258,9 +1257,8 @@ if ($submit || $preview || $refresh)
// Handle delete mode...
if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent'))
{
- $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id));
- $soft_delete_reason = (!$request->is_set_post('delete_permanent') && $allow_reason) ? $request->variable('delete_reason', '', true) : '';
- phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason);
+ $delete_reason = $request->variable('delete_reason', '', true);
+ phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $delete_reason);
return;
}
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 13e8d02469..168efff4b4 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -353,14 +353,6 @@ $('.display_post').click(function(e) {
$('#post_hidden' + postId).hide();
});
-$('#delete_permanent').click(function () {
- if ($(this).prop('checked')) {
- $('#delete_reason').hide();
- } else {
- $('#delete_reason').show();
- }
-});
-
/**
* Toggle the member search panel in memberlist.php.
*
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index e9c95aa799..275859ac97 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -22,7 +22,7 @@
<div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}">
<a href="#" class="alert_close"></a>
- <h3 class="alert_title"></h3><p class="alert_text"></p>
+ <h3 class="alert_title">&nbsp;</h3><p class="alert_text"></p>
</div>
<div id="phpbb_confirm" class="phpbb_alert">
<a href="#" class="alert_close"></a>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 1ea5b0973c..7882279485 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -41,7 +41,7 @@
<link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
<!-- ENDIF -->
-<!--[if lte IE 8]>
+<!--[if lte IE 9]>
<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
<![endif]-->
diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html
index cb2c09bff7..4680eaa175 100644
--- a/phpBB/styles/prosilver/template/pagination.html
+++ b/phpBB/styles/prosilver/template/pagination.html
@@ -7,7 +7,7 @@
<ul class="dropdown-contents">
<li>{L_JUMP_TO_PAGE}{L_COLON}</li>
<li class="page-jump-form">
- <input type="number" name="page-number" maxlength="6" title="{L_JUMP_PAGE}" class="inputbox tiny" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}" data-start-name="{START_NAME}" />
+ <input type="number" name="page-number" min="1" maxlength="6" title="{L_JUMP_PAGE}" class="inputbox tiny" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}" data-start-name="{START_NAME}" />
<input class="button2" value="{L_GO}" type="button" />
</li>
</ul>
diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css
index 851b3a6bb6..d52ac6dee8 100644
--- a/phpBB/styles/prosilver/theme/tweaks.css
+++ b/phpBB/styles/prosilver/theme/tweaks.css
@@ -1,78 +1,27 @@
/* Style Sheet Tweaks
-These style definitions are IE 7 and 8 specific
-tweaks required due to its poor CSS support.
--------------------------------------------------*/
+These style definitions are IE 8 & 9 only.
+They are required due to the poor CSS support in IE browsers.
+------------------------------------------------------------------------------*/
-/* Clear float fix for IE7 */
-.inner {
- zoom: 1;
-}
+/* IE 8 Tweaks (value)\9 equates to IE <= 8
+------------------------------------------------------------------------------*/
-ul.linklist {
- zoom: 1;
-}
+/* Clear float fix */
+.inner, ul.linklist { zoom: 1\9; }
/* Align checkboxes/radio buttons nicely */
-dd label input {
- vertical-align: text-bottom;
- *vertical-align: middle;
-}
+dd label input { vertical-align: text-bottom\9; }
-/* Simple fix so forum and topic lists always have a height set */
-dl.icon {
- *height: 35px;
-}
+/* Fixes header-avatar aspect-ratio */
+.header-avatar img { height: 20px\9; }
-/* Correctly clear floating for details on profile view */
-dl.details dd {
- *margin-left: 30%;
- *float: none;
-}
-
-/* Headerbar height fix for IE7 */
-#site-description p {
- *margin-bottom: 1.0em;
-}
-
-/* Forum list column styles for IE7 */
-dl.icon dt, dl.icon dd {
- *min-height: 32px;
-}
-
-dd.posts, dd.topics, dd.views, dd.extra, dd.mark {
- *width: 79px;
-}
-
-dd.lastpost, dd.redirect, dd.moderation, dd.time, dd.info {
- *width: 249px;
-}
-
-dd.option {
- *width: 124px;
-}
+/* IE8 often can't handle max-width in %, so we use px instead */
+.postprofile .avatar img { max-width: 150px\9; }
-/* Notifications list for IE7 */
-.dropdown-extended {
- *left: 0;
-}
-.dropdown-extended .header_settings {
- *position: absolute;
- *right: 10px;
- *top: 0;
-}
-.icon-notification {
- *z-index: 2;
-}
+/* IE 9 Tweaks
+------------------------------------------------------------------------------*/
-/* Fixes header-avatar aspect-ratio in IE8 */
-.header-avatar img {
- height: 20px;
-}
-/* IE8 often can't handle max-width in %, so we use px instead */
-.postprofile .avatar img {
- max-width: 150px;
-}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index bb4a703cc3..40c6ef7dfa 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -19,6 +19,7 @@ require_once $phpbb_root_path . 'includes/startup.php';
$table_prefix = 'phpbb_';
require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
+require_once($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
$phpbb_class_loader_mock = new \phpbb\class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php");
$phpbb_class_loader_mock->register();
diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php
index 04bff81683..e906e79164 100644
--- a/tests/controller/helper_route_test.php
+++ b/tests/controller/helper_route_test.php
@@ -13,6 +13,8 @@
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
+
class phpbb_controller_helper_route_test extends phpbb_test_case
{
public function setUp()
@@ -21,11 +23,21 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
$this->user = new \phpbb\user('\phpbb\datetime');
+
+ $request = new phpbb_mock_request();
+ $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('SCRIPT_FILENAME', 'app.php', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('REQUEST_URI', '/app.php', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER);
+
+ $this->symfony_request = new \phpbb\symfony_request(
+ $request
+ );
+ $this->filesystem = new \phpbb\filesystem();
$phpbb_path_helper = new \phpbb\path_helper(
- new \phpbb\symfony_request(
- new phpbb_mock_request()
- ),
- new \phpbb\filesystem(),
+ $this->symfony_request,
+ $this->filesystem,
$this->getMock('\phpbb\request\request'),
$phpbb_root_path,
$phpEx
@@ -57,6 +69,125 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function helper_url_data_no_rewrite()
{
return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, '/app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, '/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/app.php/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/app.php/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, '/app.php/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, '/app.php/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, '/app.php/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_no_rewrite()
+ */
+ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ }
+
+ public function helper_url_data_with_rewrite()
+ {
+ return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, '/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, '/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, '/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, '/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, '/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_with_rewrite()
+ */
+ public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ }
+
+ public function helper_url_data_absolute()
+ {
+ return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/app.php/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/app.php/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, 'http://localhost/app.php/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, 'http://localhost/app.php/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, 'http://localhost/app.php/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_absolute()
+ */
+ public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
+ }
+
+ public function helper_url_data_relative_path()
+ {
+ return array(
array('controller2', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
array('controller2', array('t' => 1, 'f' => 2), false, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'app.php/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
@@ -85,15 +216,96 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
}
/**
- * @dataProvider helper_url_data_no_rewrite()
+ * @dataProvider helper_url_data_relative_path()
*/
- public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description)
{
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
}
- public function helper_url_data_with_rewrite()
+ public function helper_url_data_network()
+ {
+ return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/app.php/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/app.php/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/app.php/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, '//localhost/app.php/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, '//localhost/app.php/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, '//localhost/app.php/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_network()
+ */
+ public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
+ }
+//TODO
+ public function helper_url_data_absolute_with_rewrite()
+ {
+ return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, 'http://localhost/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, 'http://localhost/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, 'http://localhost/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_absolute_with_rewrite()
+ */
+ public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
+ }
+
+ public function helper_url_data_relative_path_with_rewrite()
{
return array(
array('controller2', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
@@ -124,12 +336,52 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
}
/**
- * @dataProvider helper_url_data_with_rewrite()
- */
- public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ * @dataProvider helper_url_data_relative_path_with_rewrite()
+ */
+ public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
+ }
+
+ public function helper_url_data_network_with_rewrite()
+ {
+ return array(
+ array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/foo/bar/p-3?t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid', 'params-argument (array) using session_id'),
+
+ // Testing anchors
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/foo/bar/p-3?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/foo/bar/p-3?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp; or ?
+ array('controller2', array(), true, false, '//localhost/foo/bar', 'no params using empty array'),
+ array('controller2', array(), false, false, '//localhost/foo/bar', 'no params using empty array'),
+ array('controller3', array('p' => 3), true, false, '//localhost/foo/bar/p-3', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_network_with_rewrite()
+ */
+ public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
}
}
diff --git a/tests/extension/ext/vendor2/bar/migration/migration.php b/tests/extension/ext/vendor2/bar/migration/migration.php
new file mode 100644
index 0000000000..fc27656d10
--- /dev/null
+++ b/tests/extension/ext/vendor2/bar/migration/migration.php
@@ -0,0 +1,18 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace vendor2\bar\migration;
+
+class migration extends \phpbb\db\migration\migration
+{
+}
diff --git a/tests/extension/ext/vendor2/bar/migrations/migration.php b/tests/extension/ext/vendor2/bar/migrations/migration.php
new file mode 100644
index 0000000000..71caa34fd9
--- /dev/null
+++ b/tests/extension/ext/vendor2/bar/migrations/migration.php
@@ -0,0 +1,18 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace vendor2\bar\migrations;
+
+class migration extends \phpbb\db\migration\migration
+{
+}
diff --git a/tests/extension/ext/vendor2/foo/migrations/migration.php b/tests/extension/ext/vendor2/foo/migrations/migration.php
new file mode 100644
index 0000000000..63085497e3
--- /dev/null
+++ b/tests/extension/ext/vendor2/foo/migrations/migration.php
@@ -0,0 +1,18 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace vendor2\foo\migrations;
+
+class migration extends \phpbb\db\migration\migration
+{
+}
diff --git a/tests/extension/ext/vendor3/bar/migration/migration.php b/tests/extension/ext/vendor3/bar/migration/migration.php
new file mode 100644
index 0000000000..e7280a7d5e
--- /dev/null
+++ b/tests/extension/ext/vendor3/bar/migration/migration.php
@@ -0,0 +1,18 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace vendor3\bar\migration;
+
+class migration extends \phpbb\db\migration\migration
+{
+}
diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php
new file mode 100644
index 0000000000..5535c91fc5
--- /dev/null
+++ b/tests/extension/extension_base_test.php
@@ -0,0 +1,85 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_extension_extension_base_test extends phpbb_test_case
+{
+ protected static $reflection_method_get_migration_file_list;
+
+ public static function setUpBeforeClass()
+ {
+ parent::setUpBeforeClass();
+
+ $reflection_class = new ReflectionClass('\phpbb\extension\base');
+ self::$reflection_method_get_migration_file_list = $reflection_class->getMethod('get_migration_file_list');
+ self::$reflection_method_get_migration_file_list->setAccessible(true);
+ }
+
+ public function setUp()
+ {
+ $container = new phpbb_mock_container_builder();
+ $migrator = new phpbb_mock_migrator();
+ $container->set('migrator', $migrator);
+
+ $this->extension_manager = new phpbb_mock_extension_manager(
+ dirname(__FILE__) . '/',
+ array(
+ 'vendor2/foo' => array(
+ 'ext_name' => 'vendor2/foo',
+ 'ext_active' => '1',
+ 'ext_path' => 'ext/vendor2/foo/',
+ ),
+ 'vendor3/bar' => array(
+ 'ext_name' => 'vendor3/bar',
+ 'ext_active' => '1',
+ 'ext_path' => 'ext/vendor3/bar/',
+ ),
+ 'vendor2/bar' => array(
+ 'ext_name' => 'vendor2/bar',
+ 'ext_active' => '1',
+ 'ext_path' => 'ext/vendor2/bar/',
+ ),
+ ),
+ $container);
+ }
+
+ public function data_test_suffix_get_classes()
+ {
+ return array(
+ array(
+ 'vendor3/bar',
+ array('\vendor3\bar\migration\migration'),
+ ),
+ array(
+ 'vendor2/foo',
+ array('\vendor2\foo\migrations\migration'),
+ ),
+ array(
+ 'vendor2/bar',
+ array(
+ '\vendor2\bar\migration\migration',
+ '\vendor2\bar\migrations\migration',
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider data_test_suffix_get_classes
+ */
+ public function test_suffix_get_classes($extension_name, $expected)
+ {
+ $extension = $this->extension_manager->get_extension($extension_name);
+ $this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension));
+ }
+}
diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php
index f9d231258e..9c13c309f2 100644
--- a/tests/mock/controller_helper.php
+++ b/tests/mock/controller_helper.php
@@ -13,11 +13,13 @@
class phpbb_mock_controller_helper extends \phpbb\controller\helper
{
- public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, $phpbb_root_path, $php_ext, $phpbb_root_path_ext)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext, $phpbb_root_path_ext)
{
$this->template = $template;
$this->user = $user;
$this->config = $config;
+ $this->symfony_request = $symfony_request;
+ $this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$provider->find_routing_files($manager->get_finder());
diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php
index 1a475f62e0..3b759fbbc2 100644
--- a/tests/mock/extension_manager.php
+++ b/tests/mock/extension_manager.php
@@ -13,11 +13,12 @@
class phpbb_mock_extension_manager extends \phpbb\extension\manager
{
- public function __construct($phpbb_root_path, $extensions = array())
+ public function __construct($phpbb_root_path, $extensions = array(), $container = null)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = 'php';
$this->extensions = $extensions;
$this->filesystem = new \phpbb\filesystem();
+ $this->container = $container;
}
}
diff --git a/tests/mock/migrator.php b/tests/mock/migrator.php
new file mode 100644
index 0000000000..293f115335
--- /dev/null
+++ b/tests/mock/migrator.php
@@ -0,0 +1,55 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+class phpbb_mock_migrator extends \phpbb\db\migrator
+{
+ public function __construct()
+ {
+ }
+
+ public function load_migration_state()
+ {
+ }
+
+ public function set_migrations($class_names)
+ {
+ }
+
+ public function update()
+ {
+ }
+
+ public function revert($migration)
+ {
+ }
+
+ public function unfulfillable($name)
+ {
+ }
+
+ public function finished()
+ {
+ }
+
+ public function migration_state($migration)
+ {
+ }
+
+ public function populate_migrations($migrations)
+ {
+ }
+
+ public function create_migrations_table()
+ {
+ }
+}
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index 321d6c2caf..95856dd07d 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -34,9 +34,10 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
+ $filesystem = new \phpbb\filesystem();
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
$finder = new \phpbb\finder(
- new \phpbb\filesystem(),
+ $filesystem,
dirname(__FILE__) . '/',
new phpbb_mock_cache()
);
@@ -46,7 +47,17 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
$provider = new \phpbb\controller\provider();
$provider->find_routing_files($finder);
$provider->find(dirname(__FILE__) . '/');
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php', dirname(__FILE__) . '/');
+
+ $request = new phpbb_mock_request();
+ $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('SCRIPT_FILENAME', 'app.php', \phpbb\request\request_interface::SERVER);
+ $request->overwrite('REQUEST_URI', '/app.php', \phpbb\request\request_interface::SERVER);
+
+ $symfony_request = new \phpbb\symfony_request(
+ $request
+ );
+
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, $symfony_request, $filesystem, '', 'php', dirname(__FILE__) . '/');
$this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper);
}
@@ -110,17 +121,17 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:per_page:10
:current_page:2
:base_url:
- :previous::test
- :else:1:test
- :current:2:test/page/2
- :else:3:test/page/3
- :else:4:test/page/4
- :else:5:test/page/5
- :ellipsis:9:test/page/9
- :else:10:test/page/10
- :next::test/page/3
- :u_prev:test
- :u_next:test/page/3',
+ :previous::/test
+ :else:1:/test
+ :current:2:/test/page/2
+ :else:3:/test/page/3
+ :else:4:/test/page/4
+ :else:5:/test/page/5
+ :ellipsis:9:/test/page/9
+ :else:10:/test/page/10
+ :next::/test/page/3
+ :u_prev:/test
+ :u_next:/test/page/3',
),
array(
array('routes' => array(
@@ -135,17 +146,17 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:per_page:10
:current_page:3
:base_url:
- :previous::test/page/2
- :else:1:test
- :else:2:test/page/2
- :current:3:test/page/3
- :else:4:test/page/4
- :else:5:test/page/5
- :ellipsis:9:test/page/9
- :else:10:test/page/10
- :next::test/page/4
- :u_prev:test/page/2
- :u_next:test/page/4',
+ :previous::/test/page/2
+ :else:1:/test
+ :else:2:/test/page/2
+ :current:3:/test/page/3
+ :else:4:/test/page/4
+ :else:5:/test/page/5
+ :ellipsis:9:/test/page/9
+ :else:10:/test/page/10
+ :next::/test/page/4
+ :u_prev:/test/page/2
+ :u_next:/test/page/4',
),
);
}