/** 显示页面 * tplDisplay function. * * @access public * @param mixed $str_tpl 模版名 * @param string $arr_tplData (default: "") 模版数据 * @return void */ function tplDisplay($str_tpl, $arr_tplData = "") { $this->common["token_session"] = fn_token(); //生成口令 $this->common["token_cookie"] = fn_cookie("token_cookie"); //输出cookie口令(特殊用途,用于上传) $this->common["ssid"] = session_id(); //会话ID(特殊用途,用于上传) if (BG_MODULE_GEN == false) { unset($this->adminMod["gen"]); } $this->obj_smarty->assign("common", $this->common); $this->obj_smarty->assign("config", $this->config); $this->obj_smarty->assign("lang", $this->lang); $this->obj_smarty->assign("status", $this->status); $this->obj_smarty->assign("type", $this->type); $this->obj_smarty->assign("alert", $this->alert); $this->obj_smarty->assign("install", $this->install); $this->obj_smarty->assign("opt", $this->opt); $this->obj_smarty->assign("appMod", $this->appMod); $this->obj_smarty->assign("adminMod", $this->adminMod); $this->obj_smarty->assign("tplData", $arr_tplData); $this->obj_smarty->display($str_tpl); //显示 }
function ajax_order() { if (!isset($this->adminLogged["groupRow"]["group_allow"]["opt"]["custom"])) { $this->obj_ajax->halt_alert("x200303"); } if (!fn_token("chk")) { //令牌 $this->obj_ajax->halt_alert("x030102"); } $_num_customId = fn_getSafe(fn_post("custom_id"), "int", 0); //ID if ($_num_customId == 0) { $this->obj_ajax->halt_alert("x200209"); } $_arr_customRow = $this->mdl_custom->mdl_read($_num_customId); if ($_arr_customRow["alert"] != "y200102") { $this->obj_ajax->halt_alert($_arr_customRow["alert"]); } $_num_parentId = fn_getSafe(fn_post("custom_parent_id"), "int", 0); $_str_orderType = fn_getSafe(fn_post("order_type"), "txt", "order_first"); $_num_targetId = fn_getSafe(fn_post("order_target"), "int", 0); $_arr_customRow = $this->mdl_custom->mdl_order($_str_orderType, $_num_customId, $_num_targetId, $_num_parentId); $this->misc_process(); $this->obj_ajax->halt_alert($_arr_customRow["alert"]); }
/** 显示页面 * tplDisplay function. * * @access public * @param mixed $str_tpl 模版名 * @param string $arr_tplData (default: "") 模版数据 * @return void */ function tplDisplay($str_tpl, $arr_tplData = "") { $this->obj_smarty->assign("config", $this->config); $this->obj_smarty->assign("lang", $this->lang); $this->obj_smarty->assign("alert", $this->alert); if (isset($this->arr_cfg["admin"])) { $this->common["token_session"] = fn_token(); //生成令牌 //$this->common["token_cookie"] = fn_cookie("token_cookie"); //输出 cookie 令牌(特殊用途,用于上传) //$this->common["ssid"] = session_id(); //会话 ID(特殊用途,用于上传) $this->obj_smarty->assign("common", $this->common); $this->obj_smarty->assign("status", $this->status); $this->obj_smarty->assign("type", $this->type); $this->obj_smarty->assign("install", $this->install); $this->obj_smarty->assign("opt", $this->opt); $this->obj_smarty->assign("appMod", $this->appMod); $this->obj_smarty->assign("adminMod", $this->adminMod); } if (isset($this->arr_cfg["pub"])) { $this->obj_smarty->registerPlugin("function", "call_display", "fn_callDisplay"); //注册自定义函数 $this->obj_smarty->registerPlugin("function", "call_attach", "fn_callAttach"); //注册自定义函数 $this->obj_smarty->registerPlugin("function", "call_cate", "fn_callCate"); //注册自定义函数 $this->obj_smarty->registerPlugin("modifier", "ubb", "fn_ubb"); } $this->obj_smarty->assign("tplData", $arr_tplData); $this->obj_smarty->display($str_tpl); //显示 }
/** * ajax_order function. * * @access public * @return void */ function ajax_order() { if (!isset($this->adminLogged["groupRow"]["group_allow"]["cate"]["edit"])) { $this->obj_ajax->halt_alert("x110303"); } if (!fn_token("chk")) { //令牌 $this->obj_ajax->halt_alert("x030102"); } $_num_cateId = fn_getSafe(fn_post("cate_id"), "int", 0); //ID if ($_num_cateId == 0) { $this->obj_ajax->halt_alert("x110217"); } $_arr_cateRow = $this->mdl_cate->mdl_read($_num_cateId); if ($_arr_cateRow["alert"] != "y110102") { $this->obj_ajax->halt_alert($_arr_cateRow["alert"]); } $_num_parentId = fn_getSafe(fn_post("cate_parent_id"), "int", 0); $_str_orderType = fn_getSafe(fn_post("order_type"), "txt", "order_first"); $_num_targetId = fn_getSafe(fn_post("order_target"), "int", 0); $_arr_cateRow = $this->mdl_cate->mdl_order($_str_orderType, $_num_cateId, $_num_targetId, $_num_parentId); $this->mdl_cate->mdl_cache(array($_num_cateId)); $this->obj_ajax->halt_alert($_arr_cateRow["alert"]); }
/** * ajax_check function. * * @access public * @return void */ function ajax_make() { if ($this->adminLogged["alert"] == "y020102") { $_str_token = fn_token(); //生成口令 $_str_alert = "y030102"; $_str_msg = "ok"; } else { $_str_token = "none"; $_str_alert = "x020404"; $_str_msg = $this->obj_ajax->alert["x020404"]; } $arr_re = array("token" => $_str_token, "alert" => $_str_alert, "msg" => $_str_msg); exit(json_encode($arr_re)); }
/** 显示界面 * tplDisplay function. * * @access public * @param mixed $str_tpl * @param string $arr_tplData (default: "") * @return void */ function tplDisplay($str_tpl, $arr_tplData = "") { $this->common["tokenRow"] = fn_token(); $this->obj_smarty->assign("common", $this->common); $this->obj_smarty->assign("config", $this->config); $this->obj_smarty->assign("lang", $this->lang); $this->obj_smarty->assign("status", $this->status); $this->obj_smarty->assign("type", $this->type); $this->obj_smarty->assign("allow", $this->allow); $this->obj_smarty->assign("alert", $this->alert); $this->obj_smarty->assign("install", $this->install); $this->obj_smarty->assign("opt", $this->opt); $this->obj_smarty->assign("adminMod", $this->adminMod); $this->obj_smarty->assign("tplData", $arr_tplData); $this->obj_smarty->display($str_tpl); }
function mdl_over() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $_str_content = "<?php" . PHP_EOL; $_str_content .= "define(\"BG_INSTALL_VER\", \"" . PRD_SSO_VER . "\");" . PHP_EOL; $_str_content .= "define(\"BG_INSTALL_PUB\", " . PRD_SSO_PUB . ");" . PHP_EOL; $_str_content .= "define(\"BG_INSTALL_TIME\", " . time() . ");" . PHP_EOL; $_num_size = file_put_contents(BG_PATH_CONFIG . "is_install.php", $_str_content); if ($_num_size > 0) { $_str_alert = "y040101"; } else { $_str_alert = "x040101"; } return array("alert" => $_str_alert); }
/** 显示界面 * tplDisplay function. * * @access public * @param mixed $str_view * @param string $arr_tplData (default: "") * @return void */ function tplDisplay($str_view, $arr_tplData = "") { $this->common["token_session"] = fn_token(); $this->common["ssid"] = session_id(); $this->common["view"] = $GLOBALS["view"]; $this->obj_smarty->assign("common", $this->common); $this->obj_smarty->assign("config", $this->config); $this->obj_smarty->assign("lang", $this->lang); $this->obj_smarty->assign("status", $this->status); $this->obj_smarty->assign("type", $this->type); $this->obj_smarty->assign("allow", $this->allow); $this->obj_smarty->assign("alert", $this->alert); $this->obj_smarty->assign("install", $this->install); $this->obj_smarty->assign("opt", $this->opt); //if (isset($this->arr_cfg["admin"])) { $this->obj_smarty->assign("adminMod", $this->adminMod); //} $this->obj_smarty->assign("tplData", $arr_tplData); $this->obj_smarty->display($str_view); }
/** 显示界面 * tplDisplay function. * * @access public * @param mixed $str_view * @param string $arr_tplData (default: "") * @return void */ function tplDisplay($str_view, $arr_tplData = "") { $this->common["token_session"] = fn_token(); if (fn_server("REQUEST_URI")) { $this->common["thisUrl"] = base64_encode(fn_server("REQUEST_URI")); } $this->common["ssid"] = session_id(); $this->common["view"] = $GLOBALS["view"]; $this->obj_smarty->assign("common", $this->common); $this->obj_smarty->assign("config", $this->config); $this->obj_smarty->assign("lang", $this->lang); $this->obj_smarty->assign("status", $this->status); $this->obj_smarty->assign("type", $this->type); $this->obj_smarty->assign("allow", $this->allow); $this->obj_smarty->assign("alert", $this->alert); $this->obj_smarty->assign("install", $this->install); $this->obj_smarty->assign("opt", $this->opt); $this->obj_smarty->assign("adminMod", $this->adminMod); $this->obj_smarty->assign("tplData", $arr_tplData); $this->obj_smarty->display($str_view); }
private function check_db() { if (!fn_token("chk")) { //令牌 $this->obj_ajax->halt_alert("x030214"); } if (strlen(BG_DB_HOST) < 1 || strlen(BG_DB_NAME) < 1 || strlen(BG_DB_USER) < 1 || strlen(BG_DB_PASS) < 1 || strlen(BG_DB_CHARSET) < 1) { $this->obj_ajax->halt_alert("x030412"); } else { if (!defined("BG_DB_PORT")) { define("BG_DB_PORT", "3306"); } $_cfg_host = array("host" => BG_DB_HOST, "name" => BG_DB_NAME, "user" => BG_DB_USER, "pass" => BG_DB_PASS, "charset" => BG_DB_CHARSET, "debug" => BG_DEBUG_DB, "port" => BG_DB_PORT); $GLOBALS["obj_db"] = new CLASS_MYSQLI($_cfg_host); //设置数据库对象 $this->obj_db = $GLOBALS["obj_db"]; if (!$this->obj_db->connect()) { $this->obj_ajax->halt_alert("x030111"); } if (!$this->obj_db->select_db()) { $this->obj_ajax->halt_alert("x030112"); } } }
/** 选择 verify * input_ids function. * * @access public * @return void */ function input_ids() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030214"); } $_arr_verifyIds = fn_post("verify_id"); if ($_arr_verifyIds) { foreach ($_arr_verifyIds as $_key => $_value) { $_arr_verifyIds[$_key] = fn_getSafe($_value, "int", 0); } $_str_alert = "ok"; } else { $_str_alert = "none"; } $this->verifyIds = array("alert" => $_str_alert, "verify_ids" => $_arr_verifyIds); return $this->verifyIds; }
/** * fn_adminLogin function. * * @access public * @return void */ private function input_login() { $_arr_adminLogin["forward"] = fn_getSafe(fn_post("forward"), "txt", ""); if (!$_arr_adminLogin["forward"]) { $_arr_adminLogin["forward"] = base64_encode(BG_URL_ADMIN . "ctl.php"); } if (!fn_seccode()) { //验证码 return array("forward" => $_arr_adminLogin["forward"], "alert" => "x030101"); exit; } if (!fn_token("chk")) { //令牌 return array("forward" => $_arr_adminLogin["forward"], "alert" => "x030102"); exit; } $_arr_adminName = validateStr(fn_post("admin_name"), 1, 30, "str", "strDigit"); switch ($_arr_adminName["status"]) { case "too_short": return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020201"); exit; break; case "too_long": return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020202"); exit; break; case "format_err": return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020203"); exit; break; case "ok": $_arr_adminLogin["admin_name"] = $_arr_adminName["str"]; break; } $_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0); switch ($_arr_adminPass["status"]) { case "too_short": return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020208"); exit; break; case "ok": $_arr_adminLogin["admin_pass"] = $_arr_adminPass["str"]; break; } $_arr_adminLogin["alert"] = "ok"; $_arr_adminLogin["view"] = fn_getSafe(fn_post("view"), "txt", ""); return $_arr_adminLogin; }
/** 选择短消息 * input_ids function. * * @access public * @return void */ function input_ids() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030206"); } $_arr_pmIds = fn_post("pm_ids"); if ($_arr_pmIds) { foreach ($_arr_pmIds as $_key => $_value) { $_arr_pmIds[$_key] = fn_getSafe($_value, "int", 0); } $_str_alert = "ok"; } else { $_str_alert = "x030202"; } $this->pmIds = array("alert" => $_str_alert, "pm_ids" => array_unique($_arr_pmIds)); return $this->pmIds; }
/** * ajax_submit function. * * @access public * @return void */ function ajax_submit() { if ($this->adminLogged["alert"] != "y020102") { //未登录,抛出错误信息 $this->show_err($this->adminLogged["alert"]); } $_arr_status = $this->obj_upload->upload_init(); if ($_arr_status["alert"] != "y070403") { $this->show_err($_arr_status["alert"]); } if (!isset($this->adminLogged["groupRow"]["group_allow"]["attach"]["upload"])) { $this->show_err("x070302"); } if (!fn_token("chk")) { //令牌 $this->show_err("x030102"); } if (!is_array($this->attachMime)) { $this->show_err("x070405"); } $_arr_uploadRow = $this->obj_upload->upload_pre(); if ($_arr_uploadRow["alert"] != "y100201") { $this->show_err($_arr_uploadRow["alert"]); } $_arr_attachRow = $this->mdl_attach->mdl_submit(0, $_arr_uploadRow["attach_name"], $_arr_uploadRow["attach_ext"], $_arr_uploadRow["attach_mime"], $_arr_uploadRow["attach_size"], $this->adminLogged["admin_id"]); if ($_arr_attachRow["alert"] != "y070101") { $this->show_err($_arr_attachRow["alert"]); } $_arr_uploadRowSubmit = $this->obj_upload->upload_submit($_arr_attachRow["attach_time"], $_arr_attachRow["attach_id"]); if ($_arr_uploadRowSubmit["alert"] != "y070401") { $this->show_err($_arr_uploadRowSubmit["alert"]); } $_arr_uploadRowSubmit["attach_id"] = $_arr_attachRow["attach_id"]; $_arr_uploadRowSubmit["attach_ext"] = $_arr_uploadRow["attach_ext"]; $_arr_uploadRowSubmit["attach_name"] = $_arr_uploadRow["attach_name"]; exit(json_encode($_arr_uploadRowSubmit)); }
private function validate_import() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $this->csvFiles = $_FILES["csv_files"]; $_str_alert = $this->upload_init($this->csvFiles["error"]); if ($_str_alert != "ok") { return array("alert" => $_str_alert); exit; } $this->userImport["file_ext"] = pathinfo($this->csvFiles["name"], PATHINFO_EXTENSION); //取得扩展名 $this->userImport["file_ext"] = strtolower($this->userImport["file_ext"]); if ($this->userImport["file_ext"] != "csv") { return array("alert" => "x010219"); exit; } $this->userImport["file_temp"] = $this->csvFiles["tmp_name"]; $this->userImport["alert"] = "ok"; return $this->userImport; }
/** * input_pass function. * * @access private * @return void */ private function input_pass() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $_arr_adminPassOld = validateStr(fn_post("admin_pass"), 1, 0); switch ($_arr_adminPassOld["status"]) { case "too_short": return array("alert" => "x020210"); exit; break; case "ok": $_arr_adminPass["admin_pass"] = $_arr_adminPassOld["str"]; break; } $_arr_adminPassNew = validateStr(fn_post("admin_pass_new"), 1, 0); switch ($_arr_adminPassNew["status"]) { case "too_short": return array("alert" => "x020217"); exit; break; case "ok": $_arr_adminPass["admin_pass_new"] = $_arr_adminPassNew["str"]; break; } $_arr_adminPassConfirm = validateStr(fn_post("admin_pass_confirm"), 1, 0); switch ($_arr_adminPassConfirm["status"]) { case "too_short": return array("alert" => "x020215"); exit; break; case "ok": $_arr_adminPass["admin_pass_confirm"] = $_arr_adminPassConfirm["str"]; break; } if ($_arr_adminPass["admin_pass_new"] != $_arr_adminPass["admin_pass_confirm"]) { return array("alert" => "x020211"); exit; } $_arr_adminPass["alert"] = "ok"; return $_arr_adminPass; }
/** * ajax_submit function. * * @access public * @return void */ function ajax_submit() { if ($this->adminLogged["alert"] != "y020102") { //未登录,抛出错误信息 $this->show_err($this->adminLogged["alert"]); } $_arr_status = $this->obj_upload->upload_init(); if ($_arr_status["alert"] != "y070403") { $this->show_err($_arr_status["alert"]); } if (!isset($this->adminLogged["admin_allow"]["media"]["upload"]) && !$this->is_super) { $this->show_err("x070302"); } if (!fn_token("chk")) { //令牌 $this->show_err("x030206"); } if (!is_array($this->mediaMime)) { $this->show_err("x070405"); } $_arr_uploadRow = $this->obj_upload->upload_pre(); if ($_arr_uploadRow["alert"] != "y100201") { $this->show_err($_arr_uploadRow["alert"]); } $_arr_mediaRow = $this->mdl_media->mdl_submit(0, $_arr_uploadRow["media_name"], $_arr_uploadRow["media_ext"], $_arr_uploadRow["media_mime"], $_arr_uploadRow["media_size"], $this->adminLogged["admin_id"]); if ($_arr_mediaRow["alert"] != "y070101") { $this->show_err($_arr_mediaRow["alert"]); } $_arr_uploadRowSubmit = $this->obj_upload->upload_submit($_arr_mediaRow["media_time"], $_arr_mediaRow["media_id"]); if ($_arr_uploadRowSubmit["alert"] != "y070401") { $this->show_err($_arr_uploadRowSubmit["alert"]); } $_arr_uploadRowSubmit["media_id"] = $_arr_mediaRow["media_id"]; $_arr_uploadRowSubmit["media_ext"] = $_arr_uploadRow["media_ext"]; $_arr_uploadRowSubmit["media_name"] = $_arr_uploadRow["media_name"]; exit(json_encode($_arr_uploadRowSubmit)); }
function input_dbconfig() { if (!fn_token("chk")) { //令牌 return array("alert" => "x030102"); exit; } $_arr_dbHost = validateStr(fn_post("db_host"), 1, 900); switch ($_arr_dbHost["status"]) { case "too_short": return array("alert" => "x040204"); exit; break; case "too_long": return array("alert" => "x040205"); exit; break; case "ok": $this->dbconfigSubmit["db_host"] = $_arr_dbHost["str"]; break; } $_arr_dbName = validateStr(fn_post("db_name"), 1, 900); switch ($_arr_dbName["status"]) { case "too_short": return array("alert" => "x040206"); exit; break; case "too_long": return array("alert" => "x040207"); exit; break; case "ok": $this->dbconfigSubmit["db_name"] = $_arr_dbName["str"]; break; } $_arr_dbPort = validateStr(fn_post("db_port"), 1, 900); switch ($_arr_dbPort["status"]) { case "too_short": return array("alert" => "x040208"); exit; break; case "too_long": return array("alert" => "x040209"); exit; break; case "ok": $this->dbconfigSubmit["db_port"] = $_arr_dbPort["str"]; break; } $_arr_dbUser = validateStr(fn_post("db_user"), 1, 900); switch ($_arr_dbUser["status"]) { case "too_short": return array("alert" => "x040210"); exit; break; case "too_long": return array("alert" => "x040211"); exit; break; case "ok": $this->dbconfigSubmit["db_user"] = $_arr_dbUser["str"]; break; } $_arr_dbPass = validateStr(fn_post("db_pass"), 1, 900); switch ($_arr_dbPass["status"]) { case "too_short": return array("alert" => "x040212"); exit; break; case "too_long": return array("alert" => "x040213"); exit; break; case "ok": $this->dbconfigSubmit["db_pass"] = $_arr_dbPass["str"]; break; } $_arr_dbCharset = validateStr(fn_post("db_charset"), 1, 900); switch ($_arr_dbCharset["status"]) { case "too_short": return array("alert" => "x040214"); exit; break; case "too_long": return array("alert" => "x040215"); exit; break; case "ok": $this->dbconfigSubmit["db_charset"] = $_arr_dbCharset["str"]; break; } $_arr_dbTable = validateStr(fn_post("db_table"), 1, 900); switch ($_arr_dbTable["status"]) { case "too_short": return array("alert" => "x040216"); exit; break; case "too_long": return array("alert" => "x040217"); exit; break; case "ok": $this->dbconfigSubmit["db_table"] = $_arr_dbTable["str"]; break; } $this->dbconfigSubmit["alert"] = "ok"; return $this->dbconfigSubmit; }