function set_f() { $id = $this->trans_lib->int("id"); $id ? sys_popedom("usergroup:modify", "tpl") : sys_popedom("usergroup:add", "tpl"); if ($id) { $rs = $this->usergroup_m->get_one($id); $p_post = $rs["popedom_post"] ? sys_id_list($rs["popedom_post"]) : array(); $p_reply = $rs["popedom_reply"] ? sys_id_list($rs["popedom_reply"]) : array(); $p_read = $rs["popedom_read"] ? sys_id_list($rs["popedom_read"]) : array(); $this->tpl->assign("rs", $rs); $this->tpl->assign("id", $id); } else { $p_post = $p_reply = $p_read = array(); } $this->tpl->assign("p_post", $p_post); $this->tpl->assign("p_reply", $p_reply); $this->tpl->assign("p_read", $p_read); //读取模块组 $this->load_model("module"); $modulelist = $this->module_m->module_list(0); $this->tpl->assign("modulelist", $modulelist); //读取分类 $this->load_model("cate"); $this->cate_m->langid($_SESSION["sys_lang_id"]); $this->cate_m->get_catelist(); $catelist = $this->cate_m->html_select_array(); $this->tpl->assign("catelist", $catelist); $this->tpl->display("user/group_set.html"); }
function set_f() { $id = $this->trans_lib->int("id"); if ($id) { if ($id == $_SESSION["admin_id"]) { error("对不起,您不能修改自己的信息", site_url("admin")); } sys_popedom($this->module_sign . ":modify", "tpl"); $rs = $this->admin_m->get_one($id); $popedom = $rs["popedom"] ? sys_id_list($rs["popedom"]) : array("0:0"); $this->tpl->assign("rs", $rs); $lang_popedom = $rs["langid"] ? sys_id_list($rs["langid"]) : array(); $this->tpl->assign("lang_popedom", $lang_popedom); } else { sys_popedom($this->module_sign . ":add", "tpl"); $popedom = array("0:0"); $lang_popedom = $rs["langid"] ? sys_id_list($rs["langid"]) : array(); $this->tpl->assign("lang_popedom", $lang_popedom); } $this->tpl->assign("popedom", $popedom); //读取所有可以配置权限的模块 $mlist = $this->module_m->all_module(); $this->tpl->assign("mlist", $mlist); $this->load_model("identifier"); $plist = $this->identifier_m->popedom_list(); $this->tpl->assign("plist", $plist); //读取所有可以配置的语言 $this->load_model("lang"); $langlist = $this->lang_m->get_list(); $this->tpl->assign("langlist", $langlist); $this->tpl->display("admin/set.html"); }
function cate_f() { $this->cate_m->langid($_SESSION["sys_lang_id"]); $this->cate_m->get_all(); $this->cate_m->format_list(0, 0); $catelist = $this->cate_m->flist(); if (!is_array($catelist)) { $catelist = array(); } foreach ($catelist as $key => $value) { $value["space"] = ""; for ($i = 0; $i < $value["level"]; $i++) { $value["space"] .= " "; } $catelist[$key] = $value; } $this->tpl->assign("catelist", $catelist); $id = $this->trans_lib->safe("id"); $idlist = array(); if ($id) { $idlist = sys_id_list($id); } $this->tpl->assign("idlist", $idlist); $this->tpl->display("highlight/cate.html"); }
function __construct() { parent::Control(); $this->load_model("upfile"); //读取附件操作类 if (file_exists(ROOT_DATA . "attachment.php")) { include ROOT_DATA . "attachment.php"; if ($_sys["picture_type"]) { $this->type_img = sys_id_list($_sys["picture_type"]); } if ($_sys["video_type"]) { $this->type_video = sys_id_list($_sys["video_type"]); } if ($_sys["file_type"]) { $this->type_file = sys_id_list($_sys["file_type"]); } $this->file_uptype = $_sys["file_uptype"]; } $this->tpl->assign("type_video", $this->type_video); $this->tpl->assign("type_img", $this->type_img); $this->tpl->assign("type_file", $this->type_file); $this->tpl->assign("file_uptype", $this->file_uptype); }
function phpok_menu($id = 0, $cid = 0, $mid = 0) { $app = sys_init(); $app->load_model("menu"); $tmplist = $app->menu_m->get_all(); if (!$tmplist) { return false; } $rslist = array(); $site_html = $app->sys_config["sitehtml"] ? $app->sys_config["sitehtml"] : $app->sys_config["siteurl"] . "html/" . $app->langid . "/"; $index_php = $app->sys_config["indexphp"] ? $app->sys_config["indexphp"] : "index.php"; $site_url = $app->sys_config["siteurl"] ? $app->sys_config["siteurl"] : base_url(); foreach ($tmplist as $key => $value) { if (!$value["link_html"]) { $value["link_html"] = $value["link"]; } if (!$value["link_rewrite"]) { $value["link_rewrite"] = $value["link"]; } if ($app->sys_config["site_type"] == "html") { $value["link"] = $value["link_html"]; } elseif ($app->sys_config["site_type"] == "rewrite") { $value["link"] = $value["link_rewrite"]; } $value["link"] = str_replace("{control_trigger}", $app->config->c, $value["link"]); $value["link"] = str_replace("{site_html}", $site_html, $value["link"]); $value["link"] = str_replace("{index_php}", $index_php, $value["link"]); $value["link"] = str_replace("{site_url}", $site_url, $value["link"]); $value["link"] = str_replace("&", "&", $value["link"]); unset($value["link_html"], $value["link_rewrite"]); //判断是否有 $value["my_highlight"] = false; $control_c = $app->trans_lib->safe($app->config->c); if ($id && $control_c == "msg") { if ($value["highlight"] == "subject" && $value["highlight_id"] == $id) { $value["my_highlight"] = true; } else { if ($value["highlight"] == "cate" && $value["highlight_id"] && $cid && in_array($cid, sys_id_list($value["highlight_id"]))) { $value["my_highlight"] = true; } else { if ($value["highlight"] == "module" && $value["highlight_id"] && $mid && $mid == $value["highlight_id"]) { $value["my_highlight"] = true; } } } } elseif ($cid && $control_c == "list") { if ($value["highlight"] == "cate" && $value["highlight_id"] && in_array($cid, sys_id_list($value["highlight_id"]))) { $value["my_highlight"] = true; } else { if ($value["highlight"] == "module" && $value["highlight_id"] && $mid && $mid == $value["highlight_id"]) { $value["my_highlight"] = true; } } } elseif ($mid && $control_c == "list") { if ($value["highlight"] == "module" && $value["highlight_id"] && $mid == $value["highlight_id"]) { $value["my_highlight"] = true; } } else { if (!$control_c) { $control_c = "index"; } if ($control_c && $control_c == $value["highlight"]) { $value["my_highlight"] = true; } } $rslist[$key] = $value; } return $rslist; }
function ajax_del_f() { $id = $this->trans_lib->safe("id"); if (!$id) { exit("error:没有指定ID"); } $array = sys_id_list($id); if (!$array[0]) { exit("error:错误"); } $rs = $this->list_m->get_one($array[0]); $module_id = $rs["module_id"]; sys_popedom($module_id . ":delete", "ajax"); $this->list_m->del($id); exit("ok"); }
function pldel_leftpanel_f() { $this->load_model("hotlink"); $id = $this->trans_lib->safe("id"); if (!$id) { exit("没有指定要删除的热链"); } $id_list = sys_id_list($id, "intval"); if (!$id_list || !is_array($id_list)) { exit("没有指定要删除的热链"); } foreach ($id_list as $key => $value) { $value = trim($value); if (!$value) { continue; } $rs = $this->module_m->get_one($value); if (!$rs) { continue; } $linkurl = "{admin}?{c}=" . $rs["ctrl_init"] . "&module_id=" . $value; $tmp_rs = $this->hotlink_m->get_one_url($linkurl, $_SESSION["sys_lang_id"]); if (!$tmp_rs) { continue; } $this->hotlink_m->del($tmp_rs["id"]); } exit("ok"); }
function set_f() { $id = $this->trans_lib->int("id"); $inc_module = array(); $layout = array(); if ($id) { sys_popedom($this->module_sign . ":modify", "tpl"); //[读取数据] $rs = $this->module_m->get_one($id); if ($rs["inc_module"]) { $inc_module = explode(",", $rs["inc_module"]); } //读取字段列表 $tmp_list = $this->module_m->fields_index($id); if ($tmp_list) { $mlist = array(); foreach ($tmp_list as $key => $value) { if ($value["input"] != "edit") { $mlist[] = $value; } } unset($tmp_list); $this->tpl->assign("keylist", $mlist); } if ($rs["layout"]) { $layout = sys_id_list($rs["layout"]); } } else { sys_popedom($this->module_sign . ":add", "tpl"); $rs["popedom"] = array(); } $this->tpl->assign("layout", $layout); $this->tpl->assign("inc_module", $inc_module); $this->tpl->assign("rs", $rs); //读取使用权限的字段 $this->load_model("identifier"); $popedom_list = $this->identifier_m->get_sign("popedom"); $this->tpl->assign("popedom_list", $popedom_list); //取得模块组 $group_list = $this->module_m->top(); $this->tpl->assign("group_list", $group_list); //关联图片类型 $this->load_model("gdtype"); $gdlist = $this->gdtype_m->get_all(); $this->tpl->assign("gdlist", $gdlist); $this->tpl->display("ctrl/set.html"); }
function post_f() { $id = $this->trans_lib->safe("id"); $tid = $this->trans_lib->safe("tid"); if (!$id && !$tid) { error("没有指定要发布有采集项目!", $this->url("collection")); } $id = sys_id_string($id, ",", "intval"); //返回上一级 $goback = $tid ? $this->url("collection,list", "id=" . $id) : $this->url("collection"); if (!$tid) { $rs = $this->collection_m->get_id_nostatus($id); if (!$rs) { error("信息已发布完成,或没有可以发布的信息!", $goback); } $nexturl = $this->url("collection,post", "id=" . rawurlencode($id)); } else { $startid = $this->trans_lib->int("startid"); $newlist = sys_id_list($tid, "intval", ","); if (!$newlist[$startid]) { error("信息已发布完成,或没有可以发布的信息!", $goback); } $rs = $this->collection_m->get_one_list($newlist[$startid]); $nexturl = $this->url("collection,post", "id=" . rawurlencode($id) . "&tid=" . rawurlencode($tid) . "&startid=" . ($startid + 1)); } if (!$rs["status"] || $rs["status"] == 2) { if (!$rs["status"]) { error("主题:<span class='red'>" . $rs["title"] . "</span> 尚未采集……", $nexturl); } else { error("主题:<span class='darkblue'>" . $rs["title"] . "</span> 已经发布过,不允许再发布!", $nexturl); } } //取得标签列表 $tags_tmp_list = $this->collection_m->get_all_tags($rs["cid"]); $tagslist = array(); foreach ($tags_tmp_list as $key => $value) { $tagslist[$value["identifier"]] = $value; } unset($tags_tmp_list); $msglist = $this->collection_m->get_content_list($rs["id"]); if (!$msglist["title"]) { $msglist["title"] = $rs["title"]; } $format_idlist = $this->collection_m->get_sub_idlist(); $tagslist = $this->collection_m->get_all_tags($rs["cid"]); $array_sys = $array_biz = $array_ext = $array_c = array(); $cm_rs = $this->collection_m->get_one_cate_module($rs["cid"]); $array_sys["module_id"] = $cm_rs["module_id"]; $array_sys["cate_id"] = $cm_rs["cateid"]; $this->load_model("list"); foreach ($tagslist as $k => $v) { if ($v["tags_type"] == "string") { $msglist[$v["identifier"]] = $v["rules"]; $msglist[$v["identifier"]] = str_replace("{session.admin_name}", $_SESSION["admin_name"], $msglist[$v["identifier"]]); $msglist[$v["identifier"]] = str_replace("{ip}", sys_ip(), $msglist[$v["identifier"]]); $msglist[$v["identifier"]] = str_replace("{post_date}", $this->system_time, $msglist[$v["identifier"]]); } else { //判断目标存储格式 $pformat = $v["post_save"]; if ($pformat == "safe") { $msglist[$v["identifier"]] = $this->trans_lib->st_safe($msglist[$v["identifier"]]); } elseif ($pformat == "int") { $msglist[$v["identifier"]] = intval($msglist[$v["identifier"]]); } elseif ($pformat == "float") { $msglist[$v["identifier"]] = floatval($msglist[$v["identifier"]]); } elseif ($pformat == "datetime") { $msglist[$v["identifier"]] = strtotime($msglist[$v["identifier"]]); } elseif ($pformat == "img") { $subject_id = $format_idlist[$v["identifier"]]; $srclist = $this->collection_m->get_all_files_id($subject_id); if ($srclist) { $return_array = $this->get_img_array($msglist[$v["identifier"]], $v["identifier"], $srclist); if ($return_array) { $msglist[$v["identifier"]] = $return_array[$v["identifier"]]; $array_sys["thumb_id"] = $return_array["thumb_id"]; //补充缩略图 } else { $msglist[$v["identifier"]] = ""; } } else { $msglist[$v["identifier"]] = ""; } } elseif ($pformat == "html") { $subject_id = $format_idlist[$v["identifier"]]; $srclist = $this->collection_m->get_all_files_id($subject_id); if ($srclist) { $return_array = $this->format_html($msglist[$v["identifier"]], $v["identifier"], $srclist); if ($return_array && is_array($return_array)) { if (!$array_sys["thumb_id"] && $return_array["thumb_id"]) { $array_sys["thumb_id"] = $return_array["thumb_id"]; //补充缩略图 } $msglist[$v["identifier"]] = $return_array[$v["identifier"]]; } else { $msglist[$v["identifier"]] = $return_array; } } } } if ($v["ifsystem"] == "list") { $array_sys[$v["identifier"]] = sys_cutstring($msglist[$v["identifier"]], 240); } elseif ($v["ifsystem"] == "ext") { $array_ext[$v["identifier"]] = sys_cutstring($msglist[$v["identifier"]], 240); } else { $array_c[$v["identifier"]] = $msglist[$v["identifier"]]; } } //exit; //存储核心数据 $insert_id = $this->list_m->save_sys($array_sys); //存储数据 if (!$insert_id) { error("异常:<span class='red'>" . $rs["title"] . "</span>", $nexturl); } //存储分类 $ext_catelist = sys_id_list($cm_rs["cateid"], "intval"); $this->list_m->save_catelist($insert_id, $ext_catelist); //存储扩展数据 foreach ($array_ext as $k => $v) { $tmp_array = array(); $tmp_array["id"] = $insert_id; $tmp_array["field"] = $k; $tmp_array["val"] = $v; $this->list_m->save_ext($tmp_array, "ext"); } foreach ($array_c as $k => $v) { $tmp_array = array(); $tmp_array["id"] = $insert_id; $tmp_array["field"] = $k; $tmp_array["val"] = $v; //存储图片 $this->list_m->save_ext($tmp_array, "c"); } //更新主题状态 $update_array = array(); $update_array["status"] = 2; $this->collection_m->save_list($update_array, $rs["id"]); error("入库:<span class='red'>" . $rs["title"] . "</span> 完成!", $nexturl); }
function top_f() { $popedom = $this->admin_m->get_module_id($_SESSION["admin_id"]); //加载头部信息 //读取头部信息 $rslist = $this->module_m->top(0, 1); if (!is_array($rslist)) { $rslist = array(); } $newlist = array(); $tmp_i = 0; foreach ($rslist as $key => $value) { $value["left_url"] = $this->url("index,left", "id=" . $value["id"]); if ($value["js_function"]) { $value["onclick"] = $value["js_function"] . "()"; $newlist[] = $value; $tmp_i++; continue; } if ($popedom == "all") { $value["onclick"] = "change_this('" . $tmp_i . "','" . $value["left_url"] . "')"; $newlist[] = $value; $tmp_i++; continue; } if ($popedom && $popedom != "all") { //判断子级是否有适合的权限 $sonlist = $this->module_m->left($value["id"], 1); $tmp_son = false; if ($sonlist && is_array($sonlist) && count($sonlist) > 0) { foreach ($sonlist as $k => $v) { if (in_array($v["id"], $popedom)) { $tmp_son = true; break; } } } if ($tmp_son) { $value["onclick"] = "change_this('" . $tmp_i . "','" . $value["left_url"] . "')"; $newlist[] = $value; $tmp_i++; continue; } } } $this->tpl->assign("rslist", $newlist); //加载语言包 $this->load_model("lang"); $tmp_langlist = $this->lang_m->get_list(); if ($tmp_langlist) { $langlist = array(); foreach ($tmp_langlist as $key => $value) { if ($value["status"]) { $langlist[] = $value; } } if (count($langlist) < 1) { unset($langlist); } } if (!$langlist) { $langlist = array(); $langlist[0]["langid"] = "zh"; $langlist[0]["title"] = "简体中文"; $langlist[0]["status"] = 1; } $admin_rs = $this->admin_m->get_one($_SESSION["admin_id"]); if (!$admin_rs["if_system"]) { $lang_popedom = sys_id_list($admin_rs["langid"]); if ($lang_popedom && is_array($lang_popedom) && count($lang_popedom) > 0) { $new_langlist = array(); foreach ($langlist as $key => $value) { if (in_array($value["langid"], $lang_popedom)) { $new_langlist[] = $value; } } if (count($new_langlist) > 0) { $langlist = $new_langlist; } } } //判断是否有语言权限 $this->tpl->assign("langlist", $langlist); $this->tpl->p("top"); }
function backup_f() { sys_popedom("phpoksql:set", "tpl"); $id = $this->trans_lib->safe("id"); if (!$id || $id == "all") { $tbl_list = $this->sql_m->get_all(); $idlist = array(); foreach ($tbl_list as $key => $value) { $idlist[] = $value["Name"]; } $tourl = site_url("phpoksql,backup") . "id=all"; } else { $idlist = sys_id_list($id); $tourl = site_url("phpoksql,backup") . "id=" . rawurlencode($id); } //备份的文件名,如果为空,则表示未创建表结构 $backfilename = $this->trans_lib->safe("backfilename"); if (!$backfilename) { $sql_prefix = $this->sql_m->sql_prefix(); //数据表前缀 //创建备份文件名称 $backfilename = "sql_" . date("YmdHis", $this->system_time) . "_" . $_SESSION["admin_id"]; //生成表名,获取表结构 $html = ""; foreach ($idlist as $key => $value) { //禁止session表恢复操作 if ($value != $sql_prefix . "session") { $html .= "DROP TABLE IF EXISTS " . $value . ";\n"; $html .= $this->sql_m->show_create_table($value); $html .= ";\n\n"; } } //判断是否包含 管理员表,如果包含,则同时更新管理员数据 if (in_array($sql_prefix . "admin", $idlist)) { $rslist = $this->sql_m->getsql($sql_prefix . "admin", 0, "all"); if ($rslist) { foreach ($rslist as $key => $value) { $html .= "INSERT INTO " . $sql_prefix . "admin VALUES('" . implode("','", $value) . "');\n"; } } } $this->file_lib->vi($html, ROOT_DATA . $backfilename . ".php"); //存储数据 $tourl .= "&backfilename=" . rawurlencode($backfilename); //已创建表 //初始化临昨表数据 $this->file_lib->vi("#PHPOK Full 数据备份\n\n", ROOT_DATA . $backfilename . "_tmpdata.php"); error("表结构信息备份完毕,请稍候,正在执行下一步!", $tourl); } $tourl .= "&backfilename=" . rawurlencode($backfilename); $startid = $this->trans_lib->int("startid"); //判断startid是否存在 if ($startid + 1 > count($idlist)) { error("数据备份完毕!系统将返回已备份列表中", site_url('phpoksql,baklist')); } $table = $idlist[$startid]; //指定表 //判断如果是管理员表,则跳到下一步 if ($table == $sql_prefix . "admin") { $pageid = $this->trans_lib->int("pageid"); $dataid = $this->trans_lib->int("dataid"); $tourl .= "&startid=" . ($startid + 1) . "&pageid=" . $pageid . "&dataid=" . $dataid; error("数据表 " . $table . " 已备份完成!正在进行下一步操作,请稍候!", $tourl); } //如果是session表,自动进入下一步操作 if ($table == $sql_prefix . "session") { $pageid = $this->trans_lib->int("pageid"); $dataid = $this->trans_lib->int("dataid"); $tourl .= "&startid=" . ($startid + 1) . "&pageid=" . $pageid . "&dataid=" . $dataid; error("数据表 " . $table . " 无需备份数据!正在进行下一步操作,请稍候!", $tourl); } //每次只备份1000条数据 $msg = ""; $oldmsg = ""; if (file_exists(ROOT_DATA . $backfilename . "_tmpdata.php")) { $oldmsg = $this->file_lib->cat(ROOT_DATA . $backfilename . "_tmpdata.php"); } $psize = 100; //每次查询最多读取次数 $total = $this->sql_m->table_count($table); //取得当前表的总记录数 if ($psize >= $total) { $rslist = $this->sql_m->getsql($table, 0, "all"); if ($rslist) { $msg .= "\n#table : " . $table . " , backup time " . date("Y-m-d H:i:s", $this->system_time) . "\n"; foreach ($rslist as $key => $value) { $tmp_value = array(); foreach ($value as $k => $v) { $v = $this->sql_m->escape_string($v); $tmp_value[$k] = $v; } $msg .= "INSERT INTO " . $table . " VALUES('" . implode("','", $tmp_value) . "');\n"; } } $new_startid = $startid + 1; $pageid = 0; } else { $pageid = $this->trans_lib->int("pageid"); if ($pageid < 1) { $pageid = 1; } if ($pageid < 2) { $msg .= "\n#table : " . $table . " , backup time " . date("Y-m-d H:i:s", $this->system_time) . "\n"; } $offset = ($pageid - 1) * $psize; if ($offset < $total) { $rslist = $this->sql_m->getsql($table, $offset, $psize); if ($rslist) { foreach ($rslist as $key => $value) { $tmp_value = array(); foreach ($value as $k => $v) { $v = $this->sql_m->escape_string($v); $tmp_value[$k] = $v; } $msg .= "INSERT INTO " . $table . " VALUES('" . implode("','", $tmp_value) . "');\n"; } $new_startid = $startid; $pageid = $pageid + 1; } else { $new_startid = $startid + 1; $pageid = 0; } } else { $new_startid = $startid + 1; $pageid = 0; } } $tourl .= "&startid=" . $new_startid . "&pageid=" . $pageid; //存储数据的文件Id $dataid = $this->trans_lib->int("dataid"); //计算数据长度 //$msg = $oldmsg.$msg; //$msg = $oldmsg . addslashes($msg); $msg = addslashes($oldmsg . $msg); if (strlen($msg) >= 1024 * 1000) { //如果文件存在,则自动加一 if (file_exists(ROOT_DATA . $backfilename . "_data_" . $dataid . ".php")) { $dataid++; } $this->file_lib->vi($msg, ROOT_DATA . $backfilename . "_data_" . $dataid . ".php"); //存储数据 unset($msg, $oldmsg); //再重新创建临时文件 $new_dataid = $dataid + 1; //判断是否已经结束了 if ($idlist[$new_startid]) { $this->file_lib->vi("#PHPOK Full 数据备份\n\n", ROOT_DATA . $backfilename . "_tmpdata.php"); error("正在备份数据,当前第 " . ($dataid + 1) . " 个文件!", $tourl . "&dataid=" . $new_dataid); } else { $this->file_lib->rm(ROOT_DATA . $backfilename . "_tmpdata.php"); error("数据表备份操作成功,请稍候,正在进入下一步!", site_url("phpoksql,baklist")); } } else { if (!$idlist[$new_startid]) { if (file_exists(ROOT_DATA . $backfilename . "_data_" . $dataid . ".php")) { $dataid++; } $this->file_lib->vi($msg, ROOT_DATA . $backfilename . "_data_" . $dataid . ".php"); //存储数据 $this->file_lib->rm(ROOT_DATA . $backfilename . "_tmpdata.php"); //删除临时文件 error("数据表备份操作成功,请稍候,正在进入下一步!", site_url("phpoksql,baklist")); } else { //如果数据没有超过系统限制,则 $this->file_lib->vi($msg, ROOT_DATA . $backfilename . "_tmpdata.php"); $new_dataid = $dataid; error("正在备份数据,当前第 " . ($dataid + 1) . " 个文件!", $tourl . "&dataid=" . $new_dataid); } } }
function open_cate_f() { $cate_id = $this->trans_lib->int("cate_id"); $cate_string = $this->trans_lib->safe("cate_string"); $this->tpl->assign("cate_id", $cate_id); $this->tpl->assign("cate_string", $cate_string); $cate_list = $cate_string ? sys_id_list($cate_string, "intval") : array(); $this->tpl->assign("cate_list", $cate_list); $mid = $this->trans_lib->int("mid"); $this->tpl->assign("mid", $mid); if (!$mid) { error("未指定模块,请返回!"); } $catelist = $this->_load_cate($mid, $cate_id, true, false); $this->tpl->assign("catelist", $catelist); $this->_load_module($mid); $this->tpl->display("list/cate.html"); }
function save_data($rs, $syslist = "title", $extlist = "", $clist = "") { if (!$rs) { return false; } $syslist = is_string($syslist) && $syslist ? explode(",", $syslist) : ($syslist ? $syslist : array()); $extlist = is_string($extlist) && $extlist ? explode(",", $extlist) : ($extlist ? $extlist : array()); $clist = is_string($clist) && $clist ? explode(",", $clist) : ($clist ? $clist : array()); $sys_rs = $ext_rs = $c_rs = array(); foreach ($rs as $key => $value) { if (in_array($key, $syslist)) { if ($key == "thumb") { $sys_rs["thumb_id"] = $this->save_pic($value); } elseif ($key == "post_date") { $sys_rs["post_date"] = strtotime($value); } else { if ($key != "id") { $sys_rs[$key] = $value; } } } elseif (in_array($key, $extlist)) { $ext_rs[$key] = $value; } elseif (in_array($key, $clist)) { $c_rs[$key] = $value; } } if (!$sys_rs["post_date"]) { $sys_rs["post_date"] = $this->system_time; } if (!$sys_rs["ip"]) { $sys_rs["ip"] = sys_ip(); } if (!$sys_rs["author"]) { $sys_rs["author"] = $_SESSION["admin_name"]; $sys_rs["author_type"] = "admin"; } $insert_id = $this->list_m->save_sys($sys_rs); //存储数据 if ($insert_id) { //存储到分类中去 if ($rs["cate_id"]) { $ext_catelist = sys_id_list($rs["cate_id"], "intval"); $this->list_m->save_catelist($insert_id, $ext_catelist); } //存储扩展字段 foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value; //扩展字段信息 $array_ext["val"] = $ext_rs[$value]; $this->list_m->save_ext($array_ext, "ext"); } // foreach ($clist as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value; //扩展字段信息 $array_ext["val"] = $c_rs[$value]; $this->list_m->save_ext($array_ext, "c"); } } return $insert_id; }
function sys_id_string($id, $implode_code = ",", $type = "strval") { if (!in_array($type, array("strval", "intval", "floatval"))) { $type = "strval"; } $id = sys_id_list($id, $type, $implode_code); if ($id) { return implode($implode_code, $id); } else { return false; } }
function setting() { $this->type_video = array("wma", "mp3", "wmv", "asf", "mpg", "mpeg", "avi", "asx", "rm", "rmvb", "ram", "ra", "swf", "flv", "dat"); $this->type_img = array("jpg", "gif", "png", "jpeg"); $this->type_file = array("zip", "rar", "txt", "tgz", "tar", "gz", "pdf"); $this->file_save_type = "Ym/d"; if (file_exists(ROOT_DATA . "attachment.php")) { include ROOT_DATA . "attachment.php"; if ($_sys["picture_type"]) { $this->type_img = sys_id_list($_sys["picture_type"]); } if ($_sys["video_type"]) { $this->type_video = sys_id_list($_sys["video_type"]); } if ($_sys["file_type"]) { $this->type_file = sys_id_list($_sys["file_type"]); } $this->file_save_type = $_sys["file_save_type"]; //重设存储目录 $this->file_uptype = $_sys["file_uptype"]; } $this->file_ext = array_merge($this->type_video, $this->type_img, $this->type_file); $this->ifset = true; }
function ajax_del_f() { $id = $this->trans_lib->safe("id"); if (!$id) { exit("error: 没有指定ID"); } $idlist = sys_id_list($id); if (!$idlist) { exit("error: 没有指定ID"); } sys_popedom("order:delete", "ajax"); foreach ($idlist as $key => $value) { $this->order_m->del($value); } exit("ok"); }
function set_f() { $order_list["post_date:desc"] = "最新发布排前"; $order_list["post_date:asc"] = "最新发布排后"; $order_list["modify_date:desc"] = "最新修改排前"; $order_list["modify_date:asc"] = "最新修改排后"; $order_list["replydate:desc"] = "最新回复排前"; $order_list["replydate:asc"] = "最新回复排后"; $order_list["hits:desc"] = "热门主题排前"; $order_list["hits:asc"] = "冷门主题排前"; $this->tpl->assign("order_list", $order_list); $id = $this->trans_lib->int("id"); $tmp_popedom = $id ? $this->module_sign . ":modify" : $this->module_sign . ":add"; sys_popedom($tmp_popedom, "tpl"); //判断是否有相应的权限 unset($tmp_popedom); $cateid = $this->trans_lib->int("cateid"); if ($cateid) { $p_rs = $this->cate_m->get_one($cateid); $mid = $p_rs["module_id"]; } else { $mid = $this->trans_lib->int("mid"); } if (!$id && !$mid) { //取得模块列表 $modulelist = $this->module_m->module_list(); $this->tpl->assign("modulelist", $modulelist); $this->tpl->display("cate/set_module.html"); exit; } if ($id) { $rs = $this->cate_m->get_one($id); $rs["note"] = $this->trans_lib->html_fck($rs["note"]); $this->tpl->assign("rs", $rs); $mid = $rs["module_id"]; $cateid = $rs["parentid"]; //父分类ID //如果有扩展字段 if ($rs["fields"]) { $extlist = sys_id_list($rs["fields"]); $this->tpl->assign("extlist", $extlist); } } $this->tpl->assign("mid", $mid); //取得模块下的分类 $this->cate_m->langid($_SESSION["sys_lang_id"]); $this->cate_m->get_catelist($mid); if (!$id) { $cate_html = $this->cate_m->html_select("cateid", $cateid, "设为根分类"); } else { if ($rs["parentid"]) { $cate_html = $this->cate_m->html_select("cateid", $cateid, "", $cateid); } else { $cate_html = "<select name='cateid' id='cateid'><option value='0'>根分类不允许修改</option></select>"; } } $this->tpl->assign("cate_html", $cate_html); //读取模块信息 $m_rs = $this->module_m->get_one($mid); $this->tpl->assign("m_rs", $m_rs); //关联图片类型 $this->load_model("gdtype"); $gdlist = $this->gdtype_m->get_all(); $this->tpl->assign("gdlist", $gdlist); //取得模块中的扩展字段 $keylist = $this->module_m->fields_index($mid); $this->tpl->assign("keylist", $keylist); $this->tpl->display("cate/set.html"); }
function sys_user_popedom($chktype = "read") { $app = sys_init(); $app->load_model("usergroup"); if ($_SESSION["user_id"]) { $rs = $_SESSION["group_id"] ? $app->usergroup_m->get_one($_SESSION["group_id"]) : $app->usergroup_m->get_default(); if (!$rs) { return false; } } else { $rs = $app->usergroup_m->get_guest(); if (!$rs) { return false; } } //格式化权限 $popedom = ""; if ($chktype == "read") { $popedom = $rs["popedom_read"]; } if ($chktype == "post") { $popedom = $rs["popedom_post"]; } if ($chktype == "reply") { $popedom = $rs["popedom_reply"]; } if (!$popedom) { return false; } if ($popedom == "all") { return $popedom; } //格式化权限 $array = $m = $c = array(); $popedom = sys_id_list($popedom); foreach ($popedom as $key => $value) { $tmp = explode(":", $value); if ($tmp[0] == "m") { $m[] = $tmp[1]; } else { $c[] = $tmp[1]; } } unset($popedom); if ((!$m || count($m) < 1) && (!$c || count($c) < 1)) { return false; } $popedom = array(); $popedom["module"] = $m ? $m : false; $popedom["category"] = $c ? $c : false; return $popedom; }
function pl_status_f() { sys_popedom("reply:check", "ajax"); $id = $this->trans_lib->safe("id"); $status = $this->trans_lib->int("status"); $this->reply_m->status($id, $status); //批量更新星星数 $idlist = sys_id_list($id, "intval"); if ($idlist) { foreach ($idlist as $key => $value) { $rs = $this->reply_m->get_one($value); if ($rs) { $this->reply_m->update_star($rs["tid"]); } } } exit("ok"); }