public function toString() { $str = ""; if ($this->scheme !== null) { $str .= $this->scheme; } if ($this->opaque !== null) { $str .= $this->opaque; } else { if ($this->registry !== null) { $str .= $this->registry; } else { if ($this->host !== null) { $str .= "//"; } if ($this->userinfo !== null) { $str .= $this->userinfo . "@"; } if ($this->host !== null) { $str .= $this->host; } if ($this->port !== null && ($this->scheme !== null && !_hx_equal($this->port, Reflect::field(sinatra_utils_URI::$SCHEME_DEFAULT_PORT, $this->scheme)))) { $str .= ":" . Std::string($this->port); } } $str .= $this->path; if ($this->query !== null) { $str .= "?" . $this->query; } } if ($this->fragment !== null) { $str .= "#" . $this->fragment; } return $str; }
static function compareMethods($f1, $f2) { if (is_array($f1) && is_array($f1)) { return $f1[0] === $f2[0] && $f1[1] == $f2[1]; } if (is_string($f1) && is_string($f2)) { return _hx_equal($f1, $f2); } return false; }
public function serializeRef($v) { $_g1 = 0; $_g = $this->cache->length; while ($_g1 < $_g) { $i = $_g1++; if (_hx_equal($this->cache[$i], $v)) { $this->buf->add("r"); $this->buf->add($i); return true; } unset($i); } $this->cache->push($v); return false; }
public function testNdjsonLoop() { $t = harness_Native::table(new _hx_array(array())); _hx_deref(new coopy_Ndjson($t))->parse("{\"a\":1,\"b\":2}\n{\"a\":11,\"b\":22}\r\n{\"a\":111,\"b\":222}\n"); $txt = _hx_deref(new coopy_Ndjson($t))->render(); $t2 = harness_Native::table(new _hx_array(array())); _hx_deref(new coopy_Ndjson($t2))->parse($txt); $ca = null; if (_hx_equal($t->getCell(0, 0), "a")) { $ca = 0; } else { $ca = 1; } $cb = 1 - $ca; $this->assertEquals("a", $t->getCell($ca, 0), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 55, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals("b", $t->getCell($cb, 0), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 56, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(1, $t->getCell($ca, 1), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 57, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(2, $t->getCell($cb, 1), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 58, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(11, $t->getCell($ca, 2), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 59, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(22, $t->getCell($cb, 2), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 60, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(111, $t->getCell($ca, 3), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 61, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); $this->assertEquals(222, $t->getCell($cb, 3), _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 62, "className" => "harness.JsonTest", "methodName" => "testNdjsonLoop"))); }
public function render() { $txt = ""; $offset = 0; if ($this->tab->get_height() === 0) { return $txt; } if ($this->tab->get_width() === 0) { return $txt; } if (_hx_equal($this->tab->getCell(0, 0), "@:@")) { $offset = 1; } $this->header_row = $offset; $_g1 = $this->header_row + 1; $_g = $this->tab->get_height(); while ($_g1 < $_g) { $r = $_g1++; $txt .= _hx_string_or_null($this->renderRow($r)); $txt .= "\n"; unset($r); } return $txt; }
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; }
function model_ClientHistory_2(&$cond, &$dataOnly, &$globalCond, &$limit, &$param, &$phValues, &$reasons, &$sql, &$where, &$where1, $el) { return !_hx_equal(_hx_string_call($el, "indexOf", array("reason")), 0); }
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; }
static function formatPartial($dti, $format) { $result = new _hx_array(array()); $pos = 0; $str = ""; $_g1 = 0; $_g = $format->length; while ($_g1 < $_g) { $f = $_g1++; $pos = _hx_index_of($format[$f], "%", null); if ($pos >= 0) { $_g2 = ord(substr($format[$f], $pos + 1, 1)); switch ($_g2) { case 89: if ($dti->getYears() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_0($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 121: if ($dti->getYears() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getYears(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 77: if ($dti->getMonths() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_1($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 109: if ($dti->getMonths() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getMonths(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 98: if ($dti->getTotalMonths() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getTotalMonths(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 68: if ($dti->getDays() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_2($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 100: if ($dti->getDays() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getDays(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 97: if ($dti->getTotalDays() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getTotalDays(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 72: if ($dti->getHours() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_3($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 104: if ($dti->getHours() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getHours(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 99: if ($dti->getTotalHours() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getTotalHours(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 73: if ($dti->getMinutes() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_4($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 105: if ($dti->getMinutes() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getMinutes(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 101: if ($dti->getTotalMinutes() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getTotalMinutes(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 83: if ($dti->getSeconds() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_or_null(datetime_utils_DateTimeIntervalUtils_5($_g, $_g1, $_g2, $dti, $f, $format, $pos, $result, $str)) . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 115: if ($dti->getSeconds() === 0) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getSeconds(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; case 102: if (_hx_equal($dti->getTotalSeconds(), 0)) { continue 2; } $str = _hx_string_or_null(_hx_substring($format[$f], 0, $pos)) . _hx_string_rec($dti->getTotalSeconds(), "") . _hx_string_or_null(_hx_substring($format[$f], $pos + 2, null)); break; default: continue 2; break; } unset($_g2); $result->push($str); } unset($f); } return $result; }
public function setMetaProp($target, $column_name, $prop_name, $value) { if ($column_name === null) { return; } if ($prop_name === null) { return; } if (!$target->exists($column_name)) { $value1 = new _hx_array(array()); $target->set($column_name, $value1); } $change = new coopy_PropertyChange(); $change->prevName = $prop_name; $change->name = $prop_name; if (_hx_equal($value, "")) { $value = null; } $change->val = $value; $target->get($column_name)->push($change); }
static function getMoonTimes($date, $lat, $lng, $inUTC = null) { if ($inUTC === null) { $inUTC = false; } if ($inUTC) { $this1 = datetime__DateTime_DateTime_Impl_::utc(suncalc_SunCalc_0($date, $inUTC, $lat, $lng)); $date = Date::fromTime(($this1 - 62135596800.0) * 1000); $date = new Date($date->getFullYear(), $date->getMonth(), $date->getDate(), 0, 0, 0); } else { $date = new Date($date->getFullYear(), $date->getMonth(), $date->getDate(), 0, 0, 0); } $hc = 0.133 * suncalc_SunCalc::$rad; $h0 = suncalc_SunCalc::getMoonPosition($date, $lat, $lng)->altitude - $hc; $h1 = null; $h2 = null; $rise = 0.0; $set = 0.0; $a = null; $b = null; $xe = null; $ye = 0.0; $d = null; $roots = null; $x1 = 0.0; $x2 = 0.0; $dx = null; $i = 1; while ($i <= 24) { $h1 = suncalc_SunCalc::getMoonPosition(suncalc_SunCalc::hoursLater($date, $i), $lat, $lng)->altitude - $hc; $h2 = suncalc_SunCalc::getMoonPosition(suncalc_SunCalc::hoursLater($date, $i + 1), $lat, $lng)->altitude - $hc; $a = ($h0 + $h2) / 2 - $h1; $b = ($h2 - $h0) / 2; $xe = -$b / (2 * $a); $ye = ($a * $xe + $b) * $xe + $h1; $d = $b * $b - 4 * $a * $h1; $roots = 0; if ($d >= 0) { $dx = Math::sqrt($d) / (Math::abs($a) * 2); $x1 = $xe - $dx; $x2 = $xe + $dx; if (Math::abs($x1) <= 1) { $roots++; } if (Math::abs($x2) <= 1) { $roots++; } if ($x1 < -1) { $x1 = $x2; } } if ($roots === 1) { if ($h0 < 0) { $rise = $i + $x1; } else { $set = $i + $x1; } } else { if ($roots === 2) { $rise = $i + ($ye < 0 ? $x2 : $x1); $set = $i + ($ye < 0 ? $x1 : $x2); } } if (!_hx_equal($rise, 0) && !_hx_equal($set, 0)) { break; } $h0 = $h2; $i += 2; } $result = new haxe_ds_StringMap(); if (!_hx_equal($rise, 0)) { $v = suncalc_SunCalc::hoursLater($date, $rise); $result->set("rise", $v); $v; } if (!_hx_equal($set, 0)) { $v1 = suncalc_SunCalc::hoursLater($date, $set); $result->set("set", $v1); $v1; } if (_hx_equal($rise, 0) && _hx_equal($set, 0)) { $result->set($ye > 0 ? "alwaysUp" : "alwaysDown", true); true; } return $result; }
public function parseRec() { while (true) { $c = null; $index = $this->pos++; $c = ord(substr($this->str, $index, 1)); unset($index); switch ($c) { case 32: case 13: case 10: case 9: break; case 123: $obj = _hx_anonymous(array()); $field = null; $comma = null; while (true) { $c1 = null; $index1 = $this->pos++; $c1 = ord(substr($this->str, $index1, 1)); unset($index1); switch ($c1) { case 32: case 13: case 10: case 9: break; case 125: if ($field !== null || $comma === false) { $this->invalidChar(); } return $obj; break; case 58: if ($field === null) { $this->invalidChar(); } $value = $this->parseRec(); $obj->{$field} = $value; $field = null; $comma = true; break; case 44: if ($comma) { $comma = false; } else { $this->invalidChar(); } break; case 34: if ($comma) { $this->invalidChar(); } $field = $this->parseString(); break; default: $this->invalidChar(); break; } unset($c1); } break; case 91: $arr = new _hx_array(array()); $comma1 = null; while (true) { $c2 = null; $index2 = $this->pos++; $c2 = ord(substr($this->str, $index2, 1)); unset($index2); switch ($c2) { case 32: case 13: case 10: case 9: break; case 93: if ($comma1 === false) { $this->invalidChar(); } return $arr; break; case 44: if ($comma1) { $comma1 = false; } else { $this->invalidChar(); } break; default: if ($comma1) { $this->invalidChar(); } $this->pos--; $arr->push($this->parseRec()); $comma1 = true; break; } unset($c2); } break; case 116: $save = $this->pos; if (haxe_format_JsonParser_0($this, $c, $save) !== 114 || haxe_format_JsonParser_1($this, $c, $save) !== 117 || haxe_format_JsonParser_2($this, $c, $save) !== 101) { $this->pos = $save; $this->invalidChar(); } return true; break; case 102: $save1 = $this->pos; if (haxe_format_JsonParser_3($this, $c, $save1) !== 97 || haxe_format_JsonParser_4($this, $c, $save1) !== 108 || haxe_format_JsonParser_5($this, $c, $save1) !== 115 || haxe_format_JsonParser_6($this, $c, $save1) !== 101) { $this->pos = $save1; $this->invalidChar(); } return false; break; case 110: $save2 = $this->pos; if (haxe_format_JsonParser_7($this, $c, $save2) !== 117 || haxe_format_JsonParser_8($this, $c, $save2) !== 108 || haxe_format_JsonParser_9($this, $c, $save2) !== 108) { $this->pos = $save2; $this->invalidChar(); } return null; break; case 34: return $this->parseString(); break; case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 45: $c3 = $c; $start = $this->pos - 1; $minus = $c3 === 45; $digit = !$minus; $zero = $c3 === 48; $point = false; $e = false; $pm = false; $end = false; while (true) { $index13 = $this->pos++; $c3 = ord(substr($this->str, $index13, 1)); unset($index13); switch ($c3) { case 48: if ($zero && !$point) { $this->invalidNumber($start); } if ($minus) { $minus = false; $zero = true; } $digit = true; break; case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: if ($zero && !$point) { $this->invalidNumber($start); } if ($minus) { $minus = false; } $digit = true; $zero = false; break; case 46: if ($minus || $point) { $this->invalidNumber($start); } $digit = false; $point = true; break; case 101: case 69: if ($minus || $zero || $e) { $this->invalidNumber($start); } $digit = false; $e = true; break; case 43: case 45: if (!$e || $pm) { $this->invalidNumber($start); } $digit = false; $pm = true; break; default: if (!$digit) { $this->invalidNumber($start); } $this->pos--; $end = true; break; } if ($end) { break; } } $f = Std::parseFloat(_hx_substr($this->str, $start, $this->pos - $start)); $i = Std::int($f); if (_hx_equal($i, $f)) { return $i; } else { return $f; } break; default: $this->invalidChar(); break; } unset($c); } }
public function math2Img($str, $prop) { $img = "<img"; $output = array(); $prop["centerbaseline"] = "false"; $prop["accessible"] = "true"; $prop["metrics"] = "true"; $src = null; $alt = null; $width = null; $height = null; $baseline = null; if ($this->plugin->getConfiguration()->getProperty("wirispluginperformance", "false") === "false") { $src = $this->render->createImage($str, $prop, $output); $img .= " src=\"" . $src . "\""; $alt = com_wiris_system_PropertiesTools::getProperty($output, "alt", null); $width = com_wiris_system_PropertiesTools::getProperty($output, "width", null); $height = com_wiris_system_PropertiesTools::getProperty($output, "height", null); $baseline = com_wiris_system_PropertiesTools::getProperty($output, "baseline", null); } else { $digest = $this->render->computeDigest($str, $prop); $json = com_wiris_util_json_JSon::decode($this->render->showImageJson($digest, com_wiris_system_PropertiesTools::getProperty($prop, "alt", null))); $hashImage = $json; if (_hx_equal($hashImage->get("status"), "warning")) { $this->render->showImage(null, $str, $prop); } $json = com_wiris_util_json_JSon::decode($this->render->showImageJson($digest, "en")); $hashImage = $json; if (_hx_equal($hashImage->get("status"), "ok")) { $result = $hashImage->get("result"); $base64 = $result->get("pngBase64"); $img .= " src=\"data:image/png;base64," . $base64 . "\""; if ($result->exists("alt")) { $alt = $result->get("alt"); } else { $alt = $this->service->mathml2accessible($str, null, $prop); } $width = $result->get("width"); $height = $result->get("height"); $baseline = $result->get("baseline"); } else { throw new HException("Image can't be rendererd"); } } $dpi = Std::parseFloat($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$WIRIS_DPI, "96")); 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; if ($decodedHash->exists("dpi")) { $dpi = Std::parseFloat($decodedHash->get("dpi")); } } $mml = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FILTER_OUTPUT_MATHML, "false") === "true"; $f = 96 / $dpi; $dwidth = $f * Std::parseFloat($width); $dheight = $f * Std::parseFloat($height); $dbaseline = $f * Std::parseFloat($baseline); $alt = $this->html_entity_encode($alt); $img .= " class=\"Wirisformula\""; $img .= " alt=\"" . $alt . "\""; $img .= " width=\"" . _hx_string_rec($dwidth, "") . "\""; $img .= " height=\"" . _hx_string_rec($dheight, "") . "\""; $d = $dbaseline - $dheight; $img .= " style=\"vertical-align:" . _hx_string_rec($d, "") . "px\""; if ($mml) { $tag = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_MATHML_ATTRIBUTE, "data-mathml"); $img .= " " . $tag . "=\"" . $this->save_xml_encode($str) . "\""; } $img .= "/>"; return $img; }
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; } }
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 enumEq($a, $b) { if ($a === $b) { return true; } try { if (!_hx_equal($a->index, $b->index)) { return false; } $_g1 = 0; $_g = count($a->params); while ($_g1 < $_g) { $i = $_g1++; if (Type::getEnum($a->params[$i]) !== null) { if (!Type::enumEq($a->params[$i], $b->params[$i])) { return false; } } else { if (!_hx_equal($a->params[$i], $b->params[$i])) { return false; } } unset($i); } } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $e = $_ex_; return false; } return true; }
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; } }