<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
*/

// ------------------------------------------------------------------------

class MY_Config extends CI_Config {

    // --------------------------------------------------------------------

    /**
    * Site URL
    *
    * @access public
    * @param string the URI string
    * @return string
    */
    function site_url($uri = '', $ssl = FALSE)
    {
        // This is added as a fall back if no ssl is set then it reverts
        // to the standard base_url.
        if ($this->item('secure_base_url') && $ssl)
        {
            $base = 'secure_base_url';
        }
        else
        {
            $base = 'base_url';
        }
        
        if ($uri == '')
        {
            if ($this->item('base_url') == '')
            {
                return $this->item('index_page');
            }
            else
            {
                return $this->slash_item($base).$this->item('index_page');
            }
        }
        
        if ($this->item('enable_query_strings') == FALSE)
        {
            if (is_array($uri))
            {
                $uri = implode('/', $uri);
            }
        
            $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
            return $this->slash_item($base).$this->slash_item('index_page').trim($uri, '/').$suffix;
        }
        else
        {
            if (is_array($uri))
            {
                $i = 0;
                $str = '';
                foreach ($uri as $key => $val)
                {
                    $prefix = ($i == 0) ? '' : '&';
                    $str .= $prefix.$key.'='.$val;
                    $i++;
                }
                
                $uri = $str;
            }
            
            if ($this->item('base_url') == '')
            {
                return $this->item('index_page').'?'.$uri;
            }
            else
            {
                return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
            }
        }
    }
}
/* End of file MY_Config.php */
/* Location: /application/core/MY_Config.php */ 