Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
.
// These includes are common basically anything we do: it's Phalanx's heart and
// soul.
require_once PHALANX_ROOT . '/base/functions.php';
require_once PHALANX_ROOT . '/events/event.php';
require_once PHALANX_ROOT . '/events/event_pump.php';
require_once PHALANX_ROOT . '/events/http_dispatcher.php';
require_once PHALANX_ROOT . '/events/view_output_handler.php';
require_once PHALANX_ROOT . '/data/cleaner.php';
require_once PHALANX_ROOT . '/data/model.php';
require_once PHALANX_ROOT . '/views/view.php';
class Bugdar
{
// The active database connection.
static public $db = NULL;
// The authentication system.
static public $auth = NULL;
// Bootstraps the database.
static public function BootstrapDatabase($config)
{
define('TABLE_PREFIX', $config->{'database.prefix'});
try
{
self::$db = new PDO($config->{'database.dsn'}, $config->{'database.username'}, $config->{'database.password'});
self::$db->SetAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
phalanx\data\Model::set_db(self::$db);
}
catch (PDOException $e)
{
throw new CoreException('Database error: ' . $e->GetMessage());
}
}
// Loads the proper authentication module.
static public function BootstrapAuthentication($config)
{
// Load the authentication system.
$auth_module = BUGDAR_ROOT . '/includes/auth/auth_' . $config->{'auth.module'} . '.php';
if (!file_exists($auth_module) || !is_readable($auth_module))
throw new CoreException('Could not load authentication module ' . $config->{'auth.module'});
require $auth_module;
$name = phalanx\base\UnderscoreToCamelCase($config->{'auth.module'});
$class_name = 'Authentication' . $name;
if (!class_exists($class_name))
throw new CoreException('Could not find class ' . $class_name);
self::$auth = new $class_name($config->auth);
}
}
class CoreException extends \Exception
{}