Exemplo n.º 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>");
 }
Exemplo n.º 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
        }
Exemplo n.º 3
0
 public DataTable GetSpaceTopComments(int topNumber)
 {
     if (SpacePluginProvider.GetInstance() == null)
     {
         return(new DataTable());
     }
     return(SpacePluginProvider.GetInstance().GetWebSiteAggSpaceTopComments(topNumber));
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         usergrouppowersetting.Bind();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 返回指定页数日志列表
        /// </summary>
        /// <param name="pageSize">每页的记录数</param>
        /// <param name="currentPage">当前页号</param>
        /// <returns></returns>
        public DataTable SpacePostsList(int pageSize, int currentPage)
        {
            DataTable dt = SpacePluginProvider.GetInstance().GetWebSiteAggSpacePostsList(pageSize, currentPage);

            foreach (DataRow dr in dt.Rows)
            {
                dr["content"] = Utils.RemoveHtml(dr["content"].ToString());
            }
            return(dt);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     haveAlbum = AlbumPluginProvider.GetInstance() != null;
     haveSpace = SpacePluginProvider.GetInstance() != null;
     haveMall  = MallPluginProvider.GetInstance() != null;
     if (!Page.IsPostBack)
     {
         LoadConfigInfo();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 获取空间热门标签
        /// </summary>
        private void GetSpaceHotTags()
        {
            string filename = Utils.GetMapPath(BaseConfigs.GetForumPath + SpacePluginProvider.GetInstance().SpaceHotTagJSONPCacheFileName);

            if (!File.Exists(filename))
            {
                SpacePluginProvider.GetInstance().WriteHotTagsListForSpaceJSONPCacheFile(60);
            }

            WriteFile(filename);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 检查Rewritename是否存在
        /// </summary>
        private void CheckRewriteName()
        {
            //if (userid == -1) return;

            System.Text.StringBuilder xmlnode = new System.Text.StringBuilder();

            xmlnode.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            xmlnode.Append("<result>");
            xmlnode.Append(SpacePluginProvider.GetInstance().CheckSpaceRewriteNameAvailable(DNTRequest.GetString("rewritename").Trim()).ToString());
            xmlnode.Append("</result>");
            ResponseXML(xmlnode);
        }
        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
        }
Exemplo n.º 10
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)");
     }
 }
Exemplo n.º 11
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));
         }
     }
 }
Exemplo n.º 12
0
        public DataTable GetRecentUpdateSpaceList(int count)
        {
            var       cacheService = DNTCache.Current;
            DataTable dataTable    = cacheService.RetrieveObject("/Space/RecentUpdateSpaceAggregationList") as DataTable;

            if (dataTable == null)
            {
                dataTable = SpacePluginProvider.GetInstance().GetWebSiteAggRecentUpdateSpaceList(count);
                cacheService.AddObject("/Space/RecentUpdateSpaceAggregationList", dataTable, AggregationConfigInfo.Current.RecentUpdateSpaceAggregationListTimeout * 60);
            }
            cacheService.LoadDefaultCacheStrategy();
            return(dataTable);
        }
Exemplo n.º 13
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
        }
Exemplo n.º 14
0
        /// <summary>
        /// 得到相关TOP的空间列表
        /// </summary>
        /// <param name="orderby">排序字段</param>
        /// <param name="topnumber">返回的记录数</param>
        /// <returns></returns>
        public DataTable GetTopSpaceList(string orderBy, int topNumber)
        {
            DataTable __topSpaceList = SpacePluginProvider.GetInstance().GetWebSiteAggTopSpaceList(orderBy, topNumber);

            __topSpaceList.Columns.Add("postid", typeof(String));
            __topSpaceList.Columns.Add("posttitle", typeof(String));
            foreach (DataRow dr in __topSpaceList.Rows)
            {
                string[] postinfo = SpacePluginProvider.GetInstance().GetSpaceLastPostInfo(int.Parse(dr["userid"].ToString()));
                dr["postid"]    = postinfo[0];
                dr["posttitle"] = Utils.RemoveHtml(postinfo[1].ToString());
            }
            return(__topSpaceList);
        }
Exemplo n.º 15
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
        }
Exemplo n.º 16
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);
     }
 }
Exemplo n.º 17
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);
         }
     }
 }
Exemplo n.º 18
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();
 }
