private void SaveInfo_Click(object sender, EventArgs e)
        {
            #region 保存设置信息

            if (this.CheckCookie())
            {
                GeneralConfigInfo    configInfo           = GeneralConfigs.GetConfig();
                InvitationConfigInfo invitationConfigInfo = InvitationConfigs.GetConfig();

                if (Convert.ToInt16(regverify.SelectedValue) == 1 && DNTRequest.GetString("verifyemailtempmessage_hidden").IndexOf("{1}") == -1)
                {
                    base.RegisterStartupScript("erro", "<script>alert('验证请求信息邮件内容模板中必须包含\"{1}\"');</script>");
                    return;
                }

                configInfo.Regstatus               = Convert.ToInt16(regstatus.SelectedValue);
                configInfo.Censoruser              = DelNullRowOrSpace(censoruser.Text);
                configInfo.Doublee                 = Convert.ToInt16(doublee.SelectedValue);
                configInfo.Emaillogin              = Convert.ToInt16(emaillogin.SelectedValue);
                configInfo.Regverify               = Convert.ToInt16(regverify.SelectedValue);
                configInfo.Accessemail             = accessemail.Text;
                configInfo.Censoremail             = censoremail.Text;
                configInfo.Hideprivate             = Convert.ToInt16(hideprivate.SelectedValue);
                configInfo.Ipdenyaccess            = ipdenyaccess.Text;
                configInfo.Ipaccess                = ipaccess.Text;
                configInfo.Regctrl                 = Convert.ToInt16(regctrl.Text);
                configInfo.Ipregctrl               = ipregctrl.Text;
                configInfo.Adminipaccess           = adminipaccess.Text;
                configInfo.Welcomemsg              = Convert.ToInt16(welcomemsg.SelectedValue);
                configInfo.Welcomemsgtxt           = welcomemsgtxt.Text;
                configInfo.Rules                   = Convert.ToInt16(rules.SelectedValue);
                configInfo.Rulestxt                = rulestxt.Text;
                configInfo.Newbiespan              = Convert.ToInt16(newbiespan.Text);
                configInfo.Realnamesystem          = Convert.ToInt16(realnamesystem.SelectedValue);
                configInfo.Passwordmode            = Convert.ToInt16(passwordmode.SelectedValue);
                configInfo.CookieDomain            = CookieDomain.Text;
                configInfo.Verifyregisterexpired   = Convert.ToInt16(verifyregisterexpired.Text);
                configInfo.Verifyregisteremailtemp = RepairEmailTemplateCodeParameter(DNTRequest.GetString("verifyemailtempmessage_hidden"));

                invitationConfigInfo.InviteCodePayCount             = Utils.StrToInt(addextcreditsline.Text, 0);
                invitationConfigInfo.InviteCodeExpireTime           = Utils.StrToInt(invitecodeexpiretime.Text, 0);
                invitationConfigInfo.InviteCodeMaxCount             = Utils.StrToInt(invitecodemaxcount.Text, 0);
                invitationConfigInfo.InviteCodePrice                = CreateInviteCodePriceString();
                invitationConfigInfo.InvitationLoginUserDescription = DNTRequest.GetString("invitationuserdescriptionmessage_hidden");//保存的时候取textarea的value值可以保证前台显示正常
                invitationConfigInfo.InvitationVisitorDescription   = DNTRequest.GetString("invitationvisitordescriptionmessage_hidden");
                invitationConfigInfo.InvitationEmailTemplate        = RepairEmailTemplateCodeParameter(DNTRequest.GetString("invitationemailmodelmessage_hidden"));
                invitationConfigInfo.InviteCodeMaxCountToBuy        = Convert.ToInt16(invitecodeusermaxbuy.Text);
                invitationConfigInfo.InviteCodeUserCreatePerDay     = Convert.ToInt16(invitecodeusercreateperday.Text);

                Hashtable IPHash = new Hashtable();
                IPHash.Add("特殊 IP 注册限制", ipregctrl.Text);
                IPHash.Add("IP 禁止访问列表", ipdenyaccess.Text);
                IPHash.Add("IP 访问列表", ipaccess.Text);
                IPHash.Add("管理员后台IP访问列表", adminipaccess.Text);

                string ipkey = "";
                if (Utils.IsRuleTip(IPHash, "ip", out ipkey) == false)
                {
                    base.RegisterStartupScript("erro", "<script>alert('" + ipkey.ToString() + ",IP格式错误');</script>");
                    return;
                }

                Hashtable Emailhash = new Hashtable();
                Emailhash.Add("Email 允许地址", accessemail.Text);
                Emailhash.Add("Email 禁止地址", censoremail.Text);

                string key = "";
                if (Utils.IsRuleTip(Emailhash, "email", out key) == false)
                {
                    base.RegisterStartupScript("erro", "<script>alert('" + key.ToString() + ",Email格式错误');</script>");
                    return;
                }

                GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                InvitationConfigs.Serialiaze(invitationConfigInfo, Server.MapPath("../../config/invitation.config"));

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "注册与访问控制设置", "");
                base.RegisterStartupScript("PAGE", "window.location.href='global_registerandvisit.aspx';");
            }

            #endregion
        }
Exemple #2
0
        public AjaxPage()
        {
            config = GeneralConfigs.GetConfig();
            //如果是Flash提交
            if (Utils.StrIsNullOrEmpty(DNTRequest.GetUrlReferrer()))
            {
                string[] input    = DecodeUid(DNTRequest.GetString("input")).Split(','); //下标0为Uid,1为Olid
                UserInfo userInfo = Users.GetUserInfo(TypeConverter.StrToInt((input[0])));
                if (userInfo == null || DNTRequest.GetString("appid") != Utils.MD5(userInfo.Username + userInfo.Password + userInfo.Uid + input[1]))
                {
                    return;
                }
            }
            else if (ForumUtils.IsCrossSitePost(DNTRequest.GetUrlReferrer(), DNTRequest.GetHost())) //如果是跨站提交...
            {
                return;
            }


            string type = DNTRequest.GetString("t");

            if (Utils.InArray(type, "deleteattach,getattachlist,deletepostsbyuidanddays,deletepost,ignorepost,passpost,deletetopic,ignoretopic,passtopic,getimagelist,getblocklist,getpagelist,forumtree,topictree,quickreply,report,getdebatepostpage,confirmbuyattach,getnewpms,getnewnotifications,getajaxforums,checkuserextcredit,diggdebates,imagelist,debatevote"))
            {
                //如果需要验证用户身份,跳转至继承了PageBase的页面
                try
                {
                    HttpContext.Current.Server.Transfer("sessionajax.aspx?t=" + type + "&reason=" + DNTRequest.GetString("reason"));
                }
                catch //子页面请求错误,期待更好方案
                { }
                return;
            }
            switch (type)
            {
            case "checkusername":
                CheckUserName();        //检查用户名是否存在
                break;

            case "album":      //相册
                GetAlbum();
                break;

            case "checkrewritename":
                CheckRewriteName();
                break;

            case "ratelist":
                GetRateLogList();       //帖子评分记录
                break;

            case "smilies":
                GetSmilies();
                break;

            case "relatekw":
                GetRelateKeyword();
                break;

            case "gettopictags":
                GetTopicTags();
                break;

            case "topicswithsametag":
                GetTopicsWithSameTag();
                break;

            case "getforumhottags":
                GetForumHotTags();
                break;

            case "getspaceposttags":
                GetSpacePostTags();
                break;

            case "getspacehottags":
                GetSpaceHotTags();
                break;

            case "getphototags":
                GetPhotoTags();
                break;

            case "getphotohottags":
                GetPhotoHotTags();
                break;

            case "getgoodstradelog":
                GetGoodsTradeLog(DNTRequest.GetInt("goodsid", 0), DNTRequest.GetInt("pagesize", 0), DNTRequest.GetInt("pageindex", 0), DNTRequest.GetString("orderby", true), DNTRequest.GetInt("ascdesc", 1));
                break;

            case "getgoodsleavewordbyid":
                GetGoodsLeaveWordById(DNTRequest.GetInt("leavewordid", 0));
                break;

            case "getgoodsleaveword":
                GetGoodsLeaveWord(DNTRequest.GetInt("goodsid", 0), DNTRequest.GetInt("pagesize", 0), DNTRequest.GetInt("pageindex", 0));
                break;

            case "ajaxgetgoodsratelist":
                GetGoodsRatesList(DNTRequest.GetInt("uid", 0), DNTRequest.GetInt("uidtype", 0), DNTRequest.GetInt("ratetype", 0), DNTRequest.GetString("filter", true));
                break;

            case "getmallhottags":
                GetMallHotTags();
                break;

            case "gethotgoods":
                GetHotGoods(DNTRequest.GetInt("days", 0), DNTRequest.GetInt("categoryid", 0), DNTRequest.GetInt("count", 0));
                break;

            case "getshopinfo":     //获取热门或新开的店铺信息
                GetShopInfoJson(DNTRequest.GetInt("shoptype", 0));
                break;

            case "getgoodslist":
                GetGoodsList(DNTRequest.GetInt("categoryid", 0), DNTRequest.GetInt("order", 0), DNTRequest.GetInt("topnumber", 0));
                break;

            case "gethotdebatetopic":
                Getdebatesjsonlist("gethotdebatetopic", DNTRequest.GetString("tidlist", true));
                break;

            case "recommenddebates":
                Getdebatesjsonlist("recommenddebates", DNTRequest.GetString("tidlist", true));
                break;

            case "addcommentdebates":
                ResponseXML(Debates.CommentDabetas(DNTRequest.GetInt("tid", 0), DNTRequest.GetString("commentdebates", true), DNTRequest.IsPost()));
                break;

            case "getpostinfo":
                GetPostInfo();
                break;

            case "getattachpaymentlog":    //获取指定符件id的附件交易日志
                GetAttachPaymentLogByAid(DNTRequest.GetInt("aid", 0));
                break;

            case "getiplist":
                GetIpList();
                break;

            case "getforumtopictypelist":
                GetForumTopicTypeList();
                break;

            case "image":
                GetImage();
                break;

            case "resetemail":
                ResetEmail();
                break;
            }
            if (DNTRequest.GetString("Filename") != "" && DNTRequest.GetString("Upload") != "")
            {
                string uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                ResponseText(UploadTempAvatar(uid));
                return;
            }
            if (DNTRequest.GetString("avatar1") != "" && DNTRequest.GetString("avatar2") != "" && DNTRequest.GetString("avatar3") != "")
            {
                string uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                CreateDir(uid);
                if (!(SaveAvatar("avatar1", uid) && SaveAvatar("avatar2", uid) && SaveAvatar("avatar3", uid)))
                {
                    File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                    ResponseText("<?xml version=\"1.0\" ?><root><face success=\"0\"/></root>");
                    return;
                }
                File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                ResponseText("<?xml version=\"1.0\" ?><root><face success=\"1\"/></root>");
                return;
            }
        }
