public function edit($param) { $fieldNames = new haxe_ds_StringMap(); $typeMap = new haxe_ds_StringMap(); $optionsMap = new haxe_ds_StringMap(); $eF = $this->getEditorFields(null); $keys = $eF->keys(); $tableNames = new _hx_array(array()); $tableFields = new haxe_ds_StringMap(); while ($keys->hasNext()) { $k = $keys->next(); haxe_Log::trace($k, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 55, "className" => "model.Clients", "methodName" => "edit"))); $tableNames->push($k); $aFields = $eF->get($k); $cFields = $aFields->map(array(new _hx_lambda(array(&$aFields, &$eF, &$fieldNames, &$k, &$keys, &$optionsMap, &$param, &$tableFields, &$tableNames, &$typeMap), "model_Clients_0"), 'execute')); $tableFields->set($k, $cFields); $_g1 = 0; $_g = $cFields->length; while ($_g1 < $_g) { $f = $_g1++; $fieldNames->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_name")); if (_hx_array_get($aFields, $f)->get("field_options") !== null) { $optionsMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_options")); } $typeMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_type")); unset($f); } unset($_g1, $_g); unset($k, $cFields, $aFields); } $editTables = new haxe_ds_StringMap(); $ti = 0; $_g2 = 0; while ($_g2 < $tableNames->length) { $table = $tableNames[$_g2]; ++$_g2; $p = new haxe_ds_StringMap(); $sb = new StringBuf(); $phValues = new _hx_array(array()); $p->set("primary_id", $param->get("primary_id")); if ($table === "clients") { $p->set("table", "vicidial_list"); $p->set("jointable", "fly_crm." . _hx_string_or_null($table)); $p->set("joincond", "ON vicidial_list.lead_id=fly_crm.clients.lead_id"); $p->set("fields", Std::string(_hx_string_call($param->get("fields"), "split", array(","))->map(array(new _hx_lambda(array(&$_g2, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_1"), 'execute'))->join(",")) . "," . _hx_string_or_null($tableFields->get($table)->map(array(new _hx_lambda(array(&$_g2, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_2"), 'execute'))->join(","))); $p->set("where", "vicidial_list.lead_id|" . Std::string($param->get("lead_id"))); $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doJoin($p, $sb, $phValues))); } else { $p->set("table", "fly_crm." . _hx_string_or_null($table)); $p->set("fields", $tableFields->get($table)->join(",")); $p->set("where", "client_id|" . Std::string($param->get("client_id"))); $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues))); } haxe_Log::trace($p, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 105, "className" => "model.Clients", "methodName" => "edit"))); unset($table, $sb, $phValues, $p); } $this->data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "editData" => php_Lib::associativeArrayOfHash($editTables), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $this->getRecordings(Std::parseInt($param->get("lead_id"))))); return $this->json_encode(); }
static function get_file_etag($fullpath) { if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); return _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { return ""; } }
public function __construct($e, $sql = null) { if (!php_Boot::$skip_constructor) { parent::__construct(null, _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 78, "className" => "system.base.BadSQLException", "methodName" => "new"))); $strings = null; $strings = _hx_string_call($e, "split", array(";")); haxe_Log::trace(system_base_Sql_colour::pretify($sql), _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 81, "className" => "system.base.BadSQLException", "methodName" => "new"))); haxe_Log::trace(system_base_Sql_colour::pretify($strings[0]), _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 82, "className" => "system.base.BadSQLException", "methodName" => "new"))); system_base_Error::wipe("SQL said: " . _hx_string_or_null($strings[1])); } }
public function isEditorLicensed() { $licenseClass = Type::resolveClass("com.wiris.util.sys.License"); if ($licenseClass !== null) { $init = Reflect::field($licenseClass, "init"); $initMethodParams = new _hx_array(array()); $initMethodParams->push($this->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_KEY, "")); $initMethodParams->push(""); $initMethodParams->push(new _hx_array(array(4, 5, 9, 10))); Reflect::callMethod($licenseClass, $init, $initMethodParams); $isLicensedMethod = Reflect::field($licenseClass, "isLicensed"); $isLicensedObject = Reflect::callMethod($licenseClass, $isLicensedMethod, null); $isLicensed = null; if (_hx_index_of(Type::getClassName(Type::getClass($isLicensedObject)), "Boolean", null) !== -1) { $isLicensed = _hx_string_call($isLicensedObject, "toString", array()); } else { $isLicensed = $isLicensedObject; } return $isLicensed; } 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 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(); }
static function tableFields($table, $db = null) { if ($db === null) { $db = "asterisk"; } $res = S::$my->query("SELECT GROUP_CONCAT(COLUMN_NAME) FROM information_schema.columns WHERE table_schema = \"" . _hx_string_or_null($db) . "\" AND table_name = \"" . _hx_string_or_null($table) . "\";", null); if (Util::any2bool($res) && $res->num_rows === 1) { return _hx_string_call(_hx_array_get($res->fetch_array(2), 0), "split", array(",")); } return null; }
function Index_0(&$base, &$cache, &$cl, &$params, &$profiler, &$route, &$user_class, &$user_method) { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (!file_exists($fullpath)) { return false; } else { $r_query = $router->query_string; $fin = sys_io_File::read($fullpath, false); $query = $fin->readLine(); if ($r_query === $query) { $etag = null; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); $etag = _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { $etag = ""; } if (php_Web::getClientHeader("If-none-match") === $etag) { php_Web::setReturnCode(304); $fin->close(); return true; } else { while (!system_base_Cache::$cookie_buffer->isEmpty()) { system_base_Wet_base::send_cookie(system_base_Cache::$cookie_buffer->pop()); } header("X-Powered-By" . ": " . "Webrathea/0.4 (PHP)"); $value = DateTools::format(Date::now(), "%a, %d %b %Y %X %Z"); header("Date" . ": " . _hx_string_or_null($value)); header("X-Frame-Options" . ": " . "sameorigin"); header("X-XSS-Protection" . ": " . "1; mode=block"); php_Web::setReturnCode(200); $value1 = Std::string(sys_FileSystem::stat($fullpath)->size); header("Content-Length" . ": " . _hx_string_or_null($value1)); header("ETag" . ": " . _hx_string_or_null($etag)); $m = null; $pos = strlen($query); $fin1 = sys_io_File::read($fullpath, false); $size = sys_FileSystem::stat($fullpath)->size; $fin1->seek($pos, sys_io_FileSeek::$SeekBegin); $output = $fin1->readString($size - $pos); $fin1->close(); $m = $output; $message = null; $message = Std::string($m); haxe_Log::trace("DEPRECATED FUNCTION: " . _hx_string_or_null($message), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 449, "className" => "system.base.Wet_base", "methodName" => "echo"))); $fin->close(); return true; } unset($etag); } else { $fin->close(); return false; } unset($r_query, $query, $fin); } unset($router, $hash, $fullpath); }
public function edit($param) { $fieldNames = new haxe_ds_StringMap(); $typeMap = null; $typeMap = model_Clients_5($this, $fieldNames, $param, $typeMap); $optionsMap = new haxe_ds_StringMap(); $eF = $this->getEditorFields(null); $keys = $eF->keys(); $tableNames = new _hx_array(array()); $tableFields = new haxe_ds_StringMap(); haxe_Log::trace($param, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 139, "className" => "model.Clients", "methodName" => "edit"))); while ($keys->hasNext()) { $k = $keys->next(); $tableNames->push($k); $aFields = $eF->get($k); $cFields = $aFields->map(array(new _hx_lambda(array(&$aFields, &$eF, &$fieldNames, &$k, &$keys, &$optionsMap, &$param, &$tableFields, &$tableNames, &$typeMap), "model_Clients_6"), 'execute')); $tableFields->set($k, $cFields); $_g2 = 0; $_g1 = $cFields->length; while ($_g2 < $_g1) { $f = $_g2++; $fieldNames->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_name")); if (_hx_array_get($aFields, $f)->get("field_options") !== null) { $optionsMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_options")); } $typeMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_type")); unset($f); } unset($_g2, $_g1); unset($k, $cFields, $aFields); } haxe_Log::trace($tableNames, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 158, "className" => "model.Clients", "methodName" => "edit"))); $editTables = new haxe_ds_StringMap(); $ti = 0; $tableNames->remove("vicidial_list"); $tableNames->push("buchungs_anforderungen"); $_g11 = 0; while ($_g11 < $tableNames->length) { $table = $tableNames[$_g11]; ++$_g11; $p = new haxe_ds_StringMap(); $sb = new StringBuf(); $phValues = new _hx_array(array()); $p->set("primary_id", $param->get("primary_id")); switch ($table) { case "clients": $p->set("table", "vicidial_list"); $p->set("jointable", "fly_crm." . _hx_string_or_null($table)); $p->set("joincond", $param->get("joincond")); $p->set("fields", Std::string(_hx_string_call($param->get("fields"), "split", array(","))->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_7"), 'execute'))->join(",")) . "," . _hx_string_or_null($tableFields->get($table)->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_8"), 'execute'))->join(","))); $p->set("where", "vicidial_list.lead_id|" . Std::string($param->get("lead_id"))); $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doJoin($p, $sb, $phValues))); break; case "buchungs_anforderungen": $p->set("table", "fly_crm." . _hx_string_or_null($table)); $p->set("fields", model_Clients::$pay_history_fields->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_9"), 'execute'))->join(",")); $p->set("where", "`Mandat-ID`|" . Std::string($param->get("client_id")) . "K1"); $editTables->set("pay_history", php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues))); break; default: $p->set("table", model_Clients_10($this, $_g11, $eF, $editTables, $fieldNames, $keys, $optionsMap, $p, $param, $phValues, $sb, $table, $tableFields, $tableNames, $ti, $typeMap)); $p->set("fields", $tableFields->get($table)->join(",")); if ($table === "vicidial_list") { $p->set("where", "vendor_lead_code|" . Std::string($param->get("client_id"))); } else { $p->set("where", "client_id|" . Std::string($param->get("client_id"))); } $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues))); if ($table === "pay_source") { haxe_Log::trace($tableFields->get($table), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 198, "className" => "model.Clients", "methodName" => "edit"))); } break; } unset($table, $sb, $phValues, $p); } $recordings = $this->getRecordings(Std::parseInt($param->get("lead_id"))); $editTables->set("konto_auszug", php_Lib::hashOfAssociativeArray(_hx_deref(new model_ClientHistory(null))->findClient(model_Clients_11($this, $eF, $editTables, $fieldNames, $keys, $optionsMap, $param, $recordings, $tableFields, $tableNames, $ti, $typeMap), true))); $this->data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "editData" => php_Lib::associativeArrayOfHash($editTables), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $recordings)); $userMap = new haxe_ds_StringMap(); $sb1 = new StringBuf(); $phValues1 = new _hx_array(array()); $p1 = new haxe_ds_StringMap(); $p1->set("table", "vicidial_users"); $p1->set("fields", "user,full_name"); $p1->set("where", "user_group|AGENTS_A"); $owner = Std::parseInt(model_Clients_12($this, $eF, $editTables, $fieldNames, $keys, $optionsMap, $p1, $param, $phValues1, $recordings, $sb1, $tableFields, $tableNames, $ti, $typeMap, $userMap)); haxe_Log::trace($owner, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 218, "className" => "model.Clients", "methodName" => "edit"))); $this->data->userMap = _hx_deref(new model_Users(null))->get_info(null); return $this->json_encode(); }
static function cache_to_disk() { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $query = $router->query_string; $fout = sys_io_File::write(_hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm", false); $fout->writeString(_hx_string_or_null($query) . "\n" . _hx_string_or_null(system_base_Cache::$output_buffer->toString())); $fout->close(); $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); return _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { return ""; } }