aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-30 13:21:20 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2010-01-30 13:21:20 -0500
commit4c273bcca53e335d449ee677e36bf90e1fd1d253 (patch)
tree767229d690b21ed4128b7d18ba06000bacec55c2 /index.php
parent01efa9d3ba17fde3fb3c150c8c9448594ca15b2d (diff)
downloadbayonetcms-4c273bcca53e335d449ee677e36bf90e1fd1d253.tar.gz
Configuration data is now loaded from the include/config.ini file
For now the $config and $db variables are initialized from within the theme class. This class supercedes the entire script as it is so far. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2.1@483 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'index.php')
-rw-r--r--index.php31
1 files changed, 17 insertions, 14 deletions
diff --git a/index.php b/index.php
index f9b7177..01fe58b 100644
--- a/index.php
+++ b/index.php
@@ -7,18 +7,10 @@ define('BAYONET_ROOT', basename(dirname('.')));
define('BAYONET_INCLUDE', BAYONET_ROOT . '/include');
define('BAYONET_CONFIG', BAYONET_ROOT . '/include/config.ini');
-require BAYONET_INCLUDE . '/config.php';
require BAYONET_INCLUDE . '/debug.php';
require BAYONET_INCLUDE . '/sql.class.php';
require BAYONET_INCLUDE . '/functions.php';
-$db = new Bayonet_SQL();
-$db->Connect(
- $config['sql']['hostname'],
- $config['sql']['username'],
- $config['sql']['password']
- );
-$db->Select_db($config['sql']['database']);
class Bayonet_Theme
{
@@ -38,7 +30,7 @@ class Bayonet_Theme
{
if(!isset($_GET['theme']))
{
- self::$name = Bayonet_Config::$ini['Theme']['name'];
+ self::$name = Bayonet_Config::$ini['site']['theme'];
}
else
{
@@ -62,7 +54,7 @@ class Bayonet_Theme
self::$header = self::$root_path . '/header.php';
self::$footer = self::$root_path . '/footer.php';
- decho(get_class_vars(Bayonet_Theme));
+ //decho(get_class_vars(Bayonet_Theme)); //do not re-enable this
self::load();
}
@@ -80,8 +72,19 @@ class Bayonet_Theme
static function load()
{
- global $db;
-
+ 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;
}
@@ -104,7 +107,7 @@ class Bayonet_Config
}
class Bayonet
-{
+{
static function init()
{
decho('Initializing Bayonet');
@@ -113,8 +116,8 @@ class Bayonet
}
}
-
Bayonet::init();
+
?> \ No newline at end of file