Exemple #3
0
 /// <summary>
 /// 检查RewriteName是否可用
 /// </summary>
 /// <param name="rewriteName"></param>
 /// <returns></returns>
 public static int CheckSpaceRewriteNameAvailable(string rewriteName)
 {
     if (rewriteName != string.Empty)
     {
         rewriteName = rewriteName.ToLower().Trim();
         if (rewriteName.IndexOfAny(new char[] { ' ', ' ', ':' }) != -1)
         {
             return(1);
         }
         else if (rewriteName == PrivateMessages.SystemUserName || ForumUtils.InBanWordArray(rewriteName) || ForumUtils.IsBanUsername(rewriteName, GeneralConfigs.GetConfig().Censoruser))
         {
             return(1);
         }
         else if (Regex.IsMatch(rewriteName, "([^a-z0-9_-]+?)"))
         {
             return(2);
         }
         else if (Space.Data.DbProvider.GetInstance().IsRewritenameExist(rewriteName))
         {
             return(3);
         }
         else
         {
             return(0);
         }
     }
     else
     {
         return(0);
     }
 }
Exemple #4
0
        /// <summary>
        /// 获取帖子评分列表
        /// </summary>
        /// <param name="pid">帖子列表</param>
        /// <returns>帖子评分列表</returns>
        public static List <RateLogInfo> GetPostRateLogList(int pid)
        {
            List <RateLogInfo> rateLogList = new List <RateLogInfo>();
            IDataReader        reader      = DatabaseProvider.GetInstance().GetPostRateLogs(pid, GeneralConfigs.GetConfig().DisplayRateCount);

            while (reader.Read())
            {
                rateLogList.Add(LoadSingleRateLogInfo(reader));
            }
            reader.Close();
            return(rateLogList);
        }
Exemple #5
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");
            }
        }
Exemple #6
0
        /// <summary>
        /// 检测Email和安全项
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="email">email</param>
        /// <param name="questionid">问题id</param>
        /// <param name="answer">答案</param>
        /// <returns>如果正确则返回用户id, 否则返回-1</returns>
        public static bool CheckEmailAndSecques(string username, string email, int questionid, string answer, string forumPath)
        {
            int uid = Discuz.Data.Users.CheckEmailAndSecques(username, email, ForumUtils.GetUserSecques(questionid, answer));

            if (uid != -1)
            {
                string Authstr = ForumUtils.CreateAuthStr(20);
                Users.UpdateAuthStr(uid, Authstr, 2);

                StringBuilder body = new StringBuilder(username);
                body.AppendFormat("您好!<br />这封信是由 {0}", GeneralConfigs.GetConfig().Forumtitle);
                body.Append(" 发送的.<br /><br />您收到这封邮件,是因为在我们的论坛上这个邮箱地址被登记为用户邮箱,且该用户请求使用 Email 密码重置功能所致.");
                body.Append("<br /><br />----------------------------------------------------------------------");
                body.Append("<br />重要!");
                body.Append("<br /><br />----------------------------------------------------------------------");
                body.Append("<br /><br />如果您没有提交密码重置的请求或不是我们论坛的注册用户,请立即忽略并删除这封邮件.只在您确认需要重置密码的情况下,才继续阅读下面的内容.");
                body.Append("<br /><br />----------------------------------------------------------------------");
                body.Append("<br />密码重置说明");
                body.Append("<br /><br />----------------------------------------------------------------------");
                body.Append("<br /><br />您只需在提交请求后的三天之内,通过点击下面的链接重置您的密码:<br /><br />");
                body.AppendFormat("<a href={0}/setnewpassword.aspx?uid={1}&id={2} target=_blank>{0}", forumPath, uid, Authstr);
                body.AppendFormat("/setnewpassword.aspx?uid={0}&id={1}</a>", uid, Authstr);
                body.Append("<br /><br />(如果上面不是链接形式,请将地址手工粘贴到浏览器地址栏再访问)");
                body.Append("<br /><br />上面的页面打开后,输入新的密码后提交,之后您即可使用新的密码登录论坛了.您可以在用户控制面板中随时修改您的密码.");
                body.AppendFormat("<br /><br />本请求提交者的 IP 为 {0}<br /><br /><br /><br />", DNTRequest.GetIP());
                body.AppendFormat("<br />此致 <br /><br />{0} 管理团队.<br />{1}<br /><br />", GeneralConfigs.GetConfig().Forumtitle, forumPath);

                Emails.DiscuzSmtpMailToUser(DNTRequest.GetString("email"), GeneralConfigs.GetConfig().Forumtitle + " 取回密码说明", body.ToString());
                return(true);
            }
            return(false);
        }
Exemple #7
0
        /// <summary>
        /// 根据IP查找用户
        /// </summary>
        /// <param name="ip">ip地址</param>
        /// <returns>用户信息</returns>
        public static string CheckRegisterDateDiff(string ip)
        {
            ShortUserInfo userinfo = Discuz.Data.Users.GetShortUserInfoByIP(ip);

            if (GeneralConfigs.GetConfig().Regctrl > 0 && userinfo != null)
            {
                int Interval = Utils.StrDateDiffHours(userinfo.Joindate, GeneralConfigs.GetConfig().Regctrl);
                if (Interval <= 0)
                {
                    return("抱歉, 系统设置了IP注册间隔限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册");
                }
            }

            if (GeneralConfigs.GetConfig().Ipregctrl.Trim() != "" && Utils.InIPArray(DNTRequest.GetIP(), Utils.SplitString(GeneralConfigs.GetConfig().Ipregctrl, "\n")) && userinfo != null)
            {
                int Interval = Utils.StrDateDiffHours(userinfo.Joindate, 72);
                if (Interval < 0)
                {
                    return("抱歉, 系统设置了特殊IP注册限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册");
                }
            }
            return(null);
        }
        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) != -1)
                    {
                        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 = DatabaseProvider.GetInstance().GetRadminidByGroupid(int.Parse(groupid.SelectedValue));
                }

                __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 (Utils.IsNumeric(credits.Text.Replace("-", "")))
                {
                    __userinfo.Credits = Convert.ToInt32(credits.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户的金币不能为空或大于9位 !');</script>");
                    return;
                }

                GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                if (__configinfo.Doublee == 0)
                {
                    int currentuid = AdminUsers.FindUserEmail(email.Text);
                    if ((currentuid != -1) && (currentuid != uid))
                    {
                        base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                        return;
                    }
                }

                __userinfo.Email       = email.Text;
                __userinfo.Gender      = Convert.ToInt32(gender.SelectedValue);
                __userinfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);
                __userinfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (__userinfo.Uid == 1))
                {
                    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.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)
                {
                    AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                }

                if (AdminUsers.UpdateUserAllInfo(__userinfo))
                {
                    if (userName.Text != ViewState["username"].ToString())
                    {
                        AdminUsers.UserNameChange(__userinfo, ViewState["username"].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
        }
        /// <summary>
        /// 取得指定XML路径下的数据项
        /// </summary>
        /// <param name="xpath">分级对象的路径</param>
        /// <returns></returns>
        public virtual object RetrieveObject(string xpath)
        {
            try
            {
#if NET4
                if (GeneralConfigs.GetConfig().Webgarden > 1 && Environment.Version.Major >= 4)
                {
                    //.net4框架下基于mmap实现跨进程共享信息,来实现当前web园进程内缓存更新后,其它web园进程无法得到信息已修改的标记
                    //方法摘要:通过htMapFile表记录共享内存的文件信息,这样可以提升访问共享信息的命中率(之前直接声明的方式命中率非常低且容易过多申请共享内存造成内存紧张)
                    //通过在共享内存中保存进程ID的方式,如果当前进程ID未出现在共享内存中,则直接将进程ID放到内享内存中,同时返回NULL,这样前端就会从数据库或文件中再次载入数据。
                    //如当前进程ID出现在了共享内存中,则标识该进程中的当前键值的缓存数据已更新过,则直接从缓存中获取数据并返回该数据信息。
                    lock (lockHelper)
                    {
                        //强制移除缓存(将共享内存中数据清空)后,查看指定缓存键的共享内存数据变化
                        //if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["removecache"]))
                        //    RemoveObject("/Forum/TemplateIDList");

                        MemoryMappedFile file = htMapFile[xpath] as MemoryMappedFile;
                        if (file == null)
                        {
                            file = MemoryMappedFile.CreateOrOpen(xpath, 512, MemoryMappedFileAccess.ReadWrite);// MemoryMappedFileOptions.DelayAllocatePages, new MemoryMappedFileSecurity(), HandleInheritability.Inheritable);
                            htMapFile.Add(xpath, file);
                        }
                        int processId = System.Diagnostics.Process.GetCurrentProcess().Id;
                        using (BinaryReader br = new BinaryReader(file.CreateViewStream()))
                        {
                            string brstr = br.ReadString().Trim().Replace("none", "");
                            if (!brstr.Contains("_" + processId + "_"))
                            {
                                using (BinaryWriter bw = new BinaryWriter(file.CreateViewStream()))
                                {
                                    bw.Write(Utils.CutString("_" + processId + "_" + brstr, 0, 512));
                                }
                                if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["showdetail"]))
                                {
                                    System.Web.HttpContext.Current.Response.Write("<br/>write xpath: " + xpath + "  process :" + processId + ", old process: " + brstr);
                                }
                                return(null);
                            }
                            if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["showdetail"]))
                            {
                                System.Web.HttpContext.Current.Response.Write("<br/>output write xpath: " + xpath + "  process :" + processId + ", old process: " + brstr);
                            }
                        }
                    }
                }
