header("Content-Type:text/html; charset=utf-8");
// Statistic tmp varibles
//$time_start = microtime(true);
// Settings
ini_set('display_errors',1);
error_reporting(E_ALL);
ini_set('session.use_trans_sid',0);
ini_set('session.use_cookies',1);
ini_set('session.use_only_cookies',1);
ini_set('session.auto_start',0);
session_start();
// Includes
include ( "_system/param.php" );
$css_list = array();
// Filtering
$filter = new Filter();
// Define user
$user = new User();
// Logs
//$log = new Log("","");
$ln = parse_uri(0);
if (isset($ln[0]) && $ln[0]=='en'){
define("LANG_SITE",'/'.$ln[0]."/");
define("LANG_SITE_SH",$ln[0]);
define("LANG_SITE_SH_T","_".$ln[0]);
define("LANG_SITE_SH_LN",$ln[0]);
include ("lang/".$ln[0].".php");
}elseif (isset($ln[0]) && $ln[0]=='kz'){
define("LANG_SITE",'/kz/');
define("LANG_SITE_SH",'kz');
define("LANG_SITE_SH_T","_kz");
define("LANG_SITE_SH_LN",$ln[0]);
include ("lang/kz.php");
}else {
define("LANG_SITE",'/');
define("LANG_SITE_SH",'');
define("LANG_SITE_SH_T","");
define("LANG_SITE_SH_LN",'ru');
include ("lang/ru.php");
}
// Smarty
$tpl = new Smarty;
$tpl->template_dir = PATH_TPL;
$tpl->compile_dir = PATH_TPL.'cache/';
// Post engine
$posts = new Posts();
// Getting structure
//$path = new Path('/kz');
if (LANG_SITE=='/') $path = new Path();
else $path = new Path(LANG_SITE);
$_page = $path->getPage();
if($_page["id"]) $_cont = $path->getCont($_page["id"]);
$ln = $path->a_path;
array_shift($ln);
if ($ln) $tpl->assign("lng_uri",implode('/',$ln).'/');
// Prepare template varibles
// uri
if(count($path->a_path)>1) { foreach($path->a_path as $k=>$v){ $i = $k-1; $str = "uri".$i; if($k > 0) $tpl->assign($str, $v); } }
else $tpl->assign("uri0", "");
// page info
$title_page = @$_cont["title"];
if (LANG_SITE_SH!='') $title_page = @$_cont["title_".LANG_SITE_SH];
$_page_tpl = array(
"id" => @$_page["id"],
"pid" => @$_page["pid"],
"title" => $title_page,
"keywords" => @$_cont["keywords"],
"description" => @$_cont["description"],
"content" => @$_cont["content"],
"name" => @$_page["name"],
"sys_name" => @$_page["sys_name"],
);
// Check page access
if(isset($_page["access"]) && is_array($_page["access"]) && !in_array($_SESSION["user"]["gid"], $_page["access"]))
$_page_tpl["content"] = $tpl->fetch("system/page-auth.tpl");
$tpl->assign("_backuri", base64_encode($_SERVER["REQUEST_URI"]));
$tpl->assign("_page", $_page_tpl);
$tpl->assign("_user", $_SESSION["user"]);
$_bread_crumps = $path->b_path ;
$tpl->assign("_bread_crumps", $_bread_crumps );
$tpl->assign("_bread_crumps_count", count( $_bread_crumps ) );
// Additions functions
include_once(PATH_FNS."user.functions.php");
$tpl->assign("ArrayVote",GetVoteInfo());
$tpl->assign("_sitemap",load_sitemap($path->a_path));
$tpl->assign("_today",date("d.m.Y"));
$tpl->assign("menu",showmenu('main'));
// Load blocks
//$last_uri = $path->a_path[count($path->a_path)-1];
$pid = isset( $_page['id'] ) ? $_page['id'] : 0 ;
//
$bl = new Block();
$bl->loadBlocks($_page['tid'], $pid );
$tpl->assign("_css_list", base64_encode(implode(',',$css_list)) );
// Display print page
if(__get("print") && __get("print") == 1)
$tpl->display("print.tpl");
// Display template
else
$tpl->display($_page["tpl"]);
exit;
?>