internal static void SendNextRoundMail(User pro_username, User con_username, DebateInfo di, int round) { var subject = "dezbateri.ro - dezbaterea continua!"; if (round % 2 == 1) { var body = "Discursul a fost postat de catre <b>" + con_username.Username + "</b> in dezbaterea pe tema " + di.subject + " intre <b>" + pro_username.Username + "</b> si <b>" + con_username.Username + ". " + "Aveti 3 zile pentru a publica urmatorul discurs al dezbaterii."; SendMail(pro_username.Email, "*****@*****.**", subject, body); body = "Discursul tau a fost postat in dezbaterea pe tema " + di.subject + " intre <b>" + pro_username.Username + "</b> si <b>" + con_username.Username + ". " + "Oponentul are 3 zile pentru a publica urmatorul discurs al dezbaterii."; SendMail(con_username.Email, "*****@*****.**", subject, body); } else { var body = "Discursul a fost postat de catre <b>" + pro_username.Username + "</b> in dezbaterea pe tema " + di.subject + " intre <b>" + pro_username.Username + "</b> si <b>" + con_username.Username + ". " + "Aveti 3 zile pentru a publica urmatorul discurs al dezbaterii."; SendMail(con_username.Email, "*****@*****.**", subject, body); body = "Discursul tau a fost postat in dezbaterea pe tema " + di.subject + " intre <b>" + pro_username.Username + "</b> si <b>" + con_username.Username + ". " + "Oponentul are 3 zile pentru a publica urmatorul discurs al dezbaterii."; SendMail(pro_username.Email, "*****@*****.**", subject, body); } }
internal void NextRound(string debate_id) { RoundState debateState = _roundStateRepository.GetById(int.Parse(debate_id)); if (debateState != null) { UserDebate ud = _userDebateRepository.GetById(int.Parse(debate_id.ToString())); User pro_username = _userRepository.GetByUsername(ud.pro_username); User con_username = _userRepository.GetByUsername(ud.con_username); DebateInfo di = _debateRepository.GetById(int.Parse(debate_id)); if (debateState.next_round == 6) { di.state = "incheiat"; _debateRepository.Update(di); MailService.SendDoneDebateMail(pro_username, con_username, di); } else { int currentRound = debateState.next_round; debateState.next_round = ++currentRound; long actualTime = AuthToken.GetNistTime(); long nextRoundTime = actualTime + threeDaysInMillis; debateState.time_to_next = nextRoundTime.ToString(); _roundStateRepository.Update(debateState); MailService.SendNextRoundMail(pro_username, con_username, di, debateState.next_round); } } }
/// <summary> /// 获取辩论信息 /// </summary> public void GetDebateInfo(PostpramsInfo postpramsInfo) { debateexpand = Debates.GetDebateTopic(topicid); debateList = Debates.GetPostDebateList(topicid);//通过TID得到帖子观点 if (debateexpand.Terminaltime < DateTime.Now) { isenddebate = true; } int positivepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 1); int negativepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 2); positivepagecount = (positivepostlistcount % pagesize == 0) ? (positivepostlistcount / pagesize) : (positivepostlistcount / pagesize + 1); negativepagecount = (negativepostlistcount % pagesize == 0) ? (negativepostlistcount / pagesize) : (negativepostlistcount / pagesize + 1); positivepagenumbers = Utils.GetAjaxPageNumbers(1, positivepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=1&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',1," + userid + "," + topicid + ")", 8); negativepagenumbers = Utils.GetAjaxPageNumbers(1, negativepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=2&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',2," + userid + "," + topicid + ")", 8); //防止无人参与时0做除数 if (debateexpand.Negativediggs + debateexpand.Positivediggs != 0) { positivepercent = (float)debateexpand.Positivediggs / (float)(debateexpand.Negativediggs + debateexpand.Positivediggs) * 100; negativepercent = 100 - positivepercent; } foreach (ShowtopicPagePostInfo postlistinfo in positivepostlist) { //设置POST的观点属性 if (debateList != null && debateList.ContainsKey(postlistinfo.Pid)) { postlistinfo.Debateopinion = Convert.ToInt32(debateList[postlistinfo.Pid]); } } }
/// <summary> /// 常规项验证 /// </summary> /// <param name="admininfo"></param> /// <param name="postmessage"></param> private void NormalValidate(AdminGroupInfo admininfo, string postmessage, ShortUserInfo user) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } else if (posttitle.Length > 60) { AddErrLine("标题最大长度为60个字符,当前为 " + posttitle.Length + " 个字符"); } if (Utils.StrIsNullOrEmpty(postmessage.Replace(" ", ""))) { AddErrLine("内容不能为空"); } if (admininfo != null && admininfo.Disablepostctrl != 1) { if (postmessage.Length < config.Minpostsize) { AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字"); } else if (postmessage.Length > config.Maxpostsize) { AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字"); } } if (topic.Special == 4 && DNTRequest.GetInt("debateopinion", 0) == 0) { AddErrLine("请选择您在辩论中的观点"); } if (topic.Special == 4) { DebateInfo debateexpand = Debates.GetDebateTopic(topic.Tid); if (debateexpand.Terminaltime < DateTime.Now) { AddErrLine("此辩论主题已经到期"); } } //新用户广告强力屏蔽检查 if ((config.Disablepostad == 1) && useradminid < 1) //如果开启新用户广告强力屏蔽检查或是游客 { if ((config.Disablepostadpostcount != 0 && user.Posts <= config.Disablepostadpostcount) || (config.Disablepostadregminute != 0 && DateTime.Now.AddMinutes(-config.Disablepostadregminute) <= Convert.ToDateTime(user.Joindate))) { foreach (string regular in config.Disablepostadregular.Replace("\r", "").Split('\n')) { if (Posts.IsAD(regular, posttitle, postmessage)) { AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系"); } } } } }
/// <summary> /// 更新辩论信息 /// </summary> /// <param name="debateInfo">辩论信息</param> /// <returns></returns> public static bool UpdateDebateTopic(DebateInfo debateInfo) { if (debateInfo.Tid <= 0) { return(false); } return(Discuz.Data.Debates.UpdateDebateTopic(debateInfo)); }
internal static void SendStartDebateMail(User pro_user, User con_user, DebateInfo di) { var subject = "dezbateri.ro - dezbaterea incepe!"; var body = "Dezbaterea pe tema " + di.subject + " a fost acceptata de <b>" + con_user.Username + "</b>. Aveti 3 zile pentru a publica primul discurs al dezbaterii."; SendMail(pro_user.Email, "*****@*****.**", subject, body); body = "Ai acceptat dezbaterea pe tema " + di.subject + " impotriva lui <b>" + pro_user.Username + "</b>. Oponentul are 3 zile pentru a publica primul discurs al dezbaterii, urmand ca apoi apoi sa ai alte 3 zile la dispozitie pentru primul tau discurs."; SendMail(con_user.Email, "*****@*****.**", subject, body); }
internal void AddDebate(dynamic newDebate) { DebateInfo debate = new DebateInfo { subject = newDebate.Subject, date_created = newDebate.Date_created, state = newDebate.State, description = newDebate.Description, }; dynamic addedDebate = _debateRepository.Add(debate); var id = addedDebate.debate_id; Content newContent = new Content { debate_id = id, round_1 = newDebate.Round_1, round_2 = newDebate.Round_2, round_3 = newDebate.Round_3, round_4 = newDebate.Round_4, round_5 = newDebate.Round_5, round_6 = newDebate.Round_6 }; _contentRepository.Add(newContent); foreach (string categ in newDebate.Category) { int categ_id = _categoryRepository.GetByName(categ).id; _categoryDebateRepository.Add(new CategoryDebate { debate_id = id, category_id = categ_id }); } _userDebateRepository.Add(new UserDebate { debate_id = id, pro_username = newDebate.Pro_username, con_username = newDebate.Con_username }); _roundStateRepository.Add(new RoundState { debate_id = id, next_round = 1, time_to_next = (AuthToken.GetNistTime() + threeDaysInMillis).ToString() }); }
public dynamic Add(DebateInfo debate) { try { using (var context = new dezbateriEntities()) { var addedDebate = context.DebateInfoes.Add(debate); context.SaveChanges(); return(addedDebate); } } catch (Exception ex) { throw new DebateException("Add", ex); } }
/// <summary> /// 获取辩论的扩展信息 /// </summary> /// <param name="tid">主题ID</param> /// <returns>辩论主题扩展信息</returns> public static DebateInfo GetDebateTopic(int tid) { IDataReader debatetopic = DatabaseProvider.GetInstance().GetDebateTopic(tid); DebateInfo topicexpand = new DebateInfo(); if (debatetopic.Read()) { topicexpand.Positiveopinion = debatetopic["positiveopinion"].ToString(); topicexpand.Negativeopinion = debatetopic["negativeopinion"].ToString(); topicexpand.Terminaltime = DateTime.Parse(debatetopic["terminaltime"].ToString()); topicexpand.Positivediggs = TypeConverter.ObjectToInt(debatetopic["positivediggs"]); topicexpand.Negativediggs = TypeConverter.ObjectToInt(debatetopic["negativediggs"]); topicexpand.Tid = tid; } debatetopic.Close(); return(topicexpand); }
/// <summary> /// 获取辩论信息 /// </summary> public void GetDebateInfo() { debateexpand = Debates.GetDebateTopic(topicid); debateList = Debates.GetPostDebateList(topicid);//通过TID得到帖子观点 if (debateexpand.Terminaltime < DateTime.Now) { isenddebate = true; } foreach (ShowtopicPagePostInfo postlistinfo in postlist) { //设置POST的观点属性 if (debateList != null && debateList.ContainsKey(postlistinfo.Pid)) { postlistinfo.Debateopinion = debateList[postlistinfo.Pid]; } } }
internal DebateModel GetDebate(string param, string username) { DebateModel dm = new DebateModel(); DebateInfo di = _debateRepository.GetById(int.Parse(param)); dm.DebateId = di.debate_id.ToString(); dm.Subject = di.subject; dm.Date_created = di.date_created; dm.State = di.state; dm.Description = di.description; List <CategoryDebate> categDebList = _categoryDebateRepository.GetAll().FindAll(categ => categ.debate_id.ToString() == dm.DebateId); List <String> debateCategories = new List <String>(); foreach (CategoryDebate cd in categDebList) { debateCategories.Add(_categoryRepository.GetById(cd.category_id).name); } dm.Category = debateCategories; UserDebate userDebList = _userDebateRepository.GetById(int.Parse(dm.DebateId)); dm.Pro_username = userDebList.pro_username; dm.Con_username = userDebList.con_username; RoundState roundState = _roundStateRepository.GetById(int.Parse(dm.DebateId)); dm.Next_round = roundState.next_round.ToString(); dm.Time_to_next = roundState.time_to_next; Content debContent = _contentRepository.GetById(int.Parse(dm.DebateId)); dm.Round_1 = debContent.round_1; dm.Round_2 = debContent.round_2; dm.Round_3 = debContent.round_3; dm.Round_4 = debContent.round_4; dm.Round_5 = debContent.round_5; dm.Round_6 = debContent.round_6; CheckRoundVisible(username, dm); return(dm); }
/// <summary> /// 获取辩论的扩展信息 /// </summary> /// <param name="tid">主题ID</param> /// <returns>辩论主题扩展信息</returns> public static DebateInfo GetDebateTopic(int tid) { DebateInfo topicexpand = new DebateInfo(); IDataReader debatetopic = DatabaseProvider.GetInstance().GetDebateTopic(tid); if (debatetopic.Read()) { topicexpand.Positiveopinion = debatetopic["positiveopinion"].ToString(); topicexpand.Negativeopinion = debatetopic["negativeopinion"].ToString(); //topicexpand.Positivecolor = debatetopic["positivecolor"].ToString(); //topicexpand.Negativecolor = debatetopic["negativecolor"].ToString(); topicexpand.Terminaltime = DateTime.Parse(debatetopic["terminaltime"].ToString()); topicexpand.Positivediggs = int.Parse(debatetopic["positivediggs"].ToString()); topicexpand.Negativediggs = int.Parse(debatetopic["negativediggs"].ToString()); //topicexpand.Positivebordercolor = debatetopic["positivebordercolor"].ToString(); //topicexpand.Negativebordercolor = debatetopic["negativebordercolor"].ToString(); topicexpand.Tid = tid; } debatetopic.Close(); return(topicexpand); }
public void Update(DebateInfo debate) { try { using (var context = new dezbateriEntities()) { var debateUpdated = context.DebateInfoes.FirstOrDefault(debateObj => debateObj.debate_id == debate.debate_id); if (debateUpdated == null) { throw new DebateException("No debate found"); } debateUpdated.subject = debate.subject; debateUpdated.date_created = debate.date_created; debateUpdated.state = debate.state; debateUpdated.description = debate.description; context.SaveChanges(); } } catch (Exception ex) { throw new DebateException("Update", ex); } }
internal void JoinDebate(string debate_id, string user_id) { RoundState rs = _roundStateRepository.GetById(int.Parse(debate_id.ToString())); long next_speech = AuthToken.GetNistTime() + threeDaysInMillis; rs.time_to_next = next_speech.ToString(); _roundStateRepository.Update(rs); User us = _userRepository.GetByUsername(user_id); UserDebate ud = _userDebateRepository.GetById(int.Parse(debate_id.ToString())); ud.con_username = us.Username; _userDebateRepository.Update(ud); User pro_us = _userRepository.GetByUsername(ud.pro_username); DebateInfo di = _debateRepository.GetById(int.Parse(debate_id.ToString())); di.state = "desfasurare"; _debateRepository.Update(di); MailService.SendStartDebateMail(pro_us, us, di); }
/// <summary> /// 更新辩论信息 /// </summary> /// <param name="debateInfo">辩论信息</param> /// <returns></returns> public static bool UpdateDebateTopic(DebateInfo debateInfo) { if (debateInfo.Tid <= 0) return false; return Discuz.Data.Debates.UpdateDebateTopic(debateInfo); }
protected override void ShowPage() { //pagetitle = "编辑帖子"; #region 判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); this.disablepostctrl = 0; if (admininfo != null) { disablepostctrl = admininfo.Disablepostctrl; } #endregion if (userid == -1) { forum = new ForumInfo(); topic = new TopicInfo(); postinfo = new PostInfo(); AddErrLine("您尚未登录"); return; } #region 获取帖子和主题相关信息 // 如果帖子ID非数字 if (postid == -1) { AddErrLine("无效的帖子ID"); return; } postinfo = Posts.GetPostInfo(topicid, postid); // 如果帖子不存在 if (postinfo == null) { AddErrLine("不存在的帖子ID"); return; } pagetitle = (postinfo.Title == "") ? "编辑帖子" : postinfo.Title; htmlon = postinfo.Htmlon; message = postinfo.Message; isfirstpost = postinfo.Layer == 0; // 获取主题ID if (topicid != postinfo.Tid || postinfo.Tid == -1) { AddErrLine("无效的主题ID"); return; } // 获取该主题的信息 topic = Topics.GetTopicInfo(postinfo.Tid); // 如果该主题不存在 if (topic == null) { AddErrLine("不存在的主题ID"); return; } if (topic.Special == 1 && postinfo.Layer == 0) { pollinfo = Polls.GetPollInfo(topic.Tid); polloptionlist = Polls.GetPollOptionList(topic.Tid); } if (topic.Special == 4 && postinfo.Layer == 0) { debateinfo = Debates.GetDebateTopic(topic.Tid); } #endregion #region 获取并检查版块信息 ///得到所在版块信息 forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepostctrl, usergroupinfo); // 如果该版块不存在 if (forum == null || forum.Layer == 0) { AddErrLine("版块已不存在"); forum = new ForumInfo(); return; } if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } customeditbuttons = Caches.GetCustomEditButtonList(); #endregion //是否有编辑帖子的权限 if (!UserAuthority.CanEditPost(postinfo, userid, useradminid, ref msg)) { AddErrLine(msg); return; } #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); userinfo = Users.GetShortUserInfo(userid); if (canpostattach && (config.Enablealbum == 1) && apb != null && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } else { caninsertalbum = false; } attachmentlist = Attachments.GetAttachmentListByPid(postinfo.Pid); attachmentcount = attachmentlist.Rows.Count; //当前用户是否有允许下载附件权限 allowviewattach = UserAuthority.DownloadAttachment(forum, userid, usergroupinfo); #endregion smileyoff = (!DNTRequest.IsPost()) ? postinfo.Smileyoff : 1 - forum.Allowsmilies; allowimg = forum.Allowimgcode; parseurloff = postinfo.Parseurloff; bbcodeoff = (usergroupinfo.Allowcusbbcode == 1) ? postinfo.Bbcodeoff : 1; usesig = postinfo.Usesig; userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); if (bonusCreditsTrans > 0 && bonusCreditsTrans < 9) { bonusextcreditsinfo = Scoresets.GetScoreSet(bonusCreditsTrans); mybonustranscredits = Users.GetUserExtCredits(userid, bonusCreditsTrans); } //是否有访问当前版块的权限 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); return; } // 判断当前用户是否有修改权限, 检查是否具有版主的身份 if (!Moderators.IsModer(useradminid, userid, forumid)) { if (postinfo.Posterid != userid) { AddErrLine("你并非作者, 且你当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有修改该帖的权限"); return; } else if (config.Edittimelimit > 0 && Utils.StrDateDiffMinutes(postinfo.Postdatetime, config.Edittimelimit) > 0) { AddErrLine("抱歉, 系统规定只能在帖子发表" + config.Edittimelimit + "分钟内才可以修改"); return; } else if (config.Edittimelimit == -1) { AddErrLine("抱歉,系统不允许修改帖子"); return; } } #region htmltitle标题 if (postinfo.Layer == 0) { canhtmltitle = usergroupinfo.Allowhtmltitle == 1; } if (Topics.GetMagicValue(topic.Magic, MagicType.HtmlTitle) == 1) { htmltitle = Topics.GetHtmlTitle(topic.Tid).Replace("\"", "\\\"").Replace("'", "\\'"); } #endregion #region tag信息 enabletag = (config.Enabletag & forum.Allowtag) == 1; if (enabletag && Topics.GetMagicValue(topic.Magic, MagicType.TopicTag) == 1) { foreach (TagInfo tag in ForumTags.GetTagsListByTopic(topic.Tid)) { if (tag.Orderid > -1) { topictags += string.Format(" {0}", tag.Tagname); } } topictags = topictags.Trim(); } #endregion userGroupInfoList.Sort(delegate(UserGroupInfo x, UserGroupInfo y) { return((x.Readaccess - y.Readaccess) + (y.Groupid - x.Groupid)); }); //如果是提交... if (ispost) { SetBackLink("editpost.aspx?topicid=" + postinfo.Tid + "&postid=" + postinfo.Pid); if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } //设置相关帖子信息 SetPostInfo(admininfo, userinfo, Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1); if (IsErr()) { return; } //通过验证的用户可以编辑帖子 Posts.UpdatePost(postinfo); //设置附件相关信息 System.Text.StringBuilder sb = SetAttachmentInfo(); if (IsErr()) { return; } UserCredits.UpdateUserCredits(userid); #region 设置提示信息和跳转链接 //辩论地址 if (topic.Special == 4) { SetUrl(Urls.ShowDebateAspxRewrite(topic.Tid)); } else if (DNTRequest.GetQueryString("referer") != "")//ajax快速回复将传递referer参数 { SetUrl(string.Format("showtopic.aspx?page=end&forumpage={2}&topicid={0}#{1}", topic.Tid, postinfo.Pid, forumpageid)); } else if (pageid != "")//如果不是ajax,则应该是带pageid的参数 { if (config.Aspxrewrite == 1) { SetUrl(string.Format("showtopic-{0}-{2}{1}#{3}", topic.Tid, config.Extname, DNTRequest.GetString("pageid"), postinfo.Pid)); } else { SetUrl(string.Format("showtopic.aspx?topicid={0}&forumpage={3}&page={2}#{1}", topic.Tid, postinfo.Pid, DNTRequest.GetString("pageid"), forumpageid)); } } else//如果都为空.就跳转到第一页(以免意外情况) { if (config.Aspxrewrite == 1) { SetUrl(string.Format("showtopic-{0}{1}", topic.Tid, config.Extname)); } else { SetUrl(string.Format("showtopic.aspx?topicid={0}&forumpage={1}", topic.Tid, forumpageid)); } } if (sb.Length > 0) { SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>编辑帖子成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>"); sb.Append("</table>"); AddMsgLine(sb.ToString()); } } else { //编辑主题和回复需要审核 if (postinfo.Layer == 0) { SetMetaRefresh(2, base.ShowForumAspxRewrite(forumid, forumpageid)); } else { SetMetaRefresh(); } SetShowBackLink(false); if (useradminid != 1 && (needaudit || topic.Displayorder == -2 || postinfo.Invisible == 1)) { if (postinfo.Layer == 0) { SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid)); } else { SetUrl(base.ShowTopicAspxRewrite(topic.Tid, forumpageid)); } AddMsgLine("编辑成功, 但需要经过审核才可以显示"); } else { MsgForward("editpost_succeed"); AddMsgLine("编辑帖子成功, 返回该主题"); } } #endregion // 删除主题游客缓存 if (postinfo.Layer == 0) { ForumUtils.DeleteTopicCacheFile(topic.Tid); } } else { AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); } }
/// <summary> /// 增加辩论主题扩展信息 /// </summary> /// <param name="debatetopic"></param> public static void CreateDebateTopic(DebateInfo debateTopic) { Data.Debates.CreateDebateTopic(debateTopic); }
/// <summary> /// 更新辩论信息 /// </summary> /// <param name="debateInfo">辩论信息</param> /// <returns></returns> public static bool UpdateDebateTopic(DebateInfo debateInfo) { return(DatabaseProvider.GetInstance().UpdateDebateTopic(debateInfo)); }
/// <summary> /// 增加辩论主题扩展信息 /// </summary> /// <param name="debatetopic"></param> public static void CreateDebateTopic(DebateInfo debateInfo) { //debatetopic = ReviseDebateTopicColor(debatetopic); DatabaseProvider.GetInstance().CreateDebateTopic(debateInfo); }
/// <summary> /// 创建主题信息 /// </summary> /// <param name="admininfo"></param> /// <param name="postmessage"></param> /// <param name="isbonus"></param> /// <param name="topicprice"></param> /// <returns></returns> public TopicInfo CreateTopic(AdminGroupInfo admininfo, string postmessage, bool isbonus, int topicprice) { TopicInfo topicinfo = new TopicInfo(); topicinfo.Fid = forumid; topicinfo.Iconid = (DNTRequest.GetInt("iconid", 0) < 0 || DNTRequest.GetInt("iconid", 0) > 15) ? 0 : DNTRequest.GetInt("iconid", 0); message = Posts.GetPostMessage(usergroupinfo, admininfo, postmessage, (TypeConverter.StrToInt(DNTRequest.GetString("htmlon")) == 1)); topicinfo.Title = (useradminid == 1) ? Utils.HtmlEncode(posttitle) : Utils.HtmlEncode(ForumUtils.BanWordFilter(posttitle)); if (useradminid != 1 && (ForumUtils.HasBannedWord(posttitle) || ForumUtils.HasBannedWord(postmessage))) { string bannedWord = ForumUtils.GetBannedWord(posttitle) == string.Empty ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(posttitle); AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 请返回修改!", bannedWord)); return(topicinfo); } if (Utils.GetCookie("lasttopictitle") == Utils.MD5(topicinfo.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(message)) { AddErrLine("请勿重复发帖"); return(topicinfo); } topicinfo.Typeid = DNTRequest.GetInt("typeid", 0); if (usergroupinfo.Allowsetreadperm == 1) { topicinfo.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0); } topicinfo.Price = topicprice; topicinfo.Poster = username; topicinfo.Posterid = userid; topicinfo.Postdatetime = curdatetime; topicinfo.Lastpost = curdatetime; topicinfo.Lastposter = username; topicinfo.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topicinfo, message, disablepost); string htmltitle = DNTRequest.GetString("htmltitle").Trim(); if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topicinfo.Title) { //按照 附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储 例: 11001 topicinfo.Magic = 11000; } //标签(Tag)操作 string tags = DNTRequest.GetString("tags").Trim(); string[] tagArray = null; if (enabletag && !Utils.StrIsNullOrEmpty(tags)) { if (ForumUtils.InBanWordArray(tags)) { AddErrLine("标签中含有系统禁止词语,请修改"); return(topicinfo); } tagArray = Utils.SplitString(tags, " ", true, 2, 10); if (tagArray.Length > 0 && tagArray.Length <= 5) { if (topicinfo.Magic == 0) { topicinfo.Magic = 10000; } topicinfo.Magic = Utils.StrToInt(topicinfo.Magic.ToString() + "1", 0); } else { AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签"); return(topicinfo); } } if (isbonus) { topicinfo.Special = 2; //检查积分是否足够 if (mybonustranscredits < topicprice && usergroupinfo.Radminid != 1) { AddErrLine(string.Format("无法进行悬赏<br /><br />您当前的{0}为 {1} {3}<br/>悬赏需要{0} {2} {3}", bonusextcreditsinfo.Name, mybonustranscredits, topicprice, bonusextcreditsinfo.Unit)); return(topicinfo); } else { Users.UpdateUserExtCredits(topicinfo.Posterid, Scoresets.GetBonusCreditsTrans(), -topicprice * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付 } } if (type == "poll") { topicinfo.Special = 1; } if (type == "debate") //辩论帖 { topicinfo.Special = 4; } if (!Moderators.IsModer(useradminid, userid, forumid)) { topicinfo.Attention = 1; } if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) { topicinfo.Hide = 1; } topicinfo.Tid = Topics.CreateTopic(topicinfo); //canhtmltitle = config.Htmltitle == 1 && Utils.InArray(usergroupid.ToString(), config.Htmltitleusergroup); //canhtmltitle = config.Htmltitle == 1 && usergroupinfo.Allowhtml == 1; //保存htmltitle if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topicinfo.Title) { Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topicinfo.Tid); } if (enabletag && tagArray != null && tagArray.Length > 0) { if (useradminid != 1 && ForumUtils.HasBannedWord(tags)) { string bannedWord = ForumUtils.GetBannedWord(tags); AddErrLine(string.Format("标签中含有系统禁止词语 <font color=\"red\">{0}</font>,请修改", bannedWord)); return(topicinfo); } ForumTags.CreateTopicTags(tagArray, topicinfo.Tid, userid, curdatetime); } if (type == "debate") { DebateInfo debatetopic = new DebateInfo(); debatetopic.Tid = topicinfo.Tid; debatetopic.Positiveopinion = DNTRequest.GetString("positiveopinion"); debatetopic.Negativeopinion = DNTRequest.GetString("negativeopinion"); debatetopic.Terminaltime = Convert.ToDateTime(DNTRequest.GetString("terminaltime")); Topics.CreateDebateTopic(debatetopic); } Topics.AddParentForumTopics(forum.Parentidlist.Trim(), 1); return(topicinfo); }
internal static void SendDoneDebateMail(User pro_username, User con_username, DebateInfo di) { var subject = "dezbateri.ro - dezbaterea s-a incheiat!"; var body = "Dezbaterea pe tema " + di.subject + " dintre <b>" + pro_username.Username + "</b> si <b>" + con_username.Username + " s-a incheiat." + "Perioada de votare si comentare a dezbaterii incepe!"; SendMail(pro_username.Email, "*****@*****.**", subject, body); SendMail(con_username.Email, "*****@*****.**", subject, body); }