summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-10-27 08:03:52 (GMT)
committerAleksander Machniak <alec@alec.pl>2014-10-27 08:03:52 (GMT)
commit1435a4fdd1d5b0ac3bdeeb1a8d0e847b3c2496c3 (patch)
tree1f1238709a8631a34f6122535a6f6d62eb9713a3
parenta0d46f593917b8dc78fd4fb165b8b1c9b4df352c (diff)
downloadkolab-chwala-1435a4fdd1d5b0ac3bdeeb1a8d0e847b3c2496c3.tar.gz
Support non-default port number in default API url generator (#3594)
Added file_api_url and file_api_skin options description into the sample config file
-rw-r--r--config/config.inc.php.dist9
-rw-r--r--lib/file_ui.php10
2 files changed, 15 insertions, 4 deletions
diff --git a/config/config.inc.php.dist b/config/config.inc.php.dist
index a26f4c4..649f1dd 100644
--- a/config/config.inc.php.dist
+++ b/config/config.inc.php.dist
@@ -30,6 +30,15 @@ $config['fileapi_sources'] = array(
);
*/
+// Name of the user interface skin.
+$config['file_api_skin'] = 'default';
+
+// Chwala UI communicates with Chwala API via HTTP protocol
+// The URL here is a location of Chwala API service. By default
+// the UI location is used with addition of /api/ suffix.
+$config['file_api_url'] = '';
+
+
// ------------------------------------------------
// SeaFile driver settings
// ------------------------------------------------
diff --git a/lib/file_ui.php b/lib/file_ui.php
index 6415937..13d6f92 100644
--- a/lib/file_ui.php
+++ b/lib/file_ui.php
@@ -109,10 +109,12 @@ class file_ui extends file_locale
$url = $this->config->get('file_api_url', '');
if (!$url) {
- $url = rcube_utils::https_check() ? 'https://' : 'http://';
- $url .= $_SERVER['SERVER_NAME'];
- $url .= preg_replace('/\/?\?.*$/', '', $_SERVER['REQUEST_URI']);
- $url .= '/api/';
+ $schema = rcube_utils::https_check() ? 'https' : 'http';
+ $port = $schema == 'http' ? 80 : 443;
+ $url = $schema . '://' . $_SERVER['SERVER_NAME'];
+ $url .= $_SERVER['SERVER_PORT'] != $port ? ':' . $_SERVER['SERVER_PORT'] : '';
+ $url .= preg_replace('/\/?\?.*$/', '', $_SERVER['REQUEST_URI']);
+ $url .= '/api/';
}
$this->api = new file_ui_api($url);