Exemplo n.º 19
0
        /// <summary>
        /// 得到最近更新的空间列表
        /// </summary>
        /// <param name="count">返回的记录数</param>
        /// <returns></returns>
        public DataTable GetRecentUpdateSpaceList(int count)
        {
            DNTCache cache = DNTCache.GetCacheService();

            //声明新的缓存策略接口
            //Discuz.Cache.ICacheStrategy ics = new AggregationCacheStrategy();
            //ics.TimeOut = AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListTimeout * 60;
            //cache.LoadCacheStrategy(ics);

            DataTable __recentUpdateSpaceList = cache.RetrieveObject("/Space/RecentUpdateSpaceAggregationList") as DataTable;

            if (__recentUpdateSpaceList == null)
            {
                __recentUpdateSpaceList = SpacePluginProvider.GetInstance().GetWebSiteAggRecentUpdateSpaceList(count);
                cache.AddObject("/Space/RecentUpdateSpaceAggregationList", __recentUpdateSpaceList, AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListTimeout * 60);
            }
            cache.LoadDefaultCacheStrategy();
            return(__recentUpdateSpaceList);
        }
Exemplo n.º 20
0
        protected void OutPutNewSpacePosts(string template, string alternatingTemplate)
        {
            if (SpacePluginProvider.GetInstance() == null)
            {
                Response.Write("document.write('未安装空间插件');");
                return;
            }

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

            foreach (DataRow dr in Focuses.GetNewSpacePosts(count, cachetime).Rows)
            {
                title = dr["title"].ToString().Trim();
                result.AppendFormat((i % 2 == 0 ? template : alternatingTemplate), "", (length == -1 ? title : Utils.GetUnicodeSubString(title, length, "")), "", "", title, "", spacerooturl + "?uid=" + dr["uid"].ToString(), spacerooturl + "viewspacepost.aspx?postid=" + dr["postid"].ToString());
                i++;
            }
            Response.Write("document.write('" + result.ToString().Replace("'", "\\'") + "');");
        }
Exemplo n.º 21
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));
        }
Exemplo n.º 22
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);
         }
     }
 }
Exemplo n.º 23
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>");
         }
     }
 }
Exemplo n.º 24
0
        protected void OutPutRecommendedSpaces(string template, string alternatingTemplate)
        {
            if (SpacePluginProvider.GetInstance() == null)
            {
                Response.Write("document.write('未安装空间插件');");
                return;
            }

            StringBuilder result = new StringBuilder();
            int           i      = 0;

            foreach (SpaceConfigInfoExt space in AggregationFacade.SpaceAggregation.GetSpaceListFromFile("Website"))
            {
                if (i >= count)
                {
                    break;
                }
                result.AppendFormat((i % 2 == 0 ? template : alternatingTemplate), "", (length == -1 ? space.Spacetitle : Utils.GetUnicodeSubString(space.Spacetitle, length, "")), "", "", space.Spacetitle, string.Empty, spacerooturl + "?uid=" + space.Userid.ToString());
                i++;
            }
            Response.Write("document.write('" + result.ToString().Replace("'", "\\'") + "');");
        }
Exemplo n.º 25
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>");
     }
 }
Exemplo n.º 26
0
        public static DataTable GetNewSpacePosts(int count, int cachetime)
        {
            //防止恶意行为
            if (cachetime == 0)
            {
                cachetime = 1;
            }

            if (count > 50)
            {
                count = 50;
            }

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

            string cacheKey = "/Space/NewSpacePosts-" + count.ToString();

            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject(cacheKey) as DataTable;

            if (dt == null)
            {
                dt = SpacePluginProvider.GetInstance().GetWebSiteAggSpacePostList(count);

                //声明新的缓存策略接口
                //Discuz.Cache.ICacheStrategy ics = new ForumCacheStrategy();
                //ics.TimeOut = cachetime * 60;
                //cache.LoadCacheStrategy(ics);
                cache.AddObject(cacheKey, dt, cachetime * 60);
                //cache.LoadDefaultCacheStrategy();
            }
            return(dt);
        }
Exemplo n.º 27
0
        protected void OutPutRecommendedSpacePosts(string template, string alternatingTemplate)
        {
            if (SpacePluginProvider.GetInstance() == null)
            {
                Response.Write("document.write('未安装空间插件');");
                return;
            }

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

            foreach (SpaceShortPostInfo post in AggregationFacade.SpaceAggregation.GetSpacePostList("Website"))
            {
                if (i > count)
                {
                    break;
                }
                title = post.Title;
                result.AppendFormat((i % 2 == 0 ? template : alternatingTemplate), "", (length == -1 ? title : Utils.GetUnicodeSubString(title, length, "")), "", "", title, "", spacerooturl + "?uid=" + post.Uid, spacerooturl + "viewspacepost.aspx?postid=" + post.Postid);
                i++;
            }
            Response.Write("document.write('" + result.ToString().Replace("'", "\\'") + "');");
        }
Exemplo n.º 28
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);
            }
        }
Exemplo n.º 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
        }
Exemplo n.º 30
0
 /// <summary>
 /// 空间日志标签缓存文件
 /// </summary>
 private void GetSpacePostTags()
 {
     SpacePluginProvider.GetInstance().GetSpacePostTagsCacheFile(DNTRequest.GetInt("postid", 0));
 }