Пример #1
0
 private void StopTalk_Click(object sender, EventArgs e)
 {
     if (Request["uid"] != "")
     {
         string   text   = "0" + Request["uid"];
         string[] array  = text.Split(',');
         string[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             string s   = array2[i];
             int    num = int.Parse(s);
             if (num != 0)
             {
                 if (SpacePluginProvider.GetInstance() != null)
                 {
                     SpacePluginProvider.GetInstance().Ban(num);
                 }
                 if (AlbumPluginProvider.GetInstance() != null)
                 {
                     AlbumPluginProvider.GetInstance().Ban(num);
                 }
                 OnlineUsers.DeleteUserByUid(num);
             }
         }
         Users.UpdateUserToStopTalkGroup(text);
         base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx';");
         return;
     }
     base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location.href='global_usergrid.aspx';</script>");
 }
Пример #2
0
        private void StopTalk_Click(object sender, EventArgs e)
        {
            #region 禁言
            if (DNTRequest.GetString("uid") != "")
            {
                string   uidlist = "0" + DNTRequest.GetString("uid");
                string[] uids    = uidlist.Split(',');
                foreach (string uid in uids)
                {
                    int iuid = int.Parse(uid);
                    if (iuid != 0)
                    {
                        if (SpacePluginProvider.GetInstance() != null)
                        {
                            SpacePluginProvider.GetInstance().Ban(iuid);
                        }
                        if (AlbumPluginProvider.GetInstance() != null)
                        {
                            AlbumPluginProvider.GetInstance().Ban(iuid);
                        }
                        Discuz.Forum.OnlineUsers.DeleteUserByUid(iuid);
                    }
                }
                Discuz.Forum.Users.UpdateUserToStopTalkGroup(uidlist);
                base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx';");
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location.href='global_usergrid.aspx';</script>");
            }

            #endregion
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         usergrouppowersetting.Bind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     haveMall  = MallPluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         LoadConfigInfo();
     }
 }
Пример #5
0
        /// <summary>
        /// 获取图片热门标签
        /// </summary>
        private void GetPhotoHotTags()
        {
            string filename = Utils.GetMapPath(BaseConfigs.GetForumPath + AlbumPluginProvider.GetInstance().PHOTO_HOT_TAG_CACHE_FILENAME);

            if (!File.Exists(filename))
            {
                AlbumPluginProvider.GetInstance().WriteHotTagsListForPhotoJSONPCacheFile(60);
            }

            WriteFile(filename);
        }
        private void DelUserInfo_Click(object sender, EventArgs e)
        {
            #region  除指定用户信息

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

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

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

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

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

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

            #endregion
        }
Пример #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     haveMall  = MallPluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         LoadConfigInfo();
         closed.Items[0].Attributes.Add("onclick", "setStatus(true)");
         closed.Items[1].Attributes.Add("onclick", "setStatus(false)");
     }
 }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         usergrouppowersetting.Bind();
         if (DNTRequest.GetString("groupid") != "")
         {
             SetGroupRights(DNTRequest.GetInt("groupid", 0));
         }
     }
 }
        private void StopTalk_Click(object sender, EventArgs e)
        {
            #region 设置禁言

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

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

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

            #endregion
        }
