query("SELECT * FROM `".vand."config` WHERE `lang` = '".site_lang."'"); $fetch_config = $db->fetch_array($query_config); //rain tpl include("include/rain.tpl.class.php"); $template_dir = "template/".$fetch_config['theme']."/".site_lang."/"; $template_name_dir = "template/".$fetch_config['theme'].'/'; raintpl::configure("base_url", null ); raintpl::configure("tpl_dir", "template/".$fetch_config['theme']."/".site_lang."/" ); raintpl::configure("cache_dir", "template_cache/".$fetch_config['theme']."/".site_lang."/"); raintpl::configure( 'php_enabled', false ); raintpl::configure( 'path_replace', false ); $template = new RainTPL; include("include/counter.php"); include("module/user.php"); ham3d_user(); $this_page = maka_page_url(); if(empty($this_page)) { $this_page = "main"; } $arr = array(); foreach($_GET as $k => $v) { $arr['get_'.$k] = $v; } $template->assign($arr); function recursive_array($arr, &$arr_out) { $last_arr = array(); foreach($arr as $k => $v) { $arr = array(); $arr['key'] = $k; $arr['value'] = $v; if(is_array($v)) { $in = recursive_array($v, $arr); $arr['loop_sub'] = $in; } $last_arr[] = $arr; } $arr_out = $last_arr; return $last_arr; } $template->assign(array('today' => r_s_date(time()) )); $template->assign(array('site_url' => site_url.'/')); $template->assign(array('this_page' => $this_page)); $template->assign(array('template_dir' => site_url.'/'.$template_dir)); $template->assign(array('template_name_dir' => site_url.'/'.$template_name_dir)); $template->assign(array('site_lang' => site_lang)); $template->assign(array('site_keywords' => u_escape( $fetch_config['keywords'] ) )); //$template->assign(array('site_note' => u_escape( $fetch_config['note'] ) )); $template->assign(array("page_site_title" => u_escape($fetch_config['site_title']) )); $template->assign(array("page_site_title" => u_escape($fetch_config['site_title']) )); if(preg_match("#_#", $this_page)) { $module_name = implode("_", explode("_", $this_page, -1)); } else { $module_name = $this_page; } //echo $module_name; //print_r($_GET); $site_title = ''; if($module_name == 'pages') { //print_r($_GET); $query = $db->query("SELECT * FROM `".vand."pages` WHERE `url` = '".escape(@$_GET['pages_info'])."'"); $fetch = $db->fetch_array( $query ); if(isset($fetch['title'])) { $site_title = u_escape($fetch['title']); $site_note = u_escape( $fetch_config['note']); } else { $site_title = config_key($this_page.'_title'); $site_note = u_escape( $fetch_config['note']); } } else { if(isset($_GET[$module_name.'_info'])) { if($db->num_rows($db->query("SHOW TABLES LIKE '".vand.escape($module_name)."'")) == 1) { $search = ""; if(isset($_GET['title'])) { $search .= " AND trim(`title`) = '".escape(url2str(@$_GET['title']))."' "; } else { $search .= " AND `id` = '".escape(@$_GET[$module_name.'_info'])."' "; if($db->num_rows($db->query("SHOW COLUMNS FROM `".vand."".escape($module_name)."` LIKE 'state' ")) == 1) { $search = " AND `state` = '1'"; } } $query = $db->query("SELECT * FROM `".vand."".escape($module_name)."` WHERE 1 = 1 $search "); $fetch = $db->fetch_array( $query ); } if(isset($_GET['product_info'])) { $searchpp = " AND `id` = '".(int)$_GET['product_info']."' "; @$query = $db->query("SELECT `title`,`note` FROM `".vand."product` WHERE `lang` = '".site_lang."' $searchpp "); $fetch = $db->fetch_array($query); } } if(isset($fetch['title'])) { $site_title = u_escape($fetch['title']); $site_note = filter_var($fetch['note'], FILTER_SANITIZE_STRING); } else { if($module_name == 'product' && $_GET['catid'] != '') { $query_cat = $db->query("SELECT `title` FROM `".vand."product_cat` WHERE `id` = '".$_GET['catid']."'"); $fetch_cat = $db->fetch_array( $query_cat ); if(isset($fetch_cat['title'])) { $site_title = u_escape($fetch_cat['title']); } }else{ $site_title = config_key($this_page.'_title'); $site_note = u_escape( $fetch_config['note']); } } } foreach(@$_COOKIE as $k => $v) { $template->assign('cookie_'.$k, $v) ; } $template->assign(array("site_note" => $site_note) ); $template->assign(array("site_title" => $site_title) ) ; $template->assign(array("module_name" => $module_name) ) ; $template->assign('module_title', config_key($this_page.'_title')); $n_page = 20; if ($handle = opendir('module/index')) { $last_arr = array(); while (false !== ($file = readdir($handle))) { if($file != '.' && $file != '..' && preg_match("#\.php$#", $file)) { include("module/index/".check_hack($file)); eval('if(function_exists("ham3d_'.str_replace(".php", "", $file).'")) { ham3d_'.str_replace(".php", "", $file).'(); }'); } } } $dir = 'pages'; if(isset($_GET['ajax'])) { $include = 'simple'; }else if(isset($_GET['print'])) { $dir = 'pages'; $include = 'print'; }else if(isset($_GET['email'])) { $dir = 'pages'; $include = 'email'; }else if(isset($_GET['excel'])) { $dir = 'excel'; $include = 'simple'; include('class/excel.php'); $excel = new excel(); header('Content-Disposition: attachment; filename='.date('Y-m-d-h-s').'.xls'); header("Content-Type: application/vnd.ms-excel"); } else { $include = 'base'; } if(file_exists(''.$dir.'/'.$this_page.'.php')) { include(''.$dir.'/'.$this_page.".php"); } if(isset($_GET['print'])) { $template_name = 'print/'.$template_name; } else if(isset($_GET['email'])) { $template_name = 'email/'.$template_name; } if($dir != 'excel') { $template->assign(array('template_name' => @$template_name)); $html = $template->draw( $include, $return_string = true ); echo $html; } if($dir == 'excel') { $excel->show_me(); } ob_end_flush(); ?>