private void ComUsergroup_Click(object sender, EventArgs e)
        {
            #region 合并用户组
            if (this.CheckCookie())
            {
                if ((sourceusergroup.SelectedIndex == 0) || (targetusergroup.SelectedIndex == 0))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的用户组!');</script>");
                    return;
                }

                if (sourceusergroup.SelectedValue == targetusergroup.SelectedValue)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,同一个用户组不能够合并!');</script>");
                    return;
                }

                if (UserGroups.GetUserGroupInfo(int.Parse(sourceusergroup.SelectedValue)).Creditslower !=
                    UserGroups.GetUserGroupInfo(int.Parse(targetusergroup.SelectedValue)).Creditshigher)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,要合并的用户组必须是积分相连的两个用户组!');</script>");
                    return;
                }

                //合并用户积分上下限
                UserGroupInfo userGroupInfo = UserGroups.GetUserGroupInfo(int.Parse(targetusergroup.SelectedValue));
                userGroupInfo.Creditshigher = UserGroups.GetUserGroupInfo(int.Parse(sourceusergroup.SelectedValue)).Creditshigher;
                UserGroups.UpdateUserGroup(userGroupInfo);
                //UserGroups.CombinationUserGroupScore(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));
                //删除被合并的源用户组
                //DatabaseProvider.GetInstance().DeleteUserGroupInfo(int.Parse(sourceusergroup.SelectedValue));
                UserGroups.DeleteUserGroupInfo(int.Parse(sourceusergroup.SelectedValue));

                //更新用户组中的信息
                //Data.DatabaseProvider.GetInstance().ChangeUsergroup(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));
                UserGroups.ChangeAllUserGroupId(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));

                DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并用户组", "把组ID:" + sourceusergroup.SelectedIndex + " 合并到组ID:" + targetusergroup.SelectedIndex);
                base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';");
            }

            #endregion
        }
        private void SaveCombinationInfo_Click(object sender, EventArgs e)
        {
            #region 合并论坛版块

            if (this.CheckCookie())
            {
                if (sourceforumid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('请选择相应的源论坛!');</script>");
                    return;
                }

                if (targetforumid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('请选择相应的目标论坛!');</script>");
                    return;
                }

                ForumInfo forumInfo = Forums.GetForumInfo(Utils.StrToInt(targetforumid.SelectedValue, 0));
                if (forumInfo != null && forumInfo.Parentid == 0 && forumInfo.Layer == 0)
                {
                    base.RegisterStartupScript("", "<script>alert('您所选择的目标论坛是\"论坛分类\"而不是\"论坛版块\",因此合并无效!');</script>");
                    return;
                }

                string result;
                if (!AdminForums.CombinationForums(sourceforumid.SelectedValue, targetforumid.SelectedValue))
                {
                    result = "<script>alert('当前节点下面有子结点,因此合并无效!');window.location.href='forum_forumcombination.aspx';</script>";
                    base.RegisterStartupScript("", result);
                    return;
                }
                else
                {
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并论坛版块", "合并论坛版块" + sourceforumid.SelectedValue + "到" + targetforumid.SelectedValue);

                    base.RegisterStartupScript("PAGE", "window.location.href='forum_forumstree.aspx';");
                    return;
                }
            }

            #endregion
        }
        private void AddAnnounceInfo_Click(object sender, EventArgs e)
        {
            #region 添加公告

            if (this.CheckCookie())
            {
                DatabaseProvider.GetInstance().AddAnnouncement(this.username, this.userid, tbtitle.Text, Utils.StrToInt(displayorder.Text, 0), starttime.Text, endtime.Text, message.Text);

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList");

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList");

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加公告", "添加公告,标题为:" + tbtitle.Text);

                base.RegisterStartupScript("PAGE", "window.location.href='global_announcegrid.aspx';");
            }

            #endregion
        }
