Skip to content

Commit

Permalink
protocol in url setting
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Feb 28, 2017
1 parent 56e3669 commit a28a48d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## owncloud-onlyoffice (1.0.1)
- fix exception when versions app is disabled
- adding protocol to document server url


## owncloud-onlyoffice (1.0.0)
Expand Down
4 changes: 2 additions & 2 deletions controller/settingscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct($AppName,
* @return TemplateResponse
*/
public function index() {
$data = [ "documentserver" => $this->config->GetDocumentServerUrl()];
$data = ["documentserver" => $this->config->GetDocumentServerUrl()];
return new TemplateResponse($this->appName, "settings", $data, "blank");
}

Expand All @@ -77,7 +77,7 @@ public function index() {
*/
public function settings($documentserver) {
$this->config->SetDocumentServerUrl($documentserver);
return [ "documentserver" => $this->config->GetDocumentServerUrl()];
return ["documentserver" => $this->config->GetDocumentServerUrl()];
}

/**
Expand Down
5 changes: 4 additions & 1 deletion lib/appconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public function __construct($AppName) {
* @param string $documentServer - document service address
*/
public function SetDocumentServerUrl($documentServer) {
$documentServer = rtrim(trim($documentServer), "/");
$documentServer = strtolower(rtrim(trim($documentServer), "/"));
if (strlen($documentServer) > 0 && !preg_match("/^https?:\/\//i", $documentServer)) {
$documentServer = "http://" . $documentServer;
}
$this->config->setAppValue($this->appName, $this->_documentserver, $documentServer);
$this->DropSKey();
}
Expand Down

0 comments on commit a28a48d

Please sign in to comment.