Пример #10
0
        private void DeleteUser_Click(object sender, EventArgs e)
        {
            #region  除相关用户

            if (this.CheckCookie())
            {
                string uidList = DNTRequest.GetString("uid").Trim(',');
                if (uidList != "")
                {
                    bool delpost = deltype.SelectedValue.IndexOf("1") >= 0 ? false : true;
                    bool delpms  = deltype.SelectedValue.IndexOf("2") >= 0 ? false : true;

                    foreach (string uid in uidList.Split(','))
                    {
                        if (uid != "")
                        {
                            if (CheckSponser(Convert.ToInt32(uid)))
                            {
                                if (Convert.ToInt32(uid) > 1) //判断是不是当前Uid是不是系统初始化时生成的Uid
                                {
                                    int deluserid = Convert.ToInt32(uid);
                                    if (AlbumPluginProvider.GetInstance() != null)
                                    {
                                        AlbumPluginProvider.GetInstance().Delete(deluserid);
                                    }
                                    if (SpacePluginProvider.GetInstance() != null)
                                    {
                                        SpacePluginProvider.GetInstance().Delete(deluserid);
                                    }
                                    if (AdminUsers.DelUserAllInf(deluserid, delpost, delpms))
                                    {
                                        //删除用户消息同步
                                        Discuz.Forum.Sync.DeleteUsers(uid, "");
                                        AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:批量用户删除");
                                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
Пример #11
0
 private void StopTalk_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         this.userInfo = Users.GetUserInfo(DNTRequest.GetInt("uid", -1));
         if (!this.AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true))
         {
             return;
         }
         if (this.ViewState["GroupID"].ToString() != "4")
         {
             if (this.userInfo.ID > 1)
             {
                 if (AlbumPluginProvider.GetInstance() != null)
                 {
                     AlbumPluginProvider.GetInstance().Ban(this.userInfo.ID);
                 }
                 if (SpacePluginProvider.GetInstance() != null)
                 {
                     SpacePluginProvider.GetInstance().Ban(this.userInfo.ID);
                 }
                 Users.UpdateUserToStopTalkGroup(this.userInfo.ID.ToString());
                 base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';");
             }
             else
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>");
             }
         }
         else
         {
             if (CreditsFacade.GetCreditsUserGroupId(0f) != null)
             {
                 int groupId = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits).ID;
                 Users.UpdateUserGroup(this.userInfo.ID, groupId);
                 base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';");
             }
             else
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>");
             }
         }
         OnlineUsers.DeleteUserByUid(this.userInfo.ID);
     }
 }
Пример #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.haveAlbum = (AlbumPluginProvider.GetInstance() != null);
     this.haveSpace = (SpacePluginProvider.GetInstance() != null);
     if (!base.IsPostBack)
     {
         if (!(Request["groupid"] != ""))
         {
             base.Response.Redirect("global_adminusergroupgrid.aspx");
             return;
         }
         this.LoadUserGroupInf(DNTRequest.GetInt("groupid", -1));
         if (AlbumPluginProvider.GetInstance() == null)
         {
             this.admingroupright.Items.RemoveAt(this.admingroupright.Items.Count - 1);
         }
     }
 }
Пример #13
0
 public RssPage()
 {
     System.Web.HttpContext.Current.Response.ContentType = "application/xml";
     if (config.Rssstatus == 1)
     {
         if (DNTRequest.GetString("type") == "space" && config.Enablespace == 1)
         {
             System.Web.HttpContext.Current.Response.Write(DNTRequest.GetInt("uid", -1) == -1 ?
                                                           SpacePluginProvider.GetInstance().GetFeed(config.Rssttl) :
                                                           SpacePluginProvider.GetInstance().GetFeed(config.Rssttl, DNTRequest.GetInt("uid", -1)));
             System.Web.HttpContext.Current.Response.End();
             return;
         }
         if (DNTRequest.GetString("type") == "photo" && config.Enablealbum == 1)
         {
             System.Web.HttpContext.Current.Response.Write(DNTRequest.GetInt("uid", -1) == -1 ?
                                                           AlbumPluginProvider.GetInstance().GetFeed(config.Rssttl) :
                                                           AlbumPluginProvider.GetInstance().GetFeed(config.Rssttl, DNTRequest.GetInt("uid", -1)));
             System.Web.HttpContext.Current.Response.End();
             return;
         }
         //获得论坛最新的20个主题的Rss描述
         if (DNTRequest.GetInt("forumid", -1) == -1)
         {
             System.Web.HttpContext.Current.Response.Write(Feeds.GetRssXml(config.Rssttl));
             System.Web.HttpContext.Current.Response.End();
             return;
         }
         else
         {
             //获得指定版块最新的20个主题的Rss描述
             ForumInfo forum = Forums.GetForumInfo(DNTRequest.GetInt("forumid", -1));
             if (forum != null && forum.Allowrss == 1)
             {
                 System.Web.HttpContext.Current.Response.Write(Feeds.GetForumRssXml(config.Rssttl, DNTRequest.GetInt("forumid", -1)));
                 System.Web.HttpContext.Current.Response.End();
                 return;
             }
         }
     }
     System.Web.HttpContext.Current.Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
     System.Web.HttpContext.Current.Response.Write("<Rss>Error</Rss>\r\n");
     System.Web.HttpContext.Current.Response.End();
 }
Пример #14
0
        public List <AlbumInfo> GetAlbumList(int type, int focusPhotoCount, int vaildDays)
        {
            if (__focusAlbumList != null)
            {
                return(__focusAlbumList);
            }
            IDataReader albumListByCondition = AlbumPluginProvider.GetInstance().GetAlbumListByCondition(type, focusPhotoCount, vaildDays);

            __focusAlbumList = new List <AlbumInfo>();
            if (albumListByCondition != null)
            {
                while (albumListByCondition.Read())
                {
                    __focusAlbumList.Add(AlbumPluginProvider.GetInstance().GetAlbumEntity(albumListByCondition));
                }
                albumListByCondition.Close();
            }
            return(__focusAlbumList);
        }
Пример #15
0
        /// <summary>
        /// 获取相册导航
        /// </summary>
        public void GetAlbum()
        {
            //如果不是提交...
            if (ForumUtils.IsCrossSitePost())
            {
                return;
            }

            if (DNTRequest.GetQueryInt("albumid", 0) < 1)
            {
                return;
            }

            AlbumPluginProvider.GetInstance().CreateAlbumJsonData(DNTRequest.GetQueryInt("albumid", 0));
            string builder = AlbumPluginProvider.GetInstance().GetAlbumJsonData(DNTRequest.GetQueryInt("albumid", 0));

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

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

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

            WriteFile(filename);
        }
Пример #17
0
        /// <summary>
        /// 根据指定条件进行搜索
        /// </summary>
        /// <param name="posttableid">帖子表id</param>
        /// <param name="userid">用户id</param>
        /// <param name="usergroupid">用户组id</param>
        /// <param name="keyword">关键字</param>
        /// <param name="posterid">发帖者id</param>
        /// <param name="searchType">搜索类型</param>
        /// <param name="searchforumid">搜索版块id</param>
        /// <param name="searchtime">搜索时间</param>
        /// <param name="searchtimetype">搜索时间类型</param>
        /// <param name="resultorder">结果排序方式</param>
        /// <param name="resultordertype">结果类型类型</param>
        /// <returns>如果成功则返回searchid, 否则返回-1</returns>
        public static int Search(int posttableid, int userid, int usergroupid, string keyword, int posterid, SearchType searchType, string searchforumid, int searchtime, int searchtimetype, int resultorder, int resultordertype)
        {
            bool spaceenabled = false, albumenable = false;

            if (posttableid == 0)
            {
                posttableid = TypeConverter.StrToInt(Posts.GetPostTableId(), 1);
            }

            if (GeneralConfigs.GetConfig().Enablespace == 1 && SpacePluginProvider.GetInstance() != null)
            {
                spaceenabled = true;
            }

            if (GeneralConfigs.GetConfig().Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null)
            {
                albumenable = true;
            }

            return(Discuz.Data.Searches.Search(spaceenabled, albumenable, posttableid, userid, usergroupid, keyword, posterid, searchType, searchforumid, searchtime, searchtimetype, resultorder, resultordertype));
        }
Пример #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     if (!IsPostBack)
     {
         if (DNTRequest.GetString("groupid") != "")
         {
             LoadUserGroupInf(DNTRequest.GetInt("groupid", -1));
         }
         else
         {
             Response.Redirect("global_adminusergroupgrid.aspx");
             return;
         }
         if (AlbumPluginProvider.GetInstance() == null)
         {
             admingroupright.Items.RemoveAt(admingroupright.Items.Count - 1);
         }
     }
 }