Example #4
0
        private void Available_Click(object sender, EventArgs e)
        {
            #region 将选取的勋章设置为无效

            if (DNTRequest.GetString("medalid") != "")
            {
                DatabaseProvider.GetInstance().SetAvailableForMedal(1, DNTRequest.GetString("medalid"));

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/MedalsList");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "勋章文件为有效", "ID:" + DNTRequest.GetString("medalid").Replace("0 ", ""));
                Response.Redirect("global_medalgrid.aspx");
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='global_medalgrid.aspx';</script>");
            }

            #endregion
        }
        private void ComAdminUsergroup_Click(object sender, EventArgs e)
        {
            #region 合并管理组

            if (this.CheckCookie())
            {
                if ((sourceadminusergroup.SelectedIndex == 0) || (targetadminusergroup.SelectedIndex == 0))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的管理组!');</script>");
                    return;
                }

                if ((Convert.ToInt32(sourceadminusergroup.SelectedValue) <= 3) || (Convert.ToInt32(sourceadminusergroup.SelectedValue) <= 3))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,您选择的组为系统初始化的管理组,这些组不允许合并!');</script>");
                    return;
                }

                if (sourceadminusergroup.SelectedValue == targetadminusergroup.SelectedValue)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,同一个管理组不能够合并!');</script>");
                    return;
                }

                //删除被合并的源用户组
                DatabaseProvider.GetInstance().DeleteAdminGroupInfo(int.Parse(sourceadminusergroup.SelectedValue));

                //删除被合并的源用户组
                DatabaseProvider.GetInstance().DeleteUserGroupInfo(int.Parse(sourceadminusergroup.SelectedValue));

                //更新用户组中的信息
                DatabaseProvider.GetInstance().UpdateAdminUsergroup(targetadminusergroup.SelectedValue.ToString(), sourceadminusergroup.SelectedValue.ToString());
                DatabaseProvider.GetInstance().ChangeUsergroup(int.Parse(sourceadminusergroup.SelectedValue), int.Parse(targetadminusergroup.SelectedValue));

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并管理组", "把组ID:" + sourceusergroup.SelectedIndex + " 合并到组ID:" + targetusergroup.SelectedIndex);
                base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
            }

            #endregion
        }
