public function glob()
 {
     $reg = "^";
     $chars = _hx_explode("", $this->str);
     $ch = "";
     $wild = 0;
     $single = 0;
     $or = false;
     while (true) {
         switch ($ch) {
             case "*":
                 $wild++;
                 break;
             case "?":
                 $single++;
                 break;
             case "{":
                 $reg .= "(?:";
                 $or = true;
                 break;
             case ",":
                 if ($or) {
                     $reg .= "|";
                 } else {
                     $reg .= $ch;
                 }
                 break;
             case "}":
                 $reg .= ")";
                 $or = false;
                 break;
             default:
                 if ($single > 0) {
                     $reg .= "[^/]{" . $single . "}";
                     $single = 0;
                 } else {
                     if ($wild === 1) {
                         $reg .= "[^/]*";
                         $wild = 0;
                     } else {
                         if ($wild === 2) {
                             $reg .= ".*";
                             $wild = 0;
                         }
                     }
                 }
                 if ($ch !== null) {
                     $reg .= $ch;
                 }
                 break;
         }
         if ($ch === null) {
             break;
         }
         $ch = $chars->shift();
     }
     $reg .= "\$";
     haxe_Log::trace("(glob) From pattern: " . $this->str . " we created expression: " . $reg, _hx_anonymous(array("fileName" => "Route.hx", "lineNumber" => 211, "className" => "sinatra.RouteParser", "methodName" => "glob")));
     return new EReg($reg, "");
 }
Exemple #2
0
 static function escapeArgument($arg)
 {
     $ok = true;
     $_g1 = 0;
     $_g = strlen($arg);
     while ($_g1 < $_g) {
         $i = $_g1++;
         switch (_hx_char_code_at($arg, $i)) {
             case 32:
             case 34:
                 $ok = false;
                 break;
             case 0:
             case 13:
             case 10:
                 $arg = _hx_substr($arg, 0, $i);
                 break;
         }
         unset($i);
     }
     if ($ok) {
         return $arg;
     }
     return "\"" . _hx_explode("\"", $arg)->join("\\\"") . "\"";
 }
 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);
         }
     }
 }
Exemple #4
0
 public function decode_route()
 {
     $this->params = new _hx_array(array());
     if (system_base_Router::$regexp->match($this->query_string)) {
         throw new HException(new system_base_Http_exception("Illegal character(s) in URI: " . _hx_string_or_null($this->query_string), 400, _hx_anonymous(array("fileName" => "Router.hx", "lineNumber" => 119, "className" => "system.base.Router", "methodName" => "decode_route"))));
     }
     if (strlen($this->query_string) === 0) {
         $this->controller = system_base_Router::$FRONT_CONTROLLER;
         $s = strtolower($this->controller);
         $this->controller = _hx_string_or_null(strtoupper(_hx_substr($s, 0, 1))) . _hx_string_or_null(_hx_substr($s, 1, null));
         $this->method = strtolower(system_base_Router::$DEFAULT_METHOD);
         $this->query_string = _hx_string_or_null($this->controller) . "/" . _hx_string_or_null($this->method);
         return true;
     }
     if (_hx_index_of($this->query_string, "/", null) === -1) {
         $this->params->push(strtolower($this->query_string));
     } else {
         $this->params = _hx_explode("/", strtolower($this->query_string));
     }
     if ($this->params[0] !== null && strlen($this->params[0]) > 0) {
         $s1 = $this->params[0];
         $this->controller = _hx_string_or_null(strtoupper(_hx_substr($s1, 0, 1))) . _hx_string_or_null(_hx_substr($s1, 1, null));
     } else {
         $this->controller = system_base_Router::$FRONT_CONTROLLER;
     }
     if ($this->params[1] !== null && strlen($this->params[0]) > 0) {
         $this->method = $this->params[1];
     } else {
         $this->method = system_base_Router::$DEFAULT_METHOD;
     }
     if ($this->controller === "_load") {
         return false;
     }
     return true;
 }
