<?php
/**
* Project: Dahlberg Blogg
* Project-Description: A simple blogsystem
* File: Index.php
* File-Version: (2009-09-16::23.15)
*
* @link http://www.johandahlberg.se
* @copyright 2009 Johan Dahlberg
* @license GNU GPLv3 (see LICENSE.txt)
* @author Johan Dahlberg <hide@address.com>
* @package Dahlberg Blogg
* @version 0.2 Alpha
*/
// Set include path and start the autoloader
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../dblogg'));
set_include_path(implode(PATH_SEPARATOR, array(
APPLICATION_PATH . '/libraries',
get_include_path(),
)));
require_once('Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Dblogg_');
// Loading the config file
$config = new Zend_Config_Ini(APPLICATION_PATH . '/settings.ini', 'development');
Zend_Registry::set('config', $config);
// Create the logging object
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
Zend_Registry::set('logger', $logger);
// Creating DB connection array
$params = array('host' => $config->database->hostname,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->database);
$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::set('db', $db);
// Setup application authentication
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session());
// Loading Zend Controller
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($config->paths->application . '/controllers');
$controller->registerPlugin(new CustomControllerAclManager($auth));
// Setup Smarty
$vr = new Zend_Controller_Action_Helper_ViewRenderer();
$vr->setView(new Dblogg_Templater());
$vr->setViewSuffix('tpl');
Zend_Controller_Action_HelperBroker::addHelper($vr);
$controller->dispatch();
?>