/// <summary> /// 递归找到父节点 /// </summary> private void LoopChannelMenu(StringBuilder strTxt, int category_id) { BLL.forum_board bll = new BLL.forum_board(); int parentId = bll.GetParentId(category_id); strTxt.Append(bll.GetParentId(category_id)); }
/// <summary> /// 取得该频道指定类别下的列表 /// </summary> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> public DataTable get_board_getchildlist(int parent_id) { DataTable dt = new DataTable(); dt = new BLL.forum_board().GetChildList(parent_id); return(dt); }
void forum_Init(object sender, EventArgs e) { board_id = DTRequest.GetQueryInt("board_id"); if (board_id > 0) //如果ID获取到,将使用ID { if (bll.Exists(board_id)) { model = bll.GetModel(board_id); } if (board_id > 0) { int bid = int.Parse(new board().get_category_id(board_id)); //根据子板块ID获取父板块ID string auid = new BLL.forum_board().GetModel(bid).allow_usergroupid_list; //获取父板块访问权限列表 auid += ","; string[] mlist = auid.Split(','); int ugid = 0; foreach (string item in mlist) //遍历所有父板块的访问权限 { if (item == "" || item == null) //如果父板块访问权限为空当前板块为所有权限 { umodel.user_name = "游客"; break; } else { if (IsUserLogin()) //判断用户是否登陆 { umodel = GetUserInfo(); if (item == umodel.group_id.ToString()) //如果父板块访问权限列表等于当前用户的用户组,允许访问 { ugid = 1; break; } else { ugid = 2; } } else { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("本板块禁止游客进入!"))); break; } } } if (ugid == 2) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("您没有进入本板块的权限!"))); } } else { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("非法进入!"))); } } }
public string get_board_name(int board__id) { string boardname = "所有主题"; if (new BLL.forum_board().GetBoardName(board__id) != "") { boardname = new BLL.forum_board().GetBoardName(board__id); } return(boardname); }
//判断是否是版主 public bool IsModerator(int boardid, int userid) { bool is_moderator = false; Model.forum_board bmodel = new Model.forum_board(); DTcms.Model.users umodel = new DTcms.BLL.users().GetModel(userid); int bid = int.Parse(new board().get_category_id(boardid)); string auid = new BLL.forum_board().GetModel(bid).moderator_list; auid += ","; string[] mlist = auid.Split(','); foreach (string item in mlist) { if (item != "" && item == umodel.user_name) { is_moderator = true; } } return(is_moderator); }
private void move(HttpContext context) { //检查用户是否登录 DTcms.Model.users umodel = new DTcms.Web.UI.BasePage().GetUserInfo(); if (umodel == null) { context.Response.Write("{\"status\":0, \"msg\":\"请登录后再操作!\"}"); return; } BLL.forum_posts bll = new BLL.forum_posts(); Model.forum_posts model = new Model.forum_posts(); BLL.forum_board bbll = new BLL.forum_board(); Model.forum_board bmodel = new Model.forum_board(); int post_id = DTRequest.GetFormInt("postid"); int to_boardid = DTRequest.GetFormInt("toboardid"); string opremark = DTRequest.GetString("opremark"); if (post_id == 0) { context.Response.Write("{\"status\":0, \"msg\":\"参数不正确!\"}"); return; } model = bll.GetModel(post_id); if (model.parent_post_id != 0) { context.Response.Write("{\"status\":0, \"msg\":\"非主题贴不可移动!\"}"); return; } int postcount = 0; int replycount = 0; int oldboardid = model.board_id; //检查是否是版主 if (!IsModerator(model.board_id, umodel.id)) { context.Response.Write("{\"status\":0, \"msg\":\"当前用户无权执行此操作!\"}"); return; } DataTable dt = bll.GetList(0, "id=" + post_id + " or parent_post_id=" + post_id, "id desc").Tables[0]; foreach (DataRow dr in dt.Rows) { if (int.Parse(dr["parent_post_id"].ToString()) == 0) { postcount += 1; replycount += 1; } else { replycount += 1; } bll.UpdateField(int.Parse(dr["id"].ToString()), "board_id=" + to_boardid); } bmodel = bbll.GetModel(oldboardid); bmodel.subject_count -= postcount; bmodel.post_count -= replycount; bbll.Update(bmodel); bmodel = bbll.GetModel(to_boardid); bmodel.subject_count += postcount; bmodel.post_count += replycount; bbll.Update(bmodel); new DTcms.Web.UI.ManagePage().AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "移动帖子:" + opremark); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"恭喜你,移动主题成功!\"}"); return; }
void forum_Init(object sender, EventArgs e) { page = DTRequest.GetQueryInt("page", 1); post_id = DTRequest.GetQueryInt("post_id"); if (post_id > 0) //如果ID获取到,将使用ID { if (bll.Exists(post_id)) { model = bll.GetModel(post_id); } bll.UpdateField(post_id, "click=click+1"); if (model.board_id > 0) { int bid = int.Parse(new board().get_category_id(model.board_id)); string auid = new BLL.forum_board().GetModel(bid).allow_usergroupid_list; //获取父板块访问权限列表 auid += ","; string[] alist = auid.Split(','); int ugid = 0; foreach (string item in alist) { if (item == "" || item == null) //如果父板块访问权限为空当前板块为所有权限 { if (IsUserLogin()) //判断用户是否登陆 { umodel = GetUserInfo(); string moderator = new BLL.forum_board().GetModel(bid).moderator_list; moderator += ","; string[] mlist = moderator.Split(','); foreach (string mitem in mlist) { if (mitem != "" && mitem == umodel.user_name) { is_moderator = 1; } } } } else { if (IsUserLogin()) //判断用户是否登陆 { umodel = GetUserInfo(); if (item == umodel.group_id.ToString()) //如果父板块访问权限列表等于当前用户的用户组,允许访问 { string moderator = new BLL.forum_board().GetModel(bid).moderator_list; moderator += ","; string[] mlist = moderator.Split(','); foreach (string mitem in mlist) { if (mitem != "" && mitem == umodel.user_name) { is_moderator = 1; } } ugid = 1; break; } else { ugid = 2; } } else { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("本帖子禁止游客查看!"))); break; } } } if (ugid == 2) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("您没有查看本帖子的权限!"))); } } else { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("非法进入!"))); } } }