コード例 #1
0
        protected override void ShowPage()
        {
            if (config.Enabletag != 1)
            {
                AddErrLine("没有启用Tag功能");
                return;
            }
            if (tagid > 0)
            {
                tag = Tags.GetTagInfo(tagid);
                if (tag == null || tag.Orderid < 0)
                {
                    AddErrLine("指定的标签不存在或已关闭");
                    return;
                }
                pagetitle = tag.Tagname;

                if (Utils.StrIsNullOrEmpty(listtype))
                {
                    listtype = "topic";
                }

                if (IsErr())
                {
                    return;
                }

                BindItem();
            }
            else
            {
                pagetitle = "标签";
                taglist   = ForumTags.GetCachedHotForumTags(100);
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取论坛热门标签
        /// </summary>
        private void GetForumHotTags()
        {
            string filename = Utils.GetMapPath(BaseConfigs.GetForumPath + ForumTags.ForumHotTagJSONPCacheFileName);

            if (!File.Exists(filename))
            {
                ForumTags.WriteHotTagsListForForumJSONPCacheFile(60);
            }

            WriteFile(filename);
        }
コード例 #3
0
ファイル: TopicPage.cs プロジェクト: saturn-chan/discuz-nt
        /// <summary>
        /// 更新页面Meta信息
        /// </summary>
        public void UpdateMetaInfo(string metadescritpion)
        {
            //更新页面Meta中的Description项, 提高SEO友好性
            string seokeyword = config.Seokeywords;

            metadescritpion = metadescritpion.Length > 100 ? metadescritpion.Substring(0, 100) : metadescritpion;

            //获取相关主题集合
            if (enabletag && Topics.GetMagicValue(topic.Magic, MagicType.TopicTag) == 1)
            {
                seokeyword = ForumTags.GetTagsByTopicId(topic.Tid);
            }

            //更新页面Meta中的keyword,description项, 提高SEO友好性
            UpdateMetaInfo(seokeyword, metadescritpion, config.Seohead);
        }
コード例 #4
0
        /// <summary>
        /// 读取主题标签缓存文件
        /// </summary>
        private void GetTopicTags()
        {
            if (DNTRequest.GetInt("topicid", 0) > 0)
            {
                StringBuilder dir = new StringBuilder();
                dir.Append(BaseConfigs.GetForumPath);
                dir.Append("cache/topic/magic/");
                dir.Append((DNTRequest.GetInt("topicid", 0) / 1000 + 1).ToString());
                dir.Append("/");
                string filename = Utils.GetMapPath(dir.ToString() + DNTRequest.GetInt("topicid", 0) + "_tags.config");
                if (!File.Exists(filename))
                {
                    ForumTags.WriteTopicTagsCacheFile(DNTRequest.GetInt("topicid", 0));
                }

                WriteFile(filename);
            }
        }
コード例 #5
0
ファイル: TagsEvent.cs プロジェクト: xslonglianxia/DiscuzNT
        public void Execute(object state)
        {
            SpacePluginBase spb = SpacePluginProvider.GetInstance();

            AlbumPluginBase apb = AlbumPluginProvider.GetInstance();

            ForumTags.WriteHotTagsListForForumCacheFile(60);
            ForumTags.WriteHotTagsListForForumJSONPCacheFile(60);
            if (spb != null)
            {
                spb.WriteHotTagsListForSpaceJSONPCacheFile(60);
            }
            if (apb != null)
            {
                apb.WriteHotTagsListForPhotoJSONPCacheFile(60);
            }

            MallPluginBase imp = MallPluginProvider.GetInstance();

            if (imp != null)
            {
                imp.WriteHotTagsListForGoodsJSONPCacheFile(60);
            }
        }
コード例 #6
0
        /// <summary>
        /// 设置相关主题信息
        /// </summary>
        /// <param name="pollitem"></param>
        /// <param name="topicprice"></param>
        /// <param name="postmessage"></param>
        private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage)
        {
            if (postinfo.Layer == 0)
            {
                ///修改投票信息
                StringBuilder itemvaluelist = new StringBuilder("");
                if (topic.Special == 1)
                {
                    string pollItemname = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim());

                    if (!Utils.StrIsNullOrEmpty(pollItemname))
                    {
                        int multiple   = DNTRequest.GetString("multiple") == "on" ? 1 : 0;
                        int maxchoices = DNTRequest.GetInt("maxchoices", 0);

                        if (multiple == 1 && maxchoices > pollitem.Length)
                        {
                            maxchoices = pollitem.Length;
                        }

                        if (!Polls.UpdatePoll(topic.Tid, multiple, pollitem.Length, DNTRequest.GetFormString("PollOptionID").Trim(), pollItemname, DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(), DNTRequest.GetString("enddatetime"), maxchoices, DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0))
                        {
                            AddErrLine("投票错误,请检查显示顺序");
                            return;
                        }
                    }
                    else
                    {
                        AddErrLine("投票项为空");
                        return;
                    }
                }

                //修改辩论信息
                if (topic.Special == 4)
                {
                    debateinfo.Positiveopinion = DNTRequest.GetString("positiveopinion");
                    debateinfo.Negativeopinion = DNTRequest.GetString("negativeopinion");
                    debateinfo.Terminaltime    = TypeConverter.StrToDateTime(DNTRequest.GetString("terminaltime"));
                    if (!Debates.UpdateDebateTopic(debateinfo))
                    {
                        AddErrLine("辩论修改选择了无效的主题");
                        return;
                    }
                }

                int iconid = DNTRequest.GetInt("iconid", 0);
                topic.Iconid = (iconid > 15 || iconid < 0) ? 0 : iconid;
                topic.Title  = postinfo.Title;

                //悬赏差价处理
                if (topic.Special == 2)
                {
                    int pricediff = topicprice - topic.Price;
                    if (pricediff > 0)
                    {
                        if (bonusCreditsTrans < 1 || bonusCreditsTrans > 8)
                        {
                            AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return;
                        }
                        //扣分
                        if (usergroupinfo.Radminid != 1 && Users.GetUserExtCredits(topic.Posterid, bonusCreditsTrans) < pricediff)
                        {
                            AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[bonusCreditsTrans] + " 不足, 无法追加悬赏");
                            return;
                        }
                        else
                        {
                            topic.Price = topicprice;
                            Users.UpdateUserExtCredits(topic.Posterid, bonusCreditsTrans,
                                                       -pricediff * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付
                        }
                    }
                    else if (pricediff < 0 && usergroupinfo.Radminid != 1)
                    {
                        AddErrLine("不能降低悬赏价格");
                        return;
                    }
                }
                else if (topic.Special == 0)//普通主题,出售
                {
                    topic.Price = topicprice;
                }
                if (usergroupinfo.Allowsetreadperm == 1)
                {
                    topic.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0);
                }

                if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
                {
                    topic.Hide = 1;
                }

                topic.Typeid = DNTRequest.GetFormInt("typeid", 0);

                htmltitle = DNTRequest.GetString("htmltitle").Trim();
                if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topic.Title)
                {
                    //按照  附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储,  11001
                    topic.Magic = 11000;
                }
                else
                {
                    topic.Magic = 0;
                }

                topic.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topic, message, disablepostctrl);

                ForumTags.DeleteTopicTags(topic.Tid);
                Topics.DeleteRelatedTopics(topic.Tid);
                string tags = DNTRequest.GetString("tags").Trim();
                if (enabletag && !Utils.StrIsNullOrEmpty(tags))
                {
                    if (ForumUtils.InBanWordArray(tags))
                    {
                        AddErrLine("标签中含有系统禁止词语,请修改");
                        return;
                    }

                    string[] tagArray = Utils.SplitString(tags, " ", true, 2, 10);
                    if (tagArray.Length > 0 && tagArray.Length <= 5)
                    {
                        topic.Magic = Topics.SetMagicValue(topic.Magic, MagicType.TopicTag, 1);
                        ForumTags.CreateTopicTags(tagArray, topic.Tid, userid, Utils.GetDateTime());
                    }
                    else
                    {
                        AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                        return;
                    }
                }

                Topics.UpdateTopic(topic);

                //保存htmltitle
                if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topic.Title)
                {
                    Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topic.Tid);
                }
            }
            else
            {
                if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
                {
                    topic.Hide = 1;
                    Topics.UpdateTopic(topic);
                }
            }
        }
