Пример #1
0
        public HttpResponseMessage BankCardSmsCodeCheck()
        {
            object result           = string.Empty;
            int    consultId        = DNTRequest.GetInt("consultId", -1);
            string code             = DNTRequest.GetString("code");
            string token            = DNTRequest.GetString("token");
            string bankCardId       = DNTRequest.GetString("bankCardId");
            string sign             = DNTRequest.GetString("sign");
            string orderNo          = DNTRequest.GetString("orderNo");
            string timeUnix         = DNTRequest.GetString("timeUnix");
            string merchantsNo      = DNTRequest.GetString("merchantsNo");
            string equipmentNo      = DNTRequest.GetString("equipmentNo");
            string sskdRequestParas = DNTRequest.GetString("sskdRequestParas");
            string orderSource      = DNTRequest.GetString("orderSource");

            NewLoanInterface.cookieValue = token;
            result = NewLoanInterface.BankCardSmsCodeCheck(code, bankCardId, sign, orderNo, timeUnix, merchantsNo, equipmentNo, consultId, sskdRequestParas, orderSource);

            HttpResponseMessage res = new HttpResponseMessage {
                Content = new StringContent(result.ToString(), Encoding.GetEncoding("UTF-8"), "text/plain")
            };

            return(res);
        }
Пример #2
0
        protected override void ShowPage()
        {
            pagetitle = "积分充值";

            if (!EPayments.IsOpenEPayments())
            {
                AddErrLine("论坛未开启积分充值服务!");
                return;
            }

            string jsCreditsRateArray = "";

            foreach (DataRow dr in Scoresets.GetScorePaySet(0).Rows)
            {
                jsCreditsRateArray += "creditsrate[" + dr["id"] + "] = " + dr["rate"] + ";\r\n";
            }
            jscreditsratearray = string.Format(jscreditsratearray, jsCreditsRateArray);

            if (!IsLogin())
            {
                return;
            }

            if (!string.IsNullOrEmpty(DNTRequest.GetString("redirect")))
            {
                switch (DNTRequest.GetString("redirect"))//根据该值判断操作类型
                {
                case "alipay":
                    RedirectToAlipay();
                    break;

                default:
                    return;
                }
            }
        }
        private void Restore_Click(object sender, EventArgs e)
        {
            #region 恢复备份

            if (this.CheckCookie())
            {
                if (!base.IsFounderUid(userid))
                {
                    Response.Write(base.GetShowMessage());
                    Response.End();
                    return;
                }

                if (DNTRequest.GetString("id") != "")
                {
                    string id = DNTRequest.GetString("id");
                    if (id.IndexOf(",0") > 0)
                    {
                        base.RegisterStartupScript("", "<script language=javascript>alert('您一次只能选择一个备份进行提交!');window.location.href='global_backupandrestore.aspx';</script>");
                        return;
                    }
                    DataRow[] drs = buildGridData().Select("id=" + id.Replace("0 ", ""));

                    aysncallback = new delegateBackUpDatabase(RestoreDB);
                    AsyncCallback myCallBack = new AsyncCallback(CallBack);
                    aysncallback.BeginInvoke(ServerName.Text, UserName.Text, Password.Text, strDbName.Text, drs[0]["filename"].ToString(), myCallBack, this.username); //
                    base.LoadRegisterStartupScript("PAGE", "window.location.href='global_backupandrestore.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='global_backupandrestore.aspx';</script>");
                }
            }

            #endregion
        }
        protected void DelRec_Click(object sender, EventArgs e)
        {
            string apikeylist = DNTRequest.GetString("apikey");

            if (apikeylist == "")
            {
                return;
            }
            foreach (string apikey in apikeylist.Split(','))
            {
                APIConfigInfo             aci     = APIConfigs.GetConfig();
                ApplicationInfoCollection appColl = aci.AppCollection;
                foreach (ApplicationInfo ai in appColl)
                {
                    if (ai.APIKey == apikey)
                    {
                        aci.AppCollection.Remove(ai);
                        break;
                    }
                }
                APIConfigs.SaveConfig(aci);
            }
            Response.Redirect("global_passportmanage.aspx");
        }
Пример #5
0
        private void RedirectAPILogin(ApplicationInfo appInfo)
        {
            string   expires = DNTRequest.GetFormString("expires");
            DateTime expireUTCTime;

            if (Utils.StrIsNullOrEmpty(expires))
            {
                expireUTCTime = DateTime.Parse(Users.GetShortUserInfo(userid).Lastvisit).ToUniversalTime().AddSeconds(
                    Convert.ToDouble(Request.Cookies["dnt"]["expires"].ToString()));
            }
            else
            {
                expireUTCTime = DateTime.UtcNow.AddSeconds(Convert.ToDouble(expires));
            }

            expires = Utils.ConvertToUnixTimestamp(expireUTCTime).ToString();

            //CreateToken
            OnlineUsers.UpdateAction(olid, UserAction.Login.ActionID, 0);
            string         next = DNTRequest.GetString("next");
            string         time = "";
            OnlineUserInfo oui  = OnlineUsers.GetOnlineUser(olid);

            if (oui == null)
            {
                time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                time = DateTime.Parse(oui.Lastupdatetime).ToString("yyyy-MM-dd HH:mm:ss");
            }

            string authToken = DES.Encode(string.Format("{0},{1},{2}", olid, time, expires), appInfo.Secret.Substring(0, 10)).Replace("+", "[");

            Response.Redirect(string.Format("{0}{1}auth_token={2}{3}", appInfo.CallbackUrl, appInfo.CallbackUrl.IndexOf("?") > 0 ? "&" : "?", authToken, next == "" ? next : "&next=" + next));
        }