Пример #19
0
        /// <summary>
        /// 获得焦点相册列表
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="focusphotocount">返回记录条数</param>
        /// <param name="vaildDays">有效天数</param>
        /// <returns></returns>
        public Discuz.Common.Generic.List <AlbumInfo> GetAlbumList(int type, int focusPhotoCount, int vaildDays)
        {
            //当文件未被修改时将直接返回相关记录
            if (__focusAlbumList != null)
            {
                return(__focusAlbumList);
            }

            IDataReader reader = AlbumPluginProvider.GetInstance().GetAlbumListByCondition(type, focusPhotoCount, vaildDays);

            __focusAlbumList = new Discuz.Common.Generic.List <AlbumInfo>();
            if (reader != null)
            {
                while (reader.Read())
                {
                    __focusAlbumList.Add(AlbumPluginProvider.GetInstance().GetAlbumEntity(reader));
                }
                reader.Close();
            }
            return(__focusAlbumList);
        }
Пример #20
0
 private void DelUserInfo_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         int @int = DNTRequest.GetInt("uid", -1);
         if (!this.AllowEditUserInfo(@int, true))
         {
             return;
         }
         if (this.AllowDeleteUser(this.userid, @int))
         {
             bool delposts = this.deltype.SelectedValue.IndexOf("1") < 0;
             bool delpms   = this.deltype.SelectedValue.IndexOf("2") < 0;
             if (SpacePluginProvider.GetInstance() != null)
             {
                 SpacePluginProvider.GetInstance().Delete(@int);
             }
             if (AlbumPluginProvider.GetInstance() != null)
             {
                 AlbumPluginProvider.GetInstance().Delete(@int);
             }
             if (AdminUsers.DelUserAllInf(@int, delposts, delpms))
             {
                 Sync.DeleteUsers(@int.ToString(), "");
                 Avatars.DeleteAvatar(@int.ToString());
                 AdminUsers.UpdateForumsFieldModerators(this.userName.Text);
                 OnlineUsers.DeleteUserByUid(this.userInfo.ID);
                 AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:" + this.userName.Text);
                 base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
                 return;
             }
             base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';</script>");
             return;
         }
         else
         {
             base.RegisterStartupScript("", "<script>alert('操作失败,你要删除的用户是创始人用户或是其它管理员,因此不能删除!');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';</script>");
         }
     }
 }
Пример #21
0
        public List <PhotoInfo> GetWeekHotPhotoList(int focusPhotoCount)
        {
            if (__weekHotPhotoList != null)
            {
                return(__weekHotPhotoList);
            }
            __weekHotPhotoList = new List <PhotoInfo>();
            IDataReader focusPhotoList = AlbumPluginProvider.GetInstance().GetFocusPhotoList(0, focusPhotoCount, 7);

            if (focusPhotoList != null)
            {
                while (focusPhotoList.Read())
                {
                    PhotoInfo photoEntity = AlbumPluginProvider.GetInstance().GetPhotoEntity(focusPhotoList);
                    photoEntity.Filename = AlbumPluginProvider.GetInstance().GetThumbnailImage(photoEntity.Filename);
                    photoEntity.Title    = photoEntity.Title.Trim();
                    __weekHotPhotoList.Add(photoEntity);
                }
                focusPhotoList.Close();
            }
            return(__weekHotPhotoList);
        }
