Changeset 2178
- Timestamp:
- 02/27/2008 02:12:48 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
application/config/config.php (modified) (1 diff)
-
system/helpers/url.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/config/config.php
r2177 r2178 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 2 /** 3 * Domain name, with the installation directory. Default: localhost/kohana/4 * If this starts with a /, Kohana will try to get the domain from HTTP_HOST5 * from the web server.3 * Base path of the web site. If this includes a domain, (eg, "localhost/kohana/") then 4 * a full URL will be used (eg, "http://localhost/kohana/"). If it only includes the path, 5 * and a site_protocol is specified, the domain will be auto-detected. 6 6 */ 7 $config['site_domain'] = ' localhost/kohana/';7 $config['site_domain'] = '/kohana/'; 8 8 9 9 /** 10 * Default protocol used to access the website. Default: http 10 * Force a default protocol to be used by the site. If no site_protocol is specified, then the 11 * current protocol is used, or when possible, only an absolute path (with no protocol/domain) 12 * is used. 11 13 */ 12 $config['site_protocol'] = ' http';14 $config['site_protocol'] = ''; 13 15 14 16 /** -
trunk/system/helpers/url.php
r2177 r2178 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 19 * 17 20 * @param boolean include the index page 18 21 * @param boolean non-default protocol … … 22 25 { 23 26 $protocol = ($protocol == FALSE) ? Config::item('core.site_protocol') : strtolower($protocol); 24 // try to auto-detect protocol 25 empty($protocol) AND $protocol = (isset($_SERVER['HTTPS']) AND ($_SERVER['HTTPS'] != '')) ? 'https' : 'http'; 26 27 27 28 $site_domain = Config::item('core.site_domain', TRUE); 28 // Add current servername if site_domain starts with a /29 (strlen($site_domain) > 0 AND $site_domain[0] == '/') AND $site_domain = $_SERVER['HTTP_HOST'].$site_domain;30 29 31 // if site_domain is empty, no base url. This results in 32 // a relative path (eg, "index.php/") being returned 33 $base_url = (!empty($site_domain)) ? $protocol.'://'.$site_domain : ''; 30 if (empty($protocol)) 31 { 32 if (strlen($site_domain) > 0 AND $site_domain[0] != '/') 33 { 34 // try to guess protocol, provide full http://domain/path... 35 $base_url = (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$site_domain; 36 } 37 else 38 { 39 // provide only path, eg /path... 40 $base_url = !empty($site_domain) ? $site_domain : ''; 41 } 42 } 43 else 44 { 45 // return a full url 46 47 // Add current servername if site_domain starts with a / 48 if (empty($site_domain) OR $site_domain[0] == '/') 49 { 50 $base_url = $protocol.'://'.$_SERVER['HTTP_HOST'].(!empty($site_domain) ? $site_domain : ''); 51 } 52 else 53 { 54 $base_url = $protocol.'://'.(!empty($site_domain) ? $site_domain : ''); 55 } 56 } 34 57 58 // make sure base_url ends in a slash 59 (!empty($base_url) AND ($base_url[strlen($base_url)-1] != '/')) AND $base_url .= '/'; 60 61 // add index.php if needed 35 62 if ($index == TRUE AND $index = Config::item('core.index_page')) 36 63 {
