Commit Graph

1690 Commits

Author SHA1 Message Date
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
Thomas Müller 4910f3e202 fixing unit tests in UsersControllerTest 2015-02-16 19:45:40 +01:00
Thomas Müller 9271059195 Merge pull request #13750 from owncloud/enhanced-code-checker
Implement php code checker to detect usage of not allowed private ...
2015-02-16 16:55:57 +01:00
Joas Schilling 8eb804b1f6 Merge pull request #13269 from owncloud/issue/13211-cache-array-implementation
Add an array implementation of cache and use it if we are not debugging
2015-02-16 15:35:20 +01:00
Robin Appelman 23ab25e93a Use the app manager from oc_app 2015-02-16 15:16:13 +01:00
Robin Appelman 2b58e8489f Add getInstalledApps and getAppsForUser to the app manager 2015-02-16 15:15:35 +01:00
Joas Schilling 8848b5f067 Add an array implementation of cache and use it if we are not debugging 2015-02-16 14:55:50 +01:00
Lukas Reschke a9d1a01440 Rename to allowEval 2015-02-16 12:30:21 +01:00
Lukas Reschke b20174bdad Allow AppFramework applications to specify a custom CSP header
This change allows AppFramework applications to specify a custom CSP header for example when the default policy is too strict. Furthermore this allows us to partially migrate away from CSS and allowed eval() in our JavaScript components.

Legacy ownCloud components will still use the previous policy. Application developers can use this as following in their controllers:
```php
$response = new TemplateResponse('activity', 'list', []);
$cspHelper = new ContentSecurityPolicyHelper();
$cspHelper->addAllowedScriptDomain('www.owncloud.org');
$response->addHeader('Content-Security-Policy', $cspHelper->getPolicy());
return $response;
```

Fixes https://github.com/owncloud/core/issues/11857 which is a pre-requisite for https://github.com/owncloud/core/issues/13458 and https://github.com/owncloud/core/issues/11925
2015-02-16 11:00:41 +01:00
Robin Appelman 7bfe476030 add unit test for webdav quota 2015-02-13 18:00:01 +01:00
Robin Appelman 6ecfcde954 update test 2015-02-13 15:01:05 +01:00
Robin Appelman 134243d3e5 Dont lower the mtime of a folder when propagating changes 2015-02-13 14:30:05 +01:00
Joas Schilling 12fc625885 Fix test with the invalid filter check being added 2015-02-13 13:08:57 +01:00
Lukas Reschke bd5440a8a3 Merge pull request #13780 from owncloud/cmreflector-inheritance
Additional controllermethodreflector inheritance tests
2015-02-12 18:34:07 +01:00
Vincent Petry fbbb9fe0fd Merge pull request #13979 from owncloud/group-share-collition-wrong-type-in-post-hook
Do not overwrite the shareType so the post hook is still correct
2015-02-11 15:23:13 +01:00
Thomas Müller d74662df7d implement php code checker to detect usage of not allowed private APIs - including console command to check local code to be used by developers 2015-02-10 11:51:24 +01:00
Thomas Müller c60dabd11b Request requires a second parameter 2015-02-09 23:06:55 +01:00
Vincent Petry 5296767393 Merge pull request #13921 from owncloud/ocs-af
Add a controller and reponse for ocs
2015-02-09 18:11:47 +01:00
Joas Schilling c17b236c19 Add a test for the post_shared hook shareType 2015-02-09 13:12:34 +01:00
Lukas Reschke 770fa761b8 Respect `mod_unique_id` and refactor `OC_Request::getRequestId`
When `mod_unique_id` is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs.

Testplan:

- [ ] When `mod_unique_id` is enabled the request ID equals the one generated by `mod_unique_id`.
- [ ] When `mod_unique_id` is not available the request ID is a 20 character long random string
- [ ] The generated Id is stable over the lifespan of one request

Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI.

