Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
            channel_id = Convert.ToInt32(ddlmodel.SelectedValue);
            this.id    = DTRequest.GetQueryInt("id");
            if (id > 0)
            {
                trid.Visible = true;
                channel_id   = DTRequest.GetQueryInt("mid");
            }
            else
            {
                trid.Visible = false;
                txtTime.Text = DateTime.Now.ToString();
            }
            if (!IsPostBack)
            {
                GetArea();
                GetCategory();

                if (id > 0)
                {
                    ShowInfo(id);
                }
            }
        }
Ejemplo n.º 2
0
 //启用模板
 protected void lbtnStart_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_templet", DTEnums.ActionEnum.Add.ToString()); //检查权限
     BLL.siteconfig   bll   = new BLL.siteconfig();
     Model.siteconfig model = siteConfig;
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         string   skinName = ((HiddenField)rptList.Items[i].FindControl("hideSkinName")).Value;
         CheckBox cb       = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             //判是否当前模板
             if (skinName.ToLower() == siteConfig.templateskin)
             {
                 JscriptMsg("该模板已是当前模板啦!", "back", "Warning");
                 return;
             }
             model.templateskin = skinName.ToLower();
             //修改配置文件
             bll.saveConifg(model, Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
             //重新生成模板
             MarkTemplates(skinName);
             JscriptMsg("模板启用并全部生成成功啦!", "templet_list.aspx", "Success");
             return;
         }
     }
 }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            BLL.siteconfig   bll   = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig();

            if (!File.Exists(context.Request.PhysicalPath))
            {
                return;
            }
            byte[] _ImageBytes = File.ReadAllBytes(context.Request.PhysicalPath);
            if (_ImageBytes.Length >= 10000)
            {
                //文字
                if (model.watermarktype == 1)
                {
                    AddImageSignText(context, context.Request.PhysicalPath, "1", model.watermarktext, model.watermarkposition, model.watermarkimgquality, model.watermarkfont, model.watermarkfontsize);
                }//图片
                else if (model.watermarktype == 2)
                {
                    AddImageSignPic(context, context.Request.PhysicalPath, "1", model.watermarkpic, model.watermarkposition, model.watermarkimgquality, model.watermarktransparency);
                }
            }
            else
            {
                Image img = Image.FromStream(new System.IO.MemoryStream(_ImageBytes));

                ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
                ImageCodecInfo   ici    = null;
                foreach (ImageCodecInfo codec in codecs)
                {
                    if (codec.MimeType.IndexOf("jpeg") > -1)
                    {
                        ici = codec;
                    }
                }
                EncoderParameters encoderParams = new EncoderParameters();
                long[]            qualityParam  = new long[1];
                qualityParam[0] = 100;

                EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam);
                encoderParams.Param[0] = encoderParam;


                context.Response.ContentType = "image/jpeg";
                //将叠加后的图片以指定的格式保存到Response的输出流中。
                if (ici != null)
                {
                    img.Save(context.Response.OutputStream, ici, encoderParams);
                }
                else
                {
                    img.Save(context.Response.OutputStream, ImageFormat.Jpeg);
                }

                img.Dispose();


                context.Response.End();
            }
        }
Ejemplo n.º 4
0
 public UpLoad()
 {
     siteConfig = new BLL.siteconfig().loadConfig();
     //取得当前登录用户用户名
     Model.users model = new BasePage().GetUserInfo();
     userID = (model == null ? 0 : model.id);
 }
