/** * ctl_list function. * * @access public * @return void */ function ctl_list() { if (!isset($this->adminLogged["groupRow"]["group_allow"]["opt"]["custom"])) { return array("alert" => "x200301"); exit; } $_str_key = fn_getSafe(fn_get("key"), "txt", ""); $_str_status = fn_getSafe(fn_get("status"), "txt", ""); $_str_type = fn_getSafe(fn_get("type"), "txt", ""); $_num_customId = fn_getSafe(fn_get("custom_id"), "int", 0); $_arr_search = array("act_get" => $GLOBALS["act_get"], "key" => $_str_key, "status" => $_str_status, "type" => $_str_type); $_num_customCount = $this->mdl_custom->mdl_count($_str_key, $_str_type, $_str_status); $_arr_page = fn_page($_num_customCount); //取得分页数据 $_str_query = http_build_query($_arr_search); $_arr_customRows = $this->mdl_custom->mdl_list(BG_DEFAULT_PERPAGE, $_arr_page["except"], $_str_key, $_str_type, $_str_status); //print_r($_arr_customRows); if ($_num_customId > 0) { $_arr_customRow = $this->mdl_custom->mdl_read($_num_customId); if ($_arr_customRow["alert"] != "y200102") { return $_arr_customRow; exit; } } else { $_arr_customRow = array("custom_id" => 0, "custom_name" => "", "custom_target" => "", "custom_type" => "", "custom_opt" => "", "custom_status" => "enable"); } $_arr_tpl = array("query" => $_str_query, "pageRow" => $_arr_page, "search" => $_arr_search, "customRow" => $_arr_customRow, "customRows" => $_arr_customRows, "fields" => $this->fields, "fieldsJson" => fn_jsonEncode($this->fields, "no")); $_arr_tplData = array_merge($this->tplData, $_arr_tpl); $this->obj_tpl->tplDisplay("custom_list.tpl", $_arr_tplData); return array("alert" => "y200301"); }
/** 编码 * sso_encode function. * * @access public * @param mixed $_str_json * @return void */ function sso_encode($arr_data) { $_arr_json = array_merge($this->arr_data, $arr_data); //合并数组 $_str_json = fn_jsonEncode($_arr_json, "encode"); $_arr_sso = array("act_post" => "encode", "data" => $_str_json); $_arr_ssoData = array_merge($this->arr_data, $_arr_sso); $_arr_get = fn_http(BG_SSO_URL . "?mod=code", $_arr_ssoData, "post"); //提交 return fn_jsonDecode($_arr_get["ret"], "no"); }
function api_logout() { $this->app_check(); $_arr_userSubmit = $this->mdl_user->input_get_by("post"); if ($_arr_userSubmit["alert"] != "ok") { $this->obj_api->halt_re($_arr_userSubmit); } $_arr_userRow = $this->mdl_user->mdl_read($_arr_userSubmit["user_str"], $_arr_userSubmit["user_by"]); if ($_arr_userRow["alert"] != "y010102") { $this->obj_api->halt_re($_arr_userRow); } if ($_arr_userRow["user_status"] == "disable") { $_arr_return = array("alert" => "x010401"); $this->obj_api->halt_re($_arr_return); } unset($_arr_userRow["user_pass"], $_arr_userRow["user_mail"], $_arr_userRow["user_nick"], $_arr_userRow["user_note"], $_arr_userRow["user_rand"], $_arr_userRow["user_status"], $_arr_userRow["user_time"], $_arr_userRow["user_time_login"], $_arr_userRow["user_ip"]); $_arr_code = $_arr_userRow; $_arr_urlRows = array(); foreach ($this->appRows as $_key => $_value) { $_tm_time = time(); $_arr_code["app_id"] = $_value["app_id"]; $_arr_code["app_key"] = $_value["app_key"]; //unset($_arr_code["alert"]); $_str_src = fn_jsonEncode($_arr_code, "encode"); $_str_code = $this->obj_crypt->encrypt($_str_src, $_value["app_key"]); if (stristr($_value["app_url_sync"], "?")) { $_str_conn = "&"; } else { $_str_conn = "?"; } $_str_url = $_value["app_url_sync"] . $_str_conn . "mod=sync"; $_arr_data = array("act_get" => "logout", "app_id" => $_value["app_id"], "app_key" => $_value["app_key"], "time" => $_tm_time, "code" => $_str_code); $_arr_data["signature"] = $this->obj_sign->sign_make($_arr_data); $_arr_urlRows[] = urlencode($_str_url . "&" . http_build_query($_arr_data)); } $_arr_return = array("alert" => "y100402", "urlRows" => $_arr_urlRows); $this->obj_api->halt_re($_arr_return); }
/** 编码 * sync_encode function. * * @access public * @param mixed $arr_data * @param mixed $str_key * @return void */ function sync_encode($arr_data, $str_key) { unset($arr_data["alert"]); $_str_src = fn_jsonEncode($arr_data, "encode"); $_str_code = fn_baigoEncode($_str_src, $str_key); return $_str_code; }
/** api 创建验证 * api_add function. * * @access public * @return void */ function api_add() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $_arr_adminName = validateStr(fn_post("admin_name"), 1, 30); switch ($_arr_adminName["status"]) { case "too_short": return array("alert" => "x020201"); exit; break; case "too_long": return array("alert" => "x020202"); exit; break; case "ok": $this->adminSubmit["admin_name"] = $_arr_adminName["str"]; break; } //检验用户名是否重复 $_arr_adminRow = $this->mdl_read($this->adminSubmit["admin_name"], "admin_name", $this->adminSubmit["admin_id"]); if ($_arr_adminRow["alert"] == "y020102") { $this->adminSubmit["admin_id"] = $_arr_adminRow["admin_id"]; } $this->adminSubmit["admin_status"] = "enable"; $this->adminSubmit["admin_pass"] = fn_post("admin_pass"); $_arr_adminAllow = array("user" => array("browse" => 1, "add" => 1, "edit" => 1, "del" => 1), "app" => array("browse" => 1, "add" => 1, "edit" => 1, "del" => 1), "log" => array("browse" => 1, "edit" => 1, "del" => 1), "admin" => array("browse" => 1, "add" => 1, "edit" => 1, "del" => 1), "opt" => array("db" => 1, "base" => 1, "reg" => 1)); $this->adminSubmit["admin_allow"] = fn_jsonEncode($_arr_adminAllow, "no"); $this->adminSubmit["alert"] = "ok"; return $this->adminSubmit; }
/** * api_del function. * * @access public * @return void */ function api_del() { $this->app_check("post"); if (!isset($this->appAllow["user"]["del"])) { $_arr_return = array("alert" => "x050309"); $_arr_logTarget[] = array("app_id" => $this->appRequest["app_id"]); $_arr_logType = array("user", "del"); $this->log_do($_arr_logTarget, "app", $_arr_return, $_arr_logType); $this->obj_api->halt_re($_arr_return); } $_arr_userIds = $this->mdl_user->input_ids_api(); $_arr_sign = array("act_post" => $GLOBALS["act_post"], "user_ids" => $_arr_userIds["str_userIds"]); if (!$this->obj_sign->sign_check(array_merge($this->appRequest, $_arr_sign), $this->appRequest["signature"])) { $_arr_return = array("alert" => "x050403"); $this->obj_api->halt_re($_arr_return); } if (!isset($this->appAllow["user"]["global"])) { $_arr_search = array("app_id" => $this->appRequest["app_id"], "user_ids" => $_arr_userIds["user_ids"]); $_arr_users = $this->mdl_belong->mdl_list(1000, 0, $_arr_search); } else { $_arr_users = $_arr_userIds; } $_arr_userDel = $this->mdl_user->mdl_del($_arr_users); if ($_arr_userDel["alert"] == "y010104") { foreach ($_arr_userIds["user_ids"] as $_key => $_value) { $_arr_targets[] = array("user_id" => $_value); $_str_targets = json_encode($_arr_targets); } $_arr_logData = array("log_targets" => $_str_targets, "log_target_type" => "user", "log_title" => $this->log["user"]["del"], "log_result" => $_str_result, "log_type" => "app"); $this->mdl_log->mdl_submit($_arr_logData, $this->appRequest["app_id"]); } $_tm_time = time(); $_str_src = fn_jsonEncode($_arr_userIds, "encode"); $_str_code = $this->obj_crypt->encrypt($_str_src, $this->appRow["app_key"]); foreach ($this->appRows as $_key => $_value) { $_arr_data = array("act_post" => "del", "code" => $this->obj_crypt->encrypt($_str_src, $_value["app_key"]), "time" => $_tm_time, "app_id" => $_value["app_id"], "app_key" => $_value["app_key"]); $_arr_data["signature"] = $this->obj_sign->sign_make($_arr_data); if (stristr($_value["app_url_notify"], "?")) { $_str_conn = "&"; } else { $_str_conn = "?"; } if (stristr($_value["app_url_notify"], "?")) { $_str_conn = "&"; } else { $_str_conn = "?"; } fn_http($_value["app_url_notify"] . $_str_conn . "mod=notify", $_arr_data, "post"); } $this->obj_api->halt_re($_arr_userDel); }
/** 返回结果 * halt_re function. * * @access public * @param mixed $arr_re * @return void */ function halt_re($arr_re, $is_encode = false, $is_jsonp = false) { if ($is_encode) { $_str_return = fn_jsonEncode($arr_re, "encode"); } else { $_str_return = json_encode($arr_re); } if ($is_jsonp) { $_str_return = $this->jsonp_callback . "(" . $_str_return . ")"; } exit($_str_return); //输出错误信息 }
function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->callSubmit["call_id"] = fn_getSafe(fn_post("call_id"), "int", 0); if ($this->callSubmit["call_id"] > 0) { $_arr_callRow = $this->mdl_read($this->callSubmit["call_id"]); if ($_arr_callRow["alert"] != "y170102") { return $_arr_callRows; exit; } } $_arr_callName = validateStr(fn_post("call_name"), 1, 300); switch ($_arr_callName["status"]) { case "too_short": return array("alert" => "x170201"); exit; break; case "too_long": return array("alert" => "x170202"); exit; break; case "ok": $this->callSubmit["call_name"] = $_arr_callName["str"]; break; } $_arr_callType = validateStr(fn_post("call_type"), 1, 0); switch ($_arr_callType["status"]) { case "too_short": return array("alert" => "x170204"); exit; break; case "ok": $this->callSubmit["call_type"] = $_arr_callType["str"]; break; } $_arr_callStatus = validateStr(fn_post("call_status"), 1, 0); switch ($_arr_callStatus["status"]) { case "too_short": return array("alert" => "x170206"); exit; break; case "ok": $this->callSubmit["call_status"] = $_arr_callStatus["str"]; break; } $this->callSubmit["call_file"] = fn_getSafe(fn_post("call_file"), "txt", ""); $this->callSubmit["call_attach"] = fn_getSafe(fn_post("call_attach"), "txt", ""); $this->callSubmit["call_cate_id"] = fn_getSafe(fn_post("call_cate_id"), "int", 0); $this->callSubmit["call_spec_id"] = fn_getSafe(fn_post("call_spec_id"), "int", 0); $this->callSubmit["call_cate_ids"] = fn_jsonEncode(fn_post("call_cate_ids"), "no"); $this->callSubmit["call_cate_excepts"] = fn_jsonEncode(fn_post("call_cate_excepts"), "no"); $this->callSubmit["call_mark_ids"] = fn_jsonEncode(fn_post("call_mark_ids"), "no"); $this->callSubmit["call_amount"] = fn_jsonEncode(fn_post("call_amount"), "no"); $this->callSubmit["alert"] = "ok"; return $this->callSubmit; }
function api_logout() { $this->app_check("get"); if (!isset($this->appAllow["user"]["login"])) { $_arr_return = array("alert" => "x050306"); $_arr_logTarget[] = array("app_id" => $this->appGet["app_id"]); $_arr_logType = array("user", "get"); $this->log_do($_arr_logTarget, "app", $_arr_return, $_arr_logType); $this->obj_sync->halt_re($_arr_return); } $_arr_userId = validateStr($this->appGet["user_id"], 1, 0, "str", "int"); switch ($_arr_userId["status"]) { case "too_short": $_arr_return = array("alert" => "x010217"); $this->obj_sync->halt_re($_arr_return); break; case "format_err": $_arr_return = array("alert" => "x010218"); $this->obj_sync->halt_re($_arr_return); break; case "ok": $_num_userId = $_arr_userId["str"]; break; } $_arr_userRow = $this->mdl_user->mdl_read($_num_userId); if ($_arr_userRow["alert"] != "y010102") { $this->obj_sync->halt_re($_arr_userRow); } if ($_arr_userRow["user_status"] != "enable") { $_arr_return = array("alert" => "x010401"); $this->obj_api->halt_re($_arr_return); } unset($_arr_userRow["user_pass"], $_arr_userRow["user_mail"], $_arr_userRow["user_nick"], $_arr_userRow["user_note"], $_arr_userRow["user_rand"], $_arr_userRow["user_status"], $_arr_userRow["user_time"], $_arr_userRow["user_time_login"], $_arr_userRow["user_ip"]); $_str_key = fn_rand(6); $_arr_code = $_arr_userRow; $_str_sync = ""; foreach ($this->appRows as $_key => $_value) { $_tm_time = time(); $_str_rand = fn_rand(); $_str_sign = fn_baigoSignMk($_tm_time, $_str_rand); $_arr_code["app_id"] = $_value["app_id"]; $_arr_code["app_key"] = $_value["app_key"]; $_str_code = $this->obj_sync->sync_encode($_arr_code, $_str_key); if (stristr($_value["app_notice"], "?")) { $_str_conn = "&"; } else { $_str_conn = "?"; } $_str_url = $_value["app_notice"] . $_str_conn . "act_get=logout&time=" . $_tm_time . "&random=" . $_str_rand . "&signature=" . $_str_sign . "&code=" . $_str_code . "&key=" . $_str_key; $_str_sync .= "<script type=\"text/javascript\" src=\"" . $_str_url . "\"></script>"; } $_arr_return = array("alert" => "y100402", "html" => base64_encode($_str_sync)); exit(fn_jsonEncode($_arr_return, "no")); }
/** * input_submit function. * * @access public * @return void */ function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->adminSubmit["admin_id"] = fn_getSafe(fn_post("admin_id"), "int", 0); if ($this->adminSubmit["admin_id"] > 0) { $_arr_adminRow = $this->mdl_read($this->adminSubmit["admin_id"]); if ($_arr_adminRow["alert"] != "y020102") { return $_arr_adminRow; exit; } } $_arr_adminName = validateStr(fn_post("admin_name"), 1, 30, "str", "strDigit"); switch ($_arr_adminName["status"]) { case "too_short": return array("alert" => "x020201"); exit; break; case "too_long": return array("alert" => "x020202"); exit; break; case "format_err": return array("alert" => "x020203"); exit; break; case "ok": $this->adminSubmit["admin_name"] = $_arr_adminName["str"]; break; } $_arr_adminMail = validateStr(fn_post("admin_mail"), 0, 900, "str", "email"); switch ($_arr_adminMail["status"]) { case "too_long": return array("alert" => "x020208"); exit; break; case "format_err": return array("alert" => "x020209"); exit; break; case "ok": $this->adminSubmit["admin_mail"] = $_arr_adminMail["str"]; break; } $_arr_adminNick = validateStr(fn_post("admin_nick"), 0, 30); switch ($_arr_adminNick["status"]) { case "too_long": return array("alert" => "x020216"); exit; break; case "ok": $this->adminSubmit["admin_nick"] = $_arr_adminNick["str"]; break; } $_arr_adminNote = validateStr(fn_post("admin_note"), 0, 30); switch ($_arr_adminNote["status"]) { case "too_long": return array("alert" => "x020212"); exit; break; case "ok": $this->adminSubmit["admin_note"] = $_arr_adminNote["str"]; break; } $_arr_adminStatus = validateStr(fn_post("admin_status"), 1, 0); switch ($_arr_adminStatus["status"]) { case "too_short": return array("alert" => "x020213"); exit; break; case "ok": $this->adminSubmit["admin_status"] = $_arr_adminStatus["str"]; break; } $this->adminSubmit["admin_allow_cate"] = fn_jsonEncode(fn_post("admin_allow_cate"), "no"); $this->adminSubmit["admin_allow_profile"] = fn_jsonEncode(fn_post("admin_allow_profile"), "no"); $this->adminSubmit["alert"] = "ok"; return $this->adminSubmit; }
function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->groupSubmit["group_id"] = fn_getSafe(fn_post("group_id"), "int", 0); if ($this->groupSubmit["group_id"]) { $_arr_groupRow = $this->mdl_read($this->groupSubmit["group_id"]); if ($_arr_groupRow["alert"] != "y040102") { $this->obj_ajax->halt_alert($_arr_groupRow["alert"]); } } $_arr_groupName = validateStr(fn_post("group_name"), 1, 30); switch ($_arr_groupName["status"]) { case "too_short": return array("alert" => "x040201"); exit; break; case "too_long": return array("alert" => "x040202"); exit; break; case "ok": $this->groupSubmit["group_name"] = $_arr_groupName["str"]; break; } $_arr_groupRow = $this->mdl_read($this->groupSubmit["group_name"], "group_name", $this->groupSubmit["group_id"]); if ($_arr_groupRow["alert"] == "y040102") { return array("alert" => "x040203"); exit; } $_arr_groupNote = validateStr(fn_post("group_note"), 0, 30); switch ($_arr_groupNote["status"]) { case "too_long": return array("alert" => "x040204"); exit; break; case "ok": $this->groupSubmit["group_note"] = $_arr_groupNote["str"]; break; } $_arr_groupType = validateStr(fn_post("group_type"), 1, 0); switch ($_arr_groupType["status"]) { case "too_short": return array("alert" => "x040205"); exit; break; case "ok": $this->groupSubmit["group_type"] = $_arr_groupType["str"]; break; } $_arr_groupStatus = validateStr(fn_post("group_status"), 1, 0); switch ($_arr_groupStatus["status"]) { case "too_short": return array("alert" => "x040207"); exit; break; case "ok": $this->groupSubmit["group_status"] = $_arr_groupStatus["str"]; break; } $this->groupSubmit["group_allow"] = fn_jsonEncode(fn_post("group_allow"), "no"); $this->groupSubmit["alert"] = "ok"; return $this->groupSubmit; }
function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->posiSubmit["posi_id"] = fn_getSafe(fn_post("posi_id"), "int", 0); if ($this->posiSubmit["posi_id"]) { $_arr_posiRow = $this->mdl_read($this->posiSubmit["posi_id"]); if ($_arr_posiRow["alert"] != "y040102") { $this->obj_ajax->halt_alert($_arr_posiRow["alert"]); } } $_arr_posiName = validateStr(fn_post("posi_name"), 1, 300); switch ($_arr_posiName["status"]) { case "too_short": return array("alert" => "x040201"); exit; break; case "too_long": return array("alert" => "x040202"); exit; break; case "ok": $this->posiSubmit["posi_name"] = $_arr_posiName["str"]; break; } $_arr_posiRow = $this->mdl_read($this->posiSubmit["posi_name"], "posi_name", $this->posiSubmit["posi_id"]); if ($_arr_posiRow["alert"] == "y040102") { return array("alert" => "x040203"); exit; } $_arr_posiCount = validateStr(fn_post("posi_count"), 1, 0, "str", "int"); switch ($_arr_posiCount["status"]) { case "too_short": return array("alert" => "x040205"); exit; break; case "format_err": return array("alert" => "x040208"); exit; break; case "ok": $this->posiSubmit["posi_count"] = $_arr_posiCount["str"]; break; } $_arr_posiScript = validateStr(fn_post("posi_script"), 1, 0); switch ($_arr_posiScript["status"]) { case "too_short": return array("alert" => "x040214"); exit; break; case "ok": $this->posiSubmit["posi_script"] = $_arr_posiScript["str"]; break; } $_arr_posiNote = validateStr(fn_post("posi_note"), 0, 300); switch ($_arr_posiNote["status"]) { case "too_long": return array("alert" => "x040204"); exit; break; case "ok": $this->posiSubmit["posi_note"] = $_arr_posiNote["str"]; break; } $_arr_posiType = validateStr(fn_post("posi_type"), 1, 0); switch ($_arr_posiType["status"]) { case "too_short": return array("alert" => "x040209"); exit; break; case "ok": $this->posiSubmit["posi_type"] = $_arr_posiType["str"]; break; } switch ($this->posiSubmit["posi_type"]) { case "media": $_arr_posiWidth = validateStr(fn_post("posi_width"), 1, 4); switch ($_arr_posiWidth["status"]) { case "too_short": return array("alert" => "x040210"); exit; break; case "too_long": return array("alert" => "x040211"); exit; break; case "ok": $this->posiSubmit["posi_width"] = $_arr_posiWidth["str"]; break; } $_arr_posiHeight = validateStr(fn_post("posi_height"), 1, 4); switch ($_arr_posiHeight["status"]) { case "too_short": return array("alert" => "x040212"); exit; break; case "too_long": return array("alert" => "x040213"); exit; break; case "ok": $this->posiSubmit["posi_height"] = $_arr_posiHeight["str"]; break; } break; default: $this->posiSubmit["posi_width"] = 0; $this->posiSubmit["posi_height"] = 0; break; } $_arr_posiStatus = validateStr(fn_post("posi_status"), 1, 0); switch ($_arr_posiStatus["status"]) { case "too_short": return array("alert" => "x040207"); exit; break; case "ok": $this->posiSubmit["posi_status"] = $_arr_posiStatus["str"]; break; } $_arr_posiScript = validateStr(fn_post("posi_script"), 1, 100); switch ($_arr_posiScript["status"]) { case "too_short": return array("alert" => "x040215"); exit; break; case "ok": $this->posiSubmit["posi_script"] = $_arr_posiScript["str"]; break; } $_arr_posiPlugin = validateStr(fn_post("posi_plugin"), 1, 100); switch ($_arr_posiPlugin["status"]) { case "too_short": return array("alert" => "x040216"); exit; break; case "too_long": return array("alert" => "x040217"); exit; break; case "ok": $this->posiSubmit["posi_plugin"] = $_arr_posiPlugin["str"]; break; } $_arr_posiSelector = validateStr(fn_post("posi_selector"), 1, 100); switch ($_arr_posiSelector["status"]) { case "too_short": return array("alert" => "x040218"); exit; break; case "too_long": return array("alert" => "x040219"); exit; break; case "ok": $this->posiSubmit["posi_selector"] = $_arr_posiSelector["str"]; break; } $_arr_posiIsPercent = validateStr(fn_post("posi_is_percent"), 1, 0); switch ($_arr_posiIsPercent["status"]) { case "too_short": return array("alert" => "x040221"); exit; break; case "ok": $this->posiSubmit["posi_is_percent"] = $_arr_posiIsPercent["str"]; break; } $this->posiSubmit["posi_opts"] = fn_jsonEncode(fn_post("posi_opts"), "encode"); $this->posiSubmit["alert"] = "ok"; return $this->posiSubmit; }
/** 编码 * api_encode function. * * @access public * @param mixed $arr_data * @param mixed $str_key * @return void */ function api_encode($arr_data, $str_key, $method = "encode") { unset($arr_data["alert"]); $_str_src = fn_jsonEncode($arr_data, $method); $_str_code = fn_baigoEncode($_str_src, $str_key); return $_str_code; }
function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->customSubmit["custom_id"] = fn_getSafe(fn_post("custom_id"), "int", 0); if ($this->customSubmit["custom_id"] > 0) { $_arr_customRow = $this->mdl_read($this->customSubmit["custom_id"]); if ($_arr_customRow["alert"] != "y200102") { return $_arr_customRow; exit; } } $_arr_customName = validateStr(fn_post("custom_name"), 1, 90); switch ($_arr_customName["status"]) { case "too_short": return array("alert" => "x200201"); exit; break; case "too_long": return array("alert" => "x200202"); exit; break; case "ok": $this->customSubmit["custom_name"] = $_arr_customName["str"]; break; } $_arr_customParentId = validateStr(fn_post("custom_parent_id"), 1, 0); switch ($_arr_customParentId["status"]) { case "too_short": return array("alert" => "x200207"); exit; break; case "ok": $this->customSubmit["custom_parent_id"] = $_arr_customParentId["str"]; break; } $_arr_customCateId = validateStr(fn_post("custom_cate_id"), 1, 0); switch ($_arr_customCateId["status"]) { case "too_short": return array("alert" => "x200213"); exit; break; case "ok": $this->customSubmit["custom_cate_id"] = $_arr_customCateId["str"]; break; } if ($this->customSubmit["custom_parent_id"] > 0 && $this->customSubmit["custom_parent_id"] == $this->customSubmit["custom_id"]) { return array("alert" => "x200208"); exit; } $_arr_customRow = $this->mdl_read($this->customSubmit["custom_name"], "custom_name", $this->customSubmit["custom_id"]); if ($_arr_customRow["alert"] == "y200102") { return array("alert" => "x200203"); exit; } $_arr_customType = validateStr(fn_post("custom_type"), 1, 0); switch ($_arr_customType["status"]) { case "too_short": return array("alert" => "x200211"); exit; break; case "ok": $this->customSubmit["custom_type"] = $_arr_customType["str"]; break; } $_arr_customFormat = validateStr(fn_post("custom_format"), 1, 0); switch ($_arr_customFormat["status"]) { case "too_short": return array("alert" => "x200205"); exit; break; case "ok": $this->customSubmit["custom_format"] = $_arr_customFormat["str"]; break; } $_arr_customStatus = validateStr(fn_post("custom_status"), 1, 0); switch ($_arr_customStatus["status"]) { case "too_short": return array("alert" => "x200206"); exit; break; case "ok": $this->customSubmit["custom_status"] = $_arr_customStatus["str"]; break; } $this->customSubmit["custom_require"] = fn_getSafe(fn_post("custom_require"), "int", 0); $_arr_customOpt = fn_post("custom_opt"); if ($this->customSubmit["custom_type"] == "radio" || $this->customSubmit["custom_type"] == "select") { $this->customSubmit["custom_opt"] = fn_jsonEncode($_arr_customOpt[$this->customSubmit["custom_type"]], "encode"); } else { $this->customSubmit["custom_opt"] = ""; } $this->customSubmit["alert"] = "ok"; return $this->customSubmit; }
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"); }
/** 表单验证 * input_submit function. * * @access public * @return void */ function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030101"); exit; } $this->appSubmit["app_id"] = fn_getSafe(fn_post("app_id"), "int", 0); if ($this->appSubmit["app_id"] > 0) { //检查用户是否存在 $_arr_appRow = $this->mdl_read($this->appSubmit["app_id"]); if ($_arr_appRow["alert"] != "y050102") { return $_arr_appRow; exit; } } $_arr_appName = validateStr(fn_post("app_name"), 1, 30); switch ($_arr_appName["status"]) { case "too_short": return array("alert" => "x050201"); exit; break; case "too_long": return array("alert" => "x050202"); exit; break; case "ok": $this->appSubmit["app_name"] = $_arr_appName["str"]; break; } $_arr_appNotice = validateStr(fn_post("app_notice"), 1, 3000); switch ($_arr_appNotice["status"]) { case "too_short": return array("alert" => "x050207"); exit; break; case "too_long": return array("alert" => "x050208"); exit; break; case "format_err": return array("alert" => "x050209"); exit; break; case "ok": $this->appSubmit["app_notice"] = $_arr_appNotice["str"]; break; } $_arr_appNote = validateStr(fn_post("app_note"), 0, 30); switch ($_arr_appNote["status"]) { case "too_long": return array("alert" => "x050205"); exit; break; case "ok": $this->appSubmit["app_note"] = $_arr_appNote["str"]; break; } $_arr_appStatus = validateStr(fn_post("app_status"), 1, 0); switch ($_arr_appStatus["status"]) { case "too_short": return array("alert" => "x050206"); exit; break; case "ok": $this->appSubmit["app_status"] = $_arr_appStatus["str"]; break; } $_arr_appIpAllow = validateStr(fn_post("app_ip_allow"), 0, 3000); switch ($_arr_appIpAllow["status"]) { case "too_long": return array("alert" => "x050210"); exit; break; case "ok": $this->appSubmit["app_ip_allow"] = $_arr_appIpAllow["str"]; break; } $_arr_appIpBad = validateStr(fn_post("app_ip_bad"), 0, 3000); switch ($_arr_appIpBad["status"]) { case "too_long": return array("alert" => "x050211"); exit; break; case "ok": $this->appSubmit["app_ip_bad"] = $_arr_appIpBad["str"]; break; } $_arr_appSync = validateStr(fn_post("app_sync"), 1, 0); switch ($_arr_appSync["status"]) { case "too_short": return array("alert" => "x050218"); exit; break; case "ok": $this->appSubmit["app_sync"] = $_arr_appSync["str"]; break; } $this->appSubmit["app_allow"] = fn_jsonEncode(fn_post("app_allow"), "no"); $this->appSubmit["alert"] = "ok"; return $this->appSubmit; }
/** 返回结果 * halt_re function. * * @access public * @param mixed $arr_re * @return void */ function halt_re($arr_re, $is_encode = false) { if ($is_encode) { $_str_return = fn_jsonEncode($arr_re, "encode"); } else { $_str_return = json_encode($arr_re); } exit($_str_return); //输出错误信息 }
/** 表单验证 * input_submit function. * * @access public * @return void */ function input_submit() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030206"); } $this->userSubmit["user_id"] = fn_getSafe(fn_post("user_id"), "int", 0); if ($this->userSubmit["user_id"] > 0) { //检查用户是否存在 $_arr_userRow = $this->mdl_read_api($this->userSubmit["user_id"]); if ($_arr_userRow["alert"] != "y010102") { return $_arr_userRow; } } $_arr_userName = $this->chk_user_name(fn_post("user_name")); if ($_arr_userName["alert"] != "ok") { return $_arr_userName; } $this->userSubmit["user_name"] = $_arr_userName["user_name"]; //检验用户名是否重复 $_arr_userRowChk = $this->mdl_read($this->userSubmit["user_name"], "user_name", $this->userSubmit["user_id"]); if ($_arr_userRowChk["alert"] == "y010102") { return array("alert" => "x010205"); } $_arr_userMail = $this->chk_user_mail(fn_post("user_mail")); if ($_arr_userMail["alert"] != "ok") { return $_arr_userMail; } $this->userSubmit["user_mail"] = $_arr_userMail["user_mail"]; if ((BG_REG_ONEMAIL == "false" || BG_LOGIN_MAIL == "on") && $_arr_userMail["user_mail"]) { $_arr_userRowChk = $this->mdl_read($_arr_userMail["user_mail"], "user_mail", $this->userSubmit["user_id"]); //检查邮箱 if ($_arr_userRowChk["alert"] == "y010102") { return array("alert" => "x010211"); } } $_arr_userNick = $this->chk_user_nick(fn_post("user_nick")); if ($_arr_userNick["alert"] != "ok") { return $_arr_userNick; } $this->userSubmit["user_nick"] = $_arr_userNick["user_nick"]; $_arr_userNote = $this->chk_user_note(fn_post("user_note")); if ($_arr_userNote["alert"] != "ok") { return $_arr_userNote; } $this->userSubmit["user_note"] = $_arr_userNote["user_note"]; $_arr_userStatus = validateStr(fn_post("user_status"), 1, 0); switch ($_arr_userStatus["status"]) { case "too_short": return array("alert" => "x010216"); break; case "ok": $this->userSubmit["user_status"] = $_arr_userStatus["str"]; break; } $_arr_userContact = fn_post("user_contact"); $this->userSubmit["user_contact"] = fn_jsonEncode($_arr_userContact, "encode"); $_arr_userExtend = fn_post("user_extend"); $this->userSubmit["user_extend"] = fn_jsonEncode($_arr_userExtend, "encode"); $this->userSubmit["alert"] = "ok"; return $this->userSubmit; }
/** 返回结果 * halt_re function. * * @access public * @param mixed $arr_re * @return void */ function halt_re($arr_re) { $arr_halt = array_merge($this->arr_return, $arr_re); exit(fn_jsonEncode($arr_halt, "no")); //输出错误信息 }
/** * api_chkname function. * * @access public * @return void */ function api_list() { $this->app_check("get"); if (!isset($this->appAllow["pm"]["list"])) { $_arr_return = array("alert" => "x050319"); $_arr_logTarget[] = array("app_id" => $this->appRequest["app_id"]); $_arr_logType = array("pm", "list"); $this->log_do($_arr_logTarget, "app", $_arr_return, $_arr_logType); $this->obj_api->halt_re($_arr_return); } $_arr_userRow = $this->user_check("get"); $_num_perPage = fn_getSafe(fn_get("per_page"), "int", BG_SITE_PERPAGE); $_str_pmIds = fn_getSafe(fn_get("pm_ids"), "txt", ""); $_str_type = fn_getSafe(fn_get("pm_type"), "txt", ""); $_str_status = fn_getSafe(fn_get("pm_status"), "txt", ""); $_str_key = fn_getSafe(fn_get("key"), "txt", ""); $_arr_sign = array("act_get" => $GLOBALS["act_get"], $this->userRequest["user_by"] => $this->userRequest["user_str"], "user_access_token" => $this->userRequest["user_access_token"], "pm_ids" => $_str_pmIds, "pm_type" => $_str_type, "pm_status" => $_str_status, "key" => $_str_key); if (!fn_isEmpty(fn_get("per_page"))) { $_arr_sign["per_page"] = $_num_perPage; } //file_put_contents(BG_PATH_ROOT . "debug.txt", json_encode($_arr_sign), FILE_APPEND); if (!$this->obj_sign->sign_check(array_merge($this->appRequest, $_arr_sign), $this->appRequest["signature"])) { $_arr_return = array("alert" => "x050403"); $this->obj_api->halt_re($_arr_return); } $_arr_pmIds = array(); if (!fn_isEmpty($_str_pmIds)) { if (stristr($_str_pmIds, "|")) { $_arr_pmIds = explode("|", $_str_pmIds); } else { $_arr_pmIds = array($_str_pmIds); } } if (fn_isEmpty($_str_type)) { $_arr_return = array("alert" => "x110218"); $this->obj_api->halt_re($_arr_return); } $_arr_search = array("type" => $_str_type, "status" => $_str_status, "key" => $_str_key, "pm_ids" => $_arr_pmIds); switch ($_str_type) { case "in": $_arr_search["pm_to"] = $_arr_userRow["user_id"]; break; case "out": $_arr_search["pm_from"] = $_arr_userRow["user_id"]; break; } $_num_pmCount = $this->mdl_pm->mdl_count($_arr_search); $_arr_page = fn_page($_num_pmCount); $_arr_pmRows = $this->mdl_pm->mdl_list($_num_perPage, $_arr_page["except"], $_arr_search); foreach ($_arr_pmRows as $_key => $_value) { $_arr_pmRows[$_key]["fromUser"] = $this->mdl_user->mdl_read_api($_value["pm_from"]); $_arr_pmRows[$_key]["toUser"] = $this->mdl_user->mdl_read_api($_value["pm_to"]); if ($_str_type == "out") { $_arr_sendRow = $this->mdl_pm->mdl_read($_value["pm_send_id"]); if ($_arr_sendRow["alert"] != "y110102") { $_arr_pmRows[$_key]["pm_send_status"] = "revoke"; } else { $_arr_pmRows[$_key]["pm_send_status"] = $_arr_sendRow["pm_status"]; } } } //print_r($_arr_pmRows); $_arr_return = array("pmRows" => $_arr_pmRows, "pageRow" => $_arr_page); $_str_src = fn_jsonEncode($_arr_return, "encode"); $_str_code = $this->obj_crypt->encrypt($_str_src, $this->appRow["app_key"]); $_arr_return = array("code" => $_str_code, "alert" => "y110402"); $this->obj_api->halt_re($_arr_return); }