Exemple #5
0
 public function doJoin($q, $sb, $phValues)
 {
     $fields = $q->get("fields");
     $sb->add("SELECT " . _hx_string_or_null($fields !== null ? $this->fieldFormat(_hx_explode(",", $fields)->map(array(new _hx_lambda(array(&$fields, &$phValues, &$q, &$sb), "model_Clients_0"), 'execute'))->join(",")) : "*"));
     $qTable = null;
     if (Util::any2bool($q->get("table"))) {
         $qTable = $q->get("table");
     } else {
         $qTable = $this->table;
     }
     $joinCond = null;
     if (Util::any2bool($q->get("joincond"))) {
         $joinCond = $q->get("joincond");
     } else {
         $joinCond = null;
     }
     $joinTable = null;
     if (Util::any2bool($q->get("jointable"))) {
         $joinTable = $q->get("jointable");
     } else {
         $joinTable = null;
     }
     $filterTables = "";
     if (Util::any2bool($q->get("filter"))) {
         $filterTables = _hx_explode(",", $q->get("filter_tables"))->map(array(new _hx_lambda(array(&$fields, &$filterTables, &$joinCond, &$joinTable, &$phValues, &$q, &$qTable, &$sb), "model_Clients_1"), 'execute'))->join(",");
         $sb->add(" FROM " . _hx_string_or_null($filterTables) . "," . _hx_string_or_null(S::$my->real_escape_string($qTable)));
     } else {
         $sb->add(" FROM " . _hx_string_or_null(S::$my->real_escape_string($qTable)));
     }
     if ($joinTable !== null) {
         $sb->add(" INNER JOIN " . _hx_string_or_null($joinTable));
     }
     if ($joinCond !== null) {
         $sb->add(" ON " . _hx_string_or_null($joinCond));
     }
     $where = $q->get("where");
     if ($where !== null) {
         $this->buildCond($where, $sb, $phValues, null);
     }
     if (Util::any2bool($q->get("filter"))) {
         $this->buildCond(_hx_explode(",", $q->get("filter"))->map(array(new _hx_lambda(array(&$fields, &$filterTables, &$joinCond, &$joinTable, &$phValues, &$q, &$qTable, &$sb, &$where), "model_Clients_2"), 'execute'))->join(","), $sb, $phValues, false);
         if ($joinTable === "vicidial_users") {
             $sb->add(" " . _hx_string_or_null(_hx_explode(",", $filterTables)->map(array(new _hx_lambda(array(&$fields, &$filterTables, &$joinCond, &$joinTable, &$phValues, &$q, &$qTable, &$sb, &$where), "model_Clients_3"), 'execute'))->join(" ")));
         } else {
             $sb->add(" " . _hx_string_or_null(_hx_explode(",", $filterTables)->map(array(new _hx_lambda(array(&$fields, &$filterTables, &$joinCond, &$joinTable, &$phValues, &$q, &$qTable, &$sb, &$where), "model_Clients_4"), 'execute'))->join(" ")));
         }
     }
     $groupParam = $q->get("group");
     if ($groupParam !== null) {
         $this->buildGroup($groupParam, $sb);
     }
     $order = $q->get("order");
     if ($order !== null) {
         $this->buildOrder($order, $sb);
     }
     $limit = $q->get("limit");
     $this->buildLimit($limit === null ? "15" : $limit, $sb);
     return $this->execute($sb->b, $phValues);
 }
 static function errorStackItems($stack)
 {
     $arr = new _hx_array(array());
     $stack->pop();
     $stack = $stack->slice(2, null);
     $arr1 = _hx_explode("\n", haxe_CallStack::toString($stack));
     return $arr1;
 }
 static function htmlEscape($s, $quotes = null)
 {
     $s = _hx_explode(">", _hx_explode("<", _hx_explode("&", $s)->join("&amp;"))->join("&lt;"))->join("&gt;");
     if ($quotes) {
         return _hx_explode("'", _hx_explode("\"", $s)->join("&quot;"))->join("&#039;");
     } else {
         return $s;
     }
 }
 public function hpOfString($s)
 {
     $parts = _hx_explode(":", $s);
     if ($parts->length === 2) {
         return _hx_anonymous(array("host" => new sys_net_Host($parts[0]), "port" => Std::parseInt($parts[1])));
     } else {
         return _hx_anonymous(array("host" => new sys_net_Host(_hx_substr($parts[1], 2, null)), "port" => Std::parseInt($parts[2])));
     }
 }
 public function get_uriParts()
 {
     if ($this->uriParts === null) {
         $this->uriParts = _hx_explode("/", $this->httpContext->getRequestUri());
         if ($this->uriParts->length > 0 && $this->uriParts[0] === "") {
             $this->uriParts->shift();
         }
         if ($this->uriParts->length > 0 && $this->uriParts[$this->uriParts->length - 1] === "") {
             $this->uriParts->pop();
         }
     }
     return $this->uriParts;
 }
 public function __construct($r, $opt)
 {
     if (!php_Boot::$skip_constructor) {
         $this->pattern = $r;
         $a = _hx_explode("g", $opt);
         $this->hglobal = $a->length > 1;
         if ($this->hglobal) {
             $opt = $a->join("");
         }
         $this->options = $opt;
         $this->re = '"' . str_replace('"', '\\"', $r) . '"' . $opt;
     }
 }
