public function save_f() { $id = $this->get("id", "int"); if (!$id && !$this->popedom['add'] || $id && !$this->popedom['modify']) { error(P_Lang('您没有权限执行此操作'), $this->url('cate'), 'error'); } $title = $this->get("title"); $identifier = $this->get("identifier"); $error_url = $this->url("cate", "set"); if ($id) { $error_url .= "&id=" . $id; } if (!$identifier) { error(P_Lang('标识不能为空'), $error_url, "error"); } $identifier2 = strtolower($identifier); if (!preg_match("/[a-z][a-z0-9\\_\\-]+/", $identifier2)) { error(P_Lang('标识不符合系统要求,限字母、数字及下划线(中划线)且必须是字母开头'), $error_url, "error"); } $check = $this->model('id')->check_id($identifier2, $_SESSION["admin_site_id"], $id); if ($check) { error(P_Lang('标识已被使用'), $error_url, "error"); } $array = array('title' => $title, 'identifier' => $identifier); $array['parent_id'] = $this->get("parent_id", "int"); $array['status'] = $this->get('status', 'int'); $array['tpl_list'] = $this->get('tpl_list'); $array['tpl_content'] = $this->get('tpl_content'); $array['psize'] = $this->get('psize', 'int'); $array['taxis'] = $this->get('taxis', 'int'); $array['seo_title'] = $this->get('seo_title'); $array['seo_keywords'] = $this->get('seo_keywords'); $array['seo_desc'] = $this->get('seo_desc'); $array['tag'] = $this->get('tag'); if (!$id) { $array["site_id"] = $_SESSION["admin_site_id"]; $id = $this->model('cate')->save($array); if (!$id) { error(P_Lang('分类添加失败,请检查'), $error_url); } ext_save("admin-add-cate", true, "cate-" . $id); $this->model('temp')->clean("add-cate", $_SESSION["admin_id"]); } else { $parent_id = $this->get('parent_id', 'int'); $rs = $this->model('cate')->get_one($id); if ($parent_id == $id) { $old_rs = $this->model('cate')->get_one($id); $parent_id = $old_rs["id"]; } $son_cate_list = array(); $this->son_cate_list($son_cate_list, $id); if (in_array($parent_id, $son_cate_list)) { error(P_Lang('不允许将分类迁移至此分类下的子分类'), $error_url, "error"); } $array["parent_id"] = $parent_id; $update = $this->model('cate')->save($array, $id); if (!$update) { error(P_Lang('分类更新失败'), $error_url); } ext_save("cate-" . $id); $this->model('temp')->clean("cate-" . $id, $_SESSION["admin_id"]); } $this->_save_tag($id); error(P_Lang('分类信息配置成功'), $this->url("cate"), "ok"); }
public function save_f() { $id = $this->get("id", "int"); if (!$id) { error(P_Lang('未指定项目ID'), $this->url('list'), "error"); } $this->popedom_auto($id); if (!$this->popedom["set"]) { error(P_Lang('您没有权限执行此操作'), '', 'error'); } $title = $this->get("title"); if (!$title) { error(P_Lang('名称不能为空'), $this->url("list", "action", "id=" . $id), "error"); } $array = array("title" => $title); $array["seo_title"] = $this->get("seo_title"); $array["seo_keywords"] = $this->get("seo_keywords"); $array["seo_desc"] = $this->get("seo_desc"); $array['tag'] = $this->get('tag'); $this->model('project')->save($array, $id); if ($array['tag']) { $this->model('tag')->update_tag($array['tag'], 'p' . $id, $_SESSION['admin_site_id']); } else { $this->model('tag')->stat_delete('p' . $id, "title_id"); } ext_save("project-" . $id); $this->model('temp')->clean("project-" . $id, $_SESSION["admin_id"]); $ok_url = $this->url("list", "action", "id=" . $id); error(P_Lang('项目信息编辑成功'), $ok_url, "ok"); }
function setok_f() { $array = array(); $id = $this->get("id", "int"); $title = $this->get("title"); $error_url = $this->url("usergroup", "set"); if ($id) { if (!$this->popedom["modify"]) { error(P_Lang('您没有权限执行此操作'), '', 'error'); } $error_url .= "&id=" . $id; $rs = $this->model('usergroup')->get_one($id); $old_popedom = $rs['popedom'] ? unserialize($rs['popedom']) : array(); $sitelist = $this->model('site')->get_all_site(); if ($sitelist) { foreach ($sitelist as $key => $value) { $array['popedom'][$value['id']] = $old_popedom[$value['id']] ? $old_popedom[$value['id']] : ''; } } } else { if (!$this->popedom["add"]) { error(P_Lang('您没有权限执行此操作'), '', 'error'); } } if (!$title) { error(P_Lang('组名称不允许为空'), $error_url, "error"); } $array["title"] = $title; $popedom = $this->get('popedom', 'checkbox'); if ($popedom) { $array['popedom'][$_SESSION['admin_site_id']] = implode(",", $popedom); } $array['popedom'] = serialize($array['popedom']); $array["is_open"] = $this->get("is_open", "int"); $array["taxis"] = $this->get("taxis", "int"); $array["register_status"] = $this->get("register_status"); $array["tbl_id"] = $this->get("tbl_id", "int"); $fields_list = $this->get("fields_list"); if ($fields_list && is_array($fields_list)) { if (in_array("all", $fields_list)) { $array["fields"] = ""; } else { $array["fields"] = implode(",", $fields_list); } } if ($id) { $this->model('usergroup')->save($array, $id); //存储扩展字段 ext_save("usergroup-" . $id); $this->model('temp')->clean("usergroup-" . $id, $_SESSION["admin_id"]); } else { $id = $this->model('usergroup')->save($array); if ($id) { ext_save("add-usergroup-ext-id", true, "usergroup-" . $id); $this->model('temp')->clean("add-usergroup-ext-id", $_SESSION["admin_id"]); } } error(P_Lang('会员组信息添加/存储成功'), $this->url("usergroup"), "ok"); }
public function ext_save_f() { $id = $this->get("id", "int"); if (!$id) { error(P_Lang('未指定ID'), $this->url("all")); } $rs = $this->model('site')->all_one($id); if (!$rs) { error(P_Lang('全局配置不存在'), $this->url("all")); } ext_save("all-" . $id); $this->model('temp')->clean("all-" . $id, $_SESSION["admin_id"]); error(P_Lang('扩展全局内容设置成功'), $this->url("all", 'set', 'id=' . $id)); }
function content_save_f() { if (!$this->popedom['set']) { $this->json(P_Lang('您没有权限执行此操作')); } $id = $this->get('id', 'int'); if (!$id) { $this->json(P_Lang('未指定ID')); } $title = $this->get("title"); if (!$title) { $this->json(P_Lang('名称不能为空')); } $array = array("title" => $title); $this->model('project')->save($array, $id); ext_save("project-" . $id); $this->json(true); }
public function ok_f() { $id = $this->get("id", "int"); $pid = $this->get("pid", "int"); $parent_id = $this->get("parent_id", "int"); if (!$pid && !$id) { $this->json(P_Lang('操作异常,无法取得项目信息')); } $is_add = true; if ($id) { $rs = $this->model('list')->get_one($id); $this->assign("rs", $rs); $pid = $rs["project_id"]; $parent_id = $rs["parent_id"]; $is_add = false; } if (!$pid) { $this->json(P_Lang('操作异常,无法取得项目信息')); } $p_rs = $this->model('project')->get_one($pid); if (!$p_rs) { $this->json(P_Lang('操作异常,无法取得项目信息')); } $array = array(); $title = $this->get("title"); if (!$title) { $this->json(P_Lang('内容的主题不能为空')); } $array["title"] = $title; if ($p_rs['cate']) { $cate_id = $this->get("cate_id", "int"); if (!$cate_id) { $this->json(P_Lang('主分类不能为空')); } $array["cate_id"] = $cate_id; } //更新标识串 $array['identifier'] = $this->get("identifier"); if ($array['identifier']) { $check = $this->check_identifier($array['identifier'], $id, $p_rs["site_id"]); if ($check != 'ok') { $this->json($check); } } if ($p_rs['is_attr']) { $attr = $this->get("attr"); if ($attr && is_array($attr)) { $attr = implode(",", $attr); } $array["attr"] = $attr; } if ($p_rs['is_tag']) { $array["tag"] = $this->get("tag"); if ($array["tag"]) { $array["tag"] = str_replace(array(" ", ",", ",", "|", "|", "、", "/", "\\", "/", "\", "+", "+", "-", "-", "_", "_", "—"), " ", $array["tag"]); $array["tag"] = preg_replace("/( {2,})/", " ", $array["tag"]); } } if ($p_rs['is_userid']) { $array['user_id'] = $this->get('user_id', 'int'); } else { $array['user_id'] = 0; } if ($p_rs['is_tpl_content']) { $array['tpl'] = $this->get('tpl'); } else { $array['tpl'] = ''; } $array["parent_id"] = $parent_id; $dateline = $this->get("dateline", "time"); if (!$dateline) { $dateline = $this->time; } $array["dateline"] = $dateline; $array["status"] = $this->get("status", "int"); $array["hidden"] = $this->get("hidden", "int"); $array["hits"] = $this->get("hits", "int"); $array["sort"] = $this->get("sort", "int"); $array["seo_title"] = $this->get("seo_title"); $array["seo_keywords"] = $this->get("seo_keywords"); $array["seo_desc"] = $this->get("seo_desc"); $array["project_id"] = $p_rs['id']; $array["module_id"] = $p_rs["module"]; $array["site_id"] = $p_rs["site_id"]; $tmpadd = false; if (!$id) { $id = $this->model('list')->save($array); $tmpadd = true; } else { $this->model('list')->save($array, $id); } if (!$id) { $this->json(P_Lang('存储数据失败,请检查')); } //更新扩展分类 if ($cate_id) { $ext_cate = $this->get('ext_cate_id'); if (!$ext_cate) { $ext_cate = array($cate_id); } $this->model('list')->save_ext_cate($id, $ext_cate); } //更新Tag标签 $this->model('tag')->update_tag($array['tag'], $id, $_SESSION['admin_site_id']); if ($p_rs["module"]) { $ext_list = $this->model('module')->fields_all($p_rs["module"]); $tmplist = array(); $tmplist["id"] = $id; $tmplist["site_id"] = $p_rs["site_id"]; $tmplist["project_id"] = $pid; $tmplist["cate_id"] = $cate_id; if (!$ext_list) { $ext_list = array(); } foreach ($ext_list as $key => $value) { if ($rs[$value['identifier']]) { $value['content'] = $rs[$value['identifier']]; } $tmplist[$value["identifier"]] = $this->lib('form')->get($value); } $this->model('list')->save_ext($tmplist, $p_rs["module"]); } //保存内容扩展字段 if ($tmpadd) { ext_save("admin-add-list", true, "list-" . $id); } else { ext_save("list-" . $id); } $this->plugin("ap-list-ok-after", array("id" => $id, "project" => $p_rs)); $this->json(true); }
public function save_f() { $id = $this->get("id", "int"); $title = $this->get("title"); $identifier = $this->get("identifier"); $error_url = $this->url("cate", "set"); if ($id) { $error_url .= "&id=" . $id; } if (!$identifier) { error(P_Lang('标识不能为空'), $error_url, "error"); } $identifier2 = strtolower($identifier); if (!preg_match("/[a-z][a-z0-9\\_\\-]+/", $identifier2)) { error(P_Lang('标识不符合系统要求,限字母、数字及下划线(中划线)且必须是字母开头'), $error_url, "error"); } $check = $this->model('id')->check_id($identifier2, $_SESSION["admin_site_id"], $id); if ($check) { error(P_Lang('标识已被使用'), $error_url, "error"); } $parent_id = $this->get('parent_id', 'int'); $array = array('title' => $title, 'identifier' => $identifier); $array['parent_id'] = $parent_id; $array['status'] = $this->get('status', 'int'); $array['tpl_list'] = $this->get('tpl_list'); $array['tpl_content'] = $this->get('tpl_content'); $array['psize'] = $this->get('psize', 'int'); $array['taxis'] = $this->get('taxis', 'int'); $array['seo_title'] = $this->get('seo_title'); $array['seo_keywords'] = $this->get('seo_keywords'); $array['seo_desc'] = $this->get('seo_desc'); $array['tag'] = $this->get('tag'); if (!$id) { $array["site_id"] = $_SESSION["admin_site_id"]; $id = $this->model('cate')->save($array); if (!$id) { error(P_Lang('分类添加失败,请检查'), $error_url); } ext_save("admin-add-cate", true, "cate-" . $id); } else { $rs = $this->model('cate')->get_one($id); if ($parent_id == $id) { $old_rs = $this->model('cate')->get_one($id); $parent_id = $old_rs["id"]; } $son_cate_list = array(); $this->son_cate_list($son_cate_list, $id); if (in_array($parent_id, $son_cate_list)) { error(P_Lang('不允许将分类迁移至此分类下的子分类'), $error_url, "error"); } $array["parent_id"] = $parent_id; $update = $this->model('cate')->save($array, $id); if (!$update) { error(P_Lang('分类更新失败'), $error_url); } ext_save("cate-" . $id); } $this->_save_tag($id); //保存根分类的扩展字段属性配置 if (!$parent_id && $id) { $extfields = $this->get('_extfields'); if ($extfields) { $extfields = implode(",", $extfields); $this->lib('xml')->save(array('fid' => $extfields), $this->dir_root . 'data/xml/cate_extfields_' . $id . '.xml'); } } error(P_Lang('分类信息配置成功'), $this->url("cate"), "ok"); }
public function ext_save_f() { if (!$this->popedom["set"]) { error(P_Lang('您没有权限执行此操作'), '', 'error'); } $id = $this->get("id", "int"); if (!$id) { error(P_Lang('未指定ID'), $this->url("all")); } $rs = $this->model('site')->all_one($id); if (!$rs) { error(P_Lang('全局配置不存在'), $this->url("all")); } ext_save("all-" . $id); $this->model('temp')->clean("all-" . $id, $_SESSION["admin_id"]); error(P_Lang('扩展全局内容设置成功'), $this->url("all")); }