Пример #6
0
        private void APILogin(APIConfigInfo apiInfo)
        {
            ApplicationInfo           appInfo       = null;
            ApplicationInfoCollection appcollection = apiInfo.AppCollection;

            foreach (ApplicationInfo newapp in appcollection)
            {
                if (newapp.APIKey == DNTRequest.GetString("api_key"))
                {
                    appInfo = newapp;
                }
            }

            if (appInfo == null)
            {
                return;
            }

            this.Load += delegate
            {
                RedirectAPILogin(appInfo);
                this.Load += delegate { };
            };
        }
Пример #7
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);
 }
Пример #8
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);
        }
Пример #9
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");
            }
        }
Пример #10
0
        /// <summary>
        /// 设置页码链接
        /// </summary>
        private void SetPageNumber()
        {
            if (DNTRequest.GetString("search") == "")
            {
                if (topictypeid == -1)
                {
                    if (config.Aspxrewrite == 1)
                    {
                        if (Utils.StrIsNullOrEmpty(filter))
                        {
                            if (config.Iisurlrewrite == 0)
                            {
                                pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 1 : 0));
                            }
                            else
                            {
                                pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 2 : 0));
                            }

                            if (pageid < pagecount)
                            {
                                nextpage = string.Format("<a href=\"{0}{1}\" class=\"next\">下一页</a>", forumpath, Urls.ShowForumAspxRewrite(forumid, pageid + 1, forum.Rewritename));
                            }
                        }
                        else
                        {
                            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&filter={2}", forumpath, forumid, filter), 8);

                            if (pageid < pagecount)
                            {
                                nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&filter={2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, filter, pageid + 1);
                            }
                        }
                    }
                    else
                    {
                        pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}{2}", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                        if (pageid < pagecount)
                        {
                            nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}{2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                        }
                    }
                }
                else //当有主题类型条件时
                {
                    pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&typeid={2}{3}",
                                                                                        forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                    if (pageid < pagecount)
                    {
                        nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&typeid={2}{3}&page={4}\" class=\"next\">下一页</a>", forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                    }
                }
            }
            else
            {
                pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}",
                                                                                    forumpath, DNTRequest.GetHtmlEncodeString("cond").Trim(), order, direct, forumid, interval,
                                                                                    topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                if (pageid < pagecount)
                {
                    nextpage = string.Format("<a href=\"{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}&page={8}\" class=\"next\">下一页</a>",
                                             forumpath, DNTRequest.GetHtmlEncodeString("cond").Trim(), order, direct,
                                             forumid, interval, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                }
            }
        }
Пример #11
0
        protected void SaveFtpInfo_Click(object sender, EventArgs e)
        {
            string ftpType = GetParam(DNTRequest.GetString("ftptype"));

            if (Serveraddress.Text.Trim() == "" || Serverport.Text.Trim() == "" || Username.Text.Trim() == "" ||
                Password.Text.Trim() == "" || Uploadpath.Text.Trim() == "" || Timeout.Text.Trim() == "" || Remoteurl.Text.Trim() == "")
            {
                base.RegisterStartupScript("", "<script>alert('远程附件设置各项不允许为空');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>");
                return;
            }
            if (Uploadpath.Text.EndsWith("/"))
            {
                base.RegisterStartupScript("", "<script>alert('附件保存路径不允许以“/”结尾');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>");
                return;
            }
            if (Remoteurl.Text.EndsWith("/"))
            {
                base.RegisterStartupScript("", "<script>alert('远程访问 URL 不允许以“/”结尾');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>");
                return;
            }
            if (!Utils.IsNumeric(Serverport.Text) || int.Parse(Serverport.Text) < 1)
            {
                base.RegisterStartupScript("", "<script>alert('远程访问端口必须为数字并且大于1');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>");
                return;
            }
            if (!Utils.IsNumeric(Timeout.Text) || int.Parse(Timeout.Text) < 0)
            {
                base.RegisterStartupScript("", "<script>alert('超时时间必须为数字并且大于1');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>");
                return;
            }
            FTPConfigInfoCollection ftpConfigInfoCollection =
                (FTPConfigInfoCollection)SerializationHelper.Load(typeof(FTPConfigInfoCollection), Server.MapPath("../../config/ftp.config"));
            bool isEdit = false;

            foreach (FTPConfigInfo fci in ftpConfigInfoCollection)
            {
                if (fci.Name == ftpType)
                {
                    fci.Serveraddress       = Serveraddress.Text;
                    fci.Serverport          = int.Parse(Serverport.Text);
                    fci.Username            = Username.Text;
                    fci.Password            = Password.Text;
                    fci.Mode                = int.Parse(Mode.SelectedValue);
                    fci.Uploadpath          = Uploadpath.Text;
                    fci.Timeout             = int.Parse(Timeout.Text);
                    fci.Allowupload         = int.Parse(Allowupload.SelectedValue);
                    fci.Remoteurl           = Remoteurl.Text;
                    fci.Reservelocalattach  = int.Parse(Reservelocalattach.SelectedValue);
                    fci.Reserveremoteattach = int.Parse(Reserveremoteattach.SelectedValue);
                    isEdit = true;
                    break;
                }
            }
            if (!isEdit)
            {
                FTPConfigInfo fci = new FTPConfigInfo();
                fci.Name                = ftpType;
                fci.Serveraddress       = Serveraddress.Text;
                fci.Serverport          = int.Parse(Serverport.Text);
                fci.Username            = Username.Text;
                fci.Password            = Password.Text;
                fci.Mode                = int.Parse(Mode.SelectedValue);
                fci.Uploadpath          = ftpType.ToLower();
                fci.Timeout             = int.Parse(Timeout.Text);
                fci.Allowupload         = int.Parse(Allowupload.SelectedValue);
                fci.Remoteurl           = Remoteurl.Text;
                fci.Reservelocalattach  = int.Parse(Reservelocalattach.SelectedValue);
                fci.Reserveremoteattach = int.Parse(Reserveremoteattach.SelectedValue);
                ftpConfigInfoCollection.Add(fci);
            }
            SerializationHelper.Save(ftpConfigInfoCollection, Server.MapPath("../../config/ftp.config"));
            Response.Redirect("global_ftpsetting.aspx?ftptype=" + ftpType);
        }
 protected void DataGrid_Edit(Object sender, DataGridCommandEventArgs E)
 {
     if (ViewState["validrow"].ToString().IndexOf("," + E.Item.ItemIndex + ",") >= 0)
     {
         DataGrid1.EditItemIndex = (int)E.Item.ItemIndex;
         DataGrid1.DataSource    = LoadDataInfo();
         DataGrid1.DataBind();
     }
     else
     {
         base.RegisterStartupScript("", "<script>alert('操作失败,您所修改的金币行是无效的,具体操作请看注释!');window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';</script>");
         return;
     }
 }
