summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-08 13:01:41 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-08 13:01:41 +0200
commit8d2c8cf2a262d6299932125872fb0d536881a058 (patch)
tree392d3c02a8ecb5061c1bfcd9b71d03c9c0ecb8ce
parent95c8d7598b64208dbb0110d6e581b8a311359bf8 (diff)
parent6a4f22c61f58b80f826408780d6882f0d1041e70 (diff)
downloadnextcloud-server-8d2c8cf2a262d6299932125872fb0d536881a058.tar.gz
nextcloud-server-8d2c8cf2a262d6299932125872fb0d536881a058.zip
Merge pull request #19607 from owncloud/use-url
Use `/` if installed in main folder
-rw-r--r--lib/private/appframework/dependencyinjection/dicontainer.php2
-rw-r--r--lib/private/appframework/http/output.php16
-rw-r--r--lib/public/appframework/http/ioutput.php4
3 files changed, 16 insertions, 6 deletions
diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index 4779d6bf0ad..651b268a35e 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -79,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/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/public/appframework/http/ioutput.php b/lib/public/appframework/http/ioutput.php
index ba4c031001b..185bc589f22 100644
--- a/lib/public/appframework/http/ioutput.php
+++ b/lib/public/appframework/http/ioutput.php
@@ -68,9 +68,9 @@ interface IOutput {
* @param string $path
* @param string $domain
* @param bool $secure
- * @param bool $httponly
+ * @param bool $httpOnly
* @since 8.1.0
*/
- public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly);
+ public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
}