Fixes https://github.com/owncloud/core/issues/13366
2015-02-09 11:53:11 +01:00
Morris Jobke 90556cb70b Merge pull request #12283 from oparoz/sfnt-fonts
Updated the media type of some font types
2015-02-07 13:33:49 +01:00
Morris Jobke 485e2a282b Merge pull request #13753 from owncloud/use-403-instead-of-200
Use 403 instead of 200 response
2015-02-07 13:25:15 +01:00
Lukas Reschke 4d91fa4c93 Normalize before processing 2015-02-06 15:03:29 +01:00
Bernhard Posselt 9873aa3d9e fix license email 2015-02-05 14:10:16 +01:00
Bernhard Posselt b89ddcfe41 fix license email 2015-02-05 14:09:01 +01:00
Bernhard Posselt fdc64e370c add a controller and reponse for ocs 2015-02-05 14:02:17 +01:00
Bjoern Schiessle 21c45925fe detect root of mountpoint also if the trailing slash is missed 2015-02-04 12:47:04 +01:00
Lukas Reschke 2426bd1b9d Merge pull request #13811 from owncloud/default-to-null
Default to `null` for lostpassword
2015-02-02 11:41:14 +01:00
Lukas Reschke 944dc127b8 Mock l10n in the setup 2015-02-01 17:46:48 +01:00
Lukas Reschke ba29ea178f Add unit tests for empty token 2015-02-01 17:34:03 +01:00
Lukas Reschke 0f7634eadc Switch to a factory and add unit tests 2015-01-30 17:24:42 +01:00
Lukas Reschke 7e7dd92f6b Add unit tests 2015-01-30 14:29:46 +01:00
Bernhard Posselt 81836ccc7e another test for overriding the docblock 2015-01-29 20:35:07 +01:00
Bernhard Posselt 72d2b6f723 additional inheritance tests 2015-01-29 20:33:05 +01:00
Bernhard Posselt 84a47645b9 fix indention 2015-01-29 20:10:29 +01:00
Bernhard Posselt 983563d7d9 add tests for closing the cursor 2015-01-29 19:23:57 +01:00
Bernhard Posselt 37e8969d34 ignore cursorclosing 2015-01-29 19:16:28 +01:00
Robin Appelman 2124540d1d Dont remove a file from cache if the delete operation failed 2015-01-29 15:39:56 +01:00
Robin Appelman 05035ef4af Fix webdav put for single file webdav shares 2015-01-29 12:47:12 +01:00
Robin Appelman ddee63fa00 Fix resolving paths for views rooted in a file 2015-01-29 12:47:11 +01:00
Lukas Reschke b9f180e001 Use 403 instead of 200 response
A forbidden should throw a 403 and this makes it easier for me to do some automated testing.
2015-01-29 12:04:54 +01:00
Robin Appelman cec43df0f0 Add unit test 2015-01-28 13:44:39 +01:00
Morris Jobke 752b94d363 Merge pull request #13717 from owncloud/storage-donotwrapnullstorage
Prevent wrapping null storage
2015-01-28 01:00:20 +01:00
Vincent Petry 6d8985b671 Prevent wrapping null storage
Can happen when trying to instantiate external storages that have
incomplete config, where the constructor throws an exception (the
exception is caught in createStorage())
2015-01-27 17:40:08 +01:00
Vincent Petry acec40fe5a Merge pull request #13561 from owncloud/trash-finaldeletewhencrossstoragefix
Call final unlink in trash wrapper's storage
2015-01-27 17:05:38 +01:00
Lukas Reschke a870dbe70b Merge pull request #13636 from owncloud/add-warning-if-restore-of-data-is-not-possible
Add value if restore of data is possible for a user
2015-01-27 14:12:05 +01:00
Morris Jobke 9fbeaf0fd9 Add value if restore of data is possible for a user
* reason: nice to know before password change in user management
* restore is possible:
	* encryption is disabled
	* encryption is enabled, admin and user has checked the
	  restore option
* if not possible:
	* highlight users row in red once the admin wants to change the password
	* show also a little tipsy
2015-01-27 13:23:19 +01:00
Bjoern Schiessle 5ba19ba7fc certificate manager should always use a \OC\Files\View otherwise we will get problems for different primary storages 2015-01-26 16:58:52 +01:00
Bjoern Schiessle 67da1f7e5a certificate manager only needs the user-id, no need to pass on the complete user object 2015-01-26 16:58:52 +01:00
Thomas Müller 5da4071c45 Merge pull request #13621 from owncloud/system-config-multiset
Add a method to set/unset multiple config values with one write
2015-01-26 13:36:22 +01:00
Olivier Paroz 7fbf1a20d7 Updated the media type of some font types
TTF and TTF have now the same media type
Official since 2013 and supported by Firefox and Chrome
https://www.iana.org/assignments/media-types/application/font-sfnt

