/** 验证签名 * sso_verify function. * * @access public * @param mixed $tm_time * @param mixed $str_rand * @param mixed $str_sign * @return void */ function sso_verify($tm_time, $str_rand, $str_sign) { $_arr_sso = array("act_get" => "verify", "time" => $tm_time, "random" => $str_rand, "signature" => $str_sign); $_arr_ssoData = array_merge($this->arr_data, $_arr_sso); //合并数组 $_arr_get = fn_http(BG_SSO_URL . "?mod=signature", $_arr_ssoData, "get"); //提交 return fn_jsonDecode($_arr_get["ret"], "no"); }
/** 验证签名 * sso_verify function. * * @access public * @param mixed $tm_time * @param mixed $str_rand * @param mixed $str_sign * @return void */ function sso_verify($arr_params, $str_sign) { $_arr_sso = array("act_post" => "verify", "params" => $arr_params, "signature" => $str_sign); $_arr_ssoData = array_merge($this->arr_data, $_arr_sso); //合并数组 $_arr_get = fn_http(BG_SSO_URL . "?mod=signature", $_arr_ssoData, "post"); //提交 return fn_jsonDecode($_arr_get["ret"], "no"); }
/** 读取 * mdl_read function. * * @access public * @param mixed $str_app * @param string $str_by (default: "app_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_app, $str_by = "app_id", $num_notId = 0) { $_arr_appSelect = array("app_id", "app_name", "app_notice", "app_key", "app_note", "app_token", "app_token_expire", "app_token_time", "app_status", "app_time", "app_ip_allow", "app_ip_bad", "app_sync", "app_allow"); switch ($str_by) { case "app_id": $_str_sqlWhere = "app_id=" . $str_app; break; default: $_str_sqlWhere = $str_by . "='" . $str_app . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND app_id<>" . $num_notId; } $_arr_appRows = $this->obj_db->select(BG_DB_TABLE . "app", $_arr_appSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_appRows[0])) { //用户名不存在则返回错误 $_arr_appRow = $_arr_appRows[0]; } else { return array("alert" => "x050102"); exit; } if (isset($_arr_appRow["app_allow"])) { $_arr_appRow["app_allow"] = fn_jsonDecode($_arr_appRow["app_allow"], "no"); } else { $_arr_appRow["app_allow"] = array(); } $_arr_appRow["alert"] = "y050102"; return $_arr_appRow; }
private function sync_decode($_str_code, $_str_key) { $_str_result = fn_baigoDecode($_str_code, $_str_key); $_arr_result = fn_jsonDecode($_str_result, "decode"); return $_arr_result; }
/** 读取 * mdl_read function. * * @access public * @param mixed $str_admin * @param string $str_by (default: "admin_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_admin, $str_by = "admin_id", $num_notId = 0) { $_arr_adminSelect = array("admin_id", "admin_name", "admin_pass", "admin_note", "admin_nick", "admin_rand", "admin_time", "admin_time_login", "admin_ip", "admin_allow", "admin_status"); switch ($str_by) { case "admin_id": $_str_sqlWhere = "admin_id=" . $str_admin; break; default: $_str_sqlWhere = $str_by . "='" . $str_admin . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND admin_id<>" . $num_notId; } $_arr_adminRows = $this->obj_db->select(BG_DB_TABLE . "admin", $_arr_adminSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_adminRows[0])) { //用户名不存在则返回错误 $_arr_adminRow = $_arr_adminRows[0]; } else { return array("alert" => "x020102"); exit; } if (isset($_arr_adminRow["admin_allow"])) { $_arr_adminRow["admin_allow"] = fn_jsonDecode($_arr_adminRow["admin_allow"], "no"); //json解码 } else { $_arr_adminRow["admin_allow"] = array(); } if (!isset($_arr_adminRow["admin_allow"]["info"])) { $_arr_adminRow["admin_allow"]["info"] = 0; } if (!isset($_arr_adminRow["admin_allow"]["pass"])) { $_arr_adminRow["admin_allow"]["pass"] = 0; } $_arr_adminRow["alert"] = "y020102"; return $_arr_adminRow; }
/** 读取 * mdl_read function. * * @access public * @param mixed $num_logId * @return void */ function mdl_read($num_logId) { $_arr_logSelect = array("log_id", "log_time", "log_operator_id", "log_targets", "log_target_type", "log_title", "log_result", "log_type", "log_status", "log_level"); $_str_sqlWhere = "log_id=" . $num_logId; $_arr_logRows = $this->obj_db->select(BG_DB_TABLE . "log", $_arr_logSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_logRows[0])) { //用户名不存在则返回错误 $_arr_logRow = $_arr_logRows[0]; } else { return array("alert" => "x060102"); exit; } /*if (isset($_arr_logRow["log_result"])) { $_arr_logRow["log_result"] = json_decode($_arr_logRow["log_result"], true); }*/ if (isset($_arr_logRow["log_targets"])) { $_arr_logRow["log_targets"] = fn_jsonDecode($_arr_logRow["log_targets"], "no"); } else { $_arr_logRow["log_targets"] = array(); } $_arr_logRow["alert"] = "y060102"; return $_arr_logRow; }
/** api 读取 * mdl_read_api function. * * @access public * @param mixed $str_user * @param string $str_by (default: "user_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read_api($str_user, $str_by = "user_id", $num_notId = 0) { $_arr_userSelect = array("user_id", "user_name", "user_mail", "user_contact", "user_extend", "user_nick", "user_status", "user_time", "user_time_login", "user_ip"); switch ($str_by) { case "user_id": $_str_sqlWhere = "user_id=" . $str_user; break; default: $_str_sqlWhere = $str_by . "='" . $str_user . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND user_id<>" . $num_notId; } $_arr_userRows = $this->obj_db->select(BG_DB_TABLE . "user", $_arr_userSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_userRows[0])) { //用户名不存在则返回错误 $_arr_userRow = $_arr_userRows[0]; } else { return array("alert" => "x010102"); } $_arr_userRow["user_contact"] = fn_jsonDecode($_arr_userRow["user_contact"], "decode"); $_arr_userRow["user_extend"] = fn_jsonDecode($_arr_userRow["user_extend"], "decode"); $_arr_userRow["alert"] = "y010102"; return $_arr_userRow; }
/** * mdl_read function. * * @access public * @param mixed $num_adminId * @return void */ function mdl_read($num_adminId) { $_arr_adminSelect = array("admin_id", "admin_name", "admin_note", "admin_nick", "admin_rand", "admin_group_id", "admin_status", "admin_time", "admin_ip", "admin_allow_cate", "admin_allow_profile"); $_arr_adminRows = $this->obj_db->select(BG_DB_TABLE . "admin", $_arr_adminSelect, "admin_id=" . $num_adminId, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_adminRows[0])) { //用户名不存在则返回错误 $_arr_adminRow = $_arr_adminRows[0]; } else { return array("alert" => "x020102"); exit; } if (isset($_arr_adminRow["admin_allow_cate"])) { $_arr_adminRow["admin_allow_cate"] = fn_jsonDecode($_arr_adminRow["admin_allow_cate"], "no"); //json解码 } else { $_arr_adminRow["admin_allow_cate"] = array(); } if (isset($_arr_adminRow["admin_allow_profile"])) { $_arr_adminRow["admin_allow_profile"] = fn_jsonDecode($_arr_adminRow["admin_allow_profile"], "no"); //json解码 } else { $_arr_adminRow["admin_allow_profile"] = array(); } if (!isset($_arr_adminRow["admin_allow_profile"]["info"])) { $_arr_adminRow["admin_allow"]["info"] = 0; } if (!isset($_arr_adminRow["admin_allow_profile"]["pass"])) { $_arr_adminRow["admin_allow"]["pass"] = 0; } $_arr_adminRow["alert"] = "y020102"; return $_arr_adminRow; }
function ctl_form() { $_num_posiId = fn_getSafe(fn_get("posi_id"), "int", 0); if ($_num_posiId > 0) { if (!isset($this->adminLogged["admin_allow"]["posi"]["edit"])) { return array("alert" => "x040303"); exit; } $_arr_posiRow = $this->mdl_posi->mdl_read($_num_posiId); if ($_arr_posiRow["alert"] != "y040102") { return $_arr_posiRow; exit; } } else { if ($GLOBALS["act_get"] == "form") { if (!isset($this->adminLogged["admin_allow"]["posi"]["add"])) { return array("alert" => "x040302"); exit; } $_arr_posiRow = array("posi_id" => 0, "posi_name" => "", "posi_count" => 1, "posi_type" => "media", "posi_width" => "", "posi_height" => "", "posi_status" => "enable", "posi_script" => "", "posi_plugin" => "", "posi_selector" => "", "posi_opts" => array(), "posi_is_percent" => "enable", "posi_note" => ""); } } $_arr_scriptRows = $this->obj_dir->list_dir(BG_PATH_SCRIPT); foreach ($_arr_scriptRows as $_key => $_value) { if ($_value["type"] == "file") { unset($_arr_scriptRows[$_key]); } else { $_str_config = file_get_contents(BG_PATH_SCRIPT . $_value["name"] . "/config.json"); $_arr_scriptRows[$_key]["config"] = fn_jsonDecode($_str_config, "no"); } } //print_r($_arr_scriptRows); $_arr_tpl = array("posiRow" => $_arr_posiRow, "scriptRows" => $_arr_scriptRows, "scriptJSON" => fn_jsonEncode($_arr_scriptRows, "no")); $_arr_tplData = array_merge($this->tplData, $_arr_tpl); $this->obj_tpl->tplDisplay("posi_form.tpl", $_arr_tplData); return array("alert" => "y040102"); }
/** 读取 * mdl_read function. * * @access public * @param mixed $str_app * @param string $str_by (default: "app_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_app, $str_by = "app_id", $num_notId = 0) { $_arr_appSelect = array("app_id", "app_name", "app_url_notify", "app_url_sync", "app_key", "app_note", "app_status", "app_time", "app_ip_allow", "app_ip_bad", "app_sync", "app_allow"); if (is_numeric($str_app)) { $_str_sqlWhere = $str_by . "=" . $str_app; } else { $_str_sqlWhere = $str_by . "='" . $str_app . "'"; } if ($num_notId > 0) { $_str_sqlWhere .= " AND app_id<>" . $num_notId; } $_arr_appRows = $this->obj_db->select(BG_DB_TABLE . "app", $_arr_appSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_appRows[0])) { //用户名不存在则返回错误 $_arr_appRow = $_arr_appRows[0]; } else { return array("alert" => "x050102"); } if (isset($_arr_appRow["app_allow"])) { $_arr_appRow["app_allow"] = fn_jsonDecode($_arr_appRow["app_allow"], "no"); } else { $_arr_appRow["app_allow"] = array(); } if (!$_arr_appRow["app_url_sync"]) { $_arr_appRow["app_url_sync"] = $_arr_appRow["app_url_notify"]; } $_arr_appRow["app_url_notify"] = fn_htmlcode($_arr_appRow["app_url_notify"], "decode", "url"); $_arr_appRow["app_url_sync"] = fn_htmlcode($_arr_appRow["app_url_sync"], "decode", "url"); $_arr_appRow["alert"] = "y050102"; return $_arr_appRow; }
/** * mdl_read function. * * @access public * @param mixed $str_group * @param string $str_readBy (default: "group_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_group, $str_readBy = "group_id", $num_notId = 0) { $_arr_groupSelect = array("group_id", "group_name", "group_note", "group_allow", "group_type", "group_status"); switch ($str_readBy) { case "group_id": $_str_sqlWhere = $str_readBy . "=" . $str_group; break; default: $_str_sqlWhere = $str_readBy . "='" . $str_group . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND group_id<>" . $num_notId; } $_arr_groupRows = $this->obj_db->select(BG_DB_TABLE . "group", $_arr_groupSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_groupRows[0])) { $_arr_groupRow = $_arr_groupRows[0]; } else { return array("alert" => "x040102"); exit; } if (isset($_arr_groupRow["group_allow"])) { $_arr_groupRow["group_allow"] = fn_jsonDecode($_arr_groupRow["group_allow"], "no"); //json解码 } else { $_arr_groupRow["group_allow"] = array(); } $_arr_groupRow["alert"] = "y040102"; return $_arr_groupRow; }
/** * mdl_read function. * * @access public * @param mixed $str_posi * @param string $str_readBy (default: "posi_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_posi, $str_readBy = "posi_id", $num_notId = 0) { $_arr_posiSelect = array("posi_id", "posi_name", "posi_count", "posi_type", "posi_width", "posi_height", "posi_status", "posi_script", "posi_plugin", "posi_selector", "posi_opts", "posi_is_percent", "posi_note"); switch ($str_readBy) { case "posi_id": $_str_sqlWhere = $str_readBy . "=" . $str_posi; break; default: $_str_sqlWhere = $str_readBy . "='" . $str_posi . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND posi_id<>" . $num_notId; } $_arr_posiRows = $this->obj_db->select(BG_DB_TABLE . "posi", $_arr_posiSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_posiRows[0])) { $_arr_posiRow = $_arr_posiRows[0]; } else { return array("alert" => "x040102"); exit; } $_arr_posiRow["posi_opts"] = fn_jsonDecode($_arr_posiRow["posi_opts"], "decode"); $_arr_posiRow["alert"] = "y040102"; return $_arr_posiRow; }
/** * mdl_list function. * * @access public * @param string $str_status (default: "") * @param string $str_target (default: "") * @param int $num_parentId (default: 0) * @return void */ function mdl_list($num_no, $num_except = 0, $str_key = "", $str_status = "", $num_parentId = 0, $num_level = 1, $is_tree = true) { $_arr_updateData = array("custom_order" => "custom_id"); $_num_mysql = $this->obj_db->update(BG_DB_TABLE . "custom", $_arr_updateData, "custom_order=0", true); //更新数据 $_arr_customSelect = array("custom_id", "custom_name", "custom_type", "custom_opt", "custom_status", "custom_parent_id", "custom_cate_id", "custom_format", "custom_require"); if ($is_tree) { $_str_sqlWhere = "custom_parent_id=" . $num_parentId; } else { $_str_sqlWhere = "1=1"; } if ($str_key) { $_str_sqlWhere .= " AND custom_name LIKE '%" . $str_key . "%'"; } if ($str_status) { $_str_sqlWhere .= " AND custom_status='" . $str_status . "'"; } //print_r($_str_sqlWhere); $_arr_customRows = $this->obj_db->select(BG_DB_TABLE . "custom", $_arr_customSelect, $_str_sqlWhere, "", "custom_order ASC, custom_id ASC", $num_no, $num_except); foreach ($_arr_customRows as $_key => $_value) { $_arr_customRows[$_key]["custom_opt"] = fn_jsonDecode($_value["custom_opt"], "decode"); $_arr_customRows[$_key]["custom_level"] = $num_level; if ($is_tree) { $_arr_customRows[$_key]["custom_childs"] = $this->mdl_list(1000, 0, $str_key, $str_status, $_value["custom_id"], $num_level + 1); } } return $_arr_customRows; }
/** * result_process function. * * @access private * @return void */ private function result_process($arr_get) { //print_r($arr_get); if (!isset($arr_get["ret"])) { $_arr_result = array("alert" => "x030110"); return $_arr_result; } $_arr_result = fn_jsonDecode($arr_get["ret"], "no"); if (!isset($_arr_result["alert"])) { $_arr_result = array("alert" => "x030110"); return $_arr_result; } if (!isset($_arr_result["prd_sso_pub"]) || $_arr_result["prd_sso_pub"] < 20160906) { $_arr_result = array("alert" => "x030113"); return $_arr_result; } $_arr_result["alert"] = str_ireplace("x020204", "x020206", $_arr_result["alert"]); //SSO 管理员已存在 $_arr_result["alert"] = str_ireplace("x030403", "x030408", $_arr_result["alert"]); //SSO 已安装 $_arr_result["alert"] = str_ireplace("x030404", "x030419", $_arr_result["alert"]); //SSO 数据库未正确设置 $_arr_result["alert"] = str_ireplace("x030410", "x030413", $_arr_result["alert"]); //SSO 需要执行安装程序 $_arr_result["alert"] = str_ireplace("x030411", "x030414", $_arr_result["alert"]); //SSO 需要执行升级程序 return $_arr_result; }
/** 读取 * mdl_read function. * * @access public * @param mixed $str_admin * @param string $str_by (default: "admin_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_admin, $str_by = "admin_id", $num_notId = 0) { $_arr_adminSelect = array("admin_id", "admin_name", "admin_pass", "admin_note", "admin_nick", "admin_rand", "admin_time", "admin_time_login", "admin_ip", "admin_allow", "admin_status", "admin_type"); if (is_numeric($str_admin)) { $_str_sqlWhere = $str_by . "=" . $str_admin; //如果读取值为数字 } else { $_str_sqlWhere = $str_by . "='" . $str_admin . "'"; } if ($num_notId > 0) { $_str_sqlWhere .= " AND admin_id<>" . $num_notId; } $_arr_adminRows = $this->obj_db->select(BG_DB_TABLE . "admin", $_arr_adminSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_adminRows[0])) { //用户名不存在则返回错误 $_arr_adminRow = $_arr_adminRows[0]; } else { return array("alert" => "x020102"); } if (isset($_arr_adminRow["admin_allow"])) { $_arr_adminRow["admin_allow"] = fn_jsonDecode($_arr_adminRow["admin_allow"], "no"); //json 解码 } else { $_arr_adminRow["admin_allow"] = array(); } $_arr_adminRow["alert"] = "y020102"; return $_arr_adminRow; }
/** * mdl_read function. * * @access public * @param mixed $str_call * @param string $str_readBy (default: "call_id") * @param int $num_notId (default: 0) * @return void */ function mdl_read($str_call, $str_readBy = "call_id", $num_notId = 0) { $_arr_callSelect = array("call_id", "call_name", "call_type", "call_file", "call_status", "call_amount", "call_cate_ids", "call_cate_excepts", "call_cate_id", "call_spec_id", "call_mark_ids", "call_attach"); switch ($str_readBy) { case "call_id": $_str_sqlWhere = $str_readBy . "=" . $str_call; break; default: $_str_sqlWhere = $str_readBy . "='" . $str_call . "'"; break; } if ($num_notId > 0) { $_str_sqlWhere .= " AND call_id<>" . $num_notId; } $_arr_callRows = $this->obj_db->select(BG_DB_TABLE . "call", $_arr_callSelect, $_str_sqlWhere, "", "", 1, 0); //检查本地表是否存在记录 if (isset($_arr_callRows[0])) { $_arr_callRow = $_arr_callRows[0]; } else { return array("alert" => "x170102"); exit; } if (isset($_arr_callRow["call_amount"])) { $_arr_callRow["call_amount"] = fn_jsonDecode($_arr_callRow["call_amount"], "no"); //json解码 } else { $_arr_callRow["call_amount"] = array(); } if (isset($_arr_callRow["call_cate_ids"])) { $_arr_callRow["call_cate_ids"] = fn_jsonDecode($_arr_callRow["call_cate_ids"], "no"); //json解码 } else { $_arr_callRow["call_cate_ids"] = array(); } if (isset($_arr_callRow["call_cate_excepts"])) { $_arr_callRow["call_cate_excepts"] = fn_jsonDecode($_arr_callRow["call_cate_excepts"], "no"); //json解码 } else { $_arr_callRow["call_cate_excepts"] = array(); } if (isset($_arr_callRow["call_mark_ids"])) { $_arr_callRow["call_mark_ids"] = fn_jsonDecode($_arr_callRow["call_mark_ids"], "no"); //json解码 } else { $_arr_callRow["call_mark_ids"] = array(); } $_arr_callRow["alert"] = "y170102"; return $_arr_callRow; }
/** * result_process function. * * @access private * @return void */ private function result_process($arr_get) { if (!isset($arr_get["ret"])) { $_arr_result = array("alert" => "x030110"); return $_arr_result; exit; } $_arr_result = fn_jsonDecode($arr_get["ret"], "no"); if (!isset($_arr_result["alert"])) { $_arr_result = array("alert" => "x030110"); return $_arr_result; exit; } if (!isset($_arr_result["prd_sso_pub"]) || $_arr_result["prd_sso_pub"] < 20151116) { $_arr_result = array("alert" => "x030114"); return $_arr_result; exit; } $_arr_result["alert"] = str_replace("x030410", "x030413", $_arr_result["alert"]); $_arr_result["alert"] = str_replace("x030411", "x030414", $_arr_result["alert"]); $_arr_result["alert"] = str_replace("x030403", "x030408", $_arr_result["alert"]); $_arr_result["alert"] = str_replace("x030404", "x030419", $_arr_result["alert"]); $_arr_result["alert"] = str_replace("x020204", "x020206", $_arr_result["alert"]); return $_arr_result; }