static function file_get_contents($file, $schema, $custom_schema)
 {
     $content = preg_replace("|<!--.*?-->|msi", "", file_get_contents($file));
     if (strpos($content, "<?xml") === false) {
         $content = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . $content;
     }
     $is_sys = strpos($file, "_sys/");
     if (!sys_strbegins($schema, "nodb_")) {
         $content = self::_change_schema($content);
     }
     $content = self::_change_schema_nodb($content, $schema, $is_sys);
     $diff_path = sys_custom_dir(substr($file, 0, -4) . "/");
     if (is_dir($diff_path)) {
         foreach (scandir($diff_path) as $file) {
             if ($file[0] == ".") {
                 continue;
             }
             $obj = new SimpleXMLElement($content);
             self::_merge_simplexml($obj, new SimpleXMLElement(file_get_contents($diff_path . $file)));
             $content = $obj->asXml();
         }
     }
     if ($custom_schema != "") {
         $obj = new SimpleXMLElement($content);
         self::_merge_simplexml($obj, new SimpleXMLElement($custom_schema));
         $content = $obj->asXml();
     }
     return trans($content);
 }
Example #2
0
function sys_find_bin($program)
{
    if (strpos(PHP_OS, "WIN") === false) {
        $ret = sys_exec("which " . $program);
        if (file_exists($ret)) {
            return $ret;
        }
        if (file_exists(sys_custom("tools/bin_deb/" . $program)) and USE_DEBIAN_BINARIES) {
            $program = sys_custom("tools/bin_deb/" . $program);
            if (!is_executable($program)) {
                chmod($program, 0744);
            }
            putenv("HOME=" . sys_custom_dir("./tools/bin_deb/"));
        }
        return $program;
    } else {
        if ($program == "dot") {
            $file = sys_custom("tools/bin_win32/graphviz/bin/dot.exe");
        } else {
            $file = sys_custom("tools/bin_win32/" . $program . ".exe");
        }
        if (file_exists($file)) {
            return modify::realfilename($file);
        }
        return $program . ".exe";
    }
}