From fa8180ea3a41584943dd7464eb8c3cad769d8211 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Sun, 17 Apr 2011 16:49:09 +0000 Subject: Jessus christ git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2.1@491 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- index.php | 108 ++------------------------------------------------------------ 1 file changed, 2 insertions(+), 106 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 01fe58b..d6280da 100644 --- a/index.php +++ b/index.php @@ -10,114 +10,10 @@ define('BAYONET_CONFIG', BAYONET_ROOT . '/include/config.ini'); require BAYONET_INCLUDE . '/debug.php'; require BAYONET_INCLUDE . '/sql.class.php'; require BAYONET_INCLUDE . '/functions.php'; +require_once BAYONET_INCLUDE . '/classes.php'; - -class Bayonet_Theme -{ - static public $index; - static public $header; - static public $footer; - - static public $name; - static public $root_path; - static public $include_path; - static public $image_path; - static public $config_path; - static public $config; - static public $primary_css; - - static function init() - { - if(!isset($_GET['theme'])) - { - self::$name = Bayonet_Config::$ini['site']['theme']; - } - else - { - self::$name = $_GET['theme']; - } - - decho('Initializing theme variables for \'' . self::$name . '\''); - self::$root_path = dirname(BAYONET_ROOT) . '/themes/' . self::$name; - self::$include_path = self::$root_path . '/include'; - self::$image_path = self::$root_path . '/images'; - self::$primary_css = self::$include_path . '/primary.css'; - self::$config_path = self::$include_path . '/theme.ini'; - - if(!self::is_valid()) - { - die('Theme failed during initialization.'); - } - self::$config = parse_ini_file(self::$config_path, true); - - self::$index = self::$root_path . '/index.php'; - self::$header = self::$root_path . '/header.php'; - self::$footer = self::$root_path . '/footer.php'; - - //decho(get_class_vars(Bayonet_Theme)); //do not re-enable this - self::load(); - } - - static private function is_valid() - { - if( - file_exists(self::$root_path) && - file_exists(self::$include_path) && - file_exists(self::$config_path) - ) - return true; - else - return false; - } - - static function load() - { - global $db, $config; - - // Globally referenced configuration and database variables - $config = Bayonet_Config::$ini; - $db = new Bayonet_SQL(); - - $db->Connect( - $config['sql']['hostname'], - $config['sql']['username'], - $config['sql']['password'] - ); - $db->Select_db($config['sql']['database']); - - decho("Loading theme: '" . self::$name . "'"); - require self::$index; - } -} - -class Bayonet_Config -{ - static $ini; - static function init() - { - decho('Parsing configuration data'); - if(file_exists(BAYONET_CONFIG)) - { - self::$ini = parse_ini_file(BAYONET_CONFIG, true); - decho(self::$ini); - } - else - die(BAYONET_CONFIG . ' not found'); - } -} - -class Bayonet -{ - static function init() - { - decho('Initializing Bayonet'); - Bayonet_Config::init(); - Bayonet_Theme::init(); - } -} - +/* Initialize Bayonet CMS */ Bayonet::init(); - ?> \ No newline at end of file -- cgit