error_reporting(E_ALL);
/*pulapka na wirusy
*/
date_default_timezone_set('Europe/Paris' );
ob_start();
include_once('admin/includes/mail/class.phpmailer.php');
$rClasses = Array('MicroTimer',
'Db',
'Registry',
'Logger',
'Main',
'Template',
'Gallery',
'News',
'User',
'Newsletter',
'Photo',
'Offer',
'Ads',
'Shop',
'Order',
'Polls',
'Anons',
'Promotion');
foreach ( $rClasses as $rClass )
{
if ( file_exists( 'lib/'.$rClass.'.class.php' ) && is_readable( 'lib/'.$rClass.'.class.php' ) )
{
require 'lib/'.$rClass.'.class.php';
}
}
session_start();
// Ustawa o cookies
if ( isset($_GET['nocookie']) ) {
setcookie('nocookie', 'nocookie', time() + 2592000);
}
if ( !is_dir('!data/logs') )
{
@mkdir('!data/logs');
}
$test = scandir('!data');
array_shift($test);
array_shift($test);
foreach($test as $t)
{
if(is_dir('!data/'.$t) && !is_writable('!data/'.$t))
echo 'Katalog !data/'.$t.' nie ma praw do zapisu!
';
}
require_once 'lib/config.inc.php';
define('SHOW_QUERY', false);
function exceptionDie(Exception $e){
if(DEBUG) {
echo $e->getMessage().'
';
echo 'Plik: '.$e->getFile().'
';
echo 'Linia: '.$e->getLine().'
';
echo 'Trace: '.$e->getTraceAsString().'
';
echo 'Kod: '.$e->getCode().'
';
die();
}
else {
die('Przepraszamy, wystapil blad!');
}
}
//logger odpalamy najpierw, zeby bylo wiadomo ze mozna logowac bledy
$logger = Logger::getInstance();
try
{
$db = db::getInstance();
registry :: set('db', $db);
if(!isset($_SESSION['lang'])) {
$_SESSION['lang'] = 'pl';
}
if(isset($_GET['a']) && $_GET['a'] == 'lang') {
$_SESSION['lang'] = $_GET['b'];
}
registry :: set('lang', $_SESSION['lang']);
/*
if(isset($_GET['a']) && $_GET['a'] != '')
$_SESSION['intro'] = true;
if(!isset($_SESSION['intro']))
{
include 'intro.php';
exit();
}
*/
$tpl = 'default';
$dir = 'templates/';
$tpls = scandir($dir);
array_shift($tpls);
array_shift($tpls);
foreach($tpls as $t)
{
if(!is_dir($dir.$t))
continue;
if(file_exists($dir.$t.'/akt'))
{
$tpl = $t;
break;
}
}
if ( isSet($_GET['forceTPL']) )
$tpl = $_GET['forceTPL'];
if(file_exists($dir.$tpl.'/actions.php'))
include $dir.$tpl.'/actions.php';
$template = new Template($tpl, $_SESSION['lang']);
$template->getVisitorsCounter();
$template->showPage();
}
catch (Exception $e) {
$logger->error($e->getMessage(), $e->getCode());
exceptionDie($e);
}
ob_flush();
exit();
?>