Exemple #11
0
 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;
 }
Exemple #12
0
 public function __construct($name)
 {
     if (!php_Boot::$skip_constructor) {
         if (_hx_deref(new EReg("^(\\d{1,3}\\.){3}\\d{1,3}\$", ""))->match($name)) {
             $this->_ip = $name;
         } else {
             $this->_ip = gethostbyname($name);
             if ($this->_ip === $name) {
                 $this->ip = 0;
                 return;
             }
         }
         $p = _hx_explode(".", $this->_ip);
         $this->ip = intval(sprintf("%02X%02X%02X%02X", $p[3], $p[2], $p[1], $p[0]), 16);
     }
 }
 public function __construct($directory)
 {
     if (!php_Boot::$skip_constructor) {
         if (StringTools::startsWith($directory, "/")) {
             $directory = _hx_substr($directory, 1, strlen($directory));
         }
         if (StringTools::endsWith($directory, "/")) {
             $directory = _hx_substr($directory, 0, strlen($directory) - 1);
         }
         $this->directory = $directory;
         if ($directory !== "") {
             $this->segments = _hx_explode("/", $directory);
         } else {
             $this->segments = new _hx_array(array());
         }
     }
 }
 public function getAvailableCASLanguages($languageString)
 {
     $elem = null;
     $langs = _hx_explode(",", $languageString);
     $availableLanguages = new _hx_array(array());
     $iter = $langs->iterator();
     while ($iter->hasNext()) {
         $elem = $iter->next();
         $elem = trim($elem);
         $availableLanguages->push($elem);
     }
     if ($availableLanguages->length === 0) {
         $availableLanguages = new _hx_array(array());
         $availableLanguages->push("");
     }
     return $availableLanguages;
 }
 public function addCorsHeaders($response, $origin)
 {
     $conf = $this->getConfiguration();
     if ($conf->getProperty("wiriscorsenabled", "false") === "true") {
         $confDir = $conf->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CONFIGURATION_PATH, null);
         $corsConfFile = $confDir . "/corsservers.ini";
         $s = com_wiris_system_Storage::newStorage($corsConfFile);
         if ($s->exists()) {
             $dir = $s->read();
             $allowedHosts = _hx_explode("\n", $dir);
             if (com_wiris_system_ArrayEx::contains($allowedHosts, $origin)) {
                 $response->setHeader("Access-Control-Allow-Origin", $origin);
             }
         } else {
             $response->setHeader("Access-Control-Allow-Origin", "*");
         }
     }
 }
Exemple #16
0
 static function load($cjs)
 {
     $js = file_get_contents($cjs);
     $vars = _hx_explode("var", $js);
     $vars->shift();
     $result = new haxe_ds_StringMap();
     haxe_Log::trace($vars->length, _hx_anonymous(array("fileName" => "Config.hx", "lineNumber" => 20, "className" => "Config", "methodName" => "load")));
     $jsonS = new Services_JSON(48);
     $_g = 0;
     while ($_g < $vars->length) {
         $v = $vars[$_g];
         ++$_g;
         $data = _hx_explode("=", $v);
         $json = $jsonS->decode($data[1]);
         $result->set(trim($data[0]), $json);
         unset($v, $json, $data);
     }
     return $result;
 }
