isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); //print_r($data['deviceType']);echo"aaaaaaaaaaaaaaaaa";die; if(($data['deviceType'] == 'phone' || $data['deviceType'] == 'tablet')) { header('Location: http://www.fotopin.lt/html/'); } //gentime(); // užkrauname TVS konfiguraciją require_once('config.php'); $config['root_path'] = dirname(__FILE__). '/'; $config['global_inc_path'] = 'modules/global/inc/'; $GLOBALS['config'] = &$config; $config['root_path'] = str_replace('\\', '/', $config['root_path']); require_once($config['global_inc_path'].'phemplate.cls.php'); require_once($config['global_inc_path'].'db.cls.php'); require_once($config['global_inc_path'].'global_functions.cls.php'); require_once($config['global_inc_path'].'process.cls.php'); require_once($config['global_inc_path'].'validator.cls.php'); require_once($config['global_inc_path'].'prev_next.cls.php'); if (empty($_GET['mod'])) $_GET['mod'] = $config['default_mod']; // parenkam arba svetaines valdymo, arba pacios svetaines sablonus if ($_GET['mod'] == 'content') { $main_tpl_path = $config['tpl_path']['site']; } else { $main_tpl_path = $config['tpl_path']['main']; // phemplate } // Smarty konfiguracija define('SMARTY_DIR', $config['root_path'].$config['smarty']['dir']); require_once(SMARTY_DIR.'Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = $config['root_path'].$main_tpl_path; $smarty->compile_dir = $config['root_path'].$config['smarty']['templates_c']; $smarty->config_dir = $config['root_path'].$config['smarty']['configs']; $smarty->cache_dir = $config['root_path'].$config['smarty']['cache']; $smarty->caching = false; $tpl = & new phemplate(); $tpl->unknowns = 'remove_nonjs'; $GLOBALS['modules'] = array(); // prisijungiame prie MySQL DB $db_data = $config['db']; $db = & new DB(); $db->connect($db_data['user'], $db_data['psw'], $db_data['host'], $db_data['db_name']); // startuojame sesiją session_start(); require_once('modules/global/inc/dcSessionManager.cls.php'); //init main modules processing class $process_class = & new mod_process($config); $process_class->init($db->connection); if (!empty($_GET['blank'])) { $tpl_file = 'main_blank.tpl.html'; } elseif (!empty($_GET['ajax']) OR !empty($_GET['ajx']) OR !empty($_GET['empty']) OR $_GET['mod'] == 'admin_panel') { $tpl_file = 'main_empty.tpl.html'; } elseif ($_GET['mod'] != 'content') { $tpl_file = 'main_blank.tpl.html'; } else { $tpl_file = 'main.tpl.html'; } $GLOBALS['lang'] = DEFAULT_LANG; $GLOBALS['admin_lang'] = DEFAULT_ADMIN_LANG; //init mysql session process('login', 'init_session'); // nustatom kalba, $GLOBALS['lang'] ir $GLOBALS['admin_lang'] process('lang', 'get_lang'); $lang = $GLOBALS['lang']; $is_logged = process('login', 'check_is_logged'); if (!$is_logged AND $_GET['mod'] != 'login') { if ($_GET['mod'] != 'content') process('login', 'logout'); } $permited_error = process('users_perm'); if (empty($permited_error)) { // all actions permited $output = process(); } else { // user is trying to do disabled action clear_loops(); $output = $permited_error; } //translation $trans = get_lang($lang); $smarty->assign('trans', $trans); $smarty->assign('main_output', $output); echo $smarty->fetch($tpl_file); $db->close(); ob_end_flush(); //echo 'Generated in '.gentime().' seconds.'; exit; function process($module='', $action='') { global $process_class, $smarty; $output = ''; $mod_class_output = $process_class->process($module, $action); //iterpiam modulio css ir javascript failus if (empty($module)) { $css_files = $process_class->get_mod_css(); $scripts_files = $process_class->get_mod_scripts(); $meta = $process_class->get_mod_meta(); $smarty->assign('css_loop', $css_files); $smarty->assign('script_loop', $scripts_files); $smarty->assign('base', $GLOBALS["config"]["site_url"]); $smarty->assign('lang', $GLOBALS['lang']); if ($meta) $smarty->assign('meta', $meta); } return $mod_class_output; } function get_lang($lang) { global $config, $tpl; $gf = & new global_functions(); $trans = $gf->get_lang_translation($lang, $config['root_path'].'modules/global/'); return $trans; } function clear_loops() { global $smarty; $smarty->assign('css_loop', null); $smarty->assign('script_loop', null); } function gentime() { static $a; if($a == 0) $a = microtime(true); else return (string)(microtime(true)-$a); } ?>