Пример #22
0
        /// <summary>
        /// 自定义模块加载时的行为
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public override string OnMouduleLoad(string content)
        {
            if (AlbumPluginProvider.GetInstance() == null || GeneralConfigs.GetConfig().Enablealbum != 1)
            {
                return("相册插件未安装,模块暂不可用");
            }

            UserPrefsSaved   userprefs  = new UserPrefsSaved(this.Module.UserPref);
            int              photocount = Utils.StrToInt(userprefs.GetValueByName("photocount"), 10);
            int              albumid    = Utils.StrToInt(userprefs.GetValueByName("albumid"), 0);
            List <PhotoInfo> photolist  = DTOProvider.GetPhotoListByUserId(this.Module.Uid, albumid, photocount);
            StringBuilder    sb         = new StringBuilder(StaticFileProvider.GetContent(jsFile));
            StringBuilder    sbImgList  = new StringBuilder();

            for (int i = 0; i < photolist.Count; i++)
            {
                sbImgList.AppendFormat("data[\"-1_{0}\"] = \"img: {1}; url: {2}; target: _blank; \"\r\n", i + 1, BaseConfigs.GetForumPath + Discuz.Album.Globals.GetSquareImage(photolist[i].Filename), BaseConfigs.GetForumPath + "showalbumlist.aspx?uid=" + this.Module.Uid);
            }
            sb.Replace("{$templatepath}", BaseConfigs.GetForumPath + "templates/" + Templates.GetTemplateItem(GeneralConfigs.GetConfig().Templateid).Directory);
            sb.Replace("{$photolist}", sbImgList.ToString());
            content = sb.ToString();
            return(base.OnMouduleLoad(content));
        }
Пример #23
0
 private void DeleteUser_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string text = Request["uid"].Trim(',');
         if (text != "")
         {
             bool     delposts = this.deltype.SelectedValue.IndexOf("1") < 0;
             bool     delpms   = this.deltype.SelectedValue.IndexOf("2") < 0;
             string[] array    = text.Split(',');
             for (int i = 0; i < array.Length; i++)
             {
                 string text2 = array[i];
                 if (text2 != "" && this.CheckSponser(Convert.ToInt32(text2)) && Convert.ToInt32(text2) > 1)
                 {
                     int userid = Convert.ToInt32(text2);
                     if (AlbumPluginProvider.GetInstance() != null)
                     {
                         AlbumPluginProvider.GetInstance().Delete(userid);
                     }
                     if (SpacePluginProvider.GetInstance() != null)
                     {
                         SpacePluginProvider.GetInstance().Delete(userid);
                     }
                     if (AdminUsers.DelUserAllInf(userid, delposts, delpms))
                     {
                         Sync.DeleteUsers(text2, "");
                         AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:批量用户删除");
                         base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
                     }
                 }
             }
             return;
         }
         base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';</script>");
     }
 }
