/** * WebConfigAct::act_addWebConfig() * 添加网站后台配置 * @param string $cKey 名称 * @param string $cValue 内容 * @param string $is_enable 是否启用 * @return bool */ public function act_addWebConfig() { $cKey = isset($_POST["cKey"]) ? post_check($_POST["cKey"]) : ""; $cValue = isset($_POST["cValue"]) ? post_check($_POST["cValue"]) : ""; $is_enable = isset($_POST["is_enable"]) ? abs(intval($_POST["is_enable"])) : 0; $act = isset($_REQUEST["act"]) ? post_check($_REQUEST["act"]) : ""; $mod = isset($_REQUEST["mod"]) ? post_check($_REQUEST["mod"]) : ""; if (!AuthUser::checkLogin($mod, $act)) { self::$errCode = 10000; self::$errMsg = "对不起,您无数据添加权限!"; return false; } if (empty($cKey) || !preg_match("/^([A-Z]+_?)*[A-Z]\$/", $cKey)) { self::$errCode = 10001; self::$errMsg = "配置名称参数有误!"; return false; } if (empty($cValue)) { self::$errCode = 10002; self::$errMsg = "配置内容参数有误!"; return false; } if (!in_array($is_enable, array(0, 1))) { self::$errCode = 10003; self::$errMsg = "是否启用参数有误!"; return false; } $addTime = time(); $uid = $_SESSION[C('USER_AUTH_SYS_ID')]; $data = array("cKey" => $cKey, "cValue" => $cValue, "is_enable" => $is_enable, "addTime" => $addTime, "add_user_id" => $uid); $res = WebConfigModel::addWebConfig($data); self::$errCode = WebConfigModel::$errCode; self::$errMsg = WebConfigModel::$errMsg; return $res; }