public function readBinary() { $bytes = null; $fi = sys_io_File::read($this->location, true); $bytes = $fi->readAll(null); return $bytes->b; }
public function process($onData, $partSize = null) { try { if ($partSize === null) { $partSize = 8192; } $doneTrigger = new tink_core_FutureTrigger(); $fh = sys_io_File::read($this->tmpFileName, null); $pos = 0; $readNext = null; $readNext1 = null; $readNext1 = array(new _hx_lambda(array(&$doneTrigger, &$fh, &$onData, &$partSize, &$pos, &$readNext, &$readNext1), "ufront_web_upload_TmpFileUpload_0"), 'execute'); $readNext = $readNext1; call_user_func($readNext); return $doneTrigger->future; } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e1 = $_ex_; $data = tink_core_Outcome::Failure(tink_core_TypedError::withData(null, "Error during TmpFileUpload.process()", $e1, _hx_anonymous(array("fileName" => "TmpFileUpload.hx", "lineNumber" => 148, "className" => "ufront.web.upload.TmpFileUpload", "methodName" => "process")))); return tink_core__Future_Future_Impl_::sync($data); } }
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 cached_query($sql_cmd, $args = null, $dirty_pages = null) { $s_args = $args->join(":"); $header = _hx_string_or_null($sql_cmd) . _hx_string_or_null($s_args); $filename = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_rec(system_base_Hashes::do_hash($header), ""); $resultset = null; $cached_results = null; $rows = new HList(); $data = null; $total_rows = null; $results = null; $return_data = _hx_anonymous(array("rows" => $rows, "total_rows" => 0)); if (strtoupper(_hx_substr(ltrim($sql_cmd), 0, 6)) !== "SELECT") { system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); return _hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length())); } if (file_exists($filename)) { $fin = sys_io_File::read($filename, false); $results = $fin->readLine(); if ($results === $header) { $cached_results = $fin->readLine(); $return_data = haxe_Unserializer::run($cached_results); } else { $m = "Database cache collision running query: " . _hx_string_or_null($sql_cmd) . "\n"; $m = Std::string(Date::now()) . ": " . _hx_string_or_null($m); system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); return _hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length())); } } else { system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); $data = haxe_Serializer::run(_hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length()))); $fout = sys_io_File::write($filename, false); $fout->writeString(_hx_string_or_null($header) . "\n"); $fout->writeString(_hx_string_or_null($data) . "\n"); $fout->close(); } return $return_data; }
static function get_read_handle($fullpath, $binary = null) { if ($binary === null) { $binary = false; } return sys_io_File::read($fullpath, $binary); }