Exemple #17
0
 static function escapeArgument($arg)
 {
     $ok = true;
     $_g1 = 0;
     $_g = strlen($arg);
     while ($_g1 < $_g) {
         $i = $_g1++;
         $_g2 = _hx_char_code_at($arg, $i);
         if ($_g2 !== null) {
             switch ($_g2) {
                 case 32:
                 case 9:
                 case 34:
                 case 38:
                 case 124:
                 case 60:
                 case 62:
                 case 35:
                 case 59:
                 case 42:
                 case 63:
                 case 40:
                 case 41:
                 case 123:
                 case 125:
                 case 36:
                     $ok = false;
                     break;
                 case 0:
                 case 13:
                 case 10:
                     $arg = _hx_substr($arg, 0, $i);
                     break;
             }
         }
         unset($i, $_g2);
     }
     if ($ok) {
         return $arg;
     }
     return "\"" . _hx_string_or_null(_hx_explode("\"", _hx_explode("\\", $arg)->join("\\\\"))->join("\\\"")) . "\"";
 }
 public function __construct($dsn, $user = null, $password = null, $options = null)
 {
     if (!php_Boot::$skip_constructor) {
         if (null === $options) {
             $this->pdo = new PDO($dsn, $user, $password);
         } else {
             $arr = array();
             $_g = 0;
             $_g1 = Reflect::fields($options);
             while ($_g < $_g1->length) {
                 $key = $_g1[$_g];
                 ++$_g;
                 $arr[$key] = Reflect::field($options, $key);
                 unset($key);
             }
             $this->pdo = new PDO($dsn, $user, $password, $arr);
         }
         $this->dbname = _hx_explode(":", $dsn)->shift();
     }
 }
 public function parseTokens($data)
 {
     $tokens = new HList();
     while (haxe_Template::$splitter->match($data)) {
         $p = haxe_Template::$splitter->matchedPos();
         if ($p->pos > 0) {
             $tokens->add(_hx_anonymous(array("p" => _hx_substr($data, 0, $p->pos), "s" => true, "l" => null)));
         }
         if (_hx_char_code_at($data, $p->pos) === 58) {
             $tokens->add(_hx_anonymous(array("p" => _hx_substr($data, $p->pos + 2, $p->len - 4), "s" => false, "l" => null)));
             $data = haxe_Template::$splitter->matchedRight();
             continue;
         }
         $parp = $p->pos + $p->len;
         $npar = 1;
         while ($npar > 0) {
             $c = _hx_char_code_at($data, $parp);
             if ($c === 40) {
                 $npar++;
             } else {
                 if ($c === 41) {
                     $npar--;
                 } else {
                     if ($c === null) {
                         throw new HException("Unclosed macro parenthesis");
                     }
                 }
             }
             $parp++;
             unset($c);
         }
         $params = _hx_explode(",", _hx_substr($data, $p->pos + $p->len, $parp - ($p->pos + $p->len) - 1));
         $tokens->add(_hx_anonymous(array("p" => haxe_Template::$splitter->matched(2), "s" => false, "l" => $params)));
         $data = _hx_substr($data, $parp, strlen($data) - $parp);
         unset($parp, $params, $p, $npar, $c);
     }
     if (strlen($data) > 0) {
         $tokens->add(_hx_anonymous(array("p" => $data, "s" => true, "l" => null)));
     }
     return $tokens;
 }
Exemple #20
0
 public function findLeads($q)
 {
     $sb = new StringBuf();
     $phValues = new _hx_array(array());
     $fields = $q->get("fields");
     $sb->add("SELECT " . _hx_string_or_null($fields !== null ? $this->fieldFormat(_hx_explode(",", $fields)->map(array(new _hx_lambda(array(&$fields, &$phValues, &$q, &$sb), "model_Campaigns_0"), 'execute'))->join(",")) : "*"));
     $sb->add(" FROM  `vicidial_list` WHERE `list_id` IN( SELECT `list_id` FROM vicidial_lists ");
     $where = $q->get("where");
     if ($where !== null) {
         $this->buildCond($where, $sb, $phValues, null);
     }
     $sb->add(")");
     $order = $q->get("order");
     if ($order !== null) {
         $this->buildOrder($order, $sb);
     }
     $limit = $q->get("limit");
     $this->buildLimit($limit === null ? "15" : $limit, $sb);
     $this->data = _hx_anonymous(array("rows" => $this->execute($sb->b, $phValues)));
     return $this->json_encode();
 }
