Merge pull request #19607 from owncloud/use-url

Use `/` if installed in main folder
This commit is contained in:
Thomas Müller 2015-10-08 13:01:41 +02:00
commit 8d2c8cf2a2
3 changed files with 16 additions and 6 deletions

View File

@ -79,7 +79,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
}); });
$this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){ $this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){
return new Output(); return new Output($this->getServer()->getWebRoot());
}); });
$this->registerService('OCP\\IAvatarManager', function($c) { $this->registerService('OCP\\IAvatarManager', function($c) {

View File

@ -27,6 +27,15 @@ use OCP\AppFramework\Http\IOutput;
* Very thin wrapper class to make output testable * Very thin wrapper class to make output testable
*/ */
class Output implements IOutput { class Output implements IOutput {
/** @var string */
private $webRoot;
/**
* @param $webRoot
*/
public function __construct($webRoot) {
$this->webRoot = $webRoot;
}
/** /**
* @param string $out * @param string $out
@ -72,10 +81,11 @@ class Output implements IOutput {
* @param string $path * @param string $path
* @param string $domain * @param string $domain
* @param bool $secure * @param bool $secure
* @param bool $httponly * @param bool $httpOnly
*/ */
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly) { public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) {
setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); $path = $this->webRoot ? : '/';
setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
} }
} }

View File

@ -68,9 +68,9 @@ interface IOutput {
* @param string $path * @param string $path
* @param string $domain * @param string $domain
* @param bool $secure * @param bool $secure
* @param bool $httponly * @param bool $httpOnly
* @since 8.1.0 * @since 8.1.0
*/ */
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly); public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
} }