Пример #13
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);
        }
Пример #14
0
        private void StopTalk_Click(object sender, EventArgs e)
        {
            #region 设置禁言

            if (this.CheckCookie())
            {
                userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1));

                if (!AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true))
                {
                    return;
                }

                if (ViewState["Groupid"].ToString() != "4") //当用户不是系统禁言组时
                {
                    if (userInfo.Uid > 1)                   //判断是不是当前uid是不是系统初始化时生成的uid
                    {
                        if (AlbumPluginProvider.GetInstance() != null)
                        {
                            AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                        }
                        if (SpacePluginProvider.GetInstance() != null)
                        {
                            SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                        }
                        Users.UpdateUserToStopTalkGroup(userInfo.Uid.ToString());
                        base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>");
                    }
                }
                else
                {
                    if (CreditsFacade.GetCreditsUserGroupId(0) != null)
                    {
                        int tmpGroupID = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                        Users.UpdateUserGroup(userInfo.Uid, tmpGroupID);
                        base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>");
                    }
                }
                OnlineUsers.DeleteUserByUid(userInfo.Uid);
            }

            #endregion
        }
Пример #15
0
        private void ResetUserPost_Click(object sender, EventArgs e)
        {
            #region 重设用户发帖

            if (this.CheckCookie())
            {
                AdminForumStats.ReSetUserPosts(DNTRequest.GetInt("uid", -1), DNTRequest.GetInt("uid", -1));
                base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';");
            }

            #endregion
        }
Пример #16
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();
        }
Пример #17
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            AvatarSize avatarSize;

            switch (DNTRequest.GetString("size").ToLower())
            {
            case "large":
                avatarSize = AvatarSize.Large;
                break;

            case "medium":
                avatarSize = AvatarSize.Medium;
                break;

            case "small":
                avatarSize = AvatarSize.Small;
                break;

            default:
                avatarSize = AvatarSize.Medium;
                break;
            }

            var uid = DNTRequest.GetInt("uid");

            // 如果物理文件存在,直接返回
            var fi = Avatars.GetPhysicsAvatarPath(uid + "", avatarSize);

            // 如果没有缓存,文件也不在,那么直接返回默认
            if (!File.Exists(fi))
            {
                fi = Utils.GetMapPath(BaseConfigs.GetForumPath.CombinePath("avatars/avatar_" + avatarSize.ToString().ToLower() + ".jpg"));
            }
            if (File.Exists(fi))
            {
                var ci = GetData(fi);

                // 检查缓存是否有效
                var wd = new WebDownload();
                wd.BrowserCache = true;
                wd.ModifyTime   = ci.ModifyTime;
                if (wd.CheckCache())
                {
                    return;
                }

                wd.Stream = new MemoryStream(ci.Data);
                //wd.Mode = WebDownload.DispositionMode.Inline;
                wd.ContentType = "image/" + Path.GetExtension(fi).TrimStart('.');

                // 启用浏览器缓存
                wd.BrowserCache = true;

                wd.Speed = 0;
                wd.Render();

                return;
            }

            //var avatarUrl = Avatars.GetAvatarUrl(uid + "", avatarSize);
            //XTrace.WriteLine("头像{0}未取到,跳转地址 {1}", fi, avatarUrl);
            //HttpContext.Current.Response.Redirect(avatarUrl);
        }
