<?php
/* File: $Id: index.php 180 2006-02-25 16:38:54Z l_a_toth $ */
/**
* Main Page
*
* @package YaCM Portal System
* @copyright (C) 2005 László Attila Tóth
* @license GPL {@link http://www.gnu.org/licenses/gpl.html}
*
* @author László Attila Tóth
*/
if (!is_readable('var/config.php')) {
$script_name = ereg_replace('/[^/]+$','/',$_SERVER['SCRIPT_NAME']);
if ( $script_name != $_SERVER['REQUEST_URI'] ) {
header('Location: '. $script_name );
exit;
} else {
header('Location: install/');
exit;
}
}
require_once 'var/config.php';
require_once 'functions.php';
ini_set('display_errors', Config::display_errors);
ini_set('magic_quotes_runtime', 'off');
if (is_readable(Config::root_directory . '/classcache.php')){
require_once(Config::root_directory . '/classcache.php');
}
ob_start();
try {
// should be used the own PEAR, etc classes
$incpath = explode(':',ini_get('include_path'));
$k = array_search('.', $incpath);
if ($k !== false) unset($incpath[$k]);
array_unshift($incpath, Config::root_directory . '/ext-lib');
array_unshift($incpath,'.');
ini_set('include_path', implode(':',$incpath));
if ( Request::getInstance()->get_method() == 'POST' ) {
Site_Main::create_site();
} else {//if ( Request::getInstance()->get_method() == 'GET' )
cache_novalidate();
Site_Main::create_site();
// } else { // this branch should be useless
// throw new Exception('Invalid HTTP Reqest');
}
} catch( Exception $e) {
Site_Error::errorpage($e->getMessage());
}
?>