コード例 #7
0
        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");
            }
        }
コード例 #8
0
ファイル: tags.aspx.cs プロジェクト: object8421/ichari
        protected override void ShowPage()
        {
            if (config.Enabletag != 1)
            {
                AddErrLine("没有启用Tag功能");
                return;
            }

            tagid = DNTRequest.GetInt("tagid", 0);

            if (tagid > 0)
            {
                tag = Tags.GetTagInfo(tagid);
                if (tag == null)
                {
                    AddErrLine("指定的标签不存在");
                    return;
                }

                if (tag.Orderid < 0)
                {
                    AddErrLine("指定的标签已被关闭");
                }

                if (IsErr())
                {
                    return;
                }

                listtype = DNTRequest.GetString("t");

                pageid = DNTRequest.GetInt("page", 1);
                if (pageid < 1)
                {
                    pageid = 1;
                }
                pagetitle = tag.Tagname;
                if (listtype.Equals(""))
                {
                    listtype = "topic";
                }
                switch (listtype)
                {
                case "topic":
                    topiccount = Topics.GetTopicsCountWithSameTag(tagid);
                    pagecount  = topiccount % config.Tpp == 0 ? topiccount / config.Tpp : topiccount / config.Tpp + 1;

                    if (pagecount == 0)
                    {
                        pagecount = 1;
                    }
                    if (pageid > pagecount)
                    {
                        pageid = pagecount;
                    }

                    if (topiccount > 0)
                    {
                        topiclist   = Topics.GetTopicsWithSameTag(tagid, pageid, config.Tpp);
                        pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=topic&tagid=" + tagid, 8);
                    }
                    else
                    {
                        AddMsgLine("该标签下暂无主题");
                    }
                    break;
                }
            }
            else
            {
                pagetitle = "标签";

                taglist = ForumTags.GetCachedHotForumTags(100);
            }
        }
