Commit Graph

1007 Commits

Author SHA1 Message Date
Sajjad Hashemian
971b4c121c Remove extension generator 2016-10-04 23:26:03 +03:30
Davis
258a4b352d Change == to === 2016-09-13 14:48:21 -05:00
Davis
24580ced7a Wish it was automatic :/ 2016-09-13 05:56:13 -05:00
Davis
8e90d9f9e2 Anything for Stylecl's green check 2016-09-13 05:55:00 -05:00
Davis
af36ef3fa9 StyleCl and the space after <?php is annoying 2016-09-13 05:53:46 -05:00
Davis
eef63745e6 Prevent overwriting of user's attributes on register 2016-09-13 02:22:09 -05:00
Davis
c702e911b3 StyleCl is making me hate myself 2016-09-12 22:31:55 -05:00
Davis
73d2ee825b Forgot to subscribe 2016-09-12 22:31:03 -05:00
Davis
9f99610542 StyleCl FINALLY! 2016-09-12 22:28:50 -05:00
Davis
1192867c4f StyleCl 2016-09-12 22:28:03 -05:00
Davis
b048498b84 StyleCl 2016-09-12 22:27:18 -05:00
Davis
81f7a39a31 StyleCl 2016-09-12 22:26:22 -05:00
Davis
ea12bbaf48 StyleCL 2016-09-12 22:24:57 -05:00
Davis
c8122a7879 Make StyleCL Happy 2016-09-12 22:23:31 -05:00
Davis
1a5d7a337d Remove useless code 2016-09-12 22:19:47 -05:00
Davis
c29ea98d48 Add WillBe Modifiers 2016-09-12 22:17:54 -05:00
Davis
3702ffa998 Create ExtensionValidator.php 2016-09-12 19:14:30 -05:00
Davis
58f9c22375 Create ExtensionWillBeEnabled.php 2016-09-12 17:07:00 -05:00
Davis
939a1e9ca8 Forgot the extension :/ 2016-09-12 17:05:41 -05:00
Davis
736f22a31a Create ExtensionWillBeDisabled 2016-09-12 16:57:24 -05:00
Toby Zerner
df247925d4 Fix locale JS files not being added; add (temporary?) API to add locale CSS files
fixes flarum/core#970
2016-09-03 22:22:36 +09:30
Toby Zerner
44726633ce Extract new method to filter a list of post IDs by visibility 2016-09-03 21:46:22 +09:30
Toby Zerner
0d8c8c3be3 Add missing property declaration 2016-09-03 21:45:45 +09:30
Toby Zerner
0d99f75a6d Disallow svg images to be erroneously uploaded
Laravel's `image` validation rule allows svg files to pass validation, but we can't handle svgs so it would result in an unspecified 500 error which isn't nice.
2016-08-27 23:54:18 +09:30
Toby Zerner
d5797dae79 Remove temporary file after avatar upload failure. closes flarum/core#999 2016-08-27 23:53:02 +09:30
Niels Tholenaar
05c9ce335e Fixes #825 2016-06-20 12:34:41 +02:00
Franz Liedke
cc23430a9e
Make StyleCI happy 2016-06-13 21:08:17 +09:00
Franz Liedke
1a2174d614
Log exceptions in error handler middleware 2016-06-12 17:22:28 +09:00
Toby Zerner
85bd82eab1 Fix updater 2016-06-05 15:07:15 +09:30
Toby Zerner
32aa3f0cba Clean up unnecessary alias 2016-06-05 09:53:23 +09:30
Toby Zerner
f5988bae23 Distinguish between attributes/relationships in ValidationException
This exception could be a candidate for inclusion in tobscure/json-api...
2016-06-05 09:25:26 +09:30
Toby Zerner
feffe53a86 Add ability to upload a logo + favicon, and add custom header HTML
Closes #268. Not going to bother with a preview SVG or anything fancy for now – we can think about that as part of #746. Right now it's just good to finally get this functionality in!

