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/adm/style/ajax.js33
-rw-r--r--phpBB/assets/javascript/core.js647
-rw-r--r--phpBB/composer.json1
-rw-r--r--phpBB/composer.lock302
-rw-r--r--phpBB/config/auth_providers.yml1
-rw-r--r--phpBB/config/parameters.yml1
-rw-r--r--phpBB/config/services.yml19
-rw-r--r--phpBB/docs/events.md56
-rw-r--r--phpBB/download/file.php3
-rw-r--r--phpBB/feed.php2
-rw-r--r--phpBB/includes/acp/acp_profile.php145
-rw-r--r--phpBB/includes/acp/acp_users.php2
-rw-r--r--phpBB/includes/compatibility_globals.php1
-rw-r--r--phpBB/includes/functions.php93
-rw-r--r--phpBB/includes/functions_acp.php2
-rw-r--r--phpBB/includes/functions_admin.php18
-rw-r--r--phpBB/includes/functions_content.php1
-rw-r--r--phpBB/includes/functions_display.php30
-rw-r--r--phpBB/includes/functions_download.php10
-rw-r--r--phpBB/includes/functions_mcp.php17
-rw-r--r--phpBB/includes/functions_posting.php48
-rw-r--r--phpBB/includes/functions_privmsgs.php14
-rw-r--r--phpBB/includes/functions_transfer.php2
-rw-r--r--phpBB/includes/functions_upload.php7
-rw-r--r--phpBB/includes/functions_user.php8
-rw-r--r--phpBB/includes/mcp/mcp_front.php6
-rw-r--r--phpBB/includes/mcp/mcp_main.php8
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php2
-rw-r--r--phpBB/includes/mcp/mcp_queue.php46
-rw-r--r--phpBB/includes/mcp/mcp_reports.php33
-rw-r--r--phpBB/includes/mcp/mcp_warn.php4
-rw-r--r--phpBB/includes/ucp/ucp_activate.php2
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php1
-rw-r--r--phpBB/includes/ucp/ucp_main.php6
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php8
-rw-r--r--phpBB/includes/ucp/ucp_pm_options.php6
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php26
-rw-r--r--phpBB/includes/ucp/ucp_register.php2
-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.php6
-rw-r--r--phpBB/install/index.php2
-rw-r--r--phpBB/install/schemas/schema_data.sql8
-rw-r--r--phpBB/language/en/acp/profile.php2
-rw-r--r--phpBB/language/en/cli.php3
-rw-r--r--phpBB/language/en/common.php8
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/language/en/search.php2
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php13
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php1
-rw-r--r--phpBB/phpbb/console/command/extension/show.php8
-rw-r--r--phpBB/phpbb/controller/helper.php49
-rw-r--r--phpBB/phpbb/controller/provider.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php122
-rw-r--r--phpBB/phpbb/db/migrator.php54
-rw-r--r--phpBB/phpbb/di/container_builder.php5
-rw-r--r--phpBB/phpbb/event/extension_subscriber_loader.php39
-rw-r--r--phpBB/phpbb/extension/base.php10
-rw-r--r--phpBB/phpbb/feed/forum.php4
-rw-r--r--phpBB/phpbb/feed/news.php2
-rw-r--r--phpBB/phpbb/feed/overall.php4
-rw-r--r--phpBB/phpbb/feed/topic.php2
-rw-r--r--phpBB/phpbb/feed/topics.php2
-rw-r--r--phpBB/phpbb/feed/topics_active.php4
-rw-r--r--phpBB/phpbb/mimetype/guesser.php39
-rw-r--r--phpBB/phpbb/notification/manager.php6
-rw-r--r--phpBB/phpbb/notification/method/email.php2
-rw-r--r--phpBB/phpbb/notification/method/jabber.php2
-rw-r--r--phpBB/phpbb/notification/type/admin_activate_user.php2
-rw-r--r--phpBB/phpbb/notification/type/approve_post.php2
-rw-r--r--phpBB/phpbb/notification/type/approve_topic.php2
-rw-r--r--phpBB/phpbb/notification/type/bookmark.php2
-rw-r--r--phpBB/phpbb/notification/type/disapprove_post.php2
-rw-r--r--phpBB/phpbb/notification/type/disapprove_topic.php2
-rw-r--r--phpBB/phpbb/notification/type/group_request.php2
-rw-r--r--phpBB/phpbb/notification/type/group_request_approved.php2
-rw-r--r--phpBB/phpbb/notification/type/pm.php2
-rw-r--r--phpBB/phpbb/notification/type/post.php2
-rw-r--r--phpBB/phpbb/notification/type/post_in_queue.php4
-rw-r--r--phpBB/phpbb/notification/type/quote.php2
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php4
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php2
-rw-r--r--phpBB/phpbb/notification/type/report_post.php4
-rw-r--r--phpBB/phpbb/notification/type/report_post_closed.php2
-rw-r--r--phpBB/phpbb/notification/type/topic.php2
-rw-r--r--phpBB/phpbb/notification/type/topic_in_queue.php4
-rw-r--r--phpBB/phpbb/path_helper.php24
-rw-r--r--phpBB/phpbb/profilefields/manager.php10
-rw-r--r--phpBB/phpbb/session.php4
-rw-r--r--phpBB/phpbb/template/twig/twig.php4
-rw-r--r--phpBB/posting.php10
-rw-r--r--phpBB/report.php4
-rw-r--r--phpBB/search.php5
-rw-r--r--phpBB/styles/prosilver/template/ajax.js156
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js499
-rw-r--r--phpBB/styles/prosilver/template/forumlist_body.html4
-rw-r--r--phpBB/styles/prosilver/template/jumpbox.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_warn_post.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_warn_user.html4
-rw-r--r--phpBB/styles/prosilver/template/memberlist_im.html2
-rw-r--r--phpBB/styles/prosilver/template/memberlist_view.html4
-rw-r--r--phpBB/styles/prosilver/template/message_body.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html4
-rw-r--r--phpBB/styles/prosilver/template/pagination.html2
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html4
-rw-r--r--phpBB/styles/prosilver/template/posting_pm_header.html2
-rw-r--r--phpBB/styles/prosilver/template/search_results.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html4
-rw-r--r--phpBB/styles/prosilver/template/timezone.js15
-rw-r--r--phpBB/styles/prosilver/template/ucp_attachments.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html4
-rw-r--r--phpBB/styles/prosilver/template/viewonline_whois.html8
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html12
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_topic_tools.html2
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css14
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css8
-rw-r--r--phpBB/styles/prosilver/theme/common.css7
-rw-r--r--phpBB/styles/prosilver/theme/content.css19
-rw-r--r--phpBB/styles/prosilver/theme/images/created_by.jpgbin52977 -> 0 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/done.gif (renamed from phpBB/assets/plupload/img/done.gif)bin1024 -> 1024 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/error.gif (renamed from phpBB/assets/plupload/img/error.gif)bin994 -> 994 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/throbber.gif (renamed from phpBB/assets/plupload/img/throbber.gif)bin1922 -> 1922 bytes
-rw-r--r--phpBB/styles/prosilver/theme/plupload.css6
-rw-r--r--phpBB/styles/prosilver/theme/responsive.css23
-rw-r--r--phpBB/styles/prosilver/theme/tweaks.css79
-rw-r--r--phpBB/styles/subsilver2/template/mcp_warn_post.html5
-rw-r--r--phpBB/styles/subsilver2/template/mcp_warn_user.html5
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/simple_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_attachments.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/viewtopic_body.html2
-rw-r--r--phpBB/viewforum.php69
-rw-r--r--phpBB/viewonline.php19
-rw-r--r--phpBB/viewtopic.php41
-rw-r--r--tests/bootstrap.php1
-rw-r--r--tests/console/config/config_test.php251
-rw-r--r--tests/controller/helper_route_test.php280
-rw-r--r--tests/extension/ext/vendor2/bar/migrations/migration.php18
-rw-r--r--tests/extension/ext/vendor4/bar/composer.json23
-rw-r--r--tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html1
-rw-r--r--tests/extension/extension_base_test.php79
-rw-r--r--tests/extension/manager_test.php2
-rw-r--r--tests/functional/extension_acp_test.php2
-rw-r--r--tests/functional/extension_controller_test.php14
-rw-r--r--tests/functional/fileupload_form_test.php4
-rw-r--r--tests/functional/fixtures/ext/foo/foo/composer.json24
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/resource.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/routing.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/services.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/controller/controller.php13
-rw-r--r--tests/functional/fixtures/ext/foo/foo/ext.php8
-rw-r--r--tests/functional/notification_test.php16
-rw-r--r--tests/functional/ucp_preferences_test.php85
-rw-r--r--tests/lock/flock_test.php8
-rw-r--r--tests/mimetype/guesser_test.php21
-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/notification/base.php35
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.bookmark.xml (renamed from tests/notification/fixtures/submit_post_bookmark.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post.xml (renamed from tests/notification/fixtures/submit_post_post.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml (renamed from tests/notification/fixtures/submit_post_post_in_queue.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.quote.xml (renamed from tests/notification/fixtures/submit_post_quote.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.topic.xml (renamed from tests/notification/fixtures/submit_post_topic.xml)10
-rw-r--r--tests/notification/group_request_test.php4
-rw-r--r--tests/notification/manager_helper.php3
-rw-r--r--tests/notification/notification_test.php50
-rw-r--r--tests/notification/submit_post_type_bookmark_test.php2
-rw-r--r--tests/notification/submit_post_type_post_in_queue_test.php2
-rw-r--r--tests/notification/submit_post_type_post_test.php2
-rw-r--r--tests/notification/submit_post_type_quote_test.php2
-rw-r--r--tests/notification/submit_post_type_topic_test.php2
-rw-r--r--tests/pagination/pagination_test.php59
-rw-r--r--tests/path_helper/path_helper_test.php27
-rw-r--r--tests/template/template_allfolder_test.php59
-rw-r--r--tests/test_framework/phpbb_database_test_case.php5
183 files changed, 2797 insertions, 1700 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/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 959580d6c2..4ad6b6afa5 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -1,6 +1,8 @@
+/* global phpbb */
+
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
/**
* The following callbacks are for reording items. row_down
@@ -13,11 +15,10 @@ phpbb.addAjaxCallback('row_down', function(res) {
return;
}
- var el = $(this),
- tr = el.parents('tr'),
- trSwap = tr.next();
+ var $firstTr = $(this).parents('tr'),
+ $secondTr = $firstTr.next();
- tr.insertAfter(trSwap);
+ $firstTr.insertAfter($secondTr);
});
phpbb.addAjaxCallback('row_up', function(res) {
@@ -25,11 +26,10 @@ phpbb.addAjaxCallback('row_up', function(res) {
return;
}
- var el = $(this),
- tr = el.parents('tr'),
- trSwap = tr.prev();
+ var $secondTr = $(this).parents('tr'),
+ $firstTr = $secondTr.prev();
- tr.insertBefore(trSwap);
+ $secondTr.insertBefore($firstTr);
});
/**
@@ -38,10 +38,10 @@ phpbb.addAjaxCallback('row_up', function(res) {
* in the href with "deactivate", and vice versa.
*/
phpbb.addAjaxCallback('activate_deactivate', function(res) {
- var el = $(this),
- newHref = el.attr('href');
+ var $this = $(this),
+ newHref = $this.attr('href');
- el.text(res.text);
+ $this.text(res.text);
if (newHref.indexOf('deactivate') !== -1) {
newHref = newHref.replace('deactivate', 'activate');
@@ -49,7 +49,7 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) {
newHref = newHref.replace('activate', 'deactivate');
}
- el.attr('href', newHref);
+ $this.attr('href', newHref);
});
/**
@@ -66,11 +66,10 @@ phpbb.addAjaxCallback('row_delete', function(res) {
$('[data-ajax]').each(function() {
var $this = $(this),
- ajax = $this.attr('data-ajax'),
- fn;
+ ajax = $this.attr('data-ajax');
if (ajax !== 'false') {
- fn = (ajax !== 'true') ? ajax : null;
+ var fn = (ajax !== 'true') ? ajax : null;
phpbb.ajaxify({
selector: this,
refresh: $this.attr('data-refresh') !== undefined,
@@ -82,7 +81,7 @@ $('[data-ajax]').each(function() {
/**
* Automatically resize textarea
*/
-$(document).ready(function() {
+$(function() {
phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75});
});
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 388f31698f..b5187991f9 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -3,7 +3,7 @@ phpbb.alertTime = 100;
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
// define a couple constants for keydown functions.
var keymap = {
@@ -12,8 +12,8 @@ var keymap = {
ESC: 27
};
-var dark = $('#darkenwrapper');
-var loadingIndicator = $('#loading_indicator');
+var $dark = $('#darkenwrapper');
+var $loadingIndicator = $('#loading_indicator');
var phpbbAlertTimer = null;
phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined');
@@ -24,18 +24,20 @@ phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined');
* @returns object Returns loadingIndicator.
*/
phpbb.loadingIndicator = function() {
- if (!loadingIndicator.is(':visible')) {
- loadingIndicator.fadeIn(phpbb.alertTime);
+ if (!$loadingIndicator.is(':visible')) {
+ $loadingIndicator.fadeIn(phpbb.alertTime);
// Wait fifteen seconds and display an error if nothing has been returned by then.
phpbb.clearLoadingTimeout();
phpbbAlertTimer = setTimeout(function() {
- if (loadingIndicator.is(':visible')) {
- phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
+ var $alert = $('#phpbb_alert');
+
+ if ($loadingIndicator.is(':visible')) {
+ phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req'));
}
}, 15000);
}
- return loadingIndicator;
+ return $loadingIndicator;
};
/**
@@ -73,60 +75,77 @@ phpbb.closeDarkenWrapper = function(delay) {
* @returns object Returns the div created.
*/
phpbb.alert = function(title, msg, fadedark) {
- var div = $('#phpbb_alert');
- div.find('.alert_title').html(title);
- div.find('.alert_text').html(msg);
+ var $alert = $('#phpbb_alert');
+ $alert.find('.alert_title').html(title);
+ $alert.find('.alert_text').html(msg);
+
+ $(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);
+
+ return $alert;
+};
+
+/**
+* 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 (!dark.is(':visible')) {
- dark.fadeIn(phpbb.alertTime);
+ if ($loadingIndicator.is(':visible')) {
+ $loadingIndicator.fadeOut(phpbb.alertTime, function() {
+ $dark.append($alert);
+ $alert.fadeIn(phpbb.alertTime);
+ });
+ } else if ($dark.is(':visible')) {
+ $dark.append($alert);
+ $alert.fadeIn(phpbb.alertTime);
+ } else {
+ $dark.append($alert);
+ $alert.show();
+ $dark.fadeIn(phpbb.alertTime);
}
- div.bind('click', function(e) {
+ $alert.on('click', function(e) {
e.stopPropagation();
});
- dark.one('click', function(e) {
- var fade;
-
- div.find('.alert_close').unbind('click');
- fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark;
- fade.fadeOut(phpbb.alertTime, function() {
- div.hide();
- });
+ $dark.one('click', function(e) {
+ phpbb.alert.close($alert, true);
e.preventDefault();
e.stopPropagation();
});
- $(document).keydown(function(e) {
- if ((e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) && dark.is(':visible')) {
- dark.trigger('click');
-
- e.preventDefault();
- e.stopPropagation();
- }
+ $alert.find('.alert_close').one('click', function(e) {
+ phpbb.alert.close($alert, true);
+ e.preventDefault();
});
+};
- div.find('.alert_close').one('click', function(e) {
- dark.trigger('click');
+/**
+* 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;
- e.preventDefault();
+ $fade.fadeOut(phpbb.alertTime, function() {
+ $alert.hide();
});
- if (loadingIndicator.is(':visible')) {
- loadingIndicator.fadeOut(phpbb.alertTime, function() {
- dark.append(div);
- div.fadeIn(phpbb.alertTime);
- });
- } else if (dark.is(':visible')) {
- dark.append(div);
- div.fadeIn(phpbb.alertTime);
- } else {
- dark.append(div);
- div.show();
- dark.fadeIn(phpbb.alertTime);
- }
-
- return div;
+ $alert.find('.alert_close').off('click');
+ $(document).off('keydown.phpbb.alert');
};
/**
@@ -143,81 +162,36 @@ phpbb.alert = function(title, msg, fadedark) {
* @returns object Returns the div created.
*/
phpbb.confirm = function(msg, callback, fadedark) {
- var div = $('#phpbb_confirm');
- div.find('.alert_text').html(msg);
-
- if (!dark.is(':visible')) {
- dark.fadeIn(phpbb.alertTime);
- }
-
- div.bind('click', function(e) {
- e.stopPropagation();
- });
+ var $confirmDiv = $('#phpbb_confirm');
+ $confirmDiv.find('.alert_text').html(msg);
+ fadedark = fadedark || true;
- var clickHandler = function(e) {
- var res = this.name === 'confirm';
- var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
- fade.fadeOut(phpbb.alertTime, function() {
- div.hide();
- });
- div.find('input[type="button"]').unbind('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();
}
- };
- div.find('input[type="button"]').one('click', clickHandler);
-
- dark.one('click', function(e) {
- div.find('.alert_close').unbind('click');
- dark.fadeOut(phpbb.alertTime, function() {
- div.hide();
- });
- callback(false);
-
- e.preventDefault();
- e.stopPropagation();
});
- $(document).bind('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';
- div.find('.alert_close').one('click', function(e) {
- var fade = (typeof fadedark !== 'undefined' && fadedark) ? div : dark;
- fade.fadeOut(phpbb.alertTime, function() {
- div.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(div);
- div.fadeIn(phpbb.alertTime);
- });
- } else if (dark.is(':visible')) {
- dark.append(div);
- div.fadeIn(phpbb.alertTime);
- } else {
- dark.append(div);
- div.show();
- dark.fadeIn(phpbb.alertTime);
- }
+ phpbb.alert.open($confirmDiv);
- return div;
+ return $confirmDiv;
};
/**
@@ -257,12 +231,12 @@ phpbb.parseQuerystring = function(string) {
* that was returned and (if it is a form) the form action.
*/
phpbb.ajaxify = function(options) {
- var elements = $(options.selector),
+ var $elements = $(options.selector),
refresh = options.refresh,
callback = options.callback,
overlay = (typeof options.overlay !== 'undefined') ? options.overlay : true,
- isForm = elements.is('form'),
- isText = elements.is('input[type="text"], textarea'),
+ isForm = $elements.is('form'),
+ isText = $elements.is('input[type="text"], textarea'),
eventName;
if (isForm) {
@@ -273,7 +247,7 @@ phpbb.ajaxify = function(options) {
eventName = 'click';
}
- elements.bind(eventName, function(event) {
+ $elements.on(eventName, function(event) {
var action, method, data, submit, that = this, $this = $(this);
if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') {
@@ -293,11 +267,12 @@ phpbb.ajaxify = function(options) {
errorText = errorThrown;
}
else {
- errorText = dark.attr('data-ajax-error-text-' + textStatus);
- if (typeof errorText !== 'string' || !errorText.length)
- errorText = dark.attr('data-ajax-error-text');
+ errorText = $dark.attr('data-ajax-error-text-' + textStatus);
+ if (typeof errorText !== 'string' || !errorText.length) {
+ errorText = $dark.attr('data-ajax-error-text');
+ }
}
- phpbb.alert(dark.attr('data-ajax-error-title'), errorText);
+ phpbb.alert($dark.attr('data-ajax-error-title'), errorText);
}
/**
@@ -322,7 +297,7 @@ phpbb.ajaxify = function(options) {
if (typeof res.MESSAGE_TITLE !== 'undefined') {
alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
} else {
- dark.fadeOut(phpbb.alertTime);
+ $dark.fadeOut(phpbb.alertTime);
}
if (typeof phpbb.ajaxCallbacks[callback] === 'function') {
@@ -345,7 +320,7 @@ phpbb.ajaxify = function(options) {
// Hide the alert even if we refresh the page, in case the user
// presses the back button.
- dark.fadeOut(phpbb.alertTime, function() {
+ $dark.fadeOut(phpbb.alertTime, function() {
if (typeof alert !== 'undefined') {
alert.hide();
}
@@ -355,17 +330,19 @@ phpbb.ajaxify = function(options) {
} else {
// If confirmation is required, display a dialog to the user.
phpbb.confirm(res.MESSAGE_BODY, function(del) {
- if (del) {
- phpbb.loadingIndicator();
- data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize();
- $.ajax({
- url: res.S_CONFIRM_ACTION,
- type: 'POST',
- data: data + '&confirm=' + res.YES_VALUE + '&' + $('#phpbb_confirm form').serialize(),
- success: returnHandler,
- error: errorHandler
- });
+ if (!del) {
+ return;
}
+
+ phpbb.loadingIndicator();
+ data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize();
+ $.ajax({
+ url: res.S_CONFIRM_ACTION,
+ type: 'POST',
+ data: data + '&confirm=' + res.YES_VALUE + '&' + $('form', '#phpbb_confirm').serialize(),
+ success: returnHandler,
+ error: errorHandler
+ });
}, false);
}
}
@@ -373,7 +350,7 @@ phpbb.ajaxify = function(options) {
// If the element is a form, POST must be used and some extra data must
// be taken from the form.
var runFilter = (typeof options.filter === 'function');
- var data = {};
+ data = {};
if (isForm) {
action = $this.attr('action').replace('&amp;', '&');
@@ -388,7 +365,7 @@ phpbb.ajaxify = function(options) {
});
}
} else if (isText) {
- var name = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : this['name'];
+ var name = $this.attr('data-name') || this.name;
action = $this.attr('data-url').replace('&amp;', '&');
data[name] = this.value;
method = 'POST';
@@ -399,7 +376,8 @@ phpbb.ajaxify = function(options) {
}
var sendRequest = function() {
- if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') === 'true')) {
+ var dataOverlay = $this.attr('data-overlay');
+ if (overlay && (typeof dataOverlay === 'undefined' || dataOverlay === 'true')) {
phpbb.loadingIndicator();
}
@@ -411,7 +389,7 @@ phpbb.ajaxify = function(options) {
error: errorHandler
});
request.always(function() {
- loadingIndicator.fadeOut(phpbb.alertTime);
+ $loadingIndicator.fadeOut(phpbb.alertTime);
});
};
@@ -426,7 +404,7 @@ phpbb.ajaxify = function(options) {
});
if (isForm) {
- elements.find('input:submit').click(function () {
+ $elements.find('input:submit').click(function () {
var $this = $(this);
$this.siblings('[data-clicked]').removeAttr('data-clicked');
@@ -437,7 +415,13 @@ phpbb.ajaxify = function(options) {
return this;
};
-phpbb.search = {cache: {data: []}, tpl: [], container: []};
+phpbb.search = {
+ cache: {
+ data: []
+ },
+ tpl: [],
+ container: []
+};
/**
* Get cached search data.
@@ -478,7 +462,7 @@ phpbb.search.cache.set = function(id, key, value) {
* @return undefined
*/
phpbb.search.cache.setResults = function(id, keyword, value) {
- this.data[id]['results'][keyword] = value;
+ this.data[id].results[keyword] = value;
};
/**
@@ -495,16 +479,16 @@ phpbb.search.cleanKeyword = function(keyword) {
* Get clean version of search keyword. If textarea supports several keywords
* (one per line), it fetches the current keyword based on the caret position.
*
- * @param jQuery el Search input|textarea.
+ * @param jQuery $input Search input|textarea.
* @param string keyword Input|textarea value.
* @param bool multiline Whether textarea supports multiple search keywords.
*
* @return string Clean string.
*/
-phpbb.search.getKeyword = function(el, keyword, multiline) {
+phpbb.search.getKeyword = function($input, keyword, multiline) {
if (multiline) {
- var line = phpbb.search.getKeywordLine(el);
- keyword = keyword.split("\n").splice(line, 1);
+ var line = phpbb.search.getKeywordLine($input);
+ keyword = keyword.split('\n').splice(line, 1);
}
return phpbb.search.cleanKeyword(keyword);
};
@@ -513,46 +497,48 @@ phpbb.search.getKeyword = function(el, keyword, multiline) {
* Get the textarea line number on which the keyword resides - for textareas
* that support multiple keywords (one per line).
*
- * @param jQuery el Search textarea.
+ * @param jQuery $textarea Search textarea.
* @return int
*/
-phpbb.search.getKeywordLine = function (el) {
- return el.val().substr(0, el.get(0).selectionStart).split("\n").length - 1;
+phpbb.search.getKeywordLine = function ($textarea) {
+ var selectionStart = $textarea.get(0).selectionStart;
+ return $textarea.val().substr(0, selectionStart).split('\n').length - 1;
};
/**
* Set the value on the input|textarea. If textarea supports multiple
* keywords, only the active keyword is replaced.
*
- * @param jQuery el Search input|textarea.
+ * @param jQuery $input Search input|textarea.
* @param string value Value to set.
* @param bool multiline Whether textarea supports multiple search keywords.
*
* @return undefined
*/
-phpbb.search.setValue = function(el, value, multiline) {
+phpbb.search.setValue = function($input, value, multiline) {
if (multiline) {
- var line = phpbb.search.getKeywordLine(el),
- lines = el.val().split("\n");
+ var line = phpbb.search.getKeywordLine($input),
+ lines = $input.val().split('\n');
lines[line] = value;
- value = lines.join("\n");
+ value = lines.join('\n');
}
- el.val(value);
+ $input.val(value);
};
/**
* Sets the onclick event to set the value on the input|textarea to the selected search result.
*
- * @param jQuery el Search input|textarea.
+ * @param jQuery $input Search input|textarea.
* @param object value Result object.
- * @param object container jQuery object for the search container.
+ * @param jQuery $row Result element.
+ * @param jQuery $container jQuery object for the search container.
*
* @return undefined
*/
-phpbb.search.setValueOnClick = function(el, value, row, container) {
- row.click(function() {
- phpbb.search.setValue(el, value.result, el.attr('data-multiline'));
- container.hide();
+phpbb.search.setValueOnClick = function($input, value, $row, $container) {
+ $row.click(function() {
+ phpbb.search.setValue($input, value.result, $input.attr('data-multiline'));
+ $container.hide();
});
};
@@ -569,39 +555,39 @@ phpbb.search.setValueOnClick = function(el, value, row, container) {
* @return bool Returns false.
*/
phpbb.search.filter = function(data, event, sendRequest) {
- var el = $(this),
- dataName = (el.attr('data-name') !== undefined) ? el.attr('data-name') : el.attr('name'),
- minLength = parseInt(el.attr('data-min-length')),
- searchID = el.attr('data-results'),
- keyword = phpbb.search.getKeyword(el, data[dataName], el.attr('data-multiline')),
+ var $this = $(this),
+ dataName = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : $this.attr('name'),
+ minLength = parseInt($this.attr('data-min-length')),
+ searchID = $this.attr('data-results'),
+ keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')),
cache = phpbb.search.cache.get(searchID),
proceed = true;
data[dataName] = keyword;
- if (cache['timeout']) {
- clearTimeout(cache['timeout']);
+ if (cache.timeout) {
+ clearTimeout(cache.timeout);
}
var timeout = setTimeout(function() {
// Check min length and existence of cache.
if (minLength > keyword.length) {
proceed = false;
- } else if (cache['last_search']) {
+ } else if (cache.lastSearch) {
// Has the keyword actually changed?
- if (cache['last_search'] === keyword) {
+ if (cache.lastSearch === keyword) {
proceed = false;
} else {
// Do we already have results for this?
- if (cache['results'][keyword]) {
- var response = {keyword: keyword, results: cache['results'][keyword]};
- phpbb.search.handleResponse(response, el, true);
+ if (cache.results[keyword]) {
+ var response = {keyword: keyword, results: cache.results[keyword]};
+ phpbb.search.handleResponse(response, $this, true);
proceed = false;
}
// If the previous search didn't yield results and the string only had characters added to it,
// then we won't bother sending a request.
- if (keyword.indexOf(cache['last_search']) === 0 && cache['results'][cache['last_search']].length === 0) {
- phpbb.search.cache.set(searchID, 'last_search', keyword);
+ if (keyword.indexOf(cache.lastSearch) === 0 && cache.results[cache.lastSearch].length === 0) {
+ phpbb.search.cache.set(searchID, 'lastSearch', keyword);
phpbb.search.cache.setResults(searchID, keyword, []);
proceed = false;
}
@@ -621,22 +607,22 @@ phpbb.search.filter = function(data, event, sendRequest) {
* Handle search result response.
*
* @param object res Data received from server.
- * @param jQuery el Search input|textarea.
+ * @param jQuery $input Search input|textarea.
* @param bool fromCache Whether the results are from the cache.
* @param function callback Optional callback to run when assigning each search result.
*
* @return undefined
*/
-phpbb.search.handleResponse = function(res, el, fromCache, callback) {
+phpbb.search.handleResponse = function(res, $input, fromCache, callback) {
if (typeof res !== 'object') {
return;
}
- var searchID = el.attr('data-results'),
- container = $(searchID);
+ var searchID = $input.attr('data-results'),
+ $container = $(searchID);
- if (this.cache.get(searchID)['callback']) {
- callback = this.cache.get(searchID)['callback'];
+ if (this.cache.get(searchID).callback) {
+ callback = this.cache.get(searchID).callback;
} else if (typeof callback === 'function') {
this.cache.set(searchID, 'callback', callback);
}
@@ -645,35 +631,35 @@ phpbb.search.handleResponse = function(res, el, fromCache, callback) {
this.cache.setResults(searchID, res.keyword, res.results);
}
- this.cache.set(searchID, 'last_search', res.keyword);
- this.showResults(res.results, el, container, callback);
+ this.cache.set(searchID, 'lastSearch', res.keyword);
+ this.showResults(res.results, $input, $container, callback);
};
/**
* Show search results.
*
* @param array results Search results.
- * @param jQuery el Search input|textarea.
- * @param jQuery container Search results container element.
+ * @param jQuery $input Search input|textarea.
+ * @param jQuery $container Search results container element.
* @param function callback Optional callback to run when assigning each search result.
*
* @return undefined
*/
-phpbb.search.showResults = function(results, el, container, callback) {
- var resultContainer = $('.search-results', container);
- this.clearResults(resultContainer);
+phpbb.search.showResults = function(results, $input, $container, callback) {
+ var $resultContainer = $('.search-results', $container);
+ this.clearResults($resultContainer);
if (!results.length) {
- container.hide();
+ $container.hide();
return;
}
- var searchID = container.attr('id'),
+ var searchID = $container.attr('id'),
tpl,
row;
if (!this.tpl[searchID]) {
- tpl = $('.search-result-tpl', container);
+ tpl = $('.search-result-tpl', $container);
this.tpl[searchID] = tpl.clone().removeClass('search-result-tpl');
tpl.remove();
}
@@ -684,27 +670,27 @@ phpbb.search.showResults = function(results, el, container, callback) {
row.find('.search-result').html(item.display);
if (typeof callback === 'function') {
- callback.call(this, el, item, row, container);
+ callback.call(this, $input, item, row, $container);
}
- row.appendTo(resultContainer).show();
+ row.appendTo($resultContainer).show();
});
- container.show();
+ $container.show();
};
/**
* Clear search results.
*
- * @param jQuery container Search results container.
+ * @param jQuery $container Search results container.
* @return undefined
*/
-phpbb.search.clearResults = function(container) {
- container.children(':not(.search-result-tpl)').remove();
+phpbb.search.clearResults = function($container) {
+ $container.children(':not(.search-result-tpl)').remove();
};
-$('#phpbb').click(function(e) {
- var target = $(e.target);
+$('#phpbb').click(function() {
+ var $this = $(this);
- if (!target.is('.live-search') && !target.parents().is('.live-search')) {
+ if (!$this.is('.live-search') && !$this.parents().is('.live-search')) {
$('.live-search').hide();
}
});
@@ -718,10 +704,7 @@ phpbb.history = {};
* @return bool Returns true if the method is supported.
*/
phpbb.history.isSupported = function(fn) {
- if (typeof history === 'undefined' || typeof history[fn] === 'undefined') {
- return false;
- }
- return true;
+ return !(typeof history === 'undefined' || typeof history[fn] === 'undefined');
};
/**
@@ -783,36 +766,47 @@ phpbb.history.pushUrl = function(url, title, obj) {
* @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one.
*/
phpbb.timezoneSwitchDate = function(keepSelection) {
- if ($('#timezone_copy').length === 0) {
+ var $timezoneCopy = $('#timezone_copy');
+ var $timezone = $('#timezone');
+ var $tzDate = $('#tz_date');
+ var $tzSelectDateSuggest = $('#tz_select_date_suggest');
+
+ if ($timezoneCopy.length === 0) {
// We make a backup of the original dropdown, so we can remove optgroups
// instead of setting display to none, because IE and chrome will not
// hide options inside of optgroups and selects via css
- $('#timezone').clone().attr('id', 'timezone_copy').css('display', 'none').attr('name', 'tz_copy').insertAfter('#timezone');
+ $timezone.clone()
+ .attr('id', 'timezone_copy')
+ .css('display', 'none')
+ .attr('name', 'tz_copy')
+ .insertAfter('#timezone');
} else {
// Copy the content of our backup, so we can remove all unneeded options
- $('#timezone').replaceWith($('#timezone_copy').clone().attr('id', 'timezone').css('display', 'block').attr('name', 'tz'));
+ $timezone.html($timezoneCopy.html());
}
- if ($('#tz_date').val() !== '') {
- $('#timezone > optgroup').remove(":not([label='" + $('#tz_date').val() + "'])");
+ if ($tzDate.val() !== '') {
+ $timezone.children('optgroup').remove(':not([label="' + $('#tz_date').val() + '"])');
}
- if ($('#tz_date').val() === $('#tz_select_date_suggest').attr('data-suggested-tz')) {
- $('#tz_select_date_suggest').css('display', 'none');
+ if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) {
+ $tzSelectDateSuggest.css('display', 'none');
} else {
- $('#tz_select_date_suggest').css('display', 'inline');
+ $tzSelectDateSuggest.css('display', 'inline');
}
+
+ var $tzOptions = $timezone.children('optgroup[label="' + $tzDate.val() + '"]').children('option');
- if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() === 1) {
+ if ($tzOptions.length === 1) {
// If there is only one timezone for the selected date, we just select that automatically.
- $("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").prop('selected', true);
+ $tzOptions.prop('selected', true);
keepSelection = true;
}
if (typeof keepSelection !== 'undefined' && !keepSelection) {
- var timezoneOptions = $('#timezone > optgroup option');
- if (timezoneOptions.filter(':selected').length <= 0) {
- timezoneOptions.filter(':first').prop('selected', true);
+ var $timezoneOptions = $timezone.find('optgroup option');
+ if ($timezoneOptions.filter(':selected').length <= 0) {
+ $timezoneOptions.filter(':first').prop('selected', true);
}
}
};
@@ -832,7 +826,6 @@ phpbb.timezoneEnableDateSelection = function() {
phpbb.timezonePreselectSelect = function(forceSelector) {
// The offset returned here is in minutes and negated.
- // http://www.w3schools.com/jsref/jsref_getTimezoneOffset.asp
var offset = (new Date()).getTimezoneOffset();
var sign = '-';
@@ -858,9 +851,11 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
var prefix = 'GMT' + sign + hours + ':' + minutes;
var prefixLength = prefix.length;
- var selectorOptions = $('#tz_date > option');
+ var selectorOptions = $('option', '#tz_date');
var i;
+ var $tzSelectDateSuggest = $('#tz_select_date_suggest');
+
for (i = 0; i < selectorOptions.length; ++i) {
var option = selectorOptions[i];
@@ -869,16 +864,18 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
// We do not select the option for the user, but notify him,
// that we would suggest a different setting.
phpbb.timezoneSwitchDate(true);
- $('#tz_select_date_suggest').css('display', 'inline');
+ $tzSelectDateSuggest.css('display', 'inline');
} else {
option.selected = true;
phpbb.timezoneSwitchDate(!forceSelector);
- $('#tz_select_date_suggest').css('display', 'none');
+ $tzSelectDateSuggest.css('display', 'none');
}
- $('#tz_select_date_suggest').attr('title', $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML));
- $('#tz_select_date_suggest').attr('value', $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML.substring(0, 9)));
- $('#tz_select_date_suggest').attr('data-suggested-tz', option.innerHTML);
+ var suggestion = $tzSelectDateSuggest.attr('data-l-suggestion');
+
+ $tzSelectDateSuggest.attr('title', suggestion.replace('%s', option.innerHTML));
+ $tzSelectDateSuggest.attr('value', suggestion.replace('%s', option.innerHTML.substring(0, 9)));
+ $tzSelectDateSuggest.attr('data-suggested-tz', option.innerHTML);
// Found the suggestion, there cannot be more, so return from here.
return;
@@ -916,22 +913,22 @@ phpbb.addAjaxCallback('member_search', function(res) {
* current text so that the process can be repeated.
*/
phpbb.addAjaxCallback('alt_text', function() {
- var el,
+ var $anchor,
updateAll = $(this).data('update-all'),
altText;
if (updateAll !== undefined && updateAll.length) {
- el = $(updateAll);
+ $anchor = $(updateAll);
} else {
- el = $(this);
+ $anchor = $(this);
}
- el.each(function() {
- var el = $(this);
- altText = el.attr('data-alt-text');
- el.attr('data-alt-text', el.text());
- el.attr('title', $.trim(altText));
- el.text(altText);
+ $anchor.each(function() {
+ var $this = $(this);
+ altText = $this.attr('data-alt-text');
+ $this.attr('data-alt-text', $this.text());
+ $this.attr('title', $.trim(altText));
+ $this.text(altText);
});
});
@@ -945,36 +942,36 @@ phpbb.addAjaxCallback('alt_text', function() {
* and changes the link itself.
*/
phpbb.addAjaxCallback('toggle_link', function() {
- var el,
+ var $anchor,
updateAll = $(this).data('update-all') ,
toggleText,
toggleUrl,
toggleClass;
if (updateAll !== undefined && updateAll.length) {
- el = $(updateAll);
+ $anchor = $(updateAll);
} else {
- el = $(this);
+ $anchor = $(this);
}
- el.each(function() {
- var el = $(this);
+ $anchor.each(function() {
+ var $this = $(this);
// Toggle link text
- toggleText = el.attr('data-toggle-text');
- el.attr('data-toggle-text', el.text());
- el.attr('title', $.trim(toggleText));
- el.text(toggleText);
+ toggleText = $this.attr('data-toggle-text');
+ $this.attr('data-toggle-text', $this.text());
+ $this.attr('title', $.trim(toggleText));
+ $this.text(toggleText);
// Toggle link url
- toggleUrl = el.attr('data-toggle-url');
- el.attr('data-toggle-url', el.attr('href'));
- el.attr('href', toggleUrl);
+ toggleUrl = $this.attr('data-toggle-url');
+ $this.attr('data-toggle-url', $this.attr('href'));
+ $this.attr('href', toggleUrl);
// Toggle class of link parent
- toggleClass = el.attr('data-toggle-class');
- el.attr('data-toggle-class', el.parent().attr('class'));
- el.parent().attr('class', toggleClass);
+ toggleClass = $this.attr('data-toggle-class');
+ $this.attr('data-toggle-class', $this.parent().attr('class'));
+ $this.parent().attr('class', toggleClass);
});
});
@@ -984,7 +981,7 @@ phpbb.addAjaxCallback('toggle_link', function() {
* This function automatically resizes textarea elements when user
* types text.
*
-* @param {jQuery} items jQuery object(s) to resize
+* @param {jQuery} $items jQuery object(s) to resize
* @param {object} options Optional parameter that adjusts default
* configuration. See configuration variable
*
@@ -1000,25 +997,26 @@ phpbb.addAjaxCallback('toggle_link', function() {
* this points to DOM object
* item is a jQuery object, same as this
*/
-phpbb.resizeTextArea = function(items, options) {
+phpbb.resizeTextArea = function($items, options) {
// Configuration
var configuration = {
minWindowHeight: 500,
minHeight: 200,
maxHeight: 500,
heightDiff: 200,
- resizeCallback: function(item) { },
- resetCallback: function(item) { }
+ resizeCallback: function() {},
+ resetCallback: function() {}
};
- if (phpbb.isTouch) return;
+ if (phpbb.isTouch) {
+ return;
+ }
if (arguments.length > 1) {
configuration = $.extend(configuration, options);
}
- function resetAutoResize(item)
- {
+ function resetAutoResize(item) {
var $item = $(item);
if ($item.hasClass('auto-resized')) {
$(item).css({height: '', resize: ''}).removeClass('auto-resized');
@@ -1026,10 +1024,8 @@ phpbb.resizeTextArea = function(items, options) {
}
}
- function autoResize(item)
- {
- function setHeight(height)
- {
+ function autoResize(item) {
+ function setHeight(height) {
height += parseInt($item.css('height')) - $item.height();
$item.css({height: height + 'px', resize: 'none'}).addClass('auto-resized');
configuration.resizeCallback.call(item, $item);
@@ -1042,7 +1038,10 @@ phpbb.resizeTextArea = function(items, options) {
return;
}
- var maxHeight = Math.min(Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), configuration.maxHeight),
+ var maxHeight = Math.min(
+ Math.max(windowHeight - configuration.heightDiff, configuration.minHeight),
+ configuration.maxHeight
+ ),
$item = $(item),
height = parseInt($item.height()),
scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0;
@@ -1059,14 +1058,14 @@ phpbb.resizeTextArea = function(items, options) {
}
}
- items.bind('focus change keyup', function() {
+ $items.on('focus change keyup', function() {
$(this).each(function() {
autoResize(this);
});
}).change();
$(window).resize(function() {
- items.each(function() {
+ $items.each(function() {
if ($(this).hasClass('auto-resized')) {
autoResize(this);
}
@@ -1104,7 +1103,9 @@ phpbb.inBBCodeTag = function(textarea, startTags, endTags) {
lastStart = Math.max(lastStart, index);
}
}
- if (lastStart == -1) return false;
+ if (lastStart === -1) {
+ return false;
+ }
if (start > 0) {
for (i = 0; i < endTags.length; i++) {
@@ -1114,7 +1115,7 @@ phpbb.inBBCodeTag = function(textarea, startTags, endTags) {
}
return (lastEnd < lastStart);
-}
+};
/**
@@ -1158,7 +1159,7 @@ phpbb.applyCodeEditor = function(textarea) {
function getLastLine(stripCodeStart) {
var start = textarea.selectionStart,
value = textarea.value,
- index = value.lastIndexOf("\n", start - 1);
+ index = value.lastIndexOf('\n', start - 1);
value = value.substring(index + 1, start);
@@ -1201,28 +1202,27 @@ phpbb.applyCodeEditor = function(textarea) {
var key = event.keyCode || event.which;
// intercept tabs
- if (key == keymap.TAB &&
+ if (key === keymap.TAB &&
!event.ctrlKey &&
!event.shiftKey &&
!event.altKey &&
!event.metaKey) {
if (inTag()) {
- appendText("\t");
+ appendText('\t');
event.preventDefault();
return;
}
}
// intercept new line characters
- if (key == keymap.ENTER) {
+ if (key === keymap.ENTER) {
if (inTag()) {
var lastLine = getLastLine(true),
code = '' + /^\s*/g.exec(lastLine);
if (code.length > 0) {
- appendText("\n" + code);
+ appendText('\n' + code);
event.preventDefault();
- return;
}
}
}
@@ -1247,43 +1247,41 @@ phpbb.toggleDropdown = function() {
var $this = $(this),
options = $this.data('dropdown-options'),
parent = options.parent,
- visible = parent.hasClass('dropdown-visible');
+ visible = parent.hasClass('dropdown-visible'),
+ direction;
if (!visible) {
// Hide other dropdown menus
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
// Figure out direction of dropdown
- var direction = options.direction,
- verticalDirection = options.verticalDirection,
+ direction = options.direction;
+ var verticalDirection = options.verticalDirection,
offset = $this.offset();
- if (direction == 'auto') {
+ if (direction === 'auto') {
if (($(window).width() - $this.outerWidth(true)) / 2 > offset.left) {
direction = 'right';
- }
- else {
+ } else {
direction = 'left';
}
}
- parent.toggleClass(options.leftClass, direction == 'left').toggleClass(options.rightClass, direction == 'right');
+ parent.toggleClass(options.leftClass, direction === 'left')
+ .toggleClass(options.rightClass, direction === 'right');
- if (verticalDirection == 'auto') {
+ if (verticalDirection === 'auto') {
var height = $(window).height(),
top = offset.top - $(window).scrollTop();
- if (top < height * 0.7) {
- verticalDirection = 'down';
- }
- else {
- verticalDirection = 'up';
- }
+ verticalDirection = (top < height * 0.7) ? 'down' : 'up';
}
- parent.toggleClass(options.upClass, verticalDirection == 'up').toggleClass(options.downClass, verticalDirection == 'down');
+ parent.toggleClass(options.upClass, verticalDirection === 'up')
+ .toggleClass(options.downClass, verticalDirection === 'down');
}
options.dropdown.toggle();
- parent.toggleClass(options.visibleClass, !visible).toggleClass('dropdown-visible', !visible);
+ parent.toggleClass(options.visibleClass, !visible)
+ .toggleClass('dropdown-visible', !visible);
// Check dimensions when showing dropdown
// !visible because variable shows state of dropdown before it was toggled
@@ -1304,8 +1302,7 @@ phpbb.toggleDropdown = function() {
if (offset < 2) {
$this.css('left', (2 - offset) + 'px');
- }
- else if ((offset + width + 2) > windowWidth) {
+ } else if ((offset + width + 2) > windowWidth) {
$this.css('margin-left', (windowWidth - offset - width - 2) + 'px');
}
@@ -1315,7 +1312,7 @@ phpbb.toggleDropdown = function() {
});
var freeSpace = parent.offset().left - 4;
- if (direction == 'left') {
+ if (direction === 'left') {
options.dropdown.css('margin-left', '-' + freeSpace + 'px');
// Try to position the notification dropdown correctly in RTL-responsive mode
@@ -1342,8 +1339,7 @@ phpbb.toggleDropdown = function() {
var e = arguments[0];
e.preventDefault();
e.stopPropagation();
- }
- catch (error) { }
+ } catch (error) { }
}
return false;
};
@@ -1354,7 +1350,7 @@ phpbb.toggleDropdown = function() {
phpbb.toggleSubmenu = function(e) {
$(this).siblings('.dropdown-submenu').toggle();
e.preventDefault();
-}
+};
/**
* Register dropdown menu
@@ -1364,8 +1360,7 @@ phpbb.toggleSubmenu = function(e) {
* @param {jQuery} dropdown Dropdown menu.
* @param {Object} options List of options. Optional.
*/
-phpbb.registerDropdown = function(toggle, dropdown, options)
-{
+phpbb.registerDropdown = function(toggle, dropdown, options) {
var ops = {
parent: toggle.parent(), // Parent item to add classes to
direction: 'auto', // Direction of dropdown menu. Possible values: auto, left, right
@@ -1411,8 +1406,8 @@ phpbb.colorPalette = function(dir, width, height) {
numberList[3] = 'BF';
numberList[4] = 'FF';
- var table_class = (dir == 'h') ? 'horizontal-palette' : 'vertical-palette';
- html += '<table class="not-responsive colour-palette ' + table_class + '" style="width: auto;">';
+ var tableClass = (dir == 'h') ? 'horizontal-palette' : 'vertical-palette';
+ html += '<table class="not-responsive colour-palette ' + tableClass + '" style="width: auto;">';
for (r = 0; r < 5; r++) {
if (dir == 'h') {
@@ -1442,7 +1437,7 @@ phpbb.colorPalette = function(dir, width, height) {
}
html += '</table>';
return html;
-}
+};
/**
* Register a color palette.
@@ -1492,12 +1487,14 @@ phpbb.toggleDisplay = function(id, action, type) {
type = 'block';
}
- var display = $('#' + id).css('display');
+ var $element = $('#' + id);
+
+ var display = $element.css('display');
if (!action) {
action = (display === '' || display === type) ? -1 : 1;
}
- $('#' + id).css('display', ((action === 1) ? type : 'none'));
-}
+ $element.css('display', ((action === 1) ? type : 'none'));
+};
/**
* Toggle additional settings based on the selected
@@ -1508,9 +1505,9 @@ phpbb.toggleDisplay = function(id, action, type) {
*/
phpbb.toggleSelectSettings = function(el) {
el.children().each(function() {
- var option = $(this),
- setting = $(option.data('toggle-setting'));
- setting.toggle(option.is(':selected'));
+ var $this = $(this),
+ $setting = $($this.data('toggle-setting'));
+ $setting.toggle($this.is(':selected'));
});
};
@@ -1536,49 +1533,61 @@ phpbb.getFunctionByName = function (functionName) {
* Register page dropdowns.
*/
phpbb.registerPageDropdowns = function() {
- $('body').find('.dropdown-container').each(function() {
+ var $body = $('body');
+
+ $body.find('.dropdown-container').each(function() {
var $this = $(this),
- trigger = $this.find('.dropdown-trigger:first'),
- contents = $this.find('.dropdown'),
+ $trigger = $this.find('.dropdown-trigger:first'),
+ $contents = $this.find('.dropdown'),
options = {
direction: 'auto',
verticalDirection: 'auto'
},
data;
- if (!trigger.length) {
+ if (!$trigger.length) {
data = $this.attr('data-dropdown-trigger');
- trigger = data ? $this.children(data) : $this.children('a:first');
+ $trigger = data ? $this.children(data) : $this.children('a:first');
}
- if (!contents.length) {
+ if (!$contents.length) {
data = $this.attr('data-dropdown-contents');
- contents = data ? $this.children(data) : $this.children('div:first');
+ $contents = data ? $this.children(data) : $this.children('div:first');
}
- if (!trigger.length || !contents.length) return;
+ if (!$trigger.length || !$contents.length) {
+ return;
+ }
- if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up';
- if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down';
- if ($this.hasClass('dropdown-left')) options.direction = 'left';
- if ($this.hasClass('dropdown-right')) options.direction = 'right';
+ if ($this.hasClass('dropdown-up')) {
+ options.verticalDirection = 'up';
+ }
+ if ($this.hasClass('dropdown-down')) {
+ options.verticalDirection = 'down';
+ }
+ if ($this.hasClass('dropdown-left')) {
+ options.direction = 'left';
+ }
+ if ($this.hasClass('dropdown-right')) {
+ options.direction = 'right';
+ }
- phpbb.registerDropdown(trigger, contents, options);
+ phpbb.registerDropdown($trigger, $contents, options);
});
// Hide active dropdowns when click event happens outside
- $('body').click(function(e) {
- var parents = $(e.target).parents();
- if (!parents.is(phpbb.dropdownVisibleContainers)) {
+ $body.click(function(e) {
+ var $parents = $(e.target).parents();
+ if (!$parents.is(phpbb.dropdownVisibleContainers)) {
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
}
});
-}
+};
/**
* Apply code editor to all textarea elements with data-bbcode attribute
*/
-$(document).ready(function() {
+$(function() {
$('textarea[data-bbcode]').each(function() {
phpbb.applyCodeEditor(this);
});
@@ -1595,12 +1604,12 @@ $(document).ready(function() {
// Hide settings that are not selected via select element.
$('select[data-togglable-settings]').each(function() {
- var select = $(this);
+ var $this = $(this);
- select.change(function() {
- phpbb.toggleSelectSettings(select);
+ $this.change(function() {
+ phpbb.toggleSelectSettings($this);
});
- phpbb.toggleSelectSettings(select);
+ phpbb.toggleSelectSettings($this);
});
});
diff --git a/phpBB/composer.json b/phpBB/composer.json
index e74dd120f0..69f0de8479 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -44,6 +44,7 @@
"sami/sami": "1.*",
"squizlabs/php_codesniffer": "1.*",
"symfony/browser-kit": "2.3.*",
+ "symfony/css-selector": "2.3.*",
"symfony/debug": "2.3.*",
"symfony/dom-crawler": "2.3.*",
"symfony/filesystem": "2.3.*",
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index 671daa70e1..b686bfef5c 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "27d5da149e0b5d76b76f43210306b666",
+ "hash": "d93446768ea0665b7c55c01890153a67",
"packages": [
{
"name": "lusitanian/oauth",
@@ -108,17 +108,17 @@
},
{
"name": "symfony/config",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "259722b5f2e87d3f487630abfd40f922cf2f6900"
+ "reference": "b34d2b32a92938476f0689486e7a11ea1aeb079e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/259722b5f2e87d3f487630abfd40f922cf2f6900",
- "reference": "259722b5f2e87d3f487630abfd40f922cf2f6900",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/b34d2b32a92938476f0689486e7a11ea1aeb079e",
+ "reference": "b34d2b32a92938476f0689486e7a11ea1aeb079e",
"shasum": ""
},
"require": {
@@ -142,33 +142,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
- "time": "2014-04-22 08:09:28"
+ "time": "2014-08-02 07:53:48"
},
{
"name": "symfony/console",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
- "reference": "c6c5a354a9945a5e9a9a6a495ca19558eb8639e9"
+ "reference": "a2723f99716c2fa6411e2eb5842edbe680e4b462"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Console/zipball/c6c5a354a9945a5e9a9a6a495ca19558eb8639e9",
- "reference": "c6c5a354a9945a5e9a9a6a495ca19558eb8639e9",
+ "url": "https://api.github.com/repos/symfony/Console/zipball/a2723f99716c2fa6411e2eb5842edbe680e4b462",
+ "reference": "a2723f99716c2fa6411e2eb5842edbe680e4b462",
"shasum": ""
},
"require": {
@@ -197,33 +195,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
- "time": "2014-05-14 13:35:53"
+ "time": "2014-08-07 15:55:24"
},
{
"name": "symfony/debug",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Debug",
"source": {
"type": "git",
"url": "https://github.com/symfony/Debug.git",
- "reference": "ca764f8af9cc4ba5d81b598c1b18b30db5508e18"
+ "reference": "91e3a1480c67601d2406cd938735abe0243e1c95"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Debug/zipball/ca764f8af9cc4ba5d81b598c1b18b30db5508e18",
- "reference": "ca764f8af9cc4ba5d81b598c1b18b30db5508e18",
+ "url": "https://api.github.com/repos/symfony/Debug/zipball/91e3a1480c67601d2406cd938735abe0243e1c95",
+ "reference": "91e3a1480c67601d2406cd938735abe0243e1c95",
"shasum": ""
},
"require": {
@@ -255,33 +251,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Debug Component",
"homepage": "http://symfony.com",
- "time": "2014-04-29 19:42:43"
+ "time": "2014-07-07 10:13:42"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
- "reference": "5ebd813eac59b4051705a2e29e32f211a966b6ca"
+ "reference": "5ee5795515be251c56057d79154e561ee1efecd2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/5ebd813eac59b4051705a2e29e32f211a966b6ca",
- "reference": "5ebd813eac59b4051705a2e29e32f211a966b6ca",
+ "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/5ee5795515be251c56057d79154e561ee1efecd2",
+ "reference": "5ee5795515be251c56057d79154e561ee1efecd2",
"shasum": ""
},
"require": {
@@ -313,33 +307,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony DependencyInjection Component",
"homepage": "http://symfony.com",
- "time": "2014-05-02 22:42:57"
+ "time": "2014-08-27 08:32:18"
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "cb7cd38c081507d10997553c4c522956a4d2afab"
+ "reference": "2c64e46d7e22bcafcab4413ff62bc389abf87ea5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/cb7cd38c081507d10997553c4c522956a4d2afab",
- "reference": "cb7cd38c081507d10997553c4c522956a4d2afab",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/2c64e46d7e22bcafcab4413ff62bc389abf87ea5",
+ "reference": "2c64e46d7e22bcafcab4413ff62bc389abf87ea5",
"shasum": ""
},
"require": {
@@ -369,33 +361,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
- "time": "2014-04-16 10:30:19"
+ "time": "2014-07-25 15:00:14"
},
{
"name": "symfony/filesystem",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
- "reference": "69e476c4db31c43ab7ab797adc5fc73d20aa5571"
+ "reference": "007359d2822d5eba4f04f6507bc9b46877c622b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/69e476c4db31c43ab7ab797adc5fc73d20aa5571",
- "reference": "69e476c4db31c43ab7ab797adc5fc73d20aa5571",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/007359d2822d5eba4f04f6507bc9b46877c622b4",
+ "reference": "007359d2822d5eba4f04f6507bc9b46877c622b4",
"shasum": ""
},
"require": {
@@ -418,33 +408,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Filesystem Component",
"homepage": "http://symfony.com",
- "time": "2014-04-16 10:30:19"
+ "time": "2014-08-31 03:30:23"
},
{
"name": "symfony/http-foundation",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "ad7891d4dfe221c5a9edca64b71bdb500f5b026a"
+ "reference": "d0125fed988da9e189864c2e6de967b3ee7f1d98"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/ad7891d4dfe221c5a9edca64b71bdb500f5b026a",
- "reference": "ad7891d4dfe221c5a9edca64b71bdb500f5b026a",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/d0125fed988da9e189864c2e6de967b3ee7f1d98",
+ "reference": "d0125fed988da9e189864c2e6de967b3ee7f1d98",
"shasum": ""
},
"require": {
@@ -470,33 +458,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
- "time": "2014-05-22 16:20:26"
+ "time": "2014-09-03 07:39:11"
},
{
"name": "symfony/http-kernel",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
- "reference": "d8c00747f592183692afaacf622c444c36092613"
+ "reference": "a24817f69012b23ce7c554af6b4c7b53235c7c55"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/d8c00747f592183692afaacf622c444c36092613",
- "reference": "d8c00747f592183692afaacf622c444c36092613",
+ "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a24817f69012b23ce7c554af6b4c7b53235c7c55",
+ "reference": "a24817f69012b23ce7c554af6b4c7b53235c7c55",
"shasum": ""
},
"require": {
@@ -543,33 +529,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com",
- "time": "2014-05-31 02:04:21"
+ "time": "2014-09-03 09:45:27"
},
{
"name": "symfony/routing",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
- "reference": "6e4c9024a04340b83e456a1a24597dba066dcdc9"
+ "reference": "aa2beef5d5f1d84250b5ca73a4056c0504e5969e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Routing/zipball/6e4c9024a04340b83e456a1a24597dba066dcdc9",
- "reference": "6e4c9024a04340b83e456a1a24597dba066dcdc9",
+ "url": "https://api.github.com/repos/symfony/Routing/zipball/aa2beef5d5f1d84250b5ca73a4056c0504e5969e",
+ "reference": "aa2beef5d5f1d84250b5ca73a4056c0504e5969e",
"shasum": ""
},
"require": {
@@ -603,33 +587,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Routing Component",
"homepage": "http://symfony.com",
- "time": "2014-04-23 13:35:47"
+ "time": "2014-08-15 09:05:55"
},
{
"name": "symfony/yaml",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "2e257c292cfce88bf6c894a03d0fe8d782055aee"
+ "reference": "71ceeca3d8164f0c5313127b24ad056071ccf2c6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/2e257c292cfce88bf6c894a03d0fe8d782055aee",
- "reference": "2e257c292cfce88bf6c894a03d0fe8d782055aee",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/71ceeca3d8164f0c5313127b24ad056071ccf2c6",
+ "reference": "71ceeca3d8164f0c5313127b24ad056071ccf2c6",
"shasum": ""
},
"require": {
@@ -652,19 +634,17 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2014-05-12 09:13:35"
+ "time": "2014-08-28 01:42:35"
},
{
"name": "twig/twig",
@@ -2007,17 +1987,17 @@
},
{
"name": "symfony/browser-kit",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/BrowserKit",
"source": {
"type": "git",
"url": "https://github.com/symfony/BrowserKit.git",
- "reference": "bc6cb0fe5196ecfe183483791928ed525ac41728"
+ "reference": "262d698efaa788ce24ff9c987378789bf3f81ce9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/bc6cb0fe5196ecfe183483791928ed525ac41728",
- "reference": "bc6cb0fe5196ecfe183483791928ed525ac41728",
+ "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/262d698efaa788ce24ff9c987378789bf3f81ce9",
+ "reference": "262d698efaa788ce24ff9c987378789bf3f81ce9",
"shasum": ""
},
"require": {
@@ -2048,33 +2028,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony BrowserKit Component",
"homepage": "http://symfony.com",
- "time": "2014-04-22 14:58:51"
+ "time": "2014-08-05 07:20:55"
},
{
"name": "symfony/css-selector",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/CssSelector",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector.git",
- "reference": "2ff53e8a7870b453836e879b083b971d455e174d"
+ "reference": "8953d325d3341c246abadb79be172de95ef80664"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/CssSelector/zipball/2ff53e8a7870b453836e879b083b971d455e174d",
- "reference": "2ff53e8a7870b453836e879b083b971d455e174d",
+ "url": "https://api.github.com/repos/symfony/CssSelector/zipball/8953d325d3341c246abadb79be172de95ef80664",
+ "reference": "8953d325d3341c246abadb79be172de95ef80664",
"shasum": ""
},
"require": {
@@ -2097,37 +2075,35 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony CssSelector Component",
"homepage": "http://symfony.com",
- "time": "2014-05-12 09:13:35"
+ "time": "2014-08-27 08:24:06"
},
{
"name": "symfony/dom-crawler",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/DomCrawler",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler.git",
- "reference": "5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8"
+ "reference": "bad8d98561f071639fa67b20680bffcc256ce252"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8",
- "reference": "5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8",
+ "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/bad8d98561f071639fa67b20680bffcc256ce252",
+ "reference": "bad8d98561f071639fa67b20680bffcc256ce252",
"shasum": ""
},
"require": {
@@ -2156,33 +2132,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony DomCrawler Component",
"homepage": "http://symfony.com",
- "time": "2014-05-26 22:15:18"
+ "time": "2014-08-21 00:21:59"
},
{
"name": "symfony/finder",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
- "reference": "32949721cc76afd75e4ac60d14ac3cf55b10a768"
+ "reference": "f7a5a5a3b1fc0ec9a1a5b4429223a8726e0f4b55"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Finder/zipball/32949721cc76afd75e4ac60d14ac3cf55b10a768",
- "reference": "32949721cc76afd75e4ac60d14ac3cf55b10a768",
+ "url": "https://api.github.com/repos/symfony/Finder/zipball/f7a5a5a3b1fc0ec9a1a5b4429223a8726e0f4b55",
+ "reference": "f7a5a5a3b1fc0ec9a1a5b4429223a8726e0f4b55",
"shasum": ""
},
"require": {
@@ -2205,33 +2179,31 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
- "time": "2014-05-22 13:42:36"
+ "time": "2014-08-31 04:03:32"
},
{
"name": "symfony/process",
- "version": "v2.3.16",
+ "version": "v2.3.19",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
- "reference": "2cd7d075df6cb0d564c069a66408b3877c07d4e3"
+ "reference": "b8fc0e4b6750e4c458a38d038e6b4d538d4fe2bb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Process/zipball/2cd7d075df6cb0d564c069a66408b3877c07d4e3",
- "reference": "2cd7d075df6cb0d564c069a66408b3877c07d4e3",
+ "url": "https://api.github.com/repos/symfony/Process/zipball/b8fc0e4b6750e4c458a38d038e6b4d538d4fe2bb",
+ "reference": "b8fc0e4b6750e4c458a38d038e6b4d538d4fe2bb",
"shasum": ""
},
"require": {
@@ -2254,19 +2226,17 @@
],
"authors": [
{
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
- },
- {
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
}
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com",
- "time": "2014-05-17 21:49:26"
+ "time": "2014-08-28 09:02:24"
}
],
"aliases": [
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml
index db7c603bcd..89303a684a 100644
--- a/phpBB/config/auth_providers.yml
+++ b/phpBB/config/auth_providers.yml
@@ -52,6 +52,7 @@ services:
- %tables.auth_provider_oauth_account_assoc%
- @auth.provider.oauth.service_collection
- %tables.users%
+ - @service_container
- %core.root_path%
- %core.php_ext%
tags:
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..cca655263f 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%
@@ -157,21 +158,6 @@ services:
arguments:
- @dbal.conn
- event.subscriber_loader:
- class: phpbb\event\extension_subscriber_loader
- arguments:
- - @dispatcher
- - @event.listener_collection
- calls:
- - [load, []]
-
- event.listener_collection:
- class: phpbb\di\service_collection
- arguments:
- - @service_container
- tags:
- - { name: service_collection, tag: event.listener }
-
ext.manager:
class: phpbb\extension\manager
arguments:
@@ -328,6 +314,9 @@ services:
request:
class: phpbb\request\request
+ arguments:
+ - null
+ - %core.disable_super_globals%
symfony_request:
class: phpbb\symfony_request
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index 4f39e71c3c..e1308c71d1 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -434,6 +434,38 @@ memberlist_view_user_statistics_before
* Since: 3.1.0-a1
* Purpose: Add entries before the user statistics part of any user profile
+mcp_warn_post_add_warning_field_after
+===
+* Locations:
+ + styles/prosilver/template/mcp_warn_post.html
+ + styles/subsilver2/template/mcp_warn_post.html
+* Since: 3.1.0-RC4
+* Purpose: Add content during warning for a post - after add warning field.
+
+mcp_warn_post_add_warning_field_before
+===
+* Locations:
+ + styles/prosilver/template/mcp_warn_post.html
+ + styles/subsilver2/template/mcp_warn_post.html
+* Since: 3.1.0-RC4
+* Purpose: Add content during warning for a post - before add warning field.
+
+mcp_warn_user_add_warning_field_after
+===
+* Locations:
+ + styles/prosilver/template/mcp_warn_user.html
+ + styles/subsilver2/template/mcp_warn_user.html
+* Since: 3.1.0-RC4
+* Purpose: Add content during warning a user - after add warning field.
+
+mcp_warn_user_add_warning_field_before
+===
+* Locations:
+ + styles/prosilver/template/mcp_warn_user.html
+ + styles/subsilver2/template/mcp_warn_user.html
+* Since: 3.1.0-RC4
+* Purpose: Add content during warning a user - before add warning field.
+
navbar_header_logged_out_content
===
* Locations:
@@ -732,6 +764,22 @@ posting_editor_subject_before
* Since: 3.1.0-a2
* Purpose: Add field (e.g. textbox) to the posting screen before the subject
+posting_pm_header_find_username_after
+===
+* Locations:
+ + styles/prosilver/template/posting_pm_header.html
+ + styles/subsilver2/template/ucp_header.html
+* Since: 3.1.0-RC4
+* Purpose: Add content after the find username link on composing pm
+
+posting_pm_header_find_username_before
+===
+* Locations:
+ + styles/prosilver/template/posting_pm_header.html
+ + styles/subsilver2/template/ucp_header.html
+* Since: 3.1.0-RC4
+* Purpose: Add content before the find username link on composing pm
+
quickreply_editor_panel_after
===
* Locations:
@@ -1227,6 +1275,14 @@ viewtopic_body_postrow_post_before
* Since: 3.1.0-a4
* Purpose: Add data before posts
+viewtopic_body_postrow_post_content_footer
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC4
+* Purpose: Add data at the end of the posts.
+
viewtopic_body_postrow_post_notices_after
===
* Locations:
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index fd94e78fee..77fb455bc1 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -56,6 +56,8 @@ if (isset($_GET['avatar']))
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
+ phpbb_load_extensions_autoloaders($phpbb_root_path);
+
// Set up container
$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
$phpbb_container = $phpbb_container_builder->get_container();
@@ -81,7 +83,6 @@ if (isset($_GET['avatar']))
// load extensions
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
- $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
// worst-case default
$browser = strtolower($request->header('User-Agent', 'msie 6.0'));
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/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index fda6ef25ec..046281596c 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -112,58 +112,8 @@ class acp_profile
$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id");
$db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id");
- switch ($db->get_sql_layer())
- {
- case 'sqlite':
- case 'sqlite3':
- $sql = "SELECT sql
- FROM sqlite_master
- WHERE type = 'table'
- AND name = '" . PROFILE_FIELDS_DATA_TABLE . "'
- ORDER BY type DESC, name;";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // Create a temp table and populate it, destroy the existing one
- $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql']));
- $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE);
- $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE);
-
- preg_match('#\((.*)\)#s', $row['sql'], $matches);
-
- $new_table_cols = trim($matches[1]);
- $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols);
- $column_list = array();
-
- foreach ($old_table_cols as $declaration)
- {
- $entities = preg_split('#\s+#', trim($declaration));
-
- if ($entities[0] == 'PRIMARY')
- {
- continue;
- }
-
- if ($entities[0] !== 'pf_' . $field_ident)
- {
- $column_list[] = $entities[0];
- }
- }
-
- $columns = implode(',', $column_list);
-
- $new_table_cols = preg_replace('/' . 'pf_' . $field_ident . '[^,]+,/', '', $new_table_cols);
-
- // create a new table and fill it up. destroy the temp one
- $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');');
- $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;');
- $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp');
- break;
-
- default:
- $db->sql_query('ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " DROP COLUMN pf_$field_ident");
- }
+ $db_tools = $phpbb_container->get('dbal.tools');
+ $db_tools->sql_column_remove(PROFILE_FIELDS_DATA_TABLE, 'pf_' . $field_ident);
$order = 0;
@@ -932,9 +882,7 @@ class acp_profile
$field_ident = 'pf_' . $field_ident;
$db_tools = $phpbb_container->get('dbal.tools');
-
- list($sql_type, $null) = $db_tools->get_column_type($profile_field->get_database_column_type());
- $profile_sql[] = $this->add_field_ident($field_ident, $sql_type);
+ $db_tools->sql_column_add(PROFILE_FIELDS_DATA_TABLE, $field_ident, array($profile_field->get_database_column_type(), null));
}
$sql_ary = array(
@@ -1188,91 +1136,4 @@ class acp_profile
}
}
}
-
- /**
- * Return sql statement for adding a new field ident (profile field) to the profile fields data table
- */
- function add_field_ident($field_ident, $sql_type)
- {
- global $db;
-
- switch ($db->get_sql_layer())
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `$field_ident` " . $sql_type;
-
- break;
-
- case 'sqlite':
- case 'sqlite3':
- if (version_compare($db->sql_server_info(true), '3.0') == -1)
- {
- $sql = "SELECT sql
- FROM sqlite_master
- WHERE type = 'table'
- AND name = '" . PROFILE_FIELDS_DATA_TABLE . "'
- ORDER BY type DESC, name;";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // Create a temp table and populate it, destroy the existing one
- $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql']));
- $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE);
- $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE);
-
- preg_match('#\((.*)\)#s', $row['sql'], $matches);
-
- $new_table_cols = trim($matches[1]);
- $old_table_cols = explode(',', $new_table_cols);
- $column_list = array();
-
- foreach ($old_table_cols as $declaration)
- {
- $entities = preg_split('#\s+#', trim($declaration));
- if ($entities[0] == 'PRIMARY')
- {
- continue;
- }
- $column_list[] = $entities[0];
- }
-
- $columns = implode(',', $column_list);
-
- $new_table_cols = $field_ident . ' ' . $sql_type . ',' . $new_table_cols;
-
- // create a new table and fill it up. destroy the temp one
- $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');');
- $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;');
- $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp');
- }
- else
- {
- $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident [$sql_type]";
- }
-
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- case 'mssqlnative':
- $sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] " . $sql_type;
-
- break;
-
- case 'postgres':
- $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD COLUMN \"$field_ident\" " . $sql_type;
-
- break;
-
- case 'oracle':
- $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident " . $sql_type;
-
- break;
- }
-
- return $sql;
- }
}
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 58f9643dc9..40d8218a07 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -404,7 +404,7 @@ class acp_users
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']);
+ $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php
index 2a60f7fb8e..54c9287c96 100644
--- a/phpBB/includes/compatibility_globals.php
+++ b/phpBB/includes/compatibility_globals.php
@@ -43,6 +43,5 @@ $phpbb_path_helper = $phpbb_container->get('path_helper');
// load extensions
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
-$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $phpbb_container->get('template');
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index c838876ddd..a61518401c 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -289,7 +289,6 @@ function phpbb_gmgetdate($time = false)
* @param array $allowed_units only allow these units (data array indexes)
*
* @return mixed data array if $string_only is false
-* @author bantu
*/
function get_formatted_filesize($value, $string_only = true, $allowed_units = false)
{
@@ -463,7 +462,6 @@ function phpbb_version_compare($version1, $version2, $operator = null)
* @param int $perms Permissions to set
*
* @return bool true on success, otherwise false
-* @author faw, phpBB Limited
*/
function phpbb_chmod($filename, $perms = CHMOD_READ)
{
@@ -1146,12 +1144,12 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
// Mark all topic notifications read for this user
$phpbb_notifications->mark_notifications_read(array(
- 'topic',
- 'quote',
- 'bookmark',
- 'post',
- 'approve_topic',
- 'approve_post',
+ 'notification.type.topic',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_topic',
+ 'notification.type.approve_post',
), false, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -1211,8 +1209,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'topic',
- 'approve_topic',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
), $forum_id, $user->data['user_id'], $post_time);
// Mark all post/quote notifications read for this user in this forum
@@ -1228,10 +1226,10 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$db->sql_freeresult($result);
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'quote',
- 'bookmark',
- 'post',
- 'approve_post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_post',
), $topic_ids, $user->data['user_id'], $post_time);
// Add 0 to forums array to mark global announcements correctly
@@ -1334,15 +1332,15 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
// Mark post notifications read for this user in this topic
$phpbb_notifications->mark_notifications_read(array(
- 'topic',
- 'approve_topic',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
), $topic_id, $user->data['user_id'], $post_time);
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'quote',
- 'bookmark',
- 'post',
- 'approve_post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_post',
), $topic_id, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -1638,7 +1636,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
if (empty($sql_sort))
{
- $sql_sort = 'ORDER BY t.topic_last_post_time DESC';
+ $sql_sort = 'ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC';
}
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -1991,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>
@@ -2001,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;
@@ -2013,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);
}
@@ -2039,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)
@@ -2578,15 +2580,17 @@ function add_form_key($form_name)
}
/**
-* Check the form key. Required for all altering actions not secured by confirm_box
-* @param string $form_name The name of the form; has to match the name used in add_form_key, otherwise no restrictions apply
-* @param int $timespan The maximum acceptable age for a submitted form in seconds. Defaults to the config setting.
-* @param string $return_page The address for the return link
-* @param bool $trigger If true, the function will triger an error when encountering an invalid form
-*/
-function check_form_key($form_name, $timespan = false, $return_page = '', $trigger = false)
+ * Check the form key. Required for all altering actions not secured by confirm_box
+ *
+ * @param string $form_name The name of the form; has to match the name used
+ * in add_form_key, otherwise no restrictions apply
+ * @param int $timespan The maximum acceptable age for a submitted form
+ * in seconds. Defaults to the config setting.
+ * @return bool True, if the form key was valid, false otherwise
+ */
+function check_form_key($form_name, $timespan = false)
{
- global $config, $user;
+ global $config, $request, $user;
if ($timespan === false)
{
@@ -2594,10 +2598,10 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg
$timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']);
}
- if (isset($_POST['creation_time']) && isset($_POST['form_token']))
+ if ($request->is_set_post('creation_time') && $request->is_set_post('form_token'))
{
- $creation_time = abs(request_var('creation_time', 0));
- $token = request_var('form_token', '');
+ $creation_time = abs($request->variable('creation_time', 0));
+ $token = $request->variable('form_token', '');
$diff = time() - $creation_time;
@@ -2614,11 +2618,6 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg
}
}
- if ($trigger)
- {
- trigger_error($user->lang['FORM_INVALID'] . $return_page);
- }
-
return false;
}
@@ -2834,8 +2833,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
if ($result['status'] == LOGIN_SUCCESS)
{
$redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
- $message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
- $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
// append/replace SID (may change during the session for AOL users)
$redirect = reapply_sid($redirect);
@@ -3404,8 +3401,6 @@ function short_ipv6($ip, $length)
*
* @return mixed false if specified address is not valid,
* string otherwise
-*
-* @author bantu
*/
function phpbb_ip_normalise($address)
{
@@ -3434,8 +3429,6 @@ function phpbb_ip_normalise($address)
*
* @return mixed false on failure,
* string otherwise
-*
-* @author APTX
*/
function phpbb_inet_ntop($in_addr)
{
@@ -3505,8 +3498,6 @@ function phpbb_inet_ntop($in_addr)
*
* @return mixed false if address is invalid,
* in_addr representation of the given address otherwise (string)
-*
-* @author APTX
*/
function phpbb_inet_pton($address)
{
@@ -3586,8 +3577,6 @@ function phpbb_inet_pton($address)
*
* Since null can also be returned, you probably want to compare the result
* with === true or === false,
-*
-* @author bantu
*/
function phpbb_checkdnsrr($host, $type = 'MX')
{
@@ -4674,7 +4663,7 @@ function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config
/**
* Get avatar
*
-* @param array $row Row cleaned by \phpbb\avatar\driver\driver::clean_row
+* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
*
@@ -5073,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_admin.php b/phpBB/includes/functions_admin.php
index accc8a6a83..e3e8657afb 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -27,8 +27,6 @@ if (!defined('IN_PHPBB'))
* @param string $table constant or fullname of the table
* @param int $parent_id parent_id of the current set (default = 0)
* @param array $where contains strings to compare closer on the where statement (additional)
-*
-* @author EXreaction
*/
function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array())
{
@@ -315,8 +313,6 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl
* @param bool $add_log True if log entry should be added
*
* @return bool False on error
-*
-* @author bantu
*/
function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true)
{
@@ -722,9 +718,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications(array(
- 'topic',
- 'approve_topic',
- 'topic_in_queue',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
+ 'notification.type.topic_in_queue',
), $topic_ids);
return $return;
@@ -739,9 +735,9 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
// Notifications types to delete
$delete_notifications_types = array(
- 'quote',
- 'approve_post',
- 'post_in_queue',
+ 'notification.type.quote',
+ 'notification.type.approve_post',
+ 'notification.type.post_in_queue',
);
/**
@@ -1224,8 +1220,6 @@ function delete_attachments($mode, $ids, $resync = true)
* @param bool $auto_sync Will call sync() if this is true
*
* @return array Array with affected forums
-*
-* @author bantu
*/
function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true)
{
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index ee78364083..f275ed1dd1 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -1323,7 +1323,6 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al
* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &amp;u={user_id}
*
* @return string A string consisting of what is wanted based on $mode.
-* @author BartVB, Acyd Burn
*/
function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
{
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 78137d075b..85d9496061 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -379,10 +379,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$last_catless = true;
foreach ($forum_rows as $row)
{
- // Empty category
+ // Category
if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT)
{
- $template->assign_block_vars('forumrow', array(
+ $cat_row = array(
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
@@ -391,9 +391,33 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'FORUM_FOLDER_IMG_SRC' => '',
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
- 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']))
+ 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
);
+ /**
+ * Modify the template data block of the 'category'
+ *
+ * This event is triggered once per 'category'
+ *
+ * @event core.display_forums_modify_category_template_vars
+ * @var array cat_row Template data of the 'category'
+ * @var bool catless The flag indicating whether the 'category' has a parent category
+ * @var bool last_catless The flag indicating whether the last forum had a parent category
+ * @var array root_data Array with the root forum data
+ * @var array row The data of the 'category'
+ * @since 3.1.0-RC4
+ */
+ $vars = array(
+ 'cat_row',
+ 'catless',
+ 'last_catless',
+ 'root_data',
+ 'row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_category_template_vars', compact($vars)));
+
+ $template->assign_block_vars('forumrow', $cat_row);
+
continue;
}
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_mcp.php b/phpBB/includes/functions_mcp.php
index 7593f08f4d..811d49f1de 100644
--- a/phpBB/includes/functions_mcp.php
+++ b/phpBB/includes/functions_mcp.php
@@ -521,21 +521,21 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
break;
case 'posts':
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
- $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject');
+ $sort_by_sql = array('a' => 'u.username_clean', 't' => array('p.post_time', 'p.post_id'), 's' => 'p.post_subject');
$limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : '';
break;
case 'reports':
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
- $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject');
+ $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => array('p.post_time', 'p.post_id'), 't' => 'r.report_time', 's' => 'p.post_subject');
break;
case 'pm_reports':
@@ -558,7 +558,16 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
$sort_key = $default_key;
}
- $sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
+ $direction = ($sort_dir == 'd') ? 'DESC' : 'ASC';
+
+ if (is_array($sort_by_sql[$sort_key]))
+ {
+ $sort_order_sql = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
+ }
+ else
+ {
+ $sort_order_sql = $sort_by_sql[$sort_key] . ' ' . $direction;
+ }
$s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 624ce187b9..1fdc7ee9ea 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1040,6 +1040,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
global $config, $phpbb_root_path, $phpEx, $phpbb_container;
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ $sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC';
// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
@@ -1048,8 +1049,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . '
- ORDER BY p.post_time ';
- $sql .= ($mode == 'post_review') ? 'ASC' : 'DESC';
+ ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort;
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
$post_list = array();
@@ -1342,7 +1342,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_visibility = " . ITEM_APPROVED . '
- ORDER BY p.post_time ASC';
+ ORDER BY p.post_time ASC, p.post_id ASC';
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1354,7 +1354,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
- ORDER BY p.post_time ASC";
+ ORDER BY p.post_time ASC, p.post_id ASC";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1409,7 +1409,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
WHERE topic_id = $topic_id
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . '
AND post_time > ' . $data['post_time'] . '
- ORDER BY post_time ASC';
+ ORDER BY post_time ASC, post_id ASC';
$result = $db->sql_query_limit($sql, 1);
$next_post_id = (int) $db->sql_fetchfield('post_id');
$db->sql_freeresult($result);
@@ -2256,17 +2256,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
case 'post':
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'topic',
+ 'notification.type.quote',
+ 'notification.type.topic',
), $notification_data);
break;
case 'reply':
case 'quote':
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'bookmark',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $notification_data);
break;
@@ -2275,10 +2275,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit':
case 'edit_last_post':
$phpbb_notifications->update_notifications(array(
- 'quote',
- 'bookmark',
- 'topic',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.topic',
+ 'notification.type.post',
), $notification_data);
break;
}
@@ -2288,12 +2288,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
switch ($mode)
{
case 'post':
- $phpbb_notifications->add_notifications('topic_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data);
break;
case 'reply':
case 'quote':
- $phpbb_notifications->add_notifications('post_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data);
break;
case 'edit_topic':
@@ -2310,20 +2310,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
case 'edit_topic':
case 'edit_first_post':
- $phpbb_notifications->add_notifications('topic_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data);
// Delete the approve_post notification so we can notify the user again,
// when his post got reapproved
- $phpbb_notifications->delete_notifications('approve_post', $notification_data['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']);
break;
case 'edit':
case 'edit_last_post':
- $phpbb_notifications->add_notifications('post_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data);
// Delete the approve_post notification so we can notify the user again,
// when his post got reapproved
- $phpbb_notifications->delete_notifications('approve_post', $notification_data['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']);
break;
case 'post':
@@ -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/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 488f46a398..29cea477e4 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -883,7 +883,7 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id)
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read('pm', $msg_id, $user_id);
+ $phpbb_notifications->mark_notifications_read('notification.type.pm', $msg_id, $user_id);
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
SET pm_unread = 0
@@ -1114,7 +1114,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('pm', array_keys($delete_rows));
+ $phpbb_notifications->delete_notifications('notification.type.pm', array_keys($delete_rows));
// Now we have to check which messages we can delete completely
$sql = 'SELECT msg_id
@@ -1296,7 +1296,7 @@ function phpbb_delete_users_pms($user_ids)
AND ' . $db->sql_in_set('msg_id', $delivered_msg);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $delivered_msg);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $delivered_msg);
}
if (!empty($undelivered_msg))
@@ -1309,7 +1309,7 @@ function phpbb_delete_users_pms($user_ids)
WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $undelivered_msg);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $undelivered_msg);
}
}
@@ -1353,7 +1353,7 @@ function phpbb_delete_users_pms($user_ids)
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $delete_ids);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $delete_ids);
}
}
@@ -1911,11 +1911,11 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
if ($mode == 'edit')
{
- $phpbb_notifications->update_notifications('pm', $pm_data);
+ $phpbb_notifications->update_notifications('notification.type.pm', $pm_data);
}
else
{
- $phpbb_notifications->add_notifications('pm', $pm_data);
+ $phpbb_notifications->add_notifications('notification.type.pm', $pm_data);
}
/**
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index fca183a225..42fdee364c 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -507,8 +507,6 @@ class ftp extends transfer
/**
* FTP fsock transfer class
-*
-* @author wGEric
*/
class ftp_fsock extends transfer
{
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index a0a67ccf3d..f179b2fd70 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -232,7 +232,12 @@ class filespec
{
if ($this->mimetype_guesser !== null)
{
- $this->mimetype = $this->mimetype_guesser->guess($filename);
+ $mimetype = $this->mimetype_guesser->guess($filename, $this->uploadname);
+
+ if ($mimetype !== 'application/octet-stream')
+ {
+ $this->mimetype = $mimetype;
+ }
}
return $this->mimetype;
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index d39be50251..38ae34c66c 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2675,7 +2675,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
foreach ($add_id_ary as $user_id)
{
- $phpbb_notifications->add_notifications('group_request', array(
+ $phpbb_notifications->add_notifications('notification.type.group_request', array(
'group_id' => $group_id,
'user_id' => $user_id,
'group_name' => $group_name,
@@ -2832,7 +2832,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id);
+ $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id);
// Return false - no error
return false;
@@ -2996,12 +2996,12 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->add_notifications('group_request_approved', array(
+ $phpbb_notifications->add_notifications('notification.type.group_request_approved', array(
'user_ids' => $user_id_ary,
'group_id' => $group_id,
'group_name' => $group_name,
));
- $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id);
+ $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id);
$log = 'LOG_USERS_APPROVED';
break;
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index b4ec0092e7..ebcf7ce643 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -66,7 +66,7 @@ function mcp_front_view($id, $mode, $action)
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . '
- ORDER BY post_time DESC';
+ ORDER BY post_time DESC, post_id DESC';
$result = $db->sql_query_limit($sql, 5);
while ($row = $db->sql_fetchrow($result))
@@ -101,7 +101,7 @@ function mcp_front_view($id, $mode, $action)
WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
AND t.topic_id = p.topic_id
AND p.poster_id = u.user_id
- ORDER BY p.post_time DESC';
+ ORDER BY p.post_time DESC, p.post_id DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -190,7 +190,7 @@ function mcp_front_view($id, $mode, $action)
AND p.poster_id = u2.user_id
AND ' . $db->sql_in_set('p.forum_id', $forum_list),
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
/**
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 92000c6ceb..74bf687fc8 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -161,9 +161,13 @@ class mcp_main
* This event allows you to handle custom quickmod options
*
* @event core.modify_quickmod_actions
+ * @var string action Topic quick moderation action name
+ * @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4
+ * @change 3.1.0-RC4 Added variables: action, quickmod
*/
- $phpbb_dispatcher->dispatch('core.modify_quickmod_actions');
+ $vars = array('action', 'quickmod');
+ extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
break;
}
@@ -1265,7 +1269,7 @@ function mcp_fork_topic($topic_ids)
$sql = 'SELECT *
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
- ORDER BY post_time ASC";
+ ORDER BY post_time ASC, post_id ASC";
$result = $db->sql_query($sql);
$post_rows = array();
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index 03e4ed4722..d76bedba98 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -95,7 +95,7 @@ class mcp_pm_reports
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read_by_parent('report_pm', $report_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read_by_parent('notification.type.report_pm', $report_id, $user->data['user_id']);
$pm_id = $report['pm_id'];
$report_id = $report['report_id'];
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index b7e47163a6..bfd30a5be2 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -165,7 +165,7 @@ class mcp_queue
{
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
- $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.topic_in_queue', $topic_id, $user->data['user_id']);
}
else
{
@@ -173,7 +173,7 @@ class mcp_queue
}
}
- $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.post_in_queue', $post_id, $user->data['user_id']);
$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);
@@ -701,11 +701,11 @@ class mcp_queue
// A single topic approval may also happen here, so handle deleting the respective notification.
if (!$post_data['topic_posts_approved'])
{
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']);
if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
{
- $phpbb_notifications->add_notifications(array('topic'), $post_data);
+ $phpbb_notifications->add_notifications(array('notification.type.topic'), $post_data);
}
if ($post_data['post_visibility'] != ITEM_APPROVED)
{
@@ -721,18 +721,18 @@ class mcp_queue
if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
{
$phpbb_notifications->add_notifications(array(
- 'bookmark',
- 'post',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $post_data);
}
}
- $phpbb_notifications->add_notifications(array('quote'), $post_data);
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+ $phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data);
+ $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);
$phpbb_notifications->mark_notifications_read(array(
- 'quote',
- 'bookmark',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $post_data['post_id'], $user->data['user_id']);
// Notify Poster?
@@ -745,11 +745,11 @@ class mcp_queue
if (!$post_data['topic_posts_approved'])
{
- $phpbb_notifications->add_notifications('approve_post', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data);
}
else
{
- $phpbb_notifications->add_notifications('approve_topic', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data);
}
}
}
@@ -921,7 +921,7 @@ class mcp_queue
'post_username' => $topic_data['topic_first_poster_name'],
));
- $phpbb_notifications->delete_notifications('topic_in_queue', $topic_id);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $topic_id);
// Only add notifications, if we are not reapproving post
// When the topic was already approved, but was edited and
@@ -930,17 +930,17 @@ class mcp_queue
if ($topic_data['topic_visibility'] == ITEM_UNAPPROVED)
{
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'topic',
+ 'notification.type.quote',
+ 'notification.type.topic',
), $topic_data);
}
- $phpbb_notifications->mark_notifications_read('quote', $topic_data['post_id'], $user->data['user_id']);
- $phpbb_notifications->mark_notifications_read('topic', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.quote', $topic_data['post_id'], $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.topic', $topic_id, $user->data['user_id']);
if ($notify_poster)
{
- $phpbb_notifications->add_notifications('approve_topic', $topic_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_topic', $topic_data);
}
}
}
@@ -1178,12 +1178,12 @@ class mcp_queue
$topic_information[$topic_id]['topic_posts_softdeleted'] == 0 &&
$topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id];
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+ $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);
// Do we disapprove the whole topic? Remove potential notifications
if ($disapprove_all_posts_in_topic)
{
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']);
}
// Notify Poster?
@@ -1228,13 +1228,13 @@ class mcp_queue
{
// If there is only 1 post when disapproving the topic,
// we send the user a "disapprove topic" notification...
- $phpbb_notifications->add_notifications('disapprove_topic', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.disapprove_topic', $post_data);
}
else
{
// ... otherwise there are multiple unapproved posts and
// all of them are disapproved as posts.
- $phpbb_notifications->add_notifications('disapprove_post', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.disapprove_post', $post_data);
}
}
}
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index a7d8bf18d6..804d48ea97 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -36,7 +36,7 @@ class mcp_reports
function main($id, $mode)
{
global $auth, $db, $user, $template, $cache;
- global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
+ global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container, $phpbb_dispatcher;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -92,7 +92,7 @@ class mcp_reports
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read('report_post', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']);
if (!$report_id && $report['report_closed'])
{
@@ -364,6 +364,27 @@ class mcp_reports
AND r.pm_id = 0
$limit_time_sql
ORDER BY $sort_order_sql";
+
+ /**
+ * Alter sql query to get report id of all reports for requested forum and topic or just forum
+ *
+ * @event core.mcp_reports_get_reports_query_before
+ * @var string sql String with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @var int topic_id topic_id in the page request
+ * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
+ * @var string sort_order_sql String with the ORDER BY SQL code used in this query
+ * @since 3.1.0-RC4
+ */
+ $vars = array(
+ 'sql',
+ 'forum_list',
+ 'topic_id',
+ 'limit_time_sql',
+ 'sort_order_sql',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_reports_get_reports_query_before', compact($vars)));
+
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$i = 0;
@@ -631,12 +652,12 @@ function close_report($report_id_list, $mode, $action, $pm = false)
if ($pm)
{
add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
- $phpbb_notifications->delete_notifications('report_pm', $report['pm_id']);
+ $phpbb_notifications->delete_notifications('notification.type.report_pm', $report['pm_id']);
}
else
{
add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
- $phpbb_notifications->delete_notifications('report_post', $report['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']);
}
}
@@ -654,7 +675,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
if ($pm)
{
- $phpbb_notifications->add_notifications('report_pm_closed', array_merge($post_info[$post_id], array(
+ $phpbb_notifications->add_notifications('notification.type.report_pm_closed', array_merge($post_info[$post_id], array(
'reporter' => $reporter['user_id'],
'closer_id' => $user->data['user_id'],
'from_user_id' => $post_info[$post_id]['author_id'],
@@ -662,7 +683,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
}
else
{
- $phpbb_notifications->add_notifications('report_post_closed', array_merge($post_info[$post_id], array(
+ $phpbb_notifications->add_notifications('notification.type.report_post_closed', array_merge($post_info[$post_id], array(
'reporter' => $reporter['user_id'],
'closer_id' => $user->data['user_id'],
)));
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index fb47522644..106b025757 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -535,7 +535,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
$message_parser = new parse_message();
- $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
+ $message_parser->message = $user->lang('WARNING_PM_BODY', $warning);
$message_parser->parse(true, true, true, false, false, true, true);
$pm_data = array(
@@ -553,7 +553,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
'address_list' => array('u' => array($user_row['user_id'] => 'to')),
);
- submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
+ submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false);
}
add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php
index 53dec89aad..6e357b260a 100644
--- a/phpBB/includes/ucp/ucp_activate.php
+++ b/phpBB/includes/ucp/ucp_activate.php
@@ -111,7 +111,7 @@ class ucp_activate
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']);
+ $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index aab45339c5..42724209aa 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -182,6 +182,7 @@ class ucp_attachments
$template->assign_vars(array(
'TOTAL_ATTACHMENTS' => $num_attachments,
+ 'NUM_ATTACHMENTS' => $user->lang('NUM_ATTACHMENTS', $num_attachments),
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 304c04eb3d..a1624e78ec 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -81,7 +81,7 @@ class ucp_main
FROM $sql_from
WHERE t.topic_type = " . POST_GLOBAL . '
AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
- ORDER BY t.topic_last_post_time DESC';
+ ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -693,7 +693,7 @@ class ucp_main
AND t.topic_id = tw.topic_id
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true),
- 'ORDER_BY' => 't.topic_last_post_time DESC'
+ 'ORDER_BY' => 't.topic_last_post_time DESC, t.topic_last_post_id DESC'
);
$sql_array['LEFT_JOIN'] = array();
@@ -710,7 +710,7 @@ class ucp_main
'WHERE' => 'b.user_id = ' . $user->data['user_id'] . '
AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true),
- 'ORDER_BY' => 't.topic_last_post_time DESC'
+ 'ORDER_BY' => 't.topic_last_post_time DESC, t.topic_last_post_id DESC'
);
$sql_array['LEFT_JOIN'] = array();
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 0ed3084e9f..5691302b83 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -58,21 +58,21 @@ class ucp_notifications
{
foreach($notification_methods as $method => $method_data)
{
- if ($request->is_set_post($type . '_' . $method_data['id']) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
+ if ($request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
{
$phpbb_notifications->add_subscription($type, 0, $method_data['id']);
}
- else if (!$request->is_set_post($type . '_' . $method_data['id']) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
+ else if (!$request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
}
}
- if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
+ if ($request->is_set_post(str_replace('.', '_', $type) . '_notification') && !isset($subscriptions[$type]))
{
$phpbb_notifications->add_subscription($type);
}
- else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
+ else if (!$request->is_set_post(str_replace('.', '_', $type) . '_notification') && isset($subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type);
}
diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php
index 353bfdc7ec..d1fc9d2c62 100644
--- a/phpBB/includes/ucp/ucp_pm_options.php
+++ b/phpBB/includes/ucp/ucp_pm_options.php
@@ -32,7 +32,11 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit
// Change "full folder" setting - what to do if folder is full
if (isset($_POST['fullfolder']))
{
- check_form_key('ucp_pm_options', $config['form_token_lifetime'], $redirect_url);
+ if (!check_form_key('ucp_pm_options'))
+ {
+ trigger_error('FORM_INVALID');
+ }
+
$full_action = request_var('full_action', 0);
$set_folder_id = 0;
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index a8c8920a7d..3ff8fe9ada 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -223,11 +223,11 @@ class ucp_prefs
$data = array(
'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'),
'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'),
- 'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0),
+ 'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? (int) $user->data['user_topic_show_days'] : 0),
'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'),
'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'),
- 'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0),
+ 'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? (int) $user->data['user_post_show_days'] : 0),
'images' => request_var('images', (bool) $user->optionget('viewimg')),
'flash' => request_var('flash', (bool) $user->optionget('viewflash')),
@@ -254,10 +254,22 @@ class ucp_prefs
if ($submit)
{
$error = validate_data($data, array(
- 'topic_sk' => array('string', false, 1, 1),
- 'topic_sd' => array('string', false, 1, 1),
- 'post_sk' => array('string', false, 1, 1),
- 'post_sd' => array('string', false, 1, 1),
+ 'topic_sk' => array(
+ array('string', false, 1, 1),
+ array('match', false, '#(a|r|s|t|v)#'),
+ ),
+ 'topic_sd' => array(
+ array('string', false, 1, 1),
+ array('match', false, '#(a|d)#'),
+ ),
+ 'post_sk' => array(
+ array('string', false, 1, 1),
+ array('match', false, '#(a|s|t)#'),
+ ),
+ 'post_sd' => array(
+ array('string', false, 1, 1),
+ array('match', false, '#(a|d)#'),
+ ),
));
if (!check_form_key('ucp_prefs_view'))
@@ -320,7 +332,7 @@ class ucp_prefs
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
// Post ordering options
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index a303197563..06baf7e5f2 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -389,7 +389,7 @@ class ucp_register
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->add_notifications('admin_activate_user', array(
+ $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array(
'user_id' => $user_id,
'user_actkey' => $user_row['user_actkey'],
'user_regdate' => $user_row['user_regdate'],
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..8016ff349b 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -177,11 +177,13 @@ $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('/migrations')
->get_classes();
+
$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/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 37e1c8de50..90b1ac8f92 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -813,9 +813,9 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s');
# User Notification Options (for first user)
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, 'email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email');
# POSTGRES COMMIT #
diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php
index 67813bcba4..d27deed602 100644
--- a/phpBB/language/en/acp/profile.php
+++ b/phpBB/language/en/acp/profile.php
@@ -99,7 +99,7 @@ $lang = array_merge($lang, array(
'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.',
'FIELD_INT' => 'Numbers',
'FIELD_IS_CONTACT' => 'Display field as a contact field',
- 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed with in the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages.',
+ 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages.',
'FIELD_LENGTH' => 'Length of input box',
'FIELD_NOT_FOUND' => 'Profile field not found.',
'FIELD_STRING' => 'Single text field',
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php
index eb0f5bb357..0e7dc39b95 100644
--- a/phpBB/language/en/cli.php
+++ b/phpBB/language/en/cli.php
@@ -73,6 +73,9 @@ $lang = array_merge($lang, array(
'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',
'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.',
+ 'CLI_EXTENSIONS_AVAILABLE' => 'Available',
+ 'CLI_EXTENSIONS_DISABLED' => 'Disabled',
+ 'CLI_EXTENSIONS_ENABLED' => 'Enabled',
'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.',
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 783faa8fad..83e1f4eaa1 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -518,6 +518,10 @@ $lang = array_merge($lang, array(
'NO_USER_SPECIFIED' => 'No username was specified.',
// Nullar/Singular/Plural language entry. The key numbers define the number range in which a certain grammatical expression is valid.
+ 'NUM_ATTACHMENTS' => array(
+ 1 => '%d attachment',
+ 2 => '%d attachments',
+ ),
'NUM_POSTS_IN_QUEUE' => array(
0 => 'No posts in queue', // 0
1 => '1 post in queue', // 1
@@ -864,6 +868,10 @@ $lang = array_merge($lang, array(
'WRONG_DATA_COLOUR' => 'The colour value you entered is invalid.',
'WRONG_DATA_JABBER' => 'The name you entered is not a valid Jabber account name.',
'WRONG_DATA_LANG' => 'The language you specified is not valid.',
+ 'WRONG_DATA_POST_SD' => 'The post sort direction you specified is not valid.',
+ 'WRONG_DATA_POST_SK' => 'The post sort option you specified is not valid.',
+ 'WRONG_DATA_TOPIC_SD' => 'The topic sort direction you specified is not valid.',
+ 'WRONG_DATA_TOPIC_SK' => 'The topic sort option you specified is not valid.',
'WROTE' => 'wrote',
'YAHOO' => 'Yahoo Messenger',
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/language/en/search.php b/phpBB/language/en/search.php
index 7d5b400f82..ec5dd99eb8 100644
--- a/phpBB/language/en/search.php
+++ b/phpBB/language/en/search.php
@@ -86,7 +86,7 @@ $lang = array_merge($lang, array(
'RESULT_DAYS' => 'Limit results to previous',
'RESULT_SORT' => 'Sort results by',
'RETURN_FIRST' => 'Return first',
- 'RETURN_TO_SEARCH_ADV' => 'Return to advanced search',
+ 'GO_TO_SEARCH_ADV' => 'Go to advanced search',
'SEARCHED_FOR' => 'Search term used',
'SEARCHED_TOPIC' => 'Searched topic',
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 7b71e3c844..902c6ae84c 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -91,6 +91,13 @@ class oauth extends \phpbb\auth\provider\base
protected $current_uri;
/**
+ * DI container
+ *
+ * @var \Symfony\Component\DependencyInjection\ContainerInterface
+ */
+ protected $phpbb_container;
+
+ /**
* phpBB root path
*
* @var string
@@ -116,10 +123,11 @@ class oauth extends \phpbb\auth\provider\base
* @param string $auth_provider_oauth_token_account_assoc
* @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface
* @param string $users_table
+ * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
@@ -130,6 +138,7 @@ class oauth extends \phpbb\auth\provider\base
$this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc;
$this->service_providers = $service_providers;
$this->users_table = $users_table;
+ $this->phpbb_container = $phpbb_container;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
@@ -160,7 +169,7 @@ class oauth extends \phpbb\auth\provider\base
// Temporary workaround for only having one authentication provider available
if (!$this->request->is_set('oauth_service'))
{
- $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext);
+ $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_container, $this->phpbb_root_path, $this->php_ext);
return $provider->login($username, $password);
}
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index c3caae5f70..86545c237d 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -119,6 +119,7 @@ class migrate extends \phpbb\console\command\command
->core_path('phpbb/db/migration/data/')
->extension_directory('/migrations')
->get_classes();
+
$this->migrator->set_migrations($migrations);
}
diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php
index 6ce9607098..f9322034d7 100644
--- a/phpBB/phpbb/console/command/extension/show.php
+++ b/phpBB/phpbb/console/command/extension/show.php
@@ -37,22 +37,22 @@ class show extends command
}
$enabled = array_keys($this->manager->all_enabled());
- $this->print_extension_list($output, 'Enabled', $enabled);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_ENABLED') . $this->user->lang('COLON'), $enabled);
$output->writeln('');
$disabled = array_keys($this->manager->all_disabled());
- $this->print_extension_list($output, 'Disabled', $disabled);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_DISABLED') . $this->user->lang('COLON'), $disabled);
$output->writeln('');
$purged = array_diff($all, $enabled, $disabled);
- $this->print_extension_list($output, 'Available', $purged);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_AVAILABLE') . $this->user->lang('COLON'), $purged);
}
protected function print_extension_list(OutputInterface $output, $type, array $extensions)
{
- $output->writeln("<info>$type:</info>");
+ $output->writeln("<info>$type</info>");
foreach ($extensions as $extension)
{
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/controller/provider.php b/phpBB/phpbb/controller/provider.php
index fffd4f0428..7e26848290 100644
--- a/phpBB/phpbb/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
@@ -73,7 +73,7 @@ class provider
$this->routes = new RouteCollection;
foreach ($this->routing_files as $file_path)
{
- $loader = new YamlFileLoader(new FileLocator($base_path));
+ $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));
$this->routes->addCollection($loader->load($file_path));
}
diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
new file mode 100644
index 0000000000..f749b32119
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
@@ -0,0 +1,122 @@
+<?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 phpbb\db\migration\data\v310;
+
+class notifications_use_full_name extends \phpbb\db\migration\migration
+{
+ protected $notification_types = array(
+ 'admin_activate_user',
+ 'approve_post',
+ 'approve_topic',
+ 'bookmark',
+ 'disapprove_post',
+ 'disapprove_topic',
+ 'group_request',
+ 'group_request_approved',
+ 'pm',
+ 'post',
+ 'post_in_queue',
+ 'quote',
+ 'report_pm',
+ 'report_pm_closed',
+ 'report_post',
+ 'report_post_closed',
+ 'topic',
+ 'topic_in_queue');
+
+ protected $notification_methods = array(
+ 'email',
+ 'jabber',
+ );
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\rc3');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'update_notifications_name'))),
+ array('custom', array(array($this, 'update_notifications_method_name'))),
+ );
+ }
+
+ public function revert_data()
+ {
+ return array(
+ array('custom', array(array($this, 'revert_notifications_name'))),
+ array('custom', array(array($this, 'revert_notifications_method_name'))),
+ );
+ }
+
+ public function update_notifications_method_name()
+ {
+ foreach ($this->notification_methods as $notification_method)
+ {
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET method = 'notification.method.{$notification_method}'
+ WHERE method = '{$notification_method}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function revert_notifications_method_name()
+ {
+ foreach ($this->notification_methods as $notification_method)
+ {
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET method = '{$notification_method}'
+ WHERE method = 'notification.method.{$notification_method}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function update_notifications_name()
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . '
+ SET notification_type_enabled = 0
+ WHERE ' . $this->db->sql_in_set('notification_type_name', $this->notification_types, true);
+ $this->db->sql_query($sql);
+
+ foreach ($this->notification_types as $notification_type)
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = 'notification.type.{$notification_type}'
+ WHERE notification_type_name = '{$notification_type}'";
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET item_type = 'notification.type.{$notification_type}'
+ WHERE item_type = '{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function revert_notifications_name()
+ {
+ foreach ($this->notification_types as $notification_type)
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = '{$notification_type}'
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET item_type = '{$notification_type}'
+ WHERE item_type = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 8bc63e564a..44bea3c5d2 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -715,60 +715,6 @@ class migrator
}
/**
- * Load migration data files from a directory
- *
- * @param \phpbb\finder $finder
- * @param string $path Path to migration data files
- * @param bool $check_fulfillable If TRUE (default), we will check
- * if all of the migrations are fulfillable after loading them.
- * If FALSE, we will not check. You SHOULD check at least once
- * to prevent errors (if including multiple directories, check
- * with the last call to prevent throwing errors unnecessarily).
- * @return array Array of migration names
- * @throws \phpbb\db\migration\exception
- */
- public function load_migrations(\phpbb\finder $finder, $path, $check_fulfillable = true)
- {
- if (!is_dir($path))
- {
- throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path);
- }
-
- $migrations = array();
-
- $files = $finder
- ->extension_directory("/")
- ->find_from_paths(array('/' => $path));
- foreach ($files as $file)
- {
- $migrations[$file['path'] . $file['filename']] = '';
- }
- $migrations = $finder->get_classes_from_files($migrations);
-
- foreach ($migrations as $migration)
- {
- if (!in_array($migration, $this->migrations))
- {
- $this->migrations[] = $migration;
- }
- }
-
- if ($check_fulfillable)
- {
- foreach ($this->migrations as $name)
- {
- $unfulfillable = $this->unfulfillable($name);
- if ($unfulfillable !== false)
- {
- throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
- }
- }
- }
-
- return $this->migrations;
- }
-
- /**
* Creates the migrations table if it does not exist.
* @return null
*/
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index 553b723cc8..638c13e86d 100644
--- a/phpBB/phpbb/di/container_builder.php
+++ b/phpBB/phpbb/di/container_builder.php
@@ -15,6 +15,7 @@ namespace phpbb\di;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
+use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
class container_builder
{
@@ -160,11 +161,13 @@ class container_builder
if ($this->use_custom_pass)
{
+ // Symfony Kernel Listeners
$this->container->addCompilerPass(new \phpbb\di\pass\collection_pass());
+ $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener'));
if ($this->use_kernel_pass)
{
- $this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass());
+ $this->container->addCompilerPass(new RegisterListenersPass('dispatcher'));
}
}
diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php
deleted file mode 100644
index fc01961e9f..0000000000
--- a/phpBB/phpbb/event/extension_subscriber_loader.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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 phpbb\event;
-
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-
-class extension_subscriber_loader
-{
- private $dispatcher;
- private $listener_collection;
-
- public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
- {
- $this->dispatcher = $dispatcher;
- $this->listener_collection = $listener_collection;
- }
-
- public function load()
- {
- if (!empty($this->listener_collection))
- {
- foreach ($this->listener_collection as $listener)
- {
- $this->dispatcher->addSubscriber($listener);
- }
- }
- }
-}
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index 288fb7d19c..5bb530bad4 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,17 +125,16 @@ 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')
->find_from_extension($this->extension_name, $this->extension_path);
+
$migrations = $this->extension_finder->get_classes_from_files($migrations);
return $migrations;
diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php
index 610b755af3..7a2087c1cd 100644
--- a/phpBB/phpbb/feed/forum.php
+++ b/phpBB/phpbb/feed/forum.php
@@ -94,7 +94,7 @@ class forum extends \phpbb\feed\post_base
WHERE forum_id = ' . $this->forum_id . '
AND topic_moved_id = 0
AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . '
- ORDER BY topic_last_post_time DESC';
+ ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
$topic_ids = array();
@@ -123,7 +123,7 @@ class forum extends \phpbb\feed\post_base
AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND p.poster_id = u.user_id',
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php
index ea5f4febf5..a02c199d85 100644
--- a/phpBB/phpbb/feed/news.php
+++ b/phpBB/phpbb/feed/news.php
@@ -99,7 +99,7 @@ class news extends \phpbb\feed\topic_base
),
'WHERE' => 'p.topic_id = t.topic_id
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php
index f6847c041e..ab452f5386 100644
--- a/phpBB/phpbb/feed/overall.php
+++ b/phpBB/phpbb/feed/overall.php
@@ -34,7 +34,7 @@ class overall extends \phpbb\feed\post_base
FROM ' . TOPICS_TABLE . '
WHERE topic_moved_id = 0
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . '
- ORDER BY topic_last_post_time DESC';
+ ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
$topic_ids = array();
@@ -71,7 +71,7 @@ class overall extends \phpbb\feed\post_base
AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND u.user_id = p.poster_id',
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php
index 78e0b4b8ab..66c49e55cf 100644
--- a/phpBB/phpbb/feed/topic.php
+++ b/phpBB/phpbb/feed/topic.php
@@ -101,7 +101,7 @@ class topic extends \phpbb\feed\post_base
'WHERE' => 'p.topic_id = ' . $this->topic_id . '
AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.poster_id = u.user_id',
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php
index 88ca7c33f3..2b9cb3501a 100644
--- a/phpBB/phpbb/feed/topics.php
+++ b/phpBB/phpbb/feed/topics.php
@@ -71,7 +71,7 @@ class topics extends \phpbb\feed\topic_base
),
'WHERE' => 'p.topic_id = t.topic_id
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php
index cde6d36f45..6d5eddfc16 100644
--- a/phpBB/phpbb/feed/topics_active.php
+++ b/phpBB/phpbb/feed/topics_active.php
@@ -56,7 +56,7 @@ class topics_active extends \phpbb\feed\topic_base
WHERE topic_moved_id = 0
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '
' . $last_post_time_sql . '
- ORDER BY topic_last_post_time DESC';
+ ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
$post_ids = array();
@@ -88,7 +88,7 @@ class topics_active extends \phpbb\feed\topic_base
),
'WHERE' => 'p.topic_id = t.topic_id
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
- 'ORDER_BY' => 'p.post_time DESC',
+ 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
);
return true;
diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php
index 773a1f822a..8baa77089b 100644
--- a/phpBB/phpbb/mimetype/guesser.php
+++ b/phpBB/phpbb/mimetype/guesser.php
@@ -115,17 +115,42 @@ class guesser
return false;
}
+ $mimetype = 'application/octet-stream';
+
foreach ($this->guessers as $guesser)
{
- $mimetype = $guesser->guess($file, $file_name);
+ $mimetype_guess = $guesser->guess($file, $file_name);
- // Try to guess something that is not the fallback application/octet-stream
- if ($mimetype !== null && $mimetype !== 'application/octet-stream')
- {
- return $mimetype;
- }
+ $mimetype = $this->choose_mime_type($mimetype, $mimetype_guess);
}
// Return any mimetype if we got a result or the fallback value
- return (!empty($mimetype)) ? $mimetype : 'application/octet-stream';
+ return $mimetype;
+ }
+
+ /**
+ * Choose the best mime type based on the current mime type and the guess
+ * If a guesser returns nulls or application/octet-stream, we will keep
+ * the current guess. Guesses with a slash inside them will be favored over
+ * already existing ones. However, any guess that will pass the first check
+ * will always overwrite the default application/octet-stream.
+ *
+ * @param string $mime_type The current mime type
+ * @param string $guess The current mime type guess
+ *
+ * @return string The best mime type based on current mime type and guess
+ */
+ public function choose_mime_type($mime_type, $guess)
+ {
+ if ($guess === null || $guess == 'application/octet-stream')
+ {
+ return $mime_type;
+ }
+
+ if ($mime_type == 'application/octet-stream' || strpos($guess, '/') !== false)
+ {
+ $mime_type = $guess;
+ }
+
+ return $mime_type;
}
}
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 5e4bab1530..81b450ebbd 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -570,7 +570,7 @@ class manager
{
$subscription_methods[$method_name] = array(
'id' => $method->get_type(),
- 'lang' => 'NOTIFICATION_METHOD_' . strtoupper($method->get_type()),
+ 'lang' => str_replace('.', '_', strtoupper($method->get_type())),
);
}
}
@@ -851,8 +851,6 @@ class manager
*/
public function get_item_type_class($notification_type_name, $data = array())
{
- $notification_type_name = (strpos($notification_type_name, 'notification.type.') === 0) ? $notification_type_name : 'notification.type.' . $notification_type_name;
-
$item = $this->load_object($notification_type_name);
$item->set_initial_data($data);
@@ -865,8 +863,6 @@ class manager
*/
public function get_method_class($method_name)
{
- $method_name = (strpos($method_name, 'notification.method.') === 0) ? $method_name : 'notification.method.' . $method_name;
-
return $this->load_object($method_name);
}
diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php
index 424f0aaf57..a4b93bc85c 100644
--- a/phpBB/phpbb/notification/method/email.php
+++ b/phpBB/phpbb/notification/method/email.php
@@ -27,7 +27,7 @@ class email extends \phpbb\notification\method\messenger_base
*/
public function get_type()
{
- return 'email';
+ return 'notification.method.email';
}
/**
diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php
index 55de50fecd..09f186e3ca 100644
--- a/phpBB/phpbb/notification/method/jabber.php
+++ b/phpBB/phpbb/notification/method/jabber.php
@@ -27,7 +27,7 @@ class jabber extends \phpbb\notification\method\messenger_base
*/
public function get_type()
{
- return 'jabber';
+ return 'notification.method.jabber';
}
/**
diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php
index 364df74cc5..038ca3726e 100644
--- a/phpBB/phpbb/notification/type/admin_activate_user.php
+++ b/phpBB/phpbb/notification/type/admin_activate_user.php
@@ -25,7 +25,7 @@ class admin_activate_user extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'admin_activate_user';
+ return 'notification.type.admin_activate_user';
}
/**
diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php
index 22c9076adc..a9e635b41a 100644
--- a/phpBB/phpbb/notification/type/approve_post.php
+++ b/phpBB/phpbb/notification/type/approve_post.php
@@ -27,7 +27,7 @@ class approve_post extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'approve_post';
+ return 'notification.type.approve_post';
}
/**
diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php
index 77e53a0064..2f4678359c 100644
--- a/phpBB/phpbb/notification/type/approve_topic.php
+++ b/phpBB/phpbb/notification/type/approve_topic.php
@@ -27,7 +27,7 @@ class approve_topic extends \phpbb\notification\type\topic
*/
public function get_type()
{
- return 'approve_topic';
+ return 'notification.type.approve_topic';
}
/**
diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php
index 21180b3b53..4f2d34cb60 100644
--- a/phpBB/phpbb/notification/type/bookmark.php
+++ b/phpBB/phpbb/notification/type/bookmark.php
@@ -27,7 +27,7 @@ class bookmark extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'bookmark';
+ return 'notification.type.bookmark';
}
/**
diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php
index 7b18ed70ea..6c7bcbcaee 100644
--- a/phpBB/phpbb/notification/type/disapprove_post.php
+++ b/phpBB/phpbb/notification/type/disapprove_post.php
@@ -27,7 +27,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post
*/
public function get_type()
{
- return 'disapprove_post';
+ return 'notification.type.disapprove_post';
}
/**
diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php
index 3f87741807..efa5eb7ecd 100644
--- a/phpBB/phpbb/notification/type/disapprove_topic.php
+++ b/phpBB/phpbb/notification/type/disapprove_topic.php
@@ -27,7 +27,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic
*/
public function get_type()
{
- return 'disapprove_topic';
+ return 'notification.type.disapprove_topic';
}
/**
diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php
index 980234c129..4baf516fed 100644
--- a/phpBB/phpbb/notification/type/group_request.php
+++ b/phpBB/phpbb/notification/type/group_request.php
@@ -20,7 +20,7 @@ class group_request extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'group_request';
+ return 'notification.type.group_request';
}
/**
diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php
index bf9cd0019f..d284046ffa 100644
--- a/phpBB/phpbb/notification/type/group_request_approved.php
+++ b/phpBB/phpbb/notification/type/group_request_approved.php
@@ -20,7 +20,7 @@ class group_request_approved extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'group_request_approved';
+ return 'notification.type.group_request_approved';
}
/**
diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php
index 8445ca4b22..330a70c85a 100644
--- a/phpBB/phpbb/notification/type/pm.php
+++ b/phpBB/phpbb/notification/type/pm.php
@@ -27,7 +27,7 @@ class pm extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'pm';
+ return 'notification.type.pm';
}
/**
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index 1eba4a6a88..d9e74f2e95 100644
--- a/phpBB/phpbb/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
@@ -27,7 +27,7 @@ class post extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'post';
+ return 'notification.type.post';
}
/**
diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php
index 3bb1028619..315b8b0243 100644
--- a/phpBB/phpbb/notification/type/post_in_queue.php
+++ b/phpBB/phpbb/notification/type/post_in_queue.php
@@ -27,7 +27,7 @@ class post_in_queue extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'post_in_queue';
+ return 'notification.type.post_in_queue';
}
/**
@@ -44,7 +44,7 @@ class post_in_queue extends \phpbb\notification\type\post
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'needs_approval',
+ 'id' => 'notification.type.needs_approval',
'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php
index 5c3c822ec2..508ca92fa0 100644
--- a/phpBB/phpbb/notification/type/quote.php
+++ b/phpBB/phpbb/notification/type/quote.php
@@ -27,7 +27,7 @@ class quote extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'quote';
+ return 'notification.type.quote';
}
/**
diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 14a328e104..d39143f4b7 100644
--- a/phpBB/phpbb/notification/type/report_pm.php
+++ b/phpBB/phpbb/notification/type/report_pm.php
@@ -27,7 +27,7 @@ class report_pm extends \phpbb\notification\type\pm
*/
public function get_type()
{
- return 'report_pm';
+ return 'notification.type.report_pm';
}
/**
@@ -61,7 +61,7 @@ class report_pm extends \phpbb\notification\type\pm
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'report',
+ 'id' => 'notification.type.report',
'lang' => 'NOTIFICATION_TYPE_REPORT',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index de7bf74a97..9f301ee2cc 100644
--- a/phpBB/phpbb/notification/type/report_pm_closed.php
+++ b/phpBB/phpbb/notification/type/report_pm_closed.php
@@ -27,7 +27,7 @@ class report_pm_closed extends \phpbb\notification\type\pm
*/
public function get_type()
{
- return 'report_pm_closed';
+ return 'notification.type.report_pm_closed';
}
/**
diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php
index bec59df9d5..027cca716b 100644
--- a/phpBB/phpbb/notification/type/report_post.php
+++ b/phpBB/phpbb/notification/type/report_post.php
@@ -26,7 +26,7 @@ class report_post extends \phpbb\notification\type\post_in_queue
*/
public function get_type()
{
- return 'report_post';
+ return 'notification.type.report_post';
}
/**
@@ -67,7 +67,7 @@ class report_post extends \phpbb\notification\type\post_in_queue
* Array of data (including keys 'id' and 'lang')
*/
public static $notification_option = array(
- 'id' => 'report',
+ 'id' => 'notification.type.report',
'lang' => 'NOTIFICATION_TYPE_REPORT',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php
index cd1400f8fa..a0bb187a0d 100644
--- a/phpBB/phpbb/notification/type/report_post_closed.php
+++ b/phpBB/phpbb/notification/type/report_post_closed.php
@@ -27,7 +27,7 @@ class report_post_closed extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'report_post_closed';
+ return 'notification.type.report_post_closed';
}
/**
diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php
index af199fb765..cf0ec77099 100644
--- a/phpBB/phpbb/notification/type/topic.php
+++ b/phpBB/phpbb/notification/type/topic.php
@@ -27,7 +27,7 @@ class topic extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'topic';
+ return 'notification.type.topic';
}
/**
diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php
index aef1487d77..4c60c6b858 100644
--- a/phpBB/phpbb/notification/type/topic_in_queue.php
+++ b/phpBB/phpbb/notification/type/topic_in_queue.php
@@ -27,7 +27,7 @@ class topic_in_queue extends \phpbb\notification\type\topic
*/
public function get_type()
{
- return 'topic_in_queue';
+ return 'notification.type.topic_in_queue';
}
/**
@@ -44,7 +44,7 @@ class topic_in_queue extends \phpbb\notification\type\topic
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'needs_approval',
+ 'id' => 'notification.type.needs_approval',
'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php
index 38dbbab51e..936564d8b6 100644
--- a/phpBB/phpbb/path_helper.php
+++ b/phpBB/phpbb/path_helper.php
@@ -316,7 +316,7 @@ class path_helper
* Glue URL parameters together
*
* @param array $params URL parameters in the form of array(name => value)
- * @return string Returns the glued string, e.g. name1=value1&amp;name2=value2
+ * @return string Returns the glued string, e.g. name1=value1&amp;name2&amp;name3=value3
*/
public function glue_url_params($params)
{
@@ -324,7 +324,15 @@ class path_helper
foreach ($params as $key => $value)
{
- $_params[] = $key . '=' . $value;
+ // some parameters do not have value
+ if ($value !== null)
+ {
+ $_params[] = $key . '=' . $value;
+ }
+ else
+ {
+ $_params[] = $key;
+ }
}
return implode('&amp;', $_params);
}
@@ -353,7 +361,17 @@ class path_helper
{
continue;
}
- list($key, $value) = explode('=', $argument, 2);
+
+ // some parameters don't have value
+ if (strpos($argument, '=') !== false)
+ {
+ list($key, $value) = explode('=', $argument, 2);
+ }
+ else
+ {
+ $key = $argument;
+ $value = null;
+ }
if ($key === '')
{
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 98802d2209..4ad3214ae4 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -245,12 +245,8 @@ class manager
$cp_data = $this->build_insert_sql_array($cp_data);
$cp_data['user_id'] = (int) $user_id;
- $this->db->sql_return_on_error(true);
-
$sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data);
$this->db->sql_query($sql);
-
- $this->db->sql_return_on_error(false);
}
}
@@ -328,7 +324,7 @@ class manager
* Event to modify profile fields data retrieved from the database
*
* @event core.grab_profile_fields_data
- * @var array user_ids Single user id or an array of ids
+ * @var array user_ids Single user id or an array of ids
* @var array field_data Array with profile fields data
* @since 3.1.0-b3
*/
@@ -377,7 +373,7 @@ class manager
* Event to modify data of the generated profile fields, before the template assignment loop
*
* @event core.generate_profile_fields_template_data_before
- * @var array profile_row Array with users profile field data
+ * @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
@@ -445,7 +441,7 @@ class manager
* Event to modify template data of the generated profile fields
*
* @event core.generate_profile_fields_template_data
- * @var array profile_row Array with users profile field data
+ * @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 7d564742af..30b364821d 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -441,8 +441,8 @@ class session
if (!$session_expired)
{
- // Only update session DB a minute or so after last update or if page changes
- if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page']))
+ // Only update session DB a minute or so after last update or if page changes and is not ajax request
+ if (($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) && !$request->is_ajax())
{
$sql_ary = array('session_time' => $this->time_now);
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
index 5e2057f818..a3b002f350 100644
--- a/phpBB/phpbb/template/twig/twig.php
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -177,6 +177,10 @@ class twig extends \phpbb\template\base
}
$names = $this->get_user_style();
+ // Add 'all' folder to $names array
+ // It allows extensions to load a template file from 'all' folder,
+ // if a style doesn't include it.
+ $names[] = 'all';
$paths = array();
foreach ($style_directories as $directory)
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/report.php b/phpBB/report.php
index fd6fab6645..1b5d3c9d46 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -231,7 +231,7 @@ if ($submit && $reason_id)
$lang_return = $user->lang['RETURN_TOPIC'];
$lang_success = $user->lang['POST_REPORTED_SUCCESS'];
- $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
+ $phpbb_notifications->add_notifications('notification.type.report_post', array_merge($report_data, $row, $forum_data, array(
'report_text' => $report_text,
)));
}
@@ -261,7 +261,7 @@ if ($submit && $reason_id)
$lang_return = $user->lang['RETURN_PM'];
$lang_success = $user->lang['PM_REPORTED_SUCCESS'];
- $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
+ $phpbb_notifications->add_notifications('notification.type.report_pm', array_merge($report_data, $row, array(
'report_text' => $report_text,
'from_user_id' => $report_data['author_id'],
'report_id' => $report_id,
diff --git a/phpBB/search.php b/phpBB/search.php
index 071db30f3d..67f6f4dbb5 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -281,12 +281,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
trigger_error($error);
}
- $common_words = $search->get_common_words();
-
// let the search module split up the keywords
if ($keywords)
{
$correct_query = $search->split_keywords($keywords, $search_terms);
+ $common_words = $search->get_common_words();
if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id))
{
$ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
@@ -599,7 +598,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'SEARCH_MATCHES' => $l_search_matches,
'SEARCH_WORDS' => $keywords,
'SEARCHED_QUERY' => $search->get_search_query(),
- 'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '',
+ 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '',
'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled,
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 63efe5f8ae..168efff4b4 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -1,6 +1,8 @@
+/* global phpbb */
+
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
// This callback will mark all forum icons read
phpbb.addAjaxCallback('mark_forums_read', function(res) {
@@ -40,10 +42,10 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
/**
* This callback will mark all topic icons read
*
-* @param update_topic_links bool Wether "Mark topics read" links should be
+* @param update_topic_links bool Whether "Mark topics read" links should be
* updated. Defaults to true.
*/
-phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) {
+phpbb.addAjaxCallback('mark_topics_read', function(res, updateTopicLinks) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
@@ -53,12 +55,12 @@ phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) {
'topic_unread': 'topic_read'
};
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
- var unreadClassSelectors = '';
+ var unreadClassSelectors;
var classMap = {};
var classNames = [];
- if (typeof update_topic_links === 'undefined') {
- update_topic_links = true;
+ if (typeof updateTopicLinks === 'undefined') {
+ updateTopicLinks = true;
}
$.each(iconsArray, function(unreadClass, readClass) {
@@ -88,7 +90,7 @@ phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) {
$('a').has('span.icon_topic_newest').remove();
// Update mark topics read links
- if (update_topic_links) {
+ if (updateTopicLinks) {
$('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS);
}
@@ -114,22 +116,22 @@ phpbb.addAjaxCallback('notification.mark_read', function(res) {
/**
* Mark notification popup rows as read.
*
- * @param {jQuery} el jQuery object(s) to mark read.
+ * @param {jQuery} $popup jQuery object(s) to mark read.
* @param {int} unreadCount The new unread notifications count.
*/
-phpbb.markNotifications = function(el, unreadCount) {
+phpbb.markNotifications = function($popup, unreadCount) {
// Remove the unread status.
- el.removeClass('bg2');
- el.find('a.mark_read').remove();
+ $popup.removeClass('bg2');
+ $popup.find('a.mark_read').remove();
// Update the notification link to the real URL.
- el.each(function() {
+ $popup.each(function() {
var link = $(this).find('a');
link.attr('href', link.attr('data-real-url'));
});
// Update the unread count.
- $('#notification_list_button strong').html(unreadCount);
+ $('strong', '#notification_list_button').html(unreadCount);
// Remove the Mark all read link if there are no unread notifications.
if (!unreadCount) {
$('#mark_all_notifications').remove();
@@ -143,12 +145,12 @@ phpbb.markNotifications = function(el, unreadCount) {
// This callback finds the post from the delete link, and removes it.
phpbb.addAjaxCallback('post_delete', function() {
- var el = $(this),
+ var $this = $(this),
postId;
- if (el.attr('data-refresh') === undefined) {
- postId = el[0].href.split('&p=')[1];
- var post = el.parents('#p' + postId).css('pointer-events', 'none');
+ if ($this.attr('data-refresh') === undefined) {
+ postId = $this[0].href.split('&p=')[1];
+ var post = $this.parents('#p' + postId).css('pointer-events', 'none');
if (post.hasClass('bg1') || post.hasClass('bg2')) {
var posts1 = post.nextAll('.bg1');
post.nextAll('.bg2').removeClass('bg2').addClass('bg1');
@@ -167,8 +169,7 @@ phpbb.addAjaxCallback('post_visibility', function(res) {
$(this).remove();
});
- if (res.visible)
- {
+ if (res.visible) {
// Remove the "Deleted by" message from the post on restoring.
remove.parents('.post').find('.post_deleted_msg').css('pointer-events', 'none').fadeOut(function() {
$(this).remove();
@@ -199,18 +200,18 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
if (typeof res.success !== 'undefined') {
var poll = $('.topic_poll');
var panel = poll.find('.panel');
- var results_visible = poll.find('dl:first-child .resultbar').is(':visible');
- var most_votes = 0;
+ var resultsVisible = poll.find('dl:first-child .resultbar').is(':visible');
+ var mostVotes = 0;
// Set min-height to prevent the page from jumping when the content changes
- var update_panel_height = function (height) {
+ var updatePanelHeight = function (height) {
var height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height;
panel.css('min-height', height);
};
- update_panel_height();
+ updatePanelHeight();
// Remove the View results link
- if (!results_visible) {
+ if (!resultsVisible) {
poll.find('.poll_view_results').hide(500);
}
@@ -226,8 +227,8 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
// Get the votes count of the highest poll option
poll.find('[data-poll-option-id]').each(function() {
var option = $(this);
- var option_id = option.attr('data-poll-option-id');
- most_votes = (res.vote_counts[option_id] >= most_votes) ? res.vote_counts[option_id] : most_votes;
+ var optionId = option.attr('data-poll-option-id');
+ mostVotes = (res.vote_counts[optionId] >= mostVotes) ? res.vote_counts[optionId] : mostVotes;
});
// Update the total votes count
@@ -235,28 +236,30 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
// Update each option
poll.find('[data-poll-option-id]').each(function() {
- var option = $(this);
- var option_id = option.attr('data-poll-option-id');
- var voted = (typeof res.user_votes[option_id] !== 'undefined') ? true : false;
- var most_voted = (res.vote_counts[option_id] == most_votes) ? true : false;
- var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[option_id] / res.total_votes) * 100);
- var percent_rel = (most_votes == 0) ? 0 : Math.round((res.vote_counts[option_id] / most_votes) * 100);
+ var $this = $(this);
+ var optionId = $this.attr('data-poll-option-id');
+ var voted = (typeof res.user_votes[optionId] !== 'undefined');
+ var mostVoted = (res.vote_counts[optionId] === mostVotes);
+ var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[optionId] / res.total_votes) * 100);
+ var percentRel = (mostVotes === 0) ? 0 : Math.round((res.vote_counts[optionId] / mostVotes) * 100);
- option.toggleClass('voted', voted);
- option.toggleClass('most-votes', most_voted);
+ $this.toggleClass('voted', voted);
+ $this.toggleClass('most-votes', mostVoted);
// Update the bars
- var bar = option.find('.resultbar div');
- var bar_time_lapse = (res.can_vote) ? 500 : 1500;
- var new_bar_class = (percent == 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1);
+ var bar = $this.find('.resultbar div');
+ var barTimeLapse = (res.can_vote) ? 500 : 1500;
+ var newBarClass = (percent === 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1);
setTimeout(function () {
- bar.animate({width: percent_rel + '%'}, 500).removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5').addClass(new_bar_class);
- bar.html(res.vote_counts[option_id]);
-
- var percent_txt = (!percent) ? res.NO_VOTES : percent + '%';
- option.find('.poll_option_percent').html(percent_txt);
- }, bar_time_lapse);
+ bar.animate({width: percentRel + '%'}, 500)
+ .removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5')
+ .addClass(newBarClass)
+ .html(res.vote_counts[optionId]);
+
+ var percentText = percent ? percent + '%' : res.NO_VOTES;
+ $this.find('.poll_option_percent').html(percentText);
+ }, barTimeLapse);
});
if (!res.can_vote) {
@@ -264,30 +267,31 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
}
// Display "Your vote has been cast." message. Disappears after 5 seconds.
- var confirmation_delay = (res.can_vote) ? 300 : 900;
- poll.find('.vote-submitted').delay(confirmation_delay).slideDown(200, function() {
- if (results_visible) {
- update_panel_height();
+ var confirmationDelay = (res.can_vote) ? 300 : 900;
+ poll.find('.vote-submitted').delay(confirmationDelay).slideDown(200, function() {
+ if (resultsVisible) {
+ updatePanelHeight();
}
$(this).delay(5000).fadeOut(500, function() {
- resize_panel(300);
+ resizePanel(300);
});
});
// Remove the gap resulting from removing options
setTimeout(function() {
- resize_panel(500);
+ resizePanel(500);
}, 1500);
- var resize_panel = function (time) {
- var panel_height = panel.height();
- var inner_height = panel.find('.inner').outerHeight();
+ var resizePanel = function (time) {
+ var panelHeight = panel.height();
+ var innerHeight = panel.find('.inner').outerHeight();
- if (panel_height != inner_height) {
- panel.css({'min-height': '', 'height': panel_height}).animate({height: inner_height}, time, function () {
- panel.css({'min-height': inner_height, 'height': ''});
- });
+ if (panelHeight != innerHeight) {
+ panel.css({'min-height': '', 'height': panelHeight})
+ .animate({height: innerHeight}, time, function () {
+ panel.css({'min-height': innerHeight, 'height': ''});
+ });
}
};
}
@@ -300,20 +304,19 @@ $('.poll_view_results a').click(function(e) {
// Do not follow the link
e.preventDefault();
- var poll = $(this).parents('.topic_poll');
+ var $poll = $(this).parents('.topic_poll');
- poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500);
- poll.find('.poll_view_results').hide(500);
+ $poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500);
+ $poll.find('.poll_view_results').hide(500);
});
$('[data-ajax]').each(function() {
- var $this = $(this),
- ajax = $this.attr('data-ajax'),
- filter = $this.attr('data-filter'),
- fn;
+ var $this = $(this);
+ var ajax = $this.attr('data-ajax');
+ var filter = $this.attr('data-filter');
if (ajax !== 'false') {
- fn = (ajax !== 'true') ? ajax : null;
+ var fn = (ajax !== 'true') ? ajax : null;
filter = (filter !== undefined) ? phpbb.getFunctionByName(filter) : null;
phpbb.ajaxify({
@@ -344,18 +347,10 @@ $('.display_post').click(function(e) {
// Do not follow the link
e.preventDefault();
- var post_id = $(this).attr('data-post-id');
- $('#post_content' + post_id).show();
- $('#profile' + post_id).show();
- $('#post_hidden' + post_id).hide();
-});
-
-$('#delete_permanent').click(function () {
- if ($(this).prop('checked')) {
- $('#delete_reason').hide();
- } else {
- $('#delete_reason').show();
- }
+ var postId = $(this).attr('data-post-id');
+ $('#post_content' + postId).show();
+ $('#profile' + postId).show();
+ $('#post_hidden' + postId).hide();
});
/**
@@ -366,10 +361,13 @@ $('#delete_permanent').click(function () {
* appropriately changed based on the status of the search panel.
*/
$('#member_search').click(function () {
- $('#memberlist_search').slideToggle('fast');
+ var $memberlistSearch = $('#memberlist_search');
+
+ $memberlistSearch.slideToggle('fast');
phpbb.ajaxCallbacks.alt_text.call(this);
+
// Focus on the username textbox if it's available and displayed
- if ($('#memberlist_search').is(':visible')) {
+ if ($memberlistSearch.is(':visible')) {
$('#username').focus();
}
return false;
@@ -378,7 +376,7 @@ $('#member_search').click(function () {
/**
* Automatically resize textarea
*/
-$(document).ready(function() {
+$(function() {
phpbb.resizeTextArea($('textarea:not(#message-box textarea, .no-auto-resize)'), {minHeight: 75, maxHeight: 250});
phpbb.resizeTextArea($('#message-box textarea'));
});
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index 4929e14ef7..1280ceb8ac 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -1,3 +1,5 @@
+/* global phpbb */
+
/**
* phpBB3 forum functions
*/
@@ -6,6 +8,8 @@
* Find a member
*/
function find_username(url) {
+ 'use strict';
+
popup(url, 760, 570, '_usersearch');
return false;
}
@@ -14,6 +18,8 @@ function find_username(url) {
* Window popup
*/
function popup(url, width, height, name) {
+ 'use strict';
+
if (!name) {
name = '_popup';
}
@@ -26,17 +32,18 @@ function popup(url, width, height, name) {
* Jump to page
*/
function pageJump(item) {
+ 'use strict';
var page = item.val(),
- per_page = item.attr('data-per-page'),
- base_url = item.attr('data-base-url'),
- start_name = item.attr('data-start-name');
+ perPage = item.attr('data-per-page'),
+ baseUrl = item.attr('data-base-url'),
+ startName = item.attr('data-start-name');
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) {
- if (base_url.indexOf('?') === -1) {
- document.location.href = base_url + '?' + start_name + '=' + ((page - 1) * per_page);
+ if (baseUrl.indexOf('?') === -1) {
+ document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
} else {
- document.location.href = base_url.replace(/&amp;/g, '&') + '&' + start_name + '=' + ((page - 1) * per_page);
+ document.location.href = baseUrl.replace(/&amp;/g, '&') + '&' + startName + '=' + ((page - 1) * perPage);
}
}
}
@@ -46,9 +53,11 @@ function pageJump(item) {
* id = ID of parent container, name = name prefix, state = state [true/false]
*/
function marklist(id, name, state) {
+ 'use strict';
+
jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
var $this = jQuery(this);
- if ($this.attr('name').substr(0, name.length) == name) {
+ if ($this.attr('name').substr(0, name.length) === name) {
$this.prop('checked', state);
}
});
@@ -59,6 +68,8 @@ function marklist(id, name, state) {
* e = element
*/
function viewableArea(e, itself) {
+ 'use strict';
+
if (!e) {
return;
}
@@ -86,18 +97,20 @@ function viewableArea(e, itself) {
/**
* Alternate display of subPanels
*/
-jQuery(document).ready(function() {
- jQuery('.sub-panels').each(function() {
+jQuery(function($) {
+ 'use strict';
- var panels = [],
- childNodes = jQuery('a[data-subpanel]', this).each(function() {
- panels.push(this.getAttribute('data-subpanel'));
+ $('.sub-panels').each(function() {
+
+ var $childNodes = $('a[data-subpanel]', this),
+ panels = $childNodes.map(function () {
+ return this.getAttribute('data-subpanel');
}),
- show_panel = this.getAttribute('data-show-panel');
+ showPanel = this.getAttribute('data-show-panel');
if (panels.length) {
- activateSubPanel(show_panel, panels);
- childNodes.click(function () {
+ activateSubPanel(showPanel, panels);
+ $childNodes.click(function () {
activateSubPanel(this.getAttribute('data-subpanel'), panels);
return false;
});
@@ -109,60 +122,30 @@ jQuery(document).ready(function() {
* Activate specific subPanel
*/
function activateSubPanel(p, panels) {
- var i;
+ 'use strict';
+
+ var i, showPanel;
if (typeof(p) === 'string') {
- show_panel = p;
+ showPanel = p;
}
- $('input[name="show_panel"]').val(show_panel);
+ $('input[name="show_panel"]').val(showPanel);
- if (typeof(panels) === 'undefined') {
- panels = [];
- jQuery('.sub-panels a[data-subpanel]').each(function() {
- panels.push(this.getAttribute('data-subpanel'));
+ if (typeof panels === 'undefined') {
+ panels = jQuery('.sub-panels a[data-subpanel]').map(function() {
+ return this.getAttribute('data-subpanel');
});
}
for (i = 0; i < panels.length; i++) {
- jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none');
- jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel);
- }
-}
-
-/**
-* Call print preview
-*/
-function printPage() {
- if (is_ie) {
- printPreview();
- } else {
- window.print();
- }
-}
-
-/**
-* Show/hide groups of blocks
-* c = CSS style name
-* e = checkbox element
-* t = toggle dispay state (used to show 'grip-show' image in the profile block when hiding the profiles)
-*/
-function displayBlocks(c, e, t) {
- var s = (e.checked === true) ? 1 : -1;
-
- if (t) {
- s *= -1;
- }
-
- var divs = document.getElementsByTagName("DIV");
-
- for (var d = 0; d < divs.length; d++) {
- if (divs[d].className.indexOf(c) === 0) {
- divs[d].style.display = (s === 1) ? 'none' : 'block';
- }
+ jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none');
+ jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel);
}
}
function selectCode(a) {
+ 'use strict';
+
// Get ID of code block
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
var s, r;
@@ -209,6 +192,8 @@ function selectCode(a) {
* from the displayed rectangle area
*/
function play_qt_file(obj) {
+ 'use strict';
+
var rectangle = obj.GetRectangle();
var width, height;
@@ -233,30 +218,32 @@ function play_qt_file(obj) {
obj.Play();
}
-var in_autocomplete = false;
-var last_key_entered = '';
+var inAutocomplete = false;
+var lastKeyEntered = '';
/**
* Check event key
*/
-function phpbb_check_key(event) {
+function phpbbCheckKey(event) {
+ 'use strict';
+
// Keycode is array down or up?
if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
- in_autocomplete = true;
+ inAutocomplete = true;
}
// Make sure we are not within an "autocompletion" field
- if (in_autocomplete) {
+ if (inAutocomplete) {
// If return pressed and key changed we reset the autocompletion
- if (!last_key_entered || last_key_entered === event.which) {
- in_autocompletion = false;
+ if (!lastKeyEntered || lastKeyEntered === event.which) {
+ inAutocomplete = false;
return true;
}
}
// Keycode is not return, then return. ;)
if (event.which !== 13) {
- last_key_entered = event.which;
+ lastKeyEntered = event.which;
return true;
}
@@ -266,115 +253,106 @@ function phpbb_check_key(event) {
/**
* Apply onkeypress event for forcing default submit button on ENTER key press
*/
-function apply_onkeypress_event() {
- jQuery('form input[type=text], form input[type=password]').on('keypress', function (e) {
- var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action');
+jQuery(function($) {
+ 'use strict';
+
+ $('form input[type=text], form input[type=password]').on('keypress', function (e) {
+ var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action');
- if (!default_button || default_button.length <= 0) {
+ if (!defaultButton || defaultButton.length <= 0) {
return true;
}
- if (phpbb_check_key(e)) {
+ if (phpbbCheckKey(e)) {
return true;
}
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
- default_button.click();
+ defaultButton.click();
return false;
}
return true;
});
-}
-
-jQuery(document).ready(apply_onkeypress_event);
+});
/**
* Functions for user search popup
*/
-function insert_user(formId, value)
+function insertUser(formId, value)
{
- var form = jQuery(formId),
- formName = form.attr('data-form-name'),
- fieldName = form.attr('data-field-name'),
+ 'use strict';
+
+ var $form = jQuery(formId),
+ formName = $form.attr('data-form-name'),
+ fieldName = $form.attr('data-field-name'),
item = opener.document.forms[formName][fieldName];
if (item.value.length && item.type == 'textarea') {
- value = item.value + "\n" + value;
+ value = item.value + '\n' + value;
}
item.value = value;
}
-function insert_marked_users(formId, users)
-{
- if (typeof(users.length) == "undefined")
- {
- if (users.checked)
- {
- insert_user(formId, users.value);
- }
- }
- else if (users.length > 0)
- {
- for (i = 0; i < users.length; i++)
- {
- if (users[i].checked)
- {
- insert_user(formId, users[i].value);
- }
+function insert_marked_users(formId, users) {
+ 'use strict';
+
+ for (var i = 0; i < users.length; i++) {
+ if (users[i].checked) {
+ insertUser(formId, users[i].value);
}
}
- self.close();
+ window.close();
}
-function insert_single_user(formId, user)
-{
- insert_user(formId, user);
- self.close();
+function insert_single_user(formId, user) {
+ 'use strict';
+
+ insertUser(formId, user);
+ window.close();
}
/**
* Parse document block
*/
-function parse_document(container)
-{
+function parseDocument($container) {
+ 'use strict';
+
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined');
- delete test;
-
/**
* Reset avatar dimensions when changing URL or EMAIL
*/
- container.find('input[data-reset-on-edit]').bind('keyup', function() {
+ $container.find('input[data-reset-on-edit]').on('keyup', function() {
$(this.getAttribute('data-reset-on-edit')).val('');
});
/**
* Pagination
*/
- container.find('.pagination .page-jump-form :button').click(function() {
- $input = $(this).siblings('input.inputbox');
+ $container.find('.pagination .page-jump-form :button').click(function() {
+ var $input = $(this).siblings('input.inputbox');
pageJump($input);
});
- container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
- if (event.which == 13 || event.keyCode == 13) {
+ $container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
+ if (event.which === 13 || event.keyCode === 13) {
event.preventDefault();
pageJump($(this));
}
});
- container.find('.pagination .dropdown-trigger').click(function() {
- $dropdown_container = $(this).parent();
+ $container.find('.pagination .dropdown-trigger').click(function() {
+ var $dropdownContainer = $(this).parent();
// Wait a little bit to make sure the dropdown has activated
setTimeout(function() {
- if ($dropdown_container.hasClass('dropdown-visible')) {
- $dropdown_container.find('input.inputbox').focus();
+ if ($dropdownContainer.hasClass('dropdown-visible')) {
+ $dropdownContainer.find('input.inputbox').focus();
}
- },100);
+ }, 100);
});
/**
@@ -382,27 +360,29 @@ function parse_document(container)
*/
if (oldBrowser) {
// Fix .linklist.bulletin lists
- container.find('ul.linklist.bulletin > li:first-child, ul.linklist.bulletin > li.rightside:last-child').addClass('no-bulletin');
+ $container.find('ul.linklist.bulletin > li:first-child, ul.linklist.bulletin > li.rightside:last-child').addClass('no-bulletin');
}
/**
* Resize navigation block to keep all links on same line
*/
- container.find('.navlinks').each(function() {
+ $container.find('.navlinks').each(function() {
var $this = $(this),
- left = $this.children().not('.rightside'),
- right = $this.children('.rightside');
+ $left = $this.children().not('.rightside'),
+ $right = $this.children('.rightside');
- if (left.length !== 1 || !right.length) return;
+ if ($left.length !== 1 || !$right.length) {
+ return;
+ }
function resize() {
var width = 0,
- diff = left.outerWidth(true) - left.width();
+ diff = $left.outerWidth(true) - $left.width();
- right.each(function() {
+ $right.each(function() {
width += $(this).outerWidth(true);
});
- left.css('max-width', Math.floor($this.width() - width - diff) + 'px');
+ $left.css('max-width', Math.floor($this.width() - width - diff) + 'px');
}
resize();
@@ -412,11 +392,11 @@ function parse_document(container)
/**
* Makes breadcrumbs responsive
*/
- container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
+ $container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
var $this = $(this),
$body = $('body'),
- links = $this.find('.crumb'),
- length = links.length,
+ $links = $this.find('.crumb'),
+ length = $links.length,
classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'],
classesLength = classes.length,
maxHeight = 0,
@@ -429,14 +409,13 @@ function parse_document(container)
$link.attr('title', $link.text());
});
- // Funciton that checks breadcrumbs
+ // Function that checks breadcrumbs
function check() {
var height = $this.height(),
- width = $body.width(),
- link, i, j;
+ width = $body.width();
- maxHeight = parseInt($this.css('line-height')) | 0;
- links.each(function() {
+ maxHeight = parseInt($this.css('line-height'));
+ $links.each(function() {
if ($(this).height() > 0) {
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
}
@@ -444,7 +423,6 @@ function parse_document(container)
if (height <= maxHeight) {
if (!wrapped || lastWidth === false || lastWidth >= width) {
- lastWidth = width;
return;
}
}
@@ -452,7 +430,6 @@ function parse_document(container)
if (wrapped) {
$this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' '));
- wrapped = false;
if ($this.height() <= maxHeight) {
return;
}
@@ -464,9 +441,9 @@ function parse_document(container)
return;
}
- for (i = 0; i < classesLength; i ++) {
- for (j = length - 1; j >= 0; j --) {
- links.eq(j).addClass('wrapped ' + classes[i]);
+ for (var i = 0; i < classesLength; i ++) {
+ for (var j = length - 1; j >= 0; j --) {
+ $links.eq(j).addClass('wrapped ' + classes[i]);
if ($this.height() <= maxHeight) {
return;
}
@@ -482,32 +459,29 @@ function parse_document(container)
/**
* Responsive link lists
*/
- container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() {
+ $container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() {
var $this = $(this),
$body = $('body'),
filterSkip = '.breadcrumbs, [data-skip-responsive]',
filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
persist = $this.attr('id') == 'nav-main',
- allLinks = $this.children(),
- links = allLinks.not(filterSkip),
+ $allLinks = $this.children(),
+ $links = $allLinks.not(filterSkip),
html = '<li class="responsive-menu" style="display:none;"><a href="javascript:void(0);" class="responsive-menu-link">&nbsp;</a><div class="dropdown" style="display:none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>',
- filterLastList = links.filter(filterLast),
+ $filterLastList = $links.filter(filterLast),
slack = 1; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
if (!persist) {
- if (links.is('.rightside'))
- {
- links.filter('.rightside:first').before(html);
+ if ($links.is('.rightside')) {
+ $links.filter('.rightside:first').before(html);
$this.children('.responsive-menu').addClass('rightside');
- }
- else
- {
+ } else {
$this.append(html);
}
}
- var item = $this.children('.responsive-menu'),
- menu = item.find('.dropdown-contents'),
+ var $item = $this.children('.responsive-menu'),
+ $menu = $item.find('.dropdown-contents'),
lastWidth = false,
compact = false,
responsive = false,
@@ -521,29 +495,31 @@ function parse_document(container)
// Unhide the quick-links menu if it has content
if (persist) {
- item.addClass('hidden');
- if (menu.find('li:not(.separator, .clone)').length || (responsive && menu.find('li.clone').length)) {
- item.removeClass('hidden');
+ $item.addClass('hidden');
+ if ($menu.find('li:not(.separator, .clone)').length || (responsive && $menu.find('li.clone').length)) {
+ $item.removeClass('hidden');
}
}
// Reset responsive and compact layout
if (responsive) {
- responsive = false;
$this.removeClass('responsive');
- links.css('display', '');
- if (!persist) item.css('display', 'none');
+ $links.css('display', '');
+ if (!persist) {
+ $item.css('display', 'none');
+ }
}
if (compact) {
- compact = false;
$this.removeClass('compact');
}
// Find tallest element
var maxHeight = 0;
- allLinks.each(function() {
- if (!$(this).height()) return;
+ $allLinks.each(function() {
+ if (!$(this).height()) {
+ return;
+ }
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
});
@@ -557,12 +533,13 @@ function parse_document(container)
}
// Enable compact layout, find tallest element, compare to height of whole block
- compact = true;
$this.addClass('compact');
var compactMaxHeight = 0;
- allLinks.each(function() {
- if (!$(this).height()) return;
+ $allLinks.each(function() {
+ if (!$(this).height()) {
+ return;
+ }
compactMaxHeight = Math.max(compactMaxHeight, $(this).outerHeight(true));
});
@@ -571,51 +548,51 @@ function parse_document(container)
}
// Compact layout did not resize block enough, switch to responsive layout
- compact = false;
$this.removeClass('compact');
responsive = true;
if (!copied) {
- var clone = links.clone(true);
+ var clone = $links.clone(true);
clone.filter('.rightside').each(function() {
- if (persist) $(this).addClass('clone');
- menu.prepend(this);
+ if (persist) {
+ $(this).addClass('clone');
+ }
+ $menu.prepend(this);
});
if (persist) {
- menu.prepend(clone.not('.rightside').addClass('clone'));
+ $menu.prepend(clone.not('.rightside').addClass('clone'));
} else {
- menu.prepend(clone.not('.rightside'));
+ $menu.prepend(clone.not('.rightside'));
}
- menu.find('li.leftside, li.rightside').removeClass('leftside rightside');
- menu.find('.inputbox').parents('li:first').css('white-space', 'normal');
+ $menu.find('li.leftside, li.rightside').removeClass('leftside rightside');
+ $menu.find('.inputbox').parents('li:first').css('white-space', 'normal');
if ($this.hasClass('post-buttons')) {
- $('.button', menu).removeClass('button icon-button');
- $('.responsive-menu-link', item).addClass('button icon-button').prepend('<span></span>');
+ $('.button', $menu).removeClass('button icon-button');
+ $('.responsive-menu-link', $item).addClass('button icon-button').prepend('<span></span>');
}
copied = true;
- }
- else {
- menu.children().css('display', '');
+ } else {
+ $menu.children().css('display', '');
}
- item.css('display', '');
+ $item.css('display', '');
$this.addClass('responsive');
// Try to not hide filtered items
- if (filterLastList.length) {
- links.not(filterLast).css('display', 'none');
+ if ($filterLastList.length) {
+ $links.not(filterLast).css('display', 'none');
maxHeight = 0;
- filterLastList.each(function() {
+ $filterLastList.each(function() {
if (!$(this).height()) return;
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
});
if ($this.height() <= (maxHeight + slack)) {
- menu.children().filter(filterLast).css('display', 'none');
+ $menu.children().filter(filterLast).css('display', 'none');
return;
}
}
@@ -624,10 +601,12 @@ function parse_document(container)
compact = true;
$this.addClass('compact');
- links.css('display', 'none');
+ $links.css('display', 'none');
}
- if (!persist) phpbb.registerDropdown(item.find('a.responsive-menu-link'), item.find('.dropdown'));
+ if (!persist) {
+ phpbb.registerDropdown($item.find('a.responsive-menu-link'), $item.find('.dropdown'));
+ }
check();
$(window).resize(check);
@@ -643,7 +622,7 @@ function parse_document(container)
/**
* Adjust topiclist lists with check boxes
*/
- container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
+ $container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
/**
* Appends contents of all extra columns to first column in
@@ -652,31 +631,30 @@ function parse_document(container)
* To add that functionality to .topiclist list simply add
* responsive-show-all to list of classes
*/
- container.find('.topiclist.responsive-show-all > li > dl').each(function() {
+ $container.find('.topiclist.responsive-show-all > li > dl').each(function() {
var $this = $(this),
- block = $this.find('dt .responsive-show:last-child'),
+ $block = $this.find('dt .responsive-show:last-child'),
first = true;
// Create block that is visible only on mobile devices
- if (!block.length) {
+ if (!$block.length) {
$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
- block = $this.find('dt .responsive-show:last-child');
- }
- else {
- first = ($.trim(block.text()).length == 0);
+ $block = $this.find('dt .responsive-show:last-child');
+ } else {
+ first = ($.trim($block.text()).length === 0);
}
// Copy contents of each column
$this.find('dd').not('.mark').each(function() {
var column = $(this),
- children = column.children(),
+ $children = column.children(),
html = column.html();
- if (children.length == 1 && children.text() == column.text()) {
- html = children.html();
+ if ($children.length == 1 && $children.text() == column.text()) {
+ html = $children.html();
}
- block.append((first ? '' : '<br />') + html);
+ $block.append((first ? '' : '<br />') + html);
first = false;
});
@@ -689,15 +667,15 @@ function parse_document(container)
* To add that functionality to .topiclist list simply add
* responsive-show-columns to list of classes
*/
- container.find('.topiclist.responsive-show-columns').each(function() {
- var list = $(this),
+ $container.find('.topiclist.responsive-show-columns').each(function() {
+ var $list = $(this),
headers = [],
headersLength = 0;
// Find all headers, get contents
- list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
+ $list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
headers.push($(this).text());
- headersLength ++;
+ headersLength++;
});
if (!headersLength) {
@@ -705,18 +683,18 @@ function parse_document(container)
}
// Parse each row
- list.find('dl').each(function() {
+ $list.find('dl').each(function() {
var $this = $(this),
- block = $this.find('dt .responsive-show:last-child'),
+ $block = $this.find('dt .responsive-show:last-child'),
first = true;
// Create block that is visible only on mobile devices
- if (!block.length) {
+ if (!$block.length) {
$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
- block = $this.find('dt .responsive-show:last-child');
+ $block = $this.find('dt .responsive-show:last-child');
}
else {
- first = ($.trim(block.text()).length == 0);
+ first = ($.trim($block.text()).length === 0);
}
// Copy contents of each column
@@ -734,7 +712,7 @@ function parse_document(container)
html = headers[i] + ': <strong>' + html + '</strong>';
}
- block.append((first ? '' : '<br />') + html);
+ $block.append((first ? '' : '<br />') + html);
first = false;
});
@@ -744,16 +722,15 @@ function parse_document(container)
/**
* Responsive tables
*/
- container.find('table.table1').not('.not-responsive').each(function() {
+ $container.find('table.table1').not('.not-responsive').each(function() {
var $this = $(this),
- th = $this.find('thead > tr > th'),
- columns = th.length,
+ $th = $this.find('thead > tr > th'),
headers = [],
totalHeaders = 0,
i, headersLength;
// Find each header
- th.each(function(column) {
+ $th.each(function(column) {
var cell = $(this),
colspan = parseInt(cell.attr('colspan')),
dfn = cell.attr('data-dfn'),
@@ -761,10 +738,10 @@ function parse_document(container)
colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
- for (i=0; i<colspan; i++) {
+ for (i = 0; i < colspan; i++) {
headers.push(text);
}
- totalHeaders ++;
+ totalHeaders++;
if (dfn && !column) {
$this.addClass('show-header');
@@ -802,8 +779,7 @@ function parse_document(container)
if ((text.length && text !== '-') || cell.children().length) {
cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>');
- }
- else {
+ } else {
cell.addClass('empty');
}
@@ -816,10 +792,9 @@ function parse_document(container)
/**
* Hide empty responsive tables
*/
- container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
- var items = $(this).children('tr');
- if (items.length == 0)
- {
+ $container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
+ var $items = $(this).children('tr');
+ if (!$items.length) {
$(this).parent('table:first').addClass('responsive-hide');
}
});
@@ -827,65 +802,64 @@ function parse_document(container)
/**
* Responsive tabs
*/
- container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
+ $container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
var $this = $(this),
$body = $('body'),
- ul = $this.children(),
- tabs = ul.children().not('[data-skip-responsive]'),
- links = tabs.children('a'),
- item = ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link">&nbsp;</a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'),
- menu = item.find('.dropdown-contents'),
+ $ul = $this.children(),
+ $tabs = $ul.children().not('[data-skip-responsive]'),
+ $links = $tabs.children('a'),
+ $item = $ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link">&nbsp;</a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'),
+ $menu = $item.find('.dropdown-contents'),
maxHeight = 0,
lastWidth = false,
responsive = false;
- links.each(function() {
- var link = $(this);
- maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true)));
- })
+ $links.each(function() {
+ var $this = $(this);
+ maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true)));
+ });
function check() {
var width = $body.width(),
height = $this.height();
- if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) {
+ if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) {
return;
}
- tabs.show();
- item.hide();
+ $tabs.show();
+ $item.hide();
lastWidth = width;
height = $this.height();
if (height <= maxHeight) {
- responsive = false;
- if (item.hasClass('dropdown-visible')) {
- phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0));
+ if ($item.hasClass('dropdown-visible')) {
+ phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0));
}
return;
}
responsive = true;
- item.show();
- menu.html('');
+ $item.show();
+ $menu.html('');
- var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'),
- total = availableTabs.length,
- i, tab;
+ var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'),
+ total = $availableTabs.length,
+ i, $tab;
for (i = total - 1; i >= 0; i --) {
- tab = availableTabs.eq(i);
- menu.prepend(tab.clone(true).removeClass('tab'));
- tab.hide();
+ $tab = $availableTabs.eq(i);
+ $menu.prepend($tab.clone(true).removeClass('tab'));
+ $tab.hide();
if ($this.height() <= maxHeight) {
- menu.find('a').click(function() { check(true); });
+ $menu.find('a').click(function() { check(true); });
return;
}
}
- menu.find('a').click(function() { check(true); });
+ $menu.find('a').click(function() { check(true); });
}
- phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab'});
+ phpbb.registerDropdown($item.find('a.responsive-tab-link'), $item.find('.dropdown'), {visibleClass: 'activetab'});
check(true);
$(window).resize(check);
@@ -894,10 +868,9 @@ function parse_document(container)
/**
* Hide UCP/MCP navigation if there is only 1 item
*/
- container.find('#navigation').each(function() {
- var items = $(this).children('ol, ul').children('li');
- if (items.length == 1)
- {
+ $container.find('#navigation').each(function() {
+ var $items = $(this).children('ol, ul').children('li');
+ if ($items.length === 1) {
$(this).addClass('responsive-hide');
}
});
@@ -905,7 +878,7 @@ function parse_document(container)
/**
* Replace responsive text
*/
- container.find('[data-responsive-text]').each(function() {
+ $container.find('[data-responsive-text]').each(function() {
var $this = $(this),
fullText = $this.text(),
responsiveText = $this.attr('data-responsive-text'),
@@ -913,12 +886,16 @@ function parse_document(container)
function check() {
if ($(window).width() > 700) {
- if (!responsive) return;
+ if (!responsive) {
+ return;
+ }
$this.text(fullText);
responsive = false;
return;
}
- if (responsive) return;
+ if (responsive) {
+ return;
+ }
$this.text(responsiveText);
responsive = true;
}
@@ -931,18 +908,18 @@ function parse_document(container)
/**
* Run onload functions
*/
-(function($) {
- $(document).ready(function() {
- // Swap .nojs and .hasjs
- $('#phpbb.nojs').toggleClass('nojs hasjs');
- $('#phpbb').toggleClass('hastouch', phpbb.isTouch);
- $('#phpbb.hastouch').removeClass('notouch');
-
- // Focus forms
- $('form[data-focus]:first').each(function() {
- $('#' + this.getAttribute('data-focus')).focus();
- });
+jQuery(function($) {
+ 'use strict';
+
+ // Swap .nojs and .hasjs
+ $('#phpbb.nojs').toggleClass('nojs hasjs');
+ $('#phpbb').toggleClass('hastouch', phpbb.isTouch);
+ $('#phpbb.hastouch').removeClass('notouch');
- parse_document($('body'));
+ // Focus forms
+ $('form[data-focus]:first').each(function() {
+ $('#' + this.getAttribute('data-focus')).focus();
});
-})(jQuery);
+
+ parseDocument($('body'));
+});
diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html
index 0dd47bea9e..22859b2452 100644
--- a/phpBB/styles/prosilver/template/forumlist_body.html
+++ b/phpBB/styles/prosilver/template/forumlist_body.html
@@ -34,8 +34,8 @@
<!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF -->
<!-- IF forumrow.FORUM_IMAGE --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><!-- ENDIF -->
- <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a><br />
- {forumrow.FORUM_DESC}
+ <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a>
+ <!-- IF forumrow.FORUM_DESC --><br />{forumrow.FORUM_DESC}<!-- ENDIF -->
<!-- IF forumrow.MODERATORS -->
<br /><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS}
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html
index 44b479ab3f..3096d08318 100644
--- a/phpBB/styles/prosilver/template/jumpbox.html
+++ b/phpBB/styles/prosilver/template/jumpbox.html
@@ -6,7 +6,7 @@
<!-- ELSEIF SEARCH_TOPIC -->
<p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO_TOPIC}</a></p>
<!-- ELSEIF S_SEARCH_ACTION -->
- <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p>
+ <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_GO_TO_SEARCH_ADV}</a></p>
<!-- ENDIF -->
<!-- IF S_DISPLAY_JUMPBOX -->
diff --git a/phpBB/styles/prosilver/template/mcp_warn_post.html b/phpBB/styles/prosilver/template/mcp_warn_post.html
index 0dd2e14d92..59c7d0d495 100644
--- a/phpBB/styles/prosilver/template/mcp_warn_post.html
+++ b/phpBB/styles/prosilver/template/mcp_warn_post.html
@@ -44,6 +44,8 @@
</div>
</div>
+<!-- EVENT mcp_warn_post_add_warning_field_before -->
+
<div class="panel">
<div class="inner">
@@ -64,6 +66,8 @@
</div>
</div>
+<!-- EVENT mcp_warn_post_add_warning_field_after -->
+
<fieldset class="submit-buttons">
<input type="reset" value="{L_RESET}" name="reset" class="button2" />&nbsp;
<input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" />
diff --git a/phpBB/styles/prosilver/template/mcp_warn_user.html b/phpBB/styles/prosilver/template/mcp_warn_user.html
index 1541f2e5f6..1ad6df7ade 100644
--- a/phpBB/styles/prosilver/template/mcp_warn_user.html
+++ b/phpBB/styles/prosilver/template/mcp_warn_user.html
@@ -28,6 +28,8 @@
</div>
</div>
+<!-- EVENT mcp_warn_user_add_warning_field_before -->
+
<div class="panel">
<div class="inner">
@@ -48,6 +50,8 @@
</div>
</div>
+<!-- EVENT mcp_warn_user_add_warning_field_after -->
+
<fieldset class="submit-buttons">
<input type="reset" value="{L_RESET}" name="reset" class="button2" />&nbsp;
<input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" />
diff --git a/phpBB/styles/prosilver/template/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html
index 4fb383a0ba..bc71aa0969 100644
--- a/phpBB/styles/prosilver/template/memberlist_im.html
+++ b/phpBB/styles/prosilver/template/memberlist_im.html
@@ -1,6 +1,6 @@
<!-- INCLUDE simple_header.html -->
-<h2 class="solo">{L_SEND_IM}</h2>
+<h2>{L_SEND_IM}</h2>
<form method="post" action="{S_IM_ACTION}">
diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html
index ffa57f9cc8..eb151af8df 100644
--- a/phpBB/styles/prosilver/template/memberlist_view.html
+++ b/phpBB/styles/prosilver/template/memberlist_view.html
@@ -10,7 +10,7 @@
<!-- IF AVATAR_IMG -->
<dl class="left-box">
- <dt>{AVATAR_IMG}</dt>
+ <dt class="profile-avatar">{AVATAR_IMG}</dt>
<!-- IF RANK_TITLE --><dd style="text-align: center;">{RANK_TITLE}</dd><!-- ENDIF -->
<!-- IF RANK_IMG --><dd style="text-align: center;">{RANK_IMG}</dd><!-- ENDIF -->
</dl>
@@ -65,7 +65,7 @@
<dl class="details">
<!-- IF U_EMAIL --><dt>{L_EMAIL_ADDRESS}{L_COLON}</dt> <dd><a href="{U_EMAIL}">{L_SEND_EMAIL_USER}</a></dd><!-- ENDIF -->
<!-- IF U_PM --><dt>{L_PM}{L_COLON}</dt> <dd><a href="{U_PM}">{L_SEND_PRIVATE_MESSAGE}</a></dd><!-- ENDIF -->
- <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF -->
+ <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 750, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF -->
<!-- BEGIN custom_fields -->
<!-- IF custom_fields.S_PROFILE_CONTACT -->
<dt>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</dt>
diff --git a/phpBB/styles/prosilver/template/message_body.html b/phpBB/styles/prosilver/template/message_body.html
index 8062fed9a0..71eca203bc 100644
--- a/phpBB/styles/prosilver/template/message_body.html
+++ b/phpBB/styles/prosilver/template/message_body.html
@@ -8,7 +8,7 @@
<div class="inner">
<h2 class="message-title">{MESSAGE_TITLE}</h2>
<p>{MESSAGE_TEXT}</p>
- <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF -->
+ <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_GO_TO_SEARCH_ADV}</a></p><!-- ENDIF -->
</div>
</div>
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 076a3160f0..7882279485 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -3,8 +3,6 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" />
-<meta name="keywords" content="" />
-<meta name="description" content="" />
{META}
<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
@@ -43,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/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index 25e3be3bcb..333e61008e 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -43,7 +43,7 @@
<!-- END smiley -->
<!-- ENDIF -->
<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED-->
- <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
+ <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 750, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
<!-- ENDIF -->
<!-- IF BBCODE_STATUS -->
@@ -107,7 +107,7 @@
<a href="#tabs" data-subpanel="attach-panel" role="tab" aria-controls="attach-panel">
{L_ATTACHMENTS} <strong id="file-total-progress"><strong id="file-total-progress-bar"></strong></strong>
</a>
- </li>
+ </li>
<!-- ENDIF -->
<!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE -->
<li id="poll-panel-tab" class="tab">
diff --git a/phpBB/styles/prosilver/template/posting_pm_header.html b/phpBB/styles/prosilver/template/posting_pm_header.html
index dea50b5daf..032d8c6a6f 100644
--- a/phpBB/styles/prosilver/template/posting_pm_header.html
+++ b/phpBB/styles/prosilver/template/posting_pm_header.html
@@ -15,7 +15,9 @@
<dd class="recipients">
<input type="submit" name="add_to" value="{L_ADD}" class="button2" tabindex="1" />
<input type="submit" name="add_bcc" value="{L_ADD_BCC}" class="button2" tabindex="1" />
+ <!-- EVENT posting_pm_header_find_username_before -->
<span><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a></span>
+ <!-- EVENT posting_pm_header_find_username_after -->
</dd>
</dl>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html
index 47aa8d85de..396b698e2d 100644
--- a/phpBB/styles/prosilver/template/search_results.html
+++ b/phpBB/styles/prosilver/template/search_results.html
@@ -8,7 +8,7 @@
<!-- IF SEARCH_TOPIC -->
<p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}">{L_RETURN_TO_TOPIC}</a></p>
<!-- ELSE -->
- <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a></p>
+ <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_GO_TO_SEARCH_ADV}</a></p>
<!-- ENDIF -->
<!-- IF .pagination or SEARCH_MATCHES or PAGE_NUMBER -->
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index 0831d5f9dc..6d22a074be 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -3,8 +3,6 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" />
-<meta name="keywords" content="" />
-<meta name="description" content="" />
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
@@ -36,6 +34,6 @@
<!-- EVENT simple_header_body_before -->
-<div id="simple-wrap">
+<div id="wrap">
<a id="top" class="anchor" accesskey="t"></a>
<div id="page-body">
diff --git a/phpBB/styles/prosilver/template/timezone.js b/phpBB/styles/prosilver/template/timezone.js
index e0d3da9ff7..44ec1b0979 100644
--- a/phpBB/styles/prosilver/template/timezone.js
+++ b/phpBB/styles/prosilver/template/timezone.js
@@ -1,6 +1,8 @@
+/* global phpbb */
+
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
$('#tz_date').change(function() {
phpbb.timezoneSwitchDate(false);
@@ -10,12 +12,9 @@ $('#tz_select_date_suggest').click(function(){
phpbb.timezonePreselectSelect(true);
});
-$(document).ready(
- phpbb.timezoneEnableDateSelection
-);
-
-$(document).ready(
- phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('timezone-preselect') === 'true')
-);
+$(function () {
+ phpbb.timezoneEnableDateSelection();
+ phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('timezone-preselect') === 'true');
+});
})(jQuery); // Avoid conflicts with other libraries
diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html
index ddbf892dee..1d4963273c 100644
--- a/phpBB/styles/prosilver/template/ucp_attachments.html
+++ b/phpBB/styles/prosilver/template/ucp_attachments.html
@@ -12,7 +12,7 @@
<!-- IF .attachrow -->
<div class="action-bar top">
<div class="pagination">
- {TOTAL_ATTACHMENTS} {L_TITLE}
+ {NUM_ATTACHMENTS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 941541c582..ddd95780d7 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -14,7 +14,7 @@
<!-- ENDIF -->
-<div id="post-{MESSAGE_ID}" class="post pm<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->">
+<div id="post-{MESSAGE_ID}" class="post pm has-profile<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->">
<div class="inner">
<dl class="postprofile" id="profile{MESSAGE_ID}">
@@ -55,7 +55,7 @@
<!-- IF REMAINDER eq 0 -->
<div>
<!-- ENDIF -->
- <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->>
<span class="contact-icon {contact.ID}-icon">{contact.NAME}</span>
</a>
<!-- IF REMAINDER eq 3 or contact.S_LAST_ROW -->
diff --git a/phpBB/styles/prosilver/template/viewonline_whois.html b/phpBB/styles/prosilver/template/viewonline_whois.html
index 031f18afdc..5d780490da 100644
--- a/phpBB/styles/prosilver/template/viewonline_whois.html
+++ b/phpBB/styles/prosilver/template/viewonline_whois.html
@@ -1,14 +1,10 @@
<!-- INCLUDE simple_header.html -->
-<h2 class="whois-title">{L_WHOIS}</h2>
+<h2>{L_WHOIS}</h2>
<div class="panel">
<div class="inner">
-
- <div class="postbody"><div class="content">
- <pre>{WHOIS}</pre>
- </div></div>
-
+ <pre>{WHOIS}</pre>
</div>
</div>
<a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index ac9c9a362a..5c8879af88 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -51,7 +51,7 @@
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
- <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}" class="mark">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->{TOTAL_POSTS}
+ <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}" class="mark">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->{TOTAL_POSTS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
@@ -120,7 +120,7 @@
<!-- IF postrow.S_FIRST_UNREAD -->
<a id="unread" class="anchor"<!-- IF S_UNREAD_VIEW --> data-url="{postrow.U_MINI_POST}"<!-- ENDIF -->></a>
<!-- ENDIF -->
- <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
+ <div id="p{postrow.POST_ID}" class="post has-profile <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
<div class="inner">
<dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
@@ -137,7 +137,7 @@
<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd class="profile-rank">{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF -->
- <!-- IF postrow.POSTER_POSTS != '' --><dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF -->
+ <!-- IF postrow.POSTER_POSTS != '' --><dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> <!-- IF postrow.U_SEARCH !== '' --><a href="{postrow.U_SEARCH}"><!-- ENDIF -->{postrow.POSTER_POSTS}<!-- IF postrow.U_SEARCH !== '' --></a><!-- ENDIF --></dd><!-- ENDIF -->
<!-- IF postrow.POSTER_JOINED --><dd class="profile-joined"><strong>{L_JOINED}{L_COLON}</strong> {postrow.POSTER_JOINED}</dd><!-- ENDIF -->
<!-- IF postrow.POSTER_WARNINGS --><dd class="profile-warnings"><strong>{L_WARNINGS}{L_COLON}</strong> {postrow.POSTER_WARNINGS}</dd><!-- ENDIF -->
@@ -169,7 +169,7 @@
<!-- IF REMAINDER eq 0 -->
<div>
<!-- ENDIF -->
- <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->>
<span class="contact-icon {postrow.contact.ID}-icon">{postrow.contact.NAME}</span>
</a>
<!-- IF REMAINDER eq 3 or postrow.contact.S_LAST_ROW -->
@@ -302,6 +302,8 @@
<!-- IF postrow.BUMPED_MESSAGE --><div class="notice"><br /><br />{postrow.BUMPED_MESSAGE}</div><!-- ENDIF -->
<!-- EVENT viewtopic_body_postrow_post_notices_after -->
<!-- IF postrow.SIGNATURE --><div id="sig{postrow.POST_ID}" class="signature">{postrow.SIGNATURE}</div><!-- ENDIF -->
+
+ <!-- EVENT viewtopic_body_postrow_post_content_footer -->
</div>
</div>
@@ -361,7 +363,7 @@
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
- {TOTAL_POSTS}
+ {TOTAL_POSTS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
index 83904bf63d..8378e3bcf4 100644
--- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
+++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
@@ -1,4 +1,4 @@
-<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or S_HAS_ATTACHMENTS or U_EMAIL_TOPIC or U_PRINT_TOPIC or S_DISPLAY_TOPIC_TOOLS) -->
+<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or U_EMAIL_TOPIC or U_PRINT_TOPIC or S_DISPLAY_TOPIC_TOOLS) -->
<div class="dropdown-container dropdown-button-control topic-tools">
<span title="{L_TOPIC_TOOLS}" class="button icon-button tools-icon dropdown-trigger dropdown-select"></span>
<div class="dropdown hidden">
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index 0d98fe7a66..46fbbadef7 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -464,6 +464,11 @@ li.breadcrumbs span:first-child > a {
float: right;
}
+.rtl .has-profile .postbody h3 {
+ margin-right: 0;
+ margin-left: 180px;
+}
+
.rtl p.post-notice {
padding-left: 5px;
padding-right: 26px;
@@ -655,6 +660,11 @@ li.breadcrumbs span:first-child > a {
float: left;
}
+.rtl .has-profile .post-buttons {
+ left: 0;
+ right: auto;
+}
+
.rtl .post-buttons li {
float: right;
}
@@ -1090,4 +1100,8 @@ li.breadcrumbs span:first-child > a {
margin-left: 5px;
margin-right: 0;
}
+
+ .rtl .has-profile .post-buttons {
+ left: 20px;
+ }
}
diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css
index b45aae5672..a08b49a81c 100644
--- a/phpBB/styles/prosilver/theme/buttons.css
+++ b/phpBB/styles/prosilver/theme/buttons.css
@@ -177,6 +177,14 @@ ul.linklist.bulletin > li.small-icon:before {
margin-top: 2px;
}
+.has-profile .post-buttons {
+ float: none;
+ position: absolute;
+ margin: 0;
+ right: 0;
+ top: 5px;
+}
+
.post-buttons > li {
float: left;
margin-right: 3px;
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 45cb88890d..a3a4157704 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -189,10 +189,6 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {
}
}
-#simple-wrap {
- padding: 6px 0;
-}
-
#page-body {
margin: 4px 0;
clear: both;
@@ -303,6 +299,7 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {
background-repeat: no-repeat;
background-position: 100% 0;
border-radius: 7px;
+ position: relative;
}
.rowbg {
@@ -768,6 +765,7 @@ table.info tbody th {
float: left;
width: auto;
text-align: left;
+ max-width: 100%;
}
.left-box.profile-details {
@@ -778,6 +776,7 @@ table.info tbody th {
float: right;
width: auto;
text-align: right;
+ max-width: 100%;
}
dl.details {
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index 8b84545a2c..9388496c53 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -233,6 +233,7 @@ dd.option {
line-height: 1.48em;
width: 76%;
float: left;
+ position: relative;
}
.postbody .ignore {
@@ -249,7 +250,8 @@ dd.option {
float: left;
font-size: 1.5em;
padding: 2px 0 0 0;
- margin: 0 0 0.3em 0 !important;
+ margin-top: 0 !important;
+ margin-bottom: 0.3em !important;
text-transform: none;
border: none;
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
@@ -261,6 +263,12 @@ dd.option {
vertical-align: bottom;
}
+.has-profile .postbody h3 {
+ /* If there is a post-profile, we position the post-buttons differently */
+ float: none !important;
+ margin-right: 180px;
+}
+
.postbody .content {
font-size: 1.3em;
overflow-x: auto;
@@ -728,6 +736,10 @@ fieldset.polls dd div {
max-width: 100%;
}
+.postprofile .profile-posts a {
+ font-weight: normal;
+}
+
dd.profile-warnings {
font-weight: bold;
}
@@ -759,6 +771,11 @@ dd.profile-contact {
width: 30%;
}
+/* Profile used on view-profile */
+.profile-avatar img {
+ max-width: 100%;
+}
+
/* pm list in compose message if mass pm is enabled */
dl.pmlist dt {
width: 60% !important;
diff --git a/phpBB/styles/prosilver/theme/images/created_by.jpg b/phpBB/styles/prosilver/theme/images/created_by.jpg
deleted file mode 100644
index 68d56e2013..0000000000
--- a/phpBB/styles/prosilver/theme/images/created_by.jpg
+++ /dev/null
Binary files differ
diff --git a/phpBB/assets/plupload/img/done.gif b/phpBB/styles/prosilver/theme/images/plupload/done.gif
index 29f3ed7c97..29f3ed7c97 100644
--- a/phpBB/assets/plupload/img/done.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/done.gif
Binary files differ
diff --git a/phpBB/assets/plupload/img/error.gif b/phpBB/styles/prosilver/theme/images/plupload/error.gif
index 4682b63007..4682b63007 100644
--- a/phpBB/assets/plupload/img/error.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/error.gif
Binary files differ
diff --git a/phpBB/assets/plupload/img/throbber.gif b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif
index 4ae8b16a5a..4ae8b16a5a 100644
--- a/phpBB/assets/plupload/img/throbber.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/plupload.css b/phpBB/styles/prosilver/theme/plupload.css
index f81064dbe6..7d4092c3fe 100644
--- a/phpBB/styles/prosilver/theme/plupload.css
+++ b/phpBB/styles/prosilver/theme/plupload.css
@@ -58,15 +58,15 @@
}
.file-status.file-working {
- background: url('../../../assets/plupload/img/throbber.gif');
+ background: url('./images/plupload/throbber.gif');
}
.file-status.file-uploaded {
- background: url('../../../assets/plupload/img/done.gif');
+ background: url('./images/plupload/done.gif');
}
.file-status.file-error {
- background: url('../../../assets/plupload/img/error.gif');
+ background: url('./images/plupload/error.gif');
}
.file-status {
diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css
index 3ef0044621..fc39e03da7 100644
--- a/phpBB/styles/prosilver/theme/responsive.css
+++ b/phpBB/styles/prosilver/theme/responsive.css
@@ -398,6 +398,10 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
/* Post
----------------------------------------*/
+.postbody {
+ position: inherit;
+}
+
.postprofile, .postbody, .search .postbody {
display: block;
width: auto;
@@ -412,6 +416,7 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
padding-bottom: 5px;
margin: 0;
margin-bottom: 5px;
+ min-height: 40px;
overflow: hidden;
}
@@ -443,12 +448,18 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
max-height: 32px;
}
-@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 1.5dppx)
-{
- /* Scale online image for HD displays */
- .online {
- background-size: 40px;
- }
+.has-profile .postbody h3 {
+ margin-left: 0 !important;
+ margin-right: 0 !important;
+}
+
+.has-profile .post-buttons {
+ right: 20px;
+ top: 15px;
+}
+
+.online {
+ background-size: 40px;
}
/* Misc stuff
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/phpBB/styles/subsilver2/template/mcp_warn_post.html b/phpBB/styles/subsilver2/template/mcp_warn_post.html
index 223457d158..68715eff2d 100644
--- a/phpBB/styles/subsilver2/template/mcp_warn_post.html
+++ b/phpBB/styles/subsilver2/template/mcp_warn_post.html
@@ -35,6 +35,8 @@
<form method="post" name="mcp" action="{U_POST_ACTION}">
+<!-- EVENT mcp_warn_post_add_warning_field_before -->
+
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">
<tr>
<th align="center">{L_ADD_WARNING}</th>
@@ -54,6 +56,9 @@
<td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" /></td>
</tr>
</table>
+
+<!-- EVENT mcp_warn_post_add_warning_field_after -->
+
{S_FORM_TOKEN}
</form>
diff --git a/phpBB/styles/subsilver2/template/mcp_warn_user.html b/phpBB/styles/subsilver2/template/mcp_warn_user.html
index 6b78c71557..20b57c6837 100644
--- a/phpBB/styles/subsilver2/template/mcp_warn_user.html
+++ b/phpBB/styles/subsilver2/template/mcp_warn_user.html
@@ -48,6 +48,8 @@
<form method="post" name="mcp" action="{U_POST_ACTION}">
+<!-- EVENT mcp_warn_user_add_warning_field_before -->
+
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">
<tr>
<th align="center">{L_ADD_WARNING}</th>
@@ -67,6 +69,9 @@
<td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" /></td>
</tr>
</table>
+
+<!-- EVENT mcp_warn_user_add_warning_field_after -->
+
{S_FORM_TOKEN}
</form>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index ebb7b3be4d..4741154889 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -2,8 +2,6 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
-<meta name="keywords" content="" />
-<meta name="description" content="" />
{META}
<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html
index 0c3dff4a05..d292c4594a 100644
--- a/phpBB/styles/subsilver2/template/simple_header.html
+++ b/phpBB/styles/subsilver2/template/simple_header.html
@@ -2,8 +2,6 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
-<meta name="keywords" content="" />
-<meta name="description" content="" />
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
diff --git a/phpBB/styles/subsilver2/template/ucp_attachments.html b/phpBB/styles/subsilver2/template/ucp_attachments.html
index 0f6101aac7..c513f933c0 100644
--- a/phpBB/styles/subsilver2/template/ucp_attachments.html
+++ b/phpBB/styles/subsilver2/template/ucp_attachments.html
@@ -17,7 +17,7 @@
<table width="100%" cellspacing="1">
<tr>
<td class="nav" valign="middle" nowrap="nowrap">&nbsp;{PAGE_NUMBER}<br /></td>
- <td class="gensmall" nowrap="nowrap">&nbsp;[ {TOTAL_ATTACHMENTS} ]&nbsp;</td>
+ <td class="gensmall" nowrap="nowrap">&nbsp;[ {NUM_ATTACHMENTS} ]&nbsp;</td>
<td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td>
</tr>
</table>
diff --git a/phpBB/styles/subsilver2/template/ucp_header.html b/phpBB/styles/subsilver2/template/ucp_header.html
index e3aaef6943..dff2841b54 100644
--- a/phpBB/styles/subsilver2/template/ucp_header.html
+++ b/phpBB/styles/subsilver2/template/ucp_header.html
@@ -25,11 +25,13 @@
<tr>
<td class="row1"><b class="genmed">{L_USERNAMES}{L_COLON}</b></td>
</tr>
+ <!-- EVENT posting_pm_header_find_username_before -->
<tr>
<td class="row2"><textarea name="username_list" rows="5" cols="22" tabindex="1"></textarea><br />
[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]
</td>
</tr>
+ <!-- EVENT posting_pm_header_find_username_after -->
<!-- ENDIF -->
<!-- IF S_GROUP_OPTIONS -->
<tr>
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index 0f34b50950..838f6c5f03 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -308,6 +308,8 @@
<!-- ENDIF -->
<!-- EVENT viewtopic_body_postrow_post_notices_after -->
+ <!-- EVENT viewtopic_body_postrow_post_content_footer -->
+
<!-- IF not postrow.S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF -->
<table width="100%" cellspacing="0">
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 9086feb390..a1e8c9814b 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -251,7 +251,7 @@ $s_watching_forum = array(
'is_watching' => false,
);
-if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS))
+if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS))
{
$notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL;
watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']);
@@ -264,7 +264,7 @@ gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']);
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
-$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
+$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
@@ -392,10 +392,15 @@ $sql_array = array(
* Event to modify the SQL query before the topic data is retrieved
*
* @event core.viewforum_get_topic_data
-* @var array sql_array The SQL array to get the data of all topics
+* @var array forum_data Array with forum data
+* @var array sql_array The SQL array to get the data of all topics
* @since 3.1.0-a1
+* @change 3.1.0-RC4 Added forum_data var
*/
-$vars = array('sql_array');
+$vars = array(
+ 'forum_data',
+ 'sql_array',
+);
extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars)));
$sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
@@ -497,7 +502,7 @@ if ($start > $topics_count / 2)
$store_reverse = true;
// Select the sort order
- $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
+ $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC');
$sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count);
$sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count);
@@ -505,10 +510,19 @@ if ($start > $topics_count / 2)
else
{
// Select the sort order
- $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
+ $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC');
$sql_start = $start;
}
+if (is_array($sort_by_sql[$sort_key]))
+{
+ $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
+}
+else
+{
+ $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
+}
+
if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary))
{
$sql_where = 't.forum_id = ' . $forum_id;
@@ -524,13 +538,46 @@ else
}
// Grab just the sorted topic ids
-$sql = 'SELECT t.topic_id
- FROM ' . TOPICS_TABLE . " t
- WHERE $sql_where
+$sql_ary = array(
+ 'SELECT' => 't.topic_id',
+ 'FROM' => array(
+ TOPICS_TABLE => 't',
+ ),
+ 'WHERE' => "$sql_where
AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
$sql_approved
- $sql_limit_time
- ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order;
+ $sql_limit_time",
+ 'ORDER BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order,
+);
+
+/**
+* Event to modify the SQL query before the topic ids data is retrieved
+*
+* @event core.viewforum_get_topic_ids_data
+* @var array sql_ary SQL query array to get the topic ids data
+* @var string sql_approved Topic visibility SQL string
+* @var int sql_limit Number of records to select
+* @var string sql_limit_time SQL string to limit topic_last_post_time data
+* @var array sql_sort_order SQL sorting string
+* @var int sql_start Offset point to start selection from
+* @var string sql_where SQL WHERE clause string
+* @var bool store_reverse Flag indicating if we select from the late pages
+*
+* @since 3.1.0-RC4
+*/
+$vars = array(
+ 'sql_ary',
+ 'sql_approved',
+ 'sql_limit',
+ 'sql_limit_time',
+ 'sql_sort_order',
+ 'sql_start',
+ 'sql_where',
+ 'store_reverse',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars)));
+
+$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index a03a81a15e..9589fb54e2 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -372,7 +372,7 @@ while ($row = $db->sql_fetchrow($result))
$vars = array('on_page', 'row', 'location', 'location_url', 'forum_data');
extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars)));
- $template->assign_block_vars('user_row', array(
+ $template_row = array(
'USERNAME' => $row['username'],
'USERNAME_COLOUR' => $row['user_colour'],
'USERNAME_FULL' => $username_full,
@@ -389,7 +389,22 @@ while ($row = $db->sql_fetchrow($result))
'S_USER_HIDDEN' => $s_user_hidden,
'S_GUEST' => ($row['user_id'] == ANONYMOUS) ? true : false,
'S_USER_TYPE' => $row['user_type'],
- ));
+ );
+
+ /**
+ * Modify viewonline template data before it is displayed in the list
+ *
+ * @event core.viewonline_modify_user_row
+ * @var array on_page File name and query string
+ * @var array row Array with the users sql row
+ * @var array forum_data Array with forum data
+ * @var array template_row Array with template variables for the user row
+ * @since 3.1.0-RC4
+ */
+ $vars = array('on_page', 'row', 'forum_data', 'template_row');
+ extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_user_row', compact($vars)));
+
+ $template->assign_block_vars('user_row', $template_row);
}
$db->sql_freeresult($result);
unset($prev_id, $prev_ip);
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 8d7ab5323d..f8b4a54f05 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -94,7 +94,7 @@ if ($view && !$post_id)
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . "
AND post_time > $topic_last_read
AND forum_id = $forum_id
- ORDER BY post_time ASC";
+ ORDER BY post_time ASC, post_id ASC";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -146,7 +146,7 @@ if ($view && !$post_id)
AND topic_moved_id = 0
AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}
AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . "
- ORDER BY topic_last_post_time $sql_ordering";
+ ORDER BY topic_last_post_time $sql_ordering, topic_last_post_id $sql_ordering";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -388,7 +388,7 @@ if (!isset($topic_tracking_info))
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
-$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => 'p.post_time', 's' => array('p.post_subject', 'p.post_id'));
+$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id'));
$join_user_sql = array('a' => true, 't' => false, 's' => false);
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
@@ -449,7 +449,7 @@ $s_watching_topic = array(
'is_watching' => false,
);
-if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'])
+if ($config['allow_topic_notify'])
{
$notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null;
watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']);
@@ -602,6 +602,35 @@ if (!empty($_EXTRA_URL))
// If we've got a hightlight set pass it on to pagination.
$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . ((strlen($u_sort_param)) ? "&amp;$u_sort_param" : '') . (($highlight_match) ? "&amp;hilit=$highlight" : ''));
+
+/**
+* Event to modify data before template variables are being assigned
+*
+* @event core.viewtopic_assign_template_vars_before
+* @var string base_url URL to be passed to generate pagination
+* @var int forum_id Forum ID
+* @var int post_id Post ID
+* @var array quickmod_array Array with quick moderation options data
+* @var int start Pagination information
+* @var array topic_data Array with topic data
+* @var int topic_id Topic ID
+* @var array topic_tracking_info Array with topic tracking data
+* @var int total_posts Topic total posts count
+* @since 3.1.0-RC4
+*/
+$vars = array(
+ 'base_url',
+ 'forum_id',
+ 'post_id',
+ 'quickmod_array',
+ 'start',
+ 'topic_data',
+ 'topic_id',
+ 'topic_tracking_info',
+ 'total_posts',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars)));
+
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start);
// Send vars to template
@@ -2088,9 +2117,11 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang
* @var array topic_data Array with topic data
* @var int forum_id Forum ID of the topic
* @var int start Start offset used to calculate the page
+* @var array post_list Array with post_ids we are going to display
* @since 3.1.0-a1
+* @change 3.1.0-RC4 Added post_list var
*/
-$vars = array('page_title', 'topic_data', 'forum_id', 'start');
+$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars)));
// Output the page
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/console/config/config_test.php b/tests/console/config/config_test.php
new file mode 100644
index 0000000000..7c098af004
--- /dev/null
+++ b/tests/console/config/config_test.php
@@ -0,0 +1,251 @@
+<?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.
+*
+*/
+
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class phpbb_console_command_config_test extends phpbb_test_case
+{
+ protected $config;
+ protected $command_name;
+ protected $user;
+
+ public function setUp()
+ {
+ $this->config = new \phpbb\config\config(array());
+
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
+ $this->user->method('lang')->will($this->returnArgument(0));
+ }
+
+ public function test_set_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('set');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'test_value');
+ }
+
+ public function test_set_no_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('set');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'test_value');
+ }
+
+ public function test_set_atomic_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'old_value', true);
+ $this->assertSame($this->config['test_key'], 'old_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'new_value');
+ }
+
+ public function test_set_atomic_no_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'old_value', false);
+ $this->assertSame($this->config['test_key'], 'old_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'new_value');
+ }
+
+ public function test_set_atomic_error_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'wrong_value', true);
+ $this->assertSame($this->config['test_key'], 'wrong_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'wrong_value');
+ }
+
+ public function test_get_no_new_line()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ '--no-newline' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], $command_tester->getDisplay());
+ }
+
+ public function test_get_new_line()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ '--no-newline' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'] . PHP_EOL, $command_tester->getDisplay());
+ }
+
+ public function test_get_error()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'wrong_key',
+ '--no-newline' => false,
+ ));
+
+ $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
+ }
+
+ public function test_increment_dynamic()
+ {
+ $this->config->set('test_key', 0, false);
+ $this->assertSame($this->config['test_key'], 0);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => true,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_increment_no_dynamic()
+ {
+ $this->config->set('test_key', 0, false);
+ $this->assertSame($this->config['test_key'], 0);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => false,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_increment_no_set()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => true,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_delete_ok()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('delete');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ ));
+
+ $this->assertContains('CLI_CONFIG_DELETE_SUCCESS', $command_tester->getDisplay());
+ $this->assertEmpty($this->config);
+ }
+
+ public function test_delete_error()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('delete');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'wrong_key',
+ ));
+
+ $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
+ $this->assertEmpty($this->config);
+ }
+
+ public function get_command_tester($class_name)
+ {
+ $command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name;
+ $application = new Application();
+ $application->add(new $command_complete_name($this->user, $this->config));
+ $command = $application->find('config:' . $this->command_name);
+ $this->command_name = $command->getName();
+ return new CommandTester($command);
+ }
+}
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/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/vendor4/bar/composer.json b/tests/extension/ext/vendor4/bar/composer.json
new file mode 100644
index 0000000000..1a2fddc3f4
--- /dev/null
+++ b/tests/extension/ext/vendor4/bar/composer.json
@@ -0,0 +1,23 @@
+{
+ "name": "vendor4/bar",
+ "type": "phpbb-extension",
+ "description": "An example/sample extension to be used for testing purposes in phpBB Development.",
+ "version": "1.0.0",
+ "time": "2012-02-15 01:01:01",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "John Smith",
+ "email": "email@phpbb.com",
+ "homepage": "http://phpbb.com",
+ "role": "N/A"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB Bar Extension",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html b/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html
new file mode 100644
index 0000000000..c8f8cf957e
--- /dev/null
+++ b/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html
@@ -0,0 +1 @@
+All folder
diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php
new file mode 100644
index 0000000000..eee38186db
--- /dev/null
+++ b/tests/extension/extension_base_test.php
@@ -0,0 +1,79 @@
+<?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;
+
+ /** @var phpbb_mock_extension_manager */
+ protected $extension_manager;
+
+ 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(
+ 'vendor2/bar',
+ array(
+ '\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/extension/manager_test.php b/tests/extension/manager_test.php
index 5ec8e60a68..5c7cad89f6 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -36,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_all_available()
{
// barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure.
- $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo'), array_keys($this->extension_manager->all_available()));
+ $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo', 'vendor4/bar'), array_keys($this->extension_manager->all_available()));
}
public function test_all_enabled()
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php
index 6490c1ead3..7be8957ec7 100644
--- a/tests/functional/extension_acp_test.php
+++ b/tests/functional/extension_acp_test.php
@@ -84,7 +84,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
$this->assertCount(1, $crawler->filter('.ext_enabled'));
- $this->assertCount(5, $crawler->filter('.ext_disabled'));
+ $this->assertCount(6, $crawler->filter('.ext_disabled'));
$this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text());
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 532a160a47..18eb9ad4c6 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -26,6 +26,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
'foo/bar/event/',
'foo/bar/language/en/',
'foo/bar/styles/prosilver/template/',
+ 'foo/foo/config/',
+ 'foo/foo/controller/',
);
static public function setUpBeforeClass()
@@ -65,6 +67,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
}
/**
+ * Check a controller for extension foo/bar.
+ */
+ public function test_routing_resources()
+ {
+ $this->phpbb_extension_manager->enable('foo/foo');
+ $crawler = self::request('GET', 'app.php/foo/foo', array(), false);
+ self::assert_response_status_code();
+ $this->assertContains("foo/foo controller handle() method", $crawler->filter('body')->text());
+ $this->phpbb_extension_manager->purge('foo/foo');
+ }
+
+ /**
* Check the output of a controller using the template system
*/
public function test_controller_with_template()
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index e87953367f..b8c48389e0 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -107,9 +107,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
$crawler = $this->upload_file('disallowed.jpg', 'image/jpeg');
- // Hitting the ATTACHED_IMAGE_NOT_IMAGE error means we passed the
+ // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the
// DISALLOWED_CONTENT check
- $this->assertContains($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $crawler->text());
+ $this->assertContainsLang('UNABLE_GET_IMAGE_SIZE', $crawler->text());
}
public function test_too_large()
diff --git a/tests/functional/fixtures/ext/foo/foo/composer.json b/tests/functional/fixtures/ext/foo/foo/composer.json
new file mode 100644
index 0000000000..d85c76a6a2
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "foo/foo",
+ "type": "phpbb-extension",
+ "description": "Testing extensions",
+ "homepage": "",
+ "version": "1.0.0",
+ "time": "2013-03-21 01:01:01",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "Tristan Darricau",
+ "email": "nicofuma@phpbb.com",
+ "homepage": "http://www.phpbb.com",
+ "role": "Developer"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB 3.1 Extension Testing",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/config/resource.yml b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
new file mode 100644
index 0000000000..ed1d018016
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
@@ -0,0 +1,3 @@
+foo_foo_controller:
+ pattern: /foo
+ defaults: { _controller: foo_foo.controller:handle }
diff --git a/tests/functional/fixtures/ext/foo/foo/config/routing.yml b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
new file mode 100644
index 0000000000..c2c401687d
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
@@ -0,0 +1,3 @@
+foo_foo.general:
+ resource: "resource.yml"
+ prefix: /foo
diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml
new file mode 100644
index 0000000000..b3c7719715
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml
@@ -0,0 +1,3 @@
+services:
+ foo_foo.controller:
+ class: foo\foo\controller\controller
diff --git a/tests/functional/fixtures/ext/foo/foo/controller/controller.php b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
new file mode 100644
index 0000000000..771eaeacfc
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace foo\foo\controller;
+
+use Symfony\Component\HttpFoundation\Response;
+
+class controller
+{
+ public function handle()
+ {
+ return new Response('foo/foo controller handle() method', 200);
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/ext.php b/tests/functional/fixtures/ext/foo/foo/ext.php
new file mode 100644
index 0000000000..80acda74fe
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/ext.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace foo\foo;
+
+class ext extends \phpbb\extension\base
+{
+
+}
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php
index e4a960f862..667d268b1e 100644
--- a/tests/functional/notification_test.php
+++ b/tests/functional/notification_test.php
@@ -21,20 +21,20 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
return array(
// Rows inserted by phpBB/install/schemas/schema_data.sql
// Also see PHPBB3-11460
- array('post_notification', true),
- array('topic_notification', true),
- array('post_email', true),
- array('topic_email', true),
+ array('notification.type.post_notification', true),
+ array('notification.type.topic_notification', true),
+ array('notification.type.post_notification.method.email', true),
+ array('notification.type.topic_notification.method.email', true),
// Default behaviour for in-board notifications:
// If user did not opt-out, in-board notifications are on.
- array('bookmark_notification', true),
- array('quote_notification', true),
+ array('notification.type.bookmark_notification', true),
+ array('notification.type.quote_notification', true),
// Default behaviour for email notifications:
// If user did not opt-in, email notifications are off.
- array('bookmark_email', false),
- array('quote_email', false),
+ array('notification.type.bookmark_notification.method.email', false),
+ array('notification.type.quote_notification.method.email', false),
);
}
diff --git a/tests/functional/ucp_preferences_test.php b/tests/functional/ucp_preferences_test.php
new file mode 100644
index 0000000000..7ef325dc4b
--- /dev/null
+++ b/tests/functional/ucp_preferences_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.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_ucp_preferences_test extends phpbb_functional_test_case
+{
+ public function test_submitting_preferences_view()
+ {
+ $this->add_lang('ucp');
+ $this->login();
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'topic_sk' => 'a',
+ 'topic_sd' => 'a',
+ 'topic_st' => '1',
+ 'post_sk' => 'a',
+ 'post_sd' => 'a',
+ 'post_st' => '1',
+ ));
+
+ $crawler = self::submit($form);
+ $this->assertContainsLang('PREFERENCES_UPDATED', $crawler->filter('#message')->text());
+ }
+
+ public function test_submitting_invalid_preferences_view()
+ {
+ $this->add_lang('ucp');
+ $this->login();
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
+ $form = $crawler->selectButton('Submit')->form();
+
+ if (!method_exists($form, 'disableValidation'))
+ {
+ $this->markTestIncomplete('The crawler cannot select invalid values, until Symfony 2.4!');
+ }
+
+ $form = $form->disableValidation();
+ $form['topic_sk']->select('z');
+ $form['topic_sd']->select('z');
+ $form['topic_st']->select('test');
+ $form['post_sk']->select('z');
+ $form['post_sd']->select('z');
+ $form['post_st']->select('test');
+
+ $crawler = self::submit($form);
+ $this->assertContainsLang('WRONG_DATA_POST_SD', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_POST_SK', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_TOPIC_SD', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_TOPIC_SK', $crawler->filter('#cp-main')->text());
+ }
+
+ public function test_read_preferences_view()
+ {
+ $this->add_lang('ucp');
+ $this->login();
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
+ $form = $crawler->selectButton('Submit')->form();
+
+ $this->assertEquals('a', $form->get('topic_sk')->getValue());
+ $this->assertEquals('a', $form->get('topic_sd')->getValue());
+ $this->assertEquals('1', $form->get('topic_st')->getValue());
+ $this->assertEquals('a', $form->get('post_sk')->getValue());
+ $this->assertEquals('a', $form->get('post_sd')->getValue());
+ $this->assertEquals('1', $form->get('post_st')->getValue());
+ }
+}
diff --git a/tests/lock/flock_test.php b/tests/lock/flock_test.php
index 0ff38b6cc8..554b7e57f4 100644
--- a/tests/lock/flock_test.php
+++ b/tests/lock/flock_test.php
@@ -83,9 +83,9 @@ class phpbb_lock_flock_test extends phpbb_test_case
sleep(1);
$lock = new \phpbb\lock\flock($path);
- $start = time();
+ $start = microtime(true);
$ok = $lock->acquire();
- $delta = time() - $start;
+ $delta = microtime(true) - $start;
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
$this->assertGreaterThan(0.5, $delta, 'First lock acquired too soon');
@@ -94,9 +94,9 @@ class phpbb_lock_flock_test extends phpbb_test_case
$this->assertFalse($lock->owns_lock());
// acquire again, this should be instantaneous
- $start = time();
+ $start = microtime(true);
$ok = $lock->acquire();
- $delta = time() - $start;
+ $delta = microtime(true) - $start;
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
$this->assertLessThan(0.1, $delta, 'Second lock not acquired instantaneously');
diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php
index b74a9f236e..fa53e6c8c4 100644
--- a/tests/mimetype/guesser_test.php
+++ b/tests/mimetype/guesser_test.php
@@ -206,4 +206,25 @@ class guesser_test extends \phpbb_test_case
$this->assertInstanceOf('\phpbb\mimetype\content_guesser', $guessers[0]);
$this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]);
}
+
+ public function data_choose_mime_type()
+ {
+ return array(
+ array('application/octet-stream', 'application/octet-stream', null),
+ array('application/octet-stream', 'application/octet-stream', 'application/octet-stream'),
+ array('binary', 'application/octet-stream', 'binary'),
+ array('image/jpeg', 'application/octet-stream', 'image/jpeg'),
+ array('image/jpeg', 'binary', 'image/jpeg'),
+ array('image/jpeg', 'image/jpg', 'image/jpeg'),
+ array('image/jpeg', 'image/jpeg', 'binary'),
+ );
+ }
+
+ /**
+ * @dataProvider data_choose_mime_type
+ */
+ public function test_choose_mime_type($expected, $mime_type, $guess)
+ {
+ $this->assertSame($expected, $this->guesser->choose_mime_type($mime_type, $guess));
+ }
}
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/notification/base.php b/tests/notification/base.php
index bfa9d2a1a4..c97b7c24e2 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -21,21 +21,21 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
{
return array(
'test',
- 'approve_post',
- 'approve_topic',
- 'bookmark',
- 'disapprove_post',
- 'disapprove_topic',
- 'pm',
- 'post',
- 'post_in_queue',
- 'quote',
- 'report_pm',
- 'report_pm_closed',
- 'report_post',
- 'report_post_closed',
- 'topic',
- 'topic_in_queue',
+ 'notification.type.approve_post',
+ 'notification.type.approve_topic',
+ 'notification.type.bookmark',
+ 'notification.type.disapprove_post',
+ 'notification.type.disapprove_topic',
+ 'notification.type.pm',
+ 'notification.type.post',
+ 'notification.type.post_in_queue',
+ 'notification.type.quote',
+ 'notification.type.report_pm',
+ 'notification.type.report_pm_closed',
+ 'notification.type.report_post',
+ 'notification.type.report_post_closed',
+ 'notification.type.topic',
+ 'notification.type.topic_in_queue',
);
}
@@ -92,10 +92,11 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$types = array();
foreach ($this->get_notification_types() as $type)
{
- $class = $this->build_type('phpbb\notification\type\\' . $type);
+ $type_parts = explode('.', $type);
+ $class = $this->build_type('phpbb\notification\type\\' . array_pop($type_parts));
$types[$type] = $class;
- $this->container->set('notification.type.' . $type, $class);
+ $this->container->set($type, $class);
}
$this->notifications->set_var('notification_types', $types);
diff --git a/tests/notification/fixtures/submit_post_bookmark.xml b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
index 525d0484e0..a1413e2cf8 100644
--- a/tests/notification/fixtures/submit_post_bookmark.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>1</value>
</row>
</table>
@@ -123,35 +123,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post.xml b/tests/notification/fixtures/submit_post_notification.type.post.xml
index a38ca77ea0..ed75787c70 100644
--- a/tests/notification/fixtures/submit_post_post.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post</value>
+ <value>notification.type.post</value>
<value>1</value>
</row>
</table>
@@ -153,49 +153,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post_in_queue.xml b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
index 28cb69be36..2dea8e34dd 100644
--- a/tests/notification/fixtures/submit_post_post_in_queue.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post_in_queue</value>
+ <value>notification.type.post_in_queue</value>
<value>1</value>
</row>
</table>
@@ -107,49 +107,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>7</value>
<value></value>
<value>0</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>9</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_quote.xml b/tests/notification/fixtures/submit_post_notification.type.quote.xml
index 2b11992e54..dd5bc620cd 100644
--- a/tests/notification/fixtures/submit_post_quote.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.quote.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>1</value>
</row>
</table>
@@ -95,35 +95,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_topic.xml b/tests/notification/fixtures/submit_post_notification.type.topic.xml
index 5e179d9b99..1ba8d05699 100644
--- a/tests/notification/fixtures/submit_post_topic.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.topic.xml
@@ -42,7 +42,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>1</value>
</row>
</table>
@@ -103,28 +103,28 @@
<column>method</column>
<column>notify</column>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index 14ed4ff62c..afbc586601 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -25,8 +25,8 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
return array_merge(
parent::get_notification_types(),
array(
- 'group_request',
- 'group_request_approved',
+ 'notification.type.group_request',
+ 'notification.type.group_request_approved',
)
);
}
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 24030f5775..75b7275d3a 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -43,7 +43,8 @@ class phpbb_notification_manager_helper extends \phpbb\notification\manager
*/
public function get_item_type_class($item_type, $data = array())
{
- $item_type = 'phpbb\notification\type\\' . $item_type;
+ $item_parts = explode('.', $item_type);
+ $item_type = 'phpbb\notification\type\\' . array_pop($item_parts);
$item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 27ea8ddb44..79fa5338c4 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -25,22 +25,22 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_get_notification_type_id()
{
// They should be inserted the first time
- $post_type_id = $this->notifications->get_notification_type_id('post');
- $quote_type_id = $this->notifications->get_notification_type_id('quote');
+ $post_type_id = $this->notifications->get_notification_type_id('notification.type.post');
+ $quote_type_id = $this->notifications->get_notification_type_id('notification.type.quote');
$test_type_id = $this->notifications->get_notification_type_id('test');
$this->assertEquals(array(
'test' => $test_type_id,
- 'quote' => $quote_type_id,
- 'post' => $post_type_id,
+ 'notification.type.quote' => $quote_type_id,
+ 'notification.type.post' => $post_type_id,
),
$this->notifications->get_notification_type_ids(array(
'test',
- 'quote',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.post',
)
));
- $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('notification.type.quote'));
try
{
@@ -58,12 +58,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assertArrayHasKey('NOTIFICATION_GROUP_MISCELLANEOUS', $subscription_types);
$this->assertArrayHasKey('NOTIFICATION_GROUP_POSTING', $subscription_types);
- $this->assertArrayHasKey('bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
+ $this->assertArrayHasKey('notification.type.pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
//get_subscription_types
//get_subscription_methods
@@ -72,12 +72,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_subscriptions()
{
$expected_subscriptions = array(
- 'post' => array(''),
- 'topic' => array(''),
- 'quote' => array(''),
- 'bookmark' => array(''),
+ 'notification.type.post' => array(''),
+ 'notification.type.topic' => array(''),
+ 'notification.type.quote' => array(''),
+ 'notification.type.bookmark' => array(''),
'test' => array(''),
- 'pm' => array(''),
+ 'notification.type.pm' => array(''),
);
$subscriptions = $this->notifications->get_global_subscriptions(2);
@@ -92,20 +92,20 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assert_array_content_equals($methods, $expected_subscriptions[$item_type]);
}
- $this->notifications->delete_subscription('post', 0, '', 2);
+ $this->notifications->delete_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayNotHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayNotHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
- $this->notifications->add_subscription('post', 0, '', 2);
+ $this->notifications->add_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
}
public function test_notifications()
{
$this->db->sql_query('DELETE FROM phpbb_notification_types');
- $types = array('quote', 'bookmark', 'post', 'test');
+ $types = array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test');
foreach ($types as $id => $type)
{
$this->db->sql_query('INSERT INTO phpbb_notification_types ' .
@@ -150,7 +150,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1349413323,
));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '4',
'topic_id' => '2',
'post_time' => 1349413324,
@@ -166,7 +166,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'user_id' => 0,
)));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'post_time' => 1349413325,
@@ -258,7 +258,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1234, // change time
));
- $this->notifications->update_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->update_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'poster_id' => 2,
diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php
index 6d7747c2ba..7c3b9f938f 100644
--- a/tests/notification/submit_post_type_bookmark_test.php
+++ b/tests/notification/submit_post_type_bookmark_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'bookmark';
+ protected $item_type = 'notification.type.bookmark';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php
index 6bd9c8c93f..1390e92d96 100644
--- a/tests/notification/submit_post_type_post_in_queue_test.php
+++ b/tests/notification/submit_post_type_post_in_queue_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'post_in_queue';
+ protected $item_type = 'notification.type.post_in_queue';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php
index 5007424690..037c326bc0 100644
--- a/tests/notification/submit_post_type_post_test.php
+++ b/tests/notification/submit_post_type_post_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_post_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'post';
+ protected $item_type = 'notification.type.post';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
index 94979fd154..61e3840773 100644
--- a/tests/notification/submit_post_type_quote_test.php
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'quote';
+ protected $item_type = 'notification.type.quote';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php
index 52e9353c7c..c095fbc4ba 100644
--- a/tests/notification/submit_post_type_topic_test.php
+++ b/tests/notification/submit_post_type_topic_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'topic';
+ protected $item_type = 'notification.type.topic';
public function setUp()
{
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',
),
);
}
diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php
index 27e94d6a07..3832307897 100644
--- a/tests/path_helper/path_helper_test.php
+++ b/tests/path_helper/path_helper_test.php
@@ -205,6 +205,18 @@ class phpbb_path_helper_test extends phpbb_test_case
array('test' => 'xyz', 'var' => 'value'),
'test=xyz&amp;var=value',
),
+ array(
+ array('test' => null),
+ 'test',
+ ),
+ array(
+ array('test' => null, 'var' => null),
+ 'test&amp;var',
+ ),
+ array(
+ array('test' => 'xyz', 'var' => null, 'bar' => 'value'),
+ 'test=xyz&amp;var&amp;bar=value',
+ ),
);
}
@@ -254,6 +266,21 @@ class phpbb_path_helper_test extends phpbb_test_case
true,
array('base' => 'mcp.php', 'params' => array('f' => '3')),
),
+ array(
+ 'index.php?ready',
+ false,
+ array('base' => 'index.php', 'params' => array('ready' => null)),
+ ),
+ array(
+ 'index.php?i=1&amp;ready',
+ true,
+ array('base' => 'index.php', 'params' => array('i' => '1', 'ready' => null)),
+ ),
+ array(
+ 'index.php?ready&i=1',
+ false,
+ array('base' => 'index.php', 'params' => array('ready' => null, 'i' => '1')),
+ ),
);
}
diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php
new file mode 100644
index 0000000000..b4ad84e9c3
--- /dev/null
+++ b/tests/template/template_allfolder_test.php
@@ -0,0 +1,59 @@
+<?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__) . '/template_test_case.php';
+
+class phpbb_template_allfolder_test extends phpbb_template_template_test_case
+{
+ public function test_allfolder()
+ {
+ $this->setup_engine_for_allfolder();
+
+ $this->run_template('foobar_body.html', array(), array(), array(), "All folder");
+ }
+
+ protected function setup_engine_for_allfolder(array $new_config = array())
+ {
+ global $phpbb_root_path, $phpEx;
+
+ $defaults = $this->config_defaults();
+ $config = new \phpbb\config\config(array_merge($defaults, $new_config));
+ $this->user = new \phpbb\user('\phpbb\datetime');
+
+ $path_helper = new \phpbb\path_helper(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ new \phpbb\filesystem(),
+ $this->getMock('\phpbb\request\request'),
+ $phpbb_root_path,
+ $phpEx
+ );
+
+ $this->extension_manager = new phpbb_mock_extension_manager(
+ dirname(__FILE__) . '/',
+ array(
+ 'vendor4/bar' => array(
+ 'ext_name' => 'vendor4/bar',
+ 'ext_active' => '1',
+ 'ext_path' => 'ext/vendor4/bar/',
+ ),
+ )
+ );
+
+ $this->template_path = $this->test_path . '/templates';
+ $this->ext_template_path = 'tests/extension/ext/vendor4/bar/styles/all/template';
+ $this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, new \phpbb\template\context(), $this->extension_manager);
+ $this->template->set_custom_style('all', array($this->template_path, $this->ext_template_path));
+ }
+}
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index 46276bcfcb..9dbb7150f1 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -69,10 +69,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
global $phpbb_root_path, $phpEx, $table_prefix;
$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx);
- $classes = $finder->core_path('phpbb/')
- ->core_directory('/db/migration/data')
+ $classes = $finder->core_path('phpbb/db/migration/data/')
->set_extensions($setup_extensions)
- ->extension_directory('migrations')
+ ->extension_directory('/migrations')
->get_classes();
$db = new \phpbb\db\driver\sqlite();