<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */

class Maxsite_lib 
{
	var $version = '0.37';
	var $config = array();
	var $data = array();
	var $hooks = array();
	var $active_plugins = array();
	var $sidebars = array();
	var $widgets = array();
	var $title = '';
	var $description = '';
	var $keywords = '';
	var $language = false;
	var $current_lang_dir = false;
	
	
	function Maxsite_lib() 
	{
		$CI =& get_instance();
		
		$this->config['site_url'] = $CI->config->config['base_url'];
		$this->config['application_url'] = $this->config['site_url'] . APPPATH;
		$this->config['base_url'] = $this->config['site_url'] . APPPATH . 'maxsite/';
		$this->config['common_url'] = $this->config['base_url'] . 'common/';
		$this->config['templates_url'] = $this->config['base_url'] . 'templates/';
		$this->config['plugins_url'] = $this->config['base_url'] . 'plugins/';
		$this->config['admin_plugins_url'] = $this->config['base_url'] . 'admin/plugins/';
		$this->config['uploads_url'] = $this->config['site_url'] . 'uploads/';
		$this->config['admin_url'] = $this->config['base_url'] . 'admin/';
		$this->config['site_admin_url'] = $this->config['site_url'] . 'admin/';
		
		# MaxSite CMS < 0.352 и CodeIgniter < 1.7.2
		# $this->config['base_dir'] = realpath(dirname(FCPATH)) . '/' . APPPATH . 'maxsite/';
		# $this->config['application_dir'] = realpath(dirname(FCPATH)) . '/' . APPPATH;
		# $this->config['uploads_dir'] = realpath(dirname(FCPATH)) . '/uploads/';
		# $this->config['cache_dir'] = $CI->config->config['cache_path'];
		# if (!$this->config['cache_dir']) $this->config['cache_dir'] = realpath(dirname(FCPATH)) . '/system/cache/';		
			
			
		# MaxSite CMS >= 0.353 и CodeIgniter >= 1.7.3
		$this->config['base_dir'] = FCPATH . APPPATH . 'maxsite/';
		$this->config['application_dir'] = FCPATH . APPPATH;
		$this->config['uploads_dir'] = FCPATH . 'uploads/';
		
		$this->config['cache_dir'] = $CI->config->config['cache_path'];
		if (!$this->config['cache_dir'])
			$this->config['cache_dir'] = FCPATH . 'system/cache/';		
		
		$this->config['common_dir'] = $this->config['base_dir'] . 'common/';
		$this->config['templates_dir'] = $this->config['base_dir'] . 'templates/';
		$this->config['plugins_dir'] = $this->config['base_dir'] . 'plugins/';
		$this->config['admin_plugins_dir'] = $this->config['base_dir'] . 'admin/plugins/';
		$this->config['admin_dir'] = $this->config['base_dir'] . 'admin/';
		$this->config['config_file'] = $this->config['base_dir'] . 'mso_config.php';
		
		$this->config['cache_time'] = 86400; // в секундах = 24 часа
		$this->config['template'] = 'default';
		
		$this->config['secret_key'] = $this->config['site_url'];
		$this->config['remote_key'] = '0'; // ключ удаленного постинга
		

		
		# контроль. не использовать в проектах!
		# константы определяет CodeIgniter
		# меняются от версии
		$this->config['FCPATH'] = FCPATH;	
		$this->config['EXT'] = EXT;	
		$this->config['SELF'] = SELF;	
		$this->config['BASEPATH'] = BASEPATH;	
		$this->config['APPPATH'] = APPPATH;	
			
		#print_r($this->config);
	}
}

global $MSO;

if ( !isset($MSO) ) $MSO = new Maxsite_lib();
#print_r($MSO);


require_once( $MSO->config['common_dir'] . 'common.php' );

?>