<?php
/**
 * Meal-O
 *
 * @category   Application
 * @copyright  Copyright (c) 2012, kuzo media (http://www.kuzo-media.de)
 * @version    $Id: index.php 269 2013-08-01 17:14:35Z tsc $
 * @author     $Author: tsc $
 */

//setlocale(LC_ALL, "deu");

define ('MEALO_REVISION', '$Revision: 269 $');

set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/Library/');
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/Apps/');
include_once('Mealo/Application.php');
if( !file_exists('config.php') ) {
    die("Please add config.php");
}
include_once('config.php');

register_shutdown_function(function () {
    if (class_exists('Mealo_Components_Log')) {
        Mealo_Components_Log::handleShutdown();
    }
});

try {
    $app = new Mealo_Application('production', Mealo_Get_Config());
    return $app->run();
} catch(Zend_Session_Exception $e) {
    $html = '<html><head><meta http-equiv="refresh" content="0"></head></html>';
    echo $html;
} catch(Throwable $e) {
    if (!class_exists('Mealo_Components_Log')) {
        throw $e;
    }
    Mealo_Components_Log::respond($e, Mealo_Components_Log::error($e));
}