public function getString()
 {
     try {
         $data = tink_core_Outcome::Success(sys_io_File::getContent($this->tmpFileName));
         return tink_core__Future_Future_Impl_::sync($data);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $data1 = tink_core_Outcome::Failure(tink_core_TypedError::withData(null, "Error during TmpFileUpload.getString()", $e, _hx_anonymous(array("fileName" => "TmpFileUpload.hx", "lineNumber" => 80, "className" => "ufront.web.upload.TmpFileUpload", "methodName" => "getString"))));
         return tink_core__Future_Future_Impl_::sync($data1);
     }
 }
 public function getTemplateString($viewRelativePath)
 {
     $fullPath = _hx_string_or_null($this->get_viewDirectory()) . _hx_string_or_null($viewRelativePath);
     try {
         if (file_exists($fullPath)) {
             return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(haxe_ds_Option::Some(sys_io_File::getContent($fullPath))));
         } else {
             return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(haxe_ds_Option::$None));
         }
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         return $e->asSurpriseError("Failed to load template " . _hx_string_or_null($viewRelativePath));
     }
 }
 public function doReadSessionFile($_)
 {
     if (ufront_web_session_FileSession_2($this, $_)) {
         $filename = "" . _hx_string_or_null($this->savePath) . _hx_string_or_null($this->sessionID) . ".sess";
         try {
             return ufront_core_SurpriseTools::asGoodSurprise(sys_io_File::getContent($filename));
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $e = $_ex_;
             return ufront_core_SurpriseTools::asGoodSurprise(null);
         }
     } else {
         $this->context->messages->push(_hx_anonymous(array("msg" => "Session ID " . _hx_string_or_null($this->sessionID) . " was invalid, resetting session.", "pos" => _hx_anonymous(array("fileName" => "FileSession.hx", "lineNumber" => 243, "className" => "ufront.web.session.FileSession", "methodName" => "doReadSessionFile")), "type" => ufront_log_MessageType::$MWarning)));
         $this->sessionID = null;
         return ufront_core_SurpriseTools::asGoodSurprise(null);
     }
 }
Ejemplo n.º 4
0
 public function load_view_object($view, $vars = null)
 {
     $base = isset(system_base_Wet_base::$get_instance) ? system_base_Wet_base::$get_instance : array("system_base_Wet_base", "get_instance");
     $viewpath = _hx_string_or_null(system_base_Wet_base::$views_path) . _hx_string_or_null($view) . ".wtv";
     $view1 = null;
     $pos = 0;
     $left = null;
     $right = null;
     $uservar = null;
     $fieldname = null;
     try {
         $view1 = sys_io_File::getContent($viewpath);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         throw new HException(new system_base_NoFileError(_hx_string_or_null($viewpath) . " does not exist or cannot be opened for reading"));
     }
     if ($vars !== null) {
         $fields = Reflect::fields($vars);
         $_g = 0;
         while ($_g < $fields->length) {
             $fieldname1 = $fields[$_g];
             ++$_g;
             $uservar = Std::string(Reflect::field($vars, $fieldname1));
             $pos = 0;
             while (($pos = _hx_index_of($view1, "::" . _hx_string_or_null($fieldname1) . "::", $pos)) !== -1) {
                 $left = _hx_substr($view1, 0, $pos);
                 $right = _hx_substr($view1, $pos + strlen($fieldname1) + 4, null);
                 $view1 = _hx_string_or_null($left) . _hx_string_or_null($uservar) . _hx_string_or_null($right);
                 $pos += 1;
             }
             unset($fieldname1);
         }
     }
     $this->cache->append($view1);
 }
Ejemplo n.º 5
0
 static function getBytes($path)
 {
     return haxe_io_Bytes::ofString(sys_io_File::getContent($path));
 }
Ejemplo n.º 6
0
 public function read()
 {
     return sys_io_File::getContent($this->file);
 }
