static function main() { $files = sys_FileSystem::readDirectory("../images"); $validimages = new _hx_array(array()); $_g = 0; while ($_g < $files->length) { $it = $files[$_g]; ++$_g; if (StringTools::endsWith($it, ".jpg") === true) { $validimages->push($it); } else { if (StringTools::endsWith($it, ".png") === true) { $validimages->push($it); } else { if (StringTools::endsWith($it, ".gif") === true) { $validimages->push($it); } } } unset($it); } php_Lib::println(haxe_Json::stringify($validimages, null)); }
function Index_0(&$base, &$cache, &$cl, &$params, &$profiler, &$route, &$user_class, &$user_method) { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (!file_exists($fullpath)) { return false; } else { $r_query = $router->query_string; $fin = sys_io_File::read($fullpath, false); $query = $fin->readLine(); if ($r_query === $query) { $etag = null; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); $etag = _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { $etag = ""; } if (php_Web::getClientHeader("If-none-match") === $etag) { php_Web::setReturnCode(304); $fin->close(); return true; } else { while (!system_base_Cache::$cookie_buffer->isEmpty()) { system_base_Wet_base::send_cookie(system_base_Cache::$cookie_buffer->pop()); } header("X-Powered-By" . ": " . "Webrathea/0.4 (PHP)"); $value = DateTools::format(Date::now(), "%a, %d %b %Y %X %Z"); header("Date" . ": " . _hx_string_or_null($value)); header("X-Frame-Options" . ": " . "sameorigin"); header("X-XSS-Protection" . ": " . "1; mode=block"); php_Web::setReturnCode(200); $value1 = Std::string(sys_FileSystem::stat($fullpath)->size); header("Content-Length" . ": " . _hx_string_or_null($value1)); header("ETag" . ": " . _hx_string_or_null($etag)); $m = null; $pos = strlen($query); $fin1 = sys_io_File::read($fullpath, false); $size = sys_FileSystem::stat($fullpath)->size; $fin1->seek($pos, sys_io_FileSeek::$SeekBegin); $output = $fin1->readString($size - $pos); $fin1->close(); $m = $output; $message = null; $message = Std::string($m); haxe_Log::trace("DEPRECATED FUNCTION: " . _hx_string_or_null($message), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 449, "className" => "system.base.Wet_base", "methodName" => "echo"))); $fin->close(); return true; } unset($etag); } else { $fin->close(); return false; } unset($r_query, $query, $fin); } unset($router, $hash, $fullpath); }
static function deleteDirectory($folder, $included) { if ($folder === null || !file_exists($folder)) { return; } $path = com_wiris_util_sys_Store_2($folder, $included); $files = sys_FileSystem::readDirectory($folder); $i = 0; $_g1 = 0; $_g = $files->length; while ($_g1 < $_g) { $i1 = $_g1++; $file = $files[$i1]; $file = $path . "/" . $file; if (is_dir($file)) { com_wiris_util_sys_Store::deleteDirectory($file, $included); } else { $includedIterator = $included->iterator(); if ($included !== null) { while ($includedIterator->hasNext()) { if (StringTools::endsWith($file, $includedIterator->next())) { @unlink($file); } } } else { @unlink($file); } unset($includedIterator); } unset($i1, $file); } $files = sys_FileSystem::readDirectory($folder); if ($files->length === 0) { @rmdir($folder); } }
public function hlist() { return sys_FileSystem::readDirectory($this->file); }
static function get_file_stat($fullpath) { return sys_FileSystem::stat($fullpath); }
static function cache_to_disk() { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $query = $router->query_string; $fout = sys_io_File::write(_hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm", false); $fout->writeString(_hx_string_or_null($query) . "\n" . _hx_string_or_null(system_base_Cache::$output_buffer->toString())); $fout->close(); $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); return _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { return ""; } }