using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Spaces;
using Spaces.Controls;
public partial class Manage_SiteSecurity : ManagePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            BindPage();
    }
    void BindPage()
    { 
        SiteSettings sets=Globals.GetSiteSettings();
        chkEnableVC.Checked = sets.EnableVerifyCode;
        chkTrackBack.Checked = sets.DisabledTrackBack ? false : true;
        txtDayIpCount.Text = sets.DayRegIPCount.ToString();
        foreach (ListItem l in dropDownloadLimit.Items)
        {
            l.Selected = false;
            if (l.Value == string.Format("{0}", (int)sets.DownloadLimitType))
                l.Selected = true;
        }
    }
    protected void buttonUpdate_Click(object sender, EventArgs e)
    {
        SiteSettings sets = Globals.GetSiteSettings();
        sets.EnableVerifyCode = chkEnableVC.Checked;
        sets.DisabledTrackBack = chkTrackBack.Checked ? false : true;
        try
        {
            sets.DayRegIPCount = int.Parse(txtDayIpCount.Text.Trim());
        }
        catch { sets.DayRegIPCount = 0; };
        sets.DownloadLimitType = (DownloadLimitType)int.Parse(dropDownloadLimit.SelectedValue);
        sets.Save();
        Message.Text = Msg.GetMsg("成功修改安全设置！");
    }
}