Also need to think about apple-touch-icon, msTile stuff, and social sharing image. Not sure if this is all too much for core, but it's definitely too much for the current Appearance page layout. Again, something to think about as part of #746.

Code is a bit rough around the edges, but figured there's not much point in using the command bus properly since #870.
2016-06-04 18:05:46 +09:30
Toby Zerner
1ce6afaaeb Add option to write the config file to a different path 2016-06-03 10:55:50 +09:30
Toby Zerner
4bd05ee561 Fix up some references to old classes 2016-05-29 16:01:58 +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
Toby Zerner
c3dfa3560a Allow extensions to add default model attributes
Extensions can add default column values in their migrations, but Eloquent doesn't know about this when it first saves a model to the database.

This is useful in flarum-ext-approval where the default value for is_approved on the posts table is true.
2016-05-28 09:37:43 +09:30
Toby Zerner
40a78d302e Fix permission logic priorities
This helps to fix a bug in flarum-ext-tags where a user could not rename or edit the tags of their own discussion if it was in a restricted tag. This was due to the order of GetPermission event listeners – the logic that determines that a user *can't* perform an action because of a restrictive tag was running before (and thus instead of) the logic that determines that a user *can* edit their own stuff.

The solution is to change the "catch-all" methods on Policies to "after" instead of "before" – that is, they will run only if the per-ability methods return null.

