Exemplo n.º 1
0
        private void SaveToConfigFile()
        {
            SiteConfigInfo si = SiteConfigs.GetConfig();

            if (!string.IsNullOrEmpty(SEUrlTextBox.Text))
            {
                si.FullTextSearchUrl = SEUrlTextBox.Text;
                SiteConfigs.SaveConfig(si);
            }

            string url = "tcp://localhost:11001";

            if (!string.IsNullOrEmpty(si.FullTextSearchUrl))
            {
                url = si.FullTextSearchUrl;
            }

            ISearchService searcher = Activator.GetObject(typeof(ISearchService), url + "/SearchService") as ISearchService;

            if (searcher != null)
            {
                SiteInfo site = new SiteInfo(si.SiteID, si.SiteName, si.RootUrl);
                searcher.RegisterSite(site);
                Messages.ShowMessage("站点已成功注册到搜索服务器!");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构建按类型/状态过滤的超级链接字符串
        /// </summary>
        /// <returns></returns>
        string BuildStateLinks()
        {
            string links = @"<li> <a href='Roles.aspx'   {0} >全部<span class=""count"">({1})</span></a> |</li>
            <li><a href='Roles.aspx?state=0'  {2} >管理员角色<span class=""count"">({3})</span></a> |</li>
            <li><a href='Roles.aspx?state=1'  {4} >普通用户角色<span class=""count"">({5})</span></a> </li>";

            string siteID = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;
            string css100, css0, css1, css2;

            css100 = css0 = css1 = css2 = "";
            if (CurrentState == OwnerRank.All)
            {
                css100 = "class=\"current\"";
            }
            if (CurrentState == OwnerRank.Admin)
            {
                css0 = "class=\"current\"";
            }
            if (CurrentState == OwnerRank.Normal)
            {
                css1 = "class=\"current\"";
            }
            links = string.Format(links, css100, AccountHelper.GetRoleCount(siteID, OwnerRank.All),
                                  css0, AccountHelper.GetRoleCount(siteID, OwnerRank.Admin), css1, AccountHelper.GetRoleCount(siteID, OwnerRank.Normal));

            return(links);
        }
Exemplo n.º 3
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            if (Request.Cookies["CheckCode"] == null)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统。');</script>");
                return;
            }

            if (String.Compare(Request.Cookies["CheckCode"].Value, VerifyCodeTextBox.Text.ToString().Trim(), true) != 0)
            {
                VerifyCodeTextBox.Text = "";
                VerifyCodeTextBox.Focus();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('对不起,验证码错误!');</script>");
                return;
            }
            SiteConfigInfo si = SiteConfigs.GetConfig();

            if (si != null && AdminPasswordIsValid(PasswordTextBox.Text, si))
            {
                System.Web.Security.FormsAuthentication.SetAuthCookie("administrator", true);
                Response.Redirect(ReturnURL);
            }
            else
            {
                PasswordTextBox.Focus();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('对不起,密码错误!');</script>");
            }
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         BaseConfigInfo bci = BaseConfigs.GetBaseConfig();
         if (bci != null)
         {
             DatabaseInfo dbi = new DatabaseInfo();
             dbi = Installer.GetDatabaseInfo(bci);
             ServerTextBox.Text     = dbi.Server;
             DatabaseTextBox.Text   = dbi.Database;
             UserTextBox.Text       = dbi.User;
             PasswordTextBox.Text   = dbi.Password;
             DBFileNameTextBox.Text = dbi.DBFile;
             if (DBFileNameTextBox.Text.IndexOf("\\") >= 0)
             {
                 DBFileNameTextBox.Text = DBFileNameTextBox.Text.Substring(DBFileNameTextBox.Text.LastIndexOf("\\") + 1);
             }
             SelectDB = bci.DBType;
             CreateNewDBCheckBox.Checked = false;
             if (!CheckWebConfig())
             {
                 msg.Visible = true;
             }
             SiteConfigInfo sci = SiteConfigs.GetConfig();
             if (sci != null)
             {
                 WebsiteNameTextBox.Text = sci.SiteName;
                 AdminNameTextBox.Text   = sci.AdministratorName;
             }
         }
     }
 }