Ejemplo n.º 5
0
        //找回密碼
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            DAL.users bll   = new DAL.users();
            var       model = bll.ExistsByUsernameAndEmail(txtusername2.Value.Trim(), txtemail.Value);

            if (model.Rows.Count > 0)
            {
                var              password  = DESEncrypt.Decrypt(model.Rows[0]["password"].ToString());
                BLL.siteconfig   bllConfig = new BLL.siteconfig();
                Model.siteconfig config    = bllConfig.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));

                string body = model.Rows[0]["user_name"] + "您好,請確認您的密碼:&nbsp;" + password + "&nbsp;請牢記您的密碼";
                // var reWrite = SendMail.Mail(site.emailfrom, site.emailusername, txtemail.Value.Trim(), "會員找回密碼操作", body, site.emailusername, site.emailpassword, site.emailstmp, "");

                var reWrite = DTMail.sendMail(config.emailstmp, config.emailfrom, config.emailpassword, config.emailusername, config.emailfrom, txtemail.Value.Trim(), "會員找回密碼操作", body);
                if (reWrite.Equals("發送失敗"))
                {
                    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('發送郵件失敗,請重新發送');window.location.href='login.aspx?type=1'</script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('發送郵件成功,請查看郵件');window.location.href='login.aspx'</script>");
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('用戶名或郵箱不存在');window.location.href='login.aspx?type=1'</script>");
            }
        }
Ejemplo n.º 6
0
        private void setEmail(string Nom)
        {
            BLL.siteconfig   bll     = new BLL.siteconfig();
            Model.siteconfig model   = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
            string           Content = "你購買的商品訂單已經生成" + "請牢記訂單號:" + Nom + "" + "!";

            DTMail.sendMail(model.emailstmp, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, UserEmail.Value, "帝光房屋", Content);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 写入站点配置文件
 /// </summary>
 public Model.siteconfig saveConifg(Model.siteconfig model, string configFilePath)
 {
     lock (lockHelper)
     {
         SerializationHelper.Save(model, configFilePath);
     }
     return(model);
 }
Ejemplo n.º 8
0
        public ManagePage()
        {
            this.Load += new EventHandler(ManagePage_Load);
            siteConfig = new BLL.siteconfig().loadConfig();
            HttpCookie cookie = HttpContext.Current.Request.Cookies["lang"];
            string     lang   = cookie != null ? cookie.Value : "pl-PL";

            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang);
        }
Ejemplo n.º 9
0
 public ManagePage()
 {
     this.Load += new EventHandler(ManagePage_Load);
     siteConfig = new BLL.siteconfig().loadConfig();
     weburl     = siteConfig.weburl;
     title      = siteConfig.webname;
     keyword    = siteConfig.webname;
     describe   = siteConfig.webname;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 页面处理虚方法
 /// </summary>
 protected virtual void ShowPage()
 {
     //虚方法代码
     config   = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING), true);
     title    = config.webname;
     keywrod  = config.webkeyword;
     describe = config.webdescription;
     webUrl   = "http://" + HttpContext.Current.Request.Url.Host;
 }
Ejemplo n.º 11
0
        private void ShowInfo()
        {
            BLL.siteconfig   bll   = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
            webname.Text        = model.webname;
            webcompany.Text     = model.webcompany;
            weburl.Text         = model.weburl;
            webtel.Text         = model.webtel;
            webfax.Text         = model.webfax;
            webmail.Text        = model.webmail;
            webcrod.Text        = model.webcrod;
            webtitle.Text       = model.webtitle;
            webkeyword.Text     = model.webkeyword;
            webdescription.Text = model.webdescription;
            webcopyright.Text   = model.webcopyright;
            webpath.Text        = model.webpath;
            webmanagepath.Text  = model.webmanagepath;
            webstatus.Text      = model.webstatus.ToString();
            webclosereason.Text = model.webclosereason;
            webcountcode.Text   = model.webcountcode;

            staticstatus.SelectedValue  = model.staticstatus.ToString();
            staticextension.Text        = model.staticextension;
            memberstatus.SelectedValue  = model.memberstatus.ToString();
            commentstatus.SelectedValue = model.commentstatus.ToString();
            logstatus.SelectedValue     = model.logstatus.ToString();

            emailstmp.Text     = model.emailstmp;
            emailport.Text     = model.emailport.ToString();
            emailfrom.Text     = model.emailfrom;
            emailusername.Text = model.emailusername;
            if (!string.IsNullOrEmpty(model.emailpassword))
            {
                emailpassword.Attributes["value"] = defaultpassword;
            }
            emailnickname.Text = model.emailnickname;

            attachpath.Text             = model.attachpath;
            attachextension.Text        = model.attachextension;
            attachsave.SelectedValue    = model.attachsave.ToString();
            attachfilesize.Text         = model.attachfilesize.ToString();
            attachimgsize.Text          = model.attachimgsize.ToString();
            attachimgmaxheight.Text     = model.attachimgmaxheight.ToString();
            attachimgmaxwidth.Text      = model.attachimgmaxwidth.ToString();
            Kindmaxheight.Text          = model.kindmaxheight.ToString();
            Kindmaxwidth.Text           = model.kindgmaxwidth.ToString();
            thumbnailheight.Text        = model.thumbnailheight.ToString();
            thumbnailwidth.Text         = model.thumbnailwidth.ToString();
            watermarktype.SelectedValue = model.watermarktype.ToString();
            watermarkposition.Text      = model.watermarkposition.ToString();
            watermarkimgquality.Text    = model.watermarkimgquality.ToString();
            watermarkpic.Text           = model.watermarkpic;
            watermarktransparency.Text  = model.watermarktransparency.ToString();
            watermarktext.Text          = model.watermarktext;
            watermarkfont.Text          = model.watermarkfont;
            watermarkfontsize.Text      = model.watermarkfontsize.ToString();
        }