Ejemplo n.º 7
0
 public function __construct($dbtype = null, $host = null, $port = null, $socket = null, $user = null, $pass = null, $database = null, $trase = null)
 {
     if (!php_Boot::$skip_constructor) {
         $timer = null;
         $stoptime = null;
         $profiler = system_base_Profiler::get_instance();
         $db_config = "";
         $config_path = _hx_string_or_null(system_base_Wet_base::$conf_path) . "database.xml";
         try {
             $db_config = sys_io_File::getContent($config_path);
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $e = $_ex_;
             throw new HException(new system_base_NoFileError(_hx_string_or_null($config_path) . " does not exist or cannot be opened for reading"));
         }
         $xml = Xml::parse($db_config);
         $config = new haxe_xml_Fast($xml->firstElement());
         if ($dbtype === null) {
             $dbtype = $config->node->resolve("type")->get_innerHTML();
         } else {
             $dbtype = $dbtype;
         }
         if ($user === null) {
             $user = $config->node->resolve("user")->get_innerHTML();
         } else {
             $user = $user;
         }
         if ($pass === null) {
             $pass = $config->node->resolve("pass")->get_innerHTML();
         } else {
             $pass = $pass;
         }
         if ($port === null) {
             $port = Std::parseInt($config->node->resolve("port")->get_innerHTML());
         } else {
             $port = $port;
         }
         if ($socket === null) {
             $socket = $config->node->resolve("socket")->get_innerHTML();
         } else {
             $socket = $socket;
         }
         if ($database === null) {
             $database = $config->node->resolve("schema")->get_innerHTML();
         } else {
             $database = $database;
         }
         $timer = new system_base_Timers(null);
         switch ($dbtype) {
             case "mysql":
                 if ($host === null) {
                     $host = $config->node->resolve("host")->get_innerHTML();
                 } else {
                     $host = $host;
                 }
                 if ($trase) {
                     haxe_Log::trace("Attempting connection to " . "MySQL " . _hx_string_or_null($user) . "@" . _hx_string_or_null($host), _hx_anonymous(array("fileName" => "Database.hx", "lineNumber" => 115, "className" => "system.base.Database", "methodName" => "new")));
                 }
                 try {
                     if (system_base_Database::$cnx === null) {
                         system_base_Database::$cnx = sys_db_Mysql::connect(_hx_anonymous(array("host" => $host, "port" => $port, "user" => $user, "pass" => $pass, "socket" => $socket, "database" => $database)));
                     }
                 } catch (Exception $__hx__e) {
                     $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                     $e1 = $_ex_;
                     throw new HException(new system_base_NoConnectionError($e1));
                     return;
                 }
                 $stoptime = $timer->stop();
                 break;
             case "sqlite":
                 if ($host === null) {
                     $host = $config->node->resolve("host")->get_innerHTML();
                 } else {
                     $host = $host;
                 }
                 if (_hx_index_of($host, "/", null) === -1) {
                     $host = _hx_string_or_null(system_base_Wet_base::$datastore_path) . _hx_string_or_null($host);
                 } else {
                     $host = $host;
                 }
                 if ($trase) {
                     haxe_Log::trace("Attempting connection to " . "SQLite@" . _hx_string_or_null($host), _hx_anonymous(array("fileName" => "Database.hx", "lineNumber" => 150, "className" => "system.base.Database", "methodName" => "new")));
                 }
                 system_base_Database::$cnx = sys_db_Sqlite::open($host);
                 $stoptime = $timer->stop();
                 break;
             default:
                 throw new HException(new system_base_NoSuchDbexception($dbtype));
                 break;
         }
         $profiler->increment("CON", $stoptime, null);
     }
 }
Ejemplo n.º 8
0
 public function getContent($name)
 {
     if (!php_Boot::$skip_constructor) {
         return sys_io_File::getContent($name);
     }
 }
Ejemplo n.º 9
0
 static function get_file_content($fullpath)
 {
     return sys_io_File::getContent($fullpath);
 }
Ejemplo n.º 10
0
 public function getContent($name)
 {
     return sys_io_File::getContent($name);
 }