Пример #24
0
        protected void OutPutRecommendedAlbum(string template, string alternatingTemplate)
        {
            if (AlbumPluginProvider.GetInstance() == null)
            {
                Response.Write("document.write('未安装相册插件');");
                return;
            }

            StringBuilder result = new StringBuilder();
            int           i      = 0;
            string        title  = "";

            foreach (AlbumInfo album in AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Website"))
            {
                if (i > count)
                {
                    break;
                }
                title = album.Title;
                result.AppendFormat((i % 2 == 0 ? template : alternatingTemplate), "", (length == -1 ? title : Utils.GetUnicodeSubString(title, length, "")), "", "", title, album.Logo, spacerooturl + "?uid=" + album.Userid, "", rootUrl + "showalbum.aspx?albumid=" + album.Albumid);
                i++;
            }
            Response.Write("document.write('" + result.ToString().Replace("'", "\\'") + "');");
        }
Пример #25
0
        public void Execute(object state)
        {
            SpacePluginBase spb = SpacePluginProvider.GetInstance();

            AlbumPluginBase apb = AlbumPluginProvider.GetInstance();

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

            MallPluginBase imp = MallPluginProvider.GetInstance();

            if (imp != null)
            {
                imp.WriteHotTagsListForGoodsJSONPCacheFile(60);
            }
        }
Пример #26
0
        /// <summary>
        /// 一周热图总排行
        /// </summary>
        /// <param name="focusphotocount">返回的记录数</param>
        /// <returns></returns>
        public Discuz.Common.Generic.List <PhotoInfo> GetWeekHotPhotoList(int focusPhotoCount)
        {
            //当文件未被修改时将直接返回相关记录
            if (__weekHotPhotoList != null)
            {
                return(__weekHotPhotoList);
            }

            __weekHotPhotoList = new Discuz.Common.Generic.List <PhotoInfo>();
            IDataReader reader = AlbumPluginProvider.GetInstance().GetFocusPhotoList(0, focusPhotoCount, 7);

            if (reader != null)
            {
                while (reader.Read())
                {
                    PhotoInfo pi = AlbumPluginProvider.GetInstance().GetPhotoEntity(reader);
                    pi.Filename = AlbumPluginProvider.GetInstance().GetThumbnailImage(pi.Filename);
                    pi.Title    = pi.Title.Trim();
                    __weekHotPhotoList.Add(pi);
                }
                reader.Close();
            }
            return(__weekHotPhotoList);
        }
Пример #27
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新管理组信息

            if (this.CheckCookie())
            {
                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_editadminusergroup.aspx';</script>");
                        return;
                    }
                }
                userGroupInfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System     = 0;
                userGroupInfo.Type       = 0;
                userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text);

                int selectradminid = Convert.ToInt32(radminid.SelectedValue);
                //对于当前用户组中,有管理权限的,则设置管理权限
                if (selectradminid > 0 && selectradminid <= 3)
                {
                    adminGroupInfo          = new AdminGroupInfo();
                    adminGroupInfo.Admingid = (short)userGroupInfo.Groupid;
                    //插入相应的管理组
                    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);

                    Discuz.Forum.AdminGroups.SetAdminGroupInfo(adminGroupInfo, userGroupInfo.Groupid);
                    userGroupInfo.Radminid = selectradminid;
                }
                else
                {
                    userGroupInfo.Radminid = 0;
                }

                AdminGroups.ChangeUserAdminidByGroupid(userGroupInfo.Radminid, userGroupInfo.Groupid);

                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.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text);
                userGroupInfo.Attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);


                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    #region 是否允许接收举报信息和管理图片评论
                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    //是否允许接收举报信息
                    int groupid = userGroupInfo.Groupid;
                    if (admingroupright.Items[13].Selected)
                    {
                        if (("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (configInfo.Reportusergroup == "")
                            {
                                configInfo.Reportusergroup = groupid.ToString();
                            }
                            else
                            {
                                configInfo.Reportusergroup += "," + groupid.ToString();
                            }
                        }
                    }
                    else
                    {
                        string tempstr = "";
                        foreach (string report in configInfo.Reportusergroup.Split(','))
                        {
                            if (report != groupid.ToString())
                            {
                                if (tempstr == "")
                                {
                                    tempstr = report;
                                }
                                else
                                {
                                    tempstr += "," + report;
                                }
                            }
                        }
                        configInfo.Reportusergroup = tempstr;
                    }
                    //是否允许管理图片评论
                    if (AlbumPluginProvider.GetInstance() != null)
                    {
                        if (admingroupright.Items[admingroupright.Items.Count - 1].Selected)
                        {
                            if (("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1)
                            {
                                if (configInfo.Photomangegroups == "")
                                {
                                    configInfo.Photomangegroups = groupid.ToString();
                                }
                                else
                                {
                                    configInfo.Photomangegroups += "," + groupid.ToString();
                                }
                            }
                        }
                        else
                        {
                            string tempstr = "";
                            foreach (string photomangegroup in configInfo.Photomangegroups.Split(','))
                            {
                                if (photomangegroup != groupid.ToString())
                                {
                                    if (tempstr == "")
                                    {
                                        tempstr = photomangegroup;
                                    }
                                    else
                                    {
                                        tempstr += "," + photomangegroup;
                                    }
                                }
                            }
                            configInfo.Photomangegroups = tempstr;
                        }
                    }

                    GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                    #endregion
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");

                    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
        }
Пример #28
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                foreach (DictionaryEntry dictionaryEntry in new Hashtable
                {
                    {
                        "附件最大尺寸",
                        this.maxattachsize.Text
                    },

                    {
                        "每天最大附件总尺寸",
                        this.maxsizeperday.Text
                    },

                    {
                        "个人空间附件总尺寸",
                        this.maxspaceattachsize.Text
                    },

                    {
                        "相册空间总尺寸",
                        this.maxspacephotosize.Text
                    }
                })
                {
                    if (!Utils.IsInt(dictionaryEntry.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + dictionaryEntry.Key.ToString() + "只能是0或者正整数');window.location.href='global_editadminusergroup.aspx';</script>");
                        return;
                    }
                }
                this.userGroupInfo            = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
                this.userGroupInfo.System     = 0;
                this.userGroupInfo.Type       = 0;
                this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text);
                int num = Convert.ToInt32(this.radminid.SelectedValue);
                if (num > 0 && num <= 3)
                {
                    adminGroupInfo                   = new AdminGroup();
                    adminGroupInfo.AdmingID          = (short)this.userGroupInfo.ID;
                    adminGroupInfo.AllowEditPost     = admingroupright.Items[0].Selected;
                    adminGroupInfo.AllowEditpoll     = admingroupright.Items[1].Selected;
                    adminGroupInfo.AllowStickthread  = Convert.ToInt16(this.allowstickthread.SelectedValue) > 0;
                    adminGroupInfo.AllowModPost      = false;
                    adminGroupInfo.AllowDelPost      = admingroupright.Items[2].Selected;
                    adminGroupInfo.AllowMassprune    = admingroupright.Items[3].Selected;
                    adminGroupInfo.AllowRefund       = false;
                    adminGroupInfo.AllowCensorword   = false;
                    adminGroupInfo.AllowViewIP       = admingroupright.Items[4].Selected;
                    adminGroupInfo.AllowBanIP        = false;
                    adminGroupInfo.AllowEditUser     = admingroupright.Items[5].Selected;
                    adminGroupInfo.AllowModUser      = false;
                    adminGroupInfo.AllowBanUser      = false;
                    adminGroupInfo.AllowPostannounce = false;
                    adminGroupInfo.AllowViewLog      = admingroupright.Items[6].Selected;
                    adminGroupInfo.DisablePostctrl   = admingroupright.Items[7].Selected;
                    adminGroupInfo.AllowViewrealName = admingroupright.Items[8].Selected;
                    adminGroupInfo.AllowBanUser      = admingroupright.Items[9].Selected;
                    adminGroupInfo.AllowBanIP        = admingroupright.Items[10].Selected;
                    adminGroupInfo.AllowModPost      = admingroupright.Items[11].Selected;
                    adminGroupInfo.AllowPostannounce = admingroupright.Items[12].Selected;

                    //AdminGroups.SetAdminGroupInfo(this.adminGroupInfo, this.userGroupInfo.ID);
                    adminGroupInfo.Save();
                    this.userGroupInfo.RadminID = num;
                }
                else
                {
                    this.userGroupInfo.RadminID = 0;
                }

                //AdminGroups.ChangeUserAdminidByGroupid(this.userGroupInfo.RadminID, this.userGroupInfo.ID);
                AdminGroup.ChangeGroup(userGroupInfo.RadminID, userGroupInfo.ID);
                this.userGroupInfo.GroupTitle         = this.groupTitle.Text;
                this.userGroupInfo.Creditshigher      = Convert.ToInt32(this.creditshigher.Text);
                this.userGroupInfo.Creditslower       = Convert.ToInt32(this.creditslower.Text);
                this.userGroupInfo.Stars              = Convert.ToInt32(this.stars.Text);
                this.userGroupInfo.Color              = this.color.Text;
                this.userGroupInfo.Groupavatar        = this.groupavatar.Text;
                this.userGroupInfo.MaxPrice           = Convert.ToInt32(this.maxprice.Text);
                this.userGroupInfo.MaxPmNum           = Convert.ToInt32(this.maxpmnum.Text);
                this.userGroupInfo.MaxSigSize         = Convert.ToInt32(this.maxsigsize.Text);
                this.userGroupInfo.MaxAttachSize      = Convert.ToInt32(this.maxattachsize.Text);
                this.userGroupInfo.MaxSizeperday      = Convert.ToInt32(this.maxsizeperday.Text);
                this.userGroupInfo.MaxSpaceattachSize = Convert.ToInt32(this.maxspaceattachsize.Text);
                this.userGroupInfo.MaxSpacephotoSize  = Convert.ToInt32(this.maxspacephotosize.Text);
                this.userGroupInfo.AttachExtensions   = this.attachextensions.GetSelectString(",");
                this.usergrouppowersetting.GetSetting(ref this.userGroupInfo);
                //if (AdminUserGroups.UpdateUserGroupInfo(this.userGroupInfo))
                if (userGroupInfo.Save() > 0)
                {
                    var config  = GeneralConfigInfo.Current;
                    int groupid = this.userGroupInfo.ID;
                    if (this.admingroupright.Items[13].Selected)
                    {
                        if (("," + config.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (config.Reportusergroup == "")
                            {
                                config.Reportusergroup = groupid.ToString();
                            }
                            else
                            {
                                GeneralConfigInfo expr_636 = config;
                                expr_636.Reportusergroup = expr_636.Reportusergroup + "," + groupid.ToString();
                            }
                        }
                    }
                    else
                    {
                        string   text  = "";
                        string[] array = config.Reportusergroup.Split(',');
                        for (int i = 0; i < array.Length; i++)
                        {
                            string text2 = array[i];
                            if (text2 != groupid.ToString())
                            {
                                if (text == "")
                                {
                                    text = text2;
                                }
                                else
                                {
                                    text = text + "," + text2;
                                }
                            }
                        }
                        config.Reportusergroup = text;
                    }
                    if (AlbumPluginProvider.GetInstance() != null)
                    {
                        if (this.admingroupright.Items[this.admingroupright.Items.Count - 1].Selected)
                        {
                            if (("," + config.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1)
                            {
                                if (config.Photomangegroups == "")
                                {
                                    config.Photomangegroups = groupid.ToString();
                                }
                                else
                                {
                                    GeneralConfigInfo expr_75C = config;
                                    expr_75C.Photomangegroups = expr_75C.Photomangegroups + "," + groupid.ToString();
                                }
                            }
                        }
                        else
                        {
                            string   text3  = "";
                            string[] array2 = config.Photomangegroups.Split(',');
                            for (int j = 0; j < array2.Length; j++)
                            {
                                string text4 = array2[j];
                                if (text4 != groupid.ToString())
                                {
                                    if (text3 == "")
                                    {
                                        text3 = text4;
                                    }
                                    else
                                    {
                                        text3 = text3 + "," + text4;
                                    }
                                }
                            }
                            config.Photomangegroups = text3;
                        }
                    }
                    config.Save();

                    //config.Save();;
                    DNTCache.Current.RemoveObject(CacheKeys.FORUM_USER_GROUP_LIST);
                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新管理组", "组名:" + this.groupTitle.Text);
                    base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
                    return;
                }
                base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>");
            }
        }
Пример #29
0
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

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

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

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

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

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

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

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

                //userInfo.Avatarshowid = 0;

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


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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

            #endregion
        }
