function get_list($pageid = 0, $keywords = "") { $offset = $pageid > 0 ? ($pageid - 1) * $this->psize : 0; $sql = " SELECT * FROM " . $this->db->prefix . "user WHERE 1=1 "; if ($keywords) { $sql .= " AND (email LIKE '%" . $keywords . "%' OR name LIKE '%" . $keywords . "%') "; } $sql .= " ORDER BY id DESC LIMIT " . $offset . "," . $this->psize; $rslist = $this->db->get_all($sql, "id"); if (!$rslist) { return false; } $idstring = sys_id_string(array_keys($rslist)); $sql = "SELECT * FROM " . $this->db->prefix . "user_ext WHERE id IN(" . $idstring . ")"; $tmplist = $this->db->get_all($sql); if (!$tmplist) { $tmplist = array(); } foreach ($tmplist as $key => $value) { $rslist[$value["id"]][$value["field"]] = $value["val"]; } unset($tmplist); $tmplist = array(); foreach ($rslist as $key => $value) { $tmplist[] = $value; } return $tmplist; }
function ajax_module_f() { $id = $this->trans_lib->safe("id"); if (!$id) { exit("error"); } $id = sys_id_string($id, ",", "intval"); //取得主题列表 $rslist = $this->list_m->get_list_from_id($id, "id,title"); if (!$rslist) { exit("error"); } exit($this->json_lib->encode($rslist)); }
function setok_f() { $id = $this->trans_lib->int("id"); $id ? sys_popedom("usergroup:modify", "tpl") : sys_popedom("usergroup:add", "tpl"); $title = $this->trans_lib->safe("title"); if (!$title) { error("组名称不允许为空!", $this->url("usergroup,set", "id=" . $id)); } $popedom_post = $this->trans_lib->safe("popedom_post"); $popedom_reply = $this->trans_lib->safe("popedom_reply"); $popedom_read = $this->trans_lib->safe("popedom_read"); if (!$popedom_post) { $popedom_post = array(); } if (!$popedom_reply) { $popedom_reply = array(); } if (!$popedom_read) { $popedom_read = array(); } if (in_array("all", $popedom_read)) { $p_read = "all"; } else { $p_read = sys_id_string($popedom_read); } $p_post = sys_id_string($popedom_post); $p_reply = sys_id_string($popedom_reply); $post_cert = $this->trans_lib->checkbox("post_cert"); $reply_cert = $this->trans_lib->checkbox("reply_cert"); $array = array(); $array["title"] = $title; $array["popedom_post"] = $p_post; $array["popedom_reply"] = $p_reply; $array["popedom_read"] = $p_read; $array["post_cert"] = $post_cert; $array["reply_cert"] = $reply_cert; $array["ifshow"] = $this->trans_lib->checkbox("ifshow"); //是否在前台显示 if (!$id) { $array["group_type"] = "user"; $array["ifsystem"] = 0; $array["ifdefault"] = 0; } $this->usergroup_m->save($array, $id); error("会员组信息添加/存储成功", $this->url("usergroup")); }
function format_subject($val) { $val = sys_id_string($val, ",", "intval"); if (!$val) { return false; } $app = sys_init(); $sql = "SELECT l.*,c.cate_name,u.filename picture FROM " . $this->db->prefix . "list l LEFT JOIN " . $this->db->prefix . "cate c ON(l.cate_id = c.id) "; $sql .= " LEFT JOIN " . $this->db->prefix . "upfiles u ON (l.thumb_id=u.id) "; $sql .= " WHERE l.id IN(" . $val . ")"; $rslist = $this->db->get_all($sql, "id"); if (!$rslist) { return false; } $sql = "SELECT * FROM " . $this->db->prefix . "list_ext WHERE id IN(" . $val . ")"; $tmplist = $this->db->get_all($sql); if (!$tmplist) { $tmplist = array(); } foreach ($tmplist as $key => $value) { $rslist[$value["id"]][$value["field"]] = $value["val"]; } unset($tmplist); $sql = "SELECT * FROM " . $this->db->prefix . "list_c WHERE id IN(" . $val . ")"; $tmp_rs = $this->db->get_all($sql); if (!$tmp_rs) { $tmp_rs = array(); } foreach ($tmp_rs as $key => $value) { $rslist[$value["id"]][$value["field"]] = $value["val"]; } unset($tmp_rs); $list = array(); foreach ($rslist as $key => $value) { $list[] = $value; } unset($rslist); return $list; }
function setok_f() { $id = $this->trans_lib->int("id"); $array = array(); $array["cate_name"] = $this->trans_lib->safe("cate_name"); $array["identifier"] = $this->trans_lib->safe("identifier"); $tmp_popedom = $id ? $this->module_sign . ":modify" : $this->module_sign . ":add"; sys_popedom($tmp_popedom, "tpl"); //判断是否有相应的权限 unset($tmp_popedom); $parentid = $this->trans_lib->int("cateid"); if (!$id) { $mid = $this->trans_lib->int("mid"); if (!$mid) { error("没有指到模块ID!", $this->url("cate,set")); } $array["module_id"] = $mid; $array["langid"] = $_SESSION["sys_lang_id"]; $array["parentid"] = $parentid; } $array["tpl_index"] = $this->trans_lib->safe("tpl_index"); $array["tpl_list"] = $this->trans_lib->safe("tpl_list"); $array["tpl_file"] = $this->trans_lib->safe("tpl_file"); $array["if_index"] = isset($_POST["if_index"]) ? 1 : 0; $array["status"] = isset($_POST["status"]) ? 1 : 0; $array["taxis"] = $this->trans_lib->int("taxis"); $array["if_hidden"] = $this->trans_lib->int("if_hidden"); $array["keywords"] = $this->trans_lib->safe("keywords"); $array["description"] = $this->trans_lib->safe("description"); $array["note"] = $this->trans_lib->html("note"); $array["ifspec"] = $this->trans_lib->safe("ifspec"); //开启/关闭分类为单页 $array["inpic"] = $this->trans_lib->safe("inpic"); //读取默认图片 $array["psize"] = $this->trans_lib->int("psize"); if ($array["psize"] < 1) { $array["psize"] = 30; } $array["target"] = $this->trans_lib->int("target"); $array["linkurl"] = $this->trans_lib->safe("linkurl"); $array["ordertype"] = $this->trans_lib->safe("ordertype"); $array["subcate"] = $this->trans_lib->safe("subcate"); $array["ico"] = $this->trans_lib->safe("ico"); //图标 $array["small_pic"] = $this->trans_lib->safe("small_pic"); //小图 $array["medium_pic"] = $this->trans_lib->safe("medium_pic"); //中图 $array["big_pic"] = $this->trans_lib->safe("big_pic"); //大图 //$array["taxis_asc"] = $this->trans_lib->checkbox("taxis_asc");//自定义排序从小排到大 //存储要显示的扩展字段 $extlist = $this->trans_lib->safe("extlist"); //echo "<pre>".print_r($extlist,true)."</pre>"; //exit; $array["fields"] = sys_id_string($extlist); //存储分类信息 $this->cate_m->save($array, $id); if (!$id) { error("分类信息添加成功!", $this->url("cate", "mid=" . $mid)); } else { //判断如果更改了父分类信息 $rs = $this->cate_m->get_one($id); if ($rs["parentid"] && $parentid && $rs["parentid"] != $parentid && $parentid != $id) { $update_array = array(); $update_array["parentid"] = $parentid; $this->cate_m->save($update_array, $id); } //更新下级分类下的字段配置 $next_fields_ok = $this->trans_lib->checkbox("next_fields_ok"); if ($next_fields_ok) { $this->cate_m->update_son_fields($array["fields"], $id); } error("分类信息更新操作成功", $this->url("cate", "mid=" . $rs["module_id"])); } }
function get_img_array($content, $var, $srclist) { if (!$srclist) { return false; } $newlist = array(); foreach ($srclist as $key => $value) { if ($value["tag"] == $var) { $newlist[] = $value; } } if (!$newlist || count($newlist) < 1) { return $content; } $newlist = $this->save_img($newlist); if (!$newlist || count($newlist) < 1 || !is_array($newlist)) { return $content; } $thumb_id = 0; $idlist = array(); foreach ($newlist as $key => $value) { if ($key < 1) { $thumb_id = $value["picid"]; } $idlist[] = $value["picid"]; } return array("thumb_id" => $thumb_id, $var => sys_id_string($idlist)); }
function setok_f() { $id = $this->trans_lib->int("id"); if ($id) { sys_popedom($this->module_sign . ":modify", "tpl"); } else { sys_popedom($this->module_sign . ":add", "tpl"); } $array = array(); $array["name"] = $this->trans_lib->safe("name"); $pass = $this->trans_lib->safe("pass"); if ($pass) { $array["pass"] = sys_md5($pass); } else { if (!$id) { $array["pass"] = sys_md5("123456"); } } $array["email"] = $this->trans_lib->safe("email"); //模板目录 $array["if_system"] = $this->trans_lib->int("if_system"); if (!$array["if_system"]) { $popedom = $this->trans_lib->safe("popedom"); $array["popedom"] = $popedom ? implode(",", $popedom) : ""; } else { $array["popedom"] = ""; } $mylangid = $this->trans_lib->safe("mylangid"); $array["langid"] = sys_id_string($mylangid); //存储分类信息 $this->admin_m->save($array, $id); error("管理员信息添加/存储成功", site_url("admin")); }
function highlight_f() { $htype = $this->trans_lib->safe("htype"); $hid = $this->trans_lib->safe("hid"); if ($htype != "module" && $htype != "cate" && $htype != "subject") { exit("hidden"); } if (!$hid) { exit("error"); } if ($htype == "module") { $this->load_model("module"); $rs = $this->module_m->get_one($hid); if (!$rs) { exit("empty"); } exit("模块:" . $rs["title"]); } elseif ($htype == "cate") { $this->load_model("cate"); $hid = sys_id_string($hid); $rslist = $this->cate_m->get_list_idstring($hid); if (!$rslist) { exit("empty"); } $msg = "分类:"; foreach ($rslist as $key => $value) { $msg .= " " . $value["cate_name"]; } exit($msg); } elseif ($htype == "subject") { $this->load_model("list"); $rs = $this->list_m->get_one($hid); if (!$rs) { exit("empty"); } exit("主题:" . $rs["title"]); } exit("hidden"); }
function setok_f() { $id = $this->trans_lib->int("id"); if ($id) { sys_popedom("user:modify", "tpl"); } else { sys_popedom("user:add", "tpl"); } load_plugin("user:setok:prev"); $array = array(); $array["name"] = $this->trans_lib->safe("name"); $pass = $this->trans_lib->safe("pass"); if ($pass) { $array["pass"] = sys_md5($pass); } else { if (!$id) { $array["pass"] = sys_md5("123456"); } } $array["email"] = $this->trans_lib->safe("email"); //模板目录 $regdate = $this->trans_lib->safe("regdate"); $array["regdate"] = $regdate ? strtotime($regdate) : $this->system_time; $array["thumb_id"] = $this->trans_lib->int("thumb_id"); //存储图像 $array["groupid"] = $this->trans_lib->int("groupid"); //存储会员组 //存储扩展表信息 $insert_id = $this->user_m->save($array, $id); $extlist = $this->usergroup_m->fields_index($array["groupid"], 1); if (!$extlist) { $extlist = array(); } $ext_array = array(); foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $insert_id; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $val = $this->trans_lib->safe($value["identifier"]); if ($value["input"] == "time" && $val) { $val = strtotime($val); } if (is_array($val)) { $val = sys_id_string(",", $val); } $array_ext["val"] = $val; $this->user_model->save_ext($array_ext); } //存储分类信息 load_plugin("user:setok:next"); error("会员信息添加/存储成功", site_url("user")); }
function create_msg_f() { $this->auto_load(); $typeid = $this->trans_lib->safe("typeid"); if (!$typeid) { $mid = $this->trans_lib->int("mid"); $cid = $this->trans_lib->int("cid"); } else { $array = explode(":", $typeid); $mid = $array[0]; $cid = $array[1]; } $r = array(); $r["mid"] = $mid; $r["cid"] = $cid; $tid = $this->trans_lib->int("tid"); //取得主题ID $sid = $this->trans_lib->int("sid"); $eid = $this->trans_lib->int("eid"); $cate_string = ""; if (!$sid || !$eid) { if ($cid) { //[读取当前分类下的子分类] $array = array($cid); $this->cate_m->get_sonid_array($array, $cid); $cate_string = sys_id_string($array); $max_min_rs = $this->list_m->max_min_id($cate_string, 0, $_SESSION["sys_lang_id"], 1); } else { $max_min_rs = $this->list_m->max_min_id("", $mid, $_SESSION["sys_lang_id"], 1); } if (!$sid) { $sid = $max_min_rs["min_id"]; } if (!$eid) { $eid = $max_min_rs["max_id"]; } } $r["sid"] = $sid; $r["eid"] = $eid; if (!$tid) { $tid = $sid; } $this->load_write_msg($tid); $rs = $this->list_m->get_one($tid); //如果当前主题ID已经超过最大ID if ($tid >= $eid) { $r["status"] = "ok"; $r["subject"] = "主题静态页生成成功!"; } else { //取得当前条件下的下一个主题 $nextid = $this->list_m->get_next_id($cate_string, $mid, $_SESSION["sys_lang_id"], $tid, 1); if ($nextid) { $r["tid"] = $nextid; $r["status"] = "next"; $r["subject"] = "主题静态页 <strong style='color:red;'>" . $rs["title"] . "</strong> 已经创建成功,正在创建下一主题!"; } else { $r["status"] = "ok"; $r["subject"] = "主题信息创建完毕!"; } } exit($this->json_lib->encode($r)); }
function info_f() { if (!$_SESSION["user_id"]) { error($this->lang["user_not_login"], site_url("login")); } load_plugin("usercp:info:prev"); $array = array(); $array["email"] = $this->trans_lib->safe("email"); $array["rname"] = $this->trans_lib->safe("rname"); if (!$array["email"]) { error($this->lang["empty_email"], site_url("usercp,my")); } $array["thumb_id"] = $this->trans_lib->int("thumb_id"); $this->user_m->update_info($array, $_SESSION["user_id"]); //更新扩展信息 $extlist = $this->usergroup_m->fields_index($_SESSION["group_id"], 1); if (!$extlist) { $extlist = array(); } $ext_array = array(); foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $_SESSION["user_id"]; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $val = $this->trans_lib->safe($value["identifier"]); if ($value["input"] == "time" && $val) { $val = strtotime($val); } if (is_array($val)) { $val = sys_id_string(",", $val); } $array_ext["val"] = $val; $this->user_model->save_ext($array_ext); } $rs = $this->user_m->user_from_id($_SESSION["user_id"]); $_SESSION["user_rs"] = $rs; load_plugin("usercp:info:next"); error($this->lang["usercp_save_success"], site_url("usercp,my")); }
function setok_f() { $id = $this->trans_lib->int("id"); $array = array(); $array["title"] = $this->trans_lib->safe("title"); //模块名 if (!$array["title"]) { error("标题不允许为空", site_url("ctrl,set", "id=" . $id)); } $array["group_id"] = $this->trans_lib->int("group_id"); //组ID $array["note"] = $this->trans_lib->safe("note"); //备注 if (!$id) { sys_popedom($this->module_sign . ":add", "tpl"); //在添加操作时核心参数的配置 //判断标识符是否使用了 $array["langid"] = $_SESSION["sys_lang_id"]; //读取ID $array["identifier"] = $this->trans_lib->safe("identifier"); //标识签,必须是唯一的 if (!$array["identifier"]) { error("标识串不允许为空", site_url("ctrl,set", "id=" . $id)); } $chk_msg = $this->chk_identifier_f($array["identifier"]); if (!$chk_msg) { error("标识符不符合系统要求", site_url("ctrl,set", "id=" . $id)); } //分析控制层是否符合系统要求 $array["ctrl_init"] = $this->trans_lib->safe("ctrl_init"); if (!$array["ctrl_init"]) { $array["ctrl_init"] = $this->trans_lib->safe("ctrl_init_val"); } if (!$array["ctrl_init"]) { error("控制层配置为空,请检查", site_url("ctrl,set")); } if (!ereg("[a-z][a-z0-9\\_]+", $array["ctrl_init"])) { error("控制层仅限字母,数字及下划线且要求必须是字母开头", site_url("ctrl,set")); } if (!file_exists(APP . "control/" . $array["ctrl_init"] . ".php")) { error("没有找到控制层文件:(", site_url("ctrl,set")); } } else { sys_popedom($this->module_sign . ":modify", "tpl"); $rs = $this->module_m->get_one($id); $array["ctrl_init"] = $rs["ctrl_init"]; } $array["taxis"] = $this->trans_lib->int("taxis"); //排序 if ($array["ctrl_init"] == "list") { $array["if_cate"] = $this->trans_lib->int("if_cate"); //是否分类支持 $array["if_point"] = $this->trans_lib->int("if_point"); //点数 $array["if_thumb"] = $array["if_thumb_m"] = 0; $if_thumb = $this->trans_lib->int("if_thumb"); if ($if_thumb) { $array["if_thumb"] = 1; $array["if_thumb_m"] = $if_thumb == 2 ? 1 : 0; } $array["inpic"] = $this->trans_lib->safe("inpic"); //读取默认图片 $array["if_propety"] = $this->trans_lib->int("if_propety"); $array["if_biz"] = $this->trans_lib->int("if_biz"); //是否支持电子商务 $array["if_url_m"] = $this->trans_lib->int("if_url_m"); //第三方链接地址是否必填 $array["insearch"] = $this->trans_lib->int("insearch"); $array["if_content"] = $this->trans_lib->checkbox("if_content"); //列表读内容 $array["if_email"] = $this->trans_lib->int("if_email"); //邮件通知 $array["psize"] = $this->trans_lib->int("psize"); //默认分页数量 $array["if_subtitle"] = $this->trans_lib->int("if_subtitle"); //是否启用副标题功能 $array["tplset"] = $this->trans_lib->safe("tplset"); //设定展示格式 $array["title_nickname"] = $this->trans_lib->safe("title_nickname"); $array["subtitle_nickname"] = $this->trans_lib->safe("subtitle_nickname"); $array["sign_nickname"] = $this->trans_lib->safe("sign_nickname"); $array["if_sign_m"] = $this->trans_lib->int("if_sign_m"); //标识串是否必填 $array["if_ext"] = $this->trans_lib->int("if_ext"); $array["if_des"] = $this->trans_lib->int("if_des"); $array["if_list"] = $this->trans_lib->int("if_list"); $array["if_msg"] = $this->trans_lib->int("if_msg"); $layout = $this->trans_lib->safe("layout"); $array["layout"] = sys_id_string($layout); } else { $array["layout"] = ""; } $array["ico"] = $this->trans_lib->safe("ico"); //图标 $array["small_pic"] = $this->trans_lib->safe("small_pic"); //小图 $array["medium_pic"] = $this->trans_lib->safe("medium_pic"); //中图 $array["big_pic"] = $this->trans_lib->safe("big_pic"); //大图 //更新时间:2011-07-20 20:36 $array["if_hidden"] = $this->trans_lib->checkbox("if_hidden"); //隐藏不在导航中体现 $array["lock_identifier"] = $this->trans_lib->checkbox("lock_identifier"); //隐藏不在导航中体现 //读取权限配置信息 $popedom = $this->trans_lib->safe("popedom"); $array["popedom"] = $popedom ? implode(",", $popedom) : ""; //收集权限 $this->module_m->save($array, $id); Error("模块信息配置成功", site_url("ctrl")); }
function index_cate($cid) { $rs = $this->cate_m->get_one($cid); $this->phpok_seo($rs); $pageurl = list_url($rs, 0, true, false); // $module_rs = $this->module_m->get_one($rs["module_id"]); $this->tpl->assign("mid", $rs["module_id"]); $this->tpl->assign("cid", $cid); $this->tpl->assign("m_rs", $module_rs); $this->tpl->assign("cateid", $cid); //分类ID //指定模板文件 if ($rs["if_index"]) { $this->tplfile = $rs["tpl_index"] ? $rs["tpl_index"] : "index_" . $module_rs["identifier"]; //判断封页面 $create_html_type = "index"; } else { $this->tplfile = $rs["tpl_list"] ? $rs["tpl_list"] : "list_" . $module_rs["identifier"]; $create_html_type = "list"; } //分类未启用 if (!$rs["status"]) { sys_header(HOME_PAGE); } //分类下的模块未启用 if (!$module_rs["status"]) { sys_header(HOME_PAGE); } $rs["note"] = sys_format_content($rs["note"]); $this->tpl->assign("rs", $rs); //导航信息 $this->load_cate_msg($rs); //通过递归获取子分类ID $array = array($cid); $this->cate_m->get_sonid_array($array, $cid); //判断权限 $popedom = sys_user_popedom("read"); //获取阅读权限 if (!$popedom || !$popedom["category"]) { error($this->lang["not_popedom"], site_url("usercp")); } if ($popedom != "all") { $array = array_intersect($array, $popedom["category"]); if (!$array || count($array) < 1) { error($this->lang["not_popedom"], site_url("usercp")); } } $idstring = sys_id_string($array); if (!$idstring) { error($this->lang["not_popedom"], site_url("usercp")); } $this->idstring = $idstring; //如果存在分类至主题 if (!$module_rs["if_list"] && $module_rs["if_msg"]) { //读取当前第一个主题 $rslist = $this->cate_m->get_cate2sub($idstring, $rs["ordertype"]); $header_url = msg_url($rslist); sys_header($header_url); } //判断是否启用单页面信息 if ($rs["ifspec"]) { $newtpl = $rs["tpl_file"] ? $rs["tpl_file"] : "msg_" . $module_rs["identifier"] . "_spec"; $this->tpl->display($newtpl . "." . $this->tpl->ext); exit; } //如果启用封面页功能,将停止下一步操作的执行 if ($rs["if_index"]) { $this->tpl->display($this->tplfile . "." . $this->tpl->ext); } else { //读取列表数据 $this->list_m->set_cate($rs); $this->list_m->set_idstring($idstring); $this->list_m->set_module($module_rs); $total = $this->list_m->get_count_from_cate(); //取得总数量 $this->tpl->assign("total", $total); $psize = $rs["psize"] ? $rs["psize"] : SYS_PSIZE; $offset = $this->pageid > 0 ? ($this->pageid - 1) * $psize : 0; $this->page_lib->set_psize($psize); $pagelist = $this->page_lib->page_www($pageurl, $total, true); //分页数组 $this->tpl->assign("pagelist", $pagelist); $rslist = $this->list_m->get_list_from_cate($offset, $psize); $this->tpl->assign("rslist", $rslist); $this->tpl->display($this->tplfile . "." . $this->tpl->ext); } }
function setok_f() { load_plugin("register:setok:prev"); //在执行注册前的操作 if (!$this->sys_config["reg_status"]) { $message = $this->sys_config["close_reg"] ? $this->sys_config["close_reg"] : "No register!"; error($message, $this->url()); } if ($_SESSION["user_id"]) { error($this->lang["is_logined"], $this->url()); } 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]); } $array = array(); $array["email"] = $this->trans_lib->safe("email"); $array["name"] = $this->trans_lib->safe("name"); $array["rname"] = $this->trans_lib->safe("fullname"); $array["ygzj"] = $this->trans_lib->safe("ygzj"); $array["mima"] = $this->trans_lib->safe("newpass"); $newpass = $this->trans_lib->safe("newpass"); $chkpass = $this->trans_lib->safe("chkpass"); //echo "1".."<br />"; // echo "2".$this->trans_lib->safe("dianhua")."<br />"; // exit; /** *$to_email 发送的人 *$title 邮箱标题 *$content 有些内容 */ if (!$newpass || !$chkpass) { error($this->lang["empty_pass"], $this->url("register")); } if ($newpass != $chkpass) { error($this->lang["pass_not_right"], $this->url("register")); } $array["pass"] = sys_md5($newpass); if (!$array["email"]) { error($this->lang["empty_email"], $this->url("register")); } $chkname = $this->chkname($array["name"]); if ($chkname != "ok") { error($chkname, $this->url("register")); } $array["regdate"] = $this->system_time; $array["status"] = 0; //会员组 $this->load_model("usergroup"); $groupid = $this->trans_lib->int("groupid"); if ($groupid) { $group_rs = $this->usergroup_m->get_one($groupid); if (!$group_rs || !$group_rs["status"]) { $group_rs = $this->usergroup_m->get_default(); } } else { $group_rs = $this->usergroup_m->get_default(); } $array["groupid"] = $group_rs["id"]; $user_id = $this->user_m->save($array); if (!$user_id) { error("注册失败,请联系网站管理员!", $this->url("register")); } //存储用户扩展信息 $extlist = $this->usergroup_m->fields_index($group_rs["id"], 1); if (!$extlist) { $extlist = array(); } $ext_array = array(); foreach ($extlist as $key => $value) { $array_ext = array(); $array_ext["id"] = $user_id; $array_ext["field"] = $value["identifier"]; //扩展字段信息 $val = $this->trans_lib->safe($value["identifier"]); if ($value["input"] == "time" && $val) { $val = strtotime($val); } if (is_array($val)) { $val = sys_id_string(",", $val); } $array_ext["val"] = $val; $this->user_model->save_ext($array_ext); } //填写 //会员注册成功,模拟登录 echo "<script language=javascript>\nwindow.alert('注册成功,等待审核!');\nwindow.location.href='home.html';\n</script>"; exit; $_SESSION["user_id"] = $user_id; $_SESSION["user_name"] = $array["name"]; $_SESSION["group_id"] = $array["groupid"]; $rs = $this->user_m->user_from_id($user_id); $_SESSION["user_rs"] = $rs; $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs); //存储扩展字段 //存储邮件到订阅信息 $this->load_model("subscribers_model", true); $chk_email = $this->subscribers_model->chk_email($email); if (!$chk_email) { $array = array(); $array["email"] = $email; $array["status"] = $status; $array["postdate"] = $this->system_time; $array["md5pass"] = md5($email . "_" . $this->system_time); $this->subscribers_model->save($array, $id); } //发送欢迎信息 if ($this->sys_config["smtp_reg"]) { $this->load_lib("email"); $this->email_lib->reg($user_id); } load_plugin("register:setok:next"); //在执行注册后的操作 //error($this->lang["register_ok"],$this->url("usercp")); }
function reupdate_list($id) { if (!$id) { return false; } $sql = "UPDATE " . $this->db->prefix . "collection_list SET status='0' WHERE id IN(" . $id . ")"; $this->db->query($sql); //删除附件 $sql = "SELECT id FROM " . $this->db->prefix . "collection_format WHERE lid IN(" . $id . ")"; $rslist = $this->db->get_all($sql, "id"); if ($rslist) { $k_s = sys_id_string(array_keys($rslist)); $sql = "DELETE FROM " . $this->db->prefix . "collection_files WHERE lid IN(" . $k_s . ")"; $this->db->query($sql); } //删除数据 $sql = "DELETE FROM " . $this->db->prefix . "collection_format WHERE lid IN(" . $id . ")"; $this->db->query($sql); return true; }
function set_f() { //返回上一级网址 $referurl = $this->trans_lib->safe("referurl"); $referurl = $referurl ? $referurl : $_SERVER["HTTP_REFERER"]; if (!$referurl) { $referurl = $this->url(); } $iframe = $this->trans_lib->safe("iframe"); if ($iframe == "true") { $referurl = ""; } $this->tpl->assign("referurl", $referurl); //现在判断是否有权限 $no_popedom = $this->lang["post_not_popedom"]; //没有权限的提示语 $popedom = sys_user_popedom("post"); //获取发布权限 if (!$popedom) { error($no_popedom, $referurl); } //判断是否有主题ID $id = $this->trans_lib->int("id"); if ($id) { //锁定主题,限制非会员不允许编辑主题 if (!$_SESSION["user_id"]) { error($no_popedom, $referurl); } $rs = $this->post_m->get_one($id); //获取主题为空时提示错误! if (!$rs) { error($this->lang["msg_not_rs"], $referurl); } //判断会员和发布人是否一致,不一致禁止执行操作 if ($rs["author"] != $_SESSION["user_name"] || $rs["author_type"] != "user") { error($no_popedom, $referurl); } $this->tpl->assign("rs", $rs); $this->tpl->assign("id", $id); $module_id = $rs["module_id"]; $cate_id = $rs["cate_id"]; } else { $module_id = $this->trans_lib->int("module_id"); if (!$module_id) { $ms = $this->trans_lib->safe("ms"); $module_id = $this->module_m->get_mid_from_code($ms); if (!$module_id) { error($this->lang["post_not_mid"], $referurl); } } $cate_id = $this->trans_lib->int("cate_id"); } $this->tpl->assign("module_id", $module_id); $m_rs = $this->_load_moduel($module_id); //读取内容 $ifcate = $m_rs["if_cate"] ? true : false; $this->tpl->assign("ifcate", $ifcate); if ($ifcate) { //判断无分类权限时,禁止执行操作 if (!$popedom["category"] && !$id) { error($no_popedom, $referurl); } $condition = "c.id IN(" . sys_id_string($popedom["category"], ",", "intval") . ") "; $chk_return = $this->cate_m->get_catelist($module_id, $condition); if (!$chk_return) { //如果同时没有指定ID,那么返回无权限 if (!$id) { error($no_popedom, $referurl); } $cate_rs = $this->cate_m->get_one($cate_id); $cate_html = "<select name='cate_id' id='cate_id'><option value='" . $cate_id . "'>" . $cate_rs["cate_name"] . "</option></select>"; } else { $cate_html = $this->cate_m->html_select("cate_id", $cate_id, $this->lang["category_select"]); } $this->tpl->assign("cate_html", $cate_html); } else { //无主题时,如果也没有相匹配的模块ID,则提示无权限操作! if (!$popedom["module"] && !$id) { error($no_popedom, $referurl); } if (!in_array($module_id, $popedom["module"]) && !$id) { error($no_popedom, $referurl); } } $ext_list = $this->module_m->fields_index($module_id); if ($ext_list && is_array($ext_list) && count($ext_list) > 0) { $optlist = array(); $this->load_lib("phpok_input"); $extlist_must = $extlist_need = array(); foreach ($ext_list as $key => $value) { if (!$value["if_post"] && !$value["if_guest"]) { continue; } $_field_name = $value["identifier"]; $value["default_val"] = $rs[$_field_name] ? $rs[$_field_name] : $value["default_val"]; $extlist = $this->phpok_input_lib->get_html($value); $extlist_must[] = $extlist; if ($value["input"] == "opt") { $optlist[] = $value; } $extlist_need[] = $value; } $this->tpl->assign("extlist_must", $extlist_must); $this->tpl->assign("optlist", $optlist); $this->tpl->assign("extlist", $extlist_need); } $tplfile = "post_" . $m_rs["identifier"]; if ($iframe == "true") { $tplfile = "iframe_post"; $chk_tplfile = ROOT . $this->tpl->tpldir . "/iframe_post." . $this->tpl->ext; $bgcolor = $this->trans_lib->safe("bgcolor"); if (!$bgcolor) { $bgcolor = "#FFF"; } $this->tpl->assign("bgcolor", $bgcolor); //返回地址 $goback = $this->trans_lib->safe("_goback"); if (!$goback) { $goback = $this->url("list", "ms=" . $m_rs["identifier"]); } $this->tpl->assign("_goback", $goback); } else { $chk_tplfile = ROOT . $this->tpl->tpldir . "/" . $tplfile . "." . $this->tpl->ext; } //取得参数外的其他扩展数据 $_ext = array($this->config->c, $this->config->f, $this->config->d, "ms", "module_id", "cate_id", "id"); foreach ($_GET as $key => $value) { if (!in_array($key, $_ext) && $value) { $value = $this->trans_lib->safe($key); $this->tpl->assign($key, $value); } } if (file_exists($chk_tplfile)) { $this->tpl->display($tplfile . "." . $this->tpl->ext); } else { $this->tpl->display("post_set." . $this->tpl->ext); } }
function fck_img_f() { $idstring = $this->trans_lib->safe("idstring"); if (!$idstring) { exit("empty"); } $idstring = sys_id_string($idstring, ",", "intval"); $gd_type = $this->trans_lib->safe("gd_type"); $rslist = $this->upfile_m->pic_list($idstring, $gd_type); if (!$rslist) { exit("empty"); } exit($this->json_lib->encode($rslist)); }
function set_f() { load_plugin("list:set:prev"); $id = $this->trans_lib->int("id"); if ($id) { $rs = $this->list_m->get_one($id); $this->tpl->assign("id", $id); $module_id = $rs["module_id"]; sys_popedom($module_id . ":modify", "tpl"); $cate_id = $rs["cate_id"]; $currency = $rs["price_currency"]; //取得扩展分类 $ext_catelist = $this->list_m->ext_catelist($id, $rs["cate_id"]); if ($ext_catelist) { $this->tpl->assign("cate_string", sys_id_string($ext_catelist)); } } else { $cate_id = $this->trans_lib->int("cateid"); $module_id = $this->trans_lib->int("module_id"); if (!$module_id && $cate_id) { $cate_rs = $this->cate_m->get_one($cate_id); if (!$cate_rs) { error("没有指定模块ID!且没有指定分类ID"); } $module_id = $rs["module_id"]; } sys_popedom($module_id . ":add", "tpl"); $rs["post_date"] = $this->system_time; //系统时间 $rs["ip"] = sys_ip(); } if (!$module_id) { error("没有指定模块ID"); } if (!$currency) { $currency = $this->currency_model->get_default_currency(); } $this->tpl->assign("currency", $currency); $this->tpl->assign("rs", $rs); $this->tpl->assign("module_id", $module_id); $m_rs = $this->_load_module($module_id); //判断是否使用电子商务 if ($m_rs["if_biz"]) { $this->load_model("currency"); $curlist = $this->currency_m->get_list(); $this->tpl->assign("curlist", $curlist); } load_plugin("module:" . $m_rs["identifier"] . ":set:prev", $m_rs); //执行模块前的操作 //读取内容 $ifcate = $m_rs["if_cate"] ? true : false; $this->tpl->assign("ifcate", $ifcate); if ($ifcate) { if ($cate_id) { $cate_rs = $this->cate_m->get_one($cate_id); $this->tpl->assign("cate_rs", $cate_rs); } $this->tpl->assign("cate_id", $cate_id); $this->_load_cate($module_id, $cate_id); } $ext_list = $this->_load_ext_fields($module_id); //获取扩展信息 if ($ext_list && is_array($ext_list) && count($ext_list) > 0) { $optlist = array(); $extlist_must = $extlist_need = array(); foreach ($ext_list as $key => $value) { $_field_name = $value["identifier"]; $value["default_val"] = $rs[$_field_name] ? $rs[$_field_name] : $value["default_val"]; $extlist = $this->phpok_input_lib->get_html($value); $extlist_must[] = $extlist; if ($value["input"] == "opt") { $optlist[] = $value; } $ext_list[$key] = $value; } $this->tpl->assign("extlist_must", $extlist_must); $this->tpl->assign("optlist", $optlist); $this->tpl->assign("extlist", $ext_list); } load_plugin("module:" . $m_rs["identifier"] . ":set:next", $m_rs); //执行模块前的操作 load_plugin("list:set:next"); $_hotid = $this->trans_lib->int("_hotid"); if ($_hotid) { $this->tpl->assign("_hotid", $_hotid); } $this->tpl->display("list/set.html"); }
function index_f() { $pageurl = $this->url("search"); //搜索条件之:语言包 $list_condition = "langid='" . $_SESSION["sys_lang_id"] . "'"; //搜索条件之:分类 $cateid = $this->trans_lib->int("cateid"); if ($cateid) { $this->tpl->assign("cid", $cateid); $cate_rs = $this->cate_m->get_one($cateid); $this->tpl->assign("cate_rs", $cate_rs); $cate_array = array($cateid); $this->cate_m->get_sonid_array($cate_array, $cateid); $cate_string = sys_id_string($cate_array); $list_condition .= " AND cate_id IN(" . $cate_string . ")"; $pageurl .= "cateid=" . $cateid . "&"; $mid = $cate_rs["module_id"]; } else { $mid = $this->trans_lib->int("mid"); //模块ID } if ($mid) { $mod_rs = $this->module_m->get_one($mid); $this->tpl->assign("m_rs", $mod_rs); $list_condition .= " AND module_id ='" . $mid . "'"; } //搜索条件之:模块 $mid_string = $mid; if (!$mid) { $modlist = $this->module_m->get_all_module(); //取得所有支持搜索的模块引挈 if (!$modlist) { error($this->lang["search_not_rs"], $this->url()); } $mid_rs = array(); foreach ($modlist as $key => $value) { $mid_rs[] = $value["id"]; } $mid_string = sys_id_string($mid_rs); $list_condition .= " AND module_id IN(" . $mid_string . ")"; } //搜索条件之:关键字 //兼容旧版操作 $keytype = $this->trans_lib->safe("keytype"); $keywords = $this->trans_lib->safe("keywords"); if ($keywords && (!$keytype || $keytype == "title")) { $list_condition .= " AND (title LIKE '%" . $keywords . "%' OR subtitle LIKE '%" . $keywords . "%' OR keywords LIKE '%" . $keywords . "%' OR description LIKE '%" . $keywords . "%' OR note LIKE '%" . $keywords . "%')"; $pageurl .= "keywords=" . rawurlencode($keywords) . "&"; } //搜索条件之:扩展字段 $ext_keywords = $this->trans_lib->safe("ext_keywords"); if (!$ext_keywords || !is_array($ext_keywords)) { $ext_keywords = array(); //兼容旧版操作,这里是关键数据类型 if ($mid) { if ($mod_rs["link_id"] && $mod_rs["search_id"]) { $ext_keywords[$mod_rs["search_id"]] = $this->trans_lib->safe($mod_rs["search_id"]); } } if ($keytype && $keytype != "title") { $ext_keywords[$keytype] = $this->trans_lib->safe($keywords); } } $this->tpl->assign("ext_keywords", $ext_keywords); foreach ($ext_keywords as $key => $value) { $pageurl .= "ext_keywords[" . rawurlencode($key) . "]=" . rawurlencode($value) . "&"; } //设置每页显示数量 $pageid = $this->trans_lib->int(SYS_PAGEID); $psize = $this->sys_config["search_page"]; $this->search_m->set_psize($psize); $this->search_m->set_pageid($pageid); $gdtype = $this->sys_config["search_thumb"] ? $this->sys_config["search_thumb"] : false; //判断是否有启用缩略图 $this->search_m->set_thumb($gdtype); //取得内容 $this->search_m->get_all_id($list_condition, $ext_keywords); $rslist = $this->search_m->get_list(); $total = $this->search_m->get_count(); $this->tpl->assign("rslist", $rslist); $this->page_lib->set_psize($psize); $pagelist = $this->page_lib->page($pageurl, $total, true, false); $this->tpl->assign("pagelist", $pagelist); $sitetitle = $this->lang["search"]; $this->tpl->assign("sitetitle", $sitetitle); $array[0]["title"] = $this->lang["search"]; $this->tpl->assign("leader", $array); //定制搜索模板 $tplfile = "search"; $chk_tplfile = ROOT . $this->tpl->tpldir . "/search." . $this->tpl->ext; if ($mid && $mod_rs) { $chk_tplfile = ROOT . $this->tpl->tpldir . "/search_" . $mod_rs["identifier"] . "." . $this->tpl->ext; if (file_exists($chk_tplfile)) { $tplfile = "search_" . $mod_rs["identifier"]; } } $this->tpl->display($tplfile . "." . $this->tpl->ext); }