#endif
                {
                    var node = _objectXmlMap.SelectSingleNode(PrepareXpath(xpath));
                    if (node == null)
                    {
                        return(null);
                    }
                    return(node.Attributes != null?_cs.RetrieveObject(node.Attributes["objectId"].Value) : null);
                }
            }
            catch
            {
                return(null);
            }
        }
        public void Execute(object state)
        {
            //执行计划任务

            //每日早上5点执行,时间点为当前时间减1天

            //同步数据进入SCM系统
            GeneralConfigInfo _config = new GeneralConfigInfo();

            _config = GeneralConfigs.GetConfig();

            if (_config.DBO_CompanyID.Trim() != "" && _config.DBO_ErpSys.Trim() != "" && _config.DBO_AppID.Trim() != "" && _config.DBO_AppKey.Trim() != "" && _config.DBO_API.Trim() != "")
            {
                //Orders.SyncData2SCM();
            }

            DataTable dt = new DataTable();

            dt = tbDataToMailInfo.GetDataToMailInfoList(" dState=0 ").Tables[0];

            //执行统计数据导出并发送邮件
            DateTime now = DateTime.Now;
            //每周第一天
            DateTime startWeek = now.AddDays(1 - Convert.ToInt32(now.DayOfWeek.ToString("d")));
            //每月第一天
            DateTime startMonth = now.AddDays(1 - now.Day);

            DateTime _getDateTime = (now.Hour <= 8)?DateTime.Now.AddDays(-1):DateTime.Now;

            foreach (DataRow dr in dt.Rows)
            {
                //日计划
                if (Convert.ToInt32(dr["dDateType"].ToString()) == 1)
                {
                    //客户销售数据_分解
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 1)
                    {
                        DataUtils.getStorageSalesDetails(1, (_getDateTime).ToString("yyyy-MM-dd"), 0, dr["dEmail"].ToString());


                        DataUtils.getStorageSalesDetails(2, (_getDateTime).ToString("yyyy-MM-dd"), 0, dr["dEmail"].ToString());


                        DataUtils.getStorageSalesDetails(3, (_getDateTime).ToString("yyyy-MM-dd"), 0, dr["dEmail"].ToString());


                        DataUtils.getStorageSalesDetails(4, (_getDateTime).ToString("yyyy-MM-dd"), 0, dr["dEmail"].ToString());


                        DataUtils.getStorageSalesDetails(5, (_getDateTime).ToString("yyyy-MM-dd"), 0, dr["dEmail"].ToString());
                    }
                    //联营库存数据_分解
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 2)
                    {
                        DataUtils.getJointInventoryDetails(_getDateTime, 0, 1, dr["dEmail"].ToString());
                    }
                    //仓库库存数据_分解
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 5)
                    {
                        DataUtils.getStockDetails(dr["dEmail"].ToString(), 0, _getDateTime, 0);
                    }

                    //客户销售数据_打包
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 6)
                    {
                        DataUtils.getStorageSalesDetails_ToMail((_getDateTime).ToString("yyyy-MM-dd"), dr["dEmail"].ToString());
                    }
                    //联营库存数据_打包
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 7)
                    {
                        DataUtils.getJointInventoryDetails_ToMail(_getDateTime, 1, dr["dEmail"].ToString());
                    }
                    //公司销售数据_打包
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 8)
                    {
                        DataUtils.getIslandSalesDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                    }
                    //公司出货数据_打包
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 9)
                    {
                        DataUtils.getIslandShipmentDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                    }
                    //仓库库存数据_打包
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 10)
                    {
                        DataUtils.getStockDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                    }

                    //客户销售,联营库存,公司销售,公司出货,仓库库存
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 11)
                    {
                        DataUtils.getAll_ToMail(_getDateTime, dr["dEmail"].ToString());
                    }

                    //仓库库存分仓库单独文件
                    if (Convert.ToInt32(dr["dDataType"].ToString()) == 12)
                    {
                        DataUtils.getStockDetails_all_file(dr["dEmail"].ToString(), _getDateTime);
                    }

                    //仓库库存实时数据_多仓库单表单文件
                    if (Convert.ToInt32(dr ["dDataType"].ToString()) == 13)
                    {
                        DataUtils.getStockDetails_all_file_oneTable(dr["dEmail"].ToString(), _getDateTime);
                    }
                }

                //周计划
                if (Convert.ToInt32(dr["dDateType"].ToString()) == 2)
                {
                    if (now == startWeek)
                    {
                        //客户销售数据
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 1)
                        {
                            DataUtils.getStorageSalesDetails(1, (DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"), 1, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(2, (DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"), 1, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(3, (DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"), 1, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(4, (DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"), 1, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(5, (DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"), 1, dr["dEmail"].ToString());
                        }

                        //客户销售数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 6)
                        {
                            DataUtils.getStorageSalesDetails_ToMail((_getDateTime).ToString("yyyy-MM-dd"), dr["dEmail"].ToString());
                        }
                        //联营库存数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 7)
                        {
                            DataUtils.getJointInventoryDetails_ToMail(_getDateTime, 1, dr["dEmail"].ToString());
                        }
                        //公司销售数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 8)
                        {
                            DataUtils.getIslandSalesDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //公司出货数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 9)
                        {
                            DataUtils.getIslandShipmentDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //仓库库存数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 10)
                        {
                            DataUtils.getStockDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //客户销售,联营库存,公司销售,公司出货,仓库库存
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 11)
                        {
                            DataUtils.getAll_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                    }
                }

                //月计划
                if (Convert.ToInt32(dr["dDateType"].ToString()) == 3)
                {
                    if (now == startMonth)
                    {
                        //客户销售数据
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 1)
                        {
                            DataUtils.getStorageSalesDetails(1, (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"), 2, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(2, (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"), 2, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(3, (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"), 2, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(4, (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"), 2, dr["dEmail"].ToString());


                            DataUtils.getStorageSalesDetails(5, (DateTime.Now.AddMonths(-1)).ToString("yyyy-MM-dd"), 2, dr["dEmail"].ToString());
                        }
                        //公司销售数据
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 3)
                        {
                            DataUtils.getIslandSalesDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), (DateTime.Now.AddDays(1 - now.Day)).AddDays(-1));
                        }
                        //公司出货数据
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 4)
                        {
                            DataUtils.getIslandShipmentDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), 0);


                            DataUtils.getIslandShipmentDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), 1);


                            DataUtils.getIslandShipmentDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), 2);


                            DataUtils.getIslandShipmentDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), 3);


                            DataUtils.getIslandShipmentDetails(dr["dEmail"].ToString(), (DateTime.Now.AddDays(1 - now.Day)).AddMonths(-1), 4);
                        }


                        //客户销售数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 6)
                        {
                            DataUtils.getStorageSalesDetails_ToMail((_getDateTime).ToString("yyyy-MM-dd"), dr["dEmail"].ToString());
                        }
                        //联营库存数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 7)
                        {
                            DataUtils.getJointInventoryDetails_ToMail(_getDateTime, 1, dr["dEmail"].ToString());
                        }
                        //公司销售数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 8)
                        {
                            DataUtils.getIslandSalesDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //公司出货数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 9)
                        {
                            DataUtils.getIslandShipmentDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //仓库库存数据_打包
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 10)
                        {
                            DataUtils.getStockDetails_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                        //客户销售,联营库存,公司销售,公司出货,仓库库存
                        if (Convert.ToInt32(dr["dDataType"].ToString()) == 11)
                        {
                            DataUtils.getAll_ToMail(_getDateTime, dr["dEmail"].ToString());
                        }
                    }
                }
            }
        }