Пример #18
0
        private void DelPosts_Click(object sender, EventArgs e)
        {
            #region  除用户帖

            if (this.CheckCookie())
            {
                int uid = DNTRequest.GetInt("uid", -1);

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                //清除用户所发的帖子
                Posts.ClearPosts(uid, 0);
                //foreach (DataRow dr in Posts.GetAllPostTableName().Rows)
                //{
                //    if (dr["id"].ToString() != "")
                //    {
                //        Posts.DeletePostByPosterid(int.Parse(dr["id"].ToString()), uid);
                //    }
                //}
                //Topics.DeleteTopicByPosterid(uid);
                //Users.ClearPosts(uid);
                base.RegisterStartupScript("", "<script>alert('请到 论坛维护->论坛数据维护->重建指定主题区间帖数 对出现因为该操作产生\"读取信息失败\"的主题进行修复 ')</script>");
                base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + uid + "&condition=" + DNTRequest.GetString("condition") + "';");
            }

            #endregion
        }
        protected void DataGrid_Update(Object sender, DataGridCommandEventArgs E)
        {
            #region 编辑相关的金币设置信息

            string id        = DataGrid1.DataKeys[(int)E.Item.ItemIndex].ToString();
            bool   available = ((CheckBox)E.Item.FindControl("available")).Checked;
            string Min       = ((TextBox)E.Item.Cells[5].Controls[0]).Text.Trim();
            string Max       = ((TextBox)E.Item.Cells[6].Controls[0]).Text.Trim();
            string MaxInDay  = ((TextBox)E.Item.Cells[7].Controls[0]).Text.Trim();

            LoadDataInfo();
            int count = Convert.ToInt32(id) - 1;
            if (available)
            {
                templateDT.Rows[count]["available"] = true;
            }
            else
            {
                templateDT.Rows[count]["available"] = false;
            }

            if (Min == "" || Max == "" || MaxInDay == "")
            {
                base.RegisterStartupScript("", "<script>alert('评分的最小值,最大值以及24小时最大评分数不能为空.');window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';</script>");
                return;
            }

            if ((Min != "" && !Utils.IsNumeric(Min.Replace("-", ""))) || (Max != "" && !Utils.IsNumeric(Max.Replace("-", ""))) || (MaxInDay != "" && !Utils.IsNumeric(MaxInDay.Replace("-", ""))))
            {
                base.RegisterStartupScript("", "<script>alert('输入的数据必须是数字.');window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';</script>");
                return;
            }

            if (Convert.ToInt32(Utils.SBCCaseToNumberic(Min)) >= Convert.ToInt32(Utils.SBCCaseToNumberic(Max)))
            {
                base.RegisterStartupScript("", "<script>alert('评分的最小值必须小于评分最大值.');window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';</script>");
                return;
            }

            templateDT.Rows[count]["Min"]      = Convert.ToInt32(Utils.SBCCaseToNumberic(Min));
            templateDT.Rows[count]["Max"]      = Convert.ToInt32(Utils.SBCCaseToNumberic(Max));
            templateDT.Rows[count]["MaxInDay"] = Convert.ToInt32(Utils.SBCCaseToNumberic(MaxInDay));

            try
            {
                WriteScoreInf(templateDT);
                DataGrid1.EditItemIndex = -1;
                DataGrid1.DataSource    = LoadDataInfo();
                DataGrid1.DataBind();
                base.RegisterStartupScript("PAGE", "window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';");
            }
            catch
            {
                base.RegisterStartupScript("", "<script>alert('无法更新数据库.');window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';</script>");
                return;
            }

            #endregion
        }
Пример #20
0
        private void ReSendEmail_Click(object sender, EventArgs e)
        {
            #region 发送EMAIL

            string authstr = ForumUtils.CreateAuthStr(20);
            Emails.DiscuzSmtpMail(userName.Text, email.Text, "", authstr);
            string uid = DNTRequest.GetString("uid");
            //DbHelper.ExecuteNonQuery("UPDATE [" + BaseConfigs.GetTablePrefix + "userfields] SET [Authstr]='" + authstr + "' , [Authtime]='" + DateTime.Now.ToString() + "' ,[Authflag]=1  WHERE [uid]=" + uid);
            Users.UpdateEmailValidateInfo(authstr, DateTime.Now, int.Parse(uid));
            base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + uid + "&condition=" + DNTRequest.GetString("condition") + "';");

            #endregion
        }
        private void GivenMedal_Click(object sender, EventArgs e)
        {
            #region 给予勋章

            if (this.CheckCookie())
            {
                int uid = DNTRequest.GetInt("uid", -1);
                Users.UpdateMedals(uid, DNTRequest.GetString("medalid"), userid, username, DNTRequest.GetIP(), reason.Text.Trim());

                if (DNTRequest.GetString("codition") == "")
                {
                    Session["codition"] = null;
                }
                else
                {
                    Session["codition"] = DNTRequest.GetString("codition").Replace("^", "'");
                }

                base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + uid + "&condition=" + DNTRequest.GetString("condition") + "';");
            }

            #endregion
        }
