Commit Graph

51 Commits

Author SHA1 Message Date
Lukas Reschke 117b3e0a12 getAppPath can return false
Fixes https://github.com/owncloud/core/issues/23533
2016-03-24 09:19:43 +01:00
Lukas Reschke 979a3ff830 Escape App ID
While all callers do this as well this prevents a misuse of the API by mistake.
2016-03-17 13:09:22 +01:00
Joas Schilling c3c491689b Shorter cache key for URL entries 2016-03-14 11:05:46 +01:00
Thomas Müller 682821c71e Happy new year! 2016-01-12 15:02:18 +01:00
Lukas Reschke 9bf01283e7 Cleanup router code
- Some functions are entirely broken
- PHPDoc etc...
2016-01-07 21:29:51 +01:00
Thomas Müller 9e39e8f1c7 No more deprecation messages in error log 2015-12-29 17:31:28 +01:00
Roeland Jago Douma 19eeb23b91 OC_Helper::linkTo is deprecated
Replaced with suggested (and calling body of)
2015-12-17 10:53:21 +01:00
Morris Jobke c60c793cf2 More cleanups of OC_Config usage 2015-12-03 16:41:23 +01:00
Lukas Reschke 2515cb17be Support pretty URLs
This changeset allows ownCloud to run with pretty URLs, they will be used if mod_rewrite and mod_env are available. This means basically that the `index.php` in the URL is not shown to the user anymore.

Also the not deprecated functions to generate URLs have been modified to support this behaviour, old functions such as `filePath` will still behave as before for compatibility reasons.

Examples:
http://localhost/owncloud/index.php/s/AIDyKbxiRZWAAjP => http://localhost/owncloud/s/AIDyKbxiRZWAAjP
http://localhost/owncloud/index.php/apps/files/ => http://localhost/owncloud/apps/files/

Due to the way our CSS and JS is structured the .htaccess uses some hacks for the final result but could be worse... And I was just annoyed by all that users crying for the removal of `index.php` ;-)
2015-12-01 16:46:07 +01:00
Robin Appelman b05c8faba8 Dont die when we're missing a route 2015-11-27 14:29:06 +01:00
Morris Jobke 8366ce2767 deduplicate @xenopathic 2015-10-06 09:52:19 +02:00
Morris Jobke b945d71384 update licence headers via script 2015-10-05 21:15:52 +02:00
Robin McCorkell 5b2529b448 Delay adding OCS prefix to route collection until all is loaded
->addPrefix() iterates over all registered routes, so must be run after
all apps have had a chance to load their OCS routes.
2015-09-01 15:42:41 +01:00
Robin McCorkell 1c26755686 Only load app routes if the app has already been loaded 2015-08-18 09:18:36 +01:00
Joas Schilling c16fd29f29 Revert "Only load app routes if the app has already been loaded"
This reverts commit 50ebea41f6.
2015-08-11 14:19:59 +02:00
Robin McCorkell 50ebea41f6 Only load app routes if the app has already been loaded 2015-08-06 16:09:34 +01:00
Morris Jobke f63915d0c8 update license headers and authors 2015-06-25 14:13:49 +02:00
Lukas Reschke 73875da4b0 Clean application identifier before processing 2015-06-01 17:03:51 +02:00
David Prévot 7f2f92847b Replace `_method` requirement by {g,s}etMethods()
Make the call compatible with future Symfony version, and avoid
E_USER_DEPRECATED as thrown by the current 2.7.0-beta1:

The "_method" requirement is deprecated since version 2.2 and will be
removed in 3.0. Use getMethods() instead. at
…/Symfony/Component/Routing/Route.php#554

The "_method" requirement is deprecated since version 2.2 and will be
removed in 3.0. Use the setMethods() method instead or the "methods"
option in the route definition. at
…/Symfony/Component/Routing/Route.php#662
2015-04-19 12:08:29 -04:00
Jenkins for ownCloud b585d87d9d Update license headers 2015-03-26 11:44:36 +01:00
Morris Jobke 06aef4e8b1 Revert "Updating license headers"
This reverts commit 6a1a4880f0.
2015-02-26 11:37:37 +01:00
Jenkins for ownCloud 6a1a4880f0 Updating license headers 2015-02-23 12:13:59 +01:00
Lukas Reschke 886bda5f81 Refactor OC_Request into TrustedDomainHelper and IRequest
This changeset removes the static class `OC_Request` and moves the functions either into `IRequest` which is accessible via `\OC::$server::->getRequest()` or into a separated `TrustedDomainHelper` class for some helper methods which should not be publicly exposed.

This changes only internal methods and nothing on the public API. Some public functions in `util.php` have been deprecated though in favour of the new non-static functions.

Unfortunately some part of this code uses things like `__DIR__` and thus is not completely unit-testable. Where tests where possible they ahve been added though.

Fixes https://github.com/owncloud/core/issues/13976 which was requested in https://github.com/owncloud/core/pull/13973#issuecomment-73492969
2015-02-16 22:13:00 +01:00
Bernhard Posselt f195123765 Intelligent container
* resolves dependencies by type hint or variable name
* simpler route.php
* implementation of https://github.com/owncloud/core/issues/12829

Generates and injects parameters automatically. You can now build full classes like

    $c->query('MyClassName')

without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken.

