static function getParams() { $a = array_merge($_GET, $_POST); if (get_magic_quotes_gpc()) { reset($a); while (list($k, $v) = each($a)) { $a[$k] = stripslashes((string) $v); } } return php_Lib::hashOfAssociativeArray($a); }
static function checkAuth() { S::$user = php_Session::get("PHP_AUTH_USER"); haxe_Log::trace(S::$user, _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 98, "className" => "S", "methodName" => "checkAuth"))); if (S::$user === null) { return false; } $pass = php_Session::get("PHP_AUTH_PW"); if ($pass === null) { return false; } $res = php_Lib::hashOfAssociativeArray(_hx_deref(new Model(null))->query("SELECT use_non_latin,webroot_writable,pass_hash_enabled,pass_key,pass_cost,hosted_settings FROM system_settings")); if (S_0($pass, $res) === "1") { S::hexit("ENCRYPTED PASSWORDS NOT IMPLEMENTED"); } $res = php_Lib::hashOfAssociativeArray(_hx_deref(new Model(null))->query("SELECT count(*) AS cnt FROM vicidial_users WHERE user=\"" . _hx_string_or_null(S::$user) . "\" and pass=\"" . _hx_string_or_null($pass) . "\" and user_level > 7 and active=\"Y\"")); return $res->exists("0") && S_1($pass, $res) === "1"; }
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 environment() { return php_Lib::hashOfAssociativeArray($_SERVER); }
public function get_clientHeaders() { if ($this->clientHeaders === null) { $this->clientHeaders = new haxe_ds_StringMap(); $headers = php_Lib::hashOfAssociativeArray(apache_request_headers()); if (null == $headers) { throw new HException('null iterable'); } $__hx__it = $headers->keys(); while ($__hx__it->hasNext()) { unset($name); $name = $__hx__it->next(); $_g = 0; $_g1 = _hx_explode(",", $headers->get($name)); while ($_g < $_g1->length) { $val = $_g1[$_g]; ++$_g; ufront_core__MultiValueMap_MultiValueMap_Impl_::add($this->clientHeaders, $name, trim($val)); unset($val); } unset($_g1, $_g); } } return $this->clientHeaders; }
public function getEditorFields($table_name = null) { $sb = new StringBuf(); $phValues = new _hx_array(array()); $param = new haxe_ds_StringMap(); $param->set("table", "fly_crm.editor_fields"); $param->set("where", "field_cost|>-2" . _hx_string_or_null(Model_18($this, $param, $phValues, $sb, $table_name))); $param->set("fields", "field_name,field_label,field_type,field_options,table_name"); $param->set("order", "table_name,field_rank,field_order"); $param->set("limit", "100"); $eFields = null; $a = $this->doSelect($param, $sb, $phValues); $eFields = new _hx_array($a); $ret = new haxe_ds_StringMap(); $_g = 0; while ($_g < $eFields->length) { $ef = $eFields[$_g]; ++$_g; $table = $ef["table_name"]; if (!$ret->exists($table)) { $ret->set($table, new _hx_array(array())); } $a1 = $ret->get($table); $a1->push(php_Lib::hashOfAssociativeArray($ef)); $ret->set($table, $a1); unset($table, $ef, $a1); } return $ret; }
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; }
static function parseMultipart($onPart, $onData) { $a = $_POST; if (get_magic_quotes_gpc()) { reset($a); while (list($k, $v) = each($a)) { $a[$k] = stripslashes((string) $v); } } $post = php_Lib::hashOfAssociativeArray($a); if (null == $post) { throw new HException('null iterable'); } $__hx__it = $post->keys(); while ($__hx__it->hasNext()) { unset($key); $key = $__hx__it->next(); call_user_func_array($onPart, array($key, "")); $v = $post->get($key); if (is_array($v)) { $map = php_Lib::hashOfAssociativeArray($v); $first = true; if (null == $map) { throw new HException('null iterable'); } $__hx__it2 = $map->iterator(); while ($__hx__it2->hasNext()) { unset($val); $val = $__hx__it2->next(); if (!$first) { call_user_func_array($onPart, array($key, "")); } call_user_func_array($onData, array(haxe_io_Bytes::ofString($val), 0, strlen($val))); $first = false; } unset($map, $first); } else { call_user_func_array($onData, array(haxe_io_Bytes::ofString($v), 0, strlen($v))); } unset($v); } if (!isset($_FILES)) { return; } $parts = new _hx_array(array_keys($_FILES)); $_g = 0; while ($_g < $parts->length) { $part = $parts[$_g]; ++$_g; $info = $_FILES[$part]; $tmp = $info["tmp_name"]; $file = $info["name"]; $err = $info["error"]; if ($err > 0) { switch ($err) { case 1: throw new HException("The uploaded file exceeds the max size of " . _hx_string_or_null(ini_get("upload_max_filesize"))); break; case 2: throw new HException("The uploaded file exceeds the max file size directive specified in the HTML form (max is" . _hx_string_or_null(_hx_string_or_null(ini_get("post_max_size")) . ")")); break; case 3: throw new HException("The uploaded file was only partially uploaded"); break; case 4: continue 2; break; case 6: throw new HException("Missing a temporary folder"); break; case 7: throw new HException("Failed to write file to disk"); break; case 8: throw new HException("File upload stopped by extension"); break; } } call_user_func_array($onPart, array($part, $file)); if ("" !== $file) { $h = fopen($tmp, "r"); $bsize = 8192; while (!feof($h)) { $buf = fread($h, $bsize); $size = strlen($buf); call_user_func_array($onData, array(haxe_io_Bytes::ofString($buf), 0, $size)); unset($size, $buf); } fclose($h); unset($h, $bsize); } unset($tmp, $part, $info, $file, $err); } }
static function getCookies() { return php_Lib::hashOfAssociativeArray($_COOKIE); }
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; }