コード例 #1
0
 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();
 }
コード例 #2
0
ファイル: Stack.class.php プロジェクト: slaskis/hxsinatra
 static function makeStack($s)
 {
     $a = $GLOBALS[$s];
     $m = new _hx_array(array());
     $_g1 = 0;
     $_g = $a->length - ($s == "%s" ? 2 : 0);
     while ($_g1 < $_g) {
         $i = $_g1++;
         $d = _hx_explode("::", $a[$i]);
         $m->unshift(haxe_StackItem::Method($d[0], $d[1]));
         unset($i, $d);
     }
     return $m;
 }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
function ufront_web_session_FileSession_1(&$dir)
{
    if (file_exists($dir) === false) {
        $path = haxe_io_Path::addTrailingSlash($dir);
        $_p = null;
        $parts = new _hx_array(array());
        while ($path !== ($_p = haxe_io_Path::directory($path))) {
            $parts->unshift($path);
            $path = $_p;
        }
        $_g = 0;
        while ($_g < $parts->length) {
            $part = $parts[$_g];
            ++$_g;
            if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
                @mkdir($part, 493);
            }
            unset($part);
        }
    }
    return tink_core_Noise::$Noise;
}