Exemple #21
0
 public function prepare($where)
 {
     $wParam = _hx_explode(",", $where);
     $where = "";
     if (Lambda::has($wParam, "filter=1")) {
         $wParam = $wParam->filter(array(new _hx_lambda(array(&$wParam, &$where), "model_Select_0"), 'execute'));
     }
     if ($wParam->length > 0 && $where === "") {
         $where = "";
     }
     $_g = 0;
     while ($_g < $wParam->length) {
         $w = $wParam[$_g];
         ++$_g;
         if ($where === "") {
             $where = "WHERE " . _hx_string_or_null($w);
         } else {
             $where = " AND " . _hx_string_or_null($w);
         }
         unset($w);
     }
     haxe_Log::trace($where, _hx_anonymous(array("fileName" => "Select.hx", "lineNumber" => 62, "className" => "model.Select", "methodName" => "prepare")));
     return $where;
 }
 public function readHttpResponse($api, $sock)
 {
     $b = new haxe_io_BytesBuffer();
     $k = 4;
     $s = haxe_io_Bytes::alloc(4);
     $sock->setTimeout($this->cnxTimeout);
     while (true) {
         $p = $sock->input->readBytes($s, 0, $k);
         while ($p !== $k) {
             $p += $sock->input->readBytes($s, $p, $k - $p);
         }
         if ($k < 0 || $k > $s->length) {
             throw new HException(haxe_io_Error::$OutsideBounds);
         }
         $b->b .= substr($s->b, 0, $k);
         switch ($k) {
             case 1:
                 $c = ord($s->b[0]);
                 if ($c === 10) {
                     break 2;
                 }
                 if ($c === 13) {
                     $k = 3;
                 } else {
                     $k = 4;
                 }
                 break;
             case 2:
                 $c = ord($s->b[1]);
                 if ($c === 10) {
                     if (ord($s->b[0]) === 13) {
                         break 2;
                     }
                     $k = 4;
                 } else {
                     if ($c === 13) {
                         $k = 3;
                     } else {
                         $k = 4;
                     }
                 }
                 break;
             case 3:
                 $c = ord($s->b[2]);
                 if ($c === 10) {
                     if (ord($s->b[1]) !== 13) {
                         $k = 4;
                     } else {
                         if (ord($s->b[0]) !== 10) {
                             $k = 2;
                         } else {
                             break 2;
                         }
                     }
                 } else {
                     if ($c === 13) {
                         if (ord($s->b[1]) !== 10 || ord($s->b[0]) !== 13) {
                             $k = 1;
                         } else {
                             $k = 3;
                         }
                     } else {
                         $k = 4;
                     }
                 }
                 break;
             case 4:
                 $c = ord($s->b[3]);
                 if ($c === 10) {
                     if (ord($s->b[2]) !== 13) {
                         continue 2;
                     } else {
                         if (ord($s->b[1]) !== 10 || ord($s->b[0]) !== 13) {
                             $k = 2;
                         } else {
                             break 2;
                         }
                     }
                 } else {
                     if ($c === 13) {
                         if (ord($s->b[2]) !== 10 || ord($s->b[1]) !== 13) {
                             $k = 3;
                         } else {
                             $k = 1;
                         }
                     }
                 }
                 break;
         }
         unset($p);
     }
     $headers = _hx_explode("\r\n", $b->getBytes()->toString());
     $response = $headers->shift();
     $rp = _hx_explode(" ", $response);
     $status = Std::parseInt($rp[1]);
     if ($status === 0 || $status === null) {
         throw new HException("Response status error");
     }
     $headers->pop();
     $headers->pop();
     $this->responseHeaders = new Hash();
     $size = null;
     $chunked = false;
     $_g = 0;
     while ($_g < $headers->length) {
         $hline = $headers[$_g];
         ++$_g;
         $a = _hx_explode(": ", $hline);
         $hname = $a->shift();
         $hval = haxe_Http_3($this, $_g, $a, $api, $b, $chunked, $headers, $hline, $hname, $k, $response, $rp, $s, $size, $sock, $status);
         $this->responseHeaders->set($hname, $hval);
         switch (strtolower($hname)) {
             case "content-length":
                 $size = Std::parseInt($hval);
                 break;
             case "transfer-encoding":
                 $chunked = strtolower($hval) === "chunked";
                 break;
         }
         unset($hval, $hname, $hline, $a);
     }
     $this->onStatus($status);
     $chunk_re = new EReg("^([0-9A-Fa-f]+)[ ]*\r\n", "m");
     $this->chunk_size = null;
     $this->chunk_buf = null;
     $bufsize = 1024;
     $buf = haxe_io_Bytes::alloc($bufsize);
     if ($size === null) {
         if (!$this->noShutdown) {
             $sock->shutdown(false, true);
         }
         try {
             while (true) {
                 $len = $sock->input->readBytes($buf, 0, $bufsize);
                 if ($chunked) {
                     if (!$this->readChunk($chunk_re, $api, $buf, $len)) {
                         break;
                     }
                 } else {
                     $api->writeBytes($buf, 0, $len);
                 }
                 unset($len);
             }
         } catch (Exception $»e) {
             $_ex_ = $»e instanceof HException ? $»e->e : $»e;
             if (($e = $_ex_) instanceof haxe_io_Eof) {
             } else {
                 throw $»e;
             }
         }
     } else {
         $api->prepare($size);
         try {
             while ($size > 0) {
                 $len = $sock->input->readBytes($buf, 0, $size > $bufsize ? $bufsize : $size);
                 if ($chunked) {
                     if (!$this->readChunk($chunk_re, $api, $buf, $len)) {
                         break;
                     }
                 } else {
                     $api->writeBytes($buf, 0, $len);
                 }
                 $size -= $len;
                 unset($len);
             }
         } catch (Exception $»e) {
             $_ex_ = $»e instanceof HException ? $»e->e : $»e;
             if (($e = $_ex_) instanceof haxe_io_Eof) {
                 throw new HException("Transfert aborted");
             } else {
                 throw $»e;
             }
         }
     }
     if ($chunked && ($this->chunk_size !== null || $this->chunk_buf !== null)) {
         throw new HException("Invalid chunk");
     }
     if ($status < 200 || $status >= 400) {
         throw new HException("Http Error #" . _hx_string_rec($status, ""));
     }
     $api->close();
 }