Ejemplo n.º 12
0
 protected override void OnAuthorization(AuthorizationContext filterContext)
 {
     siteConfig = new BLL.siteconfig().loadConfig();
     base.OnAuthorization(filterContext);
     if (!IsAdminLogin())
     {
         filterContext.Result = Redirect("/Home/Login");
         return;
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 ///  读取配置文件
 /// </summary>
 public Model.siteconfig loadConfig(string configFilePath)
 {
     Model.siteconfig model = CacheHelper.Get <Model.siteconfig>(DTKeys.CACHE_SITE_CONFIG);
     if (model == null)
     {
         CacheHelper.Insert(DTKeys.CACHE_SITE_CONFIG, dal.loadConfig(configFilePath), configFilePath);
         model = CacheHelper.Get <Model.siteconfig>(DTKeys.CACHE_SITE_CONFIG);
     }
     return(model);
 }
Ejemplo n.º 14
0
 private void setEmail()
 {
     if (IsUserLogin())
     {
         Model.users      modelUser = HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] as Model.users;
         BLL.siteconfig   bll       = new BLL.siteconfig();
         Model.siteconfig model     = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
         DTMail.sendMail(model.emailstmp, model.emailport, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, modelUser.email, "帝光房屋精品物件購買成功通知", "恭喜您購買成功");
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        ///  读取站点配置文件
        /// </summary>
        public Model.siteconfig loadConfig(string configFilePath)
        {
            var model = (Model.siteconfig)SerializationHelper.Load(typeof(Model.siteconfig), configFilePath);

            if (model == null)
            {
                model = new Model.siteconfig();
            }
            return(model);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 读取客户端站点配置信息
 /// </summary>
 public Model.siteconfig loadConfig(string configFilePath, bool isClient)
 {
     Model.siteconfig model = CacheHelper.Get <Model.siteconfig>(DTKeys.CACHE_SITE_CONFIG_CLIENT);
     if (model == null)
     {
         model = dal.loadConfig(configFilePath);
         model.templateskin = model.webpath + "templates/" + model.templateskin;
         CacheHelper.Insert(DTKeys.CACHE_SITE_CONFIG_CLIENT, model, configFilePath);
     }
     return(model);
 }
Ejemplo n.º 17
0
 /// <summary>
 ///  读取配置文件
 /// </summary>
 public Model.siteconfig loadConfig()
 {
     Model.siteconfig model = _Cache.Get <Model.siteconfig>(Vincent._DTcms.DTKeys.CACHE_SITE_CONFIG);
     if (model == null)
     {
         _Cache.Insert(Vincent._DTcms.DTKeys.CACHE_SITE_CONFIG, dal.loadConfig(Vincent._DTcms.Utils.GetXmlMapPath(Vincent._DTcms.DTKeys.FILE_SITE_XML_CONFING)),
                       Vincent._DTcms.Utils.GetXmlMapPath(Vincent._DTcms.DTKeys.FILE_SITE_XML_CONFING));
         model = _Cache.Get <Model.siteconfig>(Vincent._DTcms.DTKeys.CACHE_SITE_CONFIG);
     }
     return(model);
 }
Ejemplo n.º 18
0
 /// <summary>
 ///  读取配置文件
 /// </summary>
 public Model.siteconfig loadConfig()
 {
     Model.siteconfig model = CacheHelper.Get <Model.siteconfig>(PLKeys.CACHE_SITE_CONFIG);
     if (model == null)
     {
         CacheHelper.Insert(PLKeys.CACHE_SITE_CONFIG, dal.loadConfig(Utils.GetXmlMapPath(PLKeys.FILE_SITE_XML_CONFING)),
                            Utils.GetXmlMapPath(PLKeys.FILE_SITE_XML_CONFING));
         model = CacheHelper.Get <Model.siteconfig>(PLKeys.CACHE_SITE_CONFIG);
     }
     return(model);
 }
Ejemplo n.º 19
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string userPwd = TextBox1.Text.Trim();

            BLL.siteconfig   bll   = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));

            if (model.weburl == userPwd)
            {
                Utils.WriteCookie("UserCheckPwd", userPwd, 60);
                Response.Redirect(ReferUrl);
            }
            else
            {
                JscriptMsg("會員管理密碼錯誤!", "RePw.aspx", "Success");
            }
        }
Ejemplo n.º 20
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["name"]))
     {
         string           UserName = HttpContext.Current.Request.QueryString["name"];
         BLL.siteconfig   bll      = new BLL.siteconfig();
         Model.siteconfig model    = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
         if (model.weburl == DESEncrypt.Encrypt(UserName))
         {
             context.Response.Write(1);
         }
         else
         {
             context.Response.Write("0");
         }
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 ///  读取配置文件
 /// </summary>
 public Model.siteconfig loadConfig()
 {
     try
     {
         Model.siteconfig model = CacheHelper.Get <Model.siteconfig>(DTKeys.CACHE_SITE_CONFIG);
         if (model == null)
         {
             var configFilePath = Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING);
             CacheHelper.Insert(DTKeys.CACHE_SITE_CONFIG, dal.loadConfig(configFilePath), configFilePath);
             model = CacheHelper.Get <Model.siteconfig>(DTKeys.CACHE_SITE_CONFIG);
         }
         return(model);
     }
     catch
     {
         return(null);
     }
 }
