diff --git a/framework/core/.travis.yml b/framework/core/.travis.yml index 2226ea1a2..b217e0233 100644 --- a/framework/core/.travis.yml +++ b/framework/core/.travis.yml @@ -1,9 +1,9 @@ language: php php: - - 5.6 - 7.0 - 7.1 + - 7.2 - hhvm matrix: diff --git a/framework/core/LICENSE b/framework/core/LICENSE index 1e346ea06..e6288c67a 100644 --- a/framework/core/LICENSE +++ b/framework/core/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2017 Toby Zerner +Copyright (c) 2014-2018 Toby Zerner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/framework/core/composer.json b/framework/core/composer.json index 1ee4195f0..9737688b2 100644 --- a/framework/core/composer.json +++ b/framework/core/composer.json @@ -20,24 +20,24 @@ "docs": "http://flarum.org/docs" }, "require": { - "php": ">=5.6.0", + "php": ">=7.0", "dflydev/fig-cookies": "^1.0.2", "doctrine/dbal": "^2.5", "components/font-awesome": "^4.6", "franzl/whoops-middleware": "^0.4.0", - "illuminate/bus": "5.1.*", - "illuminate/cache": "5.1.*", - "illuminate/config": "5.1.*", - "illuminate/container": "5.1.*", - "illuminate/contracts": "5.1.*", - "illuminate/database": "^5.1.31", - "illuminate/events": "5.1.*", - "illuminate/filesystem": "5.1.*", - "illuminate/hashing": "5.1.*", - "illuminate/mail": "5.1.*", - "illuminate/support": "5.1.*", - "illuminate/validation": "5.1.*", - "illuminate/view": "5.1.*", + "illuminate/bus": "5.5.*", + "illuminate/cache": "5.5.*", + "illuminate/config": "5.5.*", + "illuminate/container": "5.5.*", + "illuminate/contracts": "5.5.*", + "illuminate/database": "5.5.*", + "illuminate/events": "5.5.*", + "illuminate/filesystem": "5.5.*", + "illuminate/hashing": "5.5.*", + "illuminate/mail": "5.5.*", + "illuminate/support": "5.5.*", + "illuminate/validation": "5.5.*", + "illuminate/view": "5.5.*", "intervention/image": "^2.3.0", "league/flysystem": "^1.0.11", "league/oauth2-client": "~1.0", @@ -46,10 +46,11 @@ "nikic/fast-route": "^0.6", "oyejorge/less.php": "~1.5", "psr/http-message": "^1.0", - "symfony/console": "^2.7", - "symfony/http-foundation": "^2.7", - "symfony/translation": "^2.7", - "symfony/yaml": "^2.7", + "symfony/config": "^3.3", + "symfony/console": "^3.3", + "symfony/http-foundation": "^3.3", + "symfony/translation": "^3.3", + "symfony/yaml": "^3.3", "s9e/text-formatter": "^0.8.1", "tobscure/json-api": "^0.3.0", "zendframework/zend-diactoros": "^1.6", @@ -57,7 +58,7 @@ }, "require-dev": { "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^6.0" }, "autoload": { "psr-4": { diff --git a/framework/core/error/403.html b/framework/core/error/403.html deleted file mode 100644 index 1ed30a168..000000000 --- a/framework/core/error/403.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - -

403 Forbidden

-

You do not have permissions to access this page.

- - - \ No newline at end of file diff --git a/framework/core/error/404.html b/framework/core/error/404.html deleted file mode 100644 index 262b80985..000000000 --- a/framework/core/error/404.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - -

404 Not Found

-

Looks like this page could not be found.

- - - \ No newline at end of file diff --git a/framework/core/error/500.html b/framework/core/error/500.html deleted file mode 100644 index f9af9e116..000000000 --- a/framework/core/error/500.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - -

500 Internal Server Error

-

Something went wrong on our server.

- - - diff --git a/framework/core/error/503.html b/framework/core/error/503.html deleted file mode 100644 index 46243a1c5..000000000 --- a/framework/core/error/503.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - -

503 Service Unavailable

-

This forum is down for maintenance.

- - - diff --git a/framework/core/js/admin/dist/app.js b/framework/core/js/admin/dist/app.js index b8f9c3745..64c0aa374 100644 --- a/framework/core/js/admin/dist/app.js +++ b/framework/core/js/admin/dist/app.js @@ -17536,11 +17536,13 @@ System.register('flarum/components/AdminNav', ['flarum/Component', 'flarum/compo babelHelpers.createClass(AdminNav, [{ key: 'view', value: function view() { - return m(SelectDropdown, { - className: 'AdminNav App-titleControl', - buttonClassName: 'Button', - children: this.items().toArray() - }); + return m( + SelectDropdown, + { + className: 'AdminNav App-titleControl', + buttonClassName: 'Button' }, + this.items().toArray() + ); } }, { key: 'items', @@ -17832,8 +17834,8 @@ System.register('flarum/components/AppearancePage', ['flarum/components/Page', ' m( 'div', { className: 'AppearancePage-colors-input' }, - m('input', { className: 'FormControl', type: 'color', placeholder: '#aaaaaa', value: this.primaryColor(), onchange: m.withAttr('value', this.primaryColor) }), - m('input', { className: 'FormControl', type: 'color', placeholder: '#aaaaaa', value: this.secondaryColor(), onchange: m.withAttr('value', this.secondaryColor) }) + m('input', { className: 'FormControl', type: 'text', placeholder: '#aaaaaa', value: this.primaryColor(), onchange: m.withAttr('value', this.primaryColor) }), + m('input', { className: 'FormControl', type: 'text', placeholder: '#aaaaaa', value: this.secondaryColor(), onchange: m.withAttr('value', this.secondaryColor) }) ), Switch.component({ state: this.darkMode(), @@ -18356,15 +18358,17 @@ System.register('flarum/components/Checkbox', ['flarum/Component', 'flarum/compo } }; });; -"use strict"; +'use strict'; -System.register("flarum/components/DashboardPage", ["flarum/components/Page"], function (_export, _context) { +System.register('flarum/components/DashboardPage', ['flarum/components/Page', 'flarum/components/StatusWidget'], function (_export, _context) { "use strict"; - var Page, DashboardPage; + var Page, StatusWidget, DashboardPage; return { setters: [function (_flarumComponentsPage) { Page = _flarumComponentsPage.default; + }, function (_flarumComponentsStatusWidget) { + StatusWidget = _flarumComponentsStatusWidget.default; }], execute: function () { DashboardPage = function (_Page) { @@ -18376,70 +18380,74 @@ System.register("flarum/components/DashboardPage", ["flarum/components/Page"], f } babelHelpers.createClass(DashboardPage, [{ - key: "view", + key: 'view', value: function view() { return m( - "div", - { className: "DashboardPage" }, + 'div', + { className: 'DashboardPage' }, m( - "div", - { className: "container" }, - m( - "h2", - null, - app.translator.trans('core.admin.dashboard.welcome_text') - ), - m( - "p", - null, - app.translator.trans('core.admin.dashboard.version_text', { version: m( - "strong", - null, - app.forum.attribute('version') - ) }) - ), - m( - "p", - null, - app.translator.trans('core.admin.dashboard.beta_warning_text', { strong: m("strong", null) }) - ), - m( - "ul", - null, - m( - "li", - null, - app.translator.trans('core.admin.dashboard.contributing_text', { a: m("a", { href: "http://flarum.org/docs/contributing", target: "_blank" }) }) - ), - m( - "li", - null, - app.translator.trans('core.admin.dashboard.troubleshooting_text', { a: m("a", { href: "http://flarum.org/docs/troubleshooting", target: "_blank" }) }) - ), - m( - "li", - null, - app.translator.trans('core.admin.dashboard.support_text', { a: m("a", { href: "http://discuss.flarum.org/t/support", target: "_blank" }) }) - ), - m( - "li", - null, - app.translator.trans('core.admin.dashboard.features_text', { a: m("a", { href: "http://discuss.flarum.org/t/features", target: "_blank" }) }) - ), - m( - "li", - null, - app.translator.trans('core.admin.dashboard.extension_text', { a: m("a", { href: "http://flarum.org/docs/extend", target: "_blank" }) }) - ) - ) + 'div', + { className: 'container' }, + this.availableWidgets() ) ); } + }, { + key: 'availableWidgets', + value: function availableWidgets() { + return [m(StatusWidget, null)]; + } }]); return DashboardPage; }(Page); - _export("default", DashboardPage); + _export('default', DashboardPage); + } + }; +});; +'use strict'; + +System.register('flarum/components/DashboardWidget', ['flarum/Component'], function (_export, _context) { + "use strict"; + + var Component, Widget; + return { + setters: [function (_flarumComponent) { + Component = _flarumComponent.default; + }], + execute: function () { + Widget = function (_Component) { + babelHelpers.inherits(Widget, _Component); + + function Widget() { + babelHelpers.classCallCheck(this, Widget); + return babelHelpers.possibleConstructorReturn(this, (Widget.__proto__ || Object.getPrototypeOf(Widget)).apply(this, arguments)); + } + + babelHelpers.createClass(Widget, [{ + key: 'view', + value: function view() { + return m( + 'div', + { className: "Widget " + this.className() }, + this.content() + ); + } + }, { + key: 'className', + value: function className() { + return ''; + } + }, { + key: 'content', + value: function content() { + return []; + } + }]); + return Widget; + }(Component); + + _export('default', Widget); } }; });; @@ -18509,6 +18517,10 @@ System.register('flarum/components/Dropdown', ['flarum/Component', 'flarum/helpe $menu.toggleClass('Dropdown-menu--top', $menu.offset().top + $menu.height() > $(window).scrollTop() + $(window).height()); + if ($menu.offset().top < 0) { + $menu.removeClass('Dropdown-menu--top'); + } + $menu.toggleClass('Dropdown-menu--right', isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width()); }); @@ -21102,6 +21114,84 @@ System.register('flarum/components/SplitDropdown', ['flarum/components/Dropdown' });; 'use strict'; +System.register('flarum/components/StatusWidget', ['flarum/components/DashboardWidget', 'flarum/helpers/icon', 'flarum/helpers/listItems', 'flarum/utils/ItemList'], function (_export, _context) { + "use strict"; + + var DashboardWidget, icon, listItems, ItemList, StatusWidget; + return { + setters: [function (_flarumComponentsDashboardWidget) { + DashboardWidget = _flarumComponentsDashboardWidget.default; + }, function (_flarumHelpersIcon) { + icon = _flarumHelpersIcon.default; + }, function (_flarumHelpersListItems) { + listItems = _flarumHelpersListItems.default; + }, function (_flarumUtilsItemList) { + ItemList = _flarumUtilsItemList.default; + }], + execute: function () { + StatusWidget = function (_DashboardWidget) { + babelHelpers.inherits(StatusWidget, _DashboardWidget); + + function StatusWidget() { + babelHelpers.classCallCheck(this, StatusWidget); + return babelHelpers.possibleConstructorReturn(this, (StatusWidget.__proto__ || Object.getPrototypeOf(StatusWidget)).apply(this, arguments)); + } + + babelHelpers.createClass(StatusWidget, [{ + key: 'className', + value: function className() { + return 'StatusWidget'; + } + }, { + key: 'content', + value: function content() { + return m( + 'ul', + null, + listItems(this.items().toArray()) + ); + } + }, { + key: 'items', + value: function items() { + var items = new ItemList(); + + items.add('help', m( + 'a', + { href: 'http://flarum.org/docs/troubleshooting', target: '_blank' }, + icon('question-circle'), + ' ', + app.translator.trans('core.admin.dashboard.help_link') + )); + + items.add('version-flarum', [m( + 'strong', + null, + 'Flarum' + ), m('br', null), app.forum.attribute('version')]); + items.add('version-php', [m( + 'strong', + null, + 'PHP' + ), m('br', null), app.data.phpVersion]); + items.add('version-mysql', [m( + 'strong', + null, + 'MySQL' + ), m('br', null), app.data.mysqlVersion]); + + return items; + } + }]); + return StatusWidget; + }(DashboardWidget); + + _export('default', StatusWidget); + } + }; +});; +'use strict'; + System.register('flarum/components/Switch', ['flarum/components/Checkbox'], function (_export, _context) { "use strict"; @@ -21255,6 +21345,52 @@ System.register('flarum/components/UploadImageButton', ['flarum/components/Butto } }; });; +'use strict'; + +System.register('flarum/components/Widget', ['flarum/Component'], function (_export, _context) { + "use strict"; + + var Component, DashboardWidget; + return { + setters: [function (_flarumComponent) { + Component = _flarumComponent.default; + }], + execute: function () { + DashboardWidget = function (_Component) { + babelHelpers.inherits(DashboardWidget, _Component); + + function DashboardWidget() { + babelHelpers.classCallCheck(this, DashboardWidget); + return babelHelpers.possibleConstructorReturn(this, (DashboardWidget.__proto__ || Object.getPrototypeOf(DashboardWidget)).apply(this, arguments)); + } + + babelHelpers.createClass(DashboardWidget, [{ + key: 'view', + value: function view() { + return m( + 'div', + { className: "DashboardWidget " + this.className() }, + this.content() + ); + } + }, { + key: 'className', + value: function className() { + return ''; + } + }, { + key: 'content', + value: function content() { + return []; + } + }]); + return DashboardWidget; + }(Component); + + _export('default', DashboardWidget); + } + }; +});; "use strict"; System.register("flarum/extend", [], function (_export, _context) { @@ -22451,10 +22587,6 @@ System.register('flarum/models/User', ['flarum/Model', 'flarum/utils/stringToCol password: Model.attribute('password'), avatarUrl: Model.attribute('avatarUrl'), - bio: Model.attribute('bio'), - bioHtml: computed('bio', function (bio) { - return bio ? '

' + $('

').text(bio).html().replace(/\n/g, '
').autoLink({ rel: 'nofollow' }) + '

' : ''; - }), preferences: Model.attribute('preferences'), groups: Model.hasMany('groups'), @@ -23317,7 +23449,7 @@ System.register('flarum/utils/extractText', [], function (_export, _context) { return vdom.map(function (element) { return extractText(element); }).join(''); - } else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') { + } else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object' && vdom !== null) { return extractText(vdom.children); } else { return vdom; @@ -23603,7 +23735,12 @@ System.register('flarum/utils/patchMithril', ['../Component'], function (_export } if (comp.prototype && comp.prototype instanceof Component) { - return comp.component.apply(comp, args); + var children = args.slice(1); + if (children.length === 1 && Array.isArray(children[0])) { + children = children[0]; + } + + return comp.component(args[0], children); } var node = mo.apply(this, arguments); diff --git a/framework/core/js/admin/src/components/AdminNav.js b/framework/core/js/admin/src/components/AdminNav.js index 64c6d547c..5384e2bc7 100644 --- a/framework/core/js/admin/src/components/AdminNav.js +++ b/framework/core/js/admin/src/components/AdminNav.js @@ -18,9 +18,9 @@ export default class AdminNav extends Component { return ( + buttonClassName="Button"> + {this.items().toArray()} + ); } diff --git a/framework/core/js/admin/src/components/AppearancePage.js b/framework/core/js/admin/src/components/AppearancePage.js index 8e35a958a..62ba8e52c 100644 --- a/framework/core/js/admin/src/components/AppearancePage.js +++ b/framework/core/js/admin/src/components/AppearancePage.js @@ -3,6 +3,7 @@ import Button from 'flarum/components/Button'; import Switch from 'flarum/components/Switch'; import EditCustomCssModal from 'flarum/components/EditCustomCssModal'; import EditCustomHeaderModal from 'flarum/components/EditCustomHeaderModal'; +import EditCustomFooterModal from 'flarum/components/EditCustomFooterModal'; import UploadImageButton from 'flarum/components/UploadImageButton'; import saveSettings from 'flarum/utils/saveSettings'; @@ -28,8 +29,8 @@ export default class AppearancePage extends Page {
- - + +
{Switch.component({ @@ -81,6 +82,18 @@ export default class AppearancePage extends Page { })} +
+ {app.translator.trans('core.admin.appearance.custom_footer_heading')} +
+ {app.translator.trans('core.admin.appearance.custom_footer_text')} +
+ {Button.component({ + className: 'Button', + children: app.translator.trans('core.admin.appearance.edit_footer_button'), + onclick: () => app.modal.show(new EditCustomFooterModal()) + })} +
+
{app.translator.trans('core.admin.appearance.custom_styles_heading')}
diff --git a/framework/core/js/admin/src/components/DashboardPage.js b/framework/core/js/admin/src/components/DashboardPage.js index 0c7207d26..30e0fb589 100644 --- a/framework/core/js/admin/src/components/DashboardPage.js +++ b/framework/core/js/admin/src/components/DashboardPage.js @@ -1,22 +1,18 @@ import Page from 'flarum/components/Page'; +import StatusWidget from 'flarum/components/StatusWidget'; export default class DashboardPage extends Page { view() { return (
-

{app.translator.trans('core.admin.dashboard.welcome_text')}

-

{app.translator.trans('core.admin.dashboard.version_text', {version: {app.forum.attribute('version')}})}

-

{app.translator.trans('core.admin.dashboard.beta_warning_text', {strong: })}

- + {this.availableWidgets()}
); } + + availableWidgets() { + return []; + } } diff --git a/framework/core/js/admin/src/components/DashboardWidget.js b/framework/core/js/admin/src/components/DashboardWidget.js new file mode 100644 index 000000000..4e0b0ea96 --- /dev/null +++ b/framework/core/js/admin/src/components/DashboardWidget.js @@ -0,0 +1,38 @@ +/* + * This file is part of Flarum. + * + * (c) Toby Zerner + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import Component from 'flarum/Component'; + +export default class Widget extends Component { + view() { + return ( +
+ {this.content()} +
+ ); + } + + /** + * Get the class name to apply to the widget. + * + * @return {String} + */ + className() { + return ''; + } + + /** + * Get the content of the widget. + * + * @return {VirtualElement} + */ + content() { + return []; + } +} diff --git a/framework/core/js/admin/src/components/EditCustomFooterModal.js b/framework/core/js/admin/src/components/EditCustomFooterModal.js new file mode 100644 index 000000000..1cd02a012 --- /dev/null +++ b/framework/core/js/admin/src/components/EditCustomFooterModal.js @@ -0,0 +1,24 @@ +import SettingsModal from 'flarum/components/SettingsModal'; + +export default class EditCustomFooterModal extends SettingsModal { + className() { + return 'EditCustomFooterModal Modal--large'; + } + + title() { + return app.translator.trans('core.admin.edit_footer.title'); + } + + form() { + return [ +

{app.translator.trans('core.admin.edit_footer.customize_text')}

, +
+