<?php
/*
 * created on 16.10.2007
 * project: zf-konference
 * author: Vlastimil Vávrů (http://vavru.cz)
 * version: $
 */
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('Europe/Prague');

set_include_path('.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . '../application/domain/' . PATH_SEPARATOR . '../application/models/' . PATH_SEPARATOR . get_include_path());

// register autoload functionality
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

// load configuration from INI file
$config = new Zend_Config_Ini('../application/config.ini', 'default');
Zend_Registry::set('config', $config);

// article service
require_once '../application/service/ArticleService.php';
Zend_Registry::set('articleService', new ArticleService());

// front controller instance
$frontController = Zend_Controller_Front::getInstance();

require_once '../application/plugins/DbConnectPlugin.php';
$frontController->registerPlugin(new DbConnectPlugin($config->db->toArray()));

$frontController->setControllerDirectory('../application/controllers');
$frontController->throwExceptions(true); 
//$frontController->setParam('useDefaultControllerAlways', true);

$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config, 'routes');
$frontController->setRouter($router);

// run!
$response = new Zend_Controller_Response_Http();
$response->setRawHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$response->setRawHeader("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
$response->setRawHeader('Cache-Control: no-store, no-cache, must-revalidate');
$response->setRawHeader('Pragma: no-cache');

$frontController->dispatch(null, $response);