Changeset 2313 for trunk/system/helpers/url.php
- Timestamp:
- 03/17/2008 07:48:11 PM (10 months ago)
- Files:
-
- 1 modified
-
trunk/system/helpers/url.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/url.php
r2178 r2313 15 15 * Base URL, with or without the index page. 16 16 * 17 * If protocol (and core.site_protocol) and core.site_domain are both empty, 18 * then 17 * If protocol (and core.site_protocol) and core.site_domain are both empty, 18 * then 19 19 * 20 20 * @param boolean include the index page … … 25 25 { 26 26 $protocol = ($protocol == FALSE) ? Config::item('core.site_protocol') : strtolower($protocol); 27 27 28 28 $site_domain = Config::item('core.site_domain', TRUE); 29 29 30 30 if (empty($protocol)) 31 31 { 32 if (strlen($site_domain) > 0 AND $site_domain[0] != '/') 32 if (strlen($site_domain) > 0 AND $site_domain[0] != '/') 33 33 { 34 34 // try to guess protocol, provide full http://domain/path... 35 $base_url = ( !empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$site_domain;35 $base_url = (empty($_SERVER['HTTPS']) OR $_SERVER['HTTPS'] === 'off') ? 'http' : 'https').'://'.$site_domain; 36 36 } 37 37 else 38 38 { 39 39 // provide only path, eg /path... 40 $base_url = !empty($site_domain) ? $site_domain : '';40 $base_url = empty($site_domain) ? '' : $site_domain; 41 41 } 42 42 } 43 43 else 44 44 { 45 // return a full url46 47 45 // Add current servername if site_domain starts with a / 48 46 if (empty($site_domain) OR $site_domain[0] == '/') 49 47 { 50 $base_url = $protocol.'://'.$_SERVER['HTTP_HOST'].( !empty($site_domain) ? $site_domain : '');48 $base_url = $protocol.'://'.$_SERVER['HTTP_HOST'].(empty($site_domain) ? '' : $site_domain); 51 49 } 52 else 50 else 53 51 { 54 $base_url = $protocol.'://'.( !empty($site_domain) ? $site_domain : '');52 $base_url = $protocol.'://'.(empty($site_domain) ? '' : $site_domain); 55 53 } 56 54 } 57 55 58 56 // make sure base_url ends in a slash 59 (!empty($base_url) AND ($base_url[strlen($base_url)-1] != '/')) AND $base_url .='/';60 57 $base_url = rtrim($base_url, '/').'/'; 58 61 59 // add index.php if needed 62 if ($index == TRUE AND $index = Config::item('core.index_page'))60 if ($index === TRUE AND $index = Config::item('core.index_page')) 63 61 { 64 62 $base_url = $base_url.$index.'/';
