public function execute() { $uriParts = $this->context->actionContext->get_uriParts(); $this->setBaseUri($uriParts); $params = $this->context->request->get_params(); $method = $this->context->request->get_httpMethod(); $this->context->actionContext->controller = $this; $this->context->actionContext->action = "execute"; try { $this->context->actionContext->action = "showMessage"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 0); $wrappingRequired = null; $i = haxe_rtti_Meta::getFields(_hx_qtype("ufront.app.DefaultUfrontController"))->showMessage->wrapResult[0]; $wrappingRequired = $i; $result = $this->wrapResult($this->showMessage(), $wrappingRequired); $this->setContextActionResultWhenFinished($result); return $result; throw new HException(ufront_web_HttpError::pageNotFound(_hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 442, "className" => "ufront.app.DefaultUfrontController", "methodName" => "execute")))); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; return ufront_core_SurpriseTools::asSurpriseError($e, "Uncaught error while executing " . Std::string($this->context->actionContext->controller) . "." . _hx_string_or_null($this->context->actionContext->action) . "()", _hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 445, "className" => "ufront.app.DefaultUfrontController", "methodName" => "execute"))); } }
static function run() { if (testsite_Server::$ufrontApp === null) { testsite_Server::$ufrontApp = new ufront_app_UfrontApplication(_hx_anonymous(array("indexController" => _hx_qtype("testsite.Routes"), "logFile" => "log.txt", "contentDirectory" => "../uf-content/", "authImplementation" => _hx_qtype("ufront.auth.NobodyAuthHandler"), "sessionImplementation" => _hx_qtype("ufront.web.session.VoidSession"), "basePath" => "/php/"))); } testsite_Server::$ufrontApp->executeRequest(); }
static function initialise() { CompileTimeClassList::$lists = new haxe_ds_StringMap(); $m = haxe_rtti_Meta::getType(_hx_qtype("CompileTimeClassList")); if ($m->classLists !== null) { $_g = 0; $_g1 = $m->classLists; while ($_g < $_g1->length) { $item = $_g1[$_g]; ++$_g; $array = $item; $listID = $array[0]; $list = new HList(); $_g2 = 0; $_g3 = _hx_explode(",", $array[1]); while ($_g2 < $_g3->length) { $typeName = $_g3[$_g2]; ++$_g2; $type = Type::resolveClass($typeName); if ($type !== null) { $list->push($type); } unset($typeName, $type); } unset($_g3, $_g2); CompileTimeClassList::$lists->set($listID, $list); unset($listID, $list, $item, $array); } } }
public function getProxy() { $proxy = Reflect::field(_hx_qtype("haxe.Http"), "PROXY"); if ($proxy === null) { return null; } return $proxy; }
static function rethrow($e) { if (Std::is($e, _hx_qtype("php.Exception"))) { $__rtex__ = $e; throw $__rtex__; } else { throw new HException($e); } }
static function evalValue($v) { $str = null; if (Std::is($v, _hx_qtype("String"))) { $str = "'" . Std::string($v) . "'"; } else { $str = Std::string($v); } return $str; }
static function _trace($v, $i = null) { $info = null; if ($i !== null) { $info = _hx_string_or_null($i->fileName) . ":" . _hx_string_or_null($i->methodName) . ":" . _hx_string_rec($i->lineNumber, "") . ":"; } else { $info = ""; } file_put_contents(me_cunity_php_Debug::$logFile, _hx_string_or_null($info) . ":" . _hx_string_or_null(Std::is($v, _hx_qtype("String")) || Std::is($v, _hx_qtype("Int")) || Std::is($v, _hx_qtype("Float")) ? $v : print_r($v, 1)) . "\n", FILE_APPEND); }
static function wrap($resultValue) { if ($resultValue === null) { return new ufront_web_result_EmptyResult(null); } else { $actionResultValue = Std::instance($resultValue, _hx_qtype("ufront.web.result.ActionResult")); if ($actionResultValue === null) { $actionResultValue = new ufront_web_result_ContentResult(Std::string($resultValue), null); } return $actionResultValue; } }
public function handleRequest($httpContext) { $doneTrigger = new tink_core_FutureTrigger(); if (ufront_remoting_RemotingHandler_0($this, $doneTrigger, $httpContext)) { $r = $httpContext->response; $remotingResponse = null; $r->setOk(); $path = null; $args = null; try { $this->initializeContext($httpContext->injector); $params = $httpContext->request->get_params(); if (!$params->exists("__x")) { throw new HException("Remoting call did not have parameter `__x` which describes which API call to make. Aborting"); } $remotingCall = null; $s = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "__x"); $remotingCall = urldecode($s); $u = new haxe_Unserializer($remotingCall); $path = $u->unserialize(); $args = $u->unserialize(); $apiCallFinished = $this->executeApiCall($path, $args, $this->context, $httpContext->actionContext); $remotingResponse = tink_core__Future_Future_Impl_::map($apiCallFinished, array(new _hx_lambda(array(&$apiCallFinished, &$args, &$doneTrigger, &$httpContext, &$params, &$path, &$r, &$remotingCall, &$remotingResponse, &$u), "ufront_remoting_RemotingHandler_1"), 'execute'), null); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; $error = $e; $apiNotFoundMessages = new _hx_array(array("Invalid path", "No such object", "Can't access", "No such method")); if ($path !== null && $args !== null && Std::is($e, _hx_qtype("String")) && Lambda::exists($apiNotFoundMessages, array(new _hx_lambda(array(&$apiNotFoundMessages, &$args, &$doneTrigger, &$e, &$error, &$httpContext, &$path, &$r, &$remotingResponse), "ufront_remoting_RemotingHandler_2"), 'execute'))) { $remotingResponse = tink_core__Future_Future_Impl_::sync("Unable to access " . _hx_string_or_null($path->join(".")) . " - API Not Found (" . _hx_string_or_null($error) . "). See " . Std::string($this->context->objects)); $r->setNotFound(); } else { $r->setInternalError(); $remotingResponse = tink_core__Future_Future_Impl_::sync($this->remotingError($e, $httpContext)); } } $remotingResponse(array(new _hx_lambda(array(&$args, &$doneTrigger, &$e, &$httpContext, &$path, &$r, &$remotingResponse), "ufront_remoting_RemotingHandler_3"), 'execute')); } else { $result1 = tink_core_Outcome::Success(tink_core_Noise::$Noise); if ($doneTrigger->{"list"} === null) { false; } else { $list1 = $doneTrigger->{"list"}; $doneTrigger->{"list"} = null; $doneTrigger->result = $result1; tink_core__Callback_CallbackList_Impl_::invoke($list1, $result1); tink_core__Callback_CallbackList_Impl_::clear($list1); true; } } return $doneTrigger->future; }
public function call() { $obj = Type::createEmptyInstance($this->scope); $method = Reflect::field($obj, $this->func); if ($method === null) { throw new HException($obj . " does not contain " . $this->func); } if (!Reflect::isFunction($method)) { throw new HException($this->func . " is not a method of " . $obj); } $ret = Reflect::callMethod($obj, $method, new _hx_array(array())); haxe_Log::trace("Returned: " . $ret, _hx_anonymous(array("fileName" => "Route.hx", "lineNumber" => 28, "className" => "sinatra.Route", "methodName" => "call"))); return Std::is($ret, _hx_qtype("String")) ? new sinatra_View($ret, null) : eval("if(isset(\$this)) \$»this =& \$this;\$tmp = \$ret;\n\t\t\t\$»r = (Std::is(\$tmp, _hx_qtype(\"sinatra.View\")) ? \$tmp : eval(\"if(isset(\\\$this)) \\\$»this =& \\\$this;throw new HException(\\\"Class cast error\\\");\n\t\t\t\treturn \\\$»r2;\n\t\t\t\"));\n\t\t\treturn \$»r;\n\t\t"); }
static function setProperty($o, $field, $value) { if (null === $o) { null; return; } $cls = Std::is($o, _hx_qtype("Class")) ? $o->__tname__ : get_class($o); $cls_vars = get_class_vars($cls); if (isset($cls_vars['__properties__']) && isset($cls_vars['__properties__']['set_' . $field]) && ($field = $cls_vars['__properties__']['set_' . $field])) { $o->{$field}($value); return; } else { $o->{$field} = $value; return; } }
public function __construct() { if (!php_Boot::$skip_constructor) { $this->get("/", _hx_qtype("controller.Home"), "index"); $this->get("/user/:id.:format", _hx_qtype("controller.User"), "get"); $this->get("/user/(\\d+)", _hx_qtype("controller.User"), "get"); $this->get("/user/**/*.xml", _hx_qtype("controller.User"), "get"); $this->post("/user", _hx_qtype("controller.User"), "update"); $this->put("/user", _hx_qtype("controller.User"), "create"); $this->delete("/user", _hx_qtype("controller.User"), "delete"); $p = new Params(); $p->id = "123"; $p[0] = "321"; haxe_Log::trace($p, _hx_anonymous(array("fileName" => "Application.hx", "lineNumber" => 23, "className" => "Application", "methodName" => "new"))); } }
static function sure($outcome) { switch ($outcome->index) { case 0: $data = _hx_deref($outcome)->params[0]; return $data; break; case 1: $failure = _hx_deref($outcome)->params[0]; if (Std::is($failure, _hx_qtype("tink.core.TypedError"))) { return $failure->throwSelf(); } else { throw new HException($failure); } break; } }
static function typeof($v) { if ($v === null) { return ValueType::$TNull; } if (is_array($v)) { if (is_callable($v)) { return ValueType::$TFunction; } return ValueType::TClass(_hx_qtype("Array")); } if (is_string($v)) { if (_hx_is_lambda($v)) { return ValueType::$TFunction; } return ValueType::TClass(_hx_qtype("String")); } if (is_bool($v)) { return ValueType::$TBool; } if (is_int($v)) { return ValueType::$TInt; } if (is_float($v)) { return ValueType::$TFloat; } if ($v instanceof _hx_anonymous) { return ValueType::$TObject; } if ($v instanceof _hx_enum) { return ValueType::$TObject; } if ($v instanceof _hx_class) { return ValueType::$TObject; } $c = _hx_ttype(get_class($v)); if ($c instanceof _hx_enum) { return ValueType::TEnum($c); } if ($c instanceof _hx_class) { return ValueType::TClass($c); } return ValueType::$TUnknown; }
public function unserializeObject($o) { while (true) { if ($this->pos >= $this->length) { throw new HException("Invalid object"); } if (ord(substr($this->buf, $this->pos, 1)) === 103) { break; } $k = $this->unserialize(); if (!Std::is($k, _hx_qtype("String"))) { throw new HException("Invalid object key"); } $v = $this->unserialize(); $o->{$k} = $v; unset($v, $k); } $this->pos++; }
public function getModulesThatRequireInit() { $moduleSets = new _hx_array(array($this->requestMiddleware, $this->requestHandlers, $this->responseMiddleware, $this->logHandlers, $this->errorHandlers)); $modules = new _hx_array(array()); $_g = 0; while ($_g < $moduleSets->length) { $set = $moduleSets[$_g]; ++$_g; $_g1 = 0; while ($_g1 < $set->length) { $module = $set[$_g1]; ++$_g1; if (Std::is($module, _hx_qtype("ufront.app.UFInitRequired"))) { $modules->push($module); } unset($module); } unset($set, $_g1); } return $modules; }
public function encodeImpl($sb, $o) { if (com_wiris_system_TypeTools::isHash($o)) { $this->encodeHash($sb, $o); } else { if (com_wiris_system_TypeTools::isArray($o)) { $this->encodeArray($sb, $o); } else { if (Std::is($o, _hx_qtype("String"))) { $this->encodeString($sb, $o); } else { if (Std::is($o, _hx_qtype("Int"))) { $this->encodeInteger($sb, $o); } else { if (Std::is($o, _hx_qtype("haxe.Int64"))) { $this->encodeLong($sb, $o); } else { if (Std::is($o, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) { $this->encodeIntegerFormat($sb, $o); } else { throw new HException("Impossible to convert to json object of type " . Std::string(Type::getClass($o))); } } } } } } }
static function main() { haxe_rtti_Rtti::hasRtti(_hx_qtype("Bugged")); }
public function execute() { $uriParts = $this->context->actionContext->get_uriParts(); $this->setBaseUri($uriParts); $params = $this->context->request->get_params(); $method = $this->context->request->get_httpMethod(); $this->context->actionContext->controller = $this; $this->context->actionContext->action = "execute"; try { if (0 === $uriParts->length) { $this->context->actionContext->action = "index"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 0); $wrappingRequired = null; $i = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->index->wrapResult[0]; $wrappingRequired = $i; $result = $this->wrapResult($this->index(), $wrappingRequired); $this->setContextActionResultWhenFinished($result); return $result; } else { if (1 === $uriParts->length && $uriParts[0] === "querystring") { $this->context->actionContext->action = "queryString"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired1 = null; $i1 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->queryString->wrapResult[0]; $wrappingRequired1 = $i1; $result1 = $this->wrapResult($this->queryString(), $wrappingRequired1); $this->setContextActionResultWhenFinished($result1); return $result1; } else { if (1 === $uriParts->length && $uriParts[0] === "poststring") { $this->context->actionContext->action = "postString"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired2 = null; $i2 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->postString->wrapResult[0]; $wrappingRequired2 = $i2; $result2 = $this->wrapResult($this->postString(), $wrappingRequired2); $this->setContextActionResultWhenFinished($result2); return $result2; } else { if (1 === $uriParts->length && $uriParts[0] === "query") { $this->context->actionContext->action = "query"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired3 = null; $i3 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->query->wrapResult[0]; $wrappingRequired3 = $i3; $result3 = $this->wrapResult($this->query(), $wrappingRequired3); $this->setContextActionResultWhenFinished($result3); return $result3; } else { if (1 === $uriParts->length && $uriParts[0] === "post") { $this->context->actionContext->action = "post"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired4 = null; $i4 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->post->wrapResult[0]; $wrappingRequired4 = $i4; $result4 = $this->wrapResult($this->post(), $wrappingRequired4); $this->setContextActionResultWhenFinished($result4); return $result4; } else { if (1 === $uriParts->length && $uriParts[0] === "cookies") { $this->context->actionContext->action = "cookies"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired5 = null; $i5 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->cookies->wrapResult[0]; $wrappingRequired5 = $i5; $result5 = $this->wrapResult($this->cookies(), $wrappingRequired5); $this->setContextActionResultWhenFinished($result5); return $result5; } else { if (1 === $uriParts->length && $uriParts[0] === "clientheaders") { $this->context->actionContext->action = "clientHeaders"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired6 = null; $i6 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->clientHeaders->wrapResult[0]; $wrappingRequired6 = $i6; $result6 = $this->wrapResult($this->clientHeaders(), $wrappingRequired6); $this->setContextActionResultWhenFinished($result6); return $result6; } else { if (1 === $uriParts->length && $uriParts[0] === "hostname") { $this->context->actionContext->action = "hostname"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired7 = null; $i7 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->hostname->wrapResult[0]; $wrappingRequired7 = $i7; $result7 = $this->wrapResult($this->hostname(), $wrappingRequired7); $this->setContextActionResultWhenFinished($result7); return $result7; } else { if (1 === $uriParts->length && $uriParts[0] === "clientip") { $this->context->actionContext->action = "clientIP"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired8 = null; $i8 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->clientIP->wrapResult[0]; $wrappingRequired8 = $i8; $result8 = $this->wrapResult($this->clientIP(), $wrappingRequired8); $this->setContextActionResultWhenFinished($result8); return $result8; } else { if (1 <= $uriParts->length && $uriParts[0] === "uri") { $this->context->actionContext->action = "uri"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired9 = null; $i9 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->uri->wrapResult[0]; $wrappingRequired9 = $i9; $result9 = $this->wrapResult($this->uri(), $wrappingRequired9); $this->setContextActionResultWhenFinished($result9); return $result9; } else { if (1 === $uriParts->length && $uriParts[0] === "httpmethod") { $this->context->actionContext->action = "httpMethod"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired10 = null; $i10 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->httpMethod->wrapResult[0]; $wrappingRequired10 = $i10; $result10 = $this->wrapResult($this->httpMethod(), $wrappingRequired10); $this->setContextActionResultWhenFinished($result10); return $result10; } else { if (1 === $uriParts->length && $uriParts[0] === "scriptdirectory") { $this->context->actionContext->action = "scriptDir"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired11 = null; $i11 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->scriptDir->wrapResult[0]; $wrappingRequired11 = $i11; $result11 = $this->wrapResult($this->scriptDir(), $wrappingRequired11); $this->setContextActionResultWhenFinished($result11); return $result11; } else { if (1 === $uriParts->length && $uriParts[0] === "authorization") { $this->context->actionContext->action = "authorization"; $this->context->actionContext->args = new _hx_array(array()); $this->context->actionContext->get_uriParts()->splice(0, 1); $wrappingRequired12 = null; $i12 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->authorization->wrapResult[0]; $wrappingRequired12 = $i12; $result12 = $this->wrapResult($this->authorization(), $wrappingRequired12); $this->setContextActionResultWhenFinished($result12); return $result12; } else { if (3 === $uriParts->length && $uriParts[0] === "testresponse" && strlen($uriParts[1]) > 0 && strlen($uriParts[2]) > 0) { $status = Std::parseInt($uriParts[1]); if ($status === null) { throw new HException(testsite_Routes_0($this, $method, $params, $status, $uriParts)); } $charset = $uriParts[2]; $_param_tmp_language = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "language"); $_param_tmp_contentType = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "contentType"); $_param_tmp_content = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "content"); $_param_tmp_cookieName = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "cookieName"); $_param_tmp_cookieVal = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "cookieVal"); $args = _hx_anonymous(array("language" => $_param_tmp_language, "contentType" => $_param_tmp_contentType, "content" => $_param_tmp_content, "cookieName" => $_param_tmp_cookieName, "cookieVal" => $_param_tmp_cookieVal)); $this->context->actionContext->action = "testResponse"; $this->context->actionContext->args = new _hx_array(array($status, $charset, $args)); $this->context->actionContext->get_uriParts()->splice(0, 3); $wrappingRequired13 = null; $i13 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->testResponse->wrapResult[0]; $wrappingRequired13 = $i13; $result13 = $this->wrapResult($this->testResponse($status, $charset, $args), $wrappingRequired13); $this->setContextActionResultWhenFinished($result13); return $result13; } } } } } } } } } } } } } } throw new HException(ufront_web_HttpError::pageNotFound(_hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 442, "className" => "testsite.Routes", "methodName" => "execute")))); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; return ufront_core_SurpriseTools::asSurpriseError($e, "Uncaught error while executing " . Std::string($this->context->actionContext->controller) . "." . _hx_string_or_null($this->context->actionContext->action) . "()", _hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 445, "className" => "testsite.Routes", "methodName" => "execute"))); } }
public function customRequest($post, $api, $sock = null, $method = null) { $url_regexp = new EReg("^(https?://)?([a-zA-Z\\.0-9-]+)(:[0-9]+)?(.*)\$", ""); if (!$url_regexp->match($this->url)) { $this->onError("Invalid URL"); return; } $secure = $url_regexp->matched(1) === "https://"; if ($sock === null) { if ($secure) { $sock = new php_net_SslSocket(); } else { $sock = new sys_net_Socket(); } } $host = $url_regexp->matched(2); $portString = $url_regexp->matched(3); $request = $url_regexp->matched(4); if ($request === "") { $request = "/"; } $port = $portString === null || $portString === "" ? $secure ? 443 : 80 : Std::parseInt(_hx_substr($portString, 1, strlen($portString) - 1)); $data = null; $multipart = _hx_field($this, "file") !== null; $boundary = null; $uri = null; if ($multipart) { $post = true; $boundary = Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000)); while (strlen($boundary) < 38) { $boundary = "-" . $boundary; } $b = new StringBuf(); if (null == $this->params) { throw new HException('null iterable'); } $»it = $this->params->keys(); while ($»it->hasNext()) { $p = $»it->next(); $b->add("--"); $b->add($boundary); $b->add("\r\n"); $b->add("Content-Disposition: form-data; name=\""); $b->add($p); $b->add("\""); $b->add("\r\n"); $b->add("\r\n"); $b->add($this->params->get($p)); $b->add("\r\n"); } $b->add("--"); $b->add($boundary); $b->add("\r\n"); $b->add("Content-Disposition: form-data; name=\""); $b->add($this->file->param); $b->add("\"; filename=\""); $b->add($this->file->filename); $b->add("\""); $b->add("\r\n"); $b->add("Content-Type: " . "application/octet-stream" . "\r\n" . "\r\n"); $uri = $b->b; } else { if (null == $this->params) { throw new HException('null iterable'); } $»it = $this->params->keys(); while ($»it->hasNext()) { $p = $»it->next(); if ($uri === null) { $uri = ""; } else { $uri .= "&"; } $uri .= rawurlencode($p) . "=" . rawurlencode($this->params->get($p)); } } $b = new StringBuf(); if ($method !== null) { $b->add($method); $b->add(" "); } else { if ($post) { $b->add("POST "); } else { $b->add("GET "); } } if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) { $b->add("http://"); $b->add($host); if ($port !== 80) { $b->add(":"); $b->add($port); } } $b->add($request); if (!$post && $uri !== null) { if (_hx_index_of($request, "?", 0) >= 0) { $b->add("&"); } else { $b->add("?"); } $b->add($uri); } $b->add(" HTTP/1.1\r\nHost: " . $host . "\r\n"); if ($this->postData !== null) { $b->add("Content-Length: " . _hx_string_rec(strlen($this->postData), "") . "\r\n"); } else { if ($post && $uri !== null) { if ($multipart || $this->headers->get("Content-Type") === null) { $b->add("Content-Type: "); if ($multipart) { $b->add("multipart/form-data"); $b->add("; boundary="); $b->add($boundary); } else { $b->add("application/x-www-form-urlencoded"); } $b->add("\r\n"); } if ($multipart) { $b->add("Content-Length: " . _hx_string_rec(strlen($uri) + $this->file->size + strlen($boundary) + 6, "") . "\r\n"); } else { $b->add("Content-Length: " . _hx_string_rec(strlen($uri), "") . "\r\n"); } } } if (null == $this->headers) { throw new HException('null iterable'); } $»it = $this->headers->keys(); while ($»it->hasNext()) { $h = $»it->next(); $b->add($h); $b->add(": "); $b->add($this->headers->get($h)); $b->add("\r\n"); } $b->add("\r\n"); if ($this->postData !== null) { $b->add($this->postData); } else { if ($post && $uri !== null) { $b->add($uri); } } try { if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) { $sock->connect(new sys_net_Host(haxe_Http::$PROXY->host), haxe_Http::$PROXY->port); } else { $sock->connect(new sys_net_Host($host), $port); } $sock->write($b->b); if ($multipart) { $bufsize = 4096; $buf = haxe_io_Bytes::alloc($bufsize); while ($this->file->size > 0) { $size = haxe_Http_4($this, $api, $b, $boundary, $buf, $bufsize, $data, $host, $method, $multipart, $port, $portString, $post, $request, $secure, $sock, $uri, $url_regexp); $len = 0; try { $len = $this->file->io->readBytes($buf, 0, $size); } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; if (($e = $_ex_) instanceof haxe_io_Eof) { break; } else { throw $»e; } } $sock->output->writeFullBytes($buf, 0, $len); $this->file->size -= $len; unset($size, $len, $e); } $sock->write("\r\n"); $sock->write("--"); $sock->write($boundary); $sock->write("--"); } $this->readHttpResponse($api, $sock); $sock->close(); } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e = $_ex_; try { $sock->close(); } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e1 = $_ex_; } $this->onError(Std::string($e)); } }
public function save($q) { $lead_id = Std::parseInt($q->get("lead_id")); $user = S::$user; $log_id = false; if ($log_id = $this->saveLog($q, null)) { $cTable = "custom_" . Std::string($q->get("entry_list_id")); haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . Std::string($log_id), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 162, "className" => "model.QC", "methodName" => "save"))); $primary_id = S::$my->real_escape_string($q->get("primary_id")); $sql = new StringBuf(); $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET "); $cFields = S::tableFields("" . _hx_string_or_null($cTable), null); haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 177, "className" => "model.QC", "methodName" => "save"))); $cFields->remove($primary_id); $bindTypes = ""; $values2bind = null; $i = 0; $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes"))); $sets = new _hx_array(array()); $_g = 0; while ($_g < $cFields->length) { $c = $cFields[$_g]; ++$_g; $val = $q->get($c); if ($val !== null) { if (Std::is($val, _hx_qtype("String"))) { $values2bind[$i++] = $val; } else { $values2bind[$i++] = $val[0]; } $type = $dbFieldTypes->get($c); if (Util::any2bool($type)) { $bindTypes .= _hx_string_or_null($type); } else { $bindTypes .= "s"; } $sets->push(_hx_string_or_null($c) . "=?"); unset($type); } unset($val, $c); } $sql->add($sets->join(",")); $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, "")); $stmt = S::$my->stmt_init(); haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 199, "className" => "model.QC", "methodName" => "save"))); $success = $stmt->prepare($sql->b); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 203, "className" => "model.QC", "methodName" => "save"))); return false; } $success = myBindParam($stmt, $values2bind, $bindTypes); haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 207, "className" => "model.QC", "methodName" => "save"))); if ($success) { $success = $stmt->execute(); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 213, "className" => "model.QC", "methodName" => "save"))); return false; } $sql = new StringBuf(); $uFields = model_QC::$vicdial_list_fields; $uFields->remove($primary_id); $bindTypes = ""; $values2bind = null; $i = 0; $sql->add("UPDATE vicidial_list SET "); $sets = new _hx_array(array()); $_g1 = 0; while ($_g1 < $uFields->length) { $c1 = $uFields[$_g1]; ++$_g1; $val1 = $q->get($c1); if ($val1 !== null) { if (Std::is($val1, _hx_qtype("String"))) { $values2bind[$i++] = $val1; } else { $values2bind[$i++] = $val1[0]; } $type1 = $dbFieldTypes->get($c1); if (Util::any2bool($type1)) { $bindTypes .= _hx_string_or_null($type1); } else { $bindTypes .= "s"; } $sets->push(_hx_string_or_null($c1) . "=?"); unset($type1); } unset($val1, $c1); } $values2bind[$i++] = S::$user; $bindTypes .= "s"; $sets->push("security_phrase=?"); $values2bind[$i++] = "XX"; $bindTypes .= "s"; $sets->push("state=?"); if (_hx_equal($q->get("status"), "QCOK") || _hx_equal($q->get("status"), "QCBAD")) { $list_id = 10000; if (_hx_equal($q->get("status"), "QCOK")) { $mID = Std::parseInt($q->get("vendor_lead_code")); if ($mID === null) { $mID = S::newMemberID(); $values2bind[$i++] = $mID; $bindTypes .= "s"; $sets->push("vendor_lead_code=?"); } } else { $list_id = 1800; } $entry_list_id = $q->get("entry_list_id"); $values2bind[$i++] = $q->get("status"); $bindTypes .= "s"; $sets->push("`status`=?"); $values2bind[$i++] = $list_id; $bindTypes .= "s"; $sets->push("list_id=?"); $values2bind[$i++] = $entry_list_id; $bindTypes .= "s"; $sets->push("entry_list_id=?"); $values2bind[$i++] = $q->get("owner"); $bindTypes .= "s"; $sets->push("owner=?"); } $sql->add($sets->join(",")); $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, "")); $stmt1 = S::$my->stmt_init(); haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 277, "className" => "model.QC", "methodName" => "save"))); $success1 = $stmt1->prepare($sql->b); if (!$success1) { haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 281, "className" => "model.QC", "methodName" => "save"))); return false; } $success1 = myBindParam($stmt1, $values2bind, $bindTypes); haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 287, "className" => "model.QC", "methodName" => "save"))); if ($success1) { $success1 = $stmt1->execute(); if (!$success1) { haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 293, "className" => "model.QC", "methodName" => "save"))); return false; } else { return $this->saveLog($q, $log_id) !== false; } } return false; } } else { haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 306, "className" => "model.QC", "methodName" => "save"))); } return false; }
static function get() { $inlineSession = new ufront_web_session_InlineSessionMiddleware(); $uploadMiddleware = new ufront_web_upload_TmpFileUploadMiddleware(); return _hx_anonymous(array("indexController" => _hx_qtype("ufront.app.DefaultUfrontController"), "remotingApi" => null, "urlRewrite" => true, "basePath" => "/", "contentDirectory" => "../uf-content", "logFile" => null, "disableBrowserTrace" => false, "disableServerTrace" => false, "controllers" => CompileTimeClassList::get("null,true,ufront.web.Controller"), "apis" => CompileTimeClassList::get("null,true,ufront.api.UFApi"), "viewEngine" => _hx_qtype("ufront.view.FileViewEngine"), "templatingEngines" => ufront_view_TemplatingEngines::$all, "viewPath" => "view/", "defaultLayout" => null, "sessionImplementation" => _hx_qtype("ufront.web.session.FileSession"), "requestMiddleware" => new _hx_array(array($uploadMiddleware, $inlineSession)), "responseMiddleware" => new _hx_array(array($inlineSession, $uploadMiddleware)), "errorHandlers" => new _hx_array(array(new ufront_web_ErrorPageHandler())), "authImplementation" => _hx_qtype("ufront.auth.YesBossAuthHandler"))); }
static function isHash($o) { return Std::is($o, _hx_qtype("Hash")); }
public function isTable($t) { return Std::is($t, _hx_qtype("coopy.Table")); }
public function save($q) { $lead_id = Std::parseInt($q->get("lead_id")); $res = S::$my->query("INSERT INTO vicidial_lead_log SELECT * FROM (SELECT NULL AS log_id," . _hx_string_rec($lead_id, "") . " AS lead_id,NOW() AS entry_date) AS ll JOIN (SELECT modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM `vicidial_list`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS vl", null); $log_id = S::$my->insert_id; if ($log_id > 0) { $cTable = "custom_" . Std::string($q->get("entry_list_id")); haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . _hx_string_rec($log_id, ""), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 110, "className" => "model.QC", "methodName" => "save"))); if ($this->checkOrCreateCustomTable($cTable, null)) { $cLogTable = _hx_string_or_null($cTable) . "_log"; $res = S::$my->query("INSERT INTO " . _hx_string_or_null($cLogTable) . " SELECT * FROM (SELECT " . _hx_string_rec($log_id, "") . " AS log_id) AS ll JOIN (SELECT * FROM `" . _hx_string_or_null($cTable) . "`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS cl", null); haxe_Log::trace("INSERT INTO " . _hx_string_or_null($cLogTable) . " ..." . _hx_string_or_null(S::$my->error) . "<", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 117, "className" => "model.QC", "methodName" => "save"))); if (S::$my->error === "") { $primary_id = S::$my->real_escape_string($q->get("primary_id")); $sql = new StringBuf(); $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET "); $cFields = S::tableFields("" . _hx_string_or_null($cTable), null); haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 125, "className" => "model.QC", "methodName" => "save"))); $cFields->remove($primary_id); $bindTypes = ""; $values2bind = null; $i = 0; $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes"))); $sets = new _hx_array(array()); $_g = 0; while ($_g < $cFields->length) { $c = $cFields[$_g]; ++$_g; $val = $q->get($c); if ($val !== null) { if (Std::is($val, _hx_qtype("String"))) { $values2bind[$i++] = $val; } else { $values2bind[$i++] = $val[0]; } $type = $dbFieldTypes->get($c); if (Util::any2bool($type)) { $bindTypes .= _hx_string_or_null($type); } else { $bindTypes .= "s"; } $sets->push(_hx_string_or_null($c) . "=?"); unset($type); } unset($val, $c); } $sql->add($sets->join(",")); $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, "")); $stmt = S::$my->stmt_init(); haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 147, "className" => "model.QC", "methodName" => "save"))); $success = $stmt->prepare($sql->b); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 151, "className" => "model.QC", "methodName" => "save"))); return false; } $success = myBindParam($stmt, $values2bind, $bindTypes); haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 155, "className" => "model.QC", "methodName" => "save"))); if ($success) { $success = $stmt->execute(); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 161, "className" => "model.QC", "methodName" => "save"))); return false; } $sql = new StringBuf(); $uFields = model_QC::$vicdial_list_fields; $uFields->remove($primary_id); $bindTypes = ""; $values2bind = null; $i = 0; $sql->add("UPDATE vicidial_list SET "); $sets = new _hx_array(array()); $_g1 = 0; while ($_g1 < $uFields->length) { $c1 = $uFields[$_g1]; ++$_g1; $val1 = $q->get($c1); if ($val1 !== null) { if (Std::is($val1, _hx_qtype("String"))) { $values2bind[$i++] = $val1; } else { $values2bind[$i++] = $val1[0]; } $type1 = $dbFieldTypes->get($c1); if (Util::any2bool($type1)) { $bindTypes .= _hx_string_or_null($type1); } else { $bindTypes .= "s"; } $sets->push(_hx_string_or_null($c1) . "=?"); unset($type1); } unset($val1, $c1); } $values2bind[$i++] = S::$user; $bindTypes .= "s"; $sets->push("security_phrase=?"); if (_hx_equal($q->get("status"), "MITGL")) { $list_id = 10000; $mID = Std::parseInt($q->get("vendor_lead_code")); if ($mID === null) { $mID = S::newMemberID(); $values2bind[$i++] = $mID; $bindTypes .= "s"; $sets->push("vendor_lead_code=?"); } $entry_list_id = $q->get("entry_list_id"); $values2bind[$i++] = $q->get("status"); $bindTypes .= "s"; $sets->push("`status`=?"); $values2bind[$i++] = $list_id; $bindTypes .= "s"; $sets->push("list_id=?"); $values2bind[$i++] = $entry_list_id; $bindTypes .= "s"; $sets->push("entry_list_id=?"); $values2bind[$i++] = $q->get("user"); $bindTypes .= "s"; $sets->push("owner=?"); } $sql->add($sets->join(",")); $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, "")); $stmt1 = S::$my->stmt_init(); haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 216, "className" => "model.QC", "methodName" => "save"))); $success1 = $stmt1->prepare($sql->b); if (!$success1) { haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 220, "className" => "model.QC", "methodName" => "save"))); return false; } $success1 = myBindParam($stmt1, $values2bind, $bindTypes); haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 224, "className" => "model.QC", "methodName" => "save"))); if ($success1) { $success1 = $stmt1->execute(); if (!$success1) { haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 230, "className" => "model.QC", "methodName" => "save"))); return false; } return true; } return false; } } else { haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 240, "className" => "model.QC", "methodName" => "save"))); } } } return false; }
static function remotingError($error, $pos = null) { switch ($error->index) { case 0: $responseData = _hx_deref($error)->params[2]; $responseCode = _hx_deref($error)->params[1]; $remotingCallString = _hx_deref($error)->params[0]; return tink_core_TypedError::typed($responseCode, "HTTP " . _hx_string_rec($responseCode, "") . " Error during " . _hx_string_or_null($remotingCallString), $error, $pos); break; case 1: $errorMessage = _hx_deref($error)->params[1]; $remotingCallString1 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(404, "Remoting API " . _hx_string_or_null($remotingCallString1) . " not found: " . _hx_string_or_null($errorMessage), $error, $pos); break; case 2: $stack = _hx_deref($error)->params[2]; $e = _hx_deref($error)->params[1]; $remotingCallString2 = _hx_deref($error)->params[0]; $errorObj = Std::instance($e, _hx_qtype("tink.core.TypedError")); if ($errorObj !== null) { return tink_core_TypedError::typed($errorObj->code, $errorObj->message, $error, $pos); } else { return tink_core_TypedError::typed(500, "Internal Server Error while executing " . _hx_string_or_null($remotingCallString2), $error, $pos); } break; case 3: $e1 = _hx_deref($error)->params[1]; $remotingCallString3 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(500, "Error during callback after " . _hx_string_or_null($remotingCallString3) . ": " . Std::string($e1), $error, $pos); break; case 4: $err = _hx_deref($error)->params[2]; $troubleLine = _hx_deref($error)->params[1]; $remotingCallString4 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(422, "Remoting serialization failed for call " . _hx_string_or_null($remotingCallString4) . ": could not process " . _hx_string_or_null($troubleLine), $error, $pos); break; case 5: $responseData1 = _hx_deref($error)->params[1]; $remotingCallString5 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(500, "Error with response for " . _hx_string_or_null($remotingCallString5) . ": no remoting response found", $error, $pos); break; case 6: $data = _hx_deref($error)->params[1]; $remotingCallString6 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(500, "Call to " . _hx_string_or_null($remotingCallString6) . " failed: " . Std::string($data), $error, $pos); break; case 7: $e2 = _hx_deref($error)->params[0]; return tink_core_TypedError::typed(500, "Unknown exception during remoting call", $error, $pos); break; } }
static function compare($a, $b, $eps) { if (com_wiris_system_TypeTools::isHash($a)) { $isBHash = com_wiris_system_TypeTools::isHash($b); if (!$isBHash) { return false; } $ha = $a; $hb = $b; $it = $ha->keys(); while ($it->hasNext()) { $key = $it->next(); if (!$hb->exists($key) || !com_wiris_util_json_JSon::compare($ha->get($key), $hb->get($key), $eps)) { return false; } unset($key); } return true; } else { if (com_wiris_system_TypeTools::isArray($a)) { $isBArray = com_wiris_system_TypeTools::isArray($b); if (!$isBArray) { return false; } $aa = $a; $ab = $b; if ($aa->length !== $ab->length) { return false; } $i = null; $_g1 = 0; $_g = $aa->length; while ($_g1 < $_g) { $i1 = $_g1++; if (!com_wiris_util_json_JSon::compare($aa[$i1], $ab[$i1], $eps)) { return false; } unset($i1); } return true; } else { if (Std::is($a, _hx_qtype("String"))) { if (!Std::is($b, _hx_qtype("String"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("Int"))) { if (!Std::is($b, _hx_qtype("Int"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("haxe.Int64"))) { $isBLong = Std::is($b, _hx_qtype("haxe.Int64")); if (!$isBLong) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) { if (!Std::is($b, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) { return false; } $ja = $a; $jb = $b; return $ja->toString() === $jb->toString(); } else { if (Std::is($a, _hx_qtype("Bool"))) { if (!Std::is($b, _hx_qtype("Bool"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("Float"))) { if (!Std::is($b, _hx_qtype("Float"))) { return false; } $da = com_wiris_util_json_JSon::getFloat($a); $db = com_wiris_util_json_JSon::getFloat($b); return $da >= $db - $eps && $da <= $db + $eps; } } } } } } } } return true; }
public function serialize($v) { $_g = Type::typeof($v); switch ($_g->index) { case 0: $this->buf->add("n"); break; case 1: $v1 = $v; if ($v1 === 0) { $this->buf->add("z"); return; } $this->buf->add("i"); $this->buf->add($v1); break; case 2: $v2 = $v; if (Math::isNaN($v2)) { $this->buf->add("k"); } else { if (!Math::isFinite($v2)) { $this->buf->add($v2 < 0 ? "m" : "p"); } else { $this->buf->add("d"); $this->buf->add($v2); } } break; case 3: $this->buf->add($v ? "t" : "f"); break; case 6: $c = _hx_deref($_g)->params[0]; if (is_object($_t = $c) && !$_t instanceof Enum ? $_t === _hx_qtype("String") : $_t == _hx_qtype("String")) { $this->serializeString($v); return; } if ($this->useCache && $this->serializeRef($v)) { return; } switch ($c) { case _hx_qtype("Array"): $ucount = 0; $this->buf->add("a"); $l = _hx_len($v); $_g1 = 0; while ($_g1 < $l) { $i = $_g1++; if ($v[$i] === null) { $ucount++; } else { if ($ucount > 0) { if ($ucount === 1) { $this->buf->add("n"); } else { $this->buf->add("u"); $this->buf->add($ucount); } $ucount = 0; } $this->serialize($v[$i]); } unset($i); } if ($ucount > 0) { if ($ucount === 1) { $this->buf->add("n"); } else { $this->buf->add("u"); $this->buf->add($ucount); } } $this->buf->add("h"); break; case _hx_qtype("List"): $this->buf->add("l"); $v3 = $v; if (null == $v3) { throw new HException('null iterable'); } $__hx__it = $v3->iterator(); while ($__hx__it->hasNext()) { unset($i1); $i1 = $__hx__it->next(); $this->serialize($i1); } $this->buf->add("h"); break; case _hx_qtype("Date"): $d = $v; $this->buf->add("v"); $this->buf->add($d->getTime()); break; case _hx_qtype("haxe.ds.StringMap"): $this->buf->add("b"); $v4 = $v; if (null == $v4) { throw new HException('null iterable'); } $__hx__it = $v4->keys(); while ($__hx__it->hasNext()) { unset($k); $k = $__hx__it->next(); $this->serializeString($k); $this->serialize($v4->get($k)); } $this->buf->add("h"); break; case _hx_qtype("haxe.ds.IntMap"): $this->buf->add("q"); $v5 = $v; if (null == $v5) { throw new HException('null iterable'); } $__hx__it = $v5->keys(); while ($__hx__it->hasNext()) { unset($k1); $k1 = $__hx__it->next(); $this->buf->add(":"); $this->buf->add($k1); $this->serialize($v5->get($k1)); } $this->buf->add("h"); break; case _hx_qtype("haxe.ds.ObjectMap"): $this->buf->add("M"); $v6 = $v; $__hx__it = new _hx_array_iterator(array_values($v6->hk)); while ($__hx__it->hasNext()) { unset($k2); $k2 = $__hx__it->next(); $this->serialize($k2); $this->serialize($v6->get($k2)); } $this->buf->add("h"); break; case _hx_qtype("haxe.io.Bytes"): $v7 = $v; $i2 = 0; $max = $v7->length - 2; $charsBuf = new StringBuf(); $b64 = haxe_Serializer::$BASE64; while ($i2 < $max) { $b1 = null; $pos = $i2++; $b1 = ord($v7->b[$pos]); unset($pos); $b2 = null; $pos1 = $i2++; $b2 = ord($v7->b[$pos1]); unset($pos1); $b3 = null; $pos2 = $i2++; $b3 = ord($v7->b[$pos2]); unset($pos2); $charsBuf->add(_hx_char_at($b64, $b1 >> 2)); $charsBuf->add(_hx_char_at($b64, ($b1 << 4 | $b2 >> 4) & 63)); $charsBuf->add(_hx_char_at($b64, ($b2 << 2 | $b3 >> 6) & 63)); $charsBuf->add(_hx_char_at($b64, $b3 & 63)); unset($b3, $b2, $b1); } if ($i2 === $max) { $b11 = null; $pos3 = $i2++; $b11 = ord($v7->b[$pos3]); $b21 = null; $pos4 = $i2++; $b21 = ord($v7->b[$pos4]); $charsBuf->add(_hx_char_at($b64, $b11 >> 2)); $charsBuf->add(_hx_char_at($b64, ($b11 << 4 | $b21 >> 4) & 63)); $charsBuf->add(_hx_char_at($b64, $b21 << 2 & 63)); } else { if ($i2 === $max + 1) { $b12 = null; $pos5 = $i2++; $b12 = ord($v7->b[$pos5]); $charsBuf->add(_hx_char_at($b64, $b12 >> 2)); $charsBuf->add(_hx_char_at($b64, $b12 << 4 & 63)); } } $chars = $charsBuf->b; $this->buf->add("s"); $this->buf->add(strlen($chars)); $this->buf->add(":"); $this->buf->add($chars); break; default: if ($this->useCache) { $this->cache->pop(); } if (_hx_field($v, "hxSerialize") !== null) { $this->buf->add("C"); $this->serializeString(Type::getClassName($c)); if ($this->useCache) { $this->cache->push($v); } $v->hxSerialize($this); $this->buf->add("g"); } else { $this->buf->add("c"); $this->serializeString(Type::getClassName($c)); if ($this->useCache) { $this->cache->push($v); } $this->serializeFields($v); } break; } break; case 4: if (Std::is($v, _hx_qtype("Class"))) { $className = Type::getClassName($v); $this->buf->add("A"); $this->serializeString($className); } else { if (Std::is($v, _hx_qtype("Enum"))) { $this->buf->add("B"); $this->serializeString(Type::getEnumName($v)); } else { if ($this->useCache && $this->serializeRef($v)) { return; } $this->buf->add("o"); $this->serializeFields($v); } } break; case 7: $e = _hx_deref($_g)->params[0]; if ($this->useCache) { if ($this->serializeRef($v)) { return; } $this->cache->pop(); } $this->buf->add($this->useEnumIndex ? "j" : "w"); $this->serializeString(Type::getEnumName($e)); if ($this->useEnumIndex) { $this->buf->add(":"); $this->buf->add($v->index); } else { $this->serializeString($v->tag); } $this->buf->add(":"); $l1 = count($v->params); if ($l1 === 0 || _hx_field($v, "params") === null) { $this->buf->add(0); } else { $this->buf->add($l1); $_g11 = 0; while ($_g11 < $l1) { $i3 = $_g11++; $this->serialize($v->params[$i3]); unset($i3); } } if ($this->useCache) { $this->cache->push($v); } break; case 5: throw new HException("Cannot serialize function"); break; default: throw new HException("Cannot serialize " . Std::string($v)); break; } }
static function getValueType($value) { if (Std::is($value, _hx_qtype("String"))) { return "String"; } if (Std::is($value, _hx_qtype("Class"))) { return Type::getClassName($value); } if (Std::is($value, _hx_qtype("Enum"))) { return Type::getEnumName($value); } $name = null; $_g = Type::typeof($value); switch ($_g->index) { case 1: $name = "Int"; break; case 3: $name = "Bool"; break; case 6: $c = _hx_deref($_g)->params[0]; $name = Type::getClassName($c); break; case 7: $e = _hx_deref($_g)->params[0]; $name = Type::getEnumName($e); break; default: $name = null; break; } if ($name !== null) { return $name; } throw new HException("Could not determine type name of " . Std::string($value)); }
public function write($k, $v) { if ($this->replacer !== null) { $v = $this->replacer($k, $v); } $_g = Type::typeof($v); switch ($_g->index) { case 8: $this->buf->add("\"???\""); break; case 4: $this->fieldsString($v, Reflect::fields($v)); break; case 1: $v1 = $v; $this->buf->add($v1); break; case 2: $v2 = null; if (Math::isFinite($v)) { $v2 = $v; } else { $v2 = "null"; } $this->buf->add($v2); break; case 5: $this->buf->add("\"<fun>\""); break; case 6: $c = _hx_deref($_g)->params[0]; if (is_object($_t = $c) && !$_t instanceof Enum ? $_t === _hx_qtype("String") : $_t == _hx_qtype("String")) { $this->quote($v); } else { if (is_object($_t2 = $c) && !$_t2 instanceof Enum ? $_t2 === _hx_qtype("Array") : $_t2 == _hx_qtype("Array")) { $v3 = $v; $this->buf->b .= "["; $len = $v3->length; $last = $len - 1; $_g1 = 0; while ($_g1 < $len) { $i = $_g1++; if ($i > 0) { $this->buf->b .= ","; } else { $this->nind++; } if ($this->pretty) { $this->buf->b .= "\n"; } if ($this->pretty) { $v4 = null; $c1 = $this->indent; $l = $this->nind * strlen($this->indent); if (strlen($c1) === 0 || strlen("") >= $l) { $v4 = ""; } else { $v4 = str_pad("", Math::ceil(($l - strlen("")) / strlen($c1)) * strlen($c1) + strlen(""), $c1, STR_PAD_LEFT); } unset($l, $c1); $this->buf->add($v4); unset($v4); } $this->write($i, $v3[$i]); if ($i === $last) { $this->nind--; if ($this->pretty) { $this->buf->b .= "\n"; } if ($this->pretty) { $v5 = null; $c2 = $this->indent; $l1 = $this->nind * strlen($this->indent); if (strlen($c2) === 0 || strlen("") >= $l1) { $v5 = ""; } else { $v5 = str_pad("", Math::ceil(($l1 - strlen("")) / strlen($c2)) * strlen($c2) + strlen(""), $c2, STR_PAD_LEFT); } unset($l1, $c2); $this->buf->add($v5); unset($v5); } } unset($i); } $this->buf->b .= "]"; } else { if (is_object($_t3 = $c) && !$_t3 instanceof Enum ? $_t3 === _hx_qtype("haxe.ds.StringMap") : $_t3 == _hx_qtype("haxe.ds.StringMap")) { $v6 = $v; $o = _hx_anonymous(array()); if (null == $v6) { throw new HException('null iterable'); } $__hx__it = $v6->keys(); while ($__hx__it->hasNext()) { unset($k1); $k1 = $__hx__it->next(); $value = $v6->get($k1); $o->{$k1} = $value; unset($value); } $this->fieldsString($o, Reflect::fields($o)); } else { if (is_object($_t4 = $c) && !$_t4 instanceof Enum ? $_t4 === _hx_qtype("Date") : $_t4 == _hx_qtype("Date")) { $v7 = $v; $this->quote($v7->toString()); } else { $this->fieldsString($v, Reflect::fields($v)); } } } } break; case 7: $i1 = null; $e = $v; $i1 = $e->index; $v8 = $i1; $this->buf->add($v8); break; case 3: $this->buf->add($v ? "true" : "false"); break; case 0: $this->buf->add("null"); break; } }