'.$this->default_db_handle.'->num_queries; ?>',$template);/*
if (!@$fp = fopen($objfile, 'w')) {
die ("Directory '" . $this->tpl_root . '/' . $this->tpl_cache_root . "' not found or have no access!");
}
flock ($fp, 3);
fwrite ($fp, $template);
fclose ($fp);
*/return$template;
}
functionparse($file)
{
global$page_time,$page_time_start;$tplfile=$this->tpl_dir.$file.'.'.$this->tpl_file_ext;$objfile=$this->tpl_cache_root_dir.'/'.$this->tpl_name.'_'.$file.'.tpl.'.$this->tpl_cache_file_ext;
if (!file_exists($tplfile)) {$tplfile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$file.'.'.$this->tpl_file_ext;$objfile=$this->tpl_cache_root_dir.'/'.$this->default_tpl_name.'_'.$file.'.tpl.'.$this->tpl_cache_file_ext;
}
if ((@filemtime($tplfile) > @filemtime($objfile)) || (!@file_exists($objfile))) {//$this->parse_template ($tplfile, $objfile);if (!@$fp=fopen($objfile,'w')) {
die ("Directory '".$this->tpl_root.'/'.$this->tpl_cache_root."' not found or have no access!");
}flock($fp,3);fwrite($fp,$this->parse_template($tplfile,$objfile));fclose($fp);
}
list ($usec,$sec) =explode(" ",microtime());$page_time_end=$usec+$sec;$page_time=sprintf("%0.6f",$page_time_end-$page_time_start);
return$objfile;
}
functionset_tpl_db_handle($dh)
{$this->defalt_db_handle='$'.$dh;
}
functionset_tpl_name($name)
{$tpl_dir=$this->tpl_root_dir.'/'.$name.'/';
if ($name!=''&&is_dir($tpl_dir)) {$this->tpl_name=$name;$this->tpl_dir=str_replace('//','/',$tpl_dir);
}
else {$this->tpl_name=$this->default_tpl_name;$this->tpl_dir=str_replace('//','/',$this->tpl_root_dir.'/'.$this->tpl_name.'/');
}
}
functionset_language($langMeta)
{$langFile=$this->tpl_dir.$langMeta.'.lang';clearstatcache();
if (@is_readable($langFile)) {
return$langFile;
}
elseif (@is_readable($this->tpl_dir.$this->default_lang.'.'.$this->tpl_lang_file_ext)) {$langFile=$this->tpl_dir.$this->default_lang.'.'.$this->tpl_lang_file_ext;$langMeta=$this->default_lang;
return$langFile;
}
elseif (@is_readable($this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$langMeta.'.lang')) {$langFile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$langMeta.'.lang';
return$langFile;
}
elseif (@is_readable($this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$this->default_lang.'.'.$this->tpl_lang_file_ext)) {$langFile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$this->default_lang.'.'.$this->tpl_lang_file_ext;$langMeta=$this->default_lang;
return$langFile;
}
else
die ('Accept Langfile:'.$langFile.' did not exist or has no access!');
}
functiondsp()
{
global$mSession;
if ($mSession['do_gzip']) {$gzip_contents=ob_get_contents();ob_end_clean();$gzip_size=strlen($gzip_contents);$gzip_crc=crc32($gzip_contents);$gzip_contents=gzcompress($gzip_contents,9);$gzip_contents=substr($gzip_contents,0,strlen($gzip_contents) -4);
echo"x1fx8bx08x00x00x00x00x00";
echo$gzip_contents;
echopack('V',$gzip_crc);
echopack('V',$gzip_size);
}
elseob_end_flush();
}
functionget_static_html($file)
{// Just for Test...$static_file='../../data/static/'.$file.'.'.$this->tpl_static_file_ext;
if (@$fp=fopen($static_file,'wb')) {fwrite($fp,ob_get_contents());fclose($fp);
}ob_end_clean();
return;
}
}
functionaddquote($var)
{
returnstr_replace("\\"", """,preg_replace("/[([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*)]/s","['\1']",$var));
}
functionstripvtags($expr,$statement)
{$expr=str_replace("\\"", """,preg_replace("/=(\$[a-zA-Z_x7f-xff][a-zA-Z0-9_[]\"'x7f-xff]*)?>/s","\1",$expr));$statement=str_replace("\\"", """,$statement);
return$expr.$statement;
}?>