Пример #22
0
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserId(userName.Text) > 0)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                userInfo             = AdminUsers.GetUserInfo(uid);
                userInfo.Username    = userName.Text;
                userInfo.Nickname    = nickname.Text;
                userInfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (userInfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    userInfo.Adminid = UserGroups.GetUserGroupInfo(int.Parse(groupid.SelectedValue)).Radminid;
                }

                //userInfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    userInfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        userInfo.Bday = bday.Text;
                    }
                }


                if (!Users.ValidateEmail(email.Text, uid))
                {
                    base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                    return;
                }

                userInfo.Email  = email.Text;
                userInfo.Gender = Convert.ToInt32(gender.SelectedValue);
                //userInfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);后台操作为永久禁言和永久禁访

                userInfo.Groupexpiry = 0;
                userInfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (userInfo.Uid == BaseConfigs.GetFounderUid))
                {
                    base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                userInfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                userInfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                userInfo.Joindate     = joindate.Text;
                userInfo.Lastactivity = lastactivity.Text;
                userInfo.Lastip       = lastip.Text;
                userInfo.Lastpost     = lastpost.Text;
                userInfo.Lastvisit    = lastvisit.Text;
                userInfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                userInfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                userInfo.Oltime       = Convert.ToInt32(oltime.Text);
                userInfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                userInfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                userInfo.Posts        = Convert.ToInt32(posts.Text);
                userInfo.Ppp          = Convert.ToInt32(ppp.Text);
                userInfo.Regip        = regip.Text;
                userInfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    userInfo.Secques = "";                               //清空安全码
                }
                userInfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                userInfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                userInfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                userInfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    userInfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    userInfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    userInfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    userInfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    userInfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    userInfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    userInfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    userInfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }


                //根据公式计算用户的总积分,并更新
                userInfo.Credits = CreditsFacade.GetUserCreditsByUserInfo(userInfo);
                //判断用户组是否为积分用户组。如果是的话,就用当前积分更新。
                if (UserGroups.IsCreditUserGroup(userInfo.Groupid))
                {
                    userInfo.Groupid = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                }
                //用户扩展信息
                userInfo.Website      = website.Text;
                userInfo.Icq          = icq.Text;
                userInfo.Qq           = qq.Text;
                userInfo.Yahoo        = yahoo.Text;
                userInfo.Msn          = msn.Text;
                userInfo.Skype        = skype.Text;
                userInfo.Location     = location.Text;
                userInfo.Customstatus = customstatus.Text;
                //userInfo.Avatar = avatar.Text;
                //userInfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                //userInfo.Avatarwidth = Convert.ToInt32(avatarwidth.Text);
                userInfo.Bio = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    userInfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(userInfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    userInfo.Sightml          = UBB.UBBToHTML(_postpramsinfo);
                }

                userInfo.Realname = realname.Text;
                userInfo.Idcard   = idcard.Text;
                userInfo.Mobile   = mobile.Text;
                userInfo.Phone    = phone.Text;
                userInfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked && userName.Text != ViewState["username"].ToString())
                {
                    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //用户重命名同步
                    Discuz.Forum.Sync.RenameUser(userInfo.Uid, ViewState["username"].ToString(), userInfo.Username, "");
                }

                if (AdminUsers.UpdateUserAllInfo(userInfo))
                {
                    OnlineUsers.DeleteUserByUid(userInfo.Uid);    //移除该用户的在线信息,使之重建在线表信息
                    if (ViewState["Groupid"].ToString() != userInfo.Groupid.ToString())
                    {
                        if (userInfo.Groupid == 4)
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                        }
                        else
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                        }
                    }
                    //if (userName.Text != ViewState["username"].ToString())
                    //{
                    //    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //}
                    //删除头像
                    if (delavart.Checked)
                    {
                        Avatars.DeleteAvatar(userInfo.Uid.ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
Пример #23
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);
        }
Пример #24
0
        private void DelUserInfo_Click(object sender, EventArgs e)
        {
            #region  除指定用户信息

            if (this.CheckCookie())
            {
                int uid = DNTRequest.GetInt("uid", -1);

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (AllowDeleteUser(this.userid, uid))
                {
                    bool delpost = !(deltype.SelectedValue.IndexOf("1") >= 0);
                    bool delpms  = !(deltype.SelectedValue.IndexOf("2") >= 0);

                    if (SpacePluginProvider.GetInstance() != null)
                    {
                        SpacePluginProvider.GetInstance().Delete(uid);
                    }

                    if (AlbumPluginProvider.GetInstance() != null)
                    {
                        AlbumPluginProvider.GetInstance().Delete(uid);
                    }
                    if (AdminUsers.DelUserAllInf(uid, delpost, delpms))
                    {
                        //删除用户同步
                        Discuz.Forum.Sync.DeleteUsers(uid.ToString(), "");
                        //ManyouApplications.AddUserLog(uid, UserLogActionEnum.Delete);
                        //删除该用户头像
                        Avatars.DeleteAvatar(uid.ToString());
                        AdminUsers.UpdateForumsFieldModerators(userName.Text);

                        OnlineUsers.DeleteUserByUid(userInfo.Uid);    //移除该用户的在线信息,使之退出
                        AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:" + userName.Text);
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,你要删除的用户是创始人用户或是其它管理员,因此不能删除!');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
Пример #25
0
        public void AddCompany(HttpContext context)
        {
            int CompanyId = 0;

            if (!string.IsNullOrEmpty(DNTRequest.GetString("CompanyId")))
            {
                CompanyId = Convert.ToInt32(DNTRequest.GetString("CompanyId"));
            }

            string     objOrder   = GetParam("CompanyModel", context);
            Company    company    = JsonConvert.DeserializeObject <Company>(objOrder);
            CompanyBLL companybll = new CompanyBLL();

            //保存数据
            HttpFileCollection hfColl    = context.Request.Files;
            HttpPostedFile     postFile  = hfColl["FileLoad1"];
            HttpPostedFile     postFile2 = hfColl["FileLoad2"];

            if (postFile2 != null)
            {
                string fPath = "";
                if (company.CompanyCategoryId == 1)
                {
                    fPath = "/Content/img/Mofang/";
                }
                if (company.CompanyCategoryId == 2)
                {
                    fPath = "/Content/img/NetLoan/";
                }
                if (company.CompanyCategoryId == 3)
                {
                    fPath = "/Content/img/Bank/";
                }
                if (company.CompanyCategoryId == 4)
                {
                    fPath = "/Content/img/CreditCard/";
                }
                if (company.CompanyCategoryId == 5)
                {
                    fPath = "/Content/img/Other/";
                }
                string fileName = Path.GetFileName(postFile2.FileName);

                string TPath    = DateTime.Now.ToString("yyyyMMddHHmmss") + fileName;
                string filePath = fPath + TPath;
                string basePath = HttpContext.Current.Server.MapPath(fPath);
                string fDir     = basePath + TPath;
                // 路径不存在的创建
                if (!System.IO.Directory.Exists(basePath))
                {
                    System.IO.Directory.CreateDirectory(basePath);
                }

                if (System.IO.File.Exists(fDir))
                {
                    System.IO.File.Delete(fDir);
                }
                postFile2.SaveAs(fDir);
                company.Logo = filePath;
            }
            if (postFile != null)
            {
                string fPath = "";
                if (company.CompanyCategoryId == 1)
                {
                    fPath = "/Content/img/Mofang/";
                }
                if (company.CompanyCategoryId == 2)
                {
                    fPath = "/Content/img/NetLoan/";
                }
                if (company.CompanyCategoryId == 3)
                {
                    fPath = "/Content/img/Bank/";
                }
                if (company.CompanyCategoryId == 4)
                {
                    fPath = "/Content/img/CreditCard/";
                }
                if (company.CompanyCategoryId == 5)
                {
                    fPath = "/Content/img/Other/";
                }
                string fileName = Path.GetFileName(postFile.FileName);

                string TPath    = DateTime.Now.ToString("yyyyMMddHHmmss") + fileName;
                string filePath = fPath + TPath;
                string basePath = HttpContext.Current.Server.MapPath(fPath);
                string fDir     = basePath + TPath;
                // 路径不存在的创建
                if (!System.IO.Directory.Exists(basePath))
                {
                    System.IO.Directory.CreateDirectory(basePath);
                }

                if (System.IO.File.Exists(fDir))
                {
                    System.IO.File.Delete(fDir);
                }
                postFile.SaveAs(fDir);
                company.QRCode = filePath;
            }
            int result = 0;

            //编辑
            if (CompanyId > 0)
            {
                result = companybll.Update(company) ? 1 : 0;
            }
            else
            {
                result = companybll.Add(company);
            }
            context.Response.Write(result);
        }
Пример #26
0
        public showtopic()
        {
            // 获取主题ID
            int topicid = DNTRequest.GetInt("topicid", -1);

            // 如果主题ID非数字
            if (topicid == -1)
            {
                ShowMsg("无效的主题ID");
                return;
            }

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

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

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

            ForumInfo forum = Forums.GetForumInfo(topic.Fid);

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

            if (forum.Password != "")
            {
                ShowMsg("简洁版本无法浏览设置了密码的版块");
                return;
            }

            //验证用户是否为本版版主
            int ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;

            //购买帖子操作
            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            int price = 0;

            if (topic.Price > 0 && userid != topic.Posterid && ismoder != 1)
            {
                price = topic.Price;
                //时间乘以-1是因为当Configs.GetMaxChargeSpan()==0时,帖子始终为购买帖
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买
                {
                    price = -1;
                }
            }
            if (price > 0)
            {
                ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", "/Forum/", topic.Tid));
                return;
            }


            // 获取帖子总数
            //postcount = Posts.GetPostCount(topicid);
            int postcount = topic.Replies + 1;
            int pageid    = 1;

            // 得到Tpp设置
            int ppp = 30;

            //获取总页数
            int pagecount = postcount % ppp == 0 ? postcount / ppp : postcount / ppp + 1;

            if (pagecount == 0)
            {
                pagecount = 1;
            }
            // 得到当前用户请求的页数
            if (DNTRequest.GetString("page").ToLower().Equals("end"))
            {
                pageid = pagecount;
            }
            else
            {
                pageid = DNTRequest.GetInt("page", 1);
            }
            //修正请求页数中可能的错误
            if (pageid < 1)
            {
                pageid = 1;
            }
            if (pageid > pagecount)
            {
                pageid = pagecount;
            }

            int hide = 1;

            if (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1))
            {
                hide = -1;
            }


            //获取当前页主题列表


            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                 = forum.Fid;
            postpramsInfo.Tid                 = topicid;
            postpramsInfo.Jammer              = forum.Jammer;
            postpramsInfo.Pagesize            = ppp;
            postpramsInfo.Pageindex           = pageid;
            postpramsInfo.Getattachperm       = forum.Getattachperm;
            postpramsInfo.Usergroupid         = usergroupinfo.Groupid;
            postpramsInfo.Attachimgpost       = config.Attachimgpost;
            postpramsInfo.Showattachmentpath  = config.Showattachmentpath;
            postpramsInfo.Hide                = hide;
            postpramsInfo.Price               = topic.Price;
            postpramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess;


            postpramsInfo.CurrentUserid = userid;

            postpramsInfo.Showimages = forum.Allowimgcode;
            // 简洁版本中关闭表情符的解析
            postpramsInfo.Smileyoff              = 1;
            postpramsInfo.Smiliesmax             = 0;
            postpramsInfo.Smiliesinfo            = null;
            postpramsInfo.Customeditorbuttoninfo = null;
            postpramsInfo.Bbcodemode             = 0;
            // 简洁版本中关闭ubb转换
            postpramsInfo.Bbcodeoff        = 1;
            postpramsInfo.CurrentUserGroup = usergroupinfo;

            postpramsInfo.Onlinetimeout = config.Onlinetimeout;

            postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            if (postlist.Count <= 0)
            {
                ShowMsg("读取信息失败");
                return;
            }

            ShowTitle(topic.Title);
            ShowBody();
            HttpContext.Current.Response.Write("<h1>" + config.Forumtitle + "</h1>");

            HttpContext.Current.Response.Write("<div class=\"forumnav\">");
            HttpContext.Current.Response.Write("<a href=\"index.aspx\">首页</a> &raquo; ");

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(string.Format("{0} &raquo; <a href=\"showtopic-{1}{2}\">{3}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("</a><", "</a> &raquo; <"), topicid.ToString(), config.Extname, topic.Title));
            }
            else
            {
                HttpContext.Current.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));
            }
            HttpContext.Current.Response.Write("</div>\r\n");

            foreach (ShowtopicPagePostInfo postinfo in postlist)
            {
                HttpContext.Current.Response.Write("<div class=\"postitem\">\r\n");
                HttpContext.Current.Response.Write("\t<div class=\"postitemtitle\">\r\n");
                HttpContext.Current.Response.Write(Utils.HtmlEncode(postinfo.Poster) + " - " + postinfo.Postdatetime);
                HttpContext.Current.Response.Write("</div><div class=\"postitemcontent\">");
                HttpContext.Current.Response.Write(postinfo.Message);
                foreach (ShowtopicPageAttachmentInfo attinfo in attachmentlist)
                {
                    if (attinfo.Pid == postinfo.Pid)
                    {
                        HttpContext.Current.Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", attinfo.Aid.ToString(), Utils.HtmlEncode(attinfo.Attachment)));
                    }
                }
                HttpContext.Current.Response.Write("\t</div>\r\n</div>\r\n");
            }
            //得到页码链接
            HttpContext.Current.Response.Write("<div class=\"pagenumbers\">");

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(Utils.GetStaticPageNumbers(pageid, pagecount, "showtopic-" + topicid.ToString(), config.Extname, 8));
            }
            else
            {
                HttpContext.Current.Response.Write(Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?topicid=" + topicid.ToString(), 8, "page"));
            }
            HttpContext.Current.Response.Write("</div>\r\n");
            //更新查看次数
            //Topics.UpdateTopicViews(topicid);
            TopicStats.Track(topicid, 1);

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid.ToString(), config.Extname, topic.Title));
            }
            else
            {
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid.ToString(), topic.Title));
            }
            ShowFooter();
            HttpContext.Current.Response.End();
        }
Пример #27
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");
            }
        }
Пример #28
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }
            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            enabletag     = config.Enabletag == 1;
            categoryslist = Space.Data.DbProvider.GetInstance().GetSpaceCategoryListByUserId(userid);
            spaceconfig   = Spaces.GetSpaceConfigByUserId(userid);
            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("poststatus")) || !Utils.IsNumeric(DNTRequest.GetString("commentstatus")))
                {
                    AddErrLine("请您确保 发布类型,评论类型,数据项有效!");
                    return;
                }
                if (DNTRequest.GetString("title") == "")
                {
                    AddErrLine("请您输入文章标题");
                    return;
                }
                if (DNTRequest.GetString("title").Length > 150)
                {
                    AddErrLine("请将文章标题保持在150字以内");
                    return;
                }
                if (blogcontent == "")
                {
                    AddErrLine("请您输入文章内容");
                    return;
                }

                SpacePostInfo spacepostsinfo = new SpacePostInfo();
                spacepostsinfo.Title          = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));
                spacepostsinfo.Content        = Utils.HtmlEncode(ForumUtils.BanWordFilter(blogcontent));
                spacepostsinfo.Category       = DNTRequest.GetString("category");
                spacepostsinfo.PostStatus     = DNTRequest.GetFormInt("poststatus", 0);
                spacepostsinfo.CommentStatus  = DNTRequest.GetFormInt("commentstatus", 0);
                spacepostsinfo.Postdatetime   = DateTime.Now;
                spacepostsinfo.Author         = username;
                spacepostsinfo.Uid            = userid;
                spacepostsinfo.PostUpDateTime = DateTime.Now;
                spacepostsinfo.Commentcount   = 0;

                int postid = Space.Data.DbProvider.GetInstance().AddSpacePost(spacepostsinfo);

                //启用了标签功能
                if (enabletag)
                {
                    string   tags      = DNTRequest.GetString("tags").Trim();
                    string[] tagsArray = null;
                    if (!Utils.StrIsNullOrEmpty(tags))
                    {
                        tagsArray = Utils.SplitString(tags, " ", true, 10);
                        if (tagsArray != null && tagsArray.Length > 0)
                        {
                            Space.Data.DbProvider.GetInstance().CreateSpacePostTags(string.Join(" ", tagsArray), postid, userid, Utils.GetDateTime());
                            SpaceTags.WriteSpacePostTagsCacheFile(postid);
                        }
                    }
                }
                DNTCache.GetCacheService().RemoveObject("/Space/RecentUpdateSpaceAggregationList");
                SetUrl("usercpspacemanageblog.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("文章增加成功");
            }
        }