Example #6
0
        private void DeleteAnnounce_Click(object sender, EventArgs e)
        {
            #region  除公告

            if (this.CheckCookie())
            {
                DatabaseProvider.GetInstance().DeleteAnnouncement(DNTRequest.GetInt("id", 0));
                //移除公告缓存
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList");

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList");

                //记录日志
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除公告", "删除公告,标题为:" + tbtitle.Text);

                base.RegisterStartupScript("PAGE", "window.location.href='global_announcegrid.aspx';");
            }

            #endregion
        }
        private void DelRec_Click(object sender, EventArgs e)
        {
            #region  除选定的友情链接
            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("delid") != "")
                {
                    DatabaseProvider.GetInstance().DeleteForumLink(DNTRequest.GetString("delid"));
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList");
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除友情链接", "删除友情链接,ID为: " + DNTRequest.GetString("id").Replace("0 ", ""));
                    Response.Redirect("global_forumlinksgrid.aspx");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='global_forumlinksgrid.aspx';</script>");
                }
            }

            #endregion
        }
        private void AddIdentifyInfo_Click(object sender, EventArgs e)
        {
            #region 添加鉴定记录

            if (this.CheckCookie())
            {
                if (uploadfile.FileName.Trim() == "" || uploadfilesmall.FileName.Trim() == "")
                {
                    base.RegisterStartupScript("PAGE", "alert('没有选择鉴定图片');window.location.href='forum_addidentify.aspx';");
                    return;
                }
                string fileName      = uploadfile.UpdateFile();
                string fileNameSmall = uploadfilesmall.UpdateFile();
                if (fileName.Trim() == "")
                {
                    base.RegisterStartupScript("PAGE", "alert('没有选择鉴定大图片');window.location.href='forum_addidentify.aspx';");
                    return;
                }
                if (fileNameSmall.Trim() == "")
                {
                    base.RegisterStartupScript("PAGE", "alert('没有选择鉴定小图片');window.location.href='forum_addidentify.aspx';");
                    return;
                }
                if (Identifys.AddIdentify(name.Text, fileName))
                {
                    string[] fileNameArray    = fileName.Split('.');
                    string   newFileNameSmall = string.Format("{0}_small.{1}", fileNameArray[0], fileNameArray[1]);
                    Directory.Move(Server.MapPath("../../images/identify/") + fileNameSmall, Server.MapPath("../../images/identify/") + newFileNameSmall);
                    DNTCache.GetCacheService().RemoveObject("/Forum/TopicIdentifys");
                    DNTCache.GetCacheService().RemoveObject("/Forum/TopicIndentifysJsArray");
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件添加", name.Text);
                    base.RegisterStartupScript("PAGE", "window.location.href='forum_identifymanage.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("PAGE", "alert('插入失败,可能名称与原有的相同');window.location.href='forum_identifymanage.aspx';");
                }
            }

            #endregion
        }
Example #9
0
        private void DeleteAll_Click(object sender, EventArgs e)
        {
            #region 直接全部删除

            if (this.CheckCookie())
            {
                DataTable dt  = Attachments.GetAttachList(ViewState["condition"].ToString(), Posts.GetPostTableName());
                string    aid = "0";
                foreach (DataRow dr in dt.Rows)
                {
                    DeleteFile(dr["filename"].ToString());
                    aid += "," + dr["aid"].ToString();
                }
                Attachments.DeleteAttachment(aid);

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件", "ID:" + aid);
                base.RegisterStartupScript("PAGE", "window.location.href='forum_searchattchment.aspx';");
            }

            #endregion
        }
Example #10
0
        private void AddNewRec_Click(object sender, EventArgs e)
        {
            #region 添加过滤词

            if (find.Text == "")
            {
                base.RegisterStartupScript("", "<script>alert('要添加的过滤内容不能为空');window.location.href='global_wordgrid.aspx';</script>");
                return;
            }

            if (replacement.Text == "")
            {
                base.RegisterStartupScript("", "<script>alert('要添加的替换内容不能为空');window.location.href='global_wordgrid.aspx';</script>");
                return;
            }

            if (BanWords.IsExistBanWord(find.Text))
            {
                base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的过滤内容');window.location.href='global_wordgrid.aspx';</script>");
                return;
            }


            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "加入字符过滤", "字符为:" + find.Text);

            try
            {
                BanWords.CreateBanWord(username, find.Text, replacement.Text);
                BindData();
                base.RegisterStartupScript("PAGE", "window.location.href='global_wordgrid.aspx';");
                return;
            }
            catch
            {
                base.RegisterStartupScript("", "<script>alert('无法更新数据库.');window.location.href='global_wordgrid.aspx';</script>");
                return;
            }

            #endregion
        }
        private void DelRec_Click(object sender, EventArgs e)
        {
            #region  除指定条件的日志信息

            if (this.CheckCookie())
            {
                string condition = "";

                condition = AdminVistLogs.DelVisitLogCondition(Request.Form["deleteMode"].ToString(), DNTRequest.GetString("visitid").ToString(), deleteNum.Text, deleteFrom.SelectedDate.ToString());
                if (condition != "")
                {
                    AdminVistLogs.DeleteLog(condition);
                    Response.Redirect("forum_adminvisitloggrid.aspx");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项或输入参数错误!');window.location.href='forum_adminvisitloggrid.aspx';</script>");
                }
            }

            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }

            #region 插入相关友情链接记录

            if ((DNTRequest.GetString("displayorder").Trim() != "") && (DNTRequest.GetString("name").Trim() != ""))
            {
                Regex r = new Regex("(http|https)://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?");
                if (!r.IsMatch(DNTRequest.GetString("url").Replace("'", "''")))
                {
                    base.RegisterStartupScript("", "<script>alert('链接地址或LOGO不是有效的网页地址.');</script>");
                    return;
                }

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加友情链接", "添加友情链接,名称为: " + DNTRequest.GetString("name"));

                try
                {
                    DatabaseProvider.GetInstance().AddForumLink(DNTRequest.GetInt("displayorder", 0),
                                                                DNTRequest.GetString("name"),
                                                                DNTRequest.GetString("url"),
                                                                DNTRequest.GetString("note"),
                                                                DNTRequest.GetString("logo"));
                    BindData();
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList");
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新数据库');window.location.href='global_forumlinksgrid.aspx';</script>");
                    return;
                }
            }

            #endregion
        }
        private void DeleteAll_Click(object sender, EventArgs e)
        {
            #region 直接全部删除

            if (this.CheckCookie())
            {
                DataTable dt  = GetAttachDataTable();
                string    aid = "0";
                foreach (DataRow dr in dt.Rows)
                {
                    DeleteFile(dr["filename"].ToString());
                    aid += "," + dr["aid"].ToString();
                }
                //DbHelper.ExecuteNonQuery("DELETE FROM [" + BaseConfigs.GetTablePrefix + "attachments] WHERE [aid] IN(" + aid + ")");
                DatabaseProvider.GetInstance().DeleteAttachment(aid);

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件", "ID:" + aid);
                base.RegisterStartupScript("PAGE", "window.location.href='forum_searchattchment.aspx';");
            }

            #endregion
        }
Example #14
0
        private void DeleteUser_Click(object sender, EventArgs e)
        {
            #region  除相关用户

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

                    foreach (string uid in DNTRequest.GetString("uid").Split(','))
                    {
                        if (uid != "")
                        {
                            if (CheckSponser(Convert.ToInt32(uid)))
                            {
                                if (Convert.ToInt32(uid) > 1) //判断是不是当前UID是不是系统初始化时生成的UID
                                {
                                    int deluserid = Convert.ToInt32(uid);
                                    if (AdminUsers.DelUserAllInf(deluserid, delpost, delpms))
                                    {
                                        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
        }