Exemplo n.º 5
0
        // Token: 0x06000264 RID: 612 RVA: 0x00007EE0 File Offset: 0x000060E0
        public static bool CreateSite(string sitepath, out string errormsg)
        {
            errormsg = "";
            string pattern = "^[a-zA-Z0-9_\\w]+$";
            bool   result;

            if (!Regex.IsMatch(sitepath, pattern, RegexOptions.IgnoreCase))
            {
                errormsg = "模板路径只能由数字、字母、下划线组成,并且首字不能为数字。";
                result   = false;
            }
            else
            {
                string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + sitepath);
                if (!Directory.Exists(mapPath))
                {
                    errormsg = "错误:该站点“" + sitepath + "”已被删除或不存在。";
                    result   = false;
                }
                else
                {
                    string     mapPath2 = FPUtils.GetMapPath(WebConfig.WebPath + sitepath);
                    SiteConfig siteInfo = SiteConfigs.GetSiteInfo(sitepath);
                    SiteBll.CreateViewFile(siteInfo, sitepath);
                    siteInfo.iscompile = 1;
                    SiteConfigs.SaveConfig(siteInfo, mapPath2 + "\\site.config");
                    result = true;
                }
            }
            return(result);
        }
Exemplo n.º 6
0
 public bool UpdateBookDetails(Book bookDetails)
 {
     try
     {
         using (IDbConnection db = new SqlConnection(SiteConfigs.GetDBConnectionString()))
         {
             string sql   = @"
                                 UPDATE dbo.Books
                                 SET                                            
                                     dbo.Books.Title = @title, 
                                     dbo.Books.Author = @author,
                                     dbo.Books.Description = @description,
                                     dbo.Books.Publisher = @publisher,
                                     dbo.Books.PublishedYear = @publishedYear,
                                     dbo.Books.Price = @price
                                 WHERE dbo.Books.ID = @id
                           ";
             int    count = db.Execute(sql, param: new
             {
                 id            = bookDetails.ID,
                 title         = bookDetails.Title,
                 author        = bookDetails.Author,
                 description   = bookDetails.Description,
                 publisher     = bookDetails.Publisher,
                 publishedYear = bookDetails.PublishedYear,
                 price         = bookDetails.Price
             });
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 7
0
        protected void Initialize()
        {
            string siteID = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;

            personalForm.DataSource = AccountHelper.GetRoles(siteID, RoleType, string.Empty);
            personalForm.DataBind();

            //AccountRole[] ars = AccountHelper.GetAccountRoles(CurrentAccountID);
            List <string> ars = AccountHelper.GetRolesOfAccount(CurrentAccountID);

            if (ars != null)
            {
                foreach (string ar in ars)
                {
                    if (ValuesTextBox.Text.Length > 0)
                    {
                        ValuesTextBox.Text += ";";
                    }
                    ValuesTextBox.Text += ar;
                }
            }
            if (!Page.ClientScript.IsStartupScriptRegistered("onload"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "<script type=\"text/javascript\">onBodyLoad();</script>");
            }
        }
Exemplo n.º 8
0
 public Role(string id, string name, string description, string roletype)
 {
     ID         = id; Name = name; Description = description; RoleType = int.Parse(roletype);
     FromSiteID = SiteConfigs.GetConfig().SiteID;
     Created    = DateTime.Now;
     Updated    = DateTime.Now;
 }
Exemplo n.º 9
0
        void LoadRoles()
        {
            string siteID = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;

            RolesGridView.DataSource = AccountHelper.GetRoles(siteID, OwnerRank.All, string.Empty);
            RolesGridView.DataBind();
        }
Exemplo n.º 10
0
        protected void LoadData()
        {
            WDWebService service = new WDWebService();

            service.Url = SiteConfigs.GetConfig().WebGroupServiceUrl;
            WebSite     = service.GetWebSiteTree(SiteID, ShowChildren);
        }
Exemplo n.º 11
0
        List <ViewItem> GetItems( )
        {
            List <ViewItem>   items  = new List <ViewItem>();
            List <Department> dts    = null;
            List <Account>    acts   = null;
            string            siteID = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;

            if (CurrentState == OwnerRank.All)
            {
                dts = AccountHelper.GetDepartments(siteID, DepartmentID, Keyword, new string[] { "ID", "Name", "Description", "State" });
            }


            if (dts != null)
            {
                foreach (Department dt in dts)
                {
                    ViewItem vi = new ViewItem();
                    vi.Text      = dt.Name;
                    vi.Summary   = dt.Description;
                    vi.Mode      = "Department";
                    vi.ID        = dt.ID;
                    vi.Url       = String.Format("Departments.aspx?id={0}", dt.ID);
                    vi.DeleteUrl = String.Format("javascript:DeleteConfirm('{0}','{1}','Department');", dt.ID, dt.Name);
                    vi.EditUrl   = String.Format("DepartmentDetail.aspx?id={0}", dt.ID);
                    items.Add(vi);
                }
            }

            return(items);
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!checkLicense())
            {
                ShowMessage("您的系统授权已经过期,请及时联系客服!");
                return;
            }
            if (!Page.IsPostBack)
            {
                GeneralConfigInfo gi = GeneralConfigs.GetConfig();
                if (gi.IsOEM)
                {
                    CopyrightLiteral.Text = gi.Copyright;
                }
                else
                {
                    CopyrightLiteral.Text = gi.CopyrightOfWe7;
                }
                SiteConfigInfo si = SiteConfigs.GetConfig();
                if (si == null)
                {
                    Response.Write("对不起,您的系统已经升级,但配置文件尚未升级,您需要对配置数据进行升级。现在升级吗?<a href='../install/upgradeconfig.aspx'><u>现在升级</u></a>");
                    Response.End();
                }
                else
                {
#if DEBUG
                    LoginNameTextBox.Text = si.AdministratorName;
#endif
                    GenerateRandomCode();
                }
            }
        }
Exemplo n.º 13
0
        public string GetCurLayerNOAdviceText(string id)
        {
            Criteria      c = new Criteria(CriteriaType.Equals, "ID", id);
            List <Advice> a = Assistant.List <Advice>(c, null);

            if (a.Count > 0)
            {
                Processing p        = GetAdviceProcess(a[0]);
                string     mysiteID = SiteConfigs.GetConfig().SiteID;

                //是否站群
                bool siteGroup = SiteConfigs.GetConfig().SiteGroupEnabled;
                if (siteGroup)
                {
                    if (p.CurrentSiteID == mysiteID)
                    {
                        return(p.CurLayerNOToAdvice);
                    }
                    else
                    {
                        return(string.Empty);
                    }
                }
                else
                {
                    //直接返回
                    return(p.CurLayerNOToAdvice);
                }
            }
            return(string.Empty);
        }
Exemplo n.º 14
0
        void ShowPanel()
        {
            string sln = SiteConfigs.GetConfig().ShopLoginName;

            if (String.IsNullOrEmpty(sln) || String.IsNullOrEmpty(sln.Trim()))
            {
                Messages.ShowMessage("本站尚未登记We7插件商店帐号!只有登记了We7插件商店帐号,才能在本地站点看到已购买的We7插件。");
                ShowRegistePanl(true);
            }
            else
            {
                try
                {
                    SiteConfigInfo si     = SiteConfigs.GetConfig();
                    string[]       states = ShopService.CheckSite(si.ShopLoginName, si.ShopPassword, si.SiteUrl);
                    if (states != null && states.Length > 0 && states[0] == "1")
                    {
                        ShowRegistePanl(false);
                    }
                    else
                    {
                        Messages.ShowMessage("本站使用的的插件商店帐号有误!请重新登记插件商店帐号!");
                        ShowRegistePanl(true);
                    }
                }
                catch (Exception ex)
                {
                    Messages.ShowError("应用程序错误!错误原因:" + ex.Message);
                    plList.Visible = false;
                    plSN.Visible   = false;
                }
            }
        }
Exemplo n.º 15
0
        void InsertAdviceProcessHistory(Processing newProcess, Advice advice)
        {
            ProcessHistory aph = new ProcessHistory();

            if (newProcess != null)
            {
                aph.ObjectID = newProcess.ObjectID;
                if (string.IsNullOrEmpty(advice.ProcessState))
                {
                    aph.FromProcessState = "-1";
                }
                else
                {
                    aph.FromProcessState = advice.ProcessState;
                }

                aph.ToProcessState   = newProcess.CurLayerNO;
                aph.ProcessDirection = newProcess.ProcessDirection;
                aph.ProcessAccountID = newProcess.ProcessAccountID;
                aph.TargetSites      = newProcess.TargetSites;
                aph.Remark           = newProcess.Remark;
                aph.CreateDate       = DateTime.Now;
                aph.UpdateDate       = DateTime.Now;
                aph.ItemNum          = newProcess.ItemNum + 1;
                aph.ApproveName      = newProcess.ApproveName;
                aph.ApproveTitle     = newProcess.ApproveTitle;
                aph.ChannelID        = advice.TypeID;
                aph.ChannelName      = advice.TypeTitle;
                aph.SiteApiUrl       = SiteConfigs.GetConfig().RootUrl;
                aph.SiteID           = SiteConfigs.GetConfig().SiteID;
                aph.SiteName         = SiteConfigs.GetConfig().SiteName;

                ProcessHistoryHelper.InsertAdviceProcessHistory(aph);
            }
        }
Exemplo n.º 16
0
        void InsertArticleProcessHistory(Processing newProcess, Article article)
        {
            ProcessHistory aph = new ProcessHistory();

            if (newProcess != null)
            {
                aph.ObjectID         = newProcess.ObjectID;
                aph.FromProcessState = article.ProcessState;
                aph.ToProcessState   = newProcess.CurLayerNO;
                aph.ProcessDirection = newProcess.ProcessDirection;
                aph.ProcessAccountID = newProcess.ProcessAccountID;
                aph.TargetSites      = newProcess.TargetSites;
                aph.Remark           = newProcess.Remark;
                aph.CreateDate       = DateTime.Now;
                aph.UpdateDate       = DateTime.Now;
                aph.ItemNum          = newProcess.ItemNum + 1;
                aph.ApproveName      = newProcess.ApproveName;
                aph.ApproveTitle     = newProcess.ApproveTitle;
                aph.ChannelID        = article.OwnerID;
                aph.ChannelName      = article.ChannelName;
                aph.SiteApiUrl       = SiteConfigs.GetConfig().RootUrl;
                aph.SiteID           = SiteConfigs.GetConfig().SiteID;
                aph.SiteName         = SiteConfigs.GetConfig().SiteName;

                ProcessHistoryHelper.InsertArticleProcessHistory(aph, article);
            }
        }
Exemplo n.º 17
0
 public Account GetAuthenticatedAccount()
 {
     if (HttpContext.Current.Request["Authenticator"] != null && HttpContext.Current.Request["accountID"] != null)
     {
         SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current);
         string     actID      = ssoRequest.AccountID;
         if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID))
         {
             Security.SetAccountID(actID);
             return(RemoteHelper.GetAccount(actID, null));
         }
         else
         {
             return(null);
         }
     }
     else if (HttpContext.Current.Request["Authenticator"] == null)
     {
         SSORequest req = new SSORequest();
         req.Action = "authenticate";
         req.SiteID = SiteConfigs.GetConfig().SiteID;
         Authentication.CreateAppToken(req);
         Authentication.Post(req, SiteConfigs.GetConfig().PassportAuthPage);
         return(null);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// 状态转换为描述
        /// </summary>
        /// <param name="layno"></param>
        /// <returns></returns>
        public string GetProcessingText(string layno)
        {
            string site = "";

            if (!string.IsNullOrEmpty(SiteName) && SiteConfigs.GetConfig().SiteGroupEnabled)
            {
                site = "站点[" + SiteName + "]";
            }
            switch (layno)
            {
            case "-1": return(site + "受理中");

            case "-3": return(site + "办理中");

            case "0": return(site + "稿件处理中");

            case "1": return(site + "一审中");

            case "2": return(site + "二审中");

            case "3": return(site + "三审中");

            default: return(site + "稿件处理中");
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 部门-数据赋值
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="list"></param>
        void DepartmentDataToList(DataTable dt, List <PublishCountView> list, out int total, out int total2)
        {
            total = 0; total2 = 0;
            string            siteID      = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;
            List <Department> departments = AccountHelper.GetDepartments(siteID, We7Helper.EmptyGUID, "", new string[] { "FullName", "Name", "ParentID" });

            foreach (Department dep in departments)
            {
                PublishCountView kv = new PublishCountView();
                kv.KeyValue = dep.Name;
                foreach (DataRow dr in dt.Rows)
                {
                    Account acc = AccountHelper.GetAccount(dr["AccountID"].ToString(), new string[] { "ID", "DepartmentID" });
                    if (acc != null)
                    {
                        Department d = AccountHelper.GetDepartment(acc.DepartmentID, new string[] { "FullName", "ID", });
                        if (d != null && d.FullName.ToLower().StartsWith(dep.FullName.ToLower()))
                        {
                            kv.Count  += Int32.Parse(dr["pubcount"].ToString());
                            kv.Clicks += Int32.Parse(dr["clickcount"].ToString());
                        }
                    }
                }

                total  += kv.Count;
                total2 += kv.Clicks;
                list.Add(kv);
            }

            list.Sort(new DinoComparer());
        }
Exemplo n.º 20
0
        public List <Department> GetDepartmentList()
        {
            string            siteID      = SiteConfigs.GetConfig().SiteGroupEnabled ? SiteConfigs.GetConfig().SiteID : string.Empty;
            List <Department> departments = new List <Department>();

            departments = AccountHelper.GetDepartments(siteID, string.Empty, string.Empty, new string[] { "ParentID", "ID", "Name", "FullName" });
            //List<Department> departmentList = new List<Department>();
            //if (departments != null)
            //{
            //    foreach (Department depList in departments)
            //    {
            //        if (depList.FullName != "")
            //        {
            //            int c = depList.FullName.Length - depList.FullName.Replace("/", String.Empty).Length;
            //            for (int i = 0; i < c; i++)
            //            {
            //                depList.Name = "&nbsp;" + "&nbsp;" + "&nbsp;" + depList.Name;
            //            }
            //        }
            //        departmentList.Add(depList);
            //    }
            //}
            //return departmentList;
            return(departments);
        }
Exemplo n.º 21
0
 /// <summary>
 /// 更改商店会员帐号密码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnChange_Click(object sender, EventArgs e)
 {
     SiteInfo.ShopLoginName = "";
     SiteInfo.ShopPassword  = "";
     SiteConfigs.SaveConfig(SiteInfo);
     ShowRegistePanl(true);
 }
Exemplo n.º 22
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string Massage = string.Empty;
            string kw      = context.Request.QueryString["kw"];
            int    i;

            if (int.TryParse(context.Request.QueryString["type"], out i) && !string.IsNullOrEmpty(kw))
            {
                if ((int)validForUserType.ExistCurrentUser == i)
                {
                    if (AccountHelper.ExistUserName(kw))
                    {
                        Massage = "当前用户已存在";
                    }
                    else if (SiteConfigs.GetConfig().AdministratorName.Equals(kw))
                    {
                        Massage = "当前用户名为系统关键字";
                    }
                }
                if ((int)validForUserType.ExistEmail == i)
                {
                    if (AccountHelper.ExistEmail(kw))
                    {
                        Massage = "当前Email已存在";
                    }
                }
            }
            else
            {
                Massage = "Ajax参数不正确,请勿恶意请求!";
            }
            context.Response.Write(Massage);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 输出Xml文件
        /// </summary>
        private void ResponseXml()
        {
            Channel ch = new Channel();

            if (!string.IsNullOrEmpty(ChannelUrl))
            {
                ColoumnID = myChannelHelper.GetChannelIDByFullUrl(ChannelUrl);
            }

            if (!string.IsNullOrEmpty(ColoumnID))
            {
                ch = myChannelHelper.GetChannel(ColoumnID, null);
            }

            List <Article> list    = GetArticles();
            RssChannel     channel = new RssChannel();

            channel.Title         = ch.Name;
            channel.Link          = SiteConfigs.GetConfig().RootUrl + ch.FullUrl;
            channel.Description   = ch.Description;
            channel.Ttl           = PageSize;
            channel.Language      = "zh-cn";
            channel.LastBuildDate = DateTime.Now.ToString("yyyy-MM-dd");
            channel.PubDate       = DateTime.Now.ToString("yyyy-MM-dd");
            SetRssItems(list, channel);

            Response.Write(channel.GetXml().OuterXml);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 获取一个用户
        /// </summary>
        /// <param name="accountID">用户ID</param>
        /// <param name="fields">返回的字段集合</param>
        /// <returns>用户对象</returns>
        public Account GetAccount(string accountID, string[] fields)
        {
            if (accountID == We7Helper.EmptyGUID)
            {
                Account sa = new Account();
                sa.ID        = accountID;
                sa.LastName  = "系统管理员";
                sa.LoginName = SiteConfigs.GetConfig().AdministratorName;
                return(sa);
            }
            else if (!string.IsNullOrEmpty(accountID))
            {
                We7Helper.AssertNotNull(accountID, "GetAccount.accountID");
                Criteria       c   = new Criteria(CriteriaType.Equals, "ID", accountID);
                List <Account> act = Assistant.List <Account>(c, null, 0, 1, fields);
                if (act.Count > 0)
                {
                    return(act[0]);
                }
            }

            Account a = new Account();

            a.ID        = accountID;
            a.LoginName = "";
            a.LastName  = "未知用户";
            return(a);
        }
Exemplo n.º 25
0
 public string[] Login(string name, string password)
 {
     string[] result = { "", "" };
     if (HttpContext.Current.Request["Authenticator"] == null)
     {
         SSORequest req = new SSORequest();
         req.Action   = "signin";
         req.UserName = name;
         req.Password = password;
         req.SiteID   = SiteConfigs.GetConfig().SiteID;
         Authentication.CreateAppToken(req);
         Authentication.Post(req, SiteConfigs.GetConfig().PassportAuthPage);
     }
     //else if (Request["Authenticator"] != null && Request["accountID"] != null)
     //{
     //    SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current);
     //    string actID = ssoRequest.AccountID;
     //    if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID))
     //    {
     //        Security.SetAccountID(actID);
     //        result[0] = "true";
     //        result[1] = actID;
     //    }
     //    else if (Request["message"] != null)
     //    {
     //        result[0] = "false";
     //        result[1] = Request["message"];
     //    }
     //}
     return(result);
 }
Exemplo n.º 26
0
        /// <summary>
        /// 站点是否绑定商城
        /// </summary>
        /// <returns></returns>
        public bool IsSiteBindShop()
        {
            string sln = SiteConfigs.GetConfig().ShopLoginName.Trim();

            if (string.IsNullOrEmpty(sln))
            {
                return(false);
            }

            try
            {
                //帐号检验
                SiteConfigInfo si     = SiteConfigs.GetConfig();
                string[]       states = ShopService.CheckSite(si.ShopLoginName, si.ShopPassword, si.SiteUrl);
                if (states != null && states.Length > 0 && states[0] == "1")
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                We7.Framework.LogHelper.WriteLog(typeof(BasePage), ex);
                return(false);
            }
        }
Exemplo n.º 27
0
        void changePassword(string loginName, string password, string newPassword)
        {
            if (AccountID == We7Helper.EmptyGUID && String.Compare(loginName, SiteConfigs.GetConfig().AdministratorName, true) == 0)
            {
                if (CDHelper.AdminPasswordIsValid(password))
                {
                    SiteConfigInfo si       = SiteConfigs.GetConfig();
                    bool           isHashed = si.IsPasswordHashed;
                    if (isHashed != IsHashedPasswordCheckBox.Checked)
                    {
                        si.IsPasswordHashed = IsHashedPasswordCheckBox.Checked;
                    }
                    if (IsHashedPasswordCheckBox.Checked)
                    {
                        si.AdministratorKey = Security.Encrypt(newPassword);
                    }
                    else
                    {
                        si.AdministratorKey = newPassword;
                    }

                    SiteConfigs.SaveConfig(si);
                    //CDHelper.UpdateSystemInformation(si);

                    ShowMessage("您的密码已修改成功。");
                }
                else
                {
                    ShowMessage("对不起,您输入的旧密码不正确!");
                }
            }
            else
            {
                Account act = AccountHelper.GetAccountByLoginName(loginName);
                if (act == null)
                {
                    ShowMessage("指定的用户不存在。");
                }
                else if (!AccountHelper.IsValidPassword(act, password))
                {
                    ShowMessage("对不起,您输入的旧密码不正确!");
                }
                else if (act.State != 1)
                {
                    ShowMessage("该帐户不可用。");
                }
                else
                {
                    act.IsPasswordHashed = IsHashedPasswordCheckBox.Checked;
                    AccountHelper.UpdatePassword(act, newPassword);

                    //记录日志
                    string content = string.Format("修改了“{0}”的密码", act.LoginName);
                    AddLog("修改密码", content);

                    ShowMessage("您的密码已修改成功。");
                }
            }
        }
Exemplo n.º 28
0
        // Token: 0x0600002D RID: 45 RVA: 0x00004C98 File Offset: 0x00002E98
        protected override void View()
        {
            this.sysconfiginfo = SysConfigs.GetConfig();
            this.sitelist      = SiteBll.GetSiteList();
            Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");

            if (configuration.AppSettings.Settings["sitepath"] != null)
            {
                this.mainsite = configuration.AppSettings.Settings["sitepath"].Value;
            }
            CustomErrorsSection customErrorsSection = (CustomErrorsSection)configuration.GetSection("system.web/customErrors");

            if (customErrorsSection.Mode == CustomErrorsMode.Off)
            {
                this.customerror = 1;
            }
            this.adminsiteconfig = SiteConfigs.LoadConfig(FPUtils.GetMapPath(this.webpath + this.sysconfiginfo.adminpath + "/site.config"));
            if (this.ispost)
            {
                if (!this.isperm)
                {
                    this.ShowErr("对不起,您没有限权进行修改配置。");
                    return;
                }
                this.sysconfiginfo = FPRequest.GetModel <SysConfig>(this.sysconfiginfo);
                if (this.sysconfiginfo.admintitle == "")
                {
                    this.sysconfiginfo.admintitle = this.adminsiteconfig.sitetitle;
                }
                this.sysconfiginfo.passwordkey = WMSUtils.CreateAuthStr(10);
                WMSCookie.WriteCookie("password", DES.Encode(this.user.password, this.sysconfiginfo.passwordkey));
                SysConfigs.SaveConfig(this.sysconfiginfo);
                SysConfigs.ResetConfig();
                if (FPRequest.GetInt("customerror") != this.customerror)
                {
                    this.customerror = FPRequest.GetInt("customerror");
                    if (this.customerror == 1)
                    {
                        customErrorsSection.Mode = CustomErrorsMode.Off;
                    }
                    else
                    {
                        customErrorsSection.Mode = CustomErrorsMode.RemoteOnly;
                    }
                }
                if (configuration.AppSettings.Settings["sitepath"] != null)
                {
                    configuration.AppSettings.Settings["sitepath"].Value = FPRequest.GetString("mainsite");
                }
                else
                {
                    configuration.AppSettings.Settings.Add("sitepath", FPRequest.GetString("mainsite"));
                }
                configuration.Save(ConfigurationSaveMode.Modified);
                WebConfig.ReSet();
                base.AddMsg("更新配置成功!");
            }
            base.SaveRightURL();
        }
Exemplo n.º 29
0
        // Token: 0x0600002A RID: 42 RVA: 0x000047AC File Offset: 0x000029AC
        protected override void View()
        {
            string mapPath = FPUtils.GetMapPath(this.webpath + "sites/" + this.m_sitepath);

            if (!File.Exists(mapPath + "\\site.config"))
            {
                this.ShowErr("该站点不存在或已被删除。");
            }
            else
            {
                this.m_siteconfig = SiteConfigs.LoadConfig(mapPath + "\\site.config");
                if (this.ispost)
                {
                    string mapPath2 = FPUtils.GetMapPath(this.webpath + "cache");
                    string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
                    string a        = Path.GetExtension(fileName).ToLower();
                    if (a != ".fpsite" && a != ".zip")
                    {
                        this.ShowErr("对不起,该文件不是方配站点更新文件类型。");
                        return;
                    }
                    if (!Directory.Exists(mapPath2))
                    {
                        Directory.CreateDirectory(mapPath2);
                    }
                    if (File.Exists(mapPath2 + "\\" + fileName))
                    {
                        File.Delete(mapPath2 + "\\" + fileName);
                    }
                    FPRequest.Files["uploadfile"].SaveAs(mapPath2 + "\\" + fileName);
                    if (Directory.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName)))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    }
                    FPZip.UnZipFile(mapPath2 + "\\" + fileName, "");
                    File.Delete(mapPath2 + "\\" + fileName);
                    if (!File.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config"))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                        this.ShowErr("站点配置文件不存在或有错误。");
                        return;
                    }
                    SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config");
                    Version    v          = new Version(FPUtils.StrToDecimal(this.m_siteconfig.version).ToString("0.0"));
                    Version    v2         = new Version(FPUtils.StrToDecimal(siteConfig.version).ToString("0.0"));
                    if (v > v2)
                    {
                        this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                        return;
                    }
                    string mapPath3   = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteconfig.sitepath);
                    string sourcePath = mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName);
                    siteupdate.CopyDirectory(sourcePath, mapPath3);
                    Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    base.Response.Redirect("sitemanage.aspx");
                }
                base.SaveRightURL();
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// 类属性
 /// </summary>
 public Department()
 {
     Created    = DateTime.Now;
     ParentID   = We7Helper.EmptyGUID;
     Children   = new List <Department>();
     Updated    = DateTime.Now;
     FromSiteID = SiteConfigs.GetConfig().SiteID;
 }