Ejemplo n.º 1
0
 public function display($tpl_file, $cache_fileID = null, $html = false, $htmFile = null, $lng = 'cn', $xml_fileex = null)
 {
     $this->lng = $lng;
     if (!empty($xml_fileex)) {
         $tpl_file = $this->templatesDIR . $tpl_file . $xml_fileex;
     } else {
         $tpl_file = $this->templatesDIR . $tpl_file . $this->templatesfileex;
     }
     if (!is_dir($this->tpl_dir) || !is_dir($this->tpl_c_dir)) {
         exit('Error[2]:Please set up correctly TemplateDIR and CacheDIR');
     }
     $template_file = $this->tpl_dir . $tpl_file;
     if (!file_exists($template_file)) {
         exit('Error[3]:Template file does not exist,Path:' . $tpl_file);
     }
     if ($this->caching) {
         if (!is_dir($this->cache_dir)) {
             exit('Error[4]:Please correct cacheDIR settings');
         }
     } else {
     }
     $out = $this->fetch($tpl_file, $cache_fileID);
     if (strpos($out, $this->_linkechash)) {
         $includefile = explode($this->_linkechash, $out);
         foreach ($includefile as $key => $val) {
             if ($key % 2 == 1) {
                 $val = str_replace('|', '', $val);
                 $includefile[$key] = $this->fetch($val);
             }
         }
         $out = implode('', $includefile);
     }
     if (strpos($out, $this->_includeechash)) {
         $includefile = explode($this->_includeechash, $out);
         foreach ($includefile as $key => $val) {
             if ($key % 2 == 1) {
                 $val = str_replace('|', '', $val);
                 $includefile[$key] = $this->fetch($val);
             }
         }
         $out = implode('', $includefile);
     }
     if (strpos($out, $this->gethash)) {
         $getout = explode($this->gethash, $out);
         foreach ($getout as $key => $val) {
             if ($key % 2 == 1) {
                 $getvalue = explode($this->gethashtable, $val);
                 list($getval, $tempbreak) = $getvalue;
                 $getout[$key] = $this->insert_get_mod($getval, $tempbreak);
             }
         }
         $out = implode('', $getout);
     }
     if (strpos($out, $this->_echash)) {
         $k = explode($this->_echash, $out);
         foreach ($k as $key => $val) {
             if ($key % 2 == 1) {
                 $k[$key] = $this->insert_mod($val);
             }
         }
         $out = implode('', $k);
         $out = $this->format_js($out);
     }
     if (strpos($out, $this->_listechash)) {
         $k = explode($this->_listechash, $out);
         foreach ($k as $key => $val) {
             if ($key % 2 == 1) {
                 $k[$key] = $this->insert_mod($val);
             }
         }
         $out = implode('', $k);
         $out = $this->format_js($out);
     }
     if (strpos($out, $this->findhash)) {
         $findout = explode($this->findhash, $out);
         foreach ($findout as $key => $val) {
             if ($key % 2 == 1) {
                 $filevalue = explode('|', $val);
                 list($findmodel, $findclass, $findfiled) = $filevalue;
                 $findout[$key] = $this->insert_find_mod($findmodel, $findclass, $findfiled);
             }
         }
         $out = implode('', $findout);
     }
     if ($this->lng == 'big5') {
         $out = $this->protection($out);
         require_once admin_ROOT . 'public/class.Chinese.php';
         $codechange = new Chinese(admin_ROOT . 'public/config/');
         ob_start();
         eval('?' . '>' . trim($out));
         $name = ob_get_contents();
         ob_end_clean();
         $out = $codechange->g2b($name);
         if ($html) {
             ob_start();
             echo $out;
             $content = ob_get_contents();
             ob_end_clean();
             $this->cachefilewrite($htmFile, $content);
         } else {
             echo $out;
         }
     } else {
         $out = $this->protection($out);
         if ($html) {
             ob_start();
             eval('?' . '>' . trim($out));
             $content = ob_get_contents();
             ob_end_clean();
             $this->cachefilewrite($htmFile, $content);
         } else {
             eval('?' . '>' . trim($out));
         }
     }
 }
Ejemplo n.º 2
0
 function codeing($out, $getcode = 'ub')
 {
     require_once admin_ROOT . 'public/class.Chinese.php';
     $codechange = new Chinese(admin_ROOT . 'public/config/');
     if ($getcode == 'ub') {
         $out = $codechange->u2g($out);
         $out = $codechange->g2b($out);
     } elseif ($getcode == 'bu') {
         $out = $codechange->b2u($out);
     } elseif ($getcode == 'ug') {
         $out = $codechange->u2g($out);
     } elseif ($getcode == 'gu') {
         $out = $codechange->g2u($out);
     } elseif ($getcode == 'gb') {
         $out = $codechange->g2b($out);
     } elseif ($getcode == 'bg') {
         $out = $codechange->b2g($out);
     }
     return $out;
 }