Ejemplo n.º 22
0
        private void setEmail(int UserID)
        {
            //生成隨機碼
            string strcode = Utils.GetCheckCode(20);

            //獲得郵件內容
            Model.mail_template mailModel = new BLL.mail_template().GetModel("regverify");
            BLL.siteconfig      bll       = new BLL.siteconfig();
            Model.siteconfig    model     = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
            string titletxt = mailModel.maill_title;
            string bodytxt  = mailModel.content;

            titletxt = titletxt.Replace("{webname}", model.webname);
            titletxt = titletxt.Replace("{username}", DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername"));
            bodytxt  = bodytxt.Replace("{webname}", model.webname);
            bodytxt  = bodytxt.Replace("{username}", DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername"));
            bodytxt  = bodytxt.Replace("{linkurl}", "<a href=" + "http://" + Utils.GetHomeUrl() + "/RegPay.aspx?uId=" + UserID + ">請點擊連接激活帳戶" + "</a>"); //此處需要修改
            DTMail.sendMail(model.emailstmp, model.emailport, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtemall"), "帝光房屋會員註冊成功通知", bodytxt);
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            siteConfig = new BLL.siteconfig().loadConfig();
            if (!Page.IsPostBack)
            {
                #region 测试
                //string test = DESEncrypt.Decrypt("785528A58C55A6F7D9669B9534635E6070A99BE42E445E552F9F66FAA55F9FB376357C467EBF7F7E3B3FC77F37866FEFB0237D95CCCE157A", "Key");
                //string keys = "http://www.yubom.net/upgrade.ashx?u={0}&i={1}&v={2}";
                //string keysJM = DESEncrypt.Encrypt(keys, "Key");
                //string test = DESEncrypt.Decrypt(DTKeys.FILE_URL_UPGRADE_CODE, "DT");
                //string test2 = DESEncrypt.Decrypt(DTKeys.FILE_URL_NOTICE_CODE, "DT");
                //string sj = "http://www.yubom.net/upgrade.ashx?t=1";
                //string notice = "http://www.yubom.net/upgrade.ashx?t=2";
                //string sjJM = DESEncrypt.Encrypt(sj);
                //string noticeJM = DESEncrypt.Encrypt(notice);
                #endregion

                txtUserName.Text = Utils.GetCookie("DTRememberName");
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 获取访问的频道分类目录(不含安装目录)
        /// </summary>
        private static string GetFirstPath(Model.siteconfig config, string requestPath)
        {
            int indexNum = config.webpath.Length; //安装目录长度

            //如果包含安装目录和aspx目录也要过滤掉
            if (requestPath.StartsWith(config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/"))
            {
                indexNum = (config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/").Length;
            }
            string requestFirstPath = requestPath.Substring(indexNum);

            if (requestFirstPath.IndexOf("/") > 0)
            {
                requestFirstPath = requestFirstPath.Substring(0, requestFirstPath.IndexOf("/"));
            }
            if (requestFirstPath != string.Empty && SiteDomains.GetSiteDomains().CategoryDirs.ContainsKey(requestFirstPath))
            {
                return(requestFirstPath);
            }
            return(string.Empty);
        }
Ejemplo n.º 25
0
 public BLL_UpLoad()
 {
     siteConfig = new BLL_Siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
 }
Ejemplo n.º 26
0
 public ManagePage()
 {
     this.Load += new EventHandler(ManagePage_Load);
     siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
 }
Ejemplo n.º 27
0
        private void ShowInfo()
        {
            BLL.siteconfig   bll   = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig();

            webname.Text    = model.webname;
            weburl.Text     = model.weburl;
            webcompany.Text = model.webcompany;
            webaddress.Text = model.webaddress;
            webtel.Text     = model.webtel;
            webfax.Text     = model.webfax;
            webmail.Text    = model.webmail;
            webcrod.Text    = model.webcrod;

            webpath.Text               = model.webpath;
            webmanagepath.Text         = model.webmanagepath;
            staticstatus.SelectedValue = model.staticstatus.ToString();
            staticextension.Text       = model.staticextension;
            if (model.memberstatus == 1)
            {
                memberstatus.Checked = true;
            }
            else
            {
                memberstatus.Checked = false;
            }
            if (model.commentstatus == 1)
            {
                commentstatus.Checked = true;
            }
            else
            {
                commentstatus.Checked = false;
            }
            if (model.logstatus == 1)
            {
                logstatus.Checked = true;
            }
            else
            {
                logstatus.Checked = false;
            }
            if (model.webstatus == 1)
            {
                webstatus.Checked = true;
            }
            else
            {
                webstatus.Checked = false;
            }
            webclosereason.Text = model.webclosereason;
            webcountcode.Text   = model.webcountcode;

            smsapiurl.Text   = model.smsapiurl;
            smsusername.Text = model.smsusername;
            if (!string.IsNullOrEmpty(model.smspassword))
            {
                smspassword.Attributes["value"] = defaultpassword;
            }
            labSmsCount.Text = GetSmsCount(); //取得短信数量

            emailsmtp.Text = model.emailsmtp;
            if (model.emailssl == 1)
            {
                emailssl.Checked = true;
            }
            else
            {
                emailssl.Checked = false;
            }
            emailport.Text     = model.emailport.ToString();
            emailfrom.Text     = model.emailfrom;
            emailusername.Text = model.emailusername;
            if (!string.IsNullOrEmpty(model.emailpassword))
            {
                emailpassword.Attributes["value"] = defaultpassword;
            }
            emailnickname.Text = model.emailnickname;

            filepath.Text               = model.filepath;
            filesave.SelectedValue      = model.filesave.ToString();
            fileremote.SelectedValue    = model.fileremote.ToString();
            fileextension.Text          = model.fileextension;
            videoextension.Text         = model.videoextension;
            attachsize.Text             = model.attachsize.ToString();
            videosize.Text              = model.videosize.ToString();
            imgsize.Text                = model.imgsize.ToString();
            imgmaxheight.Text           = model.imgmaxheight.ToString();
            imgmaxwidth.Text            = model.imgmaxwidth.ToString();
            thumbnailheight.Text        = model.thumbnailheight.ToString();
            thumbnailwidth.Text         = model.thumbnailwidth.ToString();
            thumbnailmode.Text          = model.thumbnailmode;
            watermarktype.SelectedValue = model.watermarktype.ToString();
            watermarkposition.Text      = model.watermarkposition.ToString();
            watermarkimgquality.Text    = model.watermarkimgquality.ToString();
            watermarkpic.Text           = model.watermarkpic;
            watermarktransparency.Text  = model.watermarktransparency.ToString();
            watermarktext.Text          = model.watermarktext;
            watermarkfont.SelectedValue = model.watermarkfont;
            watermarkfontsize.Text      = model.watermarkfontsize.ToString();
        }
Ejemplo n.º 28
0
        public string Publish_News(string title, string content, string from, string add_time)
        {
            siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
            //string filepath_template, string savePath, Model.article_news model_news
            //给公共方法传参,标题,图片,内容,生成新闻文件
            string savePath, filepath_template = string.Empty;//保存的服务端地址,模板路径

            filepath_template = Utils.GetMapPath(siteConfig.webpath + @"templates/news.html");

            string dirPath = GetUpLoadPath(); //上传目录相对路径
            string fileName = Utils.GetRamCode() + ".html"; //随机文件名
            //获得要保存的文件路径
            string serverFileName = dirPath + fileName;
            //物理完整路径
            string toFileFullPath = Utils.GetMapPath(dirPath);
            //检查有该路径是否就创建
            if (!Directory.Exists(toFileFullPath))
            {
                Directory.CreateDirectory(toFileFullPath);
            }
            //保存的服务端地址
            savePath = toFileFullPath + fileName;
            Encoding code = Encoding.GetEncoding("gb2312");
            StreamReader sr = null;
            StreamWriter sw = null;
            string str = null;

            //读取
            try
            {
                sr = new StreamReader(filepath_template, code);
                str = sr.ReadToEnd();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sr.Close();
            }

            //根据时间自动重命名,扩展名也可以自行修改

            str = str.Replace("$title$", title) //替换Title
            .Replace("$content$", content) //替换content
            .Replace("$resource$", from) //来源
            .Replace("$datetimes$", add_time); //时间
            //.Replace("$Image$", model_news.img_url); //图片

            //生成静态文件
            try
            {
                sw = new StreamWriter(savePath, false, code);
                sw.Write(str);
                sw.Flush();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sw.Close();
            }
            return serverFileName;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_config", PLEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.siteconfig   bll   = new BLL.siteconfig();
            Model.siteconfig model = bll.loadConfig();
            try
            {
                model.webname    = webname.Text;
                model.weburl     = weburl.Text;
                model.webcompany = webcompany.Text;
                model.webaddress = webaddress.Text;
                model.webtel     = webtel.Text;
                model.webfax     = webfax.Text;
                model.webmail    = webmail.Text;
                model.webcrod    = webcrod.Text;

                model.webpath         = webpath.Text;
                model.webmanagepath   = webmanagepath.Text;
                model.staticstatus    = Utils.StrToInt(staticstatus.SelectedValue, 0);
                model.staticextension = staticextension.Text;
                if (memberstatus.Checked == true)
                {
                    model.memberstatus = 1;
                }
                else
                {
                    model.memberstatus = 0;
                }
                if (commentstatus.Checked == true)
                {
                    model.commentstatus = 1;
                }
                else
                {
                    model.commentstatus = 0;
                }
                if (logstatus.Checked == true)
                {
                    model.logstatus = 1;
                }
                else
                {
                    model.logstatus = 0;
                }
                if (webstatus.Checked == true)
                {
                    model.webstatus = 1;
                }
                else
                {
                    model.webstatus = 0;
                }
                model.webclosereason = webclosereason.Text;
                model.webcountcode   = webcountcode.Text;

                model.smsapiurl   = smsapiurl.Text;
                model.smsusername = smsusername.Text;
                //判断密码是否更改
                if (smspassword.Text.Trim() != "" && smspassword.Text.Trim() != defaultpassword)
                {
                    model.smspassword = Utils.MD5(smspassword.Text.Trim());
                }

                model.emailsmtp = emailsmtp.Text;
                if (emailssl.Checked == true)
                {
                    model.emailssl = 1;
                }
                else
                {
                    model.emailssl = 0;
                }
                model.emailport     = Utils.StrToInt(emailport.Text.Trim(), 25);
                model.emailfrom     = emailfrom.Text;
                model.emailusername = emailusername.Text;
                //判断密码是否更改
                if (emailpassword.Text.Trim() != defaultpassword)
                {
                    model.emailpassword = DESEncrypt.Encrypt(emailpassword.Text, model.sysencryptstring);
                }
                model.emailnickname = emailnickname.Text;

                model.filepath              = filepath.Text;
                model.filesave              = Utils.StrToInt(filesave.SelectedValue, 2);
                model.fileremote            = Utils.StrToInt(fileremote.SelectedValue, 0);
                model.fileextension         = fileextension.Text;
                model.videoextension        = videoextension.Text;
                model.attachsize            = Utils.StrToInt(attachsize.Text.Trim(), 0);
                model.videosize             = Utils.StrToInt(videosize.Text.Trim(), 0);
                model.imgsize               = Utils.StrToInt(imgsize.Text.Trim(), 0);
                model.imgmaxheight          = Utils.StrToInt(imgmaxheight.Text.Trim(), 0);
                model.imgmaxwidth           = Utils.StrToInt(imgmaxwidth.Text.Trim(), 0);
                model.thumbnailheight       = Utils.StrToInt(thumbnailheight.Text.Trim(), 0);
                model.thumbnailwidth        = Utils.StrToInt(thumbnailwidth.Text.Trim(), 0);
                model.thumbnailmode         = thumbnailmode.SelectedValue;
                model.watermarktype         = Utils.StrToInt(watermarktype.SelectedValue, 0);
                model.watermarkposition     = Utils.StrToInt(watermarkposition.Text.Trim(), 9);
                model.watermarkimgquality   = Utils.StrToInt(watermarkimgquality.Text.Trim(), 80);
                model.watermarkpic          = watermarkpic.Text;
                model.watermarktransparency = Utils.StrToInt(watermarktransparency.Text.Trim(), 5);
                model.watermarktext         = watermarktext.Text;
                model.watermarkfont         = watermarkfont.Text;
                model.watermarkfontsize     = Utils.StrToInt(watermarkfontsize.Text.Trim(), 12);

                bll.saveConifg(model);
                AddAdminLog(PLEnums.ActionEnum.Edit.ToString(), "修改系统配置信息"); //记录日志
                JscriptMsg("修改系统配置成功!", "sys_config.aspx");
            }
            catch
            {
                JscriptMsg("文件写入失败,请检查文件夹权限!", "");
            }
        }
Ejemplo n.º 30
0
 public ManagePage()
 {
     this.Load += new EventHandler(ManagePage_Load);
     siteConfig = new BLL.siteconfig().loadConfig();
 }
Ejemplo n.º 31
0
 public ManagePage()
 {
     this.Load += new EventHandler(ManagePage_Load);
     siteConfig = new BLL.siteconfig().loadConfig();
 }
Ejemplo n.º 32
0
 public UpLoad()
 {
     siteConfig = new BLL.siteconfig().loadConfig();
 }
Ejemplo n.º 33
0
 public string Linkurl(Model.siteconfig config)
 {
     return(NeedTransferClaim == null
         ? linkurl(config, "project", Project.id)
         : linkurl(config, "project", Project.id, NeedTransferClaim.id));
 }
Ejemplo n.º 34
0
 private void setEmail(string UserEmail, string Content)
 {
     BLL.siteconfig   bll   = new BLL.siteconfig();
     Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
     DTMail.sendMail(model.emailstmp, model.emailport, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, UserEmail, "帝光房屋留言回覆", Content);
 }
Ejemplo n.º 35
0
 public UpLoad()
 {
     siteConfig = new BLL.siteconfig().loadConfig();
 }