public function get_viewDirectory()
 {
     if ($this->get_isPathAbsolute()) {
         return haxe_io_Path::addTrailingSlash($this->path);
     } else {
         return _hx_string_or_null(haxe_io_Path::addTrailingSlash($this->scriptDir)) . _hx_string_or_null(haxe_io_Path::addTrailingSlash($this->path));
     }
 }
 public function __construct($tmpFileName, $postName, $originalFileName, $size)
 {
     if (!php_Boot::$skip_constructor) {
         $this->postName = $postName;
         $this->originalFileName = haxe_io_Path::withoutDirectory($originalFileName);
         $this->size = $size;
         $this->tmpFileName = $tmpFileName;
     }
 }
 public function log($context, $appMessages)
 {
     $logFile = _hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path);
     $req = $context->request;
     $res = $context->response;
     $userDetails = $req->get_clientIP();
     if ((null !== $context->session ? $context->session->get_id() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null(null !== $context->session ? $context->session->get_id() : null);
     }
     if (($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null);
     }
     $content = "" . Std::string(Date::now()) . " [" . _hx_string_or_null($req->get_httpMethod()) . "] [" . _hx_string_or_null($req->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($res->status, "") . " " . _hx_string_or_null($res->get_contentType()) . "]\n";
     $_g = 0;
     $_g1 = $context->messages;
     while ($_g < $_g1->length) {
         $msg = $_g1[$_g];
         ++$_g;
         $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg)) . "\n";
         unset($msg);
     }
     if ($appMessages !== null) {
         $_g2 = 0;
         while ($_g2 < $appMessages->length) {
             $msg1 = $appMessages[$_g2];
             ++$_g2;
             $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg1)) . "\n";
             unset($msg1);
         }
     }
     $path = haxe_io_Path::directory($logFile);
     $path1 = haxe_io_Path::addTrailingSlash($path);
     $_p = null;
     $parts = new _hx_array(array());
     while ($path1 !== ($_p = haxe_io_Path::directory($path1))) {
         $parts->unshift($path1);
         $path1 = $_p;
     }
     $_g3 = 0;
     while ($_g3 < $parts->length) {
         $part = $parts[$_g3];
         ++$_g3;
         if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
             @mkdir($part, 493);
         }
         unset($part);
     }
     $file = sys_io_File::append(_hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path), null);
     $file->writeString($content);
     $file->close();
     return ufront_core_SurpriseTools::success();
 }
 public function getTemplate($path, $templatingEngine = null)
 {
     $_g = $this;
     if ($this->cache !== null && $this->cache->exists($path)) {
         $cached = $this->cache->get($path);
         if ($templatingEngine === null || $templatingEngine->type === $cached->a) {
             return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success($cached->b));
         }
     }
     $tplStrReady = new tink_core_FutureTrigger();
     $ext = haxe_io_Path::extension($path);
     $finalPath = null;
     if ($templatingEngine !== null && $ext !== "") {
         $finalPath = $path;
         $this1 = $this->getTemplateString($finalPath);
         $this1(array(new _hx_lambda(array(&$_g, &$ext, &$finalPath, &$path, &$templatingEngine, &$this1, &$tplStrReady), "ufront_view_UFViewEngine_0"), 'execute'));
     } else {
         if ($templatingEngine !== null && $ext === "") {
             $exts = $templatingEngine->extensions->copy();
             $testNextExtension = null;
             $testNextExtension1 = null;
             $testNextExtension1 = array(new _hx_lambda(array(&$_g, &$ext, &$exts, &$finalPath, &$path, &$templatingEngine, &$testNextExtension, &$testNextExtension1, &$tplStrReady), "ufront_view_UFViewEngine_1"), 'execute');
             $testNextExtension = $testNextExtension1;
             call_user_func($testNextExtension);
         } else {
             if ($templatingEngine === null && $ext !== "") {
                 $tplEngines = $this->engines->copy();
                 $testNextEngine = null;
                 $testNextEngine1 = null;
                 $testNextEngine1 = array(new _hx_lambda(array(&$_g, &$ext, &$finalPath, &$path, &$templatingEngine, &$testNextEngine, &$testNextEngine1, &$tplEngines, &$tplStrReady), "ufront_view_UFViewEngine_2"), 'execute');
                 $testNextEngine = $testNextEngine1;
                 call_user_func($testNextEngine);
             } else {
                 if ($templatingEngine === null && $ext === "") {
                     $tplEngines1 = $this->engines->copy();
                     $engine1 = null;
                     $extensions = new _hx_array(array());
                     $extensionsUsed = new _hx_array(array());
                     $ext2 = null;
                     $testNextEngineOrExtension = null;
                     $testNextEngineOrExtension1 = null;
                     $testNextEngineOrExtension1 = array(new _hx_lambda(array(&$_g, &$engine1, &$ext, &$ext2, &$extensions, &$extensionsUsed, &$finalPath, &$path, &$templatingEngine, &$testNextEngineOrExtension, &$testNextEngineOrExtension1, &$tplEngines1, &$tplStrReady), "ufront_view_UFViewEngine_3"), 'execute');
                     $testNextEngineOrExtension = $testNextEngineOrExtension1;
                     call_user_func($testNextEngineOrExtension);
                 }
             }
         }
     }
     return tink_core__Future_Future_Impl_::_tryFailingMap($tplStrReady->future, array(new _hx_lambda(array(&$_g, &$ext, &$finalPath, &$path, &$templatingEngine, &$tplStrReady), "ufront_view_UFViewEngine_4"), 'execute'));
 }
 public function requestIn($ctx)
 {
     $_g = $this;
     if (strtolower($ctx->request->get_httpMethod()) === "post" && $ctx->request->isMultipart()) {
         $file = null;
         $postName = null;
         $origFileName = null;
         $size = 0;
         $tmpFilePath = null;
         $dateStr = DateTools::format(Date::now(), "%Y%m%d-%H%M");
         $dir = _hx_string_or_null($ctx->get_contentDirectory()) . _hx_string_or_null(haxe_io_Path::addTrailingSlash(ufront_web_upload_TmpFileUploadMiddleware::$subDir));
         $path = haxe_io_Path::removeTrailingSlashes($dir);
         $path1 = haxe_io_Path::addTrailingSlash($path);
         $_p = null;
         $parts = new _hx_array(array());
         while ($path1 !== ($_p = haxe_io_Path::directory($path1))) {
             $parts->unshift($path1);
             $path1 = $_p;
         }
         $_g1 = 0;
         while ($_g1 < $parts->length) {
             $part = $parts[$_g1];
             ++$_g1;
             if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
                 @mkdir($part, 493);
             }
             unset($part);
         }
         $onPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_0"), 'execute');
         $onData = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_1"), 'execute');
         $onEndPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_2"), 'execute');
         return tink_core__Future_Future_Impl_::map($ctx->request->parseMultipart($onPart, $onData, $onEndPart), array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onEndPart, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_3"), 'execute'), null);
     } else {
         return ufront_core_SurpriseTools::success();
     }
 }
 static function withExtension($path, $ext)
 {
     $s = new haxe_io_Path($path);
     $s->ext = $ext;
     return $s->toString();
 }
 public function setBaseUri($uriPartsBeforeRouting)
 {
     $remainingUri = haxe_io_Path::addTrailingSlash($uriPartsBeforeRouting->join("/"));
     $fullUri = haxe_io_Path::addTrailingSlash($this->context->getRequestUri());
     $this->baseUri = haxe_io_Path::addTrailingSlash(_hx_substr($fullUri, 0, strlen($fullUri) - strlen($remainingUri)));
 }
 public function doCreateSessionDirectory()
 {
     $dir = haxe_io_Path::removeTrailingSlashes($this->savePath);
     return ufront_core_SurpriseTools::tryCatchSurprise(array(new _hx_lambda(array(&$dir), "ufront_web_session_FileSession_1"), 'execute'), "Failed to create directory " . _hx_string_or_null($dir), _hx_anonymous(array("fileName" => "FileSession.hx", "lineNumber" => 203, "className" => "ufront.web.session.FileSession", "methodName" => "doCreateSessionDirectory")));
 }
 public function get_contentDirectory()
 {
     if ($this->_contentDir === null) {
         if ($this->request->get_scriptDirectory() !== null) {
             $this->_contentDir = _hx_string_or_null(haxe_io_Path::addTrailingSlash($this->request->get_scriptDirectory())) . _hx_string_or_null(haxe_io_Path::addTrailingSlash($this->_relativeContentDir));
         } else {
             $this->_contentDir = haxe_io_Path::addTrailingSlash($this->_relativeContentDir);
         }
     }
     return $this->_contentDir;
 }