static function formatMessage($m) { $type = null; $_g = $m->type; switch ($_g->index) { case 0: $type = "log"; break; case 1: $type = "info"; break; case 2: $type = "warn"; break; case 3: $type = "error"; break; } $extras = null; if (_hx_field($m, "pos") !== null && $m->pos->customParams !== null) { $extras = ", " . _hx_string_or_null($m->pos->customParams->join(", ")); } else { $extras = ""; } $msg = "" . _hx_string_or_null($m->pos->className) . "." . _hx_string_or_null($m->pos->methodName) . "(" . _hx_string_rec($m->pos->lineNumber, "") . "): " . Std::string($m->msg) . _hx_string_or_null($extras); return "console." . _hx_string_or_null($type) . "(decodeURIComponent(\"" . _hx_string_or_null(rawurlencode($msg)) . "\"))"; }
public function toString() { $ret = "Error: " . _hx_string_or_null($this->message); if (_hx_field($this, "pos") !== null) { $ret .= " " . _hx_string_or_null($this->printPos()); } return $ret; }
static function getFields($t) { $meta = $t->__meta__; if ($meta === null || _hx_field($meta, "fields") === null) { return _hx_anonymous(array()); } else { return $meta->fields; } }
static function getFields($t) { $meta = haxe_rtti_Meta::getMeta($t); if ($meta === null || _hx_field($meta, "fields") === null) { return _hx_anonymous(array()); } else { return $meta->fields; } }
static function formatMsg($m) { $extras = null; if (_hx_field($m, "pos") !== null && $m->pos->customParams !== null) { $extras = ", " . _hx_string_or_null($m->pos->customParams->join(", ")); } else { $extras = ""; } $type = _hx_substr(Type::enumConstructor($m->type), 1, null); return "" . _hx_string_or_null($type) . ": " . _hx_string_or_null($m->pos->className) . "." . _hx_string_or_null($m->pos->methodName) . "(" . _hx_string_rec($m->pos->lineNumber, "") . "): " . Std::string($m->msg) . _hx_string_or_null($extras); }
public function __construct($h, $obj, $methodName) { if (!php_Boot::$skip_constructor) { $this->h = $h; $this->obj = $obj; $this->method = Reflect::field($obj, $methodName); if (_hx_field($this, "method") === null) { throw new HException("Method not found: " . $methodName); } $h->setListener($this); } }
public function next() { if (_hx_field($this, "cache") !== null) { $t = $this->cache; $this->cache = null; return $t; } if (!$this->fetchRow()) { return null; } return _hx_anonymous($this->cRow); }
public function getMsg() { if(_hx_field($this, "msg") === null) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $a = $db->quoteName((new _hx_array(array("id", "name", "details", "enabled")))); $query->select($a); $query->from("#__joomlahaxe"); $query->order("'ordering ASC'"); $db->setQuery($query); $this->msg = $db->loadObjectList(); } return $this->msg; }
public function __construct($obj, $name, $errorName) { if (!php_Boot::$skip_constructor) { $this->method = Reflect::field($obj, $name); if (_hx_field($this, "method") === null) { throw new HException("Method not found: " . $name); } $this->errorMethod = Reflect::field($obj, $errorName); if (_hx_field($this, "errorMethod") === null) { throw new HException("Method not found: " . $errorName); } $this->obj = $obj; } }
public function handleError($httpError, $ctx) { $callStack = ""; $inner = null; if ($httpError !== null && _hx_field($httpError, "data") !== null) { $inner = " (" . Std::string($httpError->data) . ")"; } else { $inner = ""; } $ctx->messages->push(_hx_anonymous(array("msg" => "Handling error: " . Std::string($httpError) . _hx_string_or_null($inner) . " " . _hx_string_or_null($callStack), "pos" => _hx_anonymous(array("fileName" => "ErrorPageHandler.hx", "lineNumber" => 36, "className" => "ufront.web.ErrorPageHandler", "methodName" => "handleError")), "type" => ufront_log_MessageType::$MError))); if (!(($ctx->completion & 1 << ufront_web_context_RequestCompletion::$CRequestHandlersComplete->index) !== 0)) { $showStack = false; $ctx->response->clear(); $ctx->response->status = $httpError->code; $ctx->response->set_contentType("text/html"); $ctx->response->write($this->renderError($httpError, $showStack)); $ctx->completion |= 1 << ufront_web_context_RequestCompletion::$CRequestHandlersComplete->index; } if (!$this->catchErrors) { $httpError->throwSelf(); } return ufront_core_SurpriseTools::success(); }
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)); } }
static function field($o, $field) { return _hx_field($o, $field); }
function ufront_web_UserAgent_0(&$_g, &$d, &$data, &$s) { if (_hx_field($d, "versionSearch") === null) { return $d->identity; } else { return $d->versionSearch; } }
public function run($e) { $»t = $e; switch ($»t->index) { case 0: $v = $»t->params[0]; $this->buf->b .= Std::string($this->resolve($v)); break; case 1: $e1 = $»t->params[0]; $this->buf->b .= Std::string(call_user_func_array($e1, array())); break; case 2: $eelse = $»t->params[2]; $eif = $»t->params[1]; $e12 = $»t->params[0]; $v2 = call_user_func_array($e12, array()); if ($v2 === null || _hx_equal($v2, false)) { if ($eelse !== null) { $this->run($eelse); } } else { $this->run($eif); } break; case 3: $str = $»t->params[0]; $this->buf->b .= $str; break; case 4: $l = $»t->params[0]; $»it = $l->iterator(); while ($»it->hasNext()) { $e13 = $»it->next(); $this->run($e13); } break; case 5: $loop = $»t->params[1]; $e14 = $»t->params[0]; $v3 = call_user_func_array($e14, array()); try { if (_hx_field($v3, "hasNext") === null) { $x = $v3->iterator(); if (_hx_field($x, "hasNext") === null) { throw new HException(null); } $v3 = $x; } } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e2 = $_ex_; throw new HException("Cannot iter on " . $v3); } $this->stack->push($this->context); $v1 = $v3; $»it2 = $v1; while ($»it2->hasNext()) { $ctx = $»it2->next(); $this->context = $ctx; $this->run($loop); } $this->context = $this->stack->pop(); break; case 6: $params = $»t->params[1]; $m = $»t->params[0]; $v4 = Reflect::field($this->macros, $m); $pl = new _hx_array(array()); $old = $this->buf; $pl->push(isset($this->resolve) ? $this->resolve : array($this, "resolve")); $»it3 = $params->iterator(); while ($»it3->hasNext()) { $p = $»it3->next(); $»t2 = $p; switch ($»t2->index) { case 0: $v12 = $»t2->params[0]; $pl->push($this->resolve($v12)); break; default: $this->buf = new StringBuf(); $this->run($p); $pl->push($this->buf->b); break; } unset($»t2, $v12); } $this->buf = $old; try { $this->buf->b .= Std::string(Reflect::callMethod($this->macros, $v4, $pl)); } catch (Exception $»e2) { $_ex_2 = $»e2 instanceof HException ? $»e2->e : $»e2; $e15 = $_ex_2; $plstr = eval("if(isset(\$this)) \$»this =& \$this;try {\n\t\t\t\t\t\t\$»r = \$pl->join(\",\");\n\t\t\t\t\t}catch(Exception \$»e3) {\n\t\t\t\t\t\$_ex_3 = (\$»e3 instanceof HException) ? \$»e3->e : \$»e3;\n\t\t\t\t\t;\n\t\t\t\t\t{ \$e22 = \$_ex_3;\n\t\t\t\t\t{\n\t\t\t\t\t\t\$»r = \"???\";\n\t\t\t\t\t}}}\n\t\t\t\t\treturn \$»r;\n\t\t\t\t"); $msg = "Macro call " . $m . "(" . $plstr . ") failed (" . Std::string($e15) . ")"; throw new HException($msg); } break; } }
public function get_authorization() { if (_hx_field($this, "authorization") === null) { $this->authorization = php_Web::getAuthorization(); if (_hx_field($this, "authorization") === null) { $this->authorization = _hx_anonymous(array("user" => null, "pass" => null)); } } return $this->authorization; }
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 enumParameters($e) { if (_hx_field($e, "params") === null) { return new _hx_array(array()); } else { return new _hx_array($e->params); } }
public function next() { if (_hx_field($this, "cache") !== null) { $t = $this->cache; $this->cache = null; return $t; } if (!$this->fetchRow()) { return null; } $o = _hx_anonymous(array()); $descriptions = $this->getFieldsDescription(); $_g1 = 0; $_g = $this->getNFields(); while ($_g1 < $_g) { $i = $_g1++; $o->{_hx_array_get($descriptions, $i)->name} = $this->convert($this->cRow[$i], _hx_array_get($descriptions, $i)->type); unset($i); } return $o; }
public function run($e) { switch ($e->index) { case 0: $v = _hx_deref($e)->params[0]; $this->buf->add(Std::string($this->resolve($v))); break; case 1: $e1 = _hx_deref($e)->params[0]; $this->buf->add(Std::string(call_user_func($e1))); break; case 2: $eelse = _hx_deref($e)->params[2]; $eif = _hx_deref($e)->params[1]; $e2 = _hx_deref($e)->params[0]; $v1 = call_user_func($e2); if ($v1 === null || _hx_equal($v1, false)) { if ($eelse !== null) { $this->run($eelse); } } else { $this->run($eif); } break; case 3: $str = _hx_deref($e)->params[0]; $this->buf->add($str); break; case 4: $l = _hx_deref($e)->params[0]; if (null == $l) { throw new HException('null iterable'); } $__hx__it = $l->iterator(); while ($__hx__it->hasNext()) { unset($e3); $e3 = $__hx__it->next(); $this->run($e3); } break; case 5: $loop = _hx_deref($e)->params[1]; $e4 = _hx_deref($e)->params[0]; $v2 = call_user_func($e4); try { $x = $v2->iterator(); if (_hx_field($x, "hasNext") === null) { throw new HException(null); } $v2 = $x; } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e5 = $_ex_; try { if (_hx_field($v2, "hasNext") === null) { throw new HException(null); } } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e6 = $_ex_; throw new HException("Cannot iter on " . Std::string($v2)); } } $this->stack->push($this->context); $v3 = $v2; $__hx__it = $v3; while ($__hx__it->hasNext()) { unset($ctx); $ctx = $__hx__it->next(); $this->context = $ctx; $this->run($loop); } $this->context = $this->stack->pop(); break; case 6: $params = _hx_deref($e)->params[1]; $m = _hx_deref($e)->params[0]; $v4 = Reflect::field($this->macros, $m); $pl = new _hx_array(array()); $old = $this->buf; $pl->push(isset($this->resolve) ? $this->resolve : array($this, "resolve")); if (null == $params) { throw new HException('null iterable'); } $__hx__it = $params->iterator(); while ($__hx__it->hasNext()) { unset($p); $p = $__hx__it->next(); switch ($p->index) { case 0: $v5 = _hx_deref($p)->params[0]; $pl->push($this->resolve($v5)); break; default: $this->buf = new StringBuf(); $this->run($p); $pl->push($this->buf->b); break; } } $this->buf = $old; try { $this->buf->add(Std::string(Reflect::callMethod($this->macros, $v4, $pl))); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e7 = $_ex_; $plstr = null; try { $plstr = $pl->join(","); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e8 = $_ex_; $plstr = "???"; } $msg = "Macro call " . _hx_string_or_null($m) . "(" . _hx_string_or_null($plstr) . ") failed (" . Std::string($e7) . ")"; throw new HException($msg); } break; } }