<?php
/**
* (c) Copyright 2008 Dennis Kreminsky, etranger at etranger dot ru
*
* @package flamework
* @author Dennis Kreminsky, etranger at etranger dot ru
* @copyright Copyright (c) 2006-2009 Dennis Kreminsky, etranger at etranger dot ru
*/
/**
* Provides automatic loading for class files. A nice feature of PHP5.
*
* @package flamework
* @author Dennis Kreminsky, etranger at etranger dot ru
* @copyright Copyright (c) 2006-2009 Dennis Kreminsky, etranger at etranger dot ru
*/
error_reporting(E_ALL);
define('EXCEPTION_DB_MISCONFIG', 0x0001);
define('EXCEPTION_DB_ERROR', 0x0002);
define('EXCEPTION_DB_FAILURE', 0x0003);
define('EXCEPTION_ACCESS_DENIED', 0x0004);
define('EXCEPTION_MODULE_FAILURE', 0x0005);
define('EXCEPTION_MODULE_ERROR', 0x0006);
if (isset($_SERVER['HTTP_HOST']))
if(!@include_once dirname(__FILE__).'/../site-specific/'.strtolower($_SERVER['HTTP_HOST']).'.php')
if(!@include_once dirname(__FILE__).'/../site-specific/'.strtolower($_SERVER['SERVER_NAME']).'.php') {
header("Content-type: text/html; charset=utf8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Системная ошибка.</title>
<style type="text/css">
<!--
html, body {width: 100%; margin:0; padding 0}
body {font-family: Arial, Helvetica, sans-serif; font-size:90%;}
#wrapper {width: 50%; margin: 5em auto 0 auto; background: #f0f0f0; padding: 0.5em}
#title {font-size: 100%; font-weight:bold; padding: 0.5em 0.2em 0.5em 0.2em; background: #ff0000; color:#ffffff}
#message {padding: 0.5em 0.2em 0.5em 0.2em}
#location {font-size: 80%;padding: 0.2em; color: #a0a0a0}
#report {width: 50%; font-size: 100%;margin: 1em auto 0 auto;padding: 0.3em 0.2em 0.3em 0.2em; color: #ffffff; font-weight: bold;background: #ff0000;}
#report a {color: #ffffff;}
#serverid {color: #a0a0a0;font-size: 80%;}
-->
</style>
</head>
<body>
<div id='wrapper'>
<div id='title'>Ошибка: невозможно найти файл конфигурации.</div>
<div id='message'>Невозможно открыть конфигурационный файл виртуального сервера. Пример минимальной конфигурации системы приведен ниже.
<?php
if(strtolower($_SERVER['HTTP_HOST'])!=strtolower($_SERVER['SERVER_NAME'])) {
print "<div>site-specific/".strtolower($_SERVER['HTTP_HOST']).".php,</div>";
print "<div>site-specific/".strtolower($_SERVER['SERVER_NAME']).".php:</div>";
}
else {
print "<div style='margin: 1em 0 0 0; font-size: 70%'>site-specific/".strtolower($_SERVER['SERVER_NAME']).".php:</div>";
}
?>
<pre><?php
class config extends defaultconfig {
const dbhost="<database-host>";
# const dbport="<database-port>";
const dbname="<database-name>";
const dbuser="<database-user>";
const dbpass="<database-password>";
const title="<site title>";
# relative to server document root
const XSLTStylesheet="site-specific/<server-name>/xsl/<path-to-xslt-stylesheet>";
# relative to server document root
const uploadPath="site-specific/<server-name>/upload";
# relative classes directory
const extraclasspath="site-specific/<server-name>/classes";
}
?></pre>
</div>
<div id='serverid'>Сервер: <?php print $_SERVER['SERVER_NAME']." (".$_SERVER['SERVER_ADDR']."), flamework:".version::major.".".version::minor.".".version::revision."."?></div>
</div>
</body>
</html>
<?php
die;
}
/*if(mb_strstr(config::locale, ',')) {
$l=array();
foreach(explode(',', config::locale) as $locale) {
if(setlocale(LC_ALL, trim($locale, ' ,'))!=false)
break;
}
}
else
setlocale(LC_ALL, config::locale);
*/
if(config::timezone)
date_default_timezone_set(config::timezone);
function getFolder($className) {
$array = explode('__', $className, -1);
if($array)
return $array[0].'/';
else
return null;
}
function __autoload($className) {
$filename = trim(getFolder($className).$className).'.class.php';
$fullname = dirname(__FILE__).'/'.$filename;
if(file_exists($fullname))
include_once $fullname;
else
if(config::classPath)
include_once dirname(__FILE__).'/../'.config::classPath.'/'.$filename;
}
// disabling the guard improves system response time slightly, but increases the debugging pain in case something goes wrong
if (!isset($_guard) && config::guard) {
$_flameworkGuard=new guard();
}
mb_internal_encoding(config::charset);
mb_regex_encoding(config::charset);
?>