public function get_description() { $buf = new StringBuf(); $buf->add($this->value); if ($this->expires !== null) { if (ufront_web_HttpCookie::$tzOffset === null) { ufront_web_HttpCookie::$tzOffset = intval(date('Z', $this->expires->__t)); } $gmtExpires = Date::fromTime($this->expires->getTime() + ufront_web_HttpCookie::$tzOffset); $zeroPad = array(new _hx_lambda(array(&$buf, &$gmtExpires), "ufront_web_HttpCookie_0"), 'execute'); $day = ufront_web_HttpCookie::$dayNames[$gmtExpires->getDay()]; $date = call_user_func_array($zeroPad, array($gmtExpires->getDate())); $month = ufront_web_HttpCookie::$monthNames[$gmtExpires->getMonth()]; $year = $gmtExpires->getFullYear(); $hour = call_user_func_array($zeroPad, array($gmtExpires->getHours())); $minute = call_user_func_array($zeroPad, array($gmtExpires->getMinutes())); $second = call_user_func_array($zeroPad, array($gmtExpires->getSeconds())); $dateStr = "" . _hx_string_or_null($day) . ", " . _hx_string_or_null($date) . "-" . _hx_string_or_null($month) . "-" . _hx_string_rec($year, "") . " " . _hx_string_or_null($hour) . ":" . _hx_string_or_null($minute) . ":" . _hx_string_or_null($second) . " GMT"; ufront_web_HttpCookie::addPair($buf, "expires", $dateStr, null); } ufront_web_HttpCookie::addPair($buf, "domain", $this->domain, null); ufront_web_HttpCookie::addPair($buf, "path", $this->path, null); if ($this->secure) { ufront_web_HttpCookie::addPair($buf, "secure", null, true); } return $buf->b; }
static function toString($stack) { $b = new StringBuf(); $_g = 0; while ($_g < $stack->length) { $s = $stack[$_g]; ++$_g; $b->add("\nCalled from "); haxe_CallStack::itemToString($b, $s); unset($s); } return $b->b; }
public function get_innerHTML() { $s = new StringBuf(); if (null == $this->x) { throw new HException('null iterable'); } $__hx__it = $this->x->iterator(); while ($__hx__it->hasNext()) { $x = $__hx__it->next(); $s->add($x->toString()); } return $s->b; }
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(); }
public function getJavaScriptConfiguration() { $sb = new StringBuf(); $this->appendVarJs($sb, "_wrs_conf_editorEnabled", $this->getProperty("wiriseditorenabled", null), "Specifies if fomula editor is enabled"); $this->appendVarJs($sb, "_wrs_conf_imageMathmlAttribute", "'" . $this->getProperty("wiriseditormathmlattribute", null) . "'", "Specifies the image tag where we should save the formula editor mathml code"); $this->appendVarJs($sb, "_wrs_conf_saveMode", "'" . $this->getProperty("wiriseditorsavemode", null) . "'", "This value can be 'tags', 'xml' or 'safeXml'"); if ($this->getProperty("wiriseditorparselatex", null) === "true") { $this->appendVarJs($sb, "_wrs_conf_parseModes", "['latex']", "This value can contain 'latex'"); } else { $this->appendVarJs($sb, "_wrs_conf_parseModes", "[]", "This value can contain 'latex'"); } $this->appendVarJs($sb, "_wrs_conf_editorAttributes", "'" . $this->getProperty("wiriseditorwindowattributes", null) . "'", "Specifies formula editor window options"); $this->appendVarJs($sb, "_wrs_conf_editorUrl", "'" . $this->plugin->getImageServiceURL("editor") . "'", "WIRIS editor"); $this->appendVarJs($sb, "_wrs_conf_CASEnabled", $this->getProperty("wiriscasenabled", null), "Specifies if WIRIS cas is enabled"); $this->appendVarJs($sb, "_wrs_conf_CASMathmlAttribute", "'" . $this->getProperty("wiriscasmathmlattribute", null) . "'", "Specifies the image tag where we should save the WIRIS cas mathml code"); $this->appendVarJs($sb, "_wrs_conf_CASAttributes", "'" . $this->getProperty("wiriscaswindowattributes", null) . "'", "Specifies WIRIS cas window options"); $this->appendVarJs($sb, "_wrs_conf_hostPlatform", "'" . $this->getProperty("wirishostplatform", null) . "'", "Specifies host platform"); $this->appendVarJs($sb, "_wrs_conf_enableAccessibility", $this->getProperty("wirisaccessibilityenabled", null), "Specifies whether accessibility is enabled"); $this->appendVarJs($sb, "_wrs_conf_setSize", $this->getProperty("wiriseditorsetsize", null), "Specifies whether to set the size of the images at edition time"); $this->appendVarJs($sb, "_wrs_conf_editorToolbar", "'" . $this->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_TOOLBAR, null) . "'", "Toolbar definition"); $h = com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv; $attributes = new StringBuf(); $confVal = ""; $i = 0; $it = $h->keys(); $value = null; while ($it->hasNext()) { $value = $it->next(); if ($this->getProperty($value, null) !== null) { if ($i !== 0) { $attributes->add(","); } $i++; $confVal = $this->getProperty($value, null); str_replace("-", "_", $confVal); str_replace("-", "_", $confVal); $attributes->add("'"); $attributes->add(com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv->get($value)); $attributes->add("' : '"); $attributes->add($confVal); $attributes->add("'"); } } $this->appendVarJs($sb, "_wrs_conf_editorParameters", "{" . $attributes->b . "}", "Editor parameters"); $sb->add("var _wrs_conf_configuration_loaded = true;\r\n"); $sb->add("if (typeof _wrs_conf_core_loaded != 'undefined') _wrs_conf_plugin_loaded = true;\r\n"); return $sb->b; }
public function decodeString() { $sb = new StringBuf(); $d = $this->c; $this->nextToken(); $this->skipBlanks(); do { if ($this->c === 92) { $this->nextToken(); if ($this->c === 110) { $sb->add("\n"); } else { if ($this->c === 114) { $sb->add("\r"); } else { if ($this->c === 34) { $sb->add("\""); } else { if ($this->c === 39) { $sb->add("'"); } else { if ($this->c === 116) { $sb->add("\t"); } else { throw new HException("Unknown scape sequence '\\" . _hx_string_rec($this->c, "") . "'"); } } } } } } else { $sb->add(com_wiris_util_json_JSon_2($this, $d, $sb)); } $this->nextToken(); } while ($this->c !== $d); $this->nextToken(); return $sb->b; }
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; } }
public function getJavaScriptConfiguration() { $sb = new StringBuf(); $arrayParse = "[]"; $this->appendVarJs($sb, "_wrs_conf_editorEnabled", $this->getProperty("wiriseditorenabled", null), "Specifies if fomula editor is enabled"); $this->appendVarJs($sb, "_wrs_conf_imageMathmlAttribute", "'" . $this->getProperty("wiriseditormathmlattribute", null) . "'", "Specifies the image tag where we should save the formula editor mathml code"); $this->appendVarJs($sb, "_wrs_conf_saveMode", "'" . $this->getProperty("wiriseditorsavemode", null) . "'", "This value can be 'xml', 'safeXml', 'image' or 'base64'"); $this->appendVarJs($sb, "_wrs_conf_editMode", "'" . $this->getProperty("wiriseditoreditmode", null) . "'", "This value can be 'default' or 'image'"); if ($this->getProperty("wiriseditorparselatex", null) === "true") { $arrayParse = $this->appendElement2JavascriptArray($arrayParse, "latex"); } if ($this->getProperty("wiriseditorparsexml", null) === "true") { $arrayParse = $this->appendElement2JavascriptArray($arrayParse, "xml"); } $this->appendVarJs($sb, "_wrs_conf_parseModes", $arrayParse, "This value can contain 'latex' and 'xml)"); $this->appendVarJs($sb, "_wrs_conf_editorAttributes", "'" . $this->getProperty("wiriseditorwindowattributes", null) . "'", "Specifies formula editor window options"); $this->appendVarJs($sb, "_wrs_conf_editorUrl", "'" . $this->plugin->getImageServiceURL("editor", false) . "'", "WIRIS editor"); $this->appendVarJs($sb, "_wrs_conf_modalWindow", $this->getProperty("wiriseditormodalwindow", null), "Editor modal window"); $this->appendVarJs($sb, "_wrs_conf_CASEnabled", $this->getProperty("wiriscasenabled", null), "Specifies if WIRIS cas is enabled"); $this->appendVarJs($sb, "_wrs_conf_CASMathmlAttribute", "'" . $this->getProperty("wiriscasmathmlattribute", null) . "'", "Specifies the image tag where we should save the WIRIS cas mathml code"); $this->appendVarJs($sb, "_wrs_conf_CASAttributes", "'" . $this->getProperty("wiriscaswindowattributes", null) . "'", "Specifies WIRIS cas window options"); $this->appendVarJs($sb, "_wrs_conf_hostPlatform", "'" . $this->getProperty("wirishostplatform", null) . "'", "Specifies host platform"); $this->appendVarJs($sb, "_wrs_conf_versionPlatform", "'" . $this->getProperty("wirisversionplatform", "unknown") . "'", "Specifies host version platform"); $this->appendVarJs($sb, "_wrs_conf_enableAccessibility", $this->getProperty("wirisaccessibilityenabled", null), "Specifies whether accessibility is enabled"); $this->appendVarJs($sb, "_wrs_conf_setSize", $this->getProperty("wiriseditorsetsize", null), "Specifies whether to set the size of the images at edition time"); $this->appendVarJs($sb, "_wrs_conf_editorToolbar", "'" . $this->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_TOOLBAR, null) . "'", "Toolbar definition"); $this->appendVarJs($sb, "_wrs_conf_chemEnabled", $this->getProperty("wirischemeditorenabled", null), "Specifies if WIRIS chem editor is enabled"); if ($this->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null) !== null) { $this->appendVarJs($sb, "_wrs_conf_editorParameters", $this->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_PARAMS, null), "Editor parameters"); } else { $h = com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv; $attributes = new StringBuf(); $confVal = ""; $i = 0; $it = $h->keys(); $value = null; while ($it->hasNext()) { $value = $it->next(); if ($this->getProperty($value, null) !== null) { if ($i !== 0) { $attributes->add(","); } $i++; $confVal = $this->getProperty($value, null); str_replace("-", "_", $confVal); str_replace("-", "_", $confVal); $attributes->add("'"); $attributes->add(com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv->get($value)); $attributes->add("' : '"); $attributes->add($confVal); $attributes->add("'"); } } $this->appendVarJs($sb, "_wrs_conf_editorParameters", "{" . $attributes->b . "}", "Editor parameters"); } $this->appendVarJs($sb, "_wrs_conf_wirisPluginPerformance", $this->getProperty("wirispluginperformance", null), "Experimental settings to improve performance"); $sb->add("var _wrs_conf_configuration_loaded = true;\r\n"); $sb->add("if (typeof _wrs_conf_core_loaded != 'undefined') _wrs_conf_plugin_loaded = true;\r\n"); $version = null; try { $version = com_wiris_system_Storage::newResourceStorage("VERSION")->read(); } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; $ex = $_ex_; $version = "Missing version"; } $sb->add("var _wrs_conf_version = '" . $version . "';\r\n"); return $sb->b; }
static function format_profiler_message($type, $instance) { $t = new StringBuf(); if ($instance->calls > 0) { $t->add("<td>" . _hx_string_or_null($type) . "</td>"); $t->add("<td>" . Std::string($instance->calls) . "</td>"); $t->add("<td>" . _hx_string_or_null(system_base_Database::sprint_float($instance->time, 6)) . "</td>"); $t->add("<td class=\"__hand__\" title = '" . Std::string($instance->fast_sql) . "'>" . _hx_string_or_null(system_base_Database::sprint_float($instance->fast, 6)) . "</td>"); $t->add("<td class=\"__hand__\" title = '" . Std::string($instance->slow_sql) . "'>" . _hx_string_or_null(system_base_Database::sprint_float($instance->slow, 6)) . "</td>"); $t->add("<td>" . Std::string($instance->percentf(null)) . "</td>"); $t->add("<td>" . Std::string(Math::round($instance->percent(null) / $instance->calls)) . "%</td>"); return $t->b; } else { $t->add("<td>" . _hx_string_or_null($type) . "</td>"); $t->add("<td></td>"); $t->add("<td></td>"); $t->add("<td></td>"); $t->add("<td></td>"); $t->add("<td></td>"); $t->add("<td></td>"); return $t->b; } }
public function append($t) { $this->strLength += strlen($t); parent::add($t); }
public function toString() { $s = new StringBuf(); $s->add("{"); $it = $this->keys(); $__hx__it = $it; while ($__hx__it->hasNext()) { unset($i); $i = $__hx__it->next(); $s->add($i); $s->add(" => "); $s->add(Std::string($this->get($i))); if ($it->hasNext()) { $s->add(", "); } } $s->add("}"); return $s->b; }
static function toString($this1) { $sb = new StringBuf(); $sb->add("["); if (null == $this1) { throw new HException('null iterable'); } $__hx__it = $this1->keys(); while ($__hx__it->hasNext()) { unset($key); $key = $__hx__it->next(); $sb->add("\n\t" . _hx_string_or_null($key) . " = ["); $sb->add(ufront_core__MultiValueMap_MultiValueMap_Impl_::getAll($this1, $key)->join(", ")); $sb->add("]"); } if (strlen($sb->b) > 1) { $sb->add("\n"); } $sb->add("]"); return $sb->b; }
static function fTrace($str, $arr, $i = null) { $str_arr = _hx_explode(" @", $str); $str_buf = new StringBuf(); $_g1 = 0; $_g = $str_arr->length; while ($_g1 < $_g) { $i1 = $_g1++; $str_buf->add($str_arr[$i1]); if ($arr[$i1] !== null) { $str_buf->add($arr[$i1]); } unset($i1); } me_cunity_debug_Out::_trace($str_buf->b, $i); }
public function cas($mode, $language) { $output = new StringBuf(); $output->add("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); $config = $this->plugin->getConfiguration(); $availableLanguages = $this->getAvailableCASLanguages($config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CAS_LANGUAGES, null)); if ($language === null || !com_wiris_system_ArrayEx::contains($availableLanguages, $language)) { $language = $availableLanguages[0]; } if ($mode !== null && $mode === "applet") { $codebase = str_replace("%LANG", $language, $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CAS_CODEBASE, null)); $archive = str_replace("%LANG", $language, $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CAS_ARCHIVE, null)); $className = str_replace("%LANG", $language, $config->getProperty(com_wiris_plugin_api_ConfigurationKeys::$CAS_CLASS, null)); $output->add($this->printCAS($codebase, $archive, $className)); } else { $output->add($this->printCASContainer($config, $availableLanguages, $language)); } return $output->b; }
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; }
public function editor($language, $prop) { $output = new StringBuf(); if ($language === null || strlen($language) === 0) { $language = "en"; } $language = strtolower($language); str_replace("-", "_", $language); $store = com_wiris_system_Storage::newResourceStorage("lang/" . $language . "/strings.js"); if (!$store->exists()) { $store = com_wiris_system_Storage::newResourceStorage("lang/" . _hx_substr($language, 0, 2) . "/strings.js"); $language = _hx_substr($language, 0, 2); if (!$store->exists()) { $language = "en"; } } $attributes = new StringBuf(); $attributes->add(""); $confVal = ""; $i = 0; $config = $this->plugin->getConfiguration(); $h = com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv; $it = $h->keys(); $value = null; while ($it->hasNext()) { $value = $it->next(); if ($config->getProperty($value, null) !== null) { if ($i !== 0) { $attributes->add(","); } $i++; $confVal = $config->getProperty($value, null); str_replace("-", "_", $confVal); str_replace("-", "_", $confVal); $attributes->add("'"); $attributes->add(com_wiris_plugin_api_ConfigurationKeys::$imageConfigPropertiesInv->get($value)); $attributes->add("' : '"); $attributes->add($confVal); $attributes->add("'"); } } $script = new StringBuf(); if ($i > 0) { $script->add("<script type=\"text/javascript\">window.wrs_attributes = {"); $script->add($attributes); $script->add("};</script>"); } $editorUrl = $this->plugin->getImageServiceURL("editor"); $isSegure = com_wiris_system_PropertiesTools::getProperty($prop, "secure", "false") === "true"; if (StringTools::startsWith($editorUrl, "http:") && $isSegure) { $editorUrl = "https:" . _hx_substr($editorUrl, 5, null); } $this->addLine($output, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); $this->addLine($output, "<html><head>"); $this->addLine($output, "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"/>"); $this->addLine($output, $script->b); $this->addLine($output, "<script type=\"text/javascript\" src=\"" . $editorUrl . "?lang=" . rawurlencode($language) . "\"></script>"); $this->addLine($output, "<script type=\"text/javascript\" src=\"../core/editor.js\"></script>"); $this->addLine($output, "<script type=\"text/javascript\" src=\"../lang/" . rawurlencode($language) . "/strings.js\"></script>"); $this->addLine($output, "<title>WIRIS editor</title>"); $this->addLine($output, "<style type=\"text/css\">/*<!--*/html, body, #container { height: 100%; } body { margin: 0; }"); $this->addLine($output, "#links { text-align: right; margin-right: 20px; } #links_rtl {text-align: left; margin-left: 20px;} #controls { float: left; } #controls_rtl {float: right;}/*-->*/</style>"); $this->addLine($output, "</head><body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">"); $this->addLine($output, "<div id=\"container\"><div id=\"editorContainer\"></div><div id=\"controls\"></div>"); $this->addLine($output, "<div id=\"links\"><a href=\"http://www.wiris.com/editor3/docs/manual/latex-support\" id=\"a_latex\" target=\"_blank\">LaTeX</a> | "); $this->addLine($output, "<a href=\"http://www.wiris.com/editor3/docs/manual\" target=\"_blank\" id=\"a_manual\">Manual</a></div></div></body>"); return $output->b; }
static function make_indent($count, $char = null) { $s = new StringBuf(); if ($char === null) { $char = " "; } else { $char = $char; } $_g = 0; while ($_g < $count) { $i = $_g++; $s->add($char); unset($i); } return $s->b; }
public function filterMath($tags, $text, $prop, $safeXML) { $n0 = null; $n1 = null; $output = null; $sub = null; $output = new StringBuf(); $n0 = 0; $n1 = _hx_index_of($text, $tags->in_mathopen, $n0); while ($n1 >= 0) { $output->add(_hx_substr($text, $n0, $n1 - $n0)); $n0 = $n1; $n1 = _hx_index_of($text, $tags->in_mathclose, $n0); if ($n1 >= 0) { $n1 = $n1 + strlen($tags->in_mathclose); $sub = _hx_substr($text, $n0, $n1 - $n0); if ($safeXML) { if ($this->fixUrl === null) { $this->fixUrl = new EReg("<a href=\"[^\"]*\"[^>]*>([^<]*)<\\/a>|<a href=\"[^\"]*\">", ""); } $sub = $this->fixUrl->replace($sub, "\$1"); $sub = $this->html_entity_decode($sub); $sub = str_replace($tags->in_double_quote, $tags->out_double_quote, $sub); $sub = str_replace($tags->in_open, $tags->out_open, $sub); $sub = str_replace($tags->in_close, $tags->out_close, $sub); $sub = str_replace($tags->in_entity, $tags->out_entity, $sub); $sub = str_replace($tags->in_quote, $tags->out_quote, $sub); } $sub = $this->math2Img($sub, $prop); $n0 = $n1; $output->add($sub); $n1 = _hx_index_of($text, $tags->in_mathopen, $n0); } } $output->add(_hx_substr($text, $n0, null)); return $output->b; }
public function decodeString() { $sb = new StringBuf(); $d = $this->c; $this->nextToken(); while ($this->c !== $d) { if ($this->c === 92) { $this->nextToken(); if ($this->c === 110) { $sb->add("\n"); } else { if ($this->c === 114) { $sb->add("\r"); } else { if ($this->c === 34) { $sb->add("\""); } else { if ($this->c === 39) { $sb->add("'"); } else { if ($this->c === 116) { $sb->add("\t"); } else { if ($this->c === 92) { $sb->add("\\"); } else { if ($this->c === 117) { $this->nextToken(); $code = com_wiris_util_json_JSon_2($this, $d, $sb); $this->nextToken(); $code .= com_wiris_util_json_JSon_3($this, $code, $d, $sb); $this->nextToken(); $code .= com_wiris_util_json_JSon_4($this, $code, $d, $sb); $this->nextToken(); $code .= com_wiris_util_json_JSon_5($this, $code, $d, $sb); $dec = Std::parseInt("0x" . $code); $sb->add(com_wiris_util_json_JSon_6($this, $code, $d, $dec, $sb)); unset($dec, $code); } else { throw new HException("Unknown scape sequence '\\" . com_wiris_util_json_JSon_7($this, $d, $sb) . "'"); } } } } } } } } else { $sb->add(com_wiris_util_json_JSon_8($this, $d, $sb)); } $this->nextToken(); } $this->nextToken(); return $sb->b; }
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; }
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(); }
public function save_pay_source($q) { $account = php_Lib::hashOfAssociativeArray($q->get("account")); haxe_Log::trace(Std::string($account) . ":" . Std::string(model_Clients_15($this, $account, $q)), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 676, "className" => "model.Clients", "methodName" => "save_pay_source"))); $pIt = $account->keys(); $user = S::$user; while ($pIt->hasNext()) { $pay_source_id = $pIt->next(); $log_id = $this->save_pay_source_log($pay_source_id, null); if (!$log_id) { return false; } $sql = new StringBuf(); $uFields = model_Clients::$pay_source_fields; $uFields->remove("pay_source_id"); $bindTypes = ""; $values2bind = null; $i = 0; $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes"))); $sets = new _hx_array(array()); $sql->add("UPDATE fly_crm.pay_source SET "); $_g = 0; while ($_g < $uFields->length) { $c = $uFields[$_g]; ++$_g; haxe_Log::trace(_hx_string_or_null($c) . ":" . Std::string(Type::typeof($q->get($c))), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 699, "className" => "model.Clients", "methodName" => "save_pay_source"))); $p = $q->get($c); $val = null; if ($p !== null) { if (!Std::is($p, _hx_qtype("String"))) { $valMap = php_Lib::hashOfAssociativeArray($q->get($c)); $val = $valMap->get(Std::string($pay_source_id)); unset($valMap); } else { $val = $p; } $values2bind[$i++] = $val; $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, $p, $c); } unset($_g); if ($sets->length === 0) { continue; } $sql->add($sets->join(",")); $sql->add(" WHERE pay_source_id=" . _hx_string_rec($pay_source_id, "")); $stmt = S::$my->stmt_init(); haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 727, "className" => "model.Clients", "methodName" => "save_pay_source"))); $success = $stmt->prepare($sql->b); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 731, "className" => "model.Clients", "methodName" => "save_pay_source"))); return false; } haxe_Log::trace($values2bind, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 735, "className" => "model.Clients", "methodName" => "save_pay_source"))); $success = myBindParam($stmt, $values2bind, $bindTypes); haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 737, "className" => "model.Clients", "methodName" => "save_pay_source"))); if ($success) { $success = $stmt->execute(); if (!$success) { haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 743, "className" => "model.Clients", "methodName" => "save_pay_source"))); return false; } $this->save_pay_source_log($pay_source_id, $log_id); if (!$pIt->hasNext()) { return true; } } unset($values2bind, $uFields, $success, $stmt, $sql, $sets, $pay_source_id, $log_id, $i, $dbFieldTypes, $bindTypes); } return false; }
public function buildCond($whereParam, $sob, $phValues, $first = null) { if ($first === null) { $first = true; } $sb = new StringBuf(); $where = _hx_explode(",", $whereParam); if ($where->length === 0) { return false; } $_g = 0; while ($_g < $where->length) { $w = $where[$_g]; ++$_g; $wData = _hx_string_call($w, "split", array("|")); $values = $wData->slice(2, null); $filter_tables = null; if (Util::any2bool($this->param) && $this->param->exists("filter_tables") && Util::any2bool($this->param->get("filter_tables"))) { $jt = $this->param->get("filter_tables"); $filter_tables = _hx_explode(",", $jt); unset($jt); } haxe_Log::trace(Std::string($wData) . ":" . _hx_string_or_null($this->joinTable) . ":" . Std::string($filter_tables), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 386, "className" => "Model", "methodName" => "buildCond"))); if (_hx_deref(new EReg("^pay_[a-zA-Z_]+\\.", ""))->match($wData[0]) && _hx_array_get(_hx_explode(".", $wData[0]), 0) !== $this->joinTable) { continue; } if ($first) { $sb->add(" WHERE "); } else { $sb->add(" AND "); } $first = false; $_g1 = strtoupper($wData[1]); switch ($_g1) { case "BETWEEN": if (!($values->length === 2) && Lambda::hforeach($values, array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_13"), 'execute'))) { S::hexit("BETWEEN needs 2 values - got only:" . _hx_string_or_null($values->join(","))); } $sb->add($this->quoteField($wData[0])); $sb->add(" BETWEEN ? AND ?"); $phValues->push(new _hx_array(array($wData[0], $values[0]))); $phValues->push(new _hx_array(array($wData[0], $values[1]))); break; case "IN": $sb->add($this->quoteField($wData[0])); $sb->add(" IN("); $sb->add($values->map(array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_14"), 'execute'))->join(",")); $sb->add(")"); break; case "LIKE": $sb->add($this->quoteField($wData[0])); $sb->add(" LIKE ?"); $phValues->push(new _hx_array(array($wData[0], $wData[2]))); break; default: $sb->add($this->quoteField($wData[0])); if (_hx_deref(new EReg("^(<|>)", ""))->match($wData[1])) { $eR = new EReg("^(<|>)", ""); $eR->match($wData[1]); $val = Std::parseFloat($eR->matchedRight()); $sb->add(_hx_string_or_null($eR->matched(0)) . "?"); $phValues->push(new _hx_array(array($wData[0], $val))); continue 2; } if ($wData[1] === "NULL") { $sb->add(" IS NULL"); } else { $sb->add(" = ?"); $phValues->push(new _hx_array(array($wData[0], $wData[1]))); } break; } unset($_g1); unset($wData, $w, $values, $filter_tables); } $sob->add($sb->b); return true; }
public function explain_table($sql, $data, $keynames) { $dataset = null; $output = new StringBuf(); $output->add("<table class=\"__table__\">"); $output->add("<tr><td colspan=" . _hx_string_rec($keynames->length, "") . ">"); $output->add($sql); $output->add("</td></tr>"); $output->add("<tr>"); $_g1 = 0; $_g = $keynames->length; while ($_g1 < $_g) { $i = $_g1++; $output->add("<th>" . _hx_string_or_null($keynames[$i]) . "</th>"); unset($i); } $output->add("</tr>"); $_g11 = 0; $_g2 = $data->length; while ($_g11 < $_g2) { $i1 = $_g11++; $output->add("<tr>"); $dataset = $data[$i1]; $_g3 = 0; $_g21 = $keynames->length; while ($_g3 < $_g21) { $j = $_g3++; if ($dataset->exists($keynames[$j])) { $output->add("<td>" . _hx_string_or_null($dataset->get($keynames[$j])) . "</td>"); } else { $output->add("<td> </td>"); } unset($j); } unset($_g3, $_g21); $output->add("</tr>"); unset($i1); } $output->add("</table>"); return $output->b; }
static function indentXml($xml, $space) { $depth = 0; $opentag = new EReg("^<([\\w-_]+)[^>]*>\$", ""); $autotag = new EReg("^<([\\w-_]+)[^>]*/>\$", ""); $closetag = new EReg("^</([\\w-_]+)>\$", ""); $cdata = new EReg("^<!\\[CDATA\\[[^\\]]*\\]\\]>\$", ""); $res = new StringBuf(); $end = 0; $start = null; $text = null; while ($end < strlen($xml) && ($start = _hx_index_of($xml, "<", $end)) !== -1) { $text = $start > $end; if ($text) { $res->add(_hx_substr($xml, $end, $start - $end)); } $end = _hx_index_of($xml, ">", $start) + 1; $aux = _hx_substr($xml, $start, $end - $start); if ($autotag->match($aux)) { $res->add("\n"); $i = null; $_g = 0; while ($_g < $depth) { $i1 = $_g++; $res->add($space); unset($i1); } unset($_g); $res->add($aux); unset($i); } else { if ($opentag->match($aux)) { $res->add("\n"); $i = null; $_g = 0; while ($_g < $depth) { $i1 = $_g++; $res->add($space); unset($i1); } unset($_g); $res->add($aux); $depth++; unset($i); } else { if ($closetag->match($aux)) { $depth--; if (!$text) { $res->add("\n"); $i = null; $_g = 0; while ($_g < $depth) { $i1 = $_g++; $res->add($space); unset($i1); } unset($_g); unset($i); } $res->add($aux); } else { if ($cdata->match($aux)) { $res->add($aux); } else { haxe_Log::trace("WARNING! malformed XML at character " . _hx_string_rec($end, "") . ":" . $xml, _hx_anonymous(array("fileName" => "WXmlUtils.hx", "lineNumber" => 583, "className" => "com.wiris.util.xml.WXmlUtils", "methodName" => "indentXml"))); $res->add($aux); } } } } unset($aux); } return trim($res->b); }
public function filterMath($tags, $text, $prop, $safeXML) { $n0 = null; $n1 = null; $m0 = null; $m1 = null; $output = null; $sub = null; $output = new StringBuf(); $n0 = 0; $n1 = _hx_index_of($text, $tags->in_mathopen, $n0); $tag = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_MATHML_ATTRIBUTE, "data-mathml"); $dataMathml = _hx_index_of($text, $tag, 0); while ($n1 >= 0) { $m0 = $n0; $output->add(_hx_substr($text, $n0, $n1 - $n0)); $n0 = $n1; $n1 = _hx_index_of($text, $tags->in_mathclose, $n0); if ($n1 >= 0) { $n1 = $n1 + strlen($tags->in_mathclose); $sub = _hx_substr($text, $n0, $n1 - $n0); if ($safeXML) { if ($dataMathml !== -1) { $m1 = _hx_index_of($text, "/>", $n1); if ($m1 >= 0 && (_hx_index_of($text, "<img", $n1) === -1 || _hx_index_of($text, "<img", $n1) > $m1)) { $m0 = _hx_last_index_of(_hx_substr($text, $m0, $n0 - $m0), "<img", null); if ($m0 >= 0) { if (_hx_index_of($text, $tag, $m0) > 0 && _hx_index_of($text, $tag, $m0) < $n1) { $n0 = $n1; $output->add($sub); $n1 = _hx_index_of($text, $tags->in_mathopen, $n0); $m0 = $m1; continue; } } } } if ($this->fixUrl === null) { $this->fixUrl = new EReg("<a href=\"[^\"]*\"[^>]*>([^<]*)<\\/a>|<a href=\"[^\"]*\">", ""); } $sub = $this->fixUrl->replace($sub, "\$1"); $sub = $this->html_entity_decode($sub); $sub = str_replace($tags->in_double_quote, $tags->out_double_quote, $sub); $sub = str_replace($tags->in_open, $tags->out_open, $sub); $sub = str_replace($tags->in_close, $tags->out_close, $sub); $sub = str_replace($tags->in_entity, $tags->out_entity, $sub); $sub = str_replace($tags->in_quote, $tags->out_quote, $sub); } $sub = $this->math2Img($sub, $prop); $n0 = $n1; $output->add($sub); $n1 = _hx_index_of($text, $tags->in_mathopen, $n0); } } $output->add(_hx_substr($text, $n0, null)); return $output->b; }
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 propertiesToString($h) { $sb = new StringBuf(); $iter = $h->keys(); $keys = new _hx_array(array()); while ($iter->hasNext()) { $keys->push($iter->next()); } $i = null; $j = null; $n = $keys->length; $_g = 0; while ($_g < $n) { $i1 = $_g++; $_g1 = $i1 + 1; while ($_g1 < $n) { $j1 = $_g1++; $s1 = $keys[$i1]; $s2 = $keys[$j1]; if (com_wiris_util_sys_IniFile::compareStrings($s1, $s2) > 0) { $keys[$i1] = $s2; $keys[$j1] = $s1; } unset($s2, $s1, $j1); } unset($_g1); unset($i1); } $_g = 0; while ($_g < $n) { $i1 = $_g++; $key = $keys[$i1]; $sb->add($key); $sb->add("="); $value = $h->get($key); $value = str_replace("\\", "\\\\", $value); $value = str_replace("\n", "\\n", $value); $value = str_replace("\r", "\\r", $value); $value = str_replace("\t", "\\t", $value); $sb->add($value); $sb->add("\n"); unset($value, $key, $i1); } return $sb->b; }