Пример #29
0
        /// <summary>
        /// 设置分页信息
        /// </summary>
        private void SetPageIdAndNumber()
        {
            //设置查询条件
            //SetCondition();
            //获取主题总数
            topiccount = Topics.GetTopicCount(condition);

            //防止查询数超过系统规定的最大值
            topiccount = maxseachnumber > topiccount ? topiccount : maxseachnumber;

            if (tpp <= 0)
            {
                tpp = config.Tpp;
            }

            //得到用户设置的每页显示主题数
            if (userid != -1)
            {
                ShortUserInfo userinfo = Users.GetShortUserInfo(userid);
                if (userinfo != null)
                {
                    if (userinfo.Tpp > 0)
                    {
                        tpp = userinfo.Tpp;
                    }

                    if (userinfo.Newpm == 0)
                    {
                        newpmcount = 0;
                    }
                }
            }

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

            //修正请求页数中可能的错误
            pageid = pageid < 1 ? 1 : pageid;
            pageid = pageid > pagecount ? pagecount : pageid;

            //如果当前页面的返回结果超过系统规定的的范围时,则进行相应删剪
            if ((pageid * tpp) > topiccount)
            {
                tpp = tpp - (pageid * tpp - topiccount);
            }

            //得到页码链接
            pagenumbers = Utils.StrIsNullOrEmpty(DNTRequest.GetString("search")) ?
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?type={0}&newtopic={1}&forumid={2}&forums={3}", type, newtopic, forumid, forums), 8) :
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?search=1&type={0}&newtopic={1}&order={2}&direct={3}&forumid={4}&forums={5}",
                                                                                type, newtopic, DNTRequest.GetString("order"), DNTRequest.GetString("direct"), forumid, forums), 8);
        }
Пример #30
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.CheckCookie())
            {
                string url = DNTRequest.GetString("url");
                if (this.modulename.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('模块名称不能为空');</script>");
                    return;
                }

                if (url != string.Empty)
                {
                    XmlDocument xml = new XmlDocument();
                    try
                    {
                        xml.Load(listfilename);
                    }
                    catch
                    {
                        base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>");
                        return;
                    }
                    XmlNodeList xnl         = xml.GetElementsByTagName("Gadget");
                    XmlNodeList xnlCategory = xml.GetElementsByTagName("Category");
                    for (int i = 0; i < xnl.Count; i++)
                    {
                        if (xnl[i].Attributes["url"].Value == url)
                        {
                            xnl[i].Attributes["name"].Value = this.modulename.Text;
                            XmlNode newnode = xnl[i].Clone();
                            xnl[i].ParentNode.RemoveChild(xnl[i]);

                            foreach (XmlNode node in xnlCategory)
                            {
                                if (node.Attributes["name"].Value == this.category.SelectedValue)
                                {
                                    node.AppendChild(newnode);
                                }
                            }

                            try
                            {
                                xml.Save(listfilename);
                            }
                            catch
                            {
                                base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>");
                                return;
                            }

                            break;
                        }
                    }

                    if (url.StartsWith("builtin_"))
                    {
                        //内置模块,更改数据库中的模块名称
                        ModuleDefInfo mdi = Spaces.GetModuleDefById(Spaces.GetModuleDefIdByUrl(url));
                        mdi.ModuleName = this.modulename.Text;
                        SpaceProvider.UpdateModuleDefInfo(mdi);
                        DNTCache.GetCacheService().RemoveObject("/Space/ModuleDefList");
                    }
                }

                base.RegisterStartupScript("", "<script>window.location.href='space_moduledefmanage.aspx';</script>");
            }
        }