From 0f4a3b1b086b4bfc9217def70f8049f9eeb75672 Mon Sep 17 00:00:00 2001 From: thirdid Date: Wed, 27 Jan 2010 03:43:13 +0000 Subject: Directory structure changes (may continue for several revisions) git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2.1@466 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- index.php | 162 ++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 90 insertions(+), 72 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 0cc230a..9d09f48 100644 --- a/index.php +++ b/index.php @@ -1,72 +1,90 @@ -Connect( - $config['sql']['hostname'], - $config['sql']['username'], - $config['sql']['password'] - ); -$db->Select_db($config['sql']['database']); - -include 'header.php'; -//session_start(); -?> - -
- - - - - - - - - - - - - - - - - -
- - - -
- -
- -td.short{width:100%;}" . "" . "" . "" . "
Code" . $e->getCode() . "
In File" . $e->getFile() . "
" . $e->getLine() . " - " . $e->getMessage() . "
" - ); -} -?> +Connect( + $config['sql']['hostname'], + $config['sql']['username'], + $config['sql']['password'] + ); +$db->Select_db($config['sql']['database']); + +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; + static public $primary_css; + + static function init() + { + self::$name = Bayonet_Config::$ini['Theme']['name']; + 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 . '/' . self::$name . '.css'; + self::$config = parse_ini_file(self::$include_path . '/' . self::$name . '.ini', 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)); + self::load(); + } + + static function load() + { + global $db; + 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(); + } +} + + +Bayonet::init(); + + +?> \ No newline at end of file -- cgit