Therefore the following two implementations are identical:

    class Class1 { function __construct(MyClassName $class)
    class Class1 { function __construct($MyClassName)

This makes it possible to also inject primitive values such as strings, arrays etc.

In addition if the query could not be resolved, a `QueryException` is now thrown

Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional

Old commit messages:

make it possible to return the routes instead of having to intialize the application
try to get the controller by convention
add first implementation of automatic resolve
add another test just to be sure
store the resolved object
more tests
add phpdoc to public app.php method
use the same variable for the public app.php method
deprecate old methods and add services for public interfaces
deprecated getServer method
disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D)
register userid because its such an often used variable
fix indention and leading slash
use test namespace
add deprecation reasons, remove private api usage checks and remove deprecation from getServer()
add additional public interfaces
add public interface for rootfolder
fix syntax error
remove deprecation from methods where no alternative is there yet
remove deprecated from method which has no alternative
add timezone public service for #12881
add another deprecation hint
move deprecation into separate branch
remove dead comment
first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter
also trim the namespace name
add an interface for timefactory
move timefactory to public and add icontrollermethodreflector
keep core interface
fix copyright date in headers
2014-12-23 09:50:42 +01:00
Morris Jobke d40bdfb35e drop unneeded var_dump - fixes #9997 2014-11-18 22:36:42 +01:00
Robin Appelman 9fd234f63f Log some additional events 2014-10-20 13:38:38 +02:00
Robin Appelman 1e69f5e7ac Log some basic events 2014-10-20 13:38:38 +02:00
Joas Schilling 71bec60b92 Also match routes without trailing slash
Fix #11209
2014-09-22 11:22:33 +02:00
Jörn Friedrich Dreyer 5a588333b2 introduce and use getCurrentConnection() 2014-07-01 16:45:00 +02:00
Vincent Petry 799205488c Prevent loadApps on upgrade
Moved OC::needUpgrade() to OCP\Util::needUpgrade() to make it accessible
form the router.
Moved maintenance + upgrade check to the router.
2014-06-18 11:10:07 +02:00
Lukas Reschke ac7fb1b23e Remove legacy routing code
The getfile routing code was absolutely legacy and not needed anymore. Additionally \OC::$REQUESTEDAPP was never set to the actually accessed application.

This commit removes the legacy routing code and ensures that $REQUESTEDAPP is always set so that other applications (e.g. the firewall or a two-factor authentication) can intercept the currently accessed app.

Testplan:
[x] Installation works
[x] Login with DB works
[x] Logout works
[x] Login with alternate backend works (tested with user_webdavauth)
[x] Other apps are accessible
[x] Redirect on login works (e.g. index.php?redirect_url=%2Fcore%2Findex.php%2Fsettings%2Fapps%3Finstalled)
[x] Personal settings are accessible
[x] Admin settings are accessible
[x] Sharing files works
[x] DAV works
[x] OC::$REQUESTEDAPP contains the requested application and can be intercepted by other applications
2014-06-05 11:45:45 +02:00
Robin McCorkell 87b548ed91 Fix all PHPDoc types and variable names, in /lib 2014-05-13 19:08:14 +01:00
Thomas Müller 33987eea83 remove legacy aka deprecated code: OC_Cache 2014-05-12 16:23:33 +02:00
Robin Appelman 77e6278d09 Preserve keys when sorting parameters when generatings urls 2014-04-29 11:55:19 +02:00
Andreas Fischer f2f5a53d36 Merge pull request #7988 from owncloud/routing-cache-webroot
Keep cached urls with different hostnames or baseurls seperate

* owncloud/routing-cache-webroot:
  Sort parameters and cast to int
  add delimiter between host and baseurl
  Keep cached urls with different hostnames or baseurls seperate
2014-04-20 18:27:23 +02:00
Bart Visscher a4b7f5155f Fix PHPdoc in lib/private
using scrutinizer patch
2014-04-15 22:55:20 +02:00
Robin Appelman 7f77b08098 Sort parameters and cast to int 2014-04-15 15:48:02 +02:00
Thomas Müller ecd74d3630 Merge pull request #8138 from owncloud/allow-app-in-routes.php
To isolate the variable scope used inside the $file it is required in it...
2014-04-10 16:09:23 +02:00
Thomas Müller 98a5f121fd To isolate the variable scope used inside the $file it is required in it's own method 2014-04-09 22:45:34 +02:00
Robin Appelman 51fbf0bcbc add delimiter between host and baseurl 2014-04-07 13:27:18 +02:00
Robin Appelman db95f49b7e Load all routes when matching an ocs route 2014-04-03 13:01:20 +02:00
Robin Appelman 9c8596e95b Keep cached urls with different hostnames or baseurls seperate 2014-04-01 15:43:27 +02:00
Robin Appelman 9b2bb7c6ab fix undefined index warning in router 2014-03-26 13:02:11 +01:00
Robin Appelman d75c3d5f9a Fix routes getting lost when loading app routes twice 2014-03-25 14:28:30 +01:00
Robin Appelman e1d3d0e948 fix incorect array 2014-03-25 14:04:18 +01:00
Robin Appelman c17f415356 Only load core routes for ocs and settings 2014-03-25 13:42:47 +01:00
Robin Appelman 9e89ad07c6 Only load core routes when matching a core route 2014-03-24 16:38:01 +01:00
Robin Appelman 0e1cb001b6 Cache generated urls for routes 2014-03-24 15:42:21 +01:00
Robin Appelman f17674fef2 Only load routes from the apps we need 2014-03-24 15:41:46 +01:00
Robin Appelman 0d0aac6fff Load the routes when matching or generating a route instead of when creating the router 2014-03-24 14:55:03 +01:00