Exemplo n.º 1
0
        private int ShowForumLogin()
        {
            int result = 1;

            if (String.IsNullOrEmpty(forum.Password))
            {
                result = 0;
            }
            else
            {
                if (Utils.MD5(forum.Password) == ForumUtils.GetCookie("forum" + forumid + "password"))
                {
                    result = 0;
                }
                else
                {
                    if (forum.Password == DNTRequest.GetString("forumpassword"))
                    {
                        ForumUtils.WriteCookie("forum" + forumid + "password", Utils.MD5(forum.Password));
                        result = 0;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 显示登陆窗体
        /// </summary>
        /// <returns></returns>
        private int ShowForumLogin()
        {
            // 是否显示版块密码提示 1为显示, 0不显示
            int showforumlogin = 1;

            // 如果版块未设密码
            if (forum.Password == "")
            {
                showforumlogin = 0;
            }
            else
            {
                // 如果检测到相应的cookie正确
                if (Utils.MD5(forum.Password) == ForumUtils.GetCookie("forum" + forumid + "password"))
                {
                    showforumlogin = 0;
                }
                else
                {
                    // 如果用户提交的密码正确则保存cookie
                    if (forum.Password == DNTRequest.GetString("forumpassword"))
                    {
                        ForumUtils.WriteCookie("forum" + forumid + "password", Utils.MD5(forum.Password));
                        showforumlogin = 0;
                    }
                }
            }
            return(showforumlogin);
        }
Exemplo n.º 3
0
        //直接从原来的方法拷贝过来,进行了修改
        public static string GetVoters(int tid, int userid, string username, out bool allowvote)
        {
            var    poll             = Poll.FindByTid(tid);
            string pollUserNameList = poll == null ? "" : poll.Voternames;// BBX.Data.Polls.GetPollUserNameList(tid);

            allowvote = true;
            if (pollUserNameList.IsNullOrEmpty())
            {
                return("<li>暂无人投票</li>");
            }
            string[] array = Utils.SplitString(pollUserNameList.Trim(), "\r\n");
            var      sb    = new StringBuilder();

            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].Trim() == username)
                {
                    allowvote = false;
                }
                if (userid == -1 && Utils.InArray(tid.ToString(), ForumUtils.GetCookie("polled")))
                {
                    allowvote = false;
                }
                if (array[i].IndexOf(' ') == -1)
                {
                    sb.AppendFormat("<li><a href=\"userinfo.aspx?username={0}\">{1}</a></li>", Utils.UrlEncode(array[i].Trim()), array[i]);
                }
                else
                {
                    sb.Append(array[i].Substring(0, array[i].LastIndexOf(".") + 1).Trim().Replace(" ", string.Empty) + "]");
                }
                sb.Append("&nbsp; ");
            }
            return(sb.ToString());
        }
Exemplo n.º 4
0
        protected override void ShowPage()
        {
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            string referer = ForumUtils.GetCookie("referer");

            // 获取主题ID
            topicid = DNTRequest.GetInt("topicid", -1);
            albumid = DNTRequest.GetInt("albumid", -1);
            blogid  = DNTRequest.GetInt("postid", -1);
            goodsid = DNTRequest.GetInt("goodsid", -1);

            if (topicid != -1)//收藏的是主题
            {
                // 获取该主题的信息
                TopicInfo topic = Topics.GetTopicInfo(topicid);
                // 如果该主题不存在
                if (topic == null)
                {
                    AddErrLine("不存在的主题ID");
                    return;
                }

                topictitle = topic.Title;
                forumid    = topic.Fid;
                forum      = Forums.GetForumInfo(forumid);
                forumname  = forum.Name;
                pagetitle  = Utils.RemoveHtml(forum.Name);
                forumnav   = forum.Pathlist;

                // 检查用户是否拥有足够权限
                if (config.Maxfavorites <= Favorites.GetFavoritesCount(userid))
                {
                    AddErrLine("您收藏的主题数目已经达到系统设置的数目上限");
                    return;
                }

                if (Favorites.CheckFavoritesIsIN(userid, topicid) != 0)
                {
                    AddErrLine("您过去已经收藏过这个主题,请返回");
                    return;
                }

                if (Favorites.CreateFavorites(userid, topicid) > 0)
                {
                    AddMsgLine("指定主题已成功添加到收藏夹中,现在将回到上一页");
                    SetUrl(referer);
                    SetMetaRefresh();
                    SetShowBackLink(false);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 标识主题为已读
        /// </summary>
        /// <param name="topic"></param>
        public static void MarkOldTopic(TopicInfo topic)
        {
            string oldtopic = ForumUtils.GetCookie("oldtopic") + "D";

            if (oldtopic.IndexOf("D" + topic.Tid.ToString() + "D") == -1 && DateTime.Now.AddMinutes(-1 * 600) < DateTime.Parse(topic.Lastpost))
            {
                oldtopic = "D" + topic.Tid.ToString() + Utils.CutString(oldtopic, 0, oldtopic.Length - 1);
                if (oldtopic.Length > 3000)
                {
                    oldtopic = Utils.CutString(oldtopic, 0, 3000);
                    oldtopic = Utils.CutString(oldtopic, 0, oldtopic.LastIndexOf("D"));
                }
                ForumUtils.WriteCookie("oldtopic", oldtopic);
            }
        }
Exemplo n.º 6
0
        private void GetOnlineUserInfo()
        {
            oluserid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1);
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            olid       = oluserinfo.Olid;
            oluserid   = oluserinfo.Userid;
            olusername = oluserinfo.Username;
            string password = oluserinfo.Password;

            if (password.Length > 16)
            {
                oluserkey = password.Substring(4, 8).Trim();
            }
            else
            {
                oluserkey = "";
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取参与投票者名单
        /// </summary>
        /// <param name="tid">投票的主题id</param>
        /// <param name="userid">当前投票用户id</param>
        /// <param name="username">当前投票用户名</param>
        /// <param name="allowvote">是否允许投票</param>
        /// <returns>参与投票者名单</returns>
        public static string GetVoters(int tid, int userid, string username, out bool allowvote)
        {
            string strUsernamelist = DatabaseProvider.GetInstance().GetPollUserNameList(tid);

            // 如果已投票用户uid列表为"" (尚无人投票), 则立即返回true
            allowvote = true;
            if (strUsernamelist.Equals(""))
            {
                return("");
            }
            string[]      votername = Utils.SplitString(strUsernamelist.Trim(), "\r\n");
            StringBuilder sbVoters  = new StringBuilder();

            for (int i = 0; i < votername.Length; i++)
            {
                if (votername[i].Trim() == username)
                {
                    allowvote = false;
                }

                if (userid == -1 && Utils.InArray(tid.ToString(), ForumUtils.GetCookie("dnt_polled")))
                {
                    allowvote = false;
                }

                if (votername[i].IndexOf(' ') == -1)
                {
                    sbVoters.Append("<a href=\"userinfo.aspx?username="******"\">");
                    sbVoters.Append(votername[i]);
                    sbVoters.Append("</a>");
                }
                else
                {
                    sbVoters.Append(votername[i].Substring(0, votername[i].LastIndexOf(".") + 1).Trim().Replace(" ", string.Empty) + "]");
                }
                sbVoters.Append("&nbsp; ");
            }

            return(sbVoters.ToString());
        }
Exemplo n.º 8
0
        protected override void ShowPage()
        {
            this.pagetitle = "分栏";
            int num = DNTRequest.GetInt("f", 1);

            if (num == 1)
            {
                ForumUtils.WriteCookie("isframe", "1");
            }
            else
            {
                num = ForumUtils.GetCookie("isframe").ToInt(-1);
                num = ((num == -1) ? this.config.Isframeshow : num);
            }
            if (num == 0)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath);
                HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 9
0
        public SpacePage()
        {
            //去掉http地址中的文件名称
            if (forumurl.ToLower().IndexOf("http://") == 0)
            {
                forumurlnopage = forumurl.Substring(0, forumurl.LastIndexOf('/')) + "/";
            }
            else
            {
                forumurl = "../" + forumurl;
            }

            if (GeneralConfigs.GetConfig().Enablespace != 1)
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Write("<script>alert('" + spacename + "功能已被关闭!');document.location = '" + forumurl + "';</script>");
                HttpContext.Current.Response.End();
                return;
            }
            userid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1);
            config = SpaceActiveConfigs.GetConfig();
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(GeneralConfigs.GetConfig().Passwordkey, GeneralConfigs.GetConfig().Onlinetimeout);

            olid     = oluserinfo.Olid;
            userid   = oluserinfo.Userid;
            username = oluserinfo.Username;
            password = oluserinfo.Password;
            if (password.Length > 16)
            {
                userkey = password.Substring(4, 8).Trim();
            }
            else
            {
                userkey = "";
            }

            if (!IsPostBack)
            {
                OutputSpacePage();
            }
        }
Exemplo n.º 10
0
        protected override void ShowPage()
        {
            pagetitle = "分栏";
            int toframe = DNTRequest.GetInt("f", 1);

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

            if (toframe == 0)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath);
                HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 加载主题图标信息
        /// </summary>
        /// <param name="autocloseTime">自动关闭时间(单位:小时)</param>
        /// <param name="newMinutes">新主题失效</param>
        /// <param name="hotReplyNumber">热帖基数</param>
        /// <param name="topicInfo">主题</param>
        private static void LoadTopicFolder(int autocloseTime, int newMinutes, int hotReplyNumber, TopicInfo topicInfo)
        {
            //处理关闭标记
            if (topicInfo.Closed == 0)
            {
                string oldtopic = ForumUtils.GetCookie("oldtopic") + "D";
                if (newMinutes > 0 && oldtopic.IndexOf("D" + topicInfo.Tid.ToString() + "D") == -1 && DateTime.Now.AddMinutes(-1 * newMinutes) < TypeConverter.StrToDateTime(topicInfo.Lastpost))
                {
                    topicInfo.Folder = "new";
                }
                else
                {
                    topicInfo.Folder = "old";
                }

                if (hotReplyNumber > 0 && topicInfo.Replies >= hotReplyNumber)
                {
                    topicInfo.Folder += "hot";
                }

                if (autocloseTime > 0 && Utils.StrDateDiffHours(topicInfo.Postdatetime, autocloseTime * 24) > 0)
                {
                    topicInfo.Closed = 1;
                    topicInfo.Folder = "closed";
                }
            }
            else
            {
                topicInfo.Folder = "closed";
                if (topicInfo.Closed > 1)
                {
                    int trueTid = topicInfo.Tid;
                    topicInfo.Tid    = topicInfo.Closed;
                    topicInfo.Closed = trueTid;
                    topicInfo.Folder = "move";
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 检验版块密码
        /// </summary>
        /// <returns></returns>
        public bool ValidateForumPassword()
        {
            if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                if (config.Aspxrewrite == 1)
                {
                    System.Web.HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "showforum-" + forumid + config.Extname, true);
                }
                else
                {
                    System.Web.HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "showforum.aspx?forumid=" + forumid + "&forumpage=" + forumpageid, true);
                }

                return(false);
            }
            return(true);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 用户在线信息维护。判断当前用户的身份(会员还是游客),是否在在线列表中存在,如果存在则更新会员的当前动,不存在则建立.
        /// </summary>
        /// <param name="passwordkey">论坛passwordkey</param>
        /// <param name="timeout">在线超时时间</param>
        /// <param name="passwd">用户密码</param>
        public static OnlineUserInfo UpdateInfo(string passwordkey, int timeout, int uid, string passwd)
        {
            lock (SynObject)
            {
                OnlineUserInfo onlineuser = new OnlineUserInfo();
                string         ip         = DNTRequest.GetIP();
                int            userid     = TypeConverter.StrToInt(ForumUtils.GetCookie("userid"), uid);
                string         password   = (Utils.StrIsNullOrEmpty(passwd) ? ForumUtils.GetCookiePassword(passwordkey) : ForumUtils.GetCookiePassword(passwd, passwordkey));

                // 如果密码非Base64编码字符串则怀疑被非法篡改, 直接置身份为游客
                if (password.Length == 0 || !Utils.IsBase64String(password))
                {
                    userid = -1;
                }

                if (userid != -1)
                {
                    onlineuser = GetOnlineUser(userid, password);

                    //更新流量统计
                    if (!DNTRequest.GetPageName().EndsWith("ajax.aspx") && GeneralConfigs.GetConfig().Statstatus == 1)
                    {
                        Stats.UpdateStatCount(false, onlineuser != null);
                    }

                    if (onlineuser != null)
                    {
                        if (onlineuser.Ip != ip)
                        {
                            UpdateIP(onlineuser.Olid, ip);
                            onlineuser.Ip = ip;
                            return(onlineuser);
                        }
                    }
                    else
                    {
                        // 判断密码是否正确
                        userid = Users.CheckPassword(userid, password, false);
                        if (userid != -1)
                        {
                            Discuz.Data.OnlineUsers.DeleteRowsByIP(ip);
                            CheckIp(ip);
                            return(CreateUser(userid, timeout));
                        }
                        else
                        {
                            CheckIp(ip);
                            // 如密码错误则在在线表中创建游客
                            onlineuser = GetOnlineUserByIP(-1, ip);
                            if (onlineuser == null)
                            {
                                return(CreateGuestUser(timeout));
                            }
                        }
                    }
                }
                else
                {
                    onlineuser = GetOnlineUserByIP(-1, ip);
                    //更新流量统计
                    if (!DNTRequest.GetPageName().EndsWith("ajax.aspx") && GeneralConfigs.GetConfig().Statstatus == 1)
                    {
                        Stats.UpdateStatCount(true, onlineuser != null);
                    }

                    if (onlineuser == null)
                    {
                        return(CreateGuestUser(timeout));
                    }
                }

                //onlineuser.Lastupdatetime = Utils.GetDateTime();  为了客户端能够登录注释此句,如有问题再修改。
                return(onlineuser);
            }
        }
Exemplo n.º 14
0
        private string GetAllowviewForums(string forums)
        {
            if (!Utils.IsNumericList(forums))
            {
                return("");
            }
            string text = "";

            string[] array = forums.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                string text2     = array[i];
                int    num       = text2.ToInt(0);
                var    forumInfo = Forums.GetForumInfo(num);
                if (forumInfo != null && forumInfo.Layer != 0 && forumInfo.Visible && forumInfo.AllowView(usergroupid) && (forumInfo.Password.IsNullOrEmpty() || Utils.MD5(forumInfo.Password.Trim()) == ForumUtils.GetCookie("forum" + text2.Trim() + "password")))
                {
                    text += string.Format(",{0}", num);
                }
            }
            return(text.Trim(','));
        }
Exemplo n.º 15
0
        protected override void ShowPage()
        {
            topictitle = "";
            forumnav   = "";

            ////加载帖内广告
            //inpostad = Advertisements.GetInPostAd("", fid, templatepath, postlist.Count > ppp ? ppp : postlist.Count);

            //AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(useradminid);

            showpayments = DNTRequest.GetInt("showpayments", 0);
            buyit        = DNTRequest.GetInt("buyit", 0);
            topicid      = DNTRequest.GetInt("topicid", -1);
            // 如果主题ID非数字
            if (topicid == -1)
            {
                AddErrLine(WRONG_TOPIC);
                return;
            }

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

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

            if (topic.Posterid == userid)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            if (topic.Price <= 0)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            topictitle = topic.Title.Trim();
            topicprice = topic.Price;
            poster     = topic.Poster;
            posterid   = topic.Posterid;
            pagetitle  = topictitle.Trim();
            forumid    = topic.Fid;
            ForumInfo forum = Forums.GetForumInfo(forumid);

            forumname = forum.Name.Trim();
            forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            price = 0;
            if (topic.Price > 0)
            {
                price = topic.Price;
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买
                {
                    price = -1;
                }
            }

            if (useradminid != 0)
            {
                ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
            }

            if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid && useradminid != 1 &&
                ismoder != 1)
            {
                AddErrLine(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.Readperm.ToString(), usergroupinfo.Grouptitle));
                return;
            }

            if (topic.Displayorder == -1)
            {
                AddErrLine("此主题已被删除!");
                return;
            }

            if (topic.Displayorder == -2)
            {
                AddErrLine("此主题未经审核!");
                return;
            }

            if (forum.Password != "" &&
                Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                //SetBackLink("showforum-" + forumid.ToString() + config.Extname);
                HttpContext.Current.Response.Redirect("showforum-" + forumid.ToString() + config.Extname, true);
                return;
            }

            if (!Forums.AllowViewByUserID(forum.Permuserlist, userid))        //判断当前用户在当前版块浏览权限
            {
                if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限
                {
                    if (usergroupinfo.Allowvisit != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限");
                        return;
                    }
                }
                else //当板块权限不为空,按照板块权限
                {
                    if (!Forums.AllowView(forum.Viewperm, usergroupid))
                    {
                        AddErrLine("您没有浏览该版块的权限");
                        return;
                    }
                }
            }

            userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetCreditsTrans());
            maxincpertopic     = Scoresets.GetMaxIncPerTopic();
            maxchargespan      = Scoresets.GetMaxChargeSpan();
            creditstax         = Scoresets.GetCreditsTax() * 100;

            netamount = topicprice - topicprice * creditstax / 100;
            if (topicprice > maxincpertopic)
            {
                netamount = maxincpertopic - maxincpertopic * creditstax / 100;
            }

            if (price != -1)
            {
                IDataReader reader = Users.GetUserInfoToReader(userid);
                if (reader == null)
                {
                    AddErrLine(NO_PERMISSION);
                    return;
                }

                if (!reader.Read())
                {
                    AddErrLine(NO_PERMISSION);
                    reader.Close();
                    return;
                }

                if (Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) < topic.Price)
                {
                    AddErrLine(string.Format(NOT_ENOUGH_MONEY_TO, Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0), topic.Price));
                    reader.Close();

                    return;
                }

                userlastprice = Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) - topic.Price;
                reader.Close();
            }



            //如果不是提交...
            if (!ispost)
            {
                buyers = PaymentLogs.GetPaymentLogByTidCount(topic.Tid);

                //显示购买信息列表
                if (showpayments == 1)
                {
                    //得到当前用户请求的页数
                    pageid = DNTRequest.GetInt("page", 1);
                    //获取主题总数
                    //获取总页数
                    pagecount = buyers % pagesize == 0 ? buyers / pagesize : buyers / pagesize + 1;
                    if (pagecount == 0)
                    {
                        pagecount = 1;
                    }
                    //修正请求页数中可能的错误
                    if (pageid < 1)
                    {
                        pageid = 1;
                    }
                    if (pageid > pagecount)
                    {
                        pageid = pagecount;
                    }

                    //获取收入记录并分页显示
                    paymentloglist = PaymentLogs.GetPaymentLogByTid(pagesize, pageid, topic.Tid);
                }

                //判断是否为回复可见帖, hide=0为非回复可见(正常), hide>0为回复可见, hide=-1为回复可见但当前用户已回复
                int hide = 0;
                if (topic.Hide == 1)
                {
                    hide = topic.Hide;
                    if (Posts.IsReplier(topicid, userid))
                    {
                        hide = -1;
                    }
                }

                PostpramsInfo _postpramsinfo = new PostpramsInfo();
                _postpramsinfo.Fid                = forum.Fid;
                _postpramsinfo.Tid                = topicid;
                _postpramsinfo.Jammer             = forum.Jammer;
                _postpramsinfo.Pagesize           = 5;
                _postpramsinfo.Pageindex          = 1;
                _postpramsinfo.Getattachperm      = forum.Getattachperm;
                _postpramsinfo.Usergroupid        = usergroupid;
                _postpramsinfo.Attachimgpost      = config.Attachimgpost;
                _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
                _postpramsinfo.Hide               = hide;
                _postpramsinfo.Price              = price;
                _postpramsinfo.Ubbmode            = false;

                _postpramsinfo.Showimages             = forum.Allowimgcode;
                _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                _postpramsinfo.Bbcodemode             = config.Bbcodemode;

                lastpostlist = Posts.GetLastPostList(_postpramsinfo);
            }
            else
            {
                int reval = PaymentLogs.BuyTopic(userid, topic.Tid, topic.Posterid, topic.Price, netamount);
                if (reval > 0)
                {
                    SetUrl(base.ShowTopicAspxRewrite(topic.Tid, 0));

                    SetMetaRefresh();
                    SetShowBackLink(false);
                    AddMsgLine(PURCHASE_SUCCESS);
                    return;
                }
                else
                {
                    SetBackLink(base.ShowForumAspxRewrite(topic.Fid, 0));

                    if (reval == -1)
                    {
                        AddErrLine(NOT_ENOUGH_MONEY);
                        return;
                    }
                    else if (reval == -2)
                    {
                        AddErrLine(NO_PERMISSION);
                        return;
                    }
                    else
                    {
                        AddErrLine(UNKNOWN_REASON);
                        return;
                    }
                }
            }
        }
