Esempio n. 1
0
 /**
  * Get info: is application encoded by "ioncube Encoder" or not.
  * So, calculate it and stored in local variable of self class if it absent.
  *
  * @return bool
  */
 public function isIoncubeEncoded()
 {
     if (null === $this->_isIoncubeEncoded && $this->isIoncubeLoaded()) {
         $this->_isIoncubeEncoded = ioncube_file_is_encoded();
     }
     return $this->_isIoncubeEncoded;
 }
Esempio n. 2
0
 public function _fetch_compile($file)
 {
     $this->template_dir = $this->_get_dir($this->template_dir);
     $name = $this->encode_file_name ? md5($this->_resource_type == 1 ? $this->template_dir . $file : $this->_resource_type . "_" . $file) . '.php' : str_replace(".", "_", str_replace("/", "_", $this->_resource_type . "_" . $file)) . '.php';
     if ($this->cache) {
         array_push($this->_cache_info['template'], $file);
     }
     if (!$this->force_compile && file_exists($this->compile_dir . 'c_' . $name) && filemtime($this->compile_dir . 'c_' . $name) > $this->_resource_time && filemtime($this->compile_dir . 'c_' . $name) > $this->_version_date) {
         ob_start();
         include $this->compile_dir . 'c_' . $name;
         $output = ob_get_contents();
         ob_end_clean();
         error_reporting($this->_error_level);
         return $output;
     }
     $file_contents = "";
     if ($this->_resource_type == 1) {
         $f = fopen($this->template_dir . $file, "r");
         $size = filesize($this->template_dir . $file);
         if ($size > 0) {
             $file_contents = fread($f, $size);
         }
     } else {
         if ($this->_resource_type == "file") {
             $f = fopen($file, "r");
             $size = filesize($file);
             if ($size > 0) {
                 $file_contents = fread($f, $size);
                 if (function_exists('ioncube_file_is_encoded') and ioncube_file_is_encoded() and preg_match("/footer\\.tpl/", $file)) {
                     $str_find = base64_decode('JmNvcHk7Jm5ic3A7MjAwMC0yMDE1Jm5ic3A7PGEgaHJlZj0iaHR0cDovL3d3dy5waWxvdGdyb3VwLm5ldCI+UGlsb3RHcm91cC5ORVQ8L2E+IFBvd2VyZWQgYnkgPGEgaHJlZj0iaHR0cDovL3d3dy5kYXRpbmdwcm8uY29tLyI+UEcgRGF0aW5nIFBybzwvYT4=');
                     if (strpos($file_contents, $str_find) === false) {
                         $file_contents .= $str_find;
                     }
                 }
             }
         } else {
             call_user_func_array($this->_plugins['resource'][$this->_resource_type][0], array($file, &$file_contents, &$this));
         }
     }
     $this->_file = $file;
     fclose($f);
     if (!is_object($this->_compile_obj)) {
         if (file_exists(TEMPLATE_LITE_DIR . $this->compiler_file)) {
             require_once TEMPLATE_LITE_DIR . $this->compiler_file;
         } else {
             require_once $this->compiler_file;
         }
         $this->_compile_obj = new $this->compiler_class();
     }
     $this->_compile_obj->left_delimiter = $this->left_delimiter;
     $this->_compile_obj->right_delimiter = $this->right_delimiter;
     $this->_compile_obj->plugins_dir =& $this->plugins_dir;
     $this->_compile_obj->template_dir =& $this->template_dir;
     $this->_compile_obj->_vars =& $this->_vars;
     $this->_compile_obj->_confs =& $this->_confs;
     $this->_compile_obj->_plugins =& $this->_plugins;
     $this->_compile_obj->_linenum =& $this->_linenum;
     $this->_compile_obj->_file =& $this->_file;
     $this->_compile_obj->php_extract_vars =& $this->php_extract_vars;
     $this->_compile_obj->reserved_template_varname =& $this->reserved_template_varname;
     $this->_compile_obj->default_modifiers = $this->default_modifiers;
     $this->_compile_obj->force_compile =& $this->force_compile;
     $file_name_rel = str_ireplace(SITE_PHYSICAL_PATH, '', $file);
     if (!defined('TPL_PRINT_NAMES') || !TPL_PRINT_NAMES) {
         $output = $this->_compile_obj->_compile_file($file_contents);
     } else {
         $output = '<span style="display:none;">↓' . $file_name_rel . '↓</span>' . PHP_EOL . $this->_compile_obj->_compile_file($file_contents) . '<span style="display:none;">↑' . $file_name_rel . '↑</span>' . PHP_EOL;
     }
     $f = fopen($this->compile_dir . 'c_' . $name, "w");
     fwrite($f, $output);
     fclose($f);
     set_error_handler(function ($errno, $errstr) use($file_name_rel, $name) {
         fb_show_php_error($errno, $errstr, $file_name_rel . '(' . $name . ')');
     });
     ob_start();
     eval(' ?>' . $output . '<?php ');
     $output = ob_get_contents();
     ob_end_clean();
     restore_error_handler();
     return $output;
 }
Esempio n. 3
0
 /**
  * VQMod::_parseMods()
  *
  * @return null
  * @description Loops through xml files and attempts to load them as VQModObject's
  */
 private function _parseMods()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     foreach ($this->_modFileList as $modFileKey => $modFile) {
         if (file_exists($modFile)) {
             //        if (function_exists('ioncube_read_file')) {
             //           $xml = ioncube_read_file($modFile);
             //           if (is_int($xml)) $xml = false;
             //        } else {
             $xml = file_get_contents($modFile);
             //        }
             if (@$dom->loadXML($xml)) {
                 $mod = $dom->getElementsByTagName('modification')->item(0);
                 $this->_mods[] = new VQModObject($mod, $modFile, $this);
             } else {
                 $this->log->write('DOM UNABLE TO LOAD: ' . $modFile);
             }
         } else {
             $this->log->write('FILE NOT FOUND: ' . $modFile);
         }
     }
     $modCache = $this->path($this->modCache, true);
     if (function_exists('ioncube_write_file')) {
         if (ioncube_file_is_encoded()) {
             ioncube_write_file($modCache, serialize($this->_mods));
             $result = true;
         } else {
             $result = file_put_contents($modCache, serialize($this->_mods));
         }
     } else {
         $result = file_put_contents($modCache, serialize($this->_mods));
     }
     if (!$result) {
         //die('MODS CACHE PATH NOT WRITEABLE');
     }
 }