示例#1
0
 function InitTemplate($fd = "/dev/null")
 {
     global $tema, $vars, $SYS;
     $tmpl_dir = "";
     if (strstr($fd, "<!--HEAD-->") == False) {
         /* VNH. It's a file */
         if ($fd != "/dev/null") {
             $fdo = $tmpl_dir . $fd . ".html";
         }
         $this->file = $fdo;
         $this->name = str_replace(".html", "", basename($fd));
         if (!e_file_exists($fdo)) {
             $tmpl_dir = $SYS["DOCROOT"] . "/Plantillas/";
             if ($fd != "/dev/null") {
                 $fdo = $tmpl_dir . $fd . ".html";
             }
             $this->file = $fdo;
             $this->name = str_replace(".html", "", basename($fd));
         }
         $vars["plantillas"] .= $this->file . " , ";
         $this->data = file($fdo, 1) or print "Error abriendo {$fdo} en " . ini_get("include_path");
         //echo "<textarea cols=\"100\" rows=\"100\">";print_r($this->data);echo "</textarea>";
     } else {
         /* Must be a memory autotemplate  */
         $this->file = "in_memory";
         $this->name = "autotemplate";
         $this->data = array_values(explode("\n", strtr(nl2br($fd), array("<br>" => " ", "<br />" => " "))));
         debug("Using memory autotemplate");
         //echo "<textarea cols=\"100\" rows=\"100\">";print_r($this->data);echo "</textarea>";
     }
     /*echo "<textarea cols=\"100\" rows=\"100\">";
       print_r($this->data);
       echo "</textarea";*/
     $this->mark = array("head" => "<!--HEAD-->", "set" => "<!--SET-->", "end" => "<!--END-->");
 }
示例#2
0
 function Ente($name)
 {
     global $SYS, $TrazaStatus, $MEMORY_CACHE;
     $this->properties_desc = array();
     $this->properties = array();
     $this->properties_type = array();
     $this->ROOT = $SYS["ROOT"];
     $cache_time = false;
     $source_time = false;
     /* Soporte para precompilados */
     if (!isset($MEMORY_CACHE["{$name}"])) {
         if (file_exists(session_save_path() . "/coreg2_cache/{$SYS["ASCACHEDIR"]}/" . $name . ".cached_core_object_properties_" . $SYS["PROJECT"])) {
             $cache_time = filemtime(session_save_path() . "/coreg2_cache/{$SYS["ASCACHEDIR"]}/" . $name . ".cached_core_object_properties_" . $SYS["PROJECT"]);
         } else {
             $cache_time = false;
         }
         if (file_exists($SYS["DOCROOT"] . $SYS["DATADEFPATH"] . $name . ".def")) {
             $source_time = filemtime($SYS["DOCROOT"] . $SYS["DATADEFPATH"] . $name . ".def");
         } else {
             if (e_file_exists("local/Class/{$name}.def")) {
                 $source_time = filemtime(e_file_exists("local/Class/{$name}.def"));
             } else {
                 $source_time = false;
             }
         }
         if ($cache_time !== False && $cache_time > $source_time) {
             debug("Cargando definicion compilada de '{$name}'", "yellow");
             $fd = c_fopen(session_save_path() . "/coreg2_cache/{$SYS["ASCACHEDIR"]}/" . $name . ".cached_core_object_properties_" . $SYS["PROJECT"], "r");
             $buffer = "";
             while (!feof($fd)) {
                 $buffer .= fgets($fd, 4096);
             }
             fclose($fd);
             $prop = unserialize($buffer);
             unset($buffer);
         } else {
             /* Establece las propiedades desde un fichero XML */
             if (file_exists($SYS["DOCROOT"] . $SYS["DATADEFPATH"] . $name . ".def")) {
                 debug("Fichero definicion " . $SYS["DOCROOT"] . $SYS["DATADEFPATH"] . $name . ".def existe");
                 $file = $SYS["DOCROOT"] . $SYS["DATADEFPATH"] . $name . ".def";
             } else {
                 if (e_file_exists("local/Class/{$name}.def")) {
                     debug($SYS["BASE"] . "/local/Class/{$name}.def existe");
                     $file = e_file_exists("local/Class/{$name}.def");
                 } else {
                     die(debug($SYS["BASE"] . "/local/Class/{$name}.def no  existe"));
                 }
             }
             debug("Cargando definicion de '{$name}'", "yellow");
             $prop = load_prop($file);
             debug("Compilando dinamicamente '{$name}'", "magenta");
             $fd = c_fopen(session_save_path() . "/coreg2_cache/{$SYS["ASCACHEDIR"]}/" . $name . ".cached_core_object_properties_" . $SYS["PROJECT"], "w");
             fwrite($fd, serialize($prop), strlen(serialize($prop)));
             fclose($fd);
         }
         $MEMORY_CACHE["{$name}"] = serialize($prop);
     } else {
         $prop = unserialize($MEMORY_CACHE["{$name}"]);
     }
     $this->properties = $prop["p"];
     $this->properties_desc = $prop["pd"];
     $this->properties_type = $prop["pt"];
     $this->_normalize();
     $this->name = $name;
 }
示例#3
0
function c_filesize($filename)
{
    $serach_name = e_file_exists($filename);
    return filesize($serach_name);
}