Exemplo n.º 16
0
        protected override void ShowPage()
        {
            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }

            forumpath = BaseConfigs.GetForumPath;
            if (albumid < 1)
            {
                AddErrLine("指定的相册不存在");
                return;
            }

            album = DTOProvider.GetAlbumInfo(albumid);
            if (album == null)
            {
                AddErrLine("指定的相册不存在");
                return;
            }

            if (config.Rssstatus == 1)
            {
                if (GeneralConfigs.GetConfig().Aspxrewrite == 1)
                {
                    photorssurl = string.Format("photorss-{0}{1}", album.Userid, GeneralConfigs.GetConfig().Extname);
                }
                else
                {
                    photorssurl = string.Format("rss.aspx?uid={0}&type=photo", album.Userid);
                }

                AddLinkRss(string.Format("tools/{0}", photorssurl), "最新图片");
            }

            pagetitle = album.Title;

            //权限验证部分,私有相册,不是相册所有者
            if (album.Type == 1 && album.Userid != userid)
            {
                if (ForumUtils.GetCookie("album" + albumid + "password") != Utils.MD5(album.Password))
                {
                    //首先验证Cookie中如果相册密码不正确,则要求输入密码,并以输入值验证
                    string password = DNTRequest.GetFormString("albumpassword");
                    if (album.Password == password)
                    {
                        ForumUtils.WriteCookie("album" + albumid + "password", Utils.MD5(password));
                        needpassword = false;
                    }
                }
                else
                {
                    needpassword = false;
                }
            }
            else
            {
                needpassword = false;
            }

            if (Utils.InArray(usergroupid.ToString(), config.Photomangegroups))
            {
                needpassword = false;
            }

            albumcategory = DTOProvider.GetAlbumCategory(album.Albumcateid);
            photoscount   = DTOProvider.GetSpacePhotosCount(albumid);

            pageCount = photoscount % pageSize == 0 ? photoscount / pageSize : photoscount / pageSize + 1;

            if (pageCount == 0)
            {
                pageCount = 1;
            }

            if (currentpage < 1)
            {
                currentpage = 1;
            }

            if (currentpage > pageCount)
            {
                currentpage = pageCount;
            }

            pagenumbers = Utils.GetPageNumbers(currentpage, pageCount, string.Format("showalbum.aspx?albumid={0}", albumid), 8);
            photolist   = DTOProvider.GetSpacePhotosInfo(DbProvider.GetInstance().SpacePhotosList(pageSize, currentpage, album.Userid, album.Albumid));

            foreach (PhotoInfo photo in photolist)
            {
                //当是远程照片时
                if (photo.Filename.IndexOf("http") < 0)
                {
                    photo.Filename = forumpath + Globals.GetThumbnailImage(photo.Filename);
                }
                else
                {
                    photo.Filename = Globals.GetThumbnailImage(photo.Filename);
                }
            }

            if (photolist.Count == 0)
            {
                AddMsgLine("暂无图片");
            }

            ForumUtils.WriteCookie("referer", string.Format("showalbum.aspx?albumid={0}&page={1}", albumid, currentpage));
        }
Exemplo n.º 17
0
 public bool ValidateForumPassword()
 {
     if (!this.forum.Password.IsNullOrEmpty() && Utils.MD5(this.forum.Password) != ForumUtils.GetCookie("forum" + this.forumid + "password"))
     {
         base.AddErrLine("本版块被管理员设置了密码");
         if (this.config.Aspxrewrite == 1)
         {
             HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "showforum-" + this.forumid + this.config.Extname, true);
         }
         else
         {
             HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "showforum.aspx?forumid=" + this.forumid, true);
         }
         return(false);
     }
     return(true);
 }
Exemplo n.º 18
0
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }

            headerad = "";
            footerad = "";

            // 如果主题ID非数字
            if (goodsid == -1)
            {
                AddErrLine("无效的商品ID");
                return;
            }

            if (userid <= 0)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "login.aspx?reurl=buygoods.aspx?goodsid=" + goodsid);
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);

            //验证不通过则返回
            if (!IsConditionsValid())
            {
                return;
            }

            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(goodsinfo.Categoryid);

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = goodscategoryinfo.Fid;
                forum   = Forums.GetForumInfo(forumid);

                if (forum.Password != "" &&
                    Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
                {
                    AddErrLine("本版块被管理员设置了密码");
                    System.Web.HttpContext.Current.Response.Redirect(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), true);
                    return;
                }

                if (!Forums.AllowViewByUserId(forum.Permuserlist, userid))        //判断当前用户在当前版块浏览权限
                {
                    if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限
                    {
                        if (usergroupinfo.Allowvisit != 1)
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }

                        if (useradminid != 1 && (usergroupinfo.Allowvisit != 1 || usergroupinfo.Allowtrade != 1))
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有进行交易商品的权限");
                            return;
                        }
                    }
                    else//当板块权限不为空,按照板块权限
                    {
                        if (!Forums.AllowView(forum.Viewperm, usergroupid))
                        {
                            AddErrLine("您没有浏览该版块的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }
                    }
                }

                if (!Forums.AllowPostByUserID(forum.Permuserlist, userid))        //判断当前用户在当前版块发布商品权限
                {
                    if (forum.Postperm == null || forum.Postperm == string.Empty) //权限设置为空时,根据用户组权限判断
                    {
                        // 验证用户是否有发布商品的权限
                        if (usergroupinfo.Allowtrade != 1)
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有进行交易商品的权限");
                            return;
                        }
                    }
                    else//权限设置不为空时,根据板块权限判断
                    {
                        if (!Forums.AllowPost(forum.Postperm, usergroupid))
                        {
                            AddErrLine("您没有进行交易商品的权限");
                            return;
                        }
                    }
                }

                forumname = forum.Name;
                pagetitle = goodsinfo.Title;
                forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                forumid = 0;
            }

            ///得到广告列表
            ///头部
            headerad = Advertisements.GetOneHeaderAd("", forumid);
            footerad = Advertisements.GetOneFooterAd("", forumid);
            doublead = Advertisements.GetDoubleAd("", forumid);
            floatad  = Advertisements.GetFloatAd("", forumid);

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

            if (useradminid != 0)
            {
                if (config.Enablemall == 1) //开启普通模式
                {
                    ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
                }
                //得到管理组信息
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            }


            //如果是提交...
            if (ispost)
            {
                //创建商品交易日志
                goodstradelog.Number = DNTRequest.GetInt("number", 0);
                // 商品数不正确
                if (goodstradelog.Number <= 0)
                {
                    AddErrLine("请输入正确的商品数, 请返回修改.");
                    return;
                }
                if (goodsinfo.Amount < goodstradelog.Number)
                {
                    AddErrLine("商品剩余数量不足 (剩余数量为 " + goodsinfo.Amount + ", 而购买数量为 " + goodstradelog.Number + ").");
                    return;
                }

                goodstradelog.Sellerid = goodsinfo.Selleruid;
                goodstradelog.Buyerid  = userid;
                if (goodstradelog.Buyerid == goodstradelog.Sellerid)
                {
                    AddErrLine("买卖双方不能是同一用户.");
                    return;
                }
                goodstradelog.Goodsid       = goodsinfo.Goodsid;
                goodstradelog.Offline       = DNTRequest.GetInt("offline", 0);
                goodstradelog.Orderid       = TradeLogs.GetOrderID();
                goodstradelog.Subject       = goodsinfo.Title;
                goodstradelog.Price         = goodsinfo.Price;
                goodstradelog.Quality       = goodsinfo.Quality;
                goodstradelog.Categoryid    = goodsinfo.Categoryid;
                goodstradelog.Tax           = 0;
                goodstradelog.Locus         = goodsinfo.Locus;
                goodstradelog.Seller        = goodsinfo.Seller;
                goodstradelog.Selleraccount = goodsinfo.Account;
                goodstradelog.Buyer         = username;
                goodstradelog.Buyercontact  = DNTRequest.GetString("buyercontact");
                goodstradelog.Buyercredit   = 0;
                goodstradelog.Buyermsg      = DNTRequest.GetString("buyermsg");
                goodstradelog.Status        = (int)TradeStatusEnum.UnStart;
                goodstradelog.Lastupdate    = DateTime.Now;
                goodstradelog.Buyername     = DNTRequest.GetString("buyername");
                goodstradelog.Buyerzip      = DNTRequest.GetString("buyerzip");
                goodstradelog.Buyerphone    = DNTRequest.GetString("buyerphone");
                goodstradelog.Buyermobile   = DNTRequest.GetString("buyermobile");
                goodstradelog.Transport     = DNTRequest.GetInt("transport", 0);
                goodstradelog.Transportpay  = goodsinfo.Transport;
                goodstradelog.Transportfee  = Convert.ToDecimal(DNTRequest.GetFormFloat("fee", 0).ToString());
                goodstradelog.Tradesum      = goodstradelog.Number * goodstradelog.Price + (goodstradelog.Transportpay == 2 ? goodstradelog.Transportfee : 0);
                goodstradelog.Baseprice     = goodsinfo.Costprice;
                goodstradelog.Discount      = goodsinfo.Discount;
                goodstradelog.Ratestatus    = 0;
                goodstradelog.Message       = "";

                int tradelogid = TradeLogs.CreateTradeLog(goodstradelog);

                if (tradelogid > 0)
                {
                    string jumpurl = "";
                    if (goodstradelog.Offline == 0)
                    {
                        jumpurl = "onlinetrade.aspx?goodstradelogid=" + tradelogid;
                    }
                    else
                    {
                        jumpurl = "offlinetrade.aspx?goodstradelogid=" + tradelogid;
                    }

                    SetUrl(jumpurl);
                    SetMetaRefresh();
                    AddMsgLine("交易单已创建, 现在将转入交易单页面<br />(<a href=\"" + jumpurl + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                }
                else
                {
                    SetUrl("buygoods.aspx?goodsid=" + goodsid);
                    SetMetaRefresh();
                    AddMsgLine("交易单创建错误, 请重新添写交易单<br />(<a href=\"" + "buygoods.aspx?goodsid=" + goodsid + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 获取投票信息
        /// </summary>
        public void GetPollInfo()
        {
            pollinfo = Polls.GetPollInfo(topicid);
            voters   = Polls.GetVoters(topicid, userid, username, out allowvote);

            if (pollinfo.Uid != userid && useradminid != 1)                                                                  //当前用户不是投票发起人或不是管理组成员
            {
                if (pollinfo.Visible == 1 &&                                                                                 //当为投票才可见时
                    (allowvote || (userid == -1 && !Utils.InArray(topicid.ToString(), ForumUtils.GetCookie("dnt_polled"))))) //当允许投票或为游客(且并未投过票时)时
                {
                    showpollresult = false;
                }
            }

            if (Utils.StrIsNullOrEmpty(pollinfo.Expiration))
            {
                pollinfo.Expiration = DateTime.Now.ToString();
            }

            if (DateTime.Parse(pollinfo.Expiration) < DateTime.Now)
            {
                allowvote = false;
            }
        }
Exemplo n.º 20
0
        protected override void ShowPage()
        {
            if (!SetTopicInfo())
            {
                topic = new TopicInfo();
                forum = new ForumInfo();
                return;
            }

            pagetitle = topic.Title.Trim();

            if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forum.Fid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                Response.Redirect(string.Format("{0}showforum-{1}{2}", BaseConfigs.GetForumPath, forum.Fid, config.Extname), true);
                return;
            }
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                return;
            }

            postinfo = Posts.GetTopicPostInfo(topicid);
            if (postinfo.Message.ToLower().Contains("[free]") || postinfo.Message.ToLower().Contains("[/free]"))
            {
                for (Match m = r.Match(postinfo.Message); m.Success; m = m.NextMatch())
                {
                    postmessage += "<br /><div class=\"msgheader\">免费内容:</div><div class=\"msgborder\">" + m.Groups[1] + "</div><br />";
                }
            }

            #region 获取主题售价等相关信息
            topicprice = topic.Price;
            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            if (topic.Price > 0)
            {
                price = topic.Price;
                //判断当前用户是否已经购买
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))
                {
                    price = -1;
                }
            }

            netamount = topicprice - topicprice * creditstax / 100;
            if (topicprice > maxincpertopic)
            {
                netamount = maxincpertopic - maxincpertopic * creditstax / 100;
            }

            if (price != -1)
            {
                UserInfo userInfo = Users.GetUserInfo(userid);

                if (buyit == 1 && !CheckUserExtCredit(userInfo))
                {
                    return;
                }

                userlastprice = Users.GetUserExtCredit(userInfo, Scoresets.GetTopicAttachCreditsTrans()) - topic.Price;
            }
            #endregion

            if (useradminid != 0)
            {
                isModer = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
            }

            //如果不是提交...
            if (!ispost)
            {
                buyers = PaymentLogs.GetPaymentLogByTidCount(topic.Tid);
                //显示购买信息列表
                if (showpayments == 1)
                {
                    //获取总页数
                    pagecount = buyers % pageSize == 0 ? buyers / pageSize : buyers / pageSize + 1;
                    pagecount = pagecount == 0 ? 1 : pagecount;
                    //修正请求页数中可能的错误
                    pageid = pageid < 1 ? 1 : pageid;
                    pageid = pageid > pagecount ? pagecount : pageid;

                    //获取收入记录并分页显示
                    paymentloglist = PaymentLogs.GetPaymentLogByTid(pageSize, pageid, topic.Tid);
                }

                //判断是否为回复可见帖, hide=0为非回复可见(正常), hide>0为回复可见, hide=-1为回复可见但当前用户已回复
                int hide = (topic.Hide == 1 ? topic.Hide : 0);

                if (Posts.IsReplier(topicid, userid))
                {
                    hide = -1;
                }

                lastpostlist = Posts.GetLastPostDataTable(GetPostPramsInfo(hide));
            }
            else
            {
                int reval = PaymentLogs.BuyTopic(userid, topic.Tid, topic.Posterid, topic.Price, netamount);
                if (reval > 0)
                {
                    SetUrl(base.ShowTopicAspxRewrite(topic.Tid, 0));
                    SetMetaRefresh();
                    SetShowBackLink(false);
                    MsgForward("buytopic_succeed");
                    AddMsgLine("购买主题成功,返回该主题");
                    return;
                }
                else
                {
                    SetBackLink(base.ShowForumAspxRewrite(topic.Fid, 0));
                    if (reval == -1)
                    {
                        AddErrLine("对不起,您的账户余额少于交易额,无法进行交易");
                    }
                    else if (reval == -2)
                    {
                        AddErrLine("您无权购买本主题");
                    }
                    else
                    {
                        AddErrLine("未知原因,交易无法进行,给您带来的不方便我们很抱歉");
                    }
                    return;
                }
            }
        }
Exemplo n.º 21
0
        protected override void ShowPage()
        {
            this.pagetitle = "首页";
            if (this.userid > 0 && this.useradminid > 0)
            {
                var adminGroupInfo = AdminGroup.FindByID(this.usergroupid);
                if (adminGroupInfo != null)
                {
                    this.disablepostctrl = adminGroupInfo.DisablePostctrl;
                }
            }
            int num = DNTRequest.GetInt("f", 1);

            if (num == 0)
            {
                ForumUtils.WriteCookie("isframe", "1");
            }
            else
            {
                num = ForumUtils.GetCookie("isframe").ToInt(-1);
                if (num == -1)
                {
                    num = this.config.Isframeshow;
                }
            }
            if (num == 2)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx");
                HttpContext.Current.Response.End();
                return;
            }
            if (this.config.Rssstatus == 1)
            {
                base.AddLinkRss("tools/rss.aspx", "最新主题");
            }
            Online.UpdateAction(this.olid, UserAction.IndexShow, 0, this.config.Onlinetimeout);
            if (this.userid != -1)
            {
                this.userinfo = BBX.Entity.User.FindByID(this.userid);
                if (this.userinfo == null)
                {
                    this.userid = -1;
                    ForumUtils.ClearUserCookie();
                }
                else
                {
                    //this.newpmcount = !userinfo.Newpm ? 0 : this.newpmcount;
                    if (!userinfo.Newpm)
                    {
                        newpmcount = 0;
                    }
                    this.lastvisit  = this.userinfo.LastVisit.ToString();
                    this.showpmhint = (this.userinfo.NewsLetter.ToInt() > 4);
                }
            }
            this.navhomemenu    = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname);
            this.forumlist      = Forums.GetForumIndexCollection(this.config.Hideprivate, this.usergroupid, this.config.Moddisplay, out this.totaltopic, out this.totalpost, out this.todayposts);
            this.forumlinkcount = this.forumlinklist.Rows.Count;
            //if (this.config.Enablespace == 1)
            //{
            //    this.GetSpacePerm();
            //}
            this.totalusers       = Statistic.Current.TotalUsers;
            this.lastusername     = Statistic.Current.LastUserName + "";
            this.lastuserid       = Statistic.Current.LastUserID;
            this.yesterdayposts   = Statistic.Current.YesterdayPosts;
            this.highestposts     = Statistic.Current.HighestPosts;
            this.highestpostsdate = Statistic.Current.HighestPostsDate + "";
            if (this.todayposts > this.highestposts)
            {
                this.highestposts     = this.todayposts;
                this.highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            this.totalonline     = this.onlineusercount;
            this.showforumonline = false;
            this.onlineiconlist  = OnlineList.GetOnlineGroupIconList();
            if (this.totalonline < this.config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                this.showforumonline = true;
                var list = Online.GetList(0, Online._.UserID, true);
                // 根据活跃时间降序
                list.Sort(Online._.LastActivity, true);
                this.onlineuserlist = list;

                var st = Online.GetStat();
                this.totalonline              = st.Total;
                this.totalonlineuser          = st.User;
                this.totalonlineinvisibleuser = st.Invisible;
                this.totalonlineguest         = st.Guest;
            }
            if (DNTRequest.GetString("showonline") == "no")
            {
                this.showforumonline = false;
            }
            this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + "";
            this.highestonlineusertime  = Statistic.Current.HighestOnlineUserTime.ToString("yyyy-MM-dd HH:mm");
            //this.announcementlist = Announcements.GetSimplifiedAnnouncementList(this.nowdatetime, "2999-01-01 00:00:00");
            announcementlist       = Announcement.GetAvailableList();
            this.announcementcount = this.announcementlist != null ? this.announcementlist.Count : 0;
            var fs = new List <IXForum>();

            foreach (var current in this.forumlist)
            {
                current.Description = UBB.ParseSimpleUBB(current.Description);
                if (current.Layer == 0)
                {
                    fs.Add(current);
                }
            }
            this.taglist    = config.Enabletag ? Tag.GetHotForumTags(config.Hottagcount).ToArray() : new Tag[0];
            this.headerad   = Advertisement.GetOneHeaderAd("indexad", 0);
            this.footerad   = Advertisement.GetOneFooterAd("indexad", 0);
            this.inforumad  = Advertisement.GetInForumAd("indexad", 0, fs, this.templatepath);
            this.pagewordad = Advertisement.GetPageWordAd("indexad", 0);
            this.doublead   = Advertisement.GetDoubleAd("indexad", 0);
            this.floatad    = Advertisement.GetFloatAd("indexad", 0);
            this.mediaad    = Advertisement.GetMediaAd(this.templatepath, "indexad", 0);
            this.pagead     = Advertisement.GetPageAd("indexad", 0);
            if (this.userid > 0 && this.oluserinfo.Newpms < 0)
            {
                Users.UpdateUserNewPMCount(this.userid, this.olid);
            }
        }
Exemplo n.º 22
0
        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);
                }
            }
        }
Exemplo n.º 23
0
        private void Page_Load(object sender, EventArgs e)
        {
            //当用户在线信息不正确时,则重新返回登陆页
            if (userid <= 0 || Utils.StrToInt(ForumUtils.GetCookie("userid"), -1) != userid)
            {
                Context.Response.Redirect("../../login.aspx");
                return;
            }

            //已登录
            ShortUserInfo _user = Users.GetShortUserInfo(userid);

            if (_user == null || _user.Spaceid <= 0) //用户还未开通个人空间
            {
                Context.Response.Write("<script type='text/javascript'>alert('您还未开通" + config.Spacename + "!');window.location='../../';</script>");
                Context.Response.End();
                return;
            }

            string[] currentdate = DateTime.Now.ToString("yyyy-MM-dd").Split('-');
            if (config.Forumurl == "")
            {
                Response.Write("请正确配置论坛URL地址");
                Response.End();
                return;
            }

            string uploaddir    = "";
            string fileDatePath = currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/";

            //当支持FTP上传附件
            if (FTPs.GetSpaceAttachInfo.Allowupload == 1)
            {
                //不保留本地附件模式时
                if (FTPs.GetSpaceAttachInfo.Reservelocalattach == 0)
                {
                    uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/temp/");
                }
                else
                {
                    uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/" + fileDatePath);
                }

                httplink = FTPs.GetSpaceAttachInfo.Remoteurl + "/" + fileDatePath;
                ViewState["RelativeFilePath"] = FTPs.GetSpaceAttachInfo.Remoteurl + "/" + fileDatePath;
            }
            else
            {
                httplink  = BaseConfigs.GetForumPath + "space/upload/" + fileDatePath;
                uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/" + fileDatePath);
                ViewState["RelativeFilePath"] = BaseConfigs.GetForumPath + "space/upload/" + fileDatePath;
            }

            if (!Directory.Exists(uploaddir))
            {
                Utils.CreateDir(uploaddir);
            }

            ViewState["UploadDir"] = uploaddir;
            ViewState["postid"]    = DNTRequest.GetInt("postid", 0);

            //载入相册列表
            if (this.spaceconfiginfo.Status == SpaceStatusType.Natural)
            {
                UserGroupInfo usergroupinfo = UserGroups.GetUserGroupInfo(userid);
                //得到用户可以上传的文件类型
                StringBuilder sbAttachmentTypeSelect = new StringBuilder();
                if (!usergroupinfo.Attachextensions.Trim().Equals(""))
                {
                    sbAttachmentTypeSelect.Append("[id] in (");
                    sbAttachmentTypeSelect.Append(usergroupinfo.Attachextensions);
                    sbAttachmentTypeSelect.Append(")");
                }
                attachextensions = Attachments.GetAttachmentTypeArray(sbAttachmentTypeSelect.ToString());
            }
            else
            {
                albums.Visible = false;
            }
        }
Exemplo n.º 24
0
        protected override void ShowPage()
        {
            if (topic.ID == 0)
            {
                return;
            }

            this.pagetitle = this.topic.Title.Trim();
            if (!String.IsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + this.forum.Fid + "password"))
            {
                base.AddErrLine("本版块被管理员设置了密码");
                base.Response.Redirect(string.Format("{0}showforum-{1}{2}", BaseConfigs.GetForumPath, this.forum.Fid, this.config.Extname), true);
                return;
            }
            if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg))
            {
                base.AddErrLine(this.msg);
                return;
            }
            this.postinfo = Post.FindByTid(this.topicid);
            var msg = postinfo.Message;

            if (msg.ToLower().Contains("[free]") || msg.ToLower().Contains("[/free]"))
            {
                Match match = buytopic.r.Match(msg);
                while (match.Success)
                {
                    object obj = this.postmessage;
                    this.postmessage = obj + "<br /><div class=\"msgheader\">免费内容:</div><div class=\"msgborder\">" + match.Groups[1] + "</div><br />";
                    match            = match.NextMatch();
                }
            }
            this.topicprice = this.topic.Price;
            if (this.topic.Price > 0)
            {
                this.price       = this.topic.Price;
                this.expirehours = (Int32)(DateTime.Now - topic.PostDateTime.AddHours(maxchargespan)).TotalHours;
                if (PaymentLog.IsBuyer(this.topicid, this.userid) || (this.expirehours > 0 && this.maxchargespan != 0))
                {
                    this.price = -1;
                }
                else
                {
                    this.expirehours = Math.Abs(this.expirehours);
                }
            }
            this.netamount = (float)this.topicprice - (float)this.topicprice * this.creditstax / 100f;
            if (this.topicprice > this.maxincpertopic)
            {
                this.netamount = (float)this.maxincpertopic - (float)this.maxincpertopic * this.creditstax / 100f;
            }
            if (this.price != -1)
            {
                var userInfo = Users.GetUserInfo(this.userid);
                if (this.buyit == 1 && !this.CheckUserExtCredit(userInfo))
                {
                    return;
                }
                this.userlastprice = Users.GetUserExtCredit(userInfo, Scoresets.GetTopicAttachCreditsTrans()) - (float)this.topic.Price;
            }
            if (!this.ispost)
            {
                this.buyers = PaymentLog.GetPaymentLogByTidCount(this.topic.ID);
                if (this.showpayments == 1)
                {
                    this.pagecount      = ((this.buyers % this.pageSize == 0) ? (this.buyers / this.pageSize) : (this.buyers / this.pageSize + 1));
                    this.pagecount      = ((this.pagecount == 0) ? 1 : this.pagecount);
                    this.pageid         = ((this.pageid < 1) ? 1 : this.pageid);
                    this.pageid         = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
                    this.paymentloglist = PaymentLog.GetPaymentLogByTid(this.pageSize, this.pageid, this.topic.ID);
                }
                int hide = (this.topic.Hide == 1) ? this.topic.Hide : 0;
                if (Post.IsReplier(this.topicid, this.userid))
                {
                    hide = -1;
                }
                this.lastpostlist = Posts.GetPagedLastPost(this.GetPostPramsInfo(hide));
                return;
            }
            int num = PaymentLog.BuyTopic(this.userid, this.topic.ID, this.topic.PosterID, this.topic.Price, this.netamount);

            if (num > 0)
            {
                base.SetUrl(base.ShowTopicAspxRewrite(this.topic.ID, 0));
                base.SetMetaRefresh();
                base.SetShowBackLink(false);
                base.MsgForward("buytopic_succeed");
                base.AddMsgLine("购买主题成功,返回该主题");
                return;
            }
            base.SetBackLink(base.ShowForumAspxRewrite(this.topic.Fid, 0));
            if (num == -1)
            {
                base.AddErrLine("对不起,您的账户余额少于交易额,无法进行交易");
                return;
            }
            if (num == -2)
            {
                base.AddErrLine("您无权购买本主题");
                return;
            }
            base.AddErrLine("未知原因,交易无法进行,给您带来的不方便我们很抱歉");
        }
Exemplo n.º 25
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");
            }
        }
Exemplo n.º 26
0
        protected override void ShowPage()
        {
            #region 临时帐号发帖
            //int realuserid = -1;
            //bool tempaccountspost = false;
            //string tempusername = DNTRequest.GetString("tempusername");
            //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username)
            //{
            //    realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
            //    if (realuserid == -1)
            //    {
            //        AddErrLine("临时帐号登录失败,无法继续发帖。");
            //        return;
            //    }
            //    else
            //    {
            //        userid = realuserid;
            //        username = tempusername;
            //        tempaccountspost = true;
            //    }
            //}
            #endregion

            if (userid > 0)
            {
                userinfo = Users.GetShortUserInfo(userid);
            }

            #region 判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            if (admininfo != null)
            {
                disablepost = admininfo.Disablepostctrl;
            }

            if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg))
            {
                AddErrLine(msg); return;
            }
            #endregion

            //获取主题帖信息
            PostInfo postinfo = GetPostAndTopic(admininfo);
            if (IsErr())
            {
                return;
            }

            forum     = Forums.GetForumInfo(forumid);
            smileyoff = 1 - forum.Allowsmilies;
            bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1;
            allowimg  = forum.Allowimgcode;
            needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepost, usergroupinfo);
            #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);

            if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 &&
                (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0))
            {
                caninsertalbum = true;
                albumlist      = apb.GetSpaceAlbumByUserId(userid);
            }
            #endregion

            if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                return;
            }

            #region 访问和发帖权限校验
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = true;
                return;
            }
            if (!UserAuthority.PostReply(forum, userid, usergroupinfo, topic))
            {
                AddErrLine(topic.Closed == 1 ? "主题已关闭无法回复" : "您没有发表回复的权限");
                needlogin = (topic.Closed == 1 ? false : true);
                return;
            }

            if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg))
            {
                AddErrLine(msg);
                return;
            }
            #endregion

            // 如果是受灌水限制用户, 则判断是否是灌水
            if (admininfo != null)
            {
                disablepost = admininfo.Disablepostctrl;
            }

            if (forum.Templateid > 0)
            {
                templatepath = Templates.GetTemplateItem(forum.Templateid).Directory;
            }

            AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
            //如果是提交...
            if (ispost)
            {
                string backlink = (DNTRequest.GetInt("topicid", -1) > 0 ?
                                   string.Format("postreply.aspx?topicid={0}&restore=1&forumpage=" + forumpageid, topicid) :
                                   string.Format("postreply.aspx?postid={0}&restore=1&forumpage=" + forumpageid, postid));

                if (!DNTRequest.GetString("quote").Equals(""))
                {
                    backlink = string.Format("{0}&quote={1}", backlink, DNTRequest.GetString("quote"));
                }

                SetBackLink(backlink);

                #region 验证提交信息
                //常规项验证
                NormalValidate(admininfo, postmessage, userinfo);

                if (IsErr())
                {
                    return;
                }
                #endregion

                //是否有上传附件的权限
                canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg);

                // 产生新帖子
                if (!string.IsNullOrEmpty(DNTRequest.GetFormString("toreplay_user").Trim()))
                {
                    postmessage = DNTRequest.GetFormString("toreplay_user").Trim() + "\n\n" + postmessage;
                }

                postinfo = CreatePostInfo(postmessage);

                //获取被回复帖子的作者uid
                int replyUserid = postid > 0 ? Posts.GetPostInfo(topicid, postid).Posterid : postinfo.Posterid;
                postid = postinfo.Pid;
                if (IsErr())
                {
                    return;
                }

                #region 当回复成功后,发送通知
                if (postinfo.Pid > 0 && DNTRequest.GetString("postreplynotice") == "on")
                {
                    Notices.SendPostReplyNotice(postinfo, topic, replyUserid);
                }
                #endregion

                //向第三方应用同步数据
                Sync.Reply(postid.ToString(), topic.Tid.ToString(), topic.Title, postinfo.Poster, postinfo.Posterid.ToString(), topic.Fid.ToString(), "");

                //更新主题相关信息
                //UpdateTopicInfo(postmessage);

                #region 处理附件
                //处理附件
                StringBuilder    sb             = new StringBuilder();
                AttachmentInfo[] attachmentinfo = null;
                string           attachId       = DNTRequest.GetFormString("attachid");
                if (!string.IsNullOrEmpty(attachId))
                {
                    attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId);
                    Attachments.UpdateAttachment(attachmentinfo, topic.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo);
                }

                //加入相册
                if (config.Enablealbum == 1 && apb != null)
                {
                    sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username));
                }
                #endregion

                OnlineUsers.UpdateAction(olid, UserAction.PostReply.ActionID, forumid, forum.Name, topicid, topictitle);

                #region 设置提示信息和跳转链接
                //辩论地址
                if (topic.Special == 4)
                {
                    SetUrl(Urls.ShowDebateAspxRewrite(topicid));
                }
                else if (infloat == 0)//此处加是否弹窗提交判断是因为在IE6下弹窗提交会造成gettopicinfo, getpostlist(位于showtopic页面)被提交了两次
                {
                    SetUrl(string.Format("showtopic.aspx?forumpage={0}&topicid={1}&page=end&jump=pid#{2}", forumpageid, topicid, postid));
                }

                if (DNTRequest.GetFormString("continuereply") == "on")
                {
                    SetUrl("postreply.aspx?topicid=" + topicid + "&forumpage=" + forumpageid + "&continuereply=yes");
                }

                if (sb.Length > 0)
                {
                    UpdateUserCredits(Forums.GetValues(forum.Replycredits));
                    SetMetaRefresh(5);
                    SetShowBackLink(true);
                    if (infloat == 1)
                    {
                        AddErrLine(sb.ToString());
                        return;
                    }
                    else
                    {
                        AddMsgLine("<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表回复成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr></table>");
                    }
                }
                else
                {
                    SetMetaRefresh();
                    SetShowBackLink(false);
                    //上面已经进行用户组判断
                    if (postinfo.Invisible == 1)
                    {
                        AddMsgLine(string.Format("发表回复成功, 但需要经过审核才可以显示. {0}<br /><br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name));
                    }
                    else
                    {
                        UpdateUserCredits(Forums.GetValues(forum.Replycredits));
                        MsgForward("postreply_succeed");
                        AddMsgLine(string.Format("发表回复成功, {0}<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)<br />", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name));
                    }
                }
                #endregion

                // 删除主题游客缓存
                if (topic.Replies < (config.Ppp + 10))
                {
                    ForumUtils.DeleteTopicCacheFile(topicid);
                }

                //发送邮件通知
                if (DNTRequest.GetString("emailnotify") == "on" && topic.Posterid != -1 && topic.Posterid != userid)
                {
                    SendNotifyEmail(Users.GetShortUserInfo(topic.Posterid).Email.Trim(), postinfo, Utils.GetRootUrl(BaseConfigs.GetForumPath) + string.Format("showtopic.aspx?topicid={0}&page=end&jump=pid#{1}", topicid, postid));
                }
            }
        }
Exemplo n.º 27
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));
            ///得到广告列表
            GetForumAds(forum.Fid);

            // 检查是否具有版主的身份
            if (useradminid != 0)
            {
                ismoder   = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息
                if (admininfo != null)
                {
                    disablepostctrl = admininfo.Disablepostctrl;
                }
            }

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0;
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            usesig      = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;

            int price = 0;

            if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示
            {
                HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return;
            }

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            // 获取帖子总数
            onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor;

            // 获取分页相关信息
            BindPageCountAndId();

            PostpramsInfo postpramsInfo = GetPostPramsInfo(price);

            //获取当前正反方列表
            positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
            negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);

            GetPostAds(postpramsInfo, positivepostlist.Count);

            //辩论帖
            if (topic.Special == 4)
            {
                GetDebateInfo(postpramsInfo);
            }

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag)
            {
                relatedtopics = Topics.GetRelatedTopicList(topicid, 5);
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message));

            ///更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);
            BindDownloadAttachmentTip();
        }
Exemplo n.º 28
0
        protected override void ShowPage()
        {
            if (topicid == -1)
            {
                AddErrLine("无效的主题ID");
                return;
            }
            topic = Topics.GetTopicInfo(topicid);
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            topictitle = Utils.StrIsNullOrEmpty(topic.Title) ? "" : topic.Title;
            forumid    = topic.Fid;
            ForumInfo forum = Forums.GetForumInfo(forumid);

            pagetitle = Utils.RemoveHtml(forum.Name);
            forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

            if (topic.Special != 1)
            {
                AddErrLine("不存在的投票ID");
                return;
            }
            if (usergroupinfo.Allowvote != 1)
            {
                AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有投票的权限");
                return;
            }
            if (Convert.ToDateTime(Polls.GetPollEnddatetime(topic.Tid)).Date < DateTime.Today)
            {
                AddErrLine("投票已经过期");
                return;
            }
            if (userid != -1 && !Polls.AllowVote(topicid, username))
            {
                AddErrLine("你已经投过票");
                return;
            }
            else if (Utils.InArray(topic.Tid.ToString(), ForumUtils.GetCookie("dnt_polled")))
            {
                AddErrLine("你已经投过票");
                return;
            }

            //当未选择任何投票项时
            if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("pollitemid")))
            {
                AddErrLine("您未选择任何投票项!");
                return;
            }
            if (DNTRequest.GetString("pollitemid").Split(',').Length > Polls.GetPollInfo(topicid).Maxchoices)
            {
                AddErrLine("您的投票项多于最大投票数");
                return;
            }
            if (Polls.UpdatePoll(topicid, DNTRequest.GetString("pollitemid"), userid == -1 ? string.Format("{0} [{1}]", usergroupinfo.Grouptitle, DNTRequest.GetIP()) : username) < 0)
            {
                AddErrLine("提交投票信息中包括非法内容");
                return;
            }

            if (userid == -1)
            {
                ForumUtils.WriteCookie("dnt_polled", string.Format("{0},{1}", (userid != -1 ? "" : ForumUtils.GetCookie("dnt_polled")), topic.Tid));
            }

            SetUrl(base.ShowTopicAspxRewrite(topicid, 0));
            SetMetaRefresh();
            SetShowBackLink(false);
            MsgForward("poll_succeed");
            AddMsgLine("投票成功, 返回主题");

            CreditsFacade.Vote(userid);
            // 删除主题游客缓存
            ForumUtils.DeleteTopicCacheFile(topicid);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 取得当前用户有权访问的版块列表
        /// </summary>
        /// <param name="forums">原始版块列表(用逗号分隔的fid)</param>
        /// <returns>有权访问的版块列表(用逗号分隔的fid)</returns>
        private string GetAllowviewForums(string forums)
        {
            //验证版块id列表是否合法的数字列表
            if (!Utils.IsNumericList(forums))
            {
                return("");
            }

            string allowviewforums = "";

            foreach (string strfid in forums.Split(','))
            {
                int       fid       = Utils.StrToInt(strfid, 0);
                ForumInfo forumInfo = Forums.GetForumInfo(fid);

                if (forumInfo == null || forumInfo.Layer == 0 || forumInfo.Status == 0)
                {
                    continue;
                }

                if (!Forums.AllowView(forumInfo.Viewperm, usergroupid))
                {
                    continue;
                }

                if ((Utils.StrIsNullOrEmpty(forumInfo.Password) || Utils.MD5(forumInfo.Password.Trim()) == ForumUtils.GetCookie("forum" + strfid.Trim() + "password")))
                {
                    allowviewforums += string.Format(",{0}", fid);
                }
            }
            return(allowviewforums.Trim(','));
        }
Exemplo n.º 30
0
        /// <summary>
        /// BasePage类构造函数
        /// </summary>
        public PageBase()
        {
            if (recordPageView)
            {
                PageViewStatistic(pagename);
            }

            config = GeneralConfigs.GetConfig();
            if (SpacePluginProvider.GetInstance() == null)
            {
                config.Enablespace = 0;
            }
            if (AlbumPluginProvider.GetInstance() == null)
            {
                config.Enablealbum = 0;
            }
            if (MallPluginProvider.GetInstance() == null)
            {
                config.Enablemall = 0;
            }

            LoadUrlConfig();
            userid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1);

            //清空当前页面查询统计
#if DEBUG
            Discuz.Data.DbHelper.QueryCount  = 0;
            Discuz.Data.DbHelper.QueryDetail = "";
#endif
            // 如果启用游客页面缓存,则对游客输出缓存页
            if (userid == -1 && config.Guestcachepagetimeout > 0 && GetUserCachePage(pagename))
            {
                return;
            }

            AddMetaInfo(config.Seokeywords, config.Seodescription, config.Seohead);

            if (config.Nocacheheaders == 1)
            {
                System.Web.HttpContext.Current.Response.BufferOutput    = false;
                System.Web.HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
                System.Web.HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
                System.Web.HttpContext.Current.Response.Expires      = 0;
                System.Web.HttpContext.Current.Response.CacheControl = "no-cache";
                System.Web.HttpContext.Current.Response.Cache.SetNoStore();
            }

            //当为forumlist.aspx或forumindex.aspx,可能出现在线并发问题,这时系统会延时2秒
            if ((pagename != "forumlist.aspx") && (pagename != "forumindex.aspx"))
            {
                oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            }
            else
            {
                try
                {
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }
                catch
                {
                    System.Threading.Thread.Sleep(2000);
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }
            }

            if (config.PostTimeStorageMedia == 1 && Utils.GetCookie("lastposttime") != "")//如果最后发帖时间cookie不为空,则在此修改用户的该属性
            {
                oluserinfo.Lastposttime = Utils.GetCookie("lastposttime");
            }

            userid         = oluserinfo.Userid;
            usergroupid    = oluserinfo.Groupid;
            username       = oluserinfo.Username;
            password       = oluserinfo.Password;
            userkey        = password.Length > 16 ? password.Substring(4, 8).Trim() : "";
            lastposttime   = oluserinfo.Lastposttime;
            lastpostpmtime = oluserinfo.Lastpostpmtime;
            lastsearchtime = oluserinfo.Lastsearchtime;
            olid           = oluserinfo.Olid;

            //确保头像可以取到
            if (userid > 0)
            {
                useravatar = Avatars.GetAvatarUrl(userid, AvatarSize.Small);
            }

            if (Utils.InArray(DNTRequest.GetString("selectedtemplateid"), Templates.GetValidTemplateIDList()))
            {
                templateid = DNTRequest.GetInt("selectedtemplateid", 0);
            }
            else if (Utils.InArray(Utils.GetCookie(Utils.GetTemplateCookieName()), Templates.GetValidTemplateIDList()))
            {
                templateid = Utils.StrToInt(Utils.GetCookie(Utils.GetTemplateCookieName()), config.Templateid);
            }

            if (templateid == 0)
            {
                templateid = config.Templateid;
            }

            pmsound = Utils.StrToInt(ForumUtils.GetCookie("pmsound"), 0);

            //已登录用户检测用户组状态,如果是禁言或禁止访问状态时间到期,则自动解禁
            if (usergroupid == 4 || usergroupid == 5)
            {
                //int groupExpiry = Users.GetShortUserInfo(userid).Groupexpiry;
                //if (groupExpiry != 0 && groupExpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0))
                //{
                //    //先改为第一个积分组
                //    usergroupid = 11;
                //    //usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);
                //    Users.UpdateUserGroup(userid, 11);
                //}

                ShortUserInfo userInfo = Users.GetShortUserInfo(userid);
                if (userInfo.Groupexpiry != 0 && userInfo.Groupexpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0))
                {
                    UserGroupInfo groupInfo = UserCredits.GetCreditsUserGroupId(userInfo.Credits);
                    usergroupid = groupInfo.Groupid != 0 ? groupInfo.Groupid : usergroupid;
                    Users.UpdateUserGroup(userid, usergroupid);
                }
            }

            usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);

            // 取得用户权限id,1管理员,2超版,3版主,0普通组,-1特殊组
            useradminid = usergroupinfo.Radminid;
            string tips = ForumUtils.GetUserCreditsCookie(userid, usergroupinfo.Grouptitle);
            if (tips != "")
            {
                string[] userinfotipsList = tips.Split(',');//因为考虑到应用程序做单点登录时获取不到userinfotips,封装了此方法
                userinfotips  = "<p><a class=\"drop\" onmouseover=\"showMenu(this.id);\" href=\"" + BaseConfigs.GetForumPath + "usercpcreditspay.aspx\" id=\"extcreditmenu\">" + userinfotipsList[0] + "</a> ";
                userinfotips += "<span class=\"pipe\">|</span>用户组: <a class=\"xi2\" id=\"g_upmine\" href=\"" + BaseConfigs.GetForumPath + "usercp.aspx\">" + userinfotipsList[1].Split(':')[1] + "</a></p>";
                userinfotips += "<ul id=\"extcreditmenu_menu\" class=\"p_pop\" style=\"display:none;\">";
                for (int i = 2; i < userinfotipsList.Length; i++)
                {
                    userinfotips += string.Format("<li><a> {0}</a></li>", userinfotipsList[i]);
                }
                userinfotips += "</ul>";
            }

            mainnavigation       = Navs.GetNavigationString(userid, useradminid);
            subnavigation        = Navs.GetSubNavigation();
            mainnavigationhassub = Navs.GetMainNavigationHasSub();
            // 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页
            if (config.Closed == 1 && pagename != "login.aspx" && pagename != "logout.aspx" && pagename != "register.aspx" && useradminid != 1)
            {
                ShowMessage(1);
                return;
            }

            if (!Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗
            {
                onlineusercount = (userid != -1) ? OnlineUsers.GetOnlineAllUserCount() : OnlineUsers.GetCacheOnlineAllUserCount();
            }

            //校验用户是否可以访问论坛
            if (!ValidateUserPermission())
            {
                return;
            }

            //更新用户在线时长
            if (userid != -1 && !Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗
            {
                OnlineUsers.UpdateOnlineTime(config.Oltimespan, userid);
            }
            TemplateInfo templateInfo = Templates.GetTemplateItem(templateid);
            templatepath = templateInfo.Directory;
            if (templateInfo.Templateurl.ToLower().StartsWith("http://"))
            {
                imagedir = templateInfo.Templateurl.TrimEnd('/') + "/images";
                cssdir   = templateInfo.Templateurl.TrimEnd('/');
            }
            else
            {
                imagedir = forumpath + "templates/" + templateInfo.Directory + "/images";
                cssdir   = forumpath + "templates/" + templateInfo.Directory;
            }
            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Topicidentifydir))
            {
                topicidentifydir = EntLibConfigs.GetConfig().Topicidentifydir.TrimEnd('/');
            }
            else
            {
                topicidentifydir = forumpath + "images/identify";
            }

            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Posticondir))
            {
                posticondir = EntLibConfigs.GetConfig().Posticondir.TrimEnd('/');
            }
            else
            {
                posticondir = forumpath + "images/posticons";
            }



            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Jsdir))
            {
                jsdir = EntLibConfigs.GetConfig().Jsdir.TrimEnd('/');
            }
            else
            {
                jsdir = rooturl + "javascript";
            }

            nowdate     = Utils.GetDate();
            nowtime     = Utils.GetTime();
            nowdatetime = Utils.GetDateTime();
            ispost      = DNTRequest.IsPost();
            isget       = DNTRequest.IsGet();
            link        = "";
            script      = "";

            templatelistboxoptions = Caches.GetTemplateListBoxOptionsCache();

            string originalTemplate = string.Format("<li><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">",
                                                    "", BaseConfigs.GetForumPath, templateid);
            string newTemplate = string.Format("<li class=\"current\"><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">",
                                               BaseConfigs.GetForumPath, templateid);
            templatelistboxoptions = templatelistboxoptions.Replace(originalTemplate, newTemplate);

            isLoginCode = config.Seccodestatus.Contains("login.aspx");
            //当该页面设置了验证码检验,并且当前用户的用户组没有给予忽略验证码的权限,则isseccode=true;
            isseccode = Utils.InArray(pagename, config.Seccodestatus) && usergroupinfo.Ignoreseccode == 0;


            headerad = Advertisements.GetOneHeaderAd("", 0);
            footerad = Advertisements.GetOneFooterAd("", 0);

            //设定当前页面的显示样式
            if (config.Allowchangewidth == 0)
            {
                Utils.WriteCookie("allowchangewidth", "");
            }

            if (pagename != "website.aspx")
            {
                if (Utils.GetCookie("allowchangewidth") == "0" || (string.IsNullOrEmpty(Utils.GetCookie("allowchangewidth")) && config.Showwidthmode == 1))
                {
                    isnarrowpage = true;
                }
            }

            //校验验证码
            if (isseccode && ispost && !ValidateVerifyCode())
            {
                return;
            }

            newtopicminute = config.Viewnewtopicminute;
            m_starttick    = DateTime.Now;

            ShowPage();

            m_processtime = DateTime.Now.Subtract(m_starttick).TotalMilliseconds / 1000;

            querycount = Discuz.Data.DbHelper.QueryCount;
            Discuz.Data.DbHelper.QueryCount = 0;

#if DEBUG
            querydetail = Discuz.Data.DbHelper.QueryDetail;
            Discuz.Data.DbHelper.QueryDetail = "";
#endif
        }