Introducing support for Type1 fonts
2015-01-24 01:49:13 +01:00
Robin Appelman 87a1b2bdc4 Preserve mtime when doing cross storage move 2015-01-23 15:11:27 +01:00
Vincent Petry 8fa3e7a6bf Do not retrieve shares through group if user has no group 2015-01-23 15:11:06 +01:00
Joas Schilling 039397bd31 Use setConfigs() instead of calling setConfig() multiple times 2015-01-23 14:52:21 +01:00
Joas Schilling c61e9f3912 Add a method to set/unset multiple config values in one call
This reduces the number of file writes we do for config.php and therefor
hopefully helps lowering the chances for empty config.php files
2015-01-23 11:00:53 +01:00
Morris Jobke 3d42ecea37 Fix undefined offset 1 for wrong user mail address
* fixes Undefined offset: 1 at lib/private/mail.php#143
2015-01-22 16:23:50 +01:00
Morris Jobke b5b491d1bb Merge pull request #13509 from owncloud/share-deletechildrenwhenunsharefromgroup
Fix reshare permission change to not impair other deletion code
2015-01-22 10:40:29 +01:00
Vincent Petry 9f137ac259 Fix reshare permission change to not impair other deletion code
A recent change that prevents reshare permission changes to delete group
share children had the side-effect of also preventing group share
children deletion when it needed to be done.

This fix adds an extra flag to isolate the "reshare permission change"
deletion case and keep the other ones as they were before, not only to
fix the regression but also fix other potential regressions in code that
uses this method.

Also updated the comment because now Helper::delete() is no longer
limited to reshares but also applies to group share children.
2015-01-22 10:12:47 +01:00
Thomas Müller c13bf8d820 Merge pull request #13552 from owncloud/request-uri-double-slash
Remove duplicated slashes from the requested url
2015-01-21 21:56:09 +01:00
Robin Appelman 0b9f7642a6 Add unit test 2015-01-21 17:18:47 +01:00
Vincent Petry f3d696599a Add unit test for external share JS dialog
Moved external share JS code into a small plugin to make it testable.

Added unit test for the external share dialog logic + ajax calls.
2015-01-21 11:26:54 +01:00
Joas Schilling 7eb8404040 Add a test case for memcaches to store an array 2015-01-20 10:51:04 +01:00
Vincent Petry ef8d38ca27 Fix chunked query for tags + unit test 2015-01-19 17:05:44 +01:00
Thomas Müller d2d6472e39 Merge pull request #13423 from owncloud/share-fixfindshareforuserwithmultiplegroups
Fix getItemSharedWithUser for groups
2015-01-19 12:34:28 +01:00
Lukas Reschke 2272bcedeb Fix filtering for users when $gid is empty
Previously when $gid was empty the users were not filtered at all. Rendering the search function in the user management pretty useless.

Fixes itself
2015-01-18 18:31:03 +01:00
Lukas Reschke 744cf713f7 Merge pull request #13319 from owncloud/replace-line-breaks-in-app-description
replace line breaks in the app description by spaces - fixes #13315
2015-01-17 01:03:41 +01:00
Vincent Petry 40931a8b0d Fix getItemSharedWithUser for groups
Fixed SQL query for whenever a user has more than one group.
Added missing $owner where clause for group lookup.
Added unit tests for the group cases.
2015-01-16 18:11:13 +01:00
Thomas Müller 051f626617 Merge pull request #13389 from owncloud/issue/13372-failing-oracle-tests-jenkins
Mask table and column names with backticks and add lastInsertID() workar...
2015-01-15 22:41:57 +01:00
Robin Appelman 0a3e0a1665 Additional unit test for recursive remove 2015-01-15 18:47:05 +01:00
Bernhard Posselt bb0c88a577 always set url parameters when they are available in the app dispatch
prefer url parameters passed into the main method. If they are not present, use the containers urlParameters

add space
2015-01-15 15:22:52 +01:00
Joas Schilling 6769adcd0d Mask table and column names with backticks and add lastInsertID() workaround 2015-01-15 14:43:06 +01:00
Morris Jobke 925a680a24 Merge pull request #13354 from owncloud/hhvm-redis
HHVM: Prevent E_WARNING messages by Redis test in console output.
2015-01-15 00:23:12 +01:00
Thomas Müller 337c43ce92 Merge pull request #13317 from owncloud/partfile-fileinfo
Return valid fileinfo objects for part files
2015-01-14 22:39:19 +01:00
Morris Jobke 64d7463ca3 Merge pull request #13344 from owncloud/issue/13334-cleanup-tags-repairstep
Add a repair step to clean up orphan tags and tag entries
2015-01-14 20:43:23 +01:00
Joas Schilling a22068cce3 Add a repair step to clean up orphan tags and tag entries 2015-01-14 16:49:25 +01:00
Andreas Fischer 567c246094 HHVM: Prevent E_WARNING messages by Redis test in console output. 2015-01-14 14:46:22 +01:00
Morris Jobke 520d8ec53b OC_App::parseAppInfo
* replace line breaks (on non empty lines) in the app description by spaces
* fixes #13315
* includes unit tests
2015-01-14 13:58:31 +01:00
Joas Schilling 4b3a3dc0bb Check new and old ways of required oC version for app compatibility 2015-01-14 13:02:02 +01:00
Robin Appelman 96dff341e2 Return valid fileinfo objects for part files 2015-01-13 13:59:28 +01:00
Vincent Petry fcc3b3d5f7 Fix searchCommon to properly match path name
The internal path was matched without the last "/" which caused
"files_trashbin" to also match when the internal path was "files".

