<?php
 class MySmarty extends Smarty {
		public function __construct($path =''){
				parent::smarty();
				$this->path = $path;
				$this->template_dir = HON6_ROOT.'./templates/'.$path;
				check_dir(HON6_ROOT.'./templates_c/'.$path);
				$this->compile_dir = HON6_ROOT.'./templates_c/'.$path;
				$this->cache_dir = HON6_ROOT.'./cache';
				$this->config_dir = HON6_ROOT.'./configs';
				$this->left_delimiter = '<{';
				$this->right_delimiter ='}>';
		}
		public function formatpage($file,$arraydate,$tjdata){
				global $smarty_function;
				if(is_array($smarty_function)){ 
						foreach($smarty_function as $function){ 
								if($function){
										$this->register_function($function,$function);
								}
						}
				}
				global $smarty_url; 
				if(is_array($smarty_url)){ 
						foreach($smarty_url as $url_function){ 
								if($url_function){
										$this->register_function($url_function,$url_function);
								}
						}
				}
				if(@$_POST["showapi"] == 1){
						print_r(json_encode($arraydate));
						exit();
				}
				$this -> assign($arraydate);
				$this -> assign('queries',$GLOBALS['queries']);
				$this -> assign('querysqls',$GLOBALS['querysqls']);
				$this -> assign('memoryuse',GetMemory());
				$this -> pagecontent = $this->fetch($file);
				
				global $showlis;
				
				if($showlis != "0"){
						$this->pagecontent = str_replace("</body>","<img src=\"$tjdata\" width=\"0\" height=\"0\" />",$this->pagecontent);
						$this->pagecontent = str_replace("</wml>","<img src=\"$tjdata\" width=\"0\" height=\"0\" />",$this->pagecontent);
				}

				if($this->path=="wml"){
						$this->pagecontent = str_replace("&amp;","&",$this->pagecontent);
						$this->pagecontent = str_replace("&","&amp;",$this->pagecontent);
				}
				echo $this->pagecontent;
		}
}
?>