/* Bartosz_Szczecinski btm@anfo.pl 20070725 0.3.1 1 */ ?> header('X-UA-Compatible: IE=edge'); require_once('eternity/configure.php'); if(DEBUG) { $_start = array_sum(explode(' ', microtime())); } error_reporting(E_ALL^E_NOTICE); if(!isset($_SERVER['SCRIPT_URI']) || 1) { $_SERVER['SCRIPT_URI'] = 'http://www.'.str_replace('www.', '', $_SERVER['SERVER_NAME']) . $_SERVER['REQUEST_URI']; } /** * sprawdz, czy istnieje strona odpowiadajaca podanemu adresowi */ try { try { $pages = pages::get_instance($_SERVER['SCRIPT_URI']); } catch (Exception $e) { /** * jezeli nie istnieje, wygeneruj strone glowna */ $_SERVER['SCRIPT_URI'] = 'http://'.str_replace('www.', '', $_SERVER['SERVER_NAME']); $pages = pages::get_instance($_SERVER['SCRIPT_URI']); } } catch (Exception $e) { /** * jezeli i tu wystapil blad, wyswietl komunikat */ new error(404); die(); } //$page_data = $sql->get('pages', array('*'), array('id'=>$pages->page_id)); if(strstr($_SERVER['SCRIPT_URI'], ',')) { $temp = explode(',', $_SERVER['SCRIPT_URI']); unset($temp[0]); define('PARAMS', join(',', $temp)); } else define('PARAMS', ''); define('PAGE_ROOT', $pages->base_url); define('REQUESTED_URL', $pages->requested_uri); define('ABSOLUTE_PATH', $_SERVER['SCRIPT_URI']); define('SITE_NAME',$pages->data['title']); $prefix = ''; if(LANG == 'English') $prefix = 'en'; if(substr(PAGE_ROOT, -1) == '/') { $tpl->assign('root', substr(PAGE_ROOT,0 , -1)); $tpl->assign('here', substr(PAGE_ROOT, 0, -1).'/'.$prefix . REQUESTED_URL); } else { $tpl->assign('root', PAGE_ROOT); $tpl->assign('here', PAGE_ROOT.$prefix . REQUESTED_URL); } $tpl->assign('absolute_here', ABSOLUTE_PATH); // zbedne, i tak zawsze porownuje page.page_id i page.domain_id -_- //if($pages->page_id == $pages->domain_id) $tpl->assign('index', true); //else $tpl->assign('index',false); $tpl->assign('page', $pages->data); $tpl->assign('path', $pages->path); $tpl->assign('title', $pages->get_title()); $pages->plugins->init(); $pages->call_actions(PARAMS, $_POST); $pages->plugins->shutdown(); /** * pluginy moga modyfikowac mete (dodaja RSS np.) wiec przypisanie * wykonujemy po ich odpaleniu */ $tpl->assign('meta', $pages->meta()); //print_r($tpl); $pages->add_template('header.tpl'); if($pages->page_id == $pages->domain_id) { $pages->add_template('index.tpl'); } else $pages->add_template('subpage.tpl'); $pages->add_template('footer.tpl'); $pages->display(); if(DEBUG) { $_end = array_sum(explode(' ', microtime())); echo '
'; echo 'Generation time: '."\t\t".($_end - $_start)."\n"; echo 'Queries used: '."\t\t\t".count($pages->sql->queries)."\n"; echo ''; } ?>