type_text = json_decode(IN_ARTICLE_TYPE, true);
$this->group_text = json_decode(IN_ARTICLE_GROUP, true);
$this->Administrator(6);
$this->header();
}
public function __destruct()
{
?>
footer();
}
function index($_var_0 = [])
{
$_var_1 = SafeRequest("page", "get");
$this->search = SafeRequest("search", "get");
$this->search && ($_var_0[] = ["name|content", "like", "%" . $this->search . "%"]);
$this->type = SafeRequest("type", "get");
is_numeric($this->type) && ($_var_0[] = ["type", "=", $this->type]);
$this->group = SafeRequest("group", "get");
$this->group && ($_var_0[] = ["group", "=", $this->group]);
$_var_2 = db("article")->where($_var_0)->order("id desc")->paginate(["page" => $_var_1]);
$_var_3 = $_var_2->items();
$_var_4 = getRender($_var_2, $_var_1);
$_var_5 = $_var_2->total();
?>
ShowMessage("链接来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_9 = intval(SafeRequest("id", "get"));
$_var_10 = db("article")->where("id", $_var_9)->delete();
$this->ShowMessage("恭喜您,删除成功!", "?c=article", "infotitle2", 1000, 1);
}
function edit()
{
$_var_11 = SafeRequest("id", "get");
$_var_12 = $_var_11 ? "编辑" : "新增";
$_var_13 = db("article")->where("id", $_var_11)->find();
?>
kindeditor();
}
function save()
{
if (!submitcheck("hash", 1)) {
$this->ShowMessage("表单来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_16 = intval(SafeRequest("id", "post"));
$_var_17 = SafeRequest("name", "post");
if (!$_var_17) {
$this->ShowMessage("文章名称不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_18 = SafeRequest("content", "post", 1);
if (!$_var_18) {
$this->ShowMessage("内容不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_19 = ["name" => $_var_17, "content" => $_var_18];
$_var_19["group"] = SafeRequest("group", "post");
$_var_19["type"] = SafeRequest("type", "post");
if ($_var_16) {
$_var_20 = db("article")->where("id", $_var_16)->update($_var_19);
} else {
if (db("article")->where("name", $_var_17)->where("group", $_var_19["group"])->where("type", $_var_19["type"])->count()) {
$this->ShowMessage("已存在同名的文章", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_20 = db("article")->insert($_var_19);
}
$_var_20 && $this->ShowMessage("恭喜您,文章保存成功!", "?c=article", "infotitle2", 1000, 1);
$this->ShowMessage("文章保存失败!请稍后重试!", $_SERVER["HTTP_REFERER"], "infotitle3", 3000, 1);
}
function change_status()
{
if (!submitcheck("hash", -1)) {
$this->ShowMessage("链接来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
}
$_var_21 = intval(SafeRequest("id", "get"));
$_var_22 = intval(SafeRequest("status", "get"));
$_var_23 = db("article")->where("id", $_var_21)->update(["status" => intval(!$_var_22)]);
$this->ShowMessage("恭喜您,状态切换成功!", "?c=article", "infotitle2", 1000, 1);
}
}