diff options
Diffstat (limited to 'lib/private')
104 files changed, 469 insertions, 210 deletions
diff --git a/lib/private/activity/event.php b/lib/private/activity/event.php index 247113d54a9..413ff613186 100644 --- a/lib/private/activity/event.php +++ b/lib/private/activity/event.php @@ -1,6 +1,7 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Phil Davis <phil.davis@inf.org> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php index 340f3d335e5..fadfedf277f 100644 --- a/lib/private/activitymanager.php +++ b/lib/private/activitymanager.php @@ -2,7 +2,6 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Lukas Reschke <lukas@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/api.php b/lib/private/api.php index 3c599de25a9..cd5148c51a1 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -1,4 +1,34 @@ <?php +/** + * @author Bart Visscher <bartv@thisnet.nl> + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author Björn Schießle <schiessle@owncloud.com> + * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> + * @author Michael Gapczynski <GapczynskiM@gmail.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Tom Needham <tom@owncloud.com> + * @author Vincent Petry <pvince81@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ use OCP\API; use OCP\AppFramework\Http; diff --git a/lib/private/app.php b/lib/private/app.php index 5122a4964d4..718adcd25c1 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -18,6 +18,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Markus Goetz <markus@woboq.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author RealRancor <Fisch.666@gmx.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Sam Tuke <mail@samtuke.com> diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 75b1c0a7865..8fb197e73ff 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -4,6 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/app/codechecker/nodevisitor.php b/lib/private/app/codechecker/nodevisitor.php index a22f852f36a..3295f354324 100644 --- a/lib/private/app/codechecker/nodevisitor.php +++ b/lib/private/app/codechecker/nodevisitor.php @@ -1,5 +1,6 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/private/app/codechecker/privatecheck.php b/lib/private/app/codechecker/privatecheck.php index d6f4eb06981..bafcfd1d03e 100644 --- a/lib/private/app/codechecker/privatecheck.php +++ b/lib/private/app/codechecker/privatecheck.php @@ -1,8 +1,6 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/app/codechecker/strongcomparisoncheck.php b/lib/private/app/codechecker/strongcomparisoncheck.php index 7de0fe3e5c3..3072027b258 100644 --- a/lib/private/app/codechecker/strongcomparisoncheck.php +++ b/lib/private/app/codechecker/strongcomparisoncheck.php @@ -1,8 +1,6 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/app/dependencyanalyzer.php b/lib/private/app/dependencyanalyzer.php index dd40e4052a7..5d86368ea83 100644 --- a/lib/private/app/dependencyanalyzer.php +++ b/lib/private/app/dependencyanalyzer.php @@ -2,6 +2,7 @@ /** * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index cf2a057f224..d1c1e4bfc45 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -5,12 +5,10 @@ * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index 544da74a010..651b268a35e 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -5,6 +5,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @@ -78,7 +79,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { }); $this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){ - return new Output(); + return new Output($this->getServer()->getWebRoot()); }); $this->registerService('OCP\\IAvatarManager', function($c) { diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php index dee9818f4bc..f892ee7e5e3 100644 --- a/lib/private/appframework/http.php +++ b/lib/private/appframework/http.php @@ -3,6 +3,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/private/appframework/http/output.php b/lib/private/appframework/http/output.php index f04157665f8..01636d397b2 100644 --- a/lib/private/appframework/http/output.php +++ b/lib/private/appframework/http/output.php @@ -27,6 +27,15 @@ use OCP\AppFramework\Http\IOutput; * Very thin wrapper class to make output testable */ class Output implements IOutput { + /** @var string */ + private $webRoot; + + /** + * @param $webRoot + */ + public function __construct($webRoot) { + $this->webRoot = $webRoot; + } /** * @param string $out @@ -72,10 +81,11 @@ class Output implements IOutput { * @param string $path * @param string $domain * @param bool $secure - * @param bool $httponly + * @param bool $httpOnly */ - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly) { - setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) { + $path = $this->webRoot ? : '/'; + setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); } } diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index af6015b0eef..77785135162 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -6,10 +6,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> - * @author Robin McCorkell <rmccorkell@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 @@ -43,6 +43,7 @@ use OCP\Security\ISecureRandom; class Request implements \ArrayAccess, \Countable, IRequest { const USER_AGENT_IE = '/MSIE/'; + const USER_AGENT_IE_8 = '/MSIE 8.0/'; // Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#'; const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#'; @@ -410,7 +411,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { } } - $this->items['parameters'] = array_merge($this->items['parameters'], $params); + if (is_array($params)) { + $this->items['parameters'] = array_merge($this->items['parameters'], $params); + } $this->contentDecoded = true; } @@ -553,6 +556,27 @@ class Request implements \ArrayAccess, \Countable, IRequest { } /** + * Returns the used HTTP protocol. + * + * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. + */ + public function getHttpProtocol() { + $claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']); + + $validProtocols = [ + 'HTTP/1.0', + 'HTTP/1.1', + 'HTTP/2', + ]; + + if(in_array($claimedProtocol, $validProtocols, true)) { + return $claimedProtocol; + } + + return 'HTTP/1.1'; + } + + /** * Returns the request uri, even if the website uses one or more * reverse proxies * @return string diff --git a/lib/private/appframework/middleware/security/corsmiddleware.php b/lib/private/appframework/middleware/security/corsmiddleware.php index d7c42cd9b13..74b0dd09974 100644 --- a/lib/private/appframework/middleware/security/corsmiddleware.php +++ b/lib/private/appframework/middleware/security/corsmiddleware.php @@ -1,8 +1,8 @@ <?php /** * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/appframework/utility/simplecontainer.php b/lib/private/appframework/utility/simplecontainer.php index 3de6d9ba5bc..bcae351e023 100644 --- a/lib/private/appframework/utility/simplecontainer.php +++ b/lib/private/appframework/utility/simplecontainer.php @@ -2,9 +2,9 @@ /** * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index deadadfb77e..03c9180ddb0 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -4,7 +4,6 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index a433b84d7bf..1cda05f28e5 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -1,8 +1,8 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/connector/sabre/auth.php b/lib/private/connector/sabre/auth.php index 8a6eaab5bf8..d33ffad7d5c 100644 --- a/lib/private/connector/sabre/auth.php +++ b/lib/private/connector/sabre/auth.php @@ -8,7 +8,6 @@ * @author Markus Goetz <markus@woboq.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/connector/sabre/copyetagheaderplugin.php b/lib/private/connector/sabre/copyetagheaderplugin.php index 863d4cf3e10..fe1a8fab70e 100644 --- a/lib/private/connector/sabre/copyetagheaderplugin.php +++ b/lib/private/connector/sabre/copyetagheaderplugin.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/connector/sabre/custompropertiesbackend.php b/lib/private/connector/sabre/custompropertiesbackend.php index 47f34909a08..a05de1adb35 100644 --- a/lib/private/connector/sabre/custompropertiesbackend.php +++ b/lib/private/connector/sabre/custompropertiesbackend.php @@ -1,7 +1,6 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/connector/sabre/exceptionloggerplugin.php b/lib/private/connector/sabre/exceptionloggerplugin.php index 53a1f738ea6..3f53431c8a1 100644 --- a/lib/private/connector/sabre/exceptionloggerplugin.php +++ b/lib/private/connector/sabre/exceptionloggerplugin.php @@ -1,6 +1,7 @@ <?php /** * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php index 84620f454aa..ab7f6884a5e 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/lib/private/connector/sabre/filesplugin.php @@ -64,10 +64,20 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { private $isPublic; /** + * @var \OC\Files\View + */ + private $fileView; + + /** * @param \Sabre\DAV\Tree $tree + * @param \OC\Files\View $view + * @param bool $isPublic */ - public function __construct(\Sabre\DAV\Tree $tree, $isPublic = false) { + public function __construct(\Sabre\DAV\Tree $tree, + \OC\Files\View $view, + $isPublic = false) { $this->tree = $tree; + $this->fileView = $view; $this->isPublic = $isPublic; } @@ -106,6 +116,26 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { fclose($body); } }); + $this->server->on('beforeMove', [$this, 'checkMove']); + } + + /** + * Plugin that checks if a move can actually be performed. + * @param string $source source path + * @param string $destination destination path + * @throws \Sabre\DAV\Exception\Forbidden + */ + function checkMove($source, $destination) { + list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($source); + list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination); + + if ($sourceDir !== $destinationDir) { + $sourceFileInfo = $this->fileView->getFileInfo($source); + + if (!$sourceFileInfo->isDeletable()) { + throw new \Sabre\DAV\Exception\Forbidden($source . " cannot be deleted"); + } + } } /** diff --git a/lib/private/connector/sabre/maintenanceplugin.php b/lib/private/connector/sabre/maintenanceplugin.php index f886332418a..4b7ff8a39da 100644 --- a/lib/private/connector/sabre/maintenanceplugin.php +++ b/lib/private/connector/sabre/maintenanceplugin.php @@ -1,6 +1,7 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/private/connector/sabre/serverfactory.php b/lib/private/connector/sabre/serverfactory.php index 54470b0b8aa..893e29fd41c 100644 --- a/lib/private/connector/sabre/serverfactory.php +++ b/lib/private/connector/sabre/serverfactory.php @@ -1,5 +1,6 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. @@ -71,7 +72,6 @@ class ServerFactory { $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName())); // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to / $server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin()); - $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree)); $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger)); $server->addPlugin(new \OC\Connector\Sabre\LockPlugin($objectTree)); $server->addPlugin(new \OC\Connector\Sabre\ListenerPlugin($this->dispatcher)); @@ -90,6 +90,7 @@ class ServerFactory { } $objectTree->init($root, $view, $this->mountManager); + $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree, $view)); $server->addPlugin(new \OC\Connector\Sabre\QuotaPlugin($view)); if($this->userSession->isLoggedIn()) { diff --git a/lib/private/console/application.php b/lib/private/console/application.php index edfb45c8577..e7ddeed7d25 100644 --- a/lib/private/console/application.php +++ b/lib/private/console/application.php @@ -1,6 +1,7 @@ <?php /** * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/db/ocsqliteplatform.php b/lib/private/db/ocsqliteplatform.php index 543f58b90ec..2456d262fe3 100644 --- a/lib/private/db/ocsqliteplatform.php +++ b/lib/private/db/ocsqliteplatform.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/encryption/hookmanager.php b/lib/private/encryption/hookmanager.php index d096b7ff3ad..8969379c957 100644 --- a/lib/private/encryption/hookmanager.php +++ b/lib/private/encryption/hookmanager.php @@ -1,7 +1,6 @@ <?php /** * @author Björn Schießle <schiessle@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/encryption/keys/storage.php b/lib/private/encryption/keys/storage.php index d0c094538b0..e21fd62e366 100644 --- a/lib/private/encryption/keys/storage.php +++ b/lib/private/encryption/keys/storage.php @@ -2,7 +2,6 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php index c004dfda0d9..d38ec6684a6 100644 --- a/lib/private/encryption/manager.php +++ b/lib/private/encryption/manager.php @@ -3,7 +3,6 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Jan-Christoph Borchardt <hey@jancborchardt.net> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/encryption/update.php b/lib/private/encryption/update.php index 125946ab266..64cccc16ed8 100644 --- a/lib/private/encryption/update.php +++ b/lib/private/encryption/update.php @@ -2,7 +2,6 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php index 90ae8259972..ef500883865 100644 --- a/lib/private/encryption/util.php +++ b/lib/private/encryption/util.php @@ -3,7 +3,6 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Jan-Christoph Borchardt <hey@jancborchardt.net> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/eventsource.php b/lib/private/eventsource.php index e2be808e726..c076b87ddd9 100644 --- a/lib/private/eventsource.php +++ b/lib/private/eventsource.php @@ -2,6 +2,7 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Felix Moeller <mail@felixmoeller.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/private/files.php b/lib/private/files.php index 86ebf40cc57..e24e10ec299 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -1,27 +1,22 @@ <?php /** - * @author Andreas Fischer <bantu@owncloud.com> * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> - * @author dratini0 <dratini0@gmail.com> * @author Frank Karlitschek <frank@owncloud.org> * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author mvn23 <schopdiedwaas@gmail.com> * @author Nicolai Ehemann <en@enlightened.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thibaut GRIDEL <tgridel@free.fr> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Valerio Ponte <valerio.ponte@gmail.com> + * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 @@ -40,7 +35,7 @@ * */ -use OC\Lock\NoopLockingProvider; +use OC\Files\View; use OC\Streamer; use OCP\Lock\ILockingProvider; @@ -63,10 +58,11 @@ class OC_Files { OC_Response::setContentDispositionHeader($name, 'attachment'); header('Content-Transfer-Encoding: binary'); OC_Response::disableCaching(); - $filesize = \OC\Files\Filesystem::filesize($filename); - header('Content-Type: '.\OC_Helper::getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename))); - if ($filesize > -1) { - OC_Response::setContentLengthHeader($filesize); + $fileSize = \OC\Files\Filesystem::filesize($filename); + $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); + header('Content-Type: '.$type); + if ($fileSize > -1) { + OC_Response::setContentLengthHeader($fileSize); } } @@ -78,99 +74,78 @@ class OC_Files { * @param boolean $onlyHeader ; boolean to only send header of the request */ public static function get($dir, $files, $onlyHeader = false) { + $view = \OC\Files\Filesystem::getView(); + $getType = self::FILE; + $filename = $dir; + try { - if (is_array($files) && count($files) === 1) { - $files = $files[0]; - } + if (is_array($files) && count($files) === 1) { + $files = $files[0]; + } - if (is_array($files)) { - $getType = self::ZIP_FILES; - $basename = basename($dir); - if ($basename) { - $name = $basename; - } else { - $name = 'download'; + if (!is_array($files)) { + $filename = $dir . '/' . $files; + if (!$view->is_dir($files)) { + self::getSingleFile($view, $dir, $files, $onlyHeader); + return; + } } - $filename = $dir . '/' . $name; - } else { - $filename = $dir . '/' . $files; - if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) { + $name = 'download'; + if (is_array($files)) { + $getType = self::ZIP_FILES; + $basename = basename($dir); + if ($basename) { + $name = $basename; + } + + $filename = $dir . '/' . $name; + } else { + $filename = $dir . '/' . $files; $getType = self::ZIP_DIR; // downloading root ? - if ($files === '') { - $name = 'download'; - } else { + if ($files !== '') { $name = $files; } - - } else { - $getType = self::FILE; - $name = $files; } - } - if ($getType === self::FILE) { - $streamer = false; - } else { $streamer = new Streamer(); - } - OC_Util::obEnd(); + OC_Util::obEnd(); - try { - if ($getType === self::FILE) { - $view->lockFile($filename, ILockingProvider::LOCK_SHARED); - } - - if ($streamer) { - $streamer->sendHeaders($name); - } elseif (\OC\Files\Filesystem::isReadable($filename)) { - self::sendHeaders($filename, $name); - } elseif (!\OC\Files\Filesystem::file_exists($filename)) { - header("HTTP/1.0 404 Not Found"); - $tmpl = new OC_Template('', '404', 'guest'); - $tmpl->printPage(); - exit(); - } else { - header("HTTP/1.0 403 Forbidden"); - die('403 Forbidden'); - } - if ($onlyHeader) { - return; - } - if ($streamer) { - $executionTime = intval(ini_get('max_execution_time')); - set_time_limit(0); - if ($getType === self::ZIP_FILES) { - foreach ($files as $file) { - $file = $dir . '/' . $file; - if (\OC\Files\Filesystem::is_file($file)) { - $fileSize = \OC\Files\Filesystem::filesize($file); - $fh = \OC\Files\Filesystem::fopen($file, 'r'); - $streamer->addFileFromStream($fh, basename($file), $fileSize); - fclose($fh); - } elseif (\OC\Files\Filesystem::is_dir($file)) { - $streamer->addDirRecursive($file); - } + self::lockFiles($view, $dir, $files); + + $streamer->sendHeaders($name); + $executionTime = intval(ini_get('max_execution_time')); + set_time_limit(0); + if ($getType === self::ZIP_FILES) { + foreach ($files as $file) { + $file = $dir . '/' . $file; + if (\OC\Files\Filesystem::is_file($file)) { + $fileSize = \OC\Files\Filesystem::filesize($file); + $fh = \OC\Files\Filesystem::fopen($file, 'r'); + $streamer->addFileFromStream($fh, basename($file), $fileSize); + fclose($fh); + } elseif (\OC\Files\Filesystem::is_dir($file)) { + $streamer->addDirRecursive($file); } - } elseif ($getType === self::ZIP_DIR) { - $file = $dir . '/' . $files; - $streamer->addDirRecursive($file); } - $streamer->finalize(); - set_time_limit($executionTime); - } else { - \OC\Files\Filesystem::readfile($filename); - } - if ($getType === self::FILE) { - $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); + } elseif ($getType === self::ZIP_DIR) { + $file = $dir . '/' . $files; + $streamer->addDirRecursive($file); } + $streamer->finalize(); + set_time_limit($executionTime); + self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); } catch (\OCP\Lock\LockedException $ex) { + self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); + OC::$server->getLogger()->logException($ex); $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('File is currently busy, please try again later'), $hint); } catch (\Exception $ex) { + self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); + OC::$server->getLogger()->logException($ex); $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('Can\'t read file'), $hint); @@ -178,6 +153,56 @@ class OC_Files { } /** + * @param View $view + * @param string $name + */ + private static function getSingleFile($view, $dir, $name, $onlyHeader) { + $filename = $dir . '/' . $name; + OC_Util::obEnd(); + $view->lockFile($filename, ILockingProvider::LOCK_SHARED); + + if (\OC\Files\Filesystem::isReadable($filename)) { + self::sendHeaders($filename, $name); + } elseif (!\OC\Files\Filesystem::file_exists($filename)) { + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_Template('', '404', 'guest'); + $tmpl->printPage(); + exit(); + } else { + header("HTTP/1.0 403 Forbidden"); + die('403 Forbidden'); + } + if ($onlyHeader) { + return; + } + $view->readfile($filename); + } + + /** + * @param View $view + * @param $dir + * @param string[]|string $files + */ + public static function lockFiles($view, $dir, $files) { + if (!is_array($files)) { + $file = $dir . '/' . $files; + $files = [$file]; + } + foreach ($files as $file) { + $file = $dir . '/' . $file; + $view->lockFile($file, ILockingProvider::LOCK_SHARED); + if ($view->is_dir($file)) { + $contents = $view->getDirectoryContent($file); + $contents = array_map(function($fileInfo) use ($file) { + /** @var \OCP\Files\FileInfo $fileInfo */ + return $file . '/' . $fileInfo->getName(); + }, $contents); + self::lockFiles($view, $dir, $contents); + } + } + } + + /** * set the maximum upload size limit for apache hosts using .htaccess * * @param int $size file size in bytes @@ -258,4 +283,28 @@ class OC_Files { } return false; } + + /** + * @param $dir + * @param $files + * @param $getType + * @param View $view + * @param $filename + */ + private static function unlockAllTheFiles($dir, $files, $getType, $view, $filename) { + if ($getType === self::FILE) { + $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); + } + if ($getType === self::ZIP_FILES) { + foreach ($files as $file) { + $file = $dir . '/' . $file; + $view->unlockFile($file, ILockingProvider::LOCK_SHARED); + } + } + if ($getType === self::ZIP_DIR) { + $file = $dir . '/' . $files; + $view->unlockFile($file, ILockingProvider::LOCK_SHARED); + } + } + } diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index 5c04da1f0d5..f3e22701f40 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -13,7 +13,6 @@ * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author TheSFReader <TheSFReader@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index bfdab16b645..dbffba1e306 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -6,6 +6,7 @@ * @author Martin Mattel <martin.mattel@diemattels.at> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Olivier Paroz <github@oparoz.com> * @author Owen Winkler <a_github@midnightcircus.com> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index 88ceb287fb9..cee69194095 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -4,6 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index b333844f8c8..cf9524241dd 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -6,6 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> + * @author tbartenstein <tbartenstein@users.noreply.github.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php index 2871bbd9083..fad8678aae1 100644 --- a/lib/private/files/mount/mountpoint.php +++ b/lib/private/files/mount/mountpoint.php @@ -5,6 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php index 23004fc3527..9032c2bfb9d 100644 --- a/lib/private/files/node/folder.php +++ b/lib/private/files/node/folder.php @@ -215,7 +215,10 @@ class Folder extends Node implements \OCP\Files\Folder { * @var \OC\Files\Storage\Storage $storage */ list($storage, $internalPath) = $this->view->resolvePath($this->path); - $internalPath = rtrim($internalPath, '/') . '/'; + $internalPath = rtrim($internalPath, '/'); + if ($internalPath !== '') { + $internalPath = $internalPath . '/'; + } $internalRootLength = strlen($internalPath); $cache = $storage->getCache(''); diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php index a85553186ae..40d52feb893 100644 --- a/lib/private/files/objectstore/objectstorestorage.php +++ b/lib/private/files/objectstore/objectstorestorage.php @@ -62,41 +62,44 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { public function mkdir($path) { $path = $this->normalizePath($path); - if ($this->is_dir($path)) { + if ($this->file_exists($path)) { return false; } - $dirName = $this->normalizePath(dirname($path)); - $parentExists = $this->is_dir($dirName); - $mTime = time(); - - $data = array( + $data = [ 'mimetype' => 'httpd/unix-directory', 'size' => 0, 'mtime' => $mTime, 'storage_mtime' => $mTime, 'permissions' => \OCP\Constants::PERMISSION_ALL, - ); - - if ($dirName === '' && !$parentExists) { + ]; + if ($path === '') { //create root on the fly $data['etag'] = $this->getETag(''); $this->getCache()->put('', $data); - $parentExists = true; - - // we are done when the root folder was meant to be created - if ($dirName === $path) { - return true; + return true; + } else { + // if parent does not exist, create it + $parent = $this->normalizePath(dirname($path)); + $parentType = $this->filetype($parent); + if ($parentType === false) { + if (!$this->mkdir($parent)) { + // something went wrong + return false; + } + } else if ($parentType === 'file') { + // parent is a file + return false; } - } - - if ($parentExists) { + // finally create the new dir + $mTime = time(); // update mtime + $data['mtime'] = $mTime; + $data['storage_mtime'] = $mTime; $data['etag'] = $this->getETag($path); $this->getCache()->put($path, $data); return true; } - return false; } /** diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 2d579fa2b60..d9fee48bedb 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -7,6 +7,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php index 171afd649c6..dcde7b8029b 100644 --- a/lib/private/files/storage/dav.php +++ b/lib/private/files/storage/dav.php @@ -1,6 +1,5 @@ <?php /** - * @author Alexander Bogdanov <syn@li.ru> * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Carlos Cerrillo <ccerrillo@gmail.com> @@ -9,7 +8,6 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Philippe Kueck <pk@plusline.de> * @author Philipp Kapfer <philipp.kapfer@gmx.at> * @author Robin Appelman <icewind@owncloud.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> diff --git a/lib/private/files/storage/flysystem.php b/lib/private/files/storage/flysystem.php index 6d8dee10622..3ad2b8adc4c 100644 --- a/lib/private/files/storage/flysystem.php +++ b/lib/private/files/storage/flysystem.php @@ -1,9 +1,22 @@ <?php /** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. + * @author Robin Appelman <icewind@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * */ namespace OC\Files\Storage; diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index 4b6b08a16fd..2b2a433c013 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -1,17 +1,14 @@ <?php /** - * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Brice Maron <brice@bmaron.net> * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Klaas Freitag <freitag@owncloud.com> - * @author Lukas Reschke <lukas@owncloud.com> + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Sjors van der Pluijm <sjors@desjors.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> diff --git a/lib/private/files/storage/localtempfiletrait.php b/lib/private/files/storage/localtempfiletrait.php index 86c8b5c8377..84331f49b19 100644 --- a/lib/private/files/storage/localtempfiletrait.php +++ b/lib/private/files/storage/localtempfiletrait.php @@ -1,7 +1,6 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/storage/polyfill/copydirectory.php b/lib/private/files/storage/polyfill/copydirectory.php index 73c6d3d5436..df4f5c27dcf 100644 --- a/lib/private/files/storage/polyfill/copydirectory.php +++ b/lib/private/files/storage/polyfill/copydirectory.php @@ -1,9 +1,23 @@ <?php /** - * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. + * @author Martin Mattel <martin.mattel@diemattels.at> + * @author Robin Appelman <icewind@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * */ namespace OC\Files\Storage\PolyFill; diff --git a/lib/private/files/storage/temporary.php b/lib/private/files/storage/temporary.php index ca348313e45..c8b99a55637 100644 --- a/lib/private/files/storage/temporary.php +++ b/lib/private/files/storage/temporary.php @@ -3,6 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index e9aabe2e5a2..d6b7f53408f 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -3,7 +3,6 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/storage/wrapper/permissionsmask.php b/lib/private/files/storage/wrapper/permissionsmask.php index 8d40d023630..e1822905692 100644 --- a/lib/private/files/storage/wrapper/permissionsmask.php +++ b/lib/private/files/storage/wrapper/permissionsmask.php @@ -1,7 +1,9 @@ <?php /** + * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php index b43dd4fe142..048738170db 100644 --- a/lib/private/files/storage/wrapper/wrapper.php +++ b/lib/private/files/storage/wrapper/wrapper.php @@ -2,6 +2,7 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php index 1cef37baf9f..e0d263d80b1 100644 --- a/lib/private/files/stream/encryption.php +++ b/lib/private/files/stream/encryption.php @@ -2,7 +2,6 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author jknockaert <jasper@knockaert.nl> - * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index dc8aff2f30c..fd27d88eae6 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -2,11 +2,12 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Jens-Christian Fischer <jens-christian.fischer@switch.ch> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Thomas Tanghus <thomas@tanghus.net> - * @author Robin McCorkell <rmccorkell@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/files/type/loader.php b/lib/private/files/type/loader.php index 78bfcf60bff..55dc09ab9b8 100644 --- a/lib/private/files/type/loader.php +++ b/lib/private/files/type/loader.php @@ -1,6 +1,6 @@ <?php /** - * @author Robin McCorkell <rmccorkell@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 558a1fba028..460c8007bf4 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -2,6 +2,7 @@ /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> + * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> @@ -30,6 +31,7 @@ use OC\Files\Cache\ChangePropagator; use OC\Files\Filesystem; use OC\ForbiddenException; use OC\Hooks\PublicEmitter; +use OC\Lock\DBLockingProvider; /** * Class Scanner @@ -155,9 +157,14 @@ class Scanner extends PublicEmitter { $scanner = $storage->getScanner(); $scanner->setUseTransactions(false); $this->attachListener($mount); - $this->db->beginTransaction(); + $isDbLocking = \OC::$server->getLockingProvider() instanceof DBLockingProvider; + if (!$isDbLocking) { + $this->db->beginTransaction(); + } $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); - $this->db->commit(); + if (!$isDbLocking) { + $this->db->commit(); + } } $this->propagator->propagateChanges(time()); } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index c8dbc001f2d..1353fac51ff 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -11,6 +11,7 @@ * @author Klaas Freitag <freitag@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Luke Policinski <lpolicinski@gmail.com> + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> diff --git a/lib/private/helper.php b/lib/private/helper.php index 973960ca7a5..ac91164dfb0 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -16,6 +16,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Nicolas Grekas <nicolas.grekas@gmail.com> * @author Olivier Paroz <github@oparoz.com> * @author Owen Winkler <a_github@midnightcircus.com> * @author Pellaeon Lin <nfsmwlin@gmail.com> diff --git a/lib/private/http/client/client.php b/lib/private/http/client/client.php index 1907937e55e..5f298e1acd7 100644 --- a/lib/private/http/client/client.php +++ b/lib/private/http/client/client.php @@ -1,6 +1,7 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/http/client/response.php b/lib/private/http/client/response.php index 558482491d1..b3429f36d04 100644 --- a/lib/private/http/client/response.php +++ b/lib/private/http/client/response.php @@ -1,6 +1,7 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/installer.php b/lib/private/installer.php index 392dc1c0817..861ce6ea41b 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -12,6 +12,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Kamil Domanski <kdomanski@kdemail.net> * @author Lukas Reschke <lukas@owncloud.com> + * @author michag86 <micha_g@arcor.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> diff --git a/lib/private/l10n.php b/lib/private/l10n.php index b3c87292f1d..5816e20b104 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -4,7 +4,6 @@ * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @author Christopher Schäpers <kondou@ts.unde.re> * @author Felix Moeller <mail@felixmoeller.de> * @author Jakob Sack <mail@jakobsack.de> * @author Jan-Christoph Borchardt <hey@jancborchardt.net> diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index a9ac4da42a2..b92c21b2d5d 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -1,10 +1,10 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index 8f017a713c1..1e93a6cec6c 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -1,5 +1,6 @@ <?php /** + * @author Individual IT Services <info@individual-it.net> * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. @@ -184,6 +185,13 @@ class DBLockingProvider extends AbstractLockingProvider { } public function __destruct() { - $this->cleanEmptyLocks(); + try { + $this->cleanEmptyLocks(); + } catch (\PDOException $e) { + // If the table is missing, the clean up was successful + if ($this->connection->tableExists('file_locks')) { + throw $e; + } + } } } diff --git a/lib/private/lock/memcachelockingprovider.php b/lib/private/lock/memcachelockingprovider.php index 871572f7e3e..e4158dcdfdf 100644 --- a/lib/private/lock/memcachelockingprovider.php +++ b/lib/private/lock/memcachelockingprovider.php @@ -1,8 +1,6 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/lock/nooplockingprovider.php b/lib/private/lock/nooplockingprovider.php index a8571f2aec4..9f88e6148f8 100644 --- a/lib/private/lock/nooplockingprovider.php +++ b/lib/private/lock/nooplockingprovider.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/log.php b/lib/private/log.php index 4a0a34b7113..ee5d61e98df 100644 --- a/lib/private/log.php +++ b/lib/private/log.php @@ -3,7 +3,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Olivier Paroz <owncloud@oparoz.com> + * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> diff --git a/lib/private/log/rotate.php b/lib/private/log/rotate.php index 4572a9904d2..27731c07db2 100644 --- a/lib/private/log/rotate.php +++ b/lib/private/log/rotate.php @@ -2,6 +2,7 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/memcache/memcached.php b/lib/private/memcache/memcached.php index e99303ecc15..ce7c6fa9577 100644 --- a/lib/private/memcache/memcached.php +++ b/lib/private/memcache/memcached.php @@ -4,6 +4,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php index 26b9cec6cf1..2071ede43e0 100644 --- a/lib/private/naturalsort.php +++ b/lib/private/naturalsort.php @@ -4,6 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/ocs.php b/lib/private/ocs.php index c5133bf9ee8..7b474fa439f 100644 --- a/lib/private/ocs.php +++ b/lib/private/ocs.php @@ -1,15 +1,10 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> - * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Frank Karlitschek <frank@owncloud.org> - * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/ocs/privatedata.php b/lib/private/ocs/privatedata.php index 249c17b3792..92f029aa12a 100644 --- a/lib/private/ocs/privatedata.php +++ b/lib/private/ocs/privatedata.php @@ -3,6 +3,7 @@ * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Frank Karlitschek <frank@owncloud.org> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php index 42b6166b823..916e25e45ae 100644 --- a/lib/private/ocs/result.php +++ b/lib/private/ocs/result.php @@ -6,6 +6,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index 78df3b79bb6..e2973f82605 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -4,10 +4,10 @@ * @author Brice Maron <brice@bmaron.net> * @author Felix Moeller <mail@felixmoeller.de> * @author Frank Karlitschek <frank@owncloud.org> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Kamil Domanski <kdomanski@kdemail.net> * @author Lukas Reschke <lukas@owncloud.com> - * @author Martin Mattel <martin.mattel@diemattels.at> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Sam Tuke <mail@samtuke.com> @@ -68,7 +68,13 @@ class OCSClient { * @return bool */ public function isAppStoreEnabled() { - return $this->config->getSystemValue('appstoreenabled', true) === true; + // For a regular edition default to true, all others default to false + $default = false; + if (\OC_Util::getEditionString() === '') { + $default = true; + } + + return $this->config->getSystemValue('appstoreenabled', $default) === true; } /** diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php index 065425c9a1d..ad0ef000510 100644 --- a/lib/private/preview/bitmap.php +++ b/lib/private/preview/bitmap.php @@ -3,6 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/preview/bmp.php b/lib/private/preview/bmp.php index 2a24a783d52..36439626f08 100644 --- a/lib/private/preview/bmp.php +++ b/lib/private/preview/bmp.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/preview/gif.php b/lib/private/preview/gif.php index 08f6c41d98c..a3b57484999 100644 --- a/lib/private/preview/gif.php +++ b/lib/private/preview/gif.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php index fd90b15eb0c..9287d9c888b 100644 --- a/lib/private/preview/image.php +++ b/lib/private/preview/image.php @@ -2,8 +2,8 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> + * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/private/preview/jpeg.php b/lib/private/preview/jpeg.php index 86e447d3406..96f89f4d57e 100644 --- a/lib/private/preview/jpeg.php +++ b/lib/private/preview/jpeg.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/preview/movie.php b/lib/private/preview/movie.php index a687fefff65..f71eaaf3eb2 100644 --- a/lib/private/preview/movie.php +++ b/lib/private/preview/movie.php @@ -2,7 +2,6 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/private/preview/mp3.php b/lib/private/preview/mp3.php index 25fe6566e44..ffe596db71b 100644 --- a/lib/private/preview/mp3.php +++ b/lib/private/preview/mp3.php @@ -2,7 +2,6 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php index ac6b4afa0cc..415220ed4af 100644 --- a/lib/private/preview/office.php +++ b/lib/private/preview/office.php @@ -1,8 +1,9 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/preview/png.php b/lib/private/preview/png.php index a6755671326..bab63c16ada 100644 --- a/lib/private/preview/png.php +++ b/lib/private/preview/png.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/preview/provider.php b/lib/private/preview/provider.php index d9b80939246..8f4a9f9fc3f 100644 --- a/lib/private/preview/provider.php +++ b/lib/private/preview/provider.php @@ -3,7 +3,6 @@ * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> * diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php index f8318e9a69a..26ce0fa9411 100644 --- a/lib/private/preview/svg.php +++ b/lib/private/preview/svg.php @@ -2,8 +2,8 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php index 2fdc86d9546..b6c21b7c1b1 100644 --- a/lib/private/preview/txt.php +++ b/lib/private/preview/txt.php @@ -2,6 +2,7 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * @author Nmz <nemesiz@nmz.lt> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/private/preview/xbitmap.php b/lib/private/preview/xbitmap.php index 8001f21684a..7887f2b73f5 100644 --- a/lib/private/preview/xbitmap.php +++ b/lib/private/preview/xbitmap.php @@ -1,6 +1,5 @@ <?php /** - * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/route/router.php b/lib/private/route/router.php index 7b7849a6da0..f4abfae0f43 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -7,6 +7,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * diff --git a/lib/private/security/crypto.php b/lib/private/security/crypto.php index 9bae1d6992c..0bd34df3f36 100644 --- a/lib/private/security/crypto.php +++ b/lib/private/security/crypto.php @@ -1,5 +1,6 @@ <?php /** + * @author Andreas Fischer <bantu@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * diff --git a/lib/private/server.php b/lib/private/server.php index 9055f092800..14fa323f74d 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -6,6 +6,7 @@ * @author Bernhard Reiter <ockham@raz.or.at> * @author Björn Schießle <schiessle@owncloud.com> * @author Christopher Schäpers <kondou@ts.unde.re> + * @author Individual IT Services <info@individual-it.net> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> diff --git a/lib/private/session/cryptosessiondata.php b/lib/private/session/cryptosessiondata.php index 6826ede5e33..dcae1648fe1 100644 --- a/lib/private/session/cryptosessiondata.php +++ b/lib/private/session/cryptosessiondata.php @@ -1,6 +1,7 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/session/cryptowrapper.php b/lib/private/session/cryptowrapper.php index 70c1dab7404..c79778587e0 100644 --- a/lib/private/session/cryptowrapper.php +++ b/lib/private/session/cryptowrapper.php @@ -1,6 +1,8 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> + * @author Phil Davis <phil.davis@inf.org> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php index e10999ec48f..01d4569fd81 100644 --- a/lib/private/session/internal.php +++ b/lib/private/session/internal.php @@ -1,7 +1,9 @@ <?php /** * @author cetra3 <peter@parashift.com.au> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Phil Davis <phil.davis@inf.org> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/private/session/memory.php b/lib/private/session/memory.php index 0fc9165c7cd..ff95efc5345 100644 --- a/lib/private/session/memory.php +++ b/lib/private/session/memory.php @@ -2,6 +2,7 @@ /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> + * @author Phil Davis <phil.davis@inf.org> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php index 5597592f21e..f2d2b15cd90 100644 --- a/lib/private/setup/mysql.php +++ b/lib/private/setup/mysql.php @@ -3,7 +3,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Michael Göhler <somebody.here@gmx.de> - * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index 319b6676ef8..0a559e7a589 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -1,9 +1,9 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> - * @author Christopher Schäpers <kondou@ts.unde.re> * @author eduardo <eduardo@vnexu.net> * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/share/share.php b/lib/private/share/share.php index ca94c51cf76..932586b5c27 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1,5 +1,6 @@ <?php /** + * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Reiter <ockham@raz.or.at> * @author Björn Schießle <schiessle@owncloud.com> @@ -718,7 +719,7 @@ class Share extends Constants { if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) { $message = 'Sharing %s failed, because this item is already shared with user %s'; $message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith)); - \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR); + \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR); throw new \Exception($message_t); } } @@ -1098,6 +1099,7 @@ class Share extends Constants { 'uidOwner' => \OC_User::getUser(), 'permissions' => $permissions, 'path' => $item['path'], + 'share' => $item )); } // Check if permissions were removed @@ -1108,16 +1110,18 @@ class Share extends Constants { Helper::delete($item['id'], true, null, null, true); } else { $ids = array(); + $items = []; $parents = array($item['id']); while (!empty($parents)) { $parents = "'".implode("','", $parents)."'"; - $query = \OC_DB::prepare('SELECT `id`, `permissions` FROM `*PREFIX*share`' + $query = \OC_DB::prepare('SELECT `id`, `permissions`, `item_type` FROM `*PREFIX*share`' .' WHERE `parent` IN ('.$parents.')'); $result = $query->execute(); // Reset parents array, only go through loop again if // items are found that need permissions removed $parents = array(); while ($item = $result->fetchRow()) { + $items[] = $item; // Check if permissions need to be removed if ($item['permissions'] & ~$permissions) { // Add to list of items that need permissions removed @@ -1139,8 +1143,13 @@ class Share extends Constants { .' WHERE `id` IN ('.$ids.')'); $query->execute(array($permissions)); } + + foreach ($items as $item) { + \OC_Hook::emit('OCP\Share', 'post_update_permissions', ['share' => $item]); + } } } + return true; } $message = 'Setting permissions for %s failed, because the item was not found'; diff --git a/lib/private/streamer.php b/lib/private/streamer.php index 6f0a70e2388..a08c8444f02 100644 --- a/lib/private/streamer.php +++ b/lib/private/streamer.php @@ -1,5 +1,6 @@ <?php /** + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. @@ -38,7 +39,7 @@ class Streamer { if ($request->isUserAgent($this->preferTarFor)) { $this->streamerInstance = new TarStreamer(); } else { - $this->streamerInstance = new ZipStreamer(); + $this->streamerInstance = new ZipStreamer(['zip64' => PHP_INT_SIZE !== 4]); } } @@ -89,9 +90,9 @@ class Streamer { /** * Add a file to the archive at the specified location and file name. * - * @param string $stream Stream to read data from - * @param string $internalName Filepath and name to be used in the archive. - * @param int $size Filesize + * @param string $stream Stream to read data from + * @param string $internalName Filepath and name to be used in the archive. + * @param int $size Filesize * @return bool $success */ public function addFileFromStream($stream, $internalName, $size){ @@ -101,17 +102,17 @@ class Streamer { return $this->streamerInstance->addFileFromStream($stream, $internalName, $size); } } - + /** * Add an empty directory entry to the archive. * - * @param string $directoryPath Directory Path and name to be added to the archive. + * @param string $dirName Directory Path and name to be added to the archive. * @return bool $success */ public function addEmptyDir($dirName){ return $this->streamerInstance->addEmptyDir($dirName); } - + /** * Close the archive. * A closed archive can no longer have new files added to it. After diff --git a/lib/private/template.php b/lib/private/template.php index 0300e43edea..0deb26d8f19 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -6,6 +6,7 @@ * @author Brice Maron <brice@bmaron.net> * @author drarko <drarko@users.noreply.github.com> * @author Frank Karlitschek <frank@owncloud.org> + * @author Individual IT Services <info@individual-it.net> * @author Jakob Sack <mail@jakobsack.de> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> @@ -69,7 +70,7 @@ class OC_Template extends \OC\Template\Base { public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { // Read the selected theme from the config file - self::initTemplateEngine(); + self::initTemplateEngine($renderAs); $theme = OC_Util::getTheme(); @@ -89,13 +90,13 @@ class OC_Template extends \OC\Template\Base { parent::__construct($template, $requesttoken, $l10n, $themeDefaults); } - public static function initTemplateEngine() { + public static function initTemplateEngine($renderAs) { if (self::$initTemplateEngineFirstRun){ //apps that started before the template initialization can load their own scripts/styles //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true //meaning the last script/style in this list will be loaded first - if (\OC::$server->getSystemConfig ()->getValue ( 'installed', false ) && ! \OCP\Util::needUpgrade ()) { + if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { OC_Util::addScript ( 'backgroundjobs', null, true ); } @@ -300,10 +301,20 @@ class OC_Template extends \OC\Template\Base { * @param string $hint An optional hint message - needs to be properly escaped */ public static function printErrorPage( $error_msg, $hint = '' ) { - $content = new \OC_Template( '', 'error', 'error', false ); - $errors = array(array('error' => $error_msg, 'hint' => $hint)); - $content->assign( 'errors', $errors ); - $content->printPage(); + try { + $content = new \OC_Template( '', 'error', 'error', false ); + $errors = array(array('error' => $error_msg, 'hint' => $hint)); + $content->assign( 'errors', $errors ); + $content->printPage(); + } catch (\Exception $e) { + $logger = \OC::$server->getLogger(); + $logger->error("$error_msg $hint", ['app' => 'core']); + $logger->logException($e, ['app' => 'core']); + + header(self::getHttpProtocol() . ' 500 Internal Server Error'); + header('Content-Type: text/plain; charset=utf-8'); + print("$error_msg $hint"); + } die(); } @@ -312,22 +323,57 @@ class OC_Template extends \OC\Template\Base { * @param Exception $exception */ public static function printExceptionErrorPage($exception) { - $request = \OC::$server->getRequest(); - $content = new \OC_Template('', 'exception', 'error', false); - $content->assign('errorClass', get_class($exception)); - $content->assign('errorMsg', $exception->getMessage()); - $content->assign('errorCode', $exception->getCode()); - $content->assign('file', $exception->getFile()); - $content->assign('line', $exception->getLine()); - $content->assign('trace', $exception->getTraceAsString()); - $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); - $content->assign('remoteAddr', $request->getRemoteAddress()); - $content->assign('requestID', $request->getId()); - $content->printPage(); + try { + $request = \OC::$server->getRequest(); + $content = new \OC_Template('', 'exception', 'error', false); + $content->assign('errorClass', get_class($exception)); + $content->assign('errorMsg', $exception->getMessage()); + $content->assign('errorCode', $exception->getCode()); + $content->assign('file', $exception->getFile()); + $content->assign('line', $exception->getLine()); + $content->assign('trace', $exception->getTraceAsString()); + $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); + $content->assign('remoteAddr', $request->getRemoteAddress()); + $content->assign('requestID', $request->getId()); + $content->printPage(); + } catch (\Exception $e) { + $logger = \OC::$server->getLogger(); + $logger->logException($exception, ['app' => 'core']); + $logger->logException($e, ['app' => 'core']); + + header(self::getHttpProtocol() . ' 500 Internal Server Error'); + header('Content-Type: text/plain; charset=utf-8'); + print("Internal Server Error\n\n"); + print("The server encountered an internal error and was unable to complete your request.\n"); + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); + print("More details can be found in the server log.\n"); + } die(); } /** + * This is only here to reduce the dependencies in case of an exception to + * still be able to print a plain error message. + * + * Returns the used HTTP protocol. + * + * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. + * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead + */ + protected static function getHttpProtocol() { + $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); + $validProtocols = [ + 'HTTP/1.0', + 'HTTP/1.1', + 'HTTP/2', + ]; + if(in_array($claimedProtocol, $validProtocols, true)) { + return $claimedProtocol; + } + return 'HTTP/1.1'; + } + + /** * @return bool */ public static function isAssetPipelineEnabled() { diff --git a/lib/private/tempmanager.php b/lib/private/tempmanager.php index cc7c51d8568..365d639389f 100644 --- a/lib/private/tempmanager.php +++ b/lib/private/tempmanager.php @@ -1,9 +1,11 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/user/backend.php b/lib/private/user/backend.php index 10bf3e28085..cda91398a84 100644 --- a/lib/private/user/backend.php +++ b/lib/private/user/backend.php @@ -9,9 +9,9 @@ * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> diff --git a/lib/private/user/interface.php b/lib/private/user/interface.php index 1ccda618e10..0b36340c4f9 100644 --- a/lib/private/user/interface.php +++ b/lib/private/user/interface.php @@ -2,8 +2,8 @@ /** * @author Arthur Schiwon <blizzz@owncloud.com> * @author Christopher Schäpers <kondou@ts.unde.re> - * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index 6a57aa3f7ae..109f08f47a0 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -5,6 +5,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author RealRancor <Fisch.666@gmx.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Volkan Gezer <volkangezer@gmail.com> diff --git a/lib/private/user/nouserexception.php b/lib/private/user/nouserexception.php index 0a077d960bd..09874887469 100644 --- a/lib/private/user/nouserexception.php +++ b/lib/private/user/nouserexception.php @@ -1,7 +1,6 @@ <?php /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Morris Jobke <hey@morrisjobke.de> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/util.php b/lib/private/util.php index 746a2e09523..9ea355f0168 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -16,17 +16,20 @@ * @author Frank Karlitschek <frank@owncloud.org> * @author Georg Ehrke <georg@owncloud.com> * @author helix84 <helix84@centrum.sk> + * @author Individual IT Services <info@individual-it.net> * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Markus Goetz <markus@woboq.com> + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Marvin Thomas Rabe <mrabe@marvinrabe.de> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Michael Göhler <somebody.here@gmx.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Stefan Rado <owncloud@sradonia.net> * @author Thomas Müller <thomas.mueller@tmit.eu> |