コード例 #9
0
        protected override void ShowPage()
        {
            pagetitle = "首页";

            if (config.Rssstatus == 1)
            {
                AddLinkRss("tools/rss.aspx", "最新主题");
            }

            // 得到公告
            announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
            if (announcementlist != null)
            {
                announcementcount = announcementlist.Rows.Count;
            }

            // 友情链接
            forumlinkcount = forumlinklist.Rows.Count;

            Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts);

            // 获得统计信息
            totalusers       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers"));
            lastusername     = Statistics.GetStatisticsRowItem("lastusername");
            lastuserid       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"));
            yesterdayposts   = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts"));
            highestposts     = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts"));
            highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim();
            if (todayposts > highestposts)
            {
                highestposts     = todayposts;
                highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            totalonline = onlineusercount;
            OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);

            highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
            highestonlineusertime  = Statistics.GetStatisticsRowItem("highestonlineusertime");

            if (userid != -1)
            {
                score = Scoresets.GetValidScoreName();
                ShortUserInfo user = Users.GetShortUserInfo(userid);
                score1 = ((decimal)user.Extcredits1).ToString();
                score2 = ((decimal)user.Extcredits2).ToString();
                score3 = ((decimal)user.Extcredits3).ToString();
                score4 = ((decimal)user.Extcredits4).ToString();
                score5 = ((decimal)user.Extcredits5).ToString();
                score6 = ((decimal)user.Extcredits6).ToString();
                score7 = ((decimal)user.Extcredits7).ToString();
                score8 = ((decimal)user.Extcredits8).ToString();
            }
            //相册

            if (config.Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null)
            {
                albumcategorylist = AlbumPluginProvider.GetInstance().GetAlbumCategory();
            }

            if (config.Enablespace == 1 && AggregationFacade.SpaceAggregation.GetSpaceTopComments() != null)
            {
                topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments();
            }

            taglist  = (config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0]);
            doublead = Advertisements.GetDoubleAd("indexad", 0);
            floatad  = Advertisements.GetFloatAd("indexad", 0);
        }
コード例 #10
0
        //private bool isModer = false;

        protected override void ShowPage()
        {
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            if (post == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }
            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid    = topic.Fid;
            forum      = Forums.GetForumInfo(forumid);
            forumname  = forum.Name;
            pagetitle  = string.Format("删除{0}", post.Title);
            forumnav   = ShowForumAspxRewrite(forum.Pathlist.Trim(), forumid, forumpageid);

            if (!CheckPermission(post, DNTRequest.GetInt("opinion", -1)))
            {
                return;
            }

            if (!allowDelPost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            // 通过验证的用户可以删除帖子,如果是主题帖则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);
                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                    Debates.DeleteDebatePost(topicid, DNTRequest.GetInt("opinion", -1), postid);
                }
                else
                {
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                }

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);
                //再次确保回复数精确
                Topics.UpdateTopicReplyCount(topic.Tid);
                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24) < 0)
                {
                    UserCredits.UpdateUserCreditsByDeletePosts(post.Posterid);
                }
            }

            SetUrl(post.Layer == 0 ? base.ShowForumAspxRewrite(post.Fid, 0) : Urls.ShowTopicAspxRewrite(post.Tid, 1));
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }
コード例 #11
0
ファイル: TagsEvent.cs プロジェクト: object8421/ichari
 public void Execute(object state)
 {
     ForumTags.WriteHotTagsListForForumCacheFile(60);
     ForumTags.WriteHotTagsListForForumJSONPCacheFile(60);
 }
