<?php
//exit("......");
if (!isset($_SESSION)) session_start();
require_once('include/global.php');
date_default_timezone_set('Asia/Jakarta');
$page=Page::getInstance();
$db=pDatabase::getInstance();
$page->setTitle("Home");
$page->setDec(DESC);
$page->setKeyword(KEYWORD);
$page->addCss(TPL_CSS."kudus.css");
$page->addCss(TPL_CSS."style.css");
$page->addCss(TPL_CSS."tpl.css");
$page->addCss(TPL_CSS."button.css");
$page->addCss(BS_CSS."jquery-ui.min.css");
$page->addCss(BS_CSS."jquery-ui.structure.min.css");
$page->addCss(BS_CSS."jquery-ui.theme.min.css");
$page->addCss(BS_CSS."jquery.timepicker.min.css");

$page->addJs(BS_JS."jquery.min.js");
$page->addJs(BS_JS."jquery.timepicker.min.js");
$page->addJs(BS_JS."jquery-ui.min.js");
$page->addJs(BS_JS."Chart.bundle.js");
$page->addJs(BS_JS."acc.js");
$page->addJs(BS_JS."kudus.js");
$page->addJs(BS_JS."tinymce/tinymce.min.js");
$page->setIcon('tpl/kuduscyber/css/img/bdk.png');

$page->addLoad("kudus.set('".NPAGE."')");
$render='tpl/kuduscyber/halaman.php';

$datasettingprofile=$db->dataProfileweb();
$statuslogin=$db->ceckUser();
if($statuslogin){
	$_SESSION['profile']=$db->getProfile();
}

if(isset($_GET['hal'])){
	$halaman='halaman/hal_nohal/hal_nohal.php';
	if(file_exists('halaman/hal_'.$_GET['hal'].'/hal_'.$_GET['hal'].'.php') && $_GET['hal']!="halaman"){
		$page->addCss(TPL_CSS."utama.css");
		$page->addCss(TPL_CSS."halaman.css");
		$render='tpl/kuduscyber/halaman.php';
		$halaman='halaman/hal_'.$_GET['hal'].'/hal_'.$_GET['hal'].'.php';
	}else{
		$statusfooter=false;
		$render='tpl/kuduscyber/nohal.php';
	}
	include $halaman;
}else{
	$page->addCss(TPL_CSS."utama.css");
	include 'halaman/hal_member/hal_member.php';
}



$page->sPlug();

if($statuslogin){
	include 'plugins/plg_csession/plg_csession.php';
	include 'plugins/plg_caricanggih/plg_caricanggih.php';
	include 'plugins/plg_cetak/plg_cetak.php';
}

include 'plugins/plg_tabel/plg_tabel.php';
include 'plugins/plg_boxwin/plg_boxwin.php';
include 'plugins/plg_boxpesan/plg_boxpesan.php';
include 'plugins/plg_loader/plg_loader.php';
include 'plugins/plg_alert/plg_alert.php';

$dataplugin=$page->getPlugin();

if(sizeof($dataplugin)>0){
	for($i=0;$i<sizeof($dataplugin);$i++){
		$lokplugin='plugins/plg_'.$dataplugin[$i].'/plg_'.$dataplugin[$i].'.php';
		if(file_exists($lokplugin)){
			include 'plugins/plg_'.$dataplugin[$i].'/plg_'.$dataplugin[$i].'.php'; 
		}
	}
}
$_SESSION['_loadplugin']=$dataplugin;
$page->ePlug();

echo $page->render($render);
?>