We also simplify the GetPermission event by passing the model as a sole "argument", as I can't imagine any cases where we'll need more than one argument.
2016-05-28 09:35:08 +09:30
Toby Zerner
7c0a72047a Make sure deprecated ConfigureClientView event still works 2016-05-27 14:57:27 +09:30
Toby Zerner
15adfc528f Fix installer/updater 2016-05-27 14:53:22 +09:30
Toby Zerner
a9199ad9d9 Only check for reply permission for actual replies. fixes #917 2016-05-27 13:56:04 +09:30
Toby Zerner
96eda5cfeb Fix detection of whether or not an asset file is "empty"
We can't rely on files/strings for this, since the Locale JsCompiler doesn't use either, but still has content.
2016-05-27 12:20:14 +09:30
Franz Liedke
0b0c1055d6
Make StyleCI happy and fix some docblocks 2016-05-27 09:07:49 +09:00
Davis
f0f668fb93 Fix Permission Name (#965) 2016-05-26 23:54:25 +09:00
Toby Zerner
8e99059f62 Don't write/serve empty asset files
The new locale-specific CSS file doesn't have any content by default, so it's a waste to write it and serve it to the user.
2016-05-26 22:24:56 +09:30
Toby Zerner
1b7a0ecb33 Rename Server register API to extend
More consistent with how extensions work
2016-05-26 19:12:32 +09:30
Toby Zerner
9bfb797fdc Refactor the web app bootstrapping code
- All custom JS variables are now preloaded into the `app.data` object, rather than directly on the `app` object. This means that admin settings are available in `app.data.settings` rather than `app.settings`, etc.
- Cleaner route handler generation
- Renamed ConfigureClientView to ConfigureWebApp, though the former still exists and is deprecated
- Partial fix for #881 (strips ?nojs=1 from URL if possible, so that refreshing will attempt to load JS version again)
2016-05-26 19:04:24 +09:30
Davis
909f52522b Show post IP address in meta dropdown. closes #956 closes #657 2016-05-21 22:02:42 +09:30
Toby Zerner
1f5764e5e3 Add API to allow skeleton to customise the Application instance 2016-05-21 20:31:42 +09:30
Toby Zerner
28f72d5648 Fix crash on reset password page 2016-05-21 20:29:38 +09:30
Niels Tholenaar
77837ef7d1 Fixed LESS compile error (#958) 2016-05-13 23:15:33 +09:00
Franz Liedke
3f9fe7d33e
Fix font-awesome LESS source not being found in some cases 2016-05-13 23:04:14 +09:00
Maxim Chistyakov
bc34b858a2 SQL Performance tuning (#952)
MySQL has problems with executing this subquery efficiently.
2016-05-12 23:07:41 +09:00
Franz Liedke
251862222c
Add a comment 2016-05-12 23:03:37 +09:00
Lyntor Paul Figueroa
006ea02227 Fix avatar upload on Windows servers - Issue #893 (#927)
* Fix avatar upload on Windows servers - Issue #893

* Remove @ to show errors if any
2016-05-12 23:01:51 +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
Franz Liedke
eba782d48f Merge pull request #943 from poush/fix_#937
Validation on password change
2016-04-29 20:27:53 +09:00
JoshyPHP
6d809cb023 Updated s9e\TextFormatter to 0.5.0 (#947) 2016-04-29 15:11:30 +09:30
Piyush Agrawal
77a5b59a10 Validation on password change 2016-04-28 15:48:25 +05:30
Toby Zerner
7192c4391b Fix console installer not working
Some commands have dependencies which causes errors when there's no config/database access, so they shouldn't be instantiated.
2016-04-25 09:17:11 +09:30
Toby Zerner
3d812c287f Lazily initialise the Application instance
See f403feb3b1
2016-04-24 11:10:39 +09:30
Toby Zerner
7bd3fa82b1 Allow setting storage path, clean up docblocks 2016-04-24 11:00:25 +09:30
Buhnici Alexandru
777579e146 Public and base directory can be separated (#938)
* Public and base directory can be separated

* Standards compliance for folders separation implementation
2016-04-23 11:55:53 +09:30
Franz Liedke
02b110e545
Implement a server class that composes the other servers
Useful for local development using PHP-PM. :)
2016-04-16 23:19:10 +09:00
Franz Liedke
f177c0d8a0
Fix doc block 2016-04-16 14:44:48 +09:00
Franz Liedke
a12b5591c3
srsly?
StyleCI was complaining.
2016-04-16 14:43:52 +09:00
Franz Liedke
5293117c80
Http\AbstractServer: Use middleware functionality when listening 2016-04-16 13:11:33 +09:00
Franz Liedke
181c19eac7
Http\AbstractServer: Allow usage as PSR-7 middleware 2016-04-16 13:10:11 +09:00
Franz Liedke
f403feb3b1
AbstractServer: Store app instance as class property
This will make it easier to reuse the instance in an asynchronous
setting (e.g. ReactPHP), where one application instance is preloaded
and reused for each incoming request.
2016-04-16 13:07:52 +09:00
Franz Liedke
b5fc7b9bf5
AbstractServer: Allow omitting base path parameter
It will be inferred from the current directory instead.
2016-04-16 13:06:58 +09:00
Toby Zerner
e11401b551 Fix some random docblocks 2016-04-08 13:52:50 +09:30
Franz Liedke
e30f8f261b Use existing ClientController classes to remove compiled assets
Refs #837.
2016-04-04 21:00:04 +09:00
Franz Liedke
729103c519 Move cache:clear command to other namespace and actually flush the cache, too
Refs #837.
2016-04-03 22:22:29 +09:00
Franz Liedke
ee8f4f04de We don't need to make the cache adapter configurable like this 2016-04-03 22:21:41 +09:00
Franz Liedke
8e35afe204 First basic version of cache:clear command
Refs #837.
2016-04-02 21:23:32 +09:00
David Sevilla Martín
1fbce0db33 Add validation to forgot password email field. closes #776 2016-04-01 09:20:26 +10:30
Franz Liedke
9e79470603 Update fig-cookies dependency and use new shortcut 2016-03-31 09:43:17 +09:00
Toby Zerner
4b2f0c2d1a v0.1.0-beta.5 2016-03-29 18:02:12 +10:30
Toby Zerner
48be5ac2eb Prevent unapproved discussions from dropping to the bottom of the discussion list 2016-03-29 17:53:07 +10:30
Toby Zerner
0b3a4264a3 Use more precise regex to prevent some translations being compiled unnecessarily 2016-03-29 17:31:13 +10:30
Franz Liedke
4fe7acfddf Revert "Add a middleware for authentication with CGI wrap"
This reverts commit 685d5f1517.

This will now be dealt with at the Stratigility level.
2016-03-26 18:56:31 +09:00
Franz Liedke
685d5f1517 Add a middleware for authentication with CGI wrap
If the authorization header is stripped by CGI wrap,
the server can be configured to send the value along
in an environment variable. If the server admin sticks
to this convention, Flarum can now use this variable.

This is supposed to take care of #384.
2016-03-24 21:53:11 +09:00
Toby Zerner
a5c8ef0566 Tweak user email confirmation alert
- Make sure is_activated is serialized to a bool (otherwise "0" will evaluate to true)
- Remove "error" class from message so it's more friendly
- Make the alert more prominent by mounting it into a new div at the top of the page
- Add loading UX to the resend button
2016-03-23 22:17:42 +10:30
Franz Liedke
cb428f1e4a Make StyleCI happy 2016-03-23 19:54:04 +09:00
Sajjad Hasehmian
b13adfec84 Show alert for unverified User 2016-03-22 18:52:32 +04:30
Franz Liedke
b2b5789c25 info: Show commit hashes for Flarum core and extensions 2016-03-22 00:55:10 +09:00
Franz Liedke
673a78a203 info: Show loaded PHP extensions 2016-03-22 00:33:39 +09:00
Franz Liedke
31caced04c info: Show installation path 2016-03-22 00:29:58 +09:00
Franz Liedke
5d88ad2431 info: Show base URL 2016-03-22 00:28:02 +09:00
Franz Liedke
96a40fd6ea info: Print PHP version, too 2016-03-22 00:22:40 +09:00
Franz Liedke
cd4d669127 Make console command descriptions consistent 2016-03-20 23:16:08 +09:00
Franz Liedke
238f2fca73 Get rid of some repetition 2016-03-20 23:15:26 +09:00
Franz Liedke
7e33690660 Add first, basic version of info command
This will hopefully help in debugging some problems.
2016-03-20 23:12:20 +09:00
Toby Zerner
e6a001335d Applied fixes from StyleCI 2016-03-20 06:06:43 -04:00
Franz Liedke
4c03f13fef AbstractOAuth2Controller: Store provider and token in class properties
This way, they are available for subclasses to access them in one of
the template methods.

Refs #673.
2016-03-18 22:22:35 +09:00
Franz Liedke
588dd7b213 Fix JSON serialization error on PHP 7
Closes #685.

Thanks to @sijad.
2016-03-18 21:11:54 +09:00
Toby Zerner
476c1a5691 Prevent users from being incorrectly able to delete their own discussions 2016-03-18 09:39:41 +10:30
Toby Zerner
0b3bc9f2ba Increase avatar upload max file size 2016-03-14 09:25:02 +10:30
Toby Zerner
e37c7a9b06 Remove sudo mode and add password confirmation when changing email address
closes #674
2016-03-11 12:44:18 +10:30
Toby Zerner
beb2f91fef Fix posts being incorrectly visible on user page. closes #680
- When no discussions are visible, the query that filters posts by discussion visibility was incorrectly making all posts visible.
- Also hide user profiles altogether if discussions are not visible.
2016-03-10 17:50:29 +10:30
Franz Liedke
f631b98df6 Whoopsie, fix syntax error 2016-03-08 00:05:53 +09:00
Franz Liedke
01cb5c4478 Add another migration shortcut for defining default settings 2016-03-08 00:02:33 +09:00
Sajjad Hasehmian
393fa67d2d Remove 'extensions' path for writable check 2016-03-04 09:55:40 +03:30
Toby Zerner
a75a76e95b Fix fatal error when deleting a discussion forever. closes #842 2016-03-03 12:52:53 +10:30
Daniel Klabbers
15c0a8c2db Refactoring to drop extensions dir, see #774
satisfy nitpick
2016-03-02 09:04:10 +01:00
Toby Zerner
5d5f47aab2 Applied fixes from StyleCI 2016-02-29 22:51:13 -05:00
Toby Zerner
24713733fc Don't require a previous Post when saving event posts
A bit of an edge-case since it shouldn't really be possible to have a discussion with zero posts anymore, but when renaming an empty discussion (or taking any action that will create an "event post"), Flarum would crash. This is due to the MergeableInterface requiring these posts to be saved after a previous post.
2016-02-29 18:50:27 +10:30
Toby Zerner
56b39f9fba Fix crash when sending notification to non-existent user
When renaming a discussion, an attempt is made to send a notification to the discussion's author. However, there is no check to see if the user account still exists - this can lead to a crash. While the check should technically be in the initiating code, it will probably slip through the cracks in other scenarios/extensions, so it's probably best that we safe-guard against this in the NotificationSyncer itself.
2016-02-29 18:48:02 +10:30
Toby Zerner
cdbc4b9717 Fix regressions related to deleting posts
- On the front-end, correct the check to see if the discussion has no more posts
- On the back-end, run a query to count the posts instead of using the comments_count, because the comments_count does not include other deleted posts
2016-02-29 18:41:59 +10:30
Franz Liedke
594a2ba8cc More indentation cleanup 2016-02-26 13:10:32 +09:00
Toby Zerner
445517ee84 Use regex for username validation
Laravel's alpha_dash rule allows unicode letters including those with inflections, leading to issues like #832. As per discussion in #557, we are sticking with ASCII-only usernames for now.
2016-02-26 13:59:05 +10:30
Franz Liedke
b4cf197cc6 Improve alignment of string 2016-02-26 12:20:37 +09:00
Toby Zerner
a6cf10f854 Applied fixes from StyleCI 2016-02-25 22:09:39 -05:00
Toby Zerner
c7b6426fd4 Delete a discussion when its last post is deleted. fixes #823 2016-02-26 13:26:09 +10:30
Franz Liedke
5390187a4f Just a tad of cleanup 2016-02-25 23:29:55 +09:00
Daniel Klabbers
e4412178b1 refactoring to support array closures migrations and fixed issues with previous pr for extension rewriting 2016-02-25 23:26:10 +09:00
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
Franz Liedke
ad95a44e7d Remove obsolete AbstractMigration class 2016-02-24 23:22:52 +09:00
Franz Liedke
59613910b1 Update generate:migration command to deal with new migration structure 2016-02-24 23:20:33 +09:00
Franz Liedke
17851c4dfe Revert "typehint fix, opening for implementation" 2016-02-18 17:33:34 +01:00
Daniel Klabbers
d944a9e618 typehint fix, opening for implementation 2016-02-17 13:34:13 +01:00
Toby Zerner
d7fe3ca35b Merge pull request #787 from sijad/401-page
401 for unauthorised request to settings, notifications page
2016-02-15 21:04:39 +10:30
Daniel Klabbers
0ad4c0ac61 fixes #800, forgot these controllers 2016-02-13 20:33:33 +01:00
Daniel Klabbers
458f4f811c fixes #799, now properly assigning a id 2016-02-13 20:32:46 +01:00
Sajjad Hasehmian
e90dfe04fd 401 for unauthorised request to settings, notifications page fixes #714 2016-02-11 09:59:01 +03:30
Daniel Klabbers
191589e2b1 Implemented extensions as an object, usable by backend and frontend. 2016-02-10 15:13:51 +01:00
Franz Liedke
96c4e6b147 Merge pull request #786 from Luceos/imports
reordering and removing unused imports
2016-02-10 15:02:37 +01:00
Franz Liedke
08312568ba Installer: Fix models not being ready for use when running migrations
This was a regression after the recent introduction of a new migration that actually uses models.
Maybe we should change this.

See https://discuss.flarum.org/d/2023-can-t-manage-to-install-the-development-version-503-service-unavailable/8
2016-02-10 14:07:29 +01:00
Daniel Klabbers
31be2f8f86 reordering and removing unused imports 2016-02-10 11:00:37 +01:00
Sajjad Hasehmian
f1a1a7a806 Correct redirect uri in OAuth2 Controller (fixes #778) 2016-02-09 18:01:59 +03:30
Toby Zerner
fb09cef540 Merge pull request #748 from JoshyPHP/Minifiers
Added support for new minifiers
2016-02-07 11:37:15 +10:30
Franz Liedke
97979b2189 Store discussion slug in database table
In preparation for #646.
2016-02-04 11:46:30 +01:00
Toby Zerner
2018e424ec Refactor ListPostsController, make filtering extensible
It became apparent in https://github.com/flarum/core/issues/319#issuecomment-170558573 that there was no way for extensions to add filter parameters to the /api/posts endpoint (e.g. /api/posts?filter[mentioned]=1). Simply adding an event to modify the `$where` array severely limits how much can be done with the query. This commit refactors the controller so that filters are applied directly to the query Builder, and exposes the Builder in a new `ConfigurePostsQuery` event.
2016-01-31 17:06:38 +10:30
Toby Zerner
36ad4a8554 Fix fatal error
"PHP Fatal error:  Cannot use Symfony\Component\Translation\Translator as Translator because the name is already in use"
2016-01-31 15:35:53 +10:30
Franz Liedke
c99c83435b Fix path to extension stub directory
Refs #743.
2016-01-20 22:01:01 +01:00
Franz Liedke
c8f2d94558 Fix obsolete import 2016-01-20 21:38:14 +01:00
Franz Liedke
c842fa0184 Hardcode primary keys during installation
This avoids misleading assumptions about automatically generated primary keys
in some cases.

Fixes #566.
2016-01-20 21:36:50 +01:00
Toby Zerner
285e397d05 Remove hack to make tag permissions work
Since we now grant these global permissions if the user has the respective permission for any individual tags.
2016-01-16 14:07:13 +10:30
Toby Zerner
2e27d5938a Merge branch 'master' of https://github.com/flarum/core 2016-01-16 13:57:17 +10:30
Toby Zerner
be013c6db0 Check permission through the gate rather than directly on the actor 2016-01-16 13:57:05 +10:30
Toby Zerner
dfc0cf53b0 Give GetPermission event priority when determining permissions 2016-01-16 13:56:37 +10:30
JoshyPHP
09ad4a180b Added support for new minifiers 2016-01-15 16:59:56 +01:00
Franz Liedke
194f304752 Merge pull request #720 from Albert221/permission-denied-fix
#719 Fixed PermissionDeniedException
2016-01-13 12:31:38 +01:00
Toby Zerner
ba7fba9015 Fix/clean up created gambit
$matches indices were incorrect.
2016-01-13 10:03:26 +10:30
Toby Zerner
4ec108f28a Merge branch 'created-gambit' of https://github.com/Albert221/core 2016-01-13 09:53:24 +10:30
Albert221
b123e435ff Unified two URL prefix variables into one 2016-01-12 22:07:47 +01:00
Toby Zerner
8506d095db Use correct directory in loadLanguagePackFrom API 2016-01-12 18:35:37 +10:30
Toby Zerner
94a62293eb Extract Google font import to a head string, make overideable
Allowing headStrings to be named is a bit of a stopgap solution. Really ClientView needs to be given much more power with headStrings and footStrings as separate objects, similar to the ItemList in the JS app.
2016-01-12 18:29:21 +10:30
Franz Liedke
bd1d05ee2c #717: Implement helper for registering a language pack 2016-01-11 08:46:20 +01:00
Franz Liedke
4a6137fdb1 Remove Studio hack 2016-01-11 08:38:30 +01:00
Franz Liedke
537ab6e41f Remove empty line 2016-01-11 08:15:14 +01:00