Use rcube_utils::resolve_url() (Note: this requires current Roundcube git-master)

This commit is contained in:
Aleksander Machniak 2014-08-24 11:43:42 +02:00
parent 9a39d37c69
commit c15bec9ae6

View file

@ -34,7 +34,7 @@ class kolab_files_engine
*/
public function __construct($plugin, $url)
{
$this->url = $this->resolve_url($url);
$this->url = rcube_utils::resolve_url($url);
$this->plugin = $plugin;
$this->rc = $plugin->rc;
}
@ -1017,30 +1017,4 @@ class kolab_files_engine
return $mimetypes;
}
/**
* Resolve relative URL
*/
protected function resolve_url($url)
{
// prepend protocol://hostname:port
if (!preg_match('|^https?://|', $url)) {
$schema = 'http';
$default_port = 80;
if (rcube_utils::https_check()) {
$schema = 'https';
$default_port = 443;
}
$prefix = $schema . '://' . preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST']);
if ($_SERVER['SERVER_PORT'] != $default_port) {
$prefix .= ':' . $_SERVER['SERVER_PORT'];
}
$url = $prefix . ($url[0] == '/' ? '' : '/') . $url;
}
return $url;
}
}