Exemple #11
0
 /// <summary>
 /// 获取指定用户组和版信息下主题的DisplayOrder
 /// </summary>
 /// <param name="usergroupinfo">用户组信息</param>
 /// <param name="useradminid">管理组ID</param>
 /// <param name="forum">当前版块</param>
 /// <param name="topicInfo">当前主题信息</param>
 /// <param name="message">帖子内容</param>
 /// <param name="disablepost">是否受灌水限制 1,不受限制;0,受限制</param>
 /// <returns>0:正常显示;-2:待审核</returns>
 public static int GetTitleDisplayOrder(UserGroupInfo usergroupinfo, int useradminid, ForumInfo forum, TopicInfo topicInfo, string message, int disablepost)
 {
     if (useradminid == 1 || Moderators.IsModer(useradminid, topicInfo.Posterid, forum.Fid))
     {
         return(topicInfo.Displayorder);
     }
     if (forum.Modnewtopics == 1 || usergroupinfo.ModNewTopics == 1 || Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods) && disablepost != 1 || ForumUtils.HasAuditWord(topicInfo.Title) || ForumUtils.HasAuditWord(message))
     {
         return(-2);
     }
     return(topicInfo.Displayorder);
 }
Exemple #12
0
 public static void InitConfig()
 {
     GeneralConfigs.GetConfig();
 }
        /// <summary>
        /// 验证授权码
        /// </summary>
        /// <returns><c>true</c>, if pass code was checked, <c>false</c> otherwise.</returns>
        /// <param name="passCode">Pass code.</param>
        public bool checkPassCode(string passCode)
        {
            string _passCode = GeneralConfigs.GetConfig().Server_Key;

            return(passCode.Trim() == _passCode.Trim());
        }
        public int AddOrder(string passCode, int oType, int StoresSupplierID,
                            string oCustomersName, string oCustomersContact, string oCustomersTel, string oCustomersAddress, string oCustomersOrderID, string oCustomersNameB,
                            int oPrepay, string oReMake, string _OrderListDataJson)
        {
            int StaffID = 0;
            int UserID  = 0;
            int OrderID = 0;

            if (checkPassCode(passCode))
            {
                StaffInfo _sf = new StaffInfo();
                UserInfo  _ui = new UserInfo();

                GeneralConfigInfo _cf = new GeneralConfigInfo();
                _cf = GeneralConfigs.GetConfig();

                if (_cf.Server_Staff.Trim() != "")
                {
                    _sf = tbStaffInfo.GetStaffInfoModelByName(_cf.Server_Staff.Trim());
                    if (_sf != null)
                    {
                        StaffID = _sf.StaffID;
                    }
                }

                if (_cf.Server_User.Trim() != "")
                {
                    _ui = tbUserInfo.GetUserInfoModelByUserName(_cf.Server_User.Trim());
                    if (_ui != null)
                    {
                        UserID = _ui.UserID;
                    }
                }

                /*
                 * _OrderListDataJson = {"ProductsCode":"","StorageCode":"","Quantity":0,"Money":0}
                 */


                _OrderListDataJson = "";


                OrderInfo oi = new OrderInfo();
                oi.oOrderNum         = "----------";
                oi.oType             = oType;
                oi.StoresID          = StoresSupplierID;
                oi.oCustomersName    = oCustomersName;
                oi.oCustomersContact = oCustomersContact;
                oi.oCustomersTel     = oCustomersTel;
                oi.oCustomersAddress = oCustomersAddress;
                oi.oCustomersOrderID = oCustomersOrderID;
                oi.oCustomersNameB   = oCustomersNameB;
                oi.StaffID           = StaffID;
                oi.UserID            = UserID;
                oi.oAppendTime       = DateTime.Now;
                oi.oOrderDateTime    = DateTime.Now;
                oi.oState            = 0;
                oi.oSteps            = 1;
                oi.oPrepay           = oPrepay;
                oi.oReMake           = oReMake;
                oi.OrderListDataJson = (OrderListDataJson)JavaScriptConvert.DeserializeObject(_OrderListDataJson, typeof(OrderListDataJson));

                OrderID = Orders.AddOrderInfoAndList(oi);

                if (OrderID > 0)
                {
                    OrderWorkingLogInfo owl = new OrderWorkingLogInfo();

                    owl.OrderID     = OrderID;
                    owl.UserID      = 0;
                    owl.oType       = 0;
                    owl.oMsg        = "";
                    owl.pAppendTime = DateTime.Now;

                    Orders.AddOrderWorkingLogInfo(owl);
                }
            }
            return(OrderID);
        }