Пример #30
0
        private string StartUploadFile()
        {
            string sSavePath = "";

            if (ViewState["UploadDir"] != null)
            {
                sSavePath = ViewState["UploadDir"].ToString();
            }
            else
            {
                sSavePath = Server.MapPath(BaseConfigs.GetForumPath + "space/upload/");
            }

            if (filefield1.PostedFile != null)
            {
                HttpPostedFile myFile   = filefield1.PostedFile;
                int            nFileLen = myFile.ContentLength;
                if (nFileLen == 0)
                {
                    return("");
                }

                byte[] myData = new Byte[nFileLen];
                myFile.InputStream.Read(myData, 0, nFileLen);
                Random random    = new Random(unchecked ((int)DateTime.Now.Ticks));
                string sFilename = (Environment.TickCount & int.MaxValue).ToString() + random.Next(1000, 9999).ToString() + System.IO.Path.GetExtension(myFile.FileName).ToLower();

                //判断sFilename的文件名称是否已存在于服务器上. 如存在, 则添加文件递增标识
                int file_append = 0;
                while (File.Exists(sSavePath + sFilename))
                {
                    file_append++;
                    sFilename = Path.GetFileNameWithoutExtension(myFile.FileName) + file_append.ToString() + Path.GetExtension(myFile.FileName).ToLower();
                }

                string fileExtName      = Path.GetExtension(myFile.FileName).ToLower();
                string relativeFilePath = ViewState["RelativeFilePath"].ToString().Trim();

                fileExtName = fileExtName != "" ? fileExtName: ".invalidExtName";

                if ((attachextensions == null) || (attachextensions.ToLower().IndexOf(fileExtName.Remove(0, 1)) >= 0))
                {
                    //上传图片文件
                    if ((fileExtName == ".jpg") || (fileExtName == ".gif") || (fileExtName == ".png") || (fileExtName == ".jpeg"))
                    {
                        try
                        {
                            AlbumPluginBase apb = AlbumPluginProvider.GetInstance();
                            //上传附件同时加入相册
                            if (albums.SelectedValue != "" && apb != null)
                            {
                                int maxphotosize     = UserGroups.GetUserGroupInfo(_userinfo.Groupid).Maxspacephotosize;
                                int currentphotisize = apb.GetPhotoSizeByUserid(userid);
                                if ((maxphotosize - currentphotisize - nFileLen) <= 0)  //相册的存储空间不足
                                {
                                    HttpContext.Current.Response.Write("<script>alert('" + config.Albumname + "空间不足, 上传至相册失败!');</script>");
                                    HttpContext.Current.Response.End();
                                    return("");
                                }
                                else
                                {
                                    FileStream newFile = new FileStream(sSavePath + sFilename, FileMode.Create);
                                    newFile.Write(myData, 0, myData.Length);
                                    newFile.Close();

                                    string extension = Path.GetExtension(sSavePath + sFilename);
                                    Common.Thumbnail.MakeThumbnailImage(sSavePath + sFilename, (sSavePath + sFilename).Replace(extension, "_thumbnail" + extension), 150, 150);
                                    Common.Thumbnail.MakeSquareImage(sSavePath + sFilename, (sSavePath + sFilename).Replace(extension, "_square" + extension), 100);
                                    string sPath = relativeFilePath;
                                    if (sPath.StartsWith("/"))
                                    {
                                        sPath = sPath.Substring(1, sPath.Length - 1);
                                    }

                                    PhotoInfo photoinfo = new PhotoInfo();
                                    photoinfo.Filename      = sPath + sFilename;
                                    photoinfo.Attachment    = Path.GetFileName(filefield1.PostedFile.FileName);
                                    photoinfo.Filesize      = nFileLen;
                                    photoinfo.Title         = sFilename.Remove(sFilename.IndexOf("."), 1);
                                    photoinfo.Description   = "";
                                    photoinfo.Albumid       = Utils.StrToInt(albums.SelectedValue, 0);
                                    photoinfo.Userid        = userid;
                                    photoinfo.Username      = username;
                                    photoinfo.Views         = 0;
                                    photoinfo.Commentstatus = 0;
                                    photoinfo.Tagstatus     = 0;
                                    photoinfo.Comments      = 0;
                                    photoinfo.IsAttachment  = 1;
                                    Space.Data.DbProvider.GetInstance().AddSpacePhoto(photoinfo);
                                    AlbumInfo albumInfo = apb.GetAlbumInfo(Utils.StrToInt((albums.SelectedValue), 0));
                                    albumInfo.Imgcount = Space.Data.DbProvider.GetInstance().GetSpacePhotoCountByAlbumId(Utils.StrToInt(albums.SelectedValue, 0));
                                    Space.Data.DbProvider.GetInstance().SaveSpaceAlbum(albumInfo);

                                    //当支持FTP上传附件时,使用FTP上传远程附件,并在上传完成之后删除本地tempfilename文件
                                    if (FTPs.GetSpaceAttachInfo.Allowupload == 1)
                                    {
                                        FTPs ftps = new FTPs();
                                        relativeFilePath = relativeFilePath.Replace(FTPs.GetSpaceAttachInfo.Remoteurl, "");
                                        ftps.UpLoadFile(relativeFilePath, sSavePath + sFilename, FTPs.FTPUploadEnum.SpaceAttach);
                                        ftps = new FTPs();
                                        ftps.UpLoadFile(relativeFilePath, (sSavePath + sFilename).Replace(extension, "_thumbnail" + extension), FTPs.FTPUploadEnum.SpaceAttach);
                                        ftps = new FTPs();
                                        ftps.UpLoadFile(relativeFilePath, (sSavePath + sFilename).Replace(extension, "_square" + extension), FTPs.FTPUploadEnum.SpaceAttach);
                                    }
                                }
                            }
                            else
                            {
                                int maxspacesize = UserGroups.GetUserGroupInfo(_userinfo.Groupid).Maxspaceattachsize;
                                int currentspaceattachmentsize = Space.Data.DbProvider.GetInstance().GetSpaceAttachmentSizeByUserid(userid);
                                if ((maxspacesize - currentspaceattachmentsize - nFileLen) <= 0)  //个人空间的存储空间不足
                                {
                                    HttpContext.Current.Response.Write("<script>alert('" + config.Spacename + "存储空间不足, 上传失败!');</script>");
                                    HttpContext.Current.Response.End();
                                    return("");
                                }
                                else
                                {
                                    FileStream newFile = new FileStream(sSavePath + sFilename, FileMode.Create);
                                    newFile.Write(myData, 0, myData.Length);
                                    newFile.Close();
                                }

                                //当支持FTP上传附件时,使用FTP上传远程附件,并在上传完成之后删除本地tempfilename文件
                                if (FTPs.GetSpaceAttachInfo.Allowupload == 1)
                                {
                                    FTPs ftps = new FTPs();
                                    ftps.UpLoadFile(relativeFilePath.Replace(FTPs.GetSpaceAttachInfo.Remoteurl, ""), sSavePath + sFilename, FTPs.FTPUploadEnum.SpaceAttach);
                                }
                            }

                            InsertSapceAttachment(relativeFilePath + sFilename, myFile.ContentType, myData.Length, Path.GetFileName(myFile.FileName).ToLower());

                            return(sFilename);
                        }
                        catch (ArgumentException errArgument)
                        {
                            File.Delete(sSavePath + sFilename);
                            HttpContext.Current.Response.Write("<script>alert('" + errArgument.Message + "!');</script>");
                            HttpContext.Current.Response.End();
                            return("");
                        }
                    }
                    else //其它类型文件
                    {
                        int maxspacesize = UserGroups.GetUserGroupInfo(_userinfo.Groupid).Maxspaceattachsize;
                        int currentspaceattachmentsize = Space.Data.DbProvider.GetInstance().GetSpaceAttachmentSizeByUserid(userid);
                        if ((maxspacesize - currentspaceattachmentsize - nFileLen) <= 0)  //个人空间的存储空间不足
                        {
                            HttpContext.Current.Response.Write("<script>alert('" + config.Spacename + "存储空间不足, 上传失败!');</script>");
                            HttpContext.Current.Response.End();
                            return("");
                        }
                        else
                        {
                            try
                            {
                                myFile.SaveAs(sSavePath + sFilename);
                                InsertSapceAttachment(relativeFilePath + sFilename, myFile.ContentType, myData.Length, Path.GetFileName(myFile.FileName).ToLower());

                                //当支持FTP上传附件时,使用FTP上传远程附件,并在上传完成之后删除本地tempfilename文件
                                if (FTPs.GetSpaceAttachInfo.Allowupload == 1)
                                {
                                    FTPs ftps = new FTPs();
                                    ftps.UpLoadFile(relativeFilePath.Replace(FTPs.GetSpaceAttachInfo.Remoteurl, ""), sSavePath + sFilename, FTPs.FTPUploadEnum.SpaceAttach);
                                }
                                return(sFilename);
                            }
                            catch (ArgumentException errArgument)
                            {
                                File.Delete(sSavePath + sFilename);
                                HttpContext.Current.Response.Write("<script>alert('" + errArgument.Message + "!');</script>");
                                HttpContext.Current.Response.End();
                                return("");
                            }
                        }
                    }
                }
                else //当上传的附件类型无效时
                {
                    return("invalid_file");
                }
            }
            return("");
        }