Commit Graph

545 Commits

Author SHA1 Message Date
Luke Towers 457466c5af Fix typehint 2019-10-29 16:33:49 -06:00
Luke Towers eb4648972f Ensure that the XSRF cookie can always be added to the response, no matter the source of the response 2019-10-28 13:33:07 -06:00
Luke Towers 096ccf875d Implement suggestions from @bennothommo 2019-10-28 12:58:07 -06:00
Samuel Georges f542ca8e90 Implement XSRF checking for AJAX handlers
Refs #4699
Refs #4701
2019-10-24 20:19:20 +11:00
gaabora 773f266373 Allow for URL parameter to be zero (#4657)
The `empty()` check previously disallowed string zeroes from being used.

Credit to @gaabora.
2019-10-08 09:04:52 +08:00
Luke Towers d31006ae1a Return 403 response on CSRF fail instead of silently failing
Also moved backend::lang.page.invalid_token.label to system::lang.page.invalid_token.label. Fixes
2019-10-06 23:21:08 -06:00
Vojta Svoboda bafd057f8c Optimize theme recognition (#3220)
Credit to @vojtasvoboda. Will avoid asking the database for the currently active theme if there is only one theme present and its code matches the code set in cms.activeTheme
2019-09-25 12:26:54 -06:00
Samuell 33d149fe1a Replace caching of Theme config with generic YAML caching (#4526)
Credit to @Samuell1. Fixes issues related to complexity of the existing approach / cache invalidation by just using the caching built in to YAML::parseFile().
2019-09-25 11:36:35 -06:00
Ben Thomson 0240c21af6 Fail CSRF token checks if the session expires. (#4598)
Fixes #4595. Credit to @bennothommo
2019-09-04 21:33:10 -06:00
Dan Harrin 9521dd795c Minor Formatting Corrections in Usage Comments (#4541)
Credit to @DanHarrin
2019-08-15 09:14:54 -06:00
Dan Harrin 4434808549 Remove theme data on theme deletion (#4529)
Credit to @DanHarrin. Fixes #1292.
2019-08-15 11:41:03 +08:00
Dan Harrin 967fd02d8c Fix minor spelling errors and inconsistencies (#4543)
Credit to @DanHarrin.
2019-08-15 11:39:26 +08:00
RickAcb 0383af6282 Update __isset function to comply with the same checks as __get (#4514)
Credit to @RickAcb.
2019-08-04 19:56:15 +08:00
Ben Thomson a59d3b83eb Code quality clean up (#4449)
Credit to @bennothommo
2019-07-18 08:50:37 -06:00
Luke Towers 6f583b3920
Disable theme config cache when debug mode enabled 2019-07-08 16:25:25 -06:00
Luke Towers 1aff1e0a1e Changed calls to the Cache to use DateTime instances instead of integers representing minutes as 5.8 changed integers into meaning seconds instead. 2019-06-12 02:33:26 -06:00
Luke Towers 46c867e4b5 Improve API docs
Resolves #4214
2019-06-12 00:33:30 -06:00
Sebastiaan Kloos f921af4199 Fix menus not being displayed with database templates (#4362)
Credit to @SebastiaanKloos.
2019-06-06 21:05:38 +08:00
Samuel Georges e7ec0be0c1
Merge pull request #3908 from octobercms/wip/halcyon-db-datasource
Database layer for the CMS objects
2019-06-01 14:28:34 +10:00
Samuel Georges 8c398e7ad5 cms_theme_contents -> cms_theme_templates 2019-06-01 12:45:29 +10:00
Samuel Georges 17cea816d8 enableDatabaseLayer -> databaseTemplates 2019-06-01 12:40:17 +10:00
Samuell 0fdd3c32cb Properly isolate theme's config cache (#4284)
Fixes support for switching between themes. Credit to @Samuell1 and @w20k
2019-04-21 18:16:29 -06:00
Luke Towers 7c7ff31cd6 Return 404 when attempting to access /error directly in production
Replaces #2212
2019-04-19 15:29:00 -06:00
Samuell a69455d409 Cache the theme config (#4270)
Fixes #4265. Credit to @Samuell1
2019-04-19 10:59:27 -06:00
Ben Thomson 28ac50ab28 Fix for models that don't yet exist
Credit to @bennothommo. Fixes https://github.com/octobercms/october/pull/3908#issuecomment-447291101

Co-Authored-By: LukeTowers <github@luketowers.ca>
2019-04-12 00:13:39 -06:00
Ben Thomson ab6023f3e9 Fixed typo
Credit to @bennothommo

Co-Authored-By: LukeTowers <github@luketowers.ca>
2019-04-11 23:36:13 -06:00
Luke Towers 630d543959 Merge branch 'develop' into wip/halcyon-db-datasource 2019-04-11 12:30:29 -06:00
Luke Towers c86bec7f08 Replace deprecated Twig class references, refs: #4209. 2019-03-27 13:15:17 -06:00
Luke Towers 5f78fd4df9 Initial implementation attempt for theme:sync command 2018-12-16 09:43:33 -06:00
Teranode 82a38bdfb6 Add ability to delete asset files (#3933)
Fixes: #3925. Credit to @Teranode
2018-11-28 11:08:39 -06:00
Luke Towers a4f5e1b96e Finished initial implementation of Commit / Reset buttons 2018-11-23 13:35:51 -06:00
Luke Towers 878bb890b9 Passed the buck to the AutoDatasource to implement pushToSource and removeFromSource, added type hinting to AutoDatasource parameters 2018-11-23 11:28:34 -06:00
Luke Towers 7ebd8b9ffc Implement canCommitTemplate and canResetTemplate checks, added UX for commit / reset buttons (load indicator & success flash messages) 2018-11-23 11:07:36 -06:00
vosco88 2d1a904512 Extend opcache check if it is enabled (#3664)
Credit to @vosco88. 
When trying to deploy October on shared hosting (www.websupport.sk) it is possible to receive the following error when accessing the frontend pages - ErrorException:> Zend OPcache API is restricted by "restrict_api" configuration directive. This checks not only if the opcache_invalidate exists but also if opcache is enabled. Same check is actually present in twig vendor files - but so far it is working without having the check there.
2018-11-23 09:36:24 -06:00
Luke Towers f730fc85e1 Fix import statement 2018-11-22 16:54:35 -06:00
Luke Towers 7809f9ada5 Added a Theme::databaseLayerEnabled method to make checking for the db layer easier 2018-11-22 13:41:11 -06:00
Luke Towers 1920d5b4b6 Fix bug where updating records that didn't exist in the DB yet would cause both the original and new records to display 2018-11-22 12:04:41 -06:00
Luke Towers 38fe4af1e6 Fixed minor oversight in delete() method on AutoDatasource 2018-11-15 15:14:05 -06:00
Luke Towers 45bd2654fc Added Meta CmsObject, fixed bug in AutoDatasource 2018-11-14 16:52:46 -06:00
Luke Towers e622defed1 Initial implementation of insert() and update() on the AutoDatasource 2018-11-06 16:00:27 -06:00
Luke Towers e5518e0976 Update AutoDatasource->getAvailablePaths implementation to match updated interface 2018-11-06 14:48:47 -06:00
Luke Towers 0efae6dc33 AutoDatasource deletions now occur only on first datasource 2018-11-06 14:38:19 -06:00
Luke Towers 4887519e27 AutoDatasource bug fixes and performance improvements
Properly remove deleted paths from results returned by AutoDatasource->select() and utilize the cache exclusively when only selecting the fileName column preventing calls to the source datasources.
2018-11-06 14:22:05 -06:00
Luke Towers 65e0c9d7b6 Add initial support for deleted paths 2018-11-05 16:02:12 -06:00
Luke Towers 32c7891942 Minor changes 2018-11-05 14:35:58 -06:00
Luke Towers e14ded4be6 Initial work on the AutoDatasource 2018-11-02 16:04:35 -06:00
Luke Towers 1dc6f944ac Documented cms.router.beforeRoute 2018-10-11 20:31:36 -06:00
Luke Towers 900220b079 Documented more inline events:
cms.page.beforeDisplay
cms.page.display
cms.page.init
cms.page.beforeRenderPage
cms.page.start
cms.page.end
cms.page.postprocess
cms.page.initComponents
cms.page.render
cms.page.beforeRenderPartial
cms.page.renderPartial
cms.page.beforeRenderContent
cms.page.renderContent
2018-10-11 20:10:28 -06:00
Luke Towers 11ad4f6329 Documented cms.theme.getEditTheme & cms.theme.setActiveTheme 2018-10-11 18:53:52 -06:00
Luke Towers 96127f0d91
Check that getProperties method returns an array (#3853)
Fixes #3851.
2018-10-10 08:48:37 -06:00
Samuel Georges a0ec7652f8 Remove stub method
This is a very old stub method included to point out an override is available, in the process it prevents the viewBag property from being populated by the underlying CmsCompoundObject base class, thereby preventing anyone from extending the Layout or Page with custom form fields.
Refs #3769
2018-10-01 10:29:03 +10:00
Alexander Shapoval 709790a05d Added method getLayout() to Controller (#3765)
Credit to @ebashu-on-holidays
2018-09-09 18:55:10 -06:00
Samuel Georges 4ec3b525e0 Fixes event implementation
The array_merge approach will only shallow merge the arrays preventing a second event from contributing form fields properly. Passing by reference is the logical thing to do here.
2018-09-06 17:08:05 +10:00
Nathan van der Werf 8fd16d4db6
Merge branch 'develop' into feature/cleanup
# Conflicts:
#	modules/backend/formwidgets/FileUpload.php
2018-08-24 19:52:54 +02:00
Nathan van der Werf 0f0d108da0
Remove unused imports 2018-08-24 19:51:59 +02:00
Nathan van der Werf 66fa03f17e
Revert "Remove unused imports"
This reverts commit 742a5f415b.
2018-08-24 19:40:40 +02:00
Samuel Georges eb2419cc74 Typo 2018-08-21 13:28:12 +10:00
Samuel Georges 8383466508 Introduce events for extending Theme configuration 2018-08-21 13:18:22 +10:00
Luke Towers 1032fd0cc1 Added more inline API event docs:
Added docs for:
cms.component.beforeRunAjaxHandler
cms.component.runAjaxHandler

Improved docs for:
cms.ajax.beforeRunHandler
2018-08-18 09:05:38 -06:00
Nathan van der Werf 8b6f11e6ac Extract child instructions 2018-08-15 19:25:42 +02:00
Nathan van der Werf fbca3bea92 Remove redundant variables 2018-08-15 19:23:12 +02:00
Nathan van der Werf 62c59a4903 Refactor ternary operators to null coalescing operators 2018-08-15 19:15:13 +02:00
Nathan van der Werf a3d7a028b4 Replace is_null with "=== null" comparison 2018-08-15 18:54:46 +02:00
Nathan van der Werf 77b6f07291 Modify conditions to use elvis operators 2018-08-15 18:53:11 +02:00
Nathan van der Werf 123145fd54 Remove unnecessary parentheses 2018-08-15 18:49:52 +02:00
Nathan van der Werf 02bd38cfb1 Merge if constructs 2018-08-15 18:45:37 +02:00
Nathan van der Werf 0947406343 Remove senseless proxy functions 2018-08-15 18:35:15 +02:00
Nathan van der Werf 3a918ad200 Remove "null" assignments 2018-08-15 18:33:24 +02:00
Nathan van der Werf 742a5f415b Remove unused imports 2018-08-15 18:27:36 +02:00
Samuel Georges fb2aa1730c Fixes security issue
Refs #3604
2018-06-22 22:57:38 +10:00
whsol 15cdf6e71f Make code parser data cache key configurable (#3373)
Credit to @whsol
2018-06-05 10:10:35 -06:00
Luke Towers 92e346296e Added cms.ajax.beforeRunHandler event 2018-04-19 10:26:50 -06:00
Arthur Kushman c78b3ef786 Code formatting changes (#3363)
Code formatting improvements submitted by @arthurkushman.
2018-03-22 10:55:13 -06:00
interworks-morr 0206a6811f Improve cache reliability (#3421)
Reported and fixed by @interworks-morr: 
"Occasionally with certain IIS setups, the file will contain an out-of-date class name. This patch will verify the class name from the file before returning, and clear the cache if invalid."
2018-03-02 20:00:05 -06:00
Matteo 678916854e Add config to enable Twig strict_variables (#3370)
Adds the cms.enableTwigStrictVariables config option to enable strict_variables in Twig for debugging purposes. See https://twig.symfony.com/doc/2.x/api.html#environment-options. Credit to @matteotrubini
2018-01-26 10:59:45 -06:00
Arthur Kushman bbc33710c1 >= PHP7.0 refactoring (#3343)
* Fix loosly comparison to strict + argument types and return types for >=7.0
* Change hard-coded strings to ::class, 
* Fix unit-tests failures - some relative to 7.0 phpunit env deployment
* Fix exception string + format return types
* Change string representation of new classes in traceLog to ::class
Credit to @arthurkushman
2018-01-12 00:23:20 -06:00
viamage 7ffb79a5fd Fix typo (#3326)
Fixed typo, added CmsCompoundObject::getComponentProperties method test. Credit to @viamage
2017-12-27 13:31:34 -06:00
Miro Rauhala d54c3b18e9 Initialize missing variable (#3318)
Fixes #3317. Credit to @mirorauhala
2017-12-21 16:06:56 -06:00
Samuel Georges e6de2a5521 Fixes exception on empty token 2017-11-02 19:53:20 +11:00
Samuel Georges 4a6e0e1e0e Implement CSRF token by default
Implement CSRF protection on CMS for postback handling
2017-10-30 09:00:17 +11:00
Luke Towers 08f9cd8448 Moved the |media twig filter from the CMS module to the System module 2017-09-27 22:15:01 -06:00
Luke Towers de747f98b3 Deprecate the MediaLibrary & MediaLibraryItem classes in the CMS module 2017-09-27 22:12:45 -06:00
Luke Towers 5185ca075b Add the cms.object.listInTheme event (#3076)
Inspired by #3075. Provides a cms.object.listInTheme event to modify the results returned by that method.
2017-09-02 19:51:56 -06:00
Luke Towers 0b7170ac26 Add support for sorting direction to the MediaManager (#3007)
* Remove redundant returns

`$this->putSession()` in `Backend\Traits\SessionMaker` doesn't return anything, and the return values of these methods are not used; so returning the value of `putSession()` in these methods is redundant.

* Add support for sort direction to MediaLibrary

Adds support for switching the direction that item lists get sorted by the media library. This necessitates the changing of the default direction of Last Modified and Size to Ascending, previously their sorting direction was Descending while Title was sorted in Ascending order. This shouldn't change anything as the user still has the power to sort by either direction. Fully backwards compatible with any calls to `sortItemList`.

* Support sorting direction in the MediaManager widget

Adds further support for specifying a sorting direction to the MediaManager widget itself

* Display sorting direction options

* Improving styles for sorting direction

* Send sorting information to the MediaManager

* Add translations for sorting feature

* Removing strange ghost whitespace
2017-08-05 12:45:01 -06:00
Luke Towers 3b7a8f3123 Make extension comparisons case insensitive
Make extension comparisons done in `getFileType()` case insensitive to support audio/visual file types being correctly recognized when the file being uploaded has an uppercase extension as is occasionally the case. I.e. `.JPG` is the same as `.jpg`, this just tells October to consider them the same.
2017-07-31 21:03:28 -06:00
Samuel Georges 96d0535d09 Add generic onAjax handler that does nothing 2017-07-29 22:55:58 +10:00
Samuel Georges 5555b98799 Fixes deprecated Twig API
Refs https://github.com/kriswallsmith/assetic/pull/819
2017-07-26 22:16:52 +10:00
Samuel Georges 1db67af8e8 Merge remote-tracking branch 'remotes/origin/develop' into l55upgrade
Conflicts:
	modules/system/lang/en/lang.php
2017-07-11 10:48:54 +10:00
Max Schmitt aeba740243 Add getStatusCode() in Cms\Classes\Controller (#2959)
Related: #2953. Provide a method to access the current statusCode of a CMS controller.
2017-07-08 08:53:08 -06:00
Samuel Georges d1c160f9dc Check both instances to fix #1854
It appears there is no way around this. All directories should be lower case in October, prior to this, October wanted uppercase characters. Make up your mind guy, come on! ;-)
2017-07-01 12:26:55 +10:00
Samuel Georges 87f8f8feb1 Fixes inconsistency in component partial folder names
This is a breaking change that will require further attention - refs #1854

Eg: myComponent, the default component partial would use lower case folders
- /plugins/acme/test/components/mycomponent/default.htm

The theme component partial override would use case sensitive folders
- /themes/foobar/partials/myComponent/default.htm

This is fixed as
- /themes/foobar/partials/mycomponent/default.htm

Minor code fix to ModelBehavior class
2017-06-27 05:34:13 +10:00
Samuel Georges 3b56787a2b Use tabs cssClass definition instead of JS 2017-06-05 17:33:37 +10:00
Samuel Georges e2781c5fdf URL -> Url 2017-06-02 23:34:50 +10:00
Samuel Georges 3be6dafa6b Fixes int folder name showing as 0
Fixes #2902
Code dusting
2017-06-02 20:16:26 +10:00
Samuel Georges bab7976331 Merge branch 'develop' into l55upgrade 2017-05-20 09:08:09 +10:00
Samuel Georges d9cf7381dc Implement helper method for checking ignored path
Refs #2858
2017-05-16 07:38:38 +10:00
Samuel Georges 2a0a91486c Logic error - fixes #2654 2017-05-16 07:24:07 +10:00
Samuel Georges f05f4c21cf Merge pull request #2858 from TimFoerster/patch-1
Filter layout by ignored file names
2017-05-15 20:29:53 +10:00
Samuel Georges 5ea79489af pluck -> value
This is an odd one from Laravel, pluck is now value and lists is now pluck. We'll need a release note about this one.
2017-05-12 07:19:06 +10:00
TimFoerster 5eb278e883 Filter layout by ignored file names
The Layouts get filtered by the filesystem definition of ignored files.
#814
2017-05-04 14:53:19 +02:00