Exemple #15
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        private List <ShowtopicPageAttachmentInfo> GetAttachList(int price, string onlyauthor, int ismoder, int posterid, UserInfo userinfo, UserGroupInfo usergroupinfo, TopicInfo topic, ForumInfo forum)
        {
            GeneralConfigInfo config = GeneralConfigs.GetConfig();
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topic.Tid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = 10000; // 得到Ppp设置
            postpramsInfo.Pageindex              = 1;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupinfo.Groupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userinfo.Uid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide        = (topic.Hide == 1 && (Posts.IsReplier(topic.Tid, userinfo.Uid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Hide        = topic.Posterid == userinfo.Uid ? -2 : postpramsInfo.Hide;
            postpramsInfo.Condition   = Posts.GetPostPramsInfoCondition(onlyauthor, topic.Tid, posterid);
            postpramsInfo.Usercredits = userinfo == null ? 0 : userinfo.Credits;
            List <ShowtopicPageAttachmentInfo> attachmentlist = new List <ShowtopicPageAttachmentInfo>();
            List <ShowtopicPagePostInfo>       postlist       = GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            int allowGetAttach = GetAllowGetAttachValue(postpramsInfo);

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userinfo.Uid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            List <ShowtopicPageAttachmentInfo> attachDeleteList = new List <ShowtopicPageAttachmentInfo>();

            foreach (ShowtopicPageAttachmentInfo attachInfo in attachmentlist)
            {
                if (allowGetAttach == 1 && attachInfo.Allowread == 1)
                {
                    if (attachInfo.Filetype.IndexOf("jpeg") >= 0 || attachInfo.Filetype.IndexOf("png") >= 0)
                    {
                        if (!attachInfo.Filename.ToLower().StartsWith("http"))
                        {
                            attachInfo.Filename = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "upload/" + attachInfo.Filename.Trim();
                        }
                    }
                    else
                    {
                        attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                    }
                }
                else
                {
                    attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                }
            }
            foreach (ShowtopicPageAttachmentInfo attach in attachDeleteList)
            {
                attachmentlist.Remove(attach);
            }
            return(attachmentlist);
        }
Exemple #16
0
        /// <summary>
        /// 通过指定的路径删除缓存中的对象
        /// </summary>
        /// <param name="xpath">分级对象的路径</param>
        public virtual void RemoveObject(string xpath)
        {
            lock (LockHelper)
            {
                try
                {
#if NET4
                    if (GeneralConfigs.GetConfig().Webgarden > 1 && Environment.Version.Major >= 4)
                    {
                        //.net4框架下基于mmap实现跨进程共享信息,来实现当前web园进程内缓存更新后,其它web园进程无法得到信息已修改的标记
                        //方法摘要:通过htMapFile表记录共享内存的文件信息,这样可以提升访问共享信息的命中率(之前直接声明的方式命中率非常低且容易过多申请共享内存造成内存紧张)
                        //通过直接置空共享内存中数据(写入"none"),这样当别的进程再访问该共享内存时,发现共享内存中已为空("即当前进程缓存数据要重新加载",详情参见上面的RetrieveObject(string xpath))
                        MemoryMappedFile file = htMapFile[xpath] as MemoryMappedFile;
                        if (file == null)
                        {
                            file = MemoryMappedFile.CreateOrOpen(xpath, 512, MemoryMappedFileAccess.ReadWrite);// MemoryMappedFileOptions.DelayAllocatePages, new MemoryMappedFileSecurity(), HandleInheritability.Inheritable);
                            htMapFile.Add(xpath, file);
                        }
                        using (BinaryWriter bw = new BinaryWriter(file.CreateViewStream()))
                        {
                            if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["showdetail"]))
                            {
                                System.Web.HttpContext.Current.Response.Write("<br/>xpath: " + xpath);
                            }
                            bw.Write("none");
                        }
                    }
#endif
                    {
                        var result = _objectXmlMap.SelectSingleNode(PrepareXpath(xpath));
                        //检查路径是否指向一个组或一个被缓存的实例元素
                        if (result != null && result.HasChildNodes)
                        {
                            //删除所有对象和子结点的信息
                            var objects = result.SelectNodes("*[@objectId]");
                            if (objects == null)
                            {
                                return;
                            }
                            foreach (XmlNode node in objects)
                            {
                                if (node.Attributes == null)
                                {
                                    continue;
                                }
                                var objectId = node.Attributes["objectId"].Value;
                                if (node.ParentNode != null)
                                {
                                    node.ParentNode.RemoveChild(node);
                                }
                                //删除对象
                                _cs.RemoveObject(objectId);
                            }
                        }
                        else
                        {
                            //删除元素结点和相关的对象
                            if (result == null)
                            {
                                return;
                            }
                            if (result.Attributes == null)
                            {
                                return;
                            }
                            var objectId = result.Attributes["objectId"].Value;
                            if (result.ParentNode != null)
                            {
                                result.ParentNode.RemoveChild(result);
                            }
                            _cs.RemoveObject(objectId);
                        }
                    }
                }
                catch (Exception exception)
                { throw new Exception(exception.Message); }
            }
        }
Exemple #17
0
 /// <summary>
 /// WEB权限认证
 /// </summary>
 /// <param name="creinfo">认证信息</param>
 /// <returns>是否通过验正</returns>
 private bool AuthenticateUser(CredentialInfo creinfo)
 {
     if (creinfo.UserID > 0)
     {
         int olid = Discuz.Forum.OnlineUsers.GetOlidByUid(creinfo.UserID);
         if (olid > 0)
         {
             OnlineUserInfo oluserinfo = Discuz.Forum.OnlineUsers.GetOnlineUser(olid);
             if (oluserinfo.Userid == creinfo.UserID && Utils.UrlEncode(Discuz.Forum.ForumUtils.SetCookiePassword(oluserinfo.Password.Trim(), GeneralConfigs.GetConfig().Passwordkey)) == creinfo.Password)//检测用户id和口令
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #18
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            getAct       = HTTPRequest.GetString("Act");
            getAdminName = HTTPRequest.GetString("adminName");
            getAdminPwd  = HTTPRequest.GetString("adminPwd");

            comName     = HTTPRequest.GetString("comName");
            comID       = HTTPRequest.GetString("comID");
            comAddress  = HTTPRequest.GetString("comAddress");
            comTel      = HTTPRequest.GetString("comTel");
            orderNum    = HTTPRequest.GetString("orderNum");
            cumNum      = HTTPRequest.GetString("cumNum");
            ordNum      = HTTPRequest.GetString("ordNum");
            pzLen       = HTTPRequest.GetInt("pzLen", 0);
            MonNum      = HTTPRequest.GetInt("MonNum", 0);
            CounNum     = HTTPRequest.GetInt("CounNum", 0);
            oListWidth  = HTTPRequest.GetString("oListWidth");
            pzWidth     = HTTPRequest.GetString("pzWidth");
            pzRow       = HTTPRequest.GetInt("pzRow", 0);
            sOListWidth = HTTPRequest.GetString("sOListWidth");
            sOrderRow   = HTTPRequest.GetInt("sOrderRow", 0);

            if (!ispost)
            {
                if (getAct.IndexOf("install_four") > -1)
                {
                    //设置基本配置
                    ManageConfig                           = GeneralConfigs.GetConfig();
                    ManageConfig.CompanyName               = comName;
                    ManageConfig.RegistrationNo            = comID;
                    ManageConfig.Address                   = comAddress;
                    ManageConfig.Phone                     = comTel;
                    ManageConfig.OrderID                   = orderNum;
                    ManageConfig.SupplierCode              = cumNum;
                    ManageConfig.MonthlyStatementCode      = ordNum;
                    ManageConfig.CertificateCodeLen        = pzLen;
                    ManageConfig.MoneyDecimal              = MonNum;
                    ManageConfig.QuantityDecimal           = CounNum;
                    ManageConfig.PrintPageWidth            = oListWidth;
                    ManageConfig.PrintCertificatePageWidth = pzWidth;
                    ManageConfig.CertificateRow            = pzRow;
                    ManageConfig.PrintAddPageWidth         = sOListWidth;
                    ManageConfig.PrintAddRow               = sOrderRow;

                    GeneralConfigs.Serialiaze(ManageConfig, Yannyo.Common.Utils.GetMapPath(BaseConfigs.GetSysPath + "/config/general.config"));
                    Logs.AddEventLog(this.userid, "修改系统配置.");
                    BaseConfigs.ResetConfig();
                    Caches.ReSet();
                    try
                    {
                        Yannyo.Install.Utils.toSystemReg(ManageConfig);
                    }
                    catch
                    {
                    }

                    if (getAdminName != "" && getAdminPwd != "")
                    {
                        if (!tbUserInfo.ExistsUserInfo(getAdminName))
                        {
                            //创建新用户
                            UserInfo ui = new UserInfo();
                            ui.uName = getAdminName;
                            ui.uPWD  = Yannyo.Common.Utils.MD5(getAdminPwd);
                            ui.uCode = Yannyo.Common.Utils.CutString(Yannyo.Common.Utils.GetRanDomCode(), 16);

                            ui.uLastIP       = HTTPRequest.GetIP();
                            ui.uAppendTime   = DateTime.Now;
                            ui.uUpAppendTime = DateTime.Now;
                            ui.uEstate       = 0;
                            ui.StaffID       = 0;
                            ui.uType         = 0;
                            ui.uPermissions  = "X";
                            if (tbUserInfo.AddUserInfo(ui) > 0)
                            {
                                Logs.AddEventLog(this.userid, "新增用户:" + ui.uName);
                            }
                        }
                        else
                        {
                            this.AddErrLine("系统已经初始化,请不要刷新页面或重新初始化!");
                        }
                    }
                }
            }
        }
Exemple #19
0
        public static bool UpdateAuthStr(string authStr)
        {
            DataTable dt = Discuz.Data.Users.GetUserIdByAuthStr(authStr);

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

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

                return(true);
            }
            return(false);
        }
        private void AddUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 插入相关组信息数据

            if (this.CheckCookie())
            {
                if (radminid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择相应的管理组, 再点击提交按钮!');</script>");
                    return;
                }

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

                Hashtable ht = new Hashtable();
                ht.Add("附件最大尺寸", maxattachsize.Text);
                ht.Add("每天最大附件总尺寸", maxsizeperday.Text);
                ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text);
                ht.Add("相册空间总尺寸", maxspacephotosize.Text);
                foreach (DictionaryEntry de in ht)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_addadminusergroup.aspx';</script>");
                        return;
                    }
                }

                UserGroupInfo userGroupInfo = new UserGroupInfo();
                userGroupInfo.System             = 0;
                userGroupInfo.Type               = 0;
                userGroupInfo.Readaccess         = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text);
                userGroupInfo.Allowdirectpost    = 1;
                userGroupInfo.Allowmultigroups   = 0;
                userGroupInfo.Allowcstatus       = 0;
                userGroupInfo.Allowuseblog       = 0;
                userGroupInfo.Allowinvisible     = 0;
                userGroupInfo.Allowtransfer      = 0;
                userGroupInfo.Allowhtml          = 0;
                userGroupInfo.Allownickname      = 0;
                userGroupInfo.Allowviewstats     = 0;
                userGroupInfo.Grouptitle         = groupTitle.Text;
                userGroupInfo.Creditshigher      = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.Creditslower       = Convert.ToInt32(creditslower.Text);
                userGroupInfo.Stars              = Convert.ToInt32(stars.Text);
                userGroupInfo.Color              = color.Text;
                userGroupInfo.Groupavatar        = groupavatar.Text;
                userGroupInfo.Maxprice           = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum           = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize         = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize      = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday      = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize  = Convert.ToInt32(maxspacephotosize.Text);
                userGroupInfo.Attachextensions   = attachextensions.GetSelectString(",");
                userGroupInfo.Raterange          = "";
                userGroupInfo.Radminid           = Convert.ToInt32(radminid.SelectedValue);
                //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text);
                usergrouppowersetting.GetSetting(ref userGroupInfo);
                if (AdminUserGroups.AddUserGroupInfo(userGroupInfo))
                {
                    #region 是否允许接收举报信息和管理图片评论
                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    //是否允许接收举报信息
                    int groupid = UserGroups.GetMaxUserGroupId();
                    if (admingroupright.Items[13].Selected)
                    {
                        if (("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (configInfo.Reportusergroup == "")
                            {
                                configInfo.Reportusergroup = groupid.ToString();
                            }
                            else
                            {
                                configInfo.Reportusergroup += "," + groupid.ToString();
                            }
                        }
                    }
                    //是否允许管理图片评论
                    if (admingroupright.Items[14].Selected)
                    {
                        if (("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (configInfo.Photomangegroups == "")
                            {
                                configInfo.Photomangegroups = groupid.ToString();
                            }
                            else
                            {
                                configInfo.Photomangegroups += "," + groupid.ToString();
                            }
                        }
                    }
                    GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                    #endregion
                    AdminGroupInfo adminGroupInfo = new AdminGroupInfo();
                    //int adminId = DatabaseProvider.GetInstance().GetMaxUserGroupId() + 1;
                    adminGroupInfo.Admingid = (short)UserGroups.GetMaxUserGroupId();

                    //插入相应的管理组
                    adminGroupInfo.Alloweditpost     = BoolToByte(admingroupright.Items[0].Selected);
                    adminGroupInfo.Alloweditpoll     = BoolToByte(admingroupright.Items[1].Selected);
                    adminGroupInfo.Allowstickthread  = (byte)Convert.ToInt16(allowstickthread.SelectedValue);
                    adminGroupInfo.Allowmodpost      = 0;
                    adminGroupInfo.Allowdelpost      = BoolToByte(admingroupright.Items[2].Selected);
                    adminGroupInfo.Allowmassprune    = BoolToByte(admingroupright.Items[3].Selected);
                    adminGroupInfo.Allowrefund       = 0;
                    adminGroupInfo.Allowcensorword   = 0;
                    adminGroupInfo.Allowviewip       = BoolToByte(admingroupright.Items[4].Selected);
                    adminGroupInfo.Allowbanip        = 0;
                    adminGroupInfo.Allowedituser     = BoolToByte(admingroupright.Items[5].Selected);
                    adminGroupInfo.Allowmoduser      = 0;
                    adminGroupInfo.Allowbanuser      = 0;
                    adminGroupInfo.Allowpostannounce = 0;
                    adminGroupInfo.Allowviewlog      = BoolToByte(admingroupright.Items[6].Selected);
                    adminGroupInfo.Disablepostctrl   = BoolToByte(admingroupright.Items[7].Selected);
                    adminGroupInfo.Allowviewrealname = BoolToByte(admingroupright.Items[8].Selected);
                    adminGroupInfo.Allowbanuser      = BoolToByte(admingroupright.Items[9].Selected);
                    adminGroupInfo.Allowbanip        = BoolToByte(admingroupright.Items[10].Selected);
                    adminGroupInfo.Allowmodpost      = BoolToByte(admingroupright.Items[11].Selected);
                    adminGroupInfo.Allowpostannounce = BoolToByte(admingroupright.Items[12].Selected);

                    AdminGroups.CreateAdminGroupInfo(adminGroupInfo);

                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加管理组", "组名:" + groupTitle.Text);

                    base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }
        private void SubmitInfo_Click(object sender, EventArgs e)
        {
            #region 提交同级版块

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("fid") != "")
                {
                    forumInfo              = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0));
                    forumInfo.Name         = name.Text.Trim();
                    forumInfo.Displayorder = Convert.ToInt32(displayorder.Text);
                    forumInfo.Status       = Convert.ToInt16(status.SelectedValue);

                    if (colcount.SelectedValue == "1") //传统模式[默认]
                    {
                        forumInfo.Colcount = 1;
                    }
                    else
                    {
                        if (Convert.ToInt16(colcountnumber.Text) < 1 || Convert.ToInt16(colcountnumber.Text) > 9)
                        {
                            colcountnumber.Text = "";
                            base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>");
                            return;
                        }
                        forumInfo.Colcount = Convert.ToInt16(colcountnumber.Text);
                    }

                    if (rewritename.Text.Trim() != oldrewritename.Value && rewritename.Text.Trim() != "" && Discuz.Forum.Forums.CheckRewriteNameInvalid(rewritename.Text.Trim()))
                    {
                        rewritename.Text = "";
                        base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>");
                        return;
                    }
                    //forumInfo.Templateid为0表示绑定到默认模板
                    forumInfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue));
                    forumInfo.Allowhtml  = 0;
                    forumInfo.Allowblog  = 0;
                    forumInfo.Istrade    = 0;

                    forumInfo.Alloweditrules   = 0;
                    forumInfo.Allowsmilies     = BoolToInt(setting.Items[0].Selected);
                    forumInfo.Allowrss         = BoolToInt(setting.Items[1].Selected);
                    forumInfo.Allowbbcode      = BoolToInt(setting.Items[2].Selected);
                    forumInfo.Allowimgcode     = BoolToInt(setting.Items[3].Selected);
                    forumInfo.Recyclebin       = BoolToInt(setting.Items[4].Selected);
                    forumInfo.Modnewposts      = BoolToInt(setting.Items[5].Selected);
                    forumInfo.Modnewtopics     = BoolToInt(setting.Items[6].Selected);
                    forumInfo.Jammer           = BoolToInt(setting.Items[7].Selected);
                    forumInfo.Disablewatermark = BoolToInt(setting.Items[8].Selected);
                    forumInfo.Inheritedmod     = BoolToInt(setting.Items[9].Selected);
                    forumInfo.Allowthumbnail   = BoolToInt(setting.Items[10].Selected);
                    forumInfo.Allowtag         = BoolToInt(setting.Items[11].Selected);
                    int temppostspecial = 0;
                    temppostspecial            = setting.Items[12].Selected ? temppostspecial | 1 : temppostspecial & ~1;
                    temppostspecial            = setting.Items[13].Selected ? temppostspecial | 16 : temppostspecial & ~16;
                    temppostspecial            = setting.Items[14].Selected ? temppostspecial | 4 : temppostspecial & ~4;
                    forumInfo.Allowpostspecial = temppostspecial;
                    forumInfo.Alloweditrules   = BoolToInt(setting.Items[15].Selected);
                    forumInfo.Allowspecialonly = Convert.ToInt16(allowspecialonly.SelectedValue);

                    if (autocloseoption.SelectedValue == "0")
                    {
                        forumInfo.Autoclose = 0;
                    }
                    else
                    {
                        forumInfo.Autoclose = Convert.ToInt32(autocloseday.Text);
                    }

                    forumInfo.Description = description.Text;
                    forumInfo.Password    = password.Text;

                    //如果有上传的图片被提交上来,则执行文件保存操作,并返回保存后的文件路径,否则将icon.text控件中的值保存
                    forumInfo.Icon = HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)
                        ? AdminForums.UploadForumIcon(forumInfo.Fid) : icon.Text;

                    forumInfo.Redirect         = redirect.Text;
                    forumInfo.Attachextensions = attachextensions.GetSelectString(",");

                    AdminForums.CompareOldAndNewModerator(forumInfo.Moderators, moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0));

                    forumInfo.Moderators     = moderators.Text.Replace("\r\n", ",");
                    forumInfo.Rules          = rules.Text.Trim();
                    forumInfo.Seokeywords    = seokeywords.Text.Trim();
                    forumInfo.Seodescription = seodescription.Text.Trim();
                    forumInfo.Rewritename    = rewritename.Text.Trim();
                    forumInfo.Viewperm       = Request.Form["viewperm"];
                    forumInfo.Postperm       = Request.Form["postperm"];
                    forumInfo.Replyperm      = Request.Form["replyperm"];
                    forumInfo.Getattachperm  = Request.Form["getattachperm"];
                    forumInfo.Postattachperm = Request.Form["postattachperm"];

                    forumInfo.Applytopictype  = Convert.ToInt32(applytopictype.SelectedValue);
                    forumInfo.Postbytopictype = Convert.ToInt32(postbytopictype.SelectedValue);
                    forumInfo.Viewbytopictype = Convert.ToInt32(viewbytopictype.SelectedValue);
                    forumInfo.Topictypeprefix = Convert.ToInt32(topictypeprefix.SelectedValue);
                    forumInfo.Topictypes      = GetTopicType();

                    forumInfo.Permuserlist = GetPermuserlist();

                    Discuz.Aggregation.AggregationFacade.ForumAggregation.ClearDataBind();
                    string result = AdminForums.UpdateForumInfo(forumInfo).Replace("'", "’");

                    if (childForumApplyTemplate.Checked)//批量设置子版块的模板信息
                    {
                        AdminForums.UpdateForumTemplateID(forumInfo);
                    }

                    ForumOperator.RefreshForumCache();
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim());

                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    configInfo.Specifytemplate = Forums.GetSpecifyForumTemplateCount() > 0 ? 1 : 0;
                    GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                    if (result == "")
                    {
                        Response.Redirect("forum_ForumsTree.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户:" + result + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>");
                        Response.End();
                    }
                }
            }

            #endregion
        }
        /// <summary>
        /// 编辑广告绑定
        /// </summary>
        /// <param name="advid">广告ID</param>
        public void LoadAnnounceInf(int advid)
        {
            #region 加载相关广告信息
            GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
            for (int i = 1; i <= configInfo.Ppp; i++)
            {
                inpostfloor.Items.Add(new ListItem(" >#" + i, i.ToString()));
            }
            DataTable dt = Advertisements.GetAdvertisement(advid);
            if (dt.Rows.Count > 0)
            {
                displayorder.Text       = dt.Rows[0]["displayorder"].ToString();
                available.SelectedValue = dt.Rows[0]["available"].ToString();
                type.SelectedValue      = dt.Rows[0]["type"].ToString().Trim();
                title.Text = dt.Rows[0]["title"].ToString();

                //绑定广告有效的开始日期
                if (dt.Rows[0]["starttime"].ToString().IndexOf("1900") < 0)
                {
                    starttime.SelectedDate = Convert.ToDateTime(dt.Rows[0]["starttime"].ToString());
                }
                //绑定广告有效的结束日期
                if ((dt.Rows[0]["endtime"].ToString().IndexOf("1900") < 0) && (dt.Rows[0]["endtime"].ToString().IndexOf("2555") < 0))
                {
                    endtime.SelectedDate = Convert.ToDateTime(dt.Rows[0]["endtime"].ToString());
                }

                code.Text = dt.Rows[0]["code"].ToString().Trim();


                parameters.Items.Clear();
                parameters.Items.Add(new ListItem("代码", "htmlcode"));
                if ((type.SelectedValue != Convert.ToInt16(AdType.FloatAd).ToString()) && (type.SelectedValue != Convert.ToInt16(AdType.DoubleAd).ToString()))
                {
                    parameters.Items.Add(new ListItem("文字", "word"));
                }
                parameters.Items.Add(new ListItem("图片", "image"));
                parameters.Items.Add(new ListItem("flash", "flash"));


                //初始化参数
                string[] parameter = Utils.SplitString(dt.Rows[0]["parameters"].ToString().Trim(), "|", 9);
                parameters.SelectedValue = parameter[0].Trim();
                parameters.Attributes.Add("onChange", "showparameters();");
                wordlink.Text    = parameter[4].Trim();
                wordcontent.Text = parameter[5].Trim();
                wordfont.Text    = parameter[6].Trim();

                imgsrc.Text    = parameter[1].Trim();
                imgwidth.Text  = parameter[2].Trim();
                imgheight.Text = parameter[3].Trim();
                imglink.Text   = parameter[4].Trim();
                imgtitle.Text  = parameter[5].Trim();

                flashsrc.Text    = parameter[1].Trim();
                flashwidth.Text  = parameter[2].Trim();
                flashheight.Text = parameter[3].Trim();

                if (type.SelectedValue == Convert.ToInt16(AdType.InPostAd).ToString())
                {
                    inpostposition.SelectedValue = parameter[7].Trim();
                    string error = "";
                    foreach (string floor in parameter[8].Trim().Split(','))
                    {
                        if (Utils.StrToInt(floor, 0) > configInfo.Ppp)
                        {
                            error += floor + ",";
                        }
                        else
                        {
                            foreach (ListItem li in inpostfloor.Items)
                            {
                                if (Utils.InArray(li.Value, parameter[8].Trim()))
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                    if (error != "")
                    {
                        base.RegisterStartupScript("", "<script>window.onload = function(){alert('每页帖数已经改变,原#" + error.TrimEnd(',') + "层大于现在" + configInfo.Ppp + "层');}</script>");
                    }
                }

                if (type.SelectedValue == Convert.ToInt16(AdType.MediaAd).ToString())
                {
                    slwmvsrc.Text  = parameter[1].Trim();
                    slimage.Text   = parameter[2].Trim();
                    buttomimg.Text = parameter[4].Trim();
                    words1.Text    = parameter[5].Trim();
                    words2.Text    = parameter[6].Trim();
                    words3.Text    = parameter[7].Trim();
                }
            }

            #endregion
        }
Exemple #23
0
        protected bool UnLoginCheck()
        {
            GeneralConfigInfo gi = GeneralConfigs.GetConfig();

            return(gi.OnlyLoginUserCanVisit && !Security.IsAuthenticated());
        }
Exemple #24
0
        /// <summary>
        /// 增加一个会员信息到在线列表中。用户login.aspx或在线用户信息超时,但用户仍在线的情况下重新生成用户在线列表
        /// </summary>
        /// <param name="uid"></param>
        private static OnlineUserInfo CreateUser(int uid, int timeout)
        {
            OnlineUserInfo onlineuserinfo = new OnlineUserInfo();

            if (uid > 0)
            {
                ShortUserInfo ui = Users.GetShortUserInfo(uid);
                if (ui != null)
                {
                    onlineuserinfo.Userid         = uid;
                    onlineuserinfo.Username       = ui.Username.Trim();
                    onlineuserinfo.Nickname       = ui.Nickname.Trim();
                    onlineuserinfo.Password       = ui.Password.Trim();
                    onlineuserinfo.Groupid        = short.Parse(ui.Groupid.ToString());
                    onlineuserinfo.Olimg          = GetGroupImg(short.Parse(ui.Groupid.ToString()));
                    onlineuserinfo.Adminid        = short.Parse(ui.Adminid.ToString());
                    onlineuserinfo.Invisible      = short.Parse(ui.Invisible.ToString());
                    onlineuserinfo.Ip             = DNTRequest.GetIP();
                    onlineuserinfo.Lastposttime   = "1900-1-1 00:00:00";
                    onlineuserinfo.Lastpostpmtime = "1900-1-1 00:00:00";
                    onlineuserinfo.Lastsearchtime = "1900-1-1 00:00:00";
                    onlineuserinfo.Lastupdatetime = Utils.GetDateTime();
                    onlineuserinfo.Action         = 0;
                    onlineuserinfo.Lastactivity   = 0;
                    onlineuserinfo.Verifycode     = ForumUtils.CreateAuthStr(5, false);

                    int newPms     = PrivateMessages.GetPrivateMessageCount(uid, 0, 1);
                    int newNotices = Notices.GetNewNoticeCountByUid(uid);
                    onlineuserinfo.Newpms     = short.Parse(newPms > 1000 ? "1000" : newPms.ToString());
                    onlineuserinfo.Newnotices = short.Parse(newNotices > 1000 ? "1000" : newNotices.ToString());
                    //onlineuserinfo.Newfriendrequest = short.Parse(Friendship.GetUserFriendRequestCount(uid).ToString());
                    //onlineuserinfo.Newapprequest = short.Parse(ManyouApplications.GetApplicationInviteCount(uid).ToString());
                    onlineuserinfo.Olid = Discuz.Data.OnlineUsers.CreateOnlineUserInfo(onlineuserinfo, timeout);


                    //给管理人员发送关注通知
                    if (ui.Adminid > 0 && ui.Adminid < 4)
                    {
                        if (Discuz.Data.Notices.ReNewNotice((int)NoticeType.AttentionNotice, ui.Uid) == 0)
                        {
                            NoticeInfo ni = new NoticeInfo();
                            ni.New          = 1;
                            ni.Note         = "请及时查看<a href=\"modcp.aspx?operation=attention&forumid=0\">需要关注的主题</a>";
                            ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            ni.Type         = NoticeType.AttentionNotice;
                            ni.Poster       = "";
                            ni.Posterid     = 0;
                            ni.Uid          = ui.Uid;
                            Notices.CreateNoticeInfo(ni);
                        }
                    }
                    Discuz.Data.OnlineUsers.SetUserOnlineState(uid, 1);

                    HttpCookie cookie = HttpContext.Current.Request.Cookies["dnt"];
                    if (cookie != null)
                    {
                        cookie.Values["tpp"] = ui.Tpp.ToString();
                        cookie.Values["ppp"] = ui.Ppp.ToString();
                        if (HttpContext.Current.Request.Cookies["dnt"]["expires"] != null)
                        {
                            int expires = TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString(), 0);
                            if (expires > 0)
                            {
                                cookie.Expires = DateTime.Now.AddMinutes(TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString(), 0));
                            }
                        }
                    }

                    string cookieDomain = GeneralConfigs.GetConfig().CookieDomain.Trim();
                    if (!Utils.StrIsNullOrEmpty(cookieDomain) && HttpContext.Current.Request.Url.Host.IndexOf(cookieDomain) > -1 && ForumUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
                    {
                        cookie.Domain = cookieDomain;
                    }
                    HttpContext.Current.Response.AppendCookie(cookie);
                }
                else
                {
                    onlineuserinfo = CreateGuestUser(timeout);
                }
            }
            else
            {
                onlineuserinfo = CreateGuestUser(timeout);
            }
            return(onlineuserinfo);
        }
Exemple #25
0
        protected void 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");
            }
        }
Exemple #26
0
        /// <summary>
        /// 用户在线信息维护。判断当前用户的身份(会员还是游客),是否在在线列表中存在,如果存在则更新会员的当前动,不存在则建立.
        /// </summary>
        /// <param name="passwordkey">论坛passwordkey</param>
        /// <param name="timeout">在线超时时间</param>
        /// <param name="passwd">用户密码</param>
        public static OnlineUserInfo UpdateInfo(string passwordkey, int timeout, int uid, string passwd)
        {
            lock (SynObject)
            {
                OnlineUserInfo onlineuser = new OnlineUserInfo();
                string         ip         = DNTRequest.GetIP();
                int            userid     = TypeConverter.StrToInt(ForumUtils.GetCookie("userid"), uid);
                string         password   = (Utils.StrIsNullOrEmpty(passwd) ? ForumUtils.GetCookiePassword(passwordkey) : ForumUtils.GetCookiePassword(passwd, passwordkey));

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

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

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

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

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

                //onlineuser.Lastupdatetime = Utils.GetDateTime();  为了客户端能够登录注释此句,如有问题再修改。
                return(onlineuser);
            }
        }
Exemple #27
0
        //private void LoadUserGroup()
        //{
        //    #region 加载用户组
        //    UserGroup.DataSource = UserGroups.GetUserGroupForDataTable();
        //    UserGroup.DataValueField = "groupid";
        //    UserGroup.DataTextField = "grouptitle";
        //    UserGroup.DataBind();
        //    #endregion
        //}

        private void SaveInfo_Click(object sender, EventArgs e)
        {
            #region 保存设置信息

            if (this.CheckCookie())
            {
                if (Convert.ToInt32(minpostsize.Text) > 9999999 || (Convert.ToInt32(minpostsize.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('帖子最小字数只能在0-9999999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }

                if (Convert.ToInt32(maxpostsize.Text) > 9999999 || (Convert.ToInt32(maxpostsize.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('帖子最大字数只能在0-9999999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }

                if (Convert.ToInt32(maxfavorites.Text) > 9999999 || (Convert.ToInt32(maxfavorites.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('收藏夹容量只能在0-9999999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }

                if (Convert.ToInt32(maxpolloptions.Text) > 9999999 || (Convert.ToInt32(maxpolloptions.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('最大签名高度只能在0-9999999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }

                if (Convert.ToInt32(maxattachments.Text) > 9999999 || (Convert.ToInt32(maxattachments.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('投票最大选项数只能在0-9999999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }
                if (Convert.ToInt32(karmaratelimit.Text) > 9999 || (Convert.ToInt32(karmaratelimit.Text) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('评分时间限制只能在0-9999之间');window.location.href='forum_userrights.aspx';</script>");
                    return;
                }


                GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();

                configInfo.Dupkarmarate   = Convert.ToInt16(dupkarmarate.SelectedValue);
                configInfo.Minpostsize    = Convert.ToInt32(minpostsize.Text);
                configInfo.Maxpostsize    = Convert.ToInt32(maxpostsize.Text);
                configInfo.Maxfavorites   = Convert.ToInt32(maxfavorites.Text);
                configInfo.Maxpolloptions = Convert.ToInt32(maxpolloptions.Text);
                configInfo.Maxattachments = Convert.ToInt32(maxattachments.Text);
                configInfo.Karmaratelimit = Convert.ToInt16(karmaratelimit.Text);
                configInfo.Moderactions   = Convert.ToInt16(moderactions.SelectedValue);
                //configInfo.Allowsearchfriendbyusername = Convert.ToInt16(allowusesearchfriend.SelectedValue);
                //configInfo.Friendgroupmaxcount = Convert.ToInt16(maxfriendgroups.Text);

                //string groupList = "";
                //for (int i = 0; i < UserGroup.Items.Count; i++)
                //{
                //    if (UserGroup.Items[i].Selected)
                //    {
                //        groupList += UserGroup.Items[i].Value + ",";
                //    }
                //}
                // configInfo.Htmltitleusergroup = groupList.TrimEnd(',');

                GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "用户权限设置", "");
                base.RegisterStartupScript("PAGE", "window.location.href='forum_userrights.aspx';");
            }

            #endregion
        }
        private void SaveInfo_Click(object sender, EventArgs e)
        {
            #region 保存设置信息

            if (this.CheckCookie())
            {
                Hashtable HT = new Hashtable();
                HT.Add("发帖灌水预防", postinterval.Text);
                HT.Add("60 秒最大搜索次数", maxspm.Text);
                foreach (DictionaryEntry de in HT)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误:" + de.Key.ToString().Trim() + ",只能是0或者正整数');window.location.href='global_safecontrol.aspx';</script>");
                        return;
                    }
                }
                if (disablepostad.SelectedValue == "1" && disablepostadregular.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('新用户广告强力屏蔽正则表达式为空');window.location.href='global_safecontrol.aspx';</script>");
                    return;
                }

                //循环比对四个控件的值是否互不相同
                string   antiSpamNameList = string.Concat(antispamusername.Text, antispamemail.Text, antispamtitle.Text, antispammessage.Text);
                string[] nameList         = { antispamusername.Text, antispamemail.Text, antispamtitle.Text, antispammessage.Text };
                foreach (string str in nameList)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        base.RegisterStartupScript("", "<script>alert('防注册机设置不可为空 , 请返回重新填写!');window.location.href='global_safecontrol.aspx';</script>");
                        return;
                    }
                    if (antiSpamNameList.IndexOf(str) != antiSpamNameList.LastIndexOf(str))
                    {
                        base.RegisterStartupScript("", "<script>alert('防注册机设置不可重复 , 请返回重新填写!');window.location.href='global_safecontrol.aspx';</script>");
                        return;
                    }
                }

                GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                configInfo.VerifyImageAssemly       = VerifyImage.SelectedValue;
                configInfo.Postinterval             = Convert.ToInt32(postinterval.Text);
                configInfo.Seccodestatus            = seccodestatus.Text.Trim().Replace("\r\n", ",");
                configInfo.Maxspm                   = Convert.ToInt32(maxspm.Text);
                configInfo.Secques                  = Convert.ToInt32(secques.SelectedValue);
                configInfo.Admintools               = Convert.ToInt16(admintools.SelectedValue);
                configInfo.Antispamregisterusername = antispamusername.Text.Trim();
                configInfo.Antispamregisteremail    = antispamemail.Text.Trim();
                configInfo.Antispamposttitle        = antispamtitle.Text.Trim();
                configInfo.Antispampostmessage      = antispammessage.Text.Trim();
                configInfo.Disablepostad            = Convert.ToInt16(disablepostad.SelectedValue);
                configInfo.Disablepostadregminute   = Convert.ToInt16(disablepostadregminute.Text);
                configInfo.Disablepostadpostcount   = Convert.ToInt16(disablepostadpostcount.Text);
                configInfo.Disablepostadregular     = disablepostadregular.Text;
                GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "安全与防灌水", "");
                base.RegisterStartupScript("PAGE", "window.location.href='global_safecontrol.aspx';");
            }

            #endregion
        }
Exemple #29
0
        //public AdminPage()
        //{
        //    this.RegisterAdminPageClientScriptBlock();
        //}

        public void AdminPageStart()
        {
            this.RegisterAdminPageClientScriptBlock();

            string sysloginPage = Shove._Web.Utility.GetUrl() + "/admin/syslogin.aspx";

            config = GeneralConfigs.GetConfig();

            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(sysloginPage);
                    return;
                }
            }

            #region 进行权限判断

            int userid = Discuz.Forum.Users.GetUserIDFromCookie();

            if (userid <= 0)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }

            UserInfo u = Discuz.Forum.Users.GetUserInfo(userid);

            if (u.Adminid < 1 || u.Groupid < 1)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }



            UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(u.Groupid);
            if (usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }

            this.userid      = u.Uid;
            this.username    = u.Username;
            this.usergroupid = u.Groupid;
            this.useradminid = (short)usergroupinfo.Radminid;
            this.grouptitle  = usergroupinfo.Grouptitle;
            this.ip          = DNTRequest.GetIP();

            #endregion

            //当前窗口不在Index.aspx页面上的FRAME中,则重定向到该框架中
            //if (DNTRequest.GetPageName() != "runforumstatic.aspx")
            //{
            //    Context.Response.Write("<script>if(top.mainFrame==null) top.location.href='/admin/index.aspx?fromurl=" + Context.Request.RawUrl + "';</script>");
            //    Context.Response.End();
            //    return;
            //}
        }
        public void LoadConfigInfo()
        {
            #region 加载配置信息

            GeneralConfigInfo    configInfo           = GeneralConfigs.GetConfig();
            InvitationConfigInfo invitationConfigInfo = InvitationConfigs.GetConfig();

            regstatus.SelectedValue = configInfo.Regstatus.ToString();

            censoruser.Text           = configInfo.Censoruser;
            doublee.SelectedValue     = configInfo.Doublee.ToString();
            emaillogin.SelectedValue  = configInfo.Emaillogin.ToString();
            regverify.SelectedValue   = configInfo.Regverify.ToString();
            accessemail.Text          = configInfo.Accessemail;
            censoremail.Text          = configInfo.Censoremail;
            hideprivate.SelectedValue = configInfo.Hideprivate.ToString();
            ipdenyaccess.Text         = configInfo.Ipdenyaccess;
            ipaccess.Text             = configInfo.Ipaccess;
            regctrl.Text                      = configInfo.Regctrl.ToString();
            ipregctrl.Text                    = configInfo.Ipregctrl;
            adminipaccess.Text                = configInfo.Adminipaccess;
            welcomemsg.SelectedValue          = configInfo.Welcomemsg.ToString();
            welcomemsgtxt.Text                = configInfo.Welcomemsgtxt;
            rules.SelectedValue               = configInfo.Rules.ToString();
            rulestxt.Text                     = configInfo.Rulestxt;
            newbiespan.Text                   = configInfo.Newbiespan.ToString();
            realnamesystem.SelectedValue      = configInfo.Realnamesystem.ToString();
            invitecodeexpiretime.Text         = invitationConfigInfo.InviteCodeExpireTime.ToString();
            invitecodemaxcount.Text           = invitationConfigInfo.InviteCodeMaxCount.ToString();
            addextcreditsline.Text            = invitationConfigInfo.InviteCodePayCount.ToString();
            invitationuserdescription.Text    = invitationConfigInfo.InvitationLoginUserDescription;//配置项赋值给textarea的innnerhtml能保证显示出来的是所见即所得的效果
            invitationvisitordescription.Text = invitationConfigInfo.InvitationVisitorDescription;
            invitationemailmodel.Text         = invitationConfigInfo.InvitationEmailTemplate;
            invitecodeusermaxbuy.Text         = invitationConfigInfo.InviteCodeMaxCountToBuy.ToString();
            invitecodeusercreateperday.Text   = invitationConfigInfo.InviteCodeUserCreatePerDay.ToString();
            passwordmode.SelectedValue        = configInfo.Passwordmode.ToString();
            CookieDomain.Text                 = configInfo.CookieDomain.ToString();
            verifyregisterexpired.Text        = configInfo.Verifyregisterexpired.ToString();
            verifyemailtemp.text              = configInfo.Verifyregisteremailtemp;
            string[] extCredits = Utils.SplitString(invitationConfigInfo.InviteCodePrice, ",");
            extCreditsUnits = Scoresets.GetValidScoreUnit();
            DataTable extCreditsTable = Scoresets.GetScorePaySet(0);

            //初始化邀请码价格显示界面,全部为隐藏
            for (int count = 0; count < 8; count++)
            {
                extCreditsName[count] = "";
                TextBox textbox = this.FindControl("invitecodeprice" + count.ToString()) as TextBox;
                textbox.Text    = extCredits[count];
                textbox.Visible = false;
            }

            //根据邀请码相关信息,将有效的信息显示在界面中
            foreach (DataRow dr in extCreditsTable.Rows)
            {
                extCreditsName[Utils.StrToInt(dr["id"].ToString(), 0) - 1] = dr["name"].ToString() + ":";
                TextBox textbox = this.FindControl("invitecodeprice" + (Utils.StrToInt(dr[0].ToString(), 0) - 1).ToString()) as TextBox;
                textbox.Visible = true;
            }

            #endregion
        }