コード例 #12
0
ファイル: forumindex.aspx.cs プロジェクト: terryxym/DiscuzNT
        protected override void ShowPage()
        {
            pagetitle = "首页";
            if (userid > 0 && useradminid > 0)
            {
                AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                if (admingroupinfo != null)
                {
                    disablepostctrl = admingroupinfo.Disablepostctrl;
                }
            }

            int toframe = DNTRequest.GetInt("f", 1);

            if (toframe == 0)
            {
                ForumUtils.WriteCookie("isframe", "1");
            }
            else
            {
                toframe = Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1) == -1 ? config.Isframeshow : Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1);
            }

            if (toframe == 2)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx");
                HttpContext.Current.Response.End();
                return;
            }

            if (config.Rssstatus == 1)
            {
                AddLinkRss("tools/rss.aspx", "最新主题");
            }

            OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout);

            //if (newpmcount > 0)
            //    pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid,5,1,1);

            if (userid != -1)
            {
                userinfo = Users.GetShortUserInfo(userid);
                if (userinfo == null)
                {
                    userid = -1;
                    ForumUtils.ClearUserCookie("dnt");
                }
                else
                {
                    newpmcount = userinfo.Newpm == 0 ? 0 : newpmcount;
                    lastvisit  = userinfo.Lastvisit.ToString();
                    showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4;
                }
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

            forumlist      = Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts);
            forumlinkcount = forumlinklist.Rows.Count;

            //个人空间控制
            if (config.Enablespace == 1)
            {
                GetSpacePerm();
            }

            // 获得统计信息
            totalusers       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers"));
            lastusername     = Statistics.GetStatisticsRowItem("lastusername").Trim();
            lastuserid       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"));
            yesterdayposts   = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts"));
            highestposts     = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts"));
            highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim();
            if (todayposts > highestposts)
            {
                highestposts     = todayposts;
                highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            totalonline     = onlineusercount;
            showforumonline = false;
            onlineiconlist  = Caches.GetOnlineGroupIconList();
            if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                showforumonline = true;
                //获得在线用户列表和图标
                onlineuserlist = OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);
            }

            if (DNTRequest.GetString("showonline") == "no")
            {
                showforumonline = false;
            }

            highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
            highestonlineusertime  = DateTime.Parse(Statistics.GetStatisticsRowItem("highestonlineusertime")).ToString("yyyy-MM-dd HH:mm");
            // 得到公告
            announcementlist  = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
            announcementcount = announcementlist != null ? announcementlist.Rows.Count : 0;

            List <IndexPageForumInfo> topforum = new List <IndexPageForumInfo>();

            foreach (IndexPageForumInfo f in forumlist)
            {
                f.Description = UBB.ParseSimpleUBB(f.Description);
                if (f.Layer == 0)
                {
                    topforum.Add(f);
                }
            }

            taglist = config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0];

            ///得到广告列表
            headerad   = Advertisements.GetOneHeaderAd("indexad", 0);
            footerad   = Advertisements.GetOneFooterAd("indexad", 0);
            inforumad  = Advertisements.GetInForumAd("indexad", 0, topforum, templatepath);
            pagewordad = Advertisements.GetPageWordAd("indexad", 0);
            doublead   = Advertisements.GetDoubleAd("indexad", 0);
            floatad    = Advertisements.GetFloatAd("indexad", 0);
            mediaad    = Advertisements.GetMediaAd(templatepath, "indexad", 0);
            pagead     = Advertisements.GetPageAd("indexad", 0);

            if (userid > 0)
            {
                if (oluserinfo.Newpms < 0)
                {
                    Users.UpdateUserNewPMCount(userid, olid);
                }
            }
        }
コード例 #13
0
        /// <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);
        }
コード例 #14
0
        protected override void ShowPage()
        {
            // 获取帖子ID
            topicid = DNTRequest.GetInt("topicid", -1);
            postid  = DNTRequest.GetInt("postid", -1);
            // 如果主题ID非数字
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            // 如果该帖子不存在
            if (post == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);

            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid    = topic.Fid;
            forum      = Forums.GetForumInfo(forumid);
            forumname  = forum.Name;
            pagetitle  = "删除" + post.Title;
            forumnav   = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
            int opinion = DNTRequest.GetInt("opinion", -1);

            if (!CheckPermission(post, opinion))
            {
                return;
            }

            if (!allowdelpost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            int Losslessdel = Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24);

            // 通过验证的用户可以删除帖子,如果是主题贴则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);

                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    string opiniontext = "";

                    if (opinion != 1 && opinion != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true);
                    switch (opinion)
                    {
                    case 1:
                        opiniontext = "positivediggs";
                        break;

                    case 2:
                        opiniontext = "negativediggs";
                        break;
                    }
                    Discuz.Data.DatabaseProvider.GetInstance().DeleteDebatePost(topicid, opiniontext, postid);
                }
                else
                {
                    reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true);
                }

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);

                //再次确保回复数精确
                Topics.UpdateTopicReplies(topic.Tid);

                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Losslessdel < 0)
                {
                    UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1);
                }
            }


            SetUrl(Urls.ShowTopicAspxRewrite(post.Tid, 1));
            if (post.Layer == 0)
            {
                SetUrl(base.ShowForumAspxRewrite(post.Fid, 0));
            }
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }