Exemplo n.º 1
0
        /// <summary>
        /// 获取图片标签
        /// </summary>
        private void GetPhotoTags()
        {
            if (!DNTRequest.IsPost() || ForumUtils.IsCrossSitePost())
            {
                Response.Write("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                return;
            }
            if (DNTRequest.GetInt("photoid", 0) <= 0)
            {
                return;
            }

            string filename = Utils.GetMapPath(string.Format("{0}cache/photo/{1}/{2}_tags.txt", BaseConfigs.GetForumPath, DNTRequest.GetInt("photoid", 0) / 1000 + 1, DNTRequest.GetInt("photoid", 0)));

            if (!File.Exists(filename))
            {
                AlbumPluginProvider.GetInstance().WritePhotoTagsCacheFile(DNTRequest.GetInt("photoid", 0));
            }

            WriteFile(filename);
        }
Exemplo n.º 2
0
        private void PostTopicSucceed(IXForum forum, Topic topicinfo)
        {
            CreditsFacade.PostTopic(this.userid, forum, true);
            int tid = topicinfo.ID;

            if (this.config.Aspxrewrite == 1)
            {
                base.SetUrl(base.ShowTopicAspxRewrite(tid, 0));
            }
            else
            {
                base.SetUrl(base.ShowTopicAspxRewrite(tid, 0) + "&forumpage=" + this.forumpageid);
            }
            ForumUtils.WriteCookie("postmessage", "");
            ForumUtils.WriteCookie("clearUserdata", "forum");
            this.SetLastPostedForumCookie();
            base.SetMetaRefresh();
            base.MsgForward("posttopic_succeed");
            base.AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(this.forumid, this.forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />");
            Sync.NewTopic(tid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.PosterID.ToString(), topicinfo.Fid.ToString(), "");
        }
Exemplo n.º 3
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.º 4
0
        /// <summary>
        /// 发帖成功
        /// </summary>
        /// <param name="values">版块积分设置</param>
        /// <param name="topicinfo">主题信息</param>
        /// <param name="topicid">主题ID</param>
        private void PostTopicSucceed(float[] values, TopicInfo topicinfo, int topicid)
        {
            if (values != null) ///使用版块内积分
            {
                UserCredits.UpdateUserExtCredits(userid, values, false);
                if (userid != -1)
                {
                    UserCredits.WriteUpdateUserExtCreditsCookies(values);
                }
            }
            else ///使用默认积分
            {
                UserCredits.UpdateUserCreditsByPostTopic(userid);
                if (userid != -1)
                {
                    UserCredits.WriteUpdateUserExtCreditsCookies(Scoresets.GetUserExtCredits(CreditsOperationType.PostTopic));
                }
            }

            //当使用伪aspx
            if (config.Aspxrewrite == 1)
            {
                SetUrl(topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0));
            }
            else
            {
                SetUrl((topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0)) + "&forumpage=" + forumpageid);
            }

            ForumUtils.WriteCookie("postmessage", "");
            ForumUtils.WriteCookie("clearUserdata", "forum");
            SetLastPostedForumCookie();

            SetMetaRefresh();
            MsgForward("posttopic_succeed");
            AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />");

            //通知应用有新主题
            Sync.NewTopic(topicid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.Posterid.ToString(), topicinfo.Fid.ToString(), "");
        }
Exemplo n.º 5
0
        /// <summary>
        /// 检查cookie是否有效
        /// </summary>
        /// <returns></returns>
        public bool CheckCookie()
        {
            config = GeneralConfigs.GetConfig();

            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return false;
                }
            }
            // 获取用户信息
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);
            if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return false;
            }

            string secques = Users.GetUserInfo(oluserinfo.Userid).Secques;
            // 管理员身份验证
            if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null || ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + secques + oluserinfo.Userid.ToString()))
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return false;
            }
            else
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies["dntadmin"];
                cookie.Values["key"] = ForumUtils.SetCookiePassword(oluserinfo.Password + secques + oluserinfo.Userid.ToString(), config.Passwordkey);
                cookie.Expires = DateTime.Now.AddMinutes(30);
                HttpContext.Current.Response.AppendCookie(cookie);
            }
            return true;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新主题相关信息
        /// </summary>
        /// <param name="postmessage"></param>
        private void UpdateTopicInfo(string postmessage)
        {
            int hide = (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) ? 1 : 0;

            if (hide == 1 && topic.Hide != 1)
            {
                topic.Hide = hide;
                Topics.UpdateTopicHide(topicid);
            }

            //更新topic的attention为0
            if (Moderators.IsModer(useradminid, userid, topic.Fid) && topic.Attention == 1)
            {
                Topics.UpdateTopicAttentionByTidList(topicid.ToString(), 0);
            }
            else if (topic.Posterid != -1 && userid == topic.Posterid)
            {
                Topics.UpdateTopicAttentionByTidList(topicid.ToString(), 1);
            }

            Topics.UpdateTopicReplyCount(topicid);
        }
Exemplo n.º 7
0
        public static bool UpdateAuthStr(string authStr)
        {
            DataTable dt = Discuz.Data.Users.GetUserIdByAuthStr(authStr);

            if (dt.Rows.Count > 0)
            {
                int uid = TypeConverter.ObjectToInt(dt.Rows[0][0]);

                //将用户调整到相应的用户组
                UserGroupInfo tempGroupInfo = UserCredits.GetCreditsUserGroupId(0);
                if (tempGroupInfo != null)
                {
                    Users.UpdateUserGroup(uid, tempGroupInfo.Groupid);   //添加注册用户审核机制后需要修改
                }
                //更新激活字段
                Users.UpdateAuthStr(uid, "", 0);
                ForumUtils.WriteUserCookie(uid, TypeConverter.StrToInt(DNTRequest.GetString("expires"), -1), GeneralConfigs.GetConfig().Passwordkey);

                return(true);
            }
            return(false);
        }
Exemplo n.º 8
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.º 9
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user             = Discuz.Forum.Users.GetUserInfo(userid);
            receivepmsetting = (int)user.Newsletter;

            if (DNTRequest.IsPost())
            {
                user.Pmsound = DNTRequest.GetInt("pmsound", 0);


                receivepmsetting = 1;
                foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
                {
                    if (rpms != string.Empty)
                    {
                        int tmp = int.Parse(rpms);
                        receivepmsetting = receivepmsetting | tmp;
                    }
                }
                user.Newsletter = (ReceivePMSettingType)receivepmsetting;

                Discuz.Forum.Users.UpdateUserPMSetting(user);

                ForumUtils.WriteCookie("pmsound", user.Pmsound.ToString());

                SetUrl("usercppmset.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("短消息设置已成功更新");
            }
        }
Exemplo n.º 10
0
        public static void Process()
        {
            if (Utils.StrIsNullOrEmpty(DNTRequest.GetUrlReferrer()))
            {
                string[] array    = DecodeUid(DNTRequest.GetString("input")).Split(',');
                var      userInfo = Users.GetUserInfo(array[0].ToInt());
                if (userInfo == null || DNTRequest.GetString("appid") != Utils.MD5(userInfo.Name + userInfo.Password + userInfo.ID + array[1]))
                {
                    return;
                }
            }
            else
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    return;
                }
            }
            string t = DNTRequest.GetString("t");

            try
            {
                if (Utils.InArray(t, "deleteattach,getattachlist,deletepostsbyuidanddays,deletepost,ignorepost,passpost,deletetopic,ignoretopic,passtopic,getimagelist,getblocklist,getpagelist,forumtree,topictree,quickreply,report,getdebatepostpage,confirmbuyattach,getnewpms,getnewnotifications,getajaxforums,checkuserextcredit,diggdebates,imagelist,debatevote"))
                {
                    //HttpContext.Current.Server.Transfer("sessionajax.aspx?t=" + t + "&reason=" + DNTRequest.GetString("reason"));
                    //return;
                    new SessionAjaxPage();
                }
                else
                {
                    new AjaxPage();
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }
        }
Exemplo n.º 11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //}
            //public UserControlsPageBase()
            //{
            this.config = GeneralConfigInfo.Current;
            if (!this.config.Adminipaccess.IsNullOrEmpty())
            {
                string[] iparray = Utils.SplitString(this.config.Adminipaccess, "\n");
                if (!Utils.InIPArray(WebHelper.UserHost, iparray))
                {
                    this.Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return;
                }
            }
            var online = Online.UpdateInfo();

            //var userGroupInfo = UserGroup.FindByID((int)online.GroupID);
            if (online.UserID <= 0 || !online.Group.Is¹ÜÀíÔ±)
            {
                this.Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }
            string secques = Users.GetUserInfo(online.UserID).Secques;

            if (this.Context.Request.Cookies["bbx_admin"] == null || this.Context.Request.Cookies["bbx_admin"]["key"] == null || ForumUtils.GetCookiePassword(this.Context.Request.Cookies["bbx_admin"]["key"].ToString(), this.config.Passwordkey) != online.Password + secques + online.UserID.ToString())
            {
                this.Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["bbx_admin"];

            httpCookie.Values["key"]    = ForumUtils.SetCookiePassword(online.Password + secques + online.UserID.ToString(), this.config.Passwordkey);
            httpCookie.Values["userid"] = online.UserID.ToString();
            httpCookie.Expires          = DateTime.Now.AddMinutes(30.0);
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 根据积分公式更新用户积分,并且受分数变动影响有可能会更改用户所属的用户组
        /// <param name="uid">用户ID</param>
        /// </summary>
        public static int UpdateUserCredits(int uid)
        {
            if (uid > 0)
            {
                //ShortUserInfo userInfo = Users.GetShortUserInfo(uid);
                //if (userInfo == null || userInfo.Uid < 1)
                //    return 0;

                Discuz.Data.UserCredits.UpdateUserCredits(uid);
                ShortUserInfo userInfo = Users.GetShortUserInfo(uid);

                UserGroupInfo tmpUserGroupInfo = UserGroups.GetUserGroupInfo(userInfo.Groupid);

                if (tmpUserGroupInfo != null && (UserGroups.IsCreditUserGroup(tmpUserGroupInfo) || tmpUserGroupInfo.Groupid == 7))//当用户组为积分用户组或者组ID为游客(ID=7)
                {
                    tmpUserGroupInfo = GetCreditsUserGroupId(userInfo.Credits);
                    if (tmpUserGroupInfo.Groupid != userInfo.Groupid)//当用户所属组发生变化时
                    {
                        Discuz.Data.Users.UpdateUserGroup(userInfo.Uid.ToString(), tmpUserGroupInfo.Groupid);
                        Discuz.Data.OnlineUsers.UpdateGroupid(userInfo.Uid, tmpUserGroupInfo.Groupid);
                    }
                }
                //判断操作用户是否是当前用户,如果是则更新dntusertips的cookie
                HttpCookie cookie = HttpContext.Current.Request.Cookies["dnt"];
                if (cookie != null)
                {
                    if (cookie["userid"] == uid.ToString())
                    {
                        ForumUtils.WriteUserCreditsCookie(userInfo, tmpUserGroupInfo.Grouptitle);
                    }
                }
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //更新在线表相关用户信息
            config = GeneralConfigs.GetConfig();
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            if (AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid).Radminid != 1)
            {
                HttpContext.Current.Response.Redirect("../");
                return;
            }
            int olid = oluserinfo.Olid;

            OnlineUsers.DeleteRows(olid);

            //清除Cookie
            ForumUtils.ClearUserCookie();
            HttpCookie cookie = new HttpCookie("dntadmin");

            HttpContext.Current.Response.AppendCookie(cookie);

            FormsAuthentication.SignOut();
        }
Exemplo n.º 14
0
        protected override void ShowPage()
        {
            pagetitle = "短消息发件箱";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Discuz.Forum.Users.GetUserInfo(userid);

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                string[] pmitemid = Utils.SplitString(DNTRequest.GetFormString("pmitemid"), ",");

                int retval = PrivateMessages.DeletePrivateMessage(userid, pmitemid);

                if (retval == -1)
                {
                    AddErrLine("参数无效<br />");
                    return;
                }

                SetShowBackLink(false);
                AddMsgLine("删除完毕");
            }
            else
            {
                BindItems();
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 查询用户名是否存在
        /// </summary>
        public void CheckUserName()
        {
            if (DNTRequest.GetString("username").Trim() == "")
            {
                return;
            }
            string result      = "0";
            string tmpUsername = DNTRequest.GetString("username").Trim();

            if (tmpUsername.IndexOf(" ") != -1)//用户名中不允许包含全空格符
            {
                result = "1";
            }
            else if (tmpUsername.IndexOf(" ") != -1) //用户名中不允许包含空格
            {
                result = "1";
            }
            else if (tmpUsername.IndexOf(":") != -1) //用户名中不允许包含冒号
            {
                result = "1";
            }
            else if (Users.GetUserId(tmpUsername) > 0) //该用户名已存在
            {
                result = "1";
            }
            else if ((!Utils.IsSafeSqlString(tmpUsername)) || (!Utils.IsSafeUserInfoString(tmpUsername))) //用户名中存在非法字符
            {
                result = "1";
            }
            else if (tmpUsername.Trim() == PrivateMessages.SystemUserName || ForumUtils.IsBanUsername(tmpUsername, config.Censoruser)) //如果用户名属于禁止名单, 或者与负责发送新用户注册欢迎信件的用户名称相同
            {
                result = "1";
            }

            System.Text.StringBuilder xmlnode = new System.Text.StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            ResponseXML(xmlnode.AppendFormat("<result>{0}</result>", result));
        }
Exemplo n.º 16
0
 /// <summary>
 /// 提交后的权限检查
 /// </summary>
 /// <returns></returns>
 private bool CheckPermissionAfterPost()
 {
     if (ForumUtils.IsCrossSitePost())
     {
         AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
         return(false);
     }
     if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("message")) || DNTRequest.GetString("message").Length > 3000)
     {
         AddErrLine("内容不能为空,且不能超过3000字");
         return(false);
     }
     if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("msgto")))
     {
         AddErrLine("接收人不能为空");
         return(false);
     }
     if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("subject")) || DNTRequest.GetString("subject").Trim().Length > 60)
     {
         AddErrLine("标题不能为空,且不能超过60字");
         return(false);
     }
     // 不能给负责发送新用户注册欢迎信件的用户名称发送消息
     if (DNTRequest.GetString("msgto") == PrivateMessages.SystemUserName)
     {
         AddErrLine("不能给系统发送消息");
         return(false);
     }
     msgtoid = Users.GetUserId(DNTRequest.GetString("msgto"));
     if (msgtoid <= 0)
     {
         AddErrLine("接收人不是注册用户");
         return(false);
     }
     return(true);
 }
Exemplo n.º 17
0
        protected override void ShowPage()
        {
            pagetitle = "用户帐号激活";

            SetUrl("index.aspx");
            SetMetaRefresh();
            SetShowBackLink(false);

            string authStr = Utils.HtmlEncode(DNTRequest.GetString("authstr").Trim()).Replace("'", "''");

            if (!Utils.StrIsNullOrEmpty(authStr))
            {
                if (Users.UpdateAuthStr(authStr))
                {
                    AddMsgLine("您当前的帐号已经激活,稍后您将以相应身份返回首页");

                    OnlineUsers.UpdateAction(olid, UserAction.ActivationUser.ActionID, 0, config.Onlinetimeout);
                    return;
                }
            }
            AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页");
            OnlineUsers.DeleteRows(olid);
            ForumUtils.ClearUserCookie();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Cookie中没有用户ID或则存的的用户ID无效时在在线表中增加一个游客.
        /// </summary>
        public static OnlineUserInfo CreateGuestUser(int timeout)
        {
            OnlineUserInfo onlineuserinfo = new OnlineUserInfo();

            onlineuserinfo.Userid         = -1;
            onlineuserinfo.Username       = "******";
            onlineuserinfo.Nickname       = "游客";
            onlineuserinfo.Password       = "";
            onlineuserinfo.Groupid        = 7;
            onlineuserinfo.Olimg          = GetGroupImg(7);
            onlineuserinfo.Adminid        = 0;
            onlineuserinfo.Invisible      = 0;
            onlineuserinfo.Ip             = DNTRequest.GetIP();
            onlineuserinfo.Lastposttime   = "1900-1-1 00:00:00";
            onlineuserinfo.Lastpostpmtime = "1900-1-1 00:00:00";
            onlineuserinfo.Lastsearchtime = "1900-1-1 00:00:00";
            onlineuserinfo.Lastupdatetime = Utils.GetDateTime();
            onlineuserinfo.Action         = 0;
            onlineuserinfo.Lastactivity   = 0;
            onlineuserinfo.Verifycode     = ForumUtils.CreateAuthStr(5, false);
            onlineuserinfo.Olid           = Discuz.Data.OnlineUsers.CreateOnlineUserInfo(onlineuserinfo, timeout);

            return(onlineuserinfo);
        }
Exemplo n.º 19
0
        public NotifyPage()
        {
            if (EPayments.CheckPayment(DNTRequest.GetString("notify_id")))//验证请求是否来自支付宝,或者是伪造的
            {
                //获取需要的信息
                int    orderStatus = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status"));
                string orderCode   = DNTRequest.GetString("out_trade_no", true);
                string tradeNo     = DNTRequest.GetString("trade_no", true);

                if (string.IsNullOrEmpty(orderCode) || string.IsNullOrEmpty(tradeNo) || orderStatus <= 0)
                {
                    return;
                }

                CreditOrderInfo orderInfo = CreditOrders.GetCreditOrderInfoByOrderCode(orderCode);


                //如果订单状态为未成功交易
                if (orderInfo != null && orderInfo.OrderStatus < 2)
                {
                    float[] extcredits = new float[8];
                    extcredits[orderInfo.Credit - 1] = orderInfo.Amount;

                    if (UserCredits.UpdateUserExtCredits(orderInfo.Uid, extcredits, true) != 1)
                    {
                        orderStatus = 0;
                    }

                    CreditsLogs.AddCreditsLog(orderInfo.Uid, orderInfo.Uid, orderInfo.Credit, orderInfo.Credit, 0, orderInfo.Amount, Utils.GetDateTime(), 3);//添加积分兑换转账和充值记录

                    NoticeInfo notice = new NoticeInfo();
                    notice.Postdatetime = Utils.GetDateTime();
                    notice.Type         = NoticeType.GoodsTradeNotice;
                    notice.Poster       = "系统";
                    notice.Posterid     = 0;
                    notice.Uid          = orderInfo.Uid;
                    notice.Note         = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(orderInfo.Credit, orderInfo.Amount), tradeNo);
                    Notices.CreateNoticeInfo(notice);

                    CreditOrders.UpdateCreditOrderInfo(orderInfo.OrderId, tradeNo, orderStatus, Utils.GetDateTime());//修改积分订单记录状态
                }
                //判断当前请求是支付宝GET式(直接跳转)或者是服务器POST式(需返回success使得支付宝停止继续发送通知)
                if (DNTRequest.IsPost())
                {
                    HttpContext.Current.Response.Write("success");
                }
                else
                {
                    HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true");
                }
            }
            else
            {
                HttpContext.Current.Response.Write("fail");
            }
        }
Exemplo n.º 20
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.º 21
0
        private string condition   = ""; //查询条件

        protected override void ShowPage()
        {
            if (userid > 0 && useradminid > 0)
            {
                admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            }

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

            #region 版块信息设置
            //当所选论坛为多个时或全部时
            if (forumid == -1)
            {
                //用户点选相应的论坛
                forums = (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("fidlist")) ? DNTRequest.GetString("fidlist") : DNTRequest.GetString("forums")).ToLower();
                //如果是选择全部版块

                forums = (forums == string.Empty || forums == "all") ? GetForums() : forums;
                forums = GetAllowviewForums(forums);
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            if (forumid > 0)
            {
                forum = Forums.GetForumInfo(forumid);
                if (forum == null)
                {
                    AddErrLine("不存在的版块ID");
                    return;
                }

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

                if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }
                // 得到子版块列表
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            }
            #endregion

            //设置查询条件
            SetCondition();

            if (IsErr())
            {
                return;
            }

            pagetitle = (type == "digest" ? "查看精华" : "查看新帖");

            SetPageIdAndNumber();
            topiclist = Topics.GetTopicListByCondition(tpp, pageid, 0, 10, config.Hottopic, forum.Autoclose, forum.Topictypeprefix, condition, GetOrder(), direct);

            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, config.Onlinetimeout);
            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Exemplo n.º 22
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.º 23
0
 public void ShowFooter()
 {
     HttpContext.Current.Response.Write(string.Format("<div class=\"copyright\" align=\"center\">Powered by <a href=\"http://nt.discuz.net\">Discuz!NT</a> Archiver {0} 2001-{1} <a href=\"http://www.comsenz.com\" target=\"_blank\" style=\"color:#000000\">Comsenz Inc.</a></div>\r\n</body>\r\n</html>", ForumUtils.GetAssemblyVersion(), DateTime.Now.Year.ToString()));
 }
Exemplo n.º 24
0
        protected void Origin_Page_Load(object sender, EventArgs e)
        {
            UserName.Attributes.Remove("class");
            PassWord.Attributes.Remove("class");
            UserName.AddAttributes("style", "width:200px");
            PassWord.AddAttributes("style", "width:200px");

            config = GeneralConfigs.GetConfig();

            OnlineUserInfo oluserinfo = Discuz.Forum.OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            olid = oluserinfo.Olid;

            if (!Page.IsPostBack)
            {
                #region 如果IP访问列表有设置则进行判断
                if (config.Adminipaccess.Trim() != "")
                {
                    string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                    if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("<br /><br /><div style=\"width:100%\" align=\"center\"><div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\">");
                        sb.Append("<img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" />&nbsp; 您的IP地址不在系统允许的范围之内</div></div>");
                        Response.Write(sb.ToString());
                        Response.End();
                        return;
                    }
                }
                #endregion

                #region 用户身份判断
                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);
                if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
                {
                    string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                    message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>无法确认您的身份</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
                    message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">";
                    message += "<div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> &nbsp;";
                    message += "无法确认您的身份, 请<a href=\"../login.aspx\">登录</a></div></div></body></html>";
                    Response.Write(message);
                    Response.End();
                    return;
                }
                #endregion


                #region 判断安装目录文件信息
                if (IsExistsSetupFile())
                {
                    string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                    message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>请将您的安装目录即install/目录下的文件全部删除, 以免其它用户运行安装该程序!</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
                    message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">";
                    message += "<div align=\"center\" style=\"width:660px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> &nbsp;";
                    message += "请将您的安装目录(install/)下和升级目录(upgrade/)下的.aspx文件及bin/Discuz.Install.dll全部删除, 以免其它用户运行安装或升级程序!</div></div></body></html>";
                    Response.Write(message);
                    Response.End();
                    return;
                }
                #endregion


                #region 显示相关页面登陆提交信息
                if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null ||
                    ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) !=
                    (oluserinfo.Password + Discuz.Forum.Users.GetUserInfo(oluserinfo.Userid).Secques + oluserinfo.Userid.ToString()))
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\">请重新进行管理员登录";
                }

                if (oluserinfo.Userid > 0 && usergroupinfo.Radminid == 1 && oluserinfo.Username.Trim() != "")
                {
                    UserName.Text = oluserinfo.Username;
                    UserName.AddAttributes("readonly", "true");
                    UserName.CssClass = "nofocus";
                    UserName.Attributes.Add("onfocus", "this.className='nofocus';");
                    UserName.Attributes.Add("onblur", "this.className='nofocus';");
                }

                if (DNTRequest.GetString("result") == "1")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不存在或密码错误</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "2")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不是管理员身分,因此无法登陆后台</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "3")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">验证码错误,请重新输入</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "4")
                {
                    Msg.Text = "";
                    return;
                }
                #endregion
            }

            if (Page.IsPostBack)
            {
                VerifyLoginInf();//对提供的信息进行验证
            }
            else
            {
                Response.Redirect("syslogin.aspx?result=4");
            }
        }
Exemplo n.º 25
0
        public void VerifyLoginInf()
        {
            if (!Discuz.Forum.OnlineUsers.CheckUserVerifyCode(olid, DNTRequest.GetString("vcode")))
            {
                Response.Redirect("syslogin.aspx?result=3");
                return;
            }

            UserInfo userInfo = null;

            if (config.Passwordmode == 1)
            {
                userInfo = Users.GetUserInfo(Users.CheckDvBbsPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password")));
            }
            else if (config.Passwordmode == 0)
            {
                userInfo = Users.GetUserInfo(Users.CheckPassword(DNTRequest.GetString("username"), Utils.MD5(DNTRequest.GetString("password")), false));
            }
            else//第三方加密验证模式
            {
                userInfo = Users.CheckThirdPartPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"), -1, null);
            }

            if (userInfo != null)
            {
                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);

                if (usergroupinfo.Radminid == 1)
                {
                    ForumUtils.WriteUserCookie(userInfo.Uid, 1440, GeneralConfigs.GetConfig().Passwordkey);

                    //UserGroupInfo userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);

                    HttpCookie cookie = new HttpCookie("dntadmin");
                    cookie.Values["key"] = ForumUtils.SetCookiePassword(userInfo.Password + userInfo.Secques + userInfo.Uid, config.Passwordkey);
                    cookie.Expires       = DateTime.Now.AddMinutes(30);
                    HttpContext.Current.Response.AppendCookie(cookie);

                    AdminVistLogs.InsertLog(userInfo.Uid, userInfo.Username, userInfo.Groupid, usergroupinfo.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", "");

                    try
                    {
                        SoftInfo.LoadSoftInfo();
                    }
                    catch
                    {
                        Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                        Response.End();
                    }

                    //升级general.config文件
                    try
                    {
                        GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config"));
                    }
                    catch { }

                    Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                    Response.End();
                }
                else
                {
                    Response.Redirect("syslogin.aspx?result=2");
                }
            }
            else
            {
                Response.Redirect("syslogin.aspx?result=1");
            }
        }
Exemplo n.º 26
0
        protected override void ShowPage()
        {
            GetPostAds(forumid);

            if (userid > 0 && useradminid > 0)
            {
                AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                if (admingroupinfo != null)
                {
                    disablepostctrl = admingroupinfo.Disablepostctrl;
                }
            }

            #region 获取版块信息
            if (forumid == -1)
            {
                AddLinkRss(forumpath + "tools/rss.aspx", "最新主题");
                AddErrLine("无效的版块ID");
                return;
            }
            forum = Forums.GetForumInfo(forumid);
            if (forum == null || forum.Fid < 1)
            {
                if (config.Rssstatus == 1)
                {
                    AddLinkRss(forumpath + "tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新主题");
                }

                AddErrLine("不存在的版块ID");
                return;
            }
            #endregion

            if (config.Rssstatus == 1)
            {
                AddLinkRss(forumpath + "tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新主题");
            }

            if (JumpUrl(forum))
            {
                return;
            }

            needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo);

            // 检查是否具有版主的身份
            if (useradminid > 0)
            {
                ismoder = Moderators.IsModer(useradminid, userid, forumid);
            }

            //设置搜索和排序条件
            SetSearchCondition();

            showforumlogin = IsShowForumLogin(forum);
            pagetitle      = Utils.RemoveHtml(forum.Name);
            navhomemenu    = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            forumnav       = ShowForumAspxRewrite(ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("\"showforum", "\"" + forumurl + "showforum"),
                                                  forumid, pageid);
            topicextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans());

            #region 主题分类设置
            if (forum.Applytopictype == 1) //启用主题分类
            {
                topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes);
            }

            if (forum.Viewbytopictype == 1) //允许按类别浏览
            {
                topictypeselectlink = Forums.GetCurrentTopicTypesLink(forum.Fid, forum.Topictypes, forumurl + "showforum.aspx");
            }
            #endregion

            //更新页面Meta中的keyword,description项, 提高SEO友好性
            UpdateMetaInfo(Utils.StrIsNullOrEmpty(forum.Seokeywords) ? config.Seokeywords : forum.Seokeywords,
                           Utils.StrIsNullOrEmpty(forum.Seodescription) ? forum.Description : forum.Seodescription,
                           config.Seohead);

            //设置编辑器状态
            SetEditorState();

            #region 访问和发帖权限校验
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = userid == -1;
                return;
            }

            canposttopic = UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg);
            // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖
            if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1)
            {
                string visittime = "";
                if (canposttopic && Scoresets.BetweenTime(config.Postbanperiods, out visittime))
                {
                    canposttopic = false;
                }

                isnewbie = UserAuthority.CheckNewbieSpan(userid);
            }

            //是否显示快速发主题编辑器(全局权限判定,版块权限判定,是否是游客,游客需要显示,登录用户是否允许发主题且已过新手见习期)
            if ((config.Fastpost == 1 || config.Fastpost == 3) && forum.Allowspecialonly <= 0 && (userid < 0 || (canposttopic && !isnewbie)))
            {
                canquickpost = true;
            }
            #endregion

            // 得到子版块列表
            if (forum.Subforumcount > 0)
            {
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            }
            if (!forum.Rules.Equals(""))
            {
                forum.Rules = UBB.ParseSimpleUBB(forum.Rules);//替换版规中的UBB
            }
            //获取主题总数
            topiccount = Topics.GetTopicCount(forumid, true, condition);

            #region 设置分页及主题列表信息
            // 得到Tpp设置
            if (tpp <= 0)
            {
                tpp = config.Tpp;
            }

            // 得到Ppp设置
            if (ppp <= 0)
            {
                ppp = config.Ppp;
            }

            //修正请求页数中可能的错误
            if (pageid < 1)
            {
                pageid = 1;
            }

            int toptopicpagecount = 0;

            if (forum.Layer > 0)
            {
                //获取当前页置顶主题列表
                DataRow dr = Topics.GetTopTopicListID(forumid);
                if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString()))
                {
                    topiccount = topiccount + TypeConverter.ObjectToInt(dr["tid0Count"]);
                }

                //获取总页数
                pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1;
                if (pagecount == 0)
                {
                    pagecount = 1;
                }
                if (pageid > pagecount)
                {
                    pageid = pagecount;
                }

                if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString()))
                {
                    toptopiccount = TypeConverter.ObjectToInt(dr["tidCount"]);
                    if (toptopiccount > tpp * (pageid - 1))
                    {
                        toptopiclist      = Topics.GetTopTopicList(forumid, tpp, pageid, dr["tid"].ToString(), forum.Autoclose, forum.Topictypeprefix);
                        toptopicpagecount = toptopiccount / tpp;
                    }

                    if (toptopicpagecount >= pageid || (pageid == 1 && toptopicpagecount != toptopiccount))
                    {
                        topiclist = GetTopicInfoList(tpp - toptopiccount % tpp, pageid - toptopicpagecount, 0);
                    }
                    else
                    {
                        topiclist = GetTopicInfoList(tpp, pageid - toptopicpagecount, toptopiccount % tpp);
                    }
                }
                else
                {
                    toptopicpagecount = 0;
                    topiclist         = GetTopicInfoList(tpp, pageid, 0);
                }

                //如果topiclist为空则更新当前论坛帖数
                if (topiclist == null || topiclist.Count == 0 || topiclist.Count > topiccount)
                {
                    Forums.SetRealCurrentTopics(forum.Fid);
                }

                SetPageNumber();
                //当版块数大于一个并且当版块数量为一个时不是版块自身时显示下拉菜单
                showvisitedforumsmenu = visitedforums != null && ((visitedforums.Length == 1 && visitedforums[0].Fid != forumid) || visitedforums.Length > 1);
                SetVisitedForumsCookie();
                //保存查看版块的页数
                Utils.WriteCookie("forumpageid", pageid.ToString(), 30);

                //判断是否需要生成游客缓存页面
                IsGuestCachePage();
            }
            #endregion

            #region 替换版规中的UBB
            forum.Description = UBB.ParseSimpleUBB(forum.Description);
            #endregion

            #region 更新在线信息
            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forum.Name, -1, "");

            if ((forumtotalonline < config.Maxonlinelist && (config.Whosonlinestatus == 2 || config.Whosonlinestatus == 3)) || DNTRequest.GetString("showonline") == "yes")
            {
                showforumonline = true;
                onlineuserlist  = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest,
                                                                           out forumtotalonlineuser, out forumtotalonlineinvisibleuser);
            }
            //if (DNTRequest.GetString("showonline") != "no")
            //{
            //     showforumonline = false;
            //}

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

            //修正版主列表
            if (forum.Moderators.Trim() != "")
            {
                string moderHtml = string.Empty;
                foreach (string m in forum.Moderators.Split(','))
                {
                    moderHtml += string.Format("<a href=\"{0}userinfo.aspx?username={1}\">{2}</a>,", forumpath, Utils.UrlEncode(m), m);
                }

                forum.Moderators = moderHtml.TrimEnd(',');
            }

            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Exemplo n.º 27
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.º 28
0
        protected override void ShowPage()
        {
            pagetitle = "用户管理";

            if (userid == -1)
            {
                AddErrLine("请先登录");
                return;
            }
            if (ForumUtils.IsCrossSitePost(DNTRequest.GetUrlReferrer(), DNTRequest.GetHost()) || Utils.StrIsNullOrEmpty(action))
            {
                AddErrLine("非法提交");
                return;
            }
            if (action == "")
            {
                AddErrLine("操作类型参数为空");
                return;
            }
            // 如果拥有管理组身份
            admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            // 如果所属管理组不存在
            if (admininfo == null)
            {
                AddErrLine("你没有管理权限");
                return;
            }
            if (operateduid == -1)
            {
                AddErrLine("没有选择要操作的用户");
                return;
            }
            operateduser = Users.GetShortUserInfo(operateduid);
            if (operateduser == null)
            {
                AddErrLine("选择的用户不存在");
                return;
            }
            if (operateduser.Adminid > 0)
            {
                AddErrLine("无法对拥有管理权限的用户进行操作, 请管理员登录后台进行操作");
                return;
            }
            operatedusername = operateduser.Username;


            if (!ispost)
            {
                Utils.WriteCookie("reurl", DNTRequest.GetUrlReferrer());
                if (action == "banuser")
                {
                    operationtitle = "禁止用户";
                    switch (operateduser.Groupid)
                    {
                    case 4:
                        bantype     = 1;
                        groupexpiry = "(" + Utils.FormatDate(operateduser.Groupexpiry) + ")";
                        break;

                    case 5:
                        bantype     = 2;
                        groupexpiry = "(" + Utils.FormatDate(operateduser.Groupexpiry) + ")";
                        break;

                    case 6:
                        bantype     = 3;
                        groupexpiry = "(" + Utils.FormatDate(operateduser.Groupexpiry) + ")";
                        break;

                    default:
                        bantype = 0;
                        break;
                    }
                    if (admininfo.Allowbanuser != 1)
                    {
                        AddErrLine("您没有禁止用户的权限");
                        return;
                    }
                }
            }
            else if (action == "banuser")
            {
                operationtitle = "禁止用户";
                DoBanUserOperation();
            }
        }
Exemplo n.º 29
0
        private void DoBanUserOperation()
        {
            ispost = false;
            string actions = "";
            string title   = "";

            //判断后台是否设置必须输入理由, 0-不需要 1-必须
            if (usergroupinfo.Reasonpm == 1 && Utils.StrIsNullOrEmpty(DNTRequest.GetString("reason")))
            {
                titlemessage = true;
                AddErrLine("请填写操作原因");
                return;
            }
            int    banexpirynew = DNTRequest.GetFormInt("banexpirynew", -1);
            string expday       = (banexpirynew == 0) ? "29990101" : string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(banexpirynew));

            switch (DNTRequest.GetInt("bantype", -1))
            {
            case 0:    //正常状态
                //Users.UpdateUserGroup(operateduid, UserCredits.GetCreditsUserGroupId(operateduser.Credits).Groupid);
                Users.UpdateBanUser(CreditsFacade.GetCreditsUserGroupId(operateduser.Credits).Groupid, "0", operateduid);
                title   = string.Format("取消对 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 的禁止", operatedusername, operateduid);
                actions = "取消禁止";
                break;

            case 1:    //禁止发言
                //Users.UpdateUserGroup(operateduid, 4);
                Users.UpdateBanUser(4, expday, operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 发言", operatedusername, operateduid);
                actions = "禁止发言";
                break;

            case 2:    //禁止访问
                //Users.UpdateUserGroup(operateduid, 5);
                Users.UpdateBanUser(5, expday, operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 访问", operatedusername, operateduid);
                actions = "禁止访问";
                break;

            default:
                titlemessage = true;
                actions      = "错误的禁止类型";
                AddErrLine("错误的禁止类型");
                return;
            }

            AdminModeratorLogs.InsertLog(userid.ToString(), username, usergroupid.ToString(), usergroupinfo.Grouptitle, DNTRequest.GetIP(),
                                         DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "0", "", "0", title, actions, DNTRequest.GetString("reason").Trim());
            // 收件箱
            //if (DNTRequest.GetFormInt("sendmessage", 0) == 1)
            //{
            //    PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
            //    privatemessageinfo.Message = Utils.HtmlEncode(string.Format("这是由论坛系统自动发送的通知短消息。操作理由: {0}\r\n\r\n如果您对本管理操作有异议,请与我取得联系。", DNTRequest.GetString("reason").Trim()));
            //    privatemessageinfo.Subject = Utils.HtmlEncode("您被执行 " + actions + " 操作");
            //    privatemessageinfo.Msgto = operateduser.Username;
            //    privatemessageinfo.Msgtoid = operateduid;
            //    privatemessageinfo.Msgfrom = username;
            //    privatemessageinfo.Msgfromid = userid;
            //    privatemessageinfo.New = 1;
            //    privatemessageinfo.Postdatetime = Utils.GetDateTime();
            //    privatemessageinfo.Folder = 0;
            //    PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            //}

            ispost = true;
            SetShowBackLink(false);
            SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl()));
            SetMetaRefresh();
            MsgForward("useradmin_succeed", true);
        }
Exemplo n.º 30
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            int topicid = DNTRequest.GetInt("topicid", -1);

            if (topicid == -1)
            {
                base.ShowMsg("无效的主题ID");
                return;
            }
            var topic = Topic.FindByID(topicid);

            if (topic == null || topic.Closed > 1)
            {
                base.ShowMsg("不存在的主题ID");
                return;
            }
            if (topic.DisplayOrder == -1)
            {
                base.ShowMsg("此主题已被删除!");
                return;
            }
            if (topic.ReadPerm > this.usergroupinfo.Readaccess && topic.PosterID != this.userid)
            {
                base.ShowMsg(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.ReadPerm, this.usergroupinfo.GroupTitle));
                return;
            }
            var forum = Forums.GetForumInfo(topic.Fid);

            if (forum.ViewPerm.IsNullOrEmpty())
            {
                if (!this.usergroupinfo.AllowVisit)
                {
                    base.ShowMsg("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有浏览该版块的权限");
                    return;
                }
            }
            else
            {
                if (!forum.AllowView(this.usergroupinfo.ID))
                {
                    base.ShowMsg("您没有浏览该版块的权限");
                    return;
                }
            }
            if (!String.IsNullOrEmpty(forum.Password))
            {
                base.ShowMsg("简洁版本无法浏览设置了密码的版块");
                return;
            }
            int num  = Moderators.IsModer(this.useradminid, this.userid, forum.ID) ? 1 : 0;
            int num2 = 0;

            if (topic.Price > 0 && this.userid != topic.PosterID && num != 1)
            {
                num2 = topic.Price;
                var charge = Scoresets.GetMaxChargeSpan();
                if (PaymentLog.IsBuyer(topicid, this.userid) || charge != 0 && topic.PostDateTime.AddHours(charge) < DateTime.Now)
                {
                    num2 = -1;
                }
            }
            if (num2 > 0)
            {
                base.ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", BaseConfigs.GetForumPath, topic.ID));
                return;
            }
            int num3 = topic.Replies + 1;
            int num4 = 1;
            int num5 = 30;
            int num6 = (num3 % num5 == 0) ? (num3 / num5) : (num3 / num5 + 1);

            if (num6 == 0)
            {
                num6 = 1;
            }
            if (DNTRequest.GetString("page").ToLower().Equals("end"))
            {
                num4 = num6;
            }
            else
            {
                num4 = DNTRequest.GetInt("page", 1);
            }
            if (num4 < 1)
            {
                num4 = 1;
            }
            if (num4 > num6)
            {
                num4 = num6;
            }
            int hide = 1;

            if (topic.Hide == 1 && (Post.IsReplier(topicid, this.userid) || num == 1))
            {
                hide = -1;
            }
            var pi = new PostpramsInfo();

            pi.Fid                    = forum.ID;
            pi.Tid                    = topicid;
            pi.Jammer                 = forum.Jammer;
            pi.Pagesize               = num5;
            pi.Pageindex              = num4;
            pi.Getattachperm          = forum.GetattachPerm;
            pi.Usergroupid            = this.usergroupinfo.ID;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Hide                   = hide;
            pi.Price                  = topic.Price;
            pi.Usergroupreadaccess    = this.usergroupinfo.Readaccess;
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = forum.AllowImgCode ? 1 : 0;
            pi.Smileyoff              = 1;
            pi.Smiliesmax             = 0;
            pi.Smiliesinfo            = null;
            pi.Customeditorbuttoninfo = null;
            pi.Bbcodemode             = 0;
            pi.BBCode                 = false;
            pi.CurrentUserGroup       = this.usergroupinfo;
            pi.Onlinetimeout          = this.config.Onlinetimeout;
            User userInfo = Users.GetUserInfo(this.userid);

            pi.Usercredits = ((userInfo == null) ? 0 : userInfo.Credits);
            this.postlist  = Posts.GetPostList(pi, out this.attachmentlist, num == 1);
            if (this.postlist.Count <= 0)
            {
                base.ShowMsg("读取信息失败");
                return;
            }
            base.ShowTitle(topic.Title + " - ");
            base.ShowBody();
            Response.Write("<h1>" + this.config.Forumtitle + "</h1>");
            Response.Write("<div class=\"forumnav\">");
            Response.Write("<a href=\"index.aspx\">首页</a> &raquo; ");
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(string.Format("{0} &raquo; <a href=\"showtopic-{1}{2}\">{3}</a>", new object[]
                {
                    ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), this.config.Extname).Replace("</a><", "</a> &raquo; <"),
                    topicid.ToString(),
                    this.config.Extname,
                    topic.Title
                }));
            }
            else
            {
                Response.Write(string.Format("{0} &raquo; <a href=\"showtopic.aspx?topicid={1}\">{2}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), "aspx").Replace("</a><", "</a> &raquo; <"), topicid.ToString(), topic.Title));
            }
            Response.Write("</div>\r\n");
            Regex regex  = new Regex("<img alt=.*? imageid=\"(.*?)\".*?newsrc=\"(.*?)\".*?/>", RegexOptions.IgnoreCase);
            Regex regex2 = new Regex("<img imageid=\"(.*?)\" src=\"(.*?)\".*?/>", RegexOptions.IgnoreCase);

            foreach (var item in this.postlist)
            {
                Response.Write("<div class=\"postitem\">\r\n");
                Response.Write("\t<div class=\"postitemtitle\">\r\n");
                Response.Write(Utils.HtmlEncode(item.Poster) + " - " + item.PostDateTime.ToFullString());
                Response.Write("</div><div class=\"postitemcontent\">");
                var msg = item.Message;
                if (this.config.Showimgattachmode == 1)
                {
                    Match match = regex.Match(msg);
                    while (match.Success)
                    {
                        msg   = msg.Replace(match.Value, string.Format("<a href=\"{0}\" target=\"_blank\">点击显示图片:{1}</a>", match.Groups[2].Value, match.Groups[1].Value));
                        match = match.NextMatch();
                    }
                }
                else
                {
                    Match match = regex2.Match(msg);
                    while (match.Success)
                    {
                        msg   = msg.Replace(match.Value, string.Format("<img alt=\"{0}\" src=\"{1}\" />", match.Groups[1].Value, match.Groups[2].Value));
                        match = match.NextMatch();
                    }
                }
                Response.Write(msg);
                foreach (var att in this.attachmentlist)
                {
                    if (att.Pid == item.ID)
                    {
                        Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", att.ID, Utils.HtmlEncode(att.Name)));
                    }
                }
                Response.Write("\t</div>\r\n</div>\r\n");
            }
            Response.Write("<div class=\"pagenumbers\">");
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(Utils.GetStaticPageNumbers(num4, num6, "showtopic-" + topicid, this.config.Extname, 8));
            }
            else
            {
                Response.Write(Utils.GetPageNumbers(num4, num6, "showtopic.aspx?topicid=" + topicid, 8, "page"));
            }
            Response.Write("</div>\r\n");
            //Topic.UpdateViewCount(topicid, 1);
            topic.Views++;
            topic.SaveAsync(10000);
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid, this.config.Extname, topic.Title));
            }
            else
            {
                Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid, topic.Title));
            }
            base.ShowFooter();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }