1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
4 * Helper to get the proper complete URL to the server
9 * This relies on the setting op5reports.site_address or a webserver
10 * CLI will fail to resolve an URI without having the mentioned config key
12 * @return string similar to https://192.168.1.211/ninja/index.php/
14 public static function get() {
17 if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])) {
21 $host = Kohana
::config('op5reports.site_address', false, false);
22 if(!$host && isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
23 $host = $_SERVER['HTTP_HOST'];
25 // trim port from $host since we append it just below
26 $host_parts = explode(":", $host);
27 $host = $host_parts[0];
29 if(isset($_SERVER['SERVER_PORT']) && $check_port != $_SERVER['SERVER_PORT']) {
30 $port = ':'.$_SERVER['SERVER_PORT'];
32 $site_domain = Kohana
::config('config.site_domain', true);
33 $uri = $protocol.'://'.$host.$port.$site_domain.'index.php/';