This adds the missing slash for the comparison.
2015-01-12 19:33:00 +01:00
Lukas Reschke 05615bfd47 Simplify isValidPath and add unit tests
The check for invalid paths is actually over-complicated and performed twice resulting in a performance penalty. Additionally, I decided to add unit-tests to that function.

Part of https://github.com/owncloud/core/issues/13221
2015-01-10 00:40:21 +01:00
Thomas Müller 9fb61b42f6 Merge pull request #13208 from owncloud/hhvm-streamwrapper-exception
HHVM Workaround: Do not use Exception from Stream.
2015-01-09 18:02:28 +01:00
Andreas Fischer df849bb69a HHVM Workaround: Do not use Exception from Stream.
Works around https://github.com/facebook/hhvm/issues/2436#issuecomment-69351373
2015-01-09 17:01:17 +01:00
Robin McCorkell 631d6571fd Merge pull request #13181 from owncloud/filecache-preventleadingslash
Trim leading or trailing slashes in file cache paths
2015-01-09 13:54:17 +00:00
Thomas Müller 1f1643b35f Merge pull request #12995 from owncloud/tbelau666-master
Use Doctrines filter by table name
2015-01-09 14:17:14 +01:00
Morris Jobke 6a5f12beca Merge pull request #12988 from owncloud/logfile_download
Logfile download
2015-01-09 00:33:22 +01:00
Vincent Petry aa821ecc00 Trim leading or trailing slashes in file cache paths 2015-01-08 19:43:02 +01:00
Lukas Reschke 7fbb7f4dc4 Add version to .htaccess
Currently if a user does not replace the .htaccess file with the new update this can lead to serious problems in case Apache is used as webserver.

This commit adds the version to the .htaccess file and the update routine fails in case not the newest version is specified in there. This obviously means that every release has to update the version specified in .htaccess as well. But I see no better solution for it.

Conflicts:
	lib/private/updater.php
2015-01-08 12:49:02 +01:00
Georg Ehrke f579f2bd94 add Download logfile button to admin settings
add logSettingsController

add download logfile button

move getEntries to LogSettingsController

move set log level to logsettingscontroller.php

add warning if logfile is bigger than 100MB

add unit test for set log level

fix typecasting, add new line at EoF

show log and logfile download only if log_type is set to owncloud

add unit test for getFilenameForDownload
2015-01-07 14:55:53 +01:00
Lukas Reschke 3e324f87d0 Use proper test name 2015-01-05 09:54:14 +01:00
Lukas Reschke 7b3f736300 Use proper namespace 2015-01-05 09:54:14 +01:00
Lukas Reschke 0ed00bca43 Use namespace 2015-01-05 09:54:14 +01:00
Lukas Reschke 556c9b6f46 Write unit-tests and use DI 2015-01-05 09:54:12 +01:00
Tom Needham dc85c20b18 Add provisioning_api app
enable unit tests for provisioning api

fix admin docu key
2014-12-24 22:15:20 +01:00
Thomas Müller 40330bf492 Merge pull request #12830 from owncloud/intelligent-container
Intelligent container
2014-12-23 15:36:55 +01:00
Morris Jobke 6fd1a9563e add proper prefix for migration tests 2014-12-23 11:05:53 +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
Andreas Fischer 4569953e5c Clean up test table in Connection Test to prevent unnecessary failures. 2014-12-23 01:01:58 +01:00
Thomas Müller fe6f4a1404 Merge pull request #11810 from owncloud/hhvm-autotest
Adding autotest-hhvm.sh [WIP]
2014-12-22 14:12:03 +01:00
Andreas Fischer 91e03f5845 Properly call parent::tearDown() in MDB2SchemaManager::tearDown().
The early return introduced by 04c982a96e
prevents parent::tearDown() being called on Oracle.
2014-12-20 15:30:35 +01:00