function load_tenpay() { $sn = $this->trans_lib->safe("sn"); $paycode = "tenpay"; $pass = $this->trans_lib->safe("pass"); $rs = $this->payment_m->get_one_code($paycode); if (!$rs) { error($this->lang["alipay_not_rs"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"user_id"]) { if (!$pass || $pass != $order_rs["pass"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } else { if ($_SESSION["user_id"] != $order_rs["uid"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } $this->tpl->assign("order_rs", $order_rs); if ($order_rs["pay_status"]) { error($this->lang["alipay_paystatus_ok"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"price"] < 0.001) { error($this->lang["alipay_free"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"id"]); //判断是否是客 $tenpay_url = substr($this->url("tenpay", "", "&"), 0, -1); $return_url = $this->sys_config["siteurl"] . $tenpay_url; $tenpay = new tenpay_payment($f_rs, $return_url); $tenpay->order_rs($order_rs, $pass); //定单信息 $tenpay->ip(sys_ip()); $htmlbutton = $tenpay->create_button(); //创建按钮 $this->tpl->assign("htmlbutton", $htmlbutton); $this->tpl->display("payment/tenpay." . $this->tpl->ext); }
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 setok_f() { $id = $this->trans_lib->int("id"); if (!$id) { $module_id = $this->trans_lib->int("module_id"); if (!$module_id) { error("对不起,您的操作错误,没有指定应用模块"); } sys_popedom($module_id . ":add", "tpl"); } else { $rs = $this->list_m->get_one($id); $module_id = $rs["module_id"]; sys_popedom($module_id . ":modify", "tpl"); } //获取核心数据 $array_sys = array(); if (!$id) { $array_sys["module_id"] = $module_id; } $array_sys["cate_id"] = $this->trans_lib->int("cate_id"); $cateid = $array_sys["cate_id"]; $array_sys["yongjin"] = $this->trans_lib->safe("yongjin"); $array_sys["jili"] = $this->trans_lib->safe("jili"); $array_sys["title"] = $this->trans_lib->safe("subject"); $array_sys["style"] = $this->trans_lib->safe("style"); $array_sys["hidden"] = $this->trans_lib->int("hidden"); $array_sys["link_url"] = $this->trans_lib->safe("link_url"); $array_sys["target"] = $this->trans_lib->int("target"); $array_sys["author"] = $this->trans_lib->safe("author"); $array_sys["author_type"] = $this->trans_lib->safe("author_type"); $array_sys["ip"] = $this->trans_lib->safe("ip"); if (!$array_sys["ip"]) { $array_sys["ip"] = sys_ip(); } $array_sys["keywords"] = $this->trans_lib->safe("keywords"); $array_sys["description"] = $this->trans_lib->safe("description"); $array_sys["note"] = $this->trans_lib->safe("note"); $array_sys["identifier"] = $this->trans_lib->safe("identifier"); $array_sys["tplfile"] = $this->trans_lib->safe("tplfile"); //内容模板 $array_sys["hits"] = $this->trans_lib->int("hits"); $array_sys["good_hits"] = $this->trans_lib->int("good_hits"); $array_sys["bad_hits"] = $this->trans_lib->int("bad_hits"); $post_date = $this->trans_lib->safe("post_date"); $array_sys["post_date"] = $post_date ? strtotime($post_date) : $this->system_time; if ($id) { //最后更改时间 $array_sys["modify_date"] = $this->system_time; } $array_sys["thumb_id"] = $this->trans_lib->int("thumb_id"); $array_sys["istop"] = isset($_POST["istop"]) ? 1 : 0; $array_sys["isvouch"] = isset($_POST["isvouch"]) ? 1 : 0; $array_sys["isbest"] = isset($_POST["isbest"]) ? 1 : 0; $array_sys["points"] = $this->trans_lib->int("points"); if (!$id) { $array_sys["langid"] = $this->langid; } $array_sys["taxis"] = $this->trans_lib->int("taxis"); $array_sys["htmltype"] = $this->trans_lib->safe("htmltype"); //静态页存储方式 $array_sys["subtitle"] = $this->trans_lib->safe("subtitle"); //副主题 $insert_id = $this->list_m->save_sys($array_sys, $id); //存储数据 if (!$insert_id) { error("数据存储失败,请检查", site_url("list,set", "id=" . $id)); } unset($array_sys); //注销存储信息 //[读取核心模块配置信息] $m_rs = $this->module_m->get_one($module_id); if ($m_rs) { //判断是否 $extlist = $this->_load_ext_fields($module_id); if (!$extlist) { $extlist = array(); } foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $format_type = $value["if_html"] ? "html" : "safe"; if ($value["if_js"] && $format_type == "html") { $this->trans_lib->setting(true, true, true); } $val = $this->trans_lib->{$format_type}($value["identifier"]); if ($value["if_js"] && $format_type == "html") { $this->trans_lib->setting(false, false, false); } if (is_array($val)) { $val = implode(",", $val); } $array_ext["val"] = $val; $this->list_m->save_ext($array_ext, $value["tbl"]); } } //提示添加成功,进入跳转 if (!$id) { $_go_action = $this->trans_lib->safe("_go_back_action"); if ($_go_action == "list") { $go_url = $this->url("list", "module_id=" . $module_id . "&cate_id=" . $cateid); } else { $go_url = $this->url("list,set", "module_id=" . $module_id . "&cateid=" . $cateid); } } else { $go_url = $this->url("list", "module_id=" . $module_id . "&cate_id=" . $cateid); } error("数据存储成功,请稍候……", $this->url("list", $go_url)); }
function save_f() { $id = $this->trans_lib->int("id"); if (!$id) { error($this->lang["error_not_id"], site_url()); } $rs = $this->msg_m->get_one($id); if (!$rs || !$rs["status"]) { error($this->lang["error_not_rs"], site_url()); } $username = $this->trans_lib->safe("username"); if (!$username) { $username = $this->lang["guest"]; } $pass = $this->trans_lib->safe("password"); //如果非会员,尝试登录 $array = array(); $array["tid"] = $id; $array["userid"] = 0; if (!$_SESSION["user_id"] && $pass) { //判断并模拟登录 $this->load_model("user"); $u_rs = $this->user_m->user_from_name($username); if ($u_rs && $u_rs["pass"] == sys_md5($pass)) { //执行会员登录 $_SESSION["user_id"] = $u_rs["id"]; $array["userid"] = $u_rs["id"]; $_SESSION["user_name"] = $u_rs["name"]; $username = $u_rs["name"]; } unset($u_rs); } elseif ($_SESSION["user_id"]) { $array["userid"] = $_SESSION["user_id"]; $username = $_SESSION["user_name"]; } $array["username"] = $username; $array["ip"] = sys_ip(); $title = $this->trans_lib->safe("reply_subject"); if (!$title) { $title = "Re:" . $rs["subject"]; } $array["title"] = $title; $array["postdate"] = $this->system_time; $array["status"] = 0; //判断回复是否需要审核 if ($rs["cate_id"]) { //[读取分类配置信息] $this->load_model("cate"); $cate_rs = $this->cate_m->get_one($rs["cate_id"]); if ($cate_rs) { if (!$cate_rs["status"]) { error($this->lang["reply_lock"], site_url("msg", "id=" . $id)); } if (!$cate_rs["ifreply"]) { error($this->lang["reply_not"], site_url("msg", "id=" . $id)); } $array["status"] = $cate_rs["chk_reply"]; } } else { $this->load_model("module"); $module_rs = $this->module_m->get_one($rs["module_id"]); if ($module_rs) { if (!$module_rs["status"]) { error($this->lang["reply_lock"], site_url("msg", "id=" . $id)); } if (!$module_rs["ifreply"]) { error($this->lang["reply_not"], site_url("msg", "id=" . $id)); } $array["status"] = $module_rs["r_free_check"]; } } //判断是否 $array["content"] = $this->trans_lib->safe("reply_content"); $array["admreply"] = ""; //管理员回复,默认为空 $array["star"] = $this->trans_lib->int("star"); $this->reply_m->save($array); //存储评论信息 //更新主题的最后回复时间 $this->msg_m->update_replay_date($id, $this->system_time); //更新主题的星星点评 $this->reply_m->update_star($id); error($this->lang["save_success"], site_url("msg", "id=" . $id)); }
function setok_f() { //判断是否有使用验证码 if (function_exists("imagecreate") && defined("SYS_VCODE_USE") && SYS_VCODE_USE == true) { $chk = $this->trans_lib->safe("sys_check"); if (!$chk) { error($this->lang["login_vcode_empty"], $_SERVER["HTTP_REFERER"]); } $chk = md5($chk); if ($chk != $_SESSION[SYS_VCODE_VAR]) { error($this->lang["login_vcode_false"], $_SERVER["HTTP_REFERER"]); } unset($_SESSION[SYS_VCODE_VAR]); } $id = $this->trans_lib->int("id"); if (!$id) { $module_id = $this->trans_lib->int("module_id"); if (!$module_id) { error($this->lang["post_not_mid"], $this->url()); } } else { $rs = $this->post_m->get_one($id); $module_id = $rs["module_id"]; } $m_rs = $this->_load_moduel($module_id); //获取核心数据 $array_sys = array(); if (!$id) { $array_sys["module_id"] = $module_id; } $array_sys["cate_id"] = $this->trans_lib->int("cate_id"); $cateid = $array_sys["cate_id"]; $array_sys["title"] = $this->trans_lib->safe("subject"); $array_sys["author"] = $_SESSION["user_name"] ? $_SESSION["user_name"] : $this->lang["guest"]; $array_sys["author_type"] = $_SESSION["user_id"] ? "user" : "guest"; //发布人类型 $array_sys["ip"] = sys_ip(); //发布人IP $array_sys["post_date"] = $this->system_time; $array_sys["link_url"] = $this->trans_lib->safe("link_url"); if ($id) { $array_sys["post_date"] = $rs["post_date"]; $array_sys["modify_date"] = $this->system_time; } $array_sys["thumb_id"] = $this->trans_lib->int("thumb_id"); if (!$id) { $array_sys["langid"] = $_SESSION["sys_lang_id"]; } $array_sys["htmltype"] = "cateid"; $array_sys["status"] = 0; //如果有分类 if ($cateid) { //$condition = $_SESSION["user_id"] ? "c.ifuser='******'" : "c.ifguest='1'"; $cate_rs = $this->cate_m->get_one($cateid, $condition); if (!$cate_rs) { error($this->lang["post_cate_error"], $this->url("post,set", "id=" . $id . "&module_id=" . $module_id)); } $tmp_check_status = $_SESSION["user_id"] ? "chk_user" : "chk_guest"; $array_sys["status"] = $cate_rs[$tmp_check_status]; } else { $tmp_check_status = $_SESSION["user_id"] ? "u_free_check" : "g_free_check"; $array_sys["status"] = $m_rs[$tmp_check_status]; } $array_sys["price"] = $this->trans_lib->float("price"); //价格 $array_sys["price_currency"] = $this->trans_lib->safe("price_currency"); //货币符号 $array_sys["weight"] = $this->trans_lib->float("weight"); //重量,系统使用Kg来计 $array_sys["qty"] = $this->trans_lib->int("qty"); //产品数量 $array_sys["is_qty"] = $this->trans_lib->int("is_qty"); //是否启用产品数量统计 $array_sys["qty_unit"] = $this->trans_lib->safe("qty_unit"); //产品数量 $insert_id = $this->post_m->save_sys($array_sys, $id); //存储数据 if (!$insert_id) { error($this->lang["error_save"], site_url("post,set", "id=" . $id . "&module_id=" . $module_id)); } unset($array_sys); //注销存储信息 //判断是否 $extlist = $this->module_m->fields_index($module_id); foreach ($extlist ? $extlist : array() as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $format_type = $value["if_html"] ? "html" : "safe"; $val = $this->trans_lib->{$format_type}($value["identifier"]); //如果插入的数据是时间表单 if ($value["input"] == "time" && $val) { $val = strtotime($val); } if (is_array($val)) { $val = implode(",", $val); } $array_ext["val"] = $val; $this->post_m->save_ext($array_ext, $value["tbl"]); } $goback = $this->trans_lib->safe("_to_url"); if (!$goback) { if ($_SESSION["user_id"]) { $goback = site_url("post,list", "module_id=" . $module_id . "&cate_id=" . $cateid); } else { $goback = $_SERVER["HTTP_REFERER"] ? $_SERVER["HTTP_REFERER"] : $this->url(); } } //判断是否有邮件通知管理员 if ($m_rs["if_email"]) { $this->load_lib("email"); $this->email_lib->module_mail($insert_id); //通知客户订单信息 } error($this->lang["save_success"], $goback); }
function setok_f() { load_plugin("list:setok:prev"); $id = $this->trans_lib->int("id"); if (!$id) { $module_id = $this->trans_lib->int("module_id"); if (!$module_id) { error("对不起,您的操作错误,没有指定应用模块"); } sys_popedom($module_id . ":add", "tpl"); } else { $rs = $this->list_m->get_one($id); $module_id = $rs["module_id"]; sys_popedom($module_id . ":modify", "tpl"); } $m_rs = $this->module_m->get_one($module_id); //获取核心数据 $array_sys = array(); if (!$id) { $array_sys["module_id"] = $module_id; } $array_sys["cate_id"] = $this->trans_lib->int("cate_id"); $cateid = $array_sys["cate_id"]; $array_sys["title"] = $this->trans_lib->safe("subject"); $array_sys["s_rg"] = $this->trans_lib->safe("s_rg"); $array_sys["s_qx"] = $this->trans_lib->safe("s_qx"); $array_sys["s_ns"] = $this->trans_lib->safe("s_ns"); $array_sys["rg"] = $this->trans_lib->safe("rg"); $array_sys["qx"] = $this->trans_lib->safe("qx"); $array_sys["ns"] = $this->trans_lib->safe("ns"); $array_sys["hy"] = $this->trans_lib->safe("hy"); $array_sys["style"] = $this->trans_lib->safe("style"); $array_sys["hidden"] = $this->trans_lib->int("hidden"); $array_sys["link_url"] = $this->trans_lib->safe("link_url"); $array_sys["target"] = $this->trans_lib->int("target"); $array_sys["author"] = $this->trans_lib->safe("author"); $array_sys["author_type"] = $this->trans_lib->safe("author_type"); $array_sys["ip"] = $this->trans_lib->safe("ip"); if (!$array_sys["ip"]) { $array_sys["ip"] = sys_ip(); } $array_sys["seotitle"] = $this->trans_lib->safe("seotitle"); $array_sys["keywords"] = $this->trans_lib->safe("keywords"); $array_sys["description"] = $this->trans_lib->safe("description"); $array_sys["note"] = $this->trans_lib->html("note"); //锁定标识串 if (!$id || $id && !$m_rs["lock_identifier"]) { $array_sys["identifier"] = $this->trans_lib->safe("identifier"); } $array_sys["tplfile"] = $this->trans_lib->safe("tplfile"); //内容模板 $array_sys["hits"] = $this->trans_lib->int("hits"); $array_sys["good_hits"] = $this->trans_lib->int("good_hits"); $array_sys["bad_hits"] = $this->trans_lib->int("bad_hits"); $post_date = $this->trans_lib->safe("post_date"); $array_sys["post_date"] = $post_date ? strtotime($post_date) : $this->system_time; if ($id) { //最后更改时间 $array_sys["modify_date"] = $this->system_time; } $array_sys["thumb_id"] = $this->trans_lib->int("thumb_id"); $array_sys["istop"] = isset($_POST["istop"]) ? 1 : 0; $array_sys["isvouch"] = isset($_POST["isvouch"]) ? 1 : 0; $array_sys["isbest"] = isset($_POST["isbest"]) ? 1 : 0; $array_sys["points"] = $this->trans_lib->int("points"); if (!$id) { $array_sys["langid"] = $this->langid; } $array_sys["taxis"] = $this->trans_lib->int("taxis"); $array_sys["htmltype"] = $this->trans_lib->safe("htmltype"); //静态页存储方式 if ($this->trans_lib->safe("hy") == false) { $array_sys["subtitle"] = $this->trans_lib->safe("subtitle"); //副主题 } else { $STR_2 = explode(",", $this->trans_lib->safe("hy")); $array_sys["subtitle"] = $STR_2[1]; $array_sys["s_ns"] = $STR_2[0]; } //针对电子商务里的核心字段 $array_sys["price"] = $this->trans_lib->float("price"); //价格 $array_sys["price_currency"] = $this->trans_lib->safe("price_currency"); //货币符号 $array_sys["weight"] = $this->trans_lib->float("weight"); //重量,系统使用Kg来计 $array_sys["qty"] = $this->trans_lib->int("qty"); //产品数量 $array_sys["is_qty"] = $this->trans_lib->checkbox("is_qty"); //是否启用产品数量统计 $array_sys["qty_unit"] = $this->trans_lib->safe("qty_unit"); //数量单位 $insert_id = $this->list_m->save_sys($array_sys, $id); //存储数据 if (!$insert_id) { error("数据存储失败,请检查", site_url("list,set", "id=" . $id)); } //存储扩展分类 $cate_string = $this->trans_lib->safe("cate_string"); $cate_string = $cate_string ? $cate_string . "," . $cateid : $cateid; if ($cate_string) { $ext_catelist = sys_id_list($cate_string, "intval"); $this->list_m->save_catelist($insert_id, $ext_catelist); } unset($array_sys); //注销存储信息 //[读取核心模块配置信息] load_plugin("module:" . $m_rs["identifier"] . ":setok:prev", $id ? $id : $m_rs); //执行模块前的操作 if ($m_rs) { //判断是否 $extlist = $this->_load_ext_fields($module_id); if (!$extlist) { $extlist = array(); } foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $format_type = $value["if_html"] ? "html" : "safe"; if ($value["if_js"] && $format_type == "html") { $this->trans_lib->setting(true, true, true); } $val = $this->trans_lib->{$format_type}($value["identifier"]); //如果插入的数据是时间表单 if ($value["input"] == "time" && $val) { $val = strtotime($val); } if ($value["if_js"] && $format_type == "html") { $this->trans_lib->setting(false, false, false); } if (is_array($val)) { $val = implode(",", $val); } $array_ext["val"] = $val; $this->list_m->save_ext($array_ext, $value["tbl"]); } } //提示添加成功,进入跳转 $go_url = $this->url("list", "module_id=" . $module_id . "&cate_id=" . $cateid); load_plugin("module:" . $m_rs["identifier"] . ":setok:next", $id ? $id : $insert_id); //执行模块前的操作 load_plugin("list:setok:next", $id ? $id : $insert_id); //执行模块前的操作 //判断是否接入地方 $_hotid = $this->trans_lib->int("_hotid"); if ($_hotid) { $this->load_model("hotlink"); $hot_rs = $this->hotlink_m->get_one($_hotid); $hot_rs["linkurl"] = str_replace("{admin}", HOME_PAGE, $hot_rs["linkurl"]); $hot_rs["linkurl"] = str_replace("{c}", $this->config->c, $hot_rs["linkurl"]); $hot_rs["linkurl"] = str_replace("{f}", $this->config->f, $hot_rs["linkurl"]); $hot_rs["linkurl"] = str_replace("{d}", $this->config->d, $hot_rs["linkurl"]); $go_url = $hot_rs["linkurl"]; $go_url .= "&_hotid=" . $_hotid . "&"; } error("数据存储成功,请稍候……", $this->url("list", $go_url)); }
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; }