Commit Graph

143 Commits

Author SHA1 Message Date
Franz Liedke
076288db21
Update zend-diactoros constraint
See security advisory ZF2018-01:
https://framework.zend.com/security/advisory/ZF2018-01
2018-08-02 23:15:24 +02:00
Clark Winkelmann
df7e24cba6 Update urls with their current canonical versions (#1524) 2018-08-02 17:39:06 +02:00
Sajjad Hashemian
fba31995b1 Upgrade text formatter (#1457)
* upgrade TextFormatter

* remove finalize options

* cleanup JsCompiler

* simplify Formatter

* refactor Formatter cache

* minify formatter js

* remove Closure Compiler
2018-07-14 22:22:14 +02:00
Franz Liedke
d42205a8ff
Update doctrine/dbal version constraint
This update is needed to fix MariaDB compatibility.
See #1211.
2018-07-09 00:14:57 +02:00
Franz Liedke
00bc8fc0bc
Composer: Reorder dependencies
[ci skip]
2018-06-30 23:46:10 +02:00
Toby Zerner
0e73785498
Frontend refactor (#1471)
Refactor Frontend + Asset code

- Use Laravel's Filesystem component for asset IO, meaning theoretically
  assets should be storable on S3 etc.

- More reliable checking for asset recompilation when debug mode is on,
  so you don't have to constantly delete the compiled assets to force
  a recompile. Should also fix issues with locale JS files being
  recompiled with the same name and cached.

- Remove JavaScript minification, because it will be done by Webpack
  (exception is for the TextFormatter JS).

- Add support for JS sourcemaps.

- Separate frontend view and assets completely. This is an important
  distinction because frontend assets are compiled independent of a
  request, whereas putting together a view depends on a request.

- Bind frontend view/asset factory instances to the container (in
  service providers) rather than subclassing. Asset and content
  populators can be added to these factories – these are simply objects
  that populate the asset compilers or the view with information.

- Add RouteHandlerFactory functions that make it easy to hook up a
  frontend controller with a frontend instance ± some content.

- Remove the need for "nojs"

- Fix cache:clear command

- Recompile assets when settings/enabled extensions change
2018-06-30 12:31:12 +09:30
Franz Liedke
3ec32f8430
Composer: Sort dependencies 2018-06-02 15:07:23 +02:00
Franz Liedke
3680d88fb7
Use PSR-15 middleware standard
This finally adopts the new standardized interfaces instead of the
work-in-progress ones with the `Interop\` prefix.

Since we have now updated to PHP 7.1, we can also use Stratigility
3.0 as the middleware dispatcher.
2018-05-29 00:18:24 +02:00
Franz Liedke
0278d52cbe
Require PHP 7.1
This will be the last PHP requirement upgrade for a while, at least
until stable (and therefore until the next major release).

We have decided to do this now, for the following reasons:
- We want to support MariaDB (and the compatible release of
  doctrine/dbal requires 7.1 as well).
- We prefer to upgrade to Laravel 5.6 sooner rather than later.
- Using the PSR-15 middleware standard is easier this way, as we do
  not have to switch from zend-stratigility to another PSR-15
  implementation. (Stratigility v3, which implements the final
  standard, requires 7.1.)
2018-05-28 23:21:22 +02:00
Toby Zerner
5672819549
Use Illuminate Session component instead of Symfony
Symfony's component relies on PHP's native session functionality, which
is not ideal. It automatically sets its own cookie headers, resulting in
this issue: https://github.com/flarum/core/issues/1084#issuecomment-364569953

The Illuminate component is more powerful and has a simpler API for
extension with other drivers and such, and fits in nicely with other
components we use (the majority of which are from Illuminate).
2018-03-18 14:43:44 +01:00
Franz Liedke
9d30be1617
Update Stratigility, use http-interop middleware 2018-03-18 13:52:16 +01:00
Franz Liedke
a061eda019
Change namespace of test classes
(as implemented by @luceos in his WIP PR)
2018-03-04 00:01:49 +01:00
AFR
1a2df2d581 FontAwesome v5.0.6 (#1372)
* Update FontAwesome to v5.0.6

* Adapt DiscussionListItem-count icon to match FontAwesome 5 syntax

* Change icon name to match FontAwesome 5.0.6 fas icon

* Add font type prefix parameter to icon helper

* Add Enable Icon Prefix to show icon in Extension Page

* Fix invalid icon behavior

* Change icon name to match FontAwesome 5.0.6 far icon

* Use iconPrefix property on component

* Use full icon class name

* Update icon helper docblock

* Full icon class syntax
2018-02-23 23:42:00 +01:00
Daniël Klabbers
f65e4dcba3
merges 5.5 and master into next-back 2017-12-14 01:00:16 +01:00
Toby Zerner
9cc67fe312 Performance: Cache translation catalogue to avoid reparsing YAML 2017-11-11 22:45:38 +10:30
Daniel Klabbers
2037371886 lists > pluck 2017-10-05 13:39:41 +02:00
Franz Liedke
1e8399c014
Update zend-diactoros to v1.6
This release contains a useful fix for Content-Length problems
that we have experienced before.

See https://github.com/zendframework/zend-diactoros/releases/tag/1.6.0.
2017-09-15 13:27:11 +02:00
Franz Liedke
015967a76c
Require PHP 5.6 2017-02-03 21:53:20 +01:00
Franz Liedke
b5b18dd436 Update to Zend Stratigility 1.3
* Fix dependency version constraint. (Reverts #1066.)
* Allow exceptions to be raised when dispatching middleware.
* Fix our error handler middleware (do not implement Stratigility's
  error handler interface, catch exceptions instead).

See https://docs.zendframework.com/zend-stratigility/migration/to-v2/.

Closes #1069.
2017-01-02 22:57:09 +01:00
Toby Zerner
7af4b8d45f Merge pull request #1049 from JoshyPHP/TextFormatter-0.8.0
Updated s9e\TextFormatter to 0.8.1
2016-11-29 16:36:10 +10:30
Daniël Klabbers
7a9795fbc3 Update composer.json
fixes #1065 , this is a temporary fix until compatibility with 1.3.0 is guaranteed by refactoring
2016-11-12 01:20:10 +01:00
JoshyPHP
96926a180a Updated s9e\TextFormatter to 0.8.1 2016-10-10 01:58:40 +02:00
JoshyPHP
7b3ac18c14 Updated s9e\TextFormatter to 0.6.1 2016-07-30 03:53:32 +02:00
Toby Zerner
6db27dff4f Move phpunit.xml into root to make PHPUnit easier to run
This seems to be pretty standard. Can just run `vendor/bin/phpunit` without any arguments. Removes the need for `composer test` (which is not ideal anyway as it removes colours from the output).
2016-06-05 09:16:29 +09:30
Toby Zerner
8328c446b0 Use smaller FontAwesome shim repo instead of original
components/font-awesome is ~8 MB smaller than fortawesome/font-awesome because it excludes all examples/docs. Reducing dependency filesize will be important when we want to package up a .zip for distribution.
2016-05-29 10:21:37 +09:30
Franz Liedke
d3606b7f7e
Update TextFormatter to next release
This fixes some minor issues with emojis working correctly in the dropdown,
but not when rendered in the live preview or from the server.
2016-05-23 22:48:59 +09:00
Franz Liedke
619561cf56
Install FontAwesome via Composer.
This also updates the asset publishing and LESS paths accordingly.

Refs #891.
2016-05-09 21:28:38 +09:00
JoshyPHP
6d809cb023 Updated s9e\TextFormatter to 0.5.0 (#947) 2016-04-29 15:11:30 +09:30
Franz Liedke
694f5ad2e8
Update Whoops middleware 2016-04-18 10:55:40 +09:00
Toby Zerner
bd50a23966 Update json-api dependency 2016-03-31 20:02:42 +10:30
Franz Liedke
9e79470603 Update fig-cookies dependency and use new shortcut 2016-03-31 09:43:17 +09:00
Franz Liedke
77086c9be6 Travis: Do not run PhpUnit through Composer
We need to run PhpUnit with xDebug enabled in order to collect
code coverage information. It is disabled for performance reasons,
though: https://github.com/travis-ci/travis-ci/issues/5780.
2016-03-21 23:12:09 +09:00
Franz Liedke
3c629f091d Travis: Generate code coverage report when running tests 2016-03-21 20:21:51 +09:00
Franz Liedke
eef895c16f Composer: Sort dependencies alphabetically 2016-03-20 22:27:43 +09:00
Franz Liedke
2be964f8e2 Update to latest version of text-formatter 2016-03-20 22:25:45 +09:00
Toby Zerner
2391471937 Clean up linting stuff. closes #852 2016-03-10 17:13:30 +10:30
Franz Liedke
db7a03fbe5 Add some handy shortcuts for typical migration tasks
This will make it much easier for extension developers (and also less
error-prone) to create migrations for things like creating tables,
renaming columns and so on...
2016-02-25 00:50:03 +09:00
Toby Zerner
fb09cef540 Merge pull request #748 from JoshyPHP/Minifiers
Added support for new minifiers
2016-02-07 11:37:15 +10:30
Toby Zerner
2980c94247 Add Composer branch-alias
This allows installations to require version 0.1.0 with minimum-stability=dev, and they will get the latest from master.

See #727
2016-01-19 17:00:10 +10:30
JoshyPHP
09ad4a180b Added support for new minifiers 2016-01-15 16:59:56 +01:00
Toby Zerner
973ca16eee Add base OAuth2 controller 2015-12-05 15:25:10 +10:30
Toby Zerner
387109002e Rework sessions, remember cookies, and auth again
- Use Symfony's Session component to work with sessions, instead of a custom database model. Separate the concept of access tokens from sessions once again.
- Extract common session/remember cookie logic into SessionAuthenticator and Rememberer classes.
- Extract AuthenticateUserTrait into a new AuthenticationResponseFactory class.
- Fix forgot password process.
2015-12-05 15:11:25 +10:30
Franz Liedke
61b09ac982 Update text-formatter dependency 2015-11-19 13:00:32 +01:00
Franz Liedke
17619843b5 Update to newest version of Whoops middleware 2015-10-31 12:56:38 +01:00
Toby Zerner
7d4a04760c Use stable version of tobscure/json-api 2015-10-31 10:08:37 +10:30
Kirk Bushell
f0883471ef Updated tests namespace to be ps4-valid. Added tests for flooding exception, fixed broken code 2015-10-27 12:48:27 +00:00
Toby Zerner
c08b62af80 Refactor translation and validation
We now use Symfony's Translation component. Yay! We get more powerful pluralisation and better a fallback mechanism. Will want to implement the caching mechanism at some point too. The API is replicated in JavaScript, which could definitely use some testing.

Validators have been refactored so that they are decoupled from models completely (i.e. they simply validate arrays of user input). Language packs should include Laravel's validation messages.

ref #267
2015-10-15 22:30:45 +10:30
Franz Liedke
a23180f279 Revert previous commit 2015-10-14 13:52:52 +02:00
Franz Liedke
cc68c6f503 Fix version constraint for tobscure/json-api 2015-10-14 13:42:18 +02:00
Franz Liedke
d0a188bc42 Require version 0.1 of Whoops middleware 2015-10-14 13:40:02 +02:00
Franz Liedke
7b49f3c24c Clean up 2015-10-14 07:50:42 +02:00
Toby Zerner
8e5b13903e Add more info to composer.json 2015-10-11 11:18:30 +10:30
Toby Zerner
dd67291ce0 Major refactor and improvements
- Reorganised all namespaces and class names for consistency and structure. Following PSR bylaws (Abstract prefix, Interface/Trait suffix).
  - Move models into root of Core, because writing `use Flarum\Core\Discussion` is nice. Namespace the rest by type. (Namespacing by entity was too arbitrary.)
  - Moved some non-domain stuff out of Core: Database, Formatter, Settings.
  - Renamed config table and all references to "settings" for consistency.
  - Remove Core class and add url()/isInstalled()/inDebugMode() as instance methods of Foundation\Application.
  - Cleanup, docblocking, etc.

- Improvements to HTTP architecture
  - API and forum/admin Actions are now actually all the same thing (simple PSR-7 Request handlers), renamed to Controllers.
  - Upgrade to tobscure/json-api 0.2 branch.
  - Where possible, moved generic functionality to tobscure/json-api (e.g. pagination links). I'm quite happy with the backend balance now re: #262

- Improvements to other architecture
  - Use Illuminate's Auth\Access\Gate interface/implementation instead of our old Locked trait. We still use events to actually determine the permissions though. Our Policy classes are actually glorified event subscribers.
  - Extract model validation into Core\Validator classes.
  - Make post visibility permission stuff much more efficient and DRY.

- Renamed Flarum\Event classes for consistency. ref #246
  - `Configure` prefix for events dedicated to configuring an object.
  - `Get` prefix for events whose listeners should return something.
  - `Prepare` prefix when a variable is passed by reference so it can be modified.
  - `Scope` prefix when a query builder is passed.

- Miscellaneous improvements/bug-fixes. I'm easily distracted!
  - Increase default height of post composer.
  - Improve post stream redraw flickering in Safari by keying loading post placeholders with their IDs. ref #451
  - Use a PHP JavaScript minification library for minifying TextFormatter's JavaScript, instead of ClosureCompilerService (can't rely on external service!)
  - Use UrlGenerator properly in various places. closes #123
  - Make Api\Client return Response object. closes #128
  - Allow extensions to specify custom icon images.
  - Allow external API/admin URLs to be optionally specified in config.php. If the value or "url" is an array, we look for the corresponding path inside. Otherwise, we append the path to the base URL, using the corresponding value in "paths" if present. closes #244
2015-10-08 14:28:02 +10:30
Toby Zerner
0142b01cc5 Add server 2015-10-02 17:47:12 +09:30
kirkbushell
c3374197d1 Added zend-stragility (missing), removed some redundant code. 2015-09-28 15:59:07 +01:00
kirkbushell
bac3fe84da Moved psr-4 loading for tests out of the autoload 2015-09-28 15:44:35 +01:00
kirkbushell
a00226c05a Added some tests for the database setting repository 2015-09-28 15:34:32 +01:00
kirkbushell
7706714ad9 Removed phpsec as the testing library, added phpunit and converted the first spec test to phpunit format. Also added mockery. 2015-09-28 15:09:13 +01:00
Franz Liedke
4c6e03a692 Update TextFormatter
Fixes #532.
2015-09-23 09:03:24 +02:00
Daniel Klabbers
a2b43f6f78 version constraint must match laravel dependancies at least 2015-09-16 09:56:19 +02:00
Toby Zerner
a2def83045 Update dependencies 2015-09-14 18:45:49 +09:30
Toby Zerner
b7d8afe6a4 Add doctrine/dbal dependency so that migrations can rename columns 2015-09-14 15:31:05 +09:30
Franz Liedke
ba097dc147 Add Composer scripts 2015-08-30 14:59:10 +02:00
Toby Zerner
b49b3a14b4 Add flysystem dependency 2015-08-25 19:32:15 +09:30
Toby Zerner
ec2aa371b1 Fix installer issues 2015-08-17 14:32:38 +09:30
Toby Zerner
609d1825f3 Add missing dependency 2015-08-13 10:12:39 +09:30
Toby Zerner
47595ff9c4 Decouple from Laravel, implement translator 2015-08-12 18:33:39 +09:30
Toby Zerner
9f0358bb39 Update to Laravel 5.1
Eloquent `lists()` now returns a collection
2015-08-12 13:24:11 +09:30
Franz Liedke
0adf57b918 Update JSON-API dependency 2015-08-12 00:23:27 +02:00
Toby Zerner
a0fe68272c Implement TextFormatter for posts
Get rid of formatting on user bios, we'll do that with JavaScript
2015-07-22 16:03:48 +09:30
Franz Liedke
8a1b2fcede Install PhpSpec 2015-07-15 23:47:30 +02:00
Franz Liedke
38989a61bd Switch to stable version constraints where possible 2015-07-01 20:50:41 +02:00
Franz Liedke
074f8087fa Update FastRoute
This enables optional route parameters.

Required some code changes in the RouteCollection class; once we
actually use optional route parameters, we will have to see whether
route generation for those works as expected.

Closes flarum/core#108
2015-06-26 23:09:58 +02:00
Franz Liedke
391c510f90 Upgrade Zend Diactoros to 1.1
This gives us a bunch of handy helper classes for empty responses,
redirects, HTML and JSON content types.

Closes flarum/core#153
2015-06-26 22:38:43 +02:00
Franz Liedke
c2df8d5214 Merge branch 'master' into psr-7
Conflicts:
	composer.json
	composer.lock
	src/Api/Actions/TokenAction.php
	src/Core/Formatter/FormatterManager.php
	src/Core/Handlers/Events/EmailConfirmationMailer.php
	src/Forum/Actions/ConfirmEmailAction.php
	src/Forum/Actions/IndexAction.php
	src/Forum/Actions/ResetPasswordAction.php
	src/Forum/Actions/SavePasswordAction.php
	src/Forum/routes.php
2015-06-06 13:59:59 +02:00
Franz Liedke
9564778701 Upgrade to stable cookie dependency 2015-06-03 10:17:59 +02:00
Franz Liedke
d462eb585e Convert forum app to be PSR-7 compatible.
I also installed one new dependency: a helper library that makes it
easier to read and write cookies, given that there are no helper methods
for these purposes in the PSR-7 standard.
2015-06-03 02:04:57 +02:00
Toby Zerner
6cf1dbe648 Add HTMLPurifier after formatters are run.
After a morning of searching, it seems there is no PHP Markdown library
that has built-in XSS/sanitization support. The recommended solution is
to use HTMLPurifier.

This actually works out OK, though, as it’s probably a good idea to
enforce sanitization regardless of which formatters are enabled, and to
not leave them with the responsibility of sanitization (it’s a big
responsibility). Since we cache rendered posts, the slow speed of
HTMLPurifier isn’t a concern.

Note that HTMLPurifier requires a file to be loaded by Composer, but
Studio does not yet support this, so for now I have included it
manually.
2015-06-02 11:36:25 +09:30
Franz Liedke
22c0f3ec9e Require FastRoute and the PSR-7 interfaces. 2015-05-27 01:49:14 +02:00
Franz Liedke
119980e8ee Update PHPCS dependency 2015-05-19 01:22:52 +02:00
Franz Liedke
3073605f5c Add CodeSniffer dependency. 2015-05-11 10:41:14 +02:00
Toby Zerner
59d8d63acd Add preliminary avatar resizing 2015-05-07 13:59:07 +09:30
Toby Zerner
40a6d77e74 Big front-end asset/filestructure refactor
- Extract shared Ember components into a “flarum-common” ember-cli
addon. This can be used by both the forum + admin Ember apps, keeping
things DRY
- Move LESS styles into their own top-level directory and do a similar
thing (extract common styles)
- Add LESS/JS compilation and versioning to PHP (AssetManager)
- Set up admin entry point

(Theoretical) upgrade instructions:
- Delete everything in [app_root]/public
- Set up tooling in forum/admin Ember apps (npm install/update, bower
install/update) and then build them (ember build)
- php artisan vendor:publish
- Upgrade flarum/flarum repo (slight change in a config file)
- If you need to trigger a LESS/JS recompile, delete the .css/.js files
in [app_root]/public/flarum. I set up LiveReload to do this for me when
I change files in less/ or ember/

Todo:
- Start writing admin app!
- Remove bootstrap/font-awesome from repo and instead depend on their
composer packages? Maybe? (Bower is not an option here)
2015-03-29 22:13:26 +10:30
Toby Zerner
f61b041be7 Fix dud composer autoloading 2015-02-24 21:24:13 +10:30
Toby Zerner
2c46888db5 Upgrade to L5 + huge refactor + more. closes #2
New stuff:
- Signup + email confirmation.
- Updated authentication strategy with remember cookies. closes #5
- New search system with some example gambits! This is cool - check out
the source. Fulltext drivers will be implemented as decorators
overriding the EloquentPostRepository’s findByContent method.
- Lay down the foundation for bootstrapping the Ember app.
- Update Web layer’s asset manager to properly publish CSS/JS files.
- Console commands to run installation migrations and seeds.

Refactoring:
- New structure: move models, repositories, commands, and events into
their own namespaces, rather than grouping by entity.
- All events are classes.
- Use L5 middleware and command bus implementations.
- Clearer use of repositories and the Active Record pattern.
Repositories are used only for retrieval of ActiveRecord objects, and
then save/delete operations are called directly on those ActiveRecords.
This way, we don’t over-abstract at the cost of Eloquent magic, but
testing is still easy.
- Refactor of Web layer so that it uses the Actions routing
architecture.
- “Actor” concept instead of depending on Laravel’s Auth.
- General cleanup!
2015-02-24 20:33:18 +10:30
Toby Zerner
af94f22334 Rejig post formatting 2015-02-09 09:49:48 +10:30
Toby Zerner
6ceefa0f85 Update + add some deps for testing 2015-01-21 12:00:38 +10:30
Toby Zerner
4f2407bba3 Relocate to workbench so that dev dependencies are loaded properly. 2014-12-23 22:59:15 +10:30
Mike Dugan
bf94197dcd add codeception, update gitignore 2014-12-22 08:28:01 -05:00
Mike Dugan
a0e8b98713 composer updates
- Switch PSR 0 to PSR 4 (0 is deprecated)
- Update autoloadings
- Move Faker to dev requirements
2014-12-22 08:01:08 -05:00
Toby Zerner
1d84149fbc Add some missing dependencies. 2014-12-20 20:09:16 +10:30
Toby Zerner
eb33cb7ba6 We don't need lessphp right now. 2014-12-20 17:07:08 +10:30
Toby Zerner
74db323f83 Hello world! 2014-12-20 16:56:46 +10:30