Exemple #23
0
 public function parse($txt)
 {
     $this->columns = null;
     $rows = _hx_explode("\n", $txt);
     $h = $rows->length;
     if ($h === 0) {
         $this->tab->clear();
         return;
     }
     if ($rows[$h - 1] === "") {
         $h--;
     }
     $_g = 0;
     while ($_g < $h) {
         $i = $_g++;
         $at = $h - $i - 1;
         $this->addRow($at + 1, $rows[$at]);
         unset($i, $at);
     }
     $this->addHeaderRow(0);
 }
 public function findClient($param, $dataOnly = null)
 {
     $sql = new StringBuf();
     $phValues = new _hx_array(array());
     $cond = "";
     $limit = $param->get("limit");
     if (!Util::any2bool($limit)) {
         $limit = _hx_array_get(S::$conf->get("sql"), "LIMIT");
         if (!Util::any2bool($limit)) {
             $limit = 15;
         }
     }
     $globalCond = "";
     $reasons = "";
     $where = $param->get("where");
     if (strlen($where) > 0) {
         $where1 = _hx_explode(",", $where);
         $whereElements = $where1->filter(array(new _hx_lambda(array(&$cond, &$dataOnly, &$globalCond, &$limit, &$param, &$phValues, &$reasons, &$sql, &$where, &$where1), "model_ClientHistory_2"), 'execute'));
         $_g = 0;
         while ($_g < $where1->length) {
             $w = $where1[$_g];
             ++$_g;
             $wData = _hx_string_call($w, "split", array("|"));
             $_g1 = $wData[0];
             switch ($_g1) {
                 case "reason":
                     $reasons = $wData->slice(1, null)->join(" ");
                     break;
             }
             unset($_g1);
             unset($wData, $w);
         }
         if ($whereElements->length > 0) {
             $globalCond = $this->addCond($whereElements, $phValues);
         }
     }
     $sql->add("SELECT SQL_CALC_FOUND_ROWS * FROM(");
     $first = true;
     if (_hx_index_of($reasons, "AC04", null) > -1) {
         if ($first) {
             $first = false;
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"AC04\" AS reason FROM `konto_auszug` WHERE i LIKE \"%AC04 KONTO AUFGELOEST%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"AC04\" AS reason FROM `konto_auszug` WHERE j LIKE \"%AC04 KONTO AUFGELOEST%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "AC01", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"AC01\" AS reason FROM `konto_auszug` WHERE i LIKE \"%AC01 IBAN FEHLERHAFT%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"AC01\" AS reason FROM `konto_auszug` WHERE j LIKE \"%AC01 IBAN FEHLERHAFT%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "MD06", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"MD06\" AS reason FROM `konto_auszug` WHERE i LIKE \"%MD06 WIDERSPRUCH DURCH ZAHLER%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"MD06\" AS reason FROM `konto_auszug` WHERE j LIKE \"%MD06 WIDERSPRUCH DURCH ZAHLER%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "MS03", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"MS03\" AS reason FROM `konto_auszug` WHERE i LIKE \"%MS03 SONSTIGE GRUENDE%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"MS03\" AS reason FROM `konto_auszug` WHERE j LIKE \"%MS03 SONSTIGE GRUENDE%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     $sql->add(" )_lim " . _hx_string_or_null($globalCond) . " LIMIT " . _hx_string_rec($limit, ""));
     S::$my->select_db("fly_crm");
     $rows = $this->execute($sql->b, $phValues);
     if ($dataOnly) {
         return $rows;
     }
     $this->data = _hx_anonymous(array("count" => _hx_array_get($this->query("SELECT FOUND_ROWS()"), 0)["FOUND_ROWS()"], "page" => $param->exists("page") ? Std::parseInt($param->get("page")) : 1, "rows" => $rows));
     return $this->json_encode();
 }
Exemple #25
0
                        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 $vicdial_list_fields;
    static function create($param)
    {
        $self = new model_QC($param);
        $self->table = "vicidial_list";
        return Reflect::callMethod($self, Reflect::field($self, $param->get("action")), new _hx_array(array($param)));
    }
    function __toString()
    {
        return 'model.QC';
    }
}
model_QC::$vicdial_list_fields = _hx_explode(",", "lead_id,entry_date,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");
function model_QC_0(&$cF, &$entry_list_id, &$param, $field)
{
    return $field->get("field_label");
}
function model_QC_1(&$fields, &$phValues, &$q, &$sb, $f)
{
    return S::$my->real_escape_string($f);
}
Exemple #26
0
function _hx_string_call($s, $method, $params)
{
    if (!is_string($s)) {
        return call_user_func_array(array($s, $method), $params);
    }
    switch ($method) {
        case 'toUpperCase':
            return strtoupper($s);
        case 'toLowerCase':
            return strtolower($s);
        case 'charAt':
            return substr($s, $params[0], 1);
        case 'charCodeAt':
            return _hx_char_code_at($s, $params[0]);
        case 'indexOf':
            return _hx_index_of($s, $params[0], count($params) > 1 ? $params[1] : null);
        case 'lastIndexOf':
            return _hx_last_index_of($s, count($params) > 1 ? $params[1] : null, null);
        case 'split':
            return _hx_explode($params[0], $s);
        case 'substr':
            return _hx_substr($s, $params[0], count($params) > 1 ? $params[1] : null);
        case 'toString':
            return $s;
        default:
            throw new HException('Invalid Operation: ' . $method);
    }
}
Exemple #27
0
 public function buildLimit($limitParam, $sb)
 {
     $sb->add(" LIMIT " . _hx_string_or_null(_hx_index_of($limitParam, ",", null) > -1 ? _hx_explode(",", $limitParam)->map(array(new _hx_lambda(array(&$limitParam, &$sb), "Model_17"), 'execute'))->join(",") : Std::string(Std::parseInt($limitParam))));
     return true;
 }
 public function showImage($digest, $mml, $param)
 {
     if ($digest === null && $mml === null) {
         throw new HException("Missing parameters 'formula' or 'mml'.");
     }
     if ($digest !== null && $mml !== null) {
         throw new HException("Only one parameter 'formula' or 'mml' is valid.");
     }
     $atts = false;
     if ($digest === null && $mml !== null) {
         $digest = $this->computeDigest($mml, $param);
     }
     $formula = $this->plugin->getStorageAndCache()->decodeDigest($digest);
     if ($formula === null) {
         throw new HException("Formula associated to digest not found.");
     }
     if (StringTools::startsWith($formula, "<")) {
         throw new HException("Not implemented.");
     }
     $iniFile = com_wiris_util_sys_IniFile::newIniFileFromString($formula);
     $renderParams = $iniFile->getProperties();
     $i = null;
     $ss = $this->getEditorParametersList();
     if ($param !== null) {
         $_g1 = 0;
         $_g = $ss->length;
         while ($_g1 < $_g) {
             $i1 = $_g1++;
             $key = $ss[$i1];
             $value = com_wiris_system_PropertiesTools::getProperty($param, $key, null);
             if ($value !== null) {
                 $atts = true;
                 $renderParams->set($key, $value);
             }
             unset($value, $key, $i1);
         }
     }
     if ($atts) {
         if ($mml !== null) {
             $digest = $this->computeDigest($mml, com_wiris_system_PropertiesTools::toProperties($renderParams));
         } else {
             $digest = $this->computeDigest($renderParams->get("mml"), com_wiris_system_PropertiesTools::toProperties($renderParams));
         }
     }
     $store = $this->plugin->getStorageAndCache();
     $bs = null;
     $bs = $store->retreiveData($digest, $this->plugin->getConfiguration()->getProperty("wirisimageformat", "png"));
     if ($bs === null) {
         if ($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null) !== null) {
             $json = com_wiris_util_json_JSon::decode($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null));
             $decodedHash = $json;
             $keys = $decodedHash->keys();
             $notAllowedParams = _hx_explode(",", com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMETERS_NOTRENDER_LIST);
             while ($keys->hasNext()) {
                 $key = $keys->next();
                 if (!com_wiris_system_ArrayEx::contains($notAllowedParams, $key)) {
                     $renderParams->set($key, $decodedHash->get($key));
                 }
                 unset($key);
             }
         } else {
             $_g1 = 0;
             $_g = $ss->length;
             while ($_g1 < $_g) {
                 $i1 = $_g1++;
                 $key = $ss[$i1];
                 if (!$renderParams->exists($key)) {
                     $confKey = com_wiris_plugin_api_ConfigurationKeys::$imageConfigProperties->get($key);
                     if ($confKey !== null) {
                         $value = $this->plugin->getConfiguration()->getProperty($confKey, null);
                         if ($value !== null) {
                             $renderParams->set($key, $value);
                         }
                         unset($value);
                     }
                     unset($confKey);
                 }
                 unset($key, $i1);
             }
         }
         $prop = com_wiris_system_PropertiesTools::toProperties($renderParams);
         $iter = $renderParams->keys();
         $mml = $renderParams->get("mml");
         $b = $this->render($this->plugin->getConfiguration()->getProperty("wirisimageformat", "png"), $mml, null, $prop, null);
         $store->storeData($digest, $this->plugin->getConfiguration()->getProperty("wirisimageformat", "png"), $b->b);
         $bs = $b->b;
     }
     return $bs;
 }
 public function getEditorParametersList()
 {
     $pl = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMETERS_LIST, com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMETERS_DEFAULT_LIST);
     return _hx_explode(",", $pl);
 }
 static function getMultiValueMapFromString($s)
 {
     $map = new haxe_ds_StringMap();
     $_g = 0;
     $_g1 = _hx_explode("&", $s);
     while ($_g < $_g1->length) {
         $part = $_g1[$_g];
         ++$_g;
         $index = _hx_index_of($part, "=", null);
         if ($index > 0) {
             $name = _hx_substr($part, 0, $index);
             $val = _hx_substr($part, $index + 1, null);
             ufront_core__MultiValueMap_MultiValueMap_Impl_::add($map, $name, $val);
             unset($val, $name);
         }
         unset($part, $index);
     }
     return $map;
 }