Esempio n. 1
0
        static Config()
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            //读取XML配置信息
            string fullPath = Utils.GetMapPath("~/xmlconfig/alipay.config");
            XmlDocument doc = new XmlDocument();
            doc.Load(fullPath);
            XmlNode _partner = doc.SelectSingleNode(@"Root/partner");
            XmlNode _key = doc.SelectSingleNode(@"Root/key");
            XmlNode _email = doc.SelectSingleNode(@"Root/email");
            XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url");
            XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url");
            //读取站点配置信息
            Model.configs.siteconfig model = new BLL.configs.siteconfig().loadConfig();

            //合作身份者ID,以2088开头由16位纯数字组成的字符串
            partner = _partner.InnerText;
            //交易安全检验码,由数字和字母组成的32位字符串
            key = _key.InnerText;
            //签约支付宝账号或卖家支付宝帐户
            email = _email.InnerText;
            //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText;
            //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText;

            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";

            //签名方式 不需修改
            sign_type = "MD5";
        }
Esempio n. 2
0
        /// <summary>
        /// 过滤SQL注入危险字符
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KillSqlFilter(object sender, EventArgs e)
        {
            HttpContext context = ((HttpApplication)sender).Context;

            //  Model.WebSet webConfig = new BLL.WebSet().loadConfig(Utils.GetXmlMapPath("Configpath"));
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig(); //获得站点配置信息
            string killSqlFilter = "and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join|cmd";

            //遍历参数,管理目录和隐藏域除外
            if (context.Request.Url.ToString().ToLower().IndexOf(siteConfig.webmanagepath.ToLower()) < 0)
            {
                //遍历Post参数
                foreach (string i in context.Request.Form)
                {
                    if (i == "__VIEWSTATE")
                    {
                        continue;
                    }
                    if (Common.Utils.SqlFilter(killSqlFilter, context.Request.Form[i].ToString()))
                    {
                        context.Response.Write("<script>window.alert('您提交的参数中含有非法字符!');history.back();" + " </" + "script>");
                    }
                }
                //遍历Get参数。
                foreach (string i in context.Request.QueryString)
                {
                    if (Common.Utils.SqlFilter(killSqlFilter, context.Request.QueryString[i].ToString()))
                    {
                        context.Response.Write("<script>window.alert('您提交的参数中含有非法字符!');history.back();" + " </" + "script>");
                    }
                }
            }
        }
Esempio n. 3
0
        // 页面seo信息
        public static string seo(string item)
        {
            Model.configs.siteconfig config = new BLL.configs.siteconfig().loadConfig();
            string str = "";

            switch (item)
            {
            case "title":
                str = config.webname;
                break;

            case "keyword":
                str = config.webkeyword;
                break;

            case "description":
                str = config.webdescription;
                break;

            case "copyright":
                str = config.webcopyright;
                break;

            case "code":
                str = config.webcrod;
                break;

            case "fax":
                str = config.webfax;
                break;

            case "mail":
                str = config.webmail;
                break;

            case "logo":
                str = config.weblogo;
                break;

            case "tel":
                str = config.webtel;
                break;

            case "http":
                str = config.weburl;
                break;

            case "countcode":
                str = config.webcountcode;
                break;

            case "address":
                str = config.webaddress;
                break;
            }
            return(str);
        }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string userName   = txtUserName.Text.Trim();
            string userPwd    = txtPassword.Text.Trim();
            string ManageCode = TxtManageCode.Text.Trim();

            if (ManageCode != OS.Web.UI.BasePage.config.emailnickname)
            {
                msgtip.InnerHtml = "管理认证码输入不正确";
                return;
            }
            if (userName.Equals("") || userPwd.Equals(""))
            {
                msgtip.InnerHtml = "请输入用户名或密码";
                return;
            }
            if (Session["AdminLoginSun"] == null)
            {
                Session["AdminLoginSun"] = 1;
            }
            else
            {
                Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1;
            }
            //判断登录错误次数
            if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5)
            {
                msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!";
                return;
            }
            BLL.managers.manager   bll   = new BLL.managers.manager();
            Model.managers.manager model = bll.GetModel(userName, userPwd, true);
            if (model == null)
            {
                msgtip.InnerHtml = "用户名或密码有误,请重试!";
                return;
            }
            Session[OSKeys.SESSION_ADMIN_INFO] = model;
            Session.Timeout = 45;
            //写入登录日志
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
            if (siteConfig.logstatus > 0)
            {
                new BLL.managers.manager_log().Add(model.id, model.user_name, OSEnums.ActionEnum.Login.ToString(), "用户登录");
            }
            //写入Cookies
            Utils.WriteCookie("LoginName", model.user_name, 14400);
            Utils.WriteCookie("AdminName", "OS", model.user_name);
            Utils.WriteCookie("AdminPwd", "OS", model.password);
            Response.Redirect("Main.aspx");
            return;
        }
Esempio n. 5
0
        // 页面seo信息
        public static string seo(string item)
        {
            Model.configs.siteconfig config = new BLL.configs.siteconfig().loadConfig();
            string str = "";
            switch (item) {
                case "title":
                    str = config.webname;
                    break;
                case "keyword":
                    str = config.webkeyword;
                    break;
                case "description":
                    str = config.webdescription;
                    break;
                case "copyright":
                    str = config.webcopyright;
                    break;
                case "code":
                    str = config.webcrod;
                    break;
                case "fax":
                    str = config.webfax;
                    break;
                case "mail":
                    str = config.webmail;
                    break;
                case "logo":
                    str = config.weblogo;
                    break;
                case "tel":
                    str = config.webtel;
                    break;
                case "http":
                    str = config.weburl;
                    break;
                case "countcode":
                    str = config.webcountcode;
                    break;
                case "address":
                    str = config.webaddress;
                    break;

            }
            return str;
        }
Esempio n. 6
0
 /// <summary>
 /// 获取OAuth配置信息
 /// </summary>
 /// <param name="oauth_name"></param>
 public static oauth_config get_config(string oauth_name)
 {
     //读取接口配置信息
     Model.users.user_oauth_app model = new BLL.users.user_oauth_app().GetModel(oauth_name);
     if (model != null)
     {
         //读取站点配置信息
         Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
         //赋值
         oauth_config config = new oauth_config();
         config.oauth_name    = model.api_path.Trim();
         config.oauth_app_id  = model.app_id.Trim();
         config.oauth_app_key = model.app_key.Trim();
         config.return_uri    = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx";
         return(config);
     }
     return(null);
 }
Esempio n. 7
0
 /// <summary>
 /// 获取OAuth配置信息
 /// </summary>
 /// <param name="oauth_name"></param>
 public static oauth_config get_config(string oauth_name)
 {
     //读取接口配置信息
     Model.users.user_oauth_app model = new BLL.users.user_oauth_app().GetModel(oauth_name);
     if (model != null)
     {
         //读取站点配置信息
         Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
         //赋值
         oauth_config config = new oauth_config();
         config.oauth_name = model.api_path.Trim();
         config.oauth_app_id = model.app_id.Trim();
         config.oauth_app_key = model.app_key.Trim();
         config.return_uri = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx";
         return config;
     }
     return null;
 }
Esempio n. 8
0
        static TenpayUtil()
        {
            //��ȡXML������Ϣ
            string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
            XmlDocument doc = new XmlDocument();
            doc.Load(fullPath);
            XmlNode _partner = doc.SelectSingleNode(@"Root/partner");
            XmlNode _key = doc.SelectSingleNode(@"Root/key");
            XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url");
            XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url");
            //��ȡվ��������Ϣ
            Model.configs.siteconfig model = new BLL.configs.siteconfig().loadConfig();

            partner = _partner.InnerText;
            key = _key.InnerText;
            return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText;
            notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText;
        }
Esempio n. 9
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     string userName = txtUserName.Text.Trim();
     string userPwd = txtPassword.Text.Trim();
     string ManageCode = TxtManageCode.Text.Trim();
     if (ManageCode != OS.Web.UI.BasePage.config.emailnickname) {
         msgtip.InnerHtml = "管理认证码输入不正确";
         return;
     }
     if (userName.Equals("") || userPwd.Equals("")) {
         msgtip.InnerHtml = "请输入用户名或密码";
         return;
     }
     if (Session["AdminLoginSun"] == null) {
         Session["AdminLoginSun"] = 1;
     }
     else {
         Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1;
     }
     //判断登录错误次数
     if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) {
         msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!";
         return;
     }
     BLL.managers.manager bll = new BLL.managers.manager();
     Model.managers.manager model = bll.GetModel(userName, userPwd, true);
     if (model == null) {
         msgtip.InnerHtml = "用户名或密码有误,请重试!";
         return;
     }
     Session[OSKeys.SESSION_ADMIN_INFO] = model;
     Session.Timeout = 45;
     //写入登录日志
     Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
     if (siteConfig.logstatus > 0) {
         new BLL.managers.manager_log().Add(model.id, model.user_name, OSEnums.ActionEnum.Login.ToString(), "用户登录");
     }
     //写入Cookies
     Utils.WriteCookie("LoginName", model.user_name, 14400);
     Utils.WriteCookie("AdminName", "OS", model.user_name);
     Utils.WriteCookie("AdminPwd", "OS", model.password);
     Response.Redirect("Main.aspx");
     return;
 }
Esempio n. 10
0
 /// <summary>
 /// 生成静态文件方法
 /// </summary>
 public static void CreateIndexHtml(string aspxPath, string htmlPath)
 {
     Model.configs.siteconfig config = new BLL.configs.siteconfig().loadConfig();//站点配置
     if (File.Exists(Utils.GetMapPath(config.webpath + "aspx" + aspxPath.Substring(0, aspxPath.IndexOf(".aspx") + 5)))) {
         string linkwebsite = HttpContext.Current.Request.Url.Authority;
         System.Net.WebRequest request = System.Net.WebRequest.Create("http://" + linkwebsite + aspxPath);
         System.Net.WebResponse response = request.GetResponse();
         System.IO.Stream stream = response.GetResponseStream();
         System.IO.StreamReader streamreader = new System.IO.StreamReader(stream, System.Text.Encoding.GetEncoding("utf-8"));
         string content = streamreader.ReadToEnd();
         using (StreamWriter sw = new StreamWriter(Utils.GetMapPath(htmlPath), false, Encoding.UTF8)) {
             sw.WriteLine(content);
             sw.Flush();
             sw.Close();
         }
     } else {
         HttpContext.Current.Response.Write("1");//找不到生成的模版!
     }
 }
Esempio n. 11
0
        public static string notify_url = ""; //支付完成后的回调处理页面;

        static TenpayUtil()
        {
            //读取XML配置信息
            string      fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
            XmlDocument doc      = new XmlDocument();

            doc.Load(fullPath);
            XmlNode _partner    = doc.SelectSingleNode(@"Root/partner");
            XmlNode _key        = doc.SelectSingleNode(@"Root/key");
            XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url");
            XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url");

            //读取站点配置信息
            Model.configs.siteconfig model = new BLL.configs.siteconfig().loadConfig();

            partner    = _partner.InnerText;
            key        = _key.InnerText;
            return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText;
            notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText;
        }
Esempio n. 12
0
 private int GetIsLoginAndIsStaticstatus()
 {
     Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
     //取得管理员登录信息
     Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
     if (adminInfo == null)
     {
         return(-1);
     }
     else if (!new BLL.managers.manager_role().Exists(adminInfo.role_id, "app_builder_html", OSEnums.ActionEnum.Build.ToString()))
     {
         return(-2);
     }
     else if (siteConfig.staticstatus != 2)
     {
         return(-3);
     }
     else
     {
         return(1);
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 生成静态文件方法
        /// </summary>

        public static void CreateIndexHtml(string aspxPath, string htmlPath)
        {
            Model.configs.siteconfig config = new BLL.configs.siteconfig().loadConfig();            //站点配置
            if (File.Exists(Utils.GetMapPath(config.webpath + "aspx" + aspxPath.Substring(0, aspxPath.IndexOf(".aspx") + 5))))
            {
                string linkwebsite                  = HttpContext.Current.Request.Url.Authority;
                System.Net.WebRequest  request      = System.Net.WebRequest.Create("http://" + linkwebsite + aspxPath);
                System.Net.WebResponse response     = request.GetResponse();
                System.IO.Stream       stream       = response.GetResponseStream();
                System.IO.StreamReader streamreader = new System.IO.StreamReader(stream, System.Text.Encoding.GetEncoding("utf-8"));
                string content = streamreader.ReadToEnd();
                using (StreamWriter sw = new StreamWriter(Utils.GetMapPath(htmlPath), false, Encoding.UTF8)) {
                    sw.WriteLine(content);
                    sw.Flush();
                    sw.Close();
                }
            }
            else
            {
                HttpContext.Current.Response.Write("1");                //找不到生成的模版!
            }
        }
Esempio n. 14
0
        static Config()
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            //读取XML配置信息
            string      fullPath = Utils.GetMapPath("~/xmlconfig/alipay.config");
            XmlDocument doc      = new XmlDocument();

            doc.Load(fullPath);
            XmlNode _partner    = doc.SelectSingleNode(@"Root/partner");
            XmlNode _key        = doc.SelectSingleNode(@"Root/key");
            XmlNode _email      = doc.SelectSingleNode(@"Root/email");
            XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url");
            XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url");

            //读取站点配置信息
            Model.configs.siteconfig model = new BLL.configs.siteconfig().loadConfig();

            //合作身份者ID,以2088开头由16位纯数字组成的字符串
            partner = _partner.InnerText;
            //交易安全检验码,由数字和字母组成的32位字符串
            key = _key.InnerText;
            //签约支付宝账号或卖家支付宝帐户
            email = _email.InnerText;
            //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText;
            //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText;

            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";

            //签名方式 不需修改
            sign_type = "MD5";
        }
Esempio n. 15
0
        private void ShowInfo()
        {
            BLL.configs.siteconfig   bll   = new BLL.configs.siteconfig();
            Model.configs.siteconfig model = bll.loadConfig();

            webname.Text        = model.webname;
            weburl.Text         = model.weburl;
            weblogo.Text        = model.weblogo;
            webcompany.Text     = model.webcompany;
            webaddress.Text     = model.webaddress;
            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;
            webweiXin.Text      = model.webweixin;
            webweibo.Text       = model.webweibo;

            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;

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

            emailsmtp.Text     = model.emailsmtp;
            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();
            fileextension.Text          = model.fileextension;
            attachsize.Text             = model.attachsize.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();
            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();
            pricemechanism.Text         = model.pricemechanism.ToString();
            pricepeople.Text            = model.pricepeople.ToString();
            pricestudent.Text           = model.pricestudent.ToString();
        }
Esempio n. 16
0
        //private string GetSmsCount()
        //{
        //    string code = string.Empty;
        //    int count = new BLL.configs.sms_message().GetAccountQuantity(out code);
        //    if (code == "115")
        //    {
        //        return "查询出错:请完善账户信息";
        //    }
        //    else if (code != "100")
        //    {
        //        return "错误代码:" + code;
        //    }
        //    return count + " 条";
        //}
        #endregion

        /// <summary>
        /// 保存配置信息
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("site_config", OSEnums.ActionEnum.Edit.ToString());             //检查权限
            BLL.configs.siteconfig   bll   = new BLL.configs.siteconfig();
            Model.configs.siteconfig model = bll.loadConfig();

            model.webname        = webname.Text;
            model.weburl         = weburl.Text;
            model.weblogo        = weblogo.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.webtitle       = webtitle.Text;
            model.webkeyword     = webkeyword.Text;
            model.webdescription = Utils.DropHTML(webdescription.Text);
            model.webcopyright   = webcopyright.Text;
            model.webweixin      = webweiXin.Text;
            model.webweibo       = webweibo.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.smsusername = smsusername.Text;
            ////判断密码是否更改
            //if (smspassword.Text.Trim() != "" && smspassword.Text.Trim() != defaultpassword)
            //{
            //    model.smspassword = Utils.MD5(smspassword.Text.Trim());
            //}

            model.emailsmtp     = emailsmtp.Text;
            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.fileextension         = fileextension.Text;
            model.attachsize            = Utils.StrToInt(attachsize.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.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);


            model.pricemechanism = pricemechanism.Text != "" ? Convert.ToDecimal(pricemechanism.Text) : 0;
            model.pricepeople    = pricepeople.Text != "" ? Convert.ToDecimal(pricepeople.Text) : 0;
            model.pricestudent   = pricestudent.Text != "" ? Convert.ToDecimal(pricestudent.Text) : 0;

            bll.saveConifg(model);
            AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改系统配置信息");             //记录日志

            PageSuccessMsg("修改系统配置成功", "", "sys_config.aspx");
        }
Esempio n. 17
0
        public void ProcessRequest(HttpContext context)
        {
            int aid = OSRequest.GetQueryInt("id");

            //获得广告位的ID
            if (aid < 1)
            {
                context.Response.Write("document.write('错误提示,请勿提交非法字符!');");
                return;
            }

            //检查广告位是否存在
            BLL.plugins.advert abll = new BLL.plugins.advert();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('错误提示,该广告位不存在!');");
                return;
            }

            //取得该广告位详细信息
            Model.plugins.advert aModel = abll.GetModel(aid);

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            BLL.plugins.advert_banner bbll = new BLL.plugins.advert_banner();
            DataSet ds = bbll.GetList("is_lock=0 and datediff(d,start_time,getdate())>=0 and datediff(d,end_time,getdate())<=0 and aid=" + aid);
            if (ds.Tables[0].Rows.Count < 1)
            {
                context.Response.Write("document.write('该广告位下暂无广告内容');");
                return;
            }

            //=================判断广告位类别,输出广告条======================

            //新增,取得站点配置信息
                 Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig(); //获得站点配置信息

            switch (aModel.type)
            {
                case 1: //文字
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                            break;
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">" + dr["title"] + "</a>');");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                    break;
                case 2: //图片
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                        context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                        context.Response.Write("document.write('</a>');");
                    }
                    else
                    {
                        context.Response.Write("document.write('<ul>');\n");
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            //如果超出限制广告数量,则退出循环
                            if (i >= aModel.view_num)
                                break;
                            DataRow dr = ds.Tables[0].Rows[i];
                            context.Response.Write("document.write('<li>');");
                            context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                            context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                            context.Response.Write("document.write('</a>');\n");
                            context.Response.Write("document.write('</li>');\n");
                        }
                        context.Response.Write("document.write('</ul>');\n");
                    }
                    break;
                case 3: //幻灯片
                    StringBuilder picTitle = new StringBuilder();
                    StringBuilder picUrl = new StringBuilder();
                    StringBuilder picLink = new StringBuilder();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                            break;
                        DataRow dr = ds.Tables[0].Rows[i];
                        picUrl.Append(dr["file_path"].ToString());
                        picLink.Append(dr["link_url"].ToString());
                        if (i < ds.Tables[0].Rows.Count - 1)
                        {
                            picUrl.Append("|");
                            picLink.Append("|");
                        }
                    }
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" d=scriptmain name=scriptmain codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\">');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                    context.Response.Write("document.write('<param name=\"loop\" value=\"false\">');\n");
                    context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                    context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                    context.Response.Write("document.write('<embed src=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" loop=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" menu=\"false\"></embed>');\n");
                    context.Response.Write("document.write('</object>');\n");
                    break;
                case 4: //动画
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                        context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                        context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                        context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                        context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                        context.Response.Write("document.write('</embed>');\n");
                        context.Response.Write("document.write('</object>');\n");
                    }
                    else
                    {
                        context.Response.Write("document.write('<ul>');\n");
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            //如果超出限制广告数量,则退出循环
                            if (i >= aModel.view_num)
                                break;
                            DataRow dr = ds.Tables[0].Rows[i];
                            context.Response.Write("document.write('<li>');");
                            context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                            context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                            context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                            context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                            context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                            context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                            context.Response.Write("document.write('</embed>');\n");
                            context.Response.Write("document.write('</object>');\n");
                            context.Response.Write("document.write('</li>');\n");
                        }
                        context.Response.Write("document.write('</ul>');\n");
                    }
                    break;
                case 5://视频
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= 1)
                            break;
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=" + aModel.view_width + " height=" + aModel.view_height + " viewastext>');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/player.swf\" />');\n");
                        context.Response.Write("document.write('<param name=\"quality\" value=\"high\" />');\n");
                        context.Response.Write("document.write('<param name=\"allowFullScreen\" value=\"true\" />');\n");
                        context.Response.Write("document.write('<param name=\"FlashVars\" value=\"vcastr_file=" + dr["file_path"].ToString() + "&LogoText=www.auto.cn&BarTransparent=30&BarColor=0xffffff&IsAutoPlay=1&IsContinue=1\" />');\n");
                        context.Response.Write("document.write('</object>');\n");
                    }
                    break;
                case 6://代码
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= 1)
                            break;
                        DataRow dr = ds.Tables[0].Rows[i];
                        StringBuilder sb = new StringBuilder(dr["content"].ToString());
                        sb.Replace("&lt;", "<");
                        sb.Replace("&gt;", ">");
                        sb.Replace("\"", "'");
                        context.Response.Write("document.write(\"" + sb.ToString() + "\")");
                    }
                    break;

            }
        }
Esempio n. 18
0
        private void ShowInfo()
        {
            BLL.configs.siteconfig bll = new BLL.configs.siteconfig();
            Model.configs.siteconfig model = bll.loadConfig();

            webname.Text = model.webname;
            weburl.Text = model.weburl;
            weblogo.Text = model.weblogo;
            webcompany.Text = model.webcompany;
            webaddress.Text = model.webaddress;
            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;
            webweiXin.Text = model.webweixin;
            webweibo.Text = model.webweibo;

            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;

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

            emailsmtp.Text = model.emailsmtp;
            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();
            fileextension.Text = model.fileextension;
            attachsize.Text = model.attachsize.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();
            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();
            pricemechanism.Text = model.pricemechanism.ToString();
            pricepeople.Text = model.pricepeople.ToString();
            pricestudent.Text = model.pricestudent.ToString();
        }
Esempio n. 19
0
        string defaultpassword = "******"; //默认显示密码

        #endregion Fields

        #region Methods

        /// <summary>
        /// 保存配置信息
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("site_config", OSEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.configs.siteconfig bll = new BLL.configs.siteconfig();
            Model.configs.siteconfig model = bll.loadConfig();

            model.webname = webname.Text;
            model.weburl = weburl.Text;
            model.weblogo = weblogo.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.webtitle = webtitle.Text;
            model.webkeyword = webkeyword.Text;
            model.webdescription = Utils.DropHTML(webdescription.Text);
            model.webcopyright = webcopyright.Text;
            model.webweixin = webweiXin.Text;
            model.webweibo = webweibo.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.smsusername = smsusername.Text;
            ////判断密码是否更改
            //if (smspassword.Text.Trim() != "" && smspassword.Text.Trim() != defaultpassword)
            //{
            //    model.smspassword = Utils.MD5(smspassword.Text.Trim());
            //}

            model.emailsmtp = emailsmtp.Text;
            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.fileextension = fileextension.Text;
            model.attachsize = Utils.StrToInt(attachsize.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.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);

            model.pricemechanism = pricemechanism.Text != "" ? Convert.ToDecimal(pricemechanism.Text) : 0;
            model.pricepeople = pricepeople.Text != "" ? Convert.ToDecimal(pricepeople.Text) : 0;
            model.pricestudent = pricestudent.Text != "" ? Convert.ToDecimal(pricestudent.Text) : 0;

            bll.saveConifg(model);
            AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改系统配置信息"); //记录日志

            PageSuccessMsg("修改系统配置成功", "", "sys_config.aspx");
        }
Esempio n. 20
0
        private void ManagerFile(HttpContext context)
        {
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
            //String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);

            //根目录路径,相对路径
            String rootPath = siteConfig.webpath + siteConfig.filepath + "/"; //站点目录+上传目录
            //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
            String rootUrl = siteConfig.webpath + siteConfig.filepath + "/";
            //图片扩展名
            String fileTypes = "gif,jpg,jpeg,png,bmp";

            String currentPath = "";
            String currentUrl = "";
            String currentDirPath = "";
            String moveupDirPath = "";

            String dirPath = Utils.GetMapPath(rootPath);
            String dirName = context.Request.QueryString["dir"];

            //根据path参数,设置各路径和URL
            String path = context.Request.QueryString["path"];
            path = String.IsNullOrEmpty(path) ? "" : path;
            if (path == "")
            {
                currentPath = dirPath;
                currentUrl = rootUrl;
                currentDirPath = "";
                moveupDirPath = "";
            }
            else
            {
                currentPath = dirPath + path;
                currentUrl = rootUrl + path;
                currentDirPath = path;
                moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1");
            }

            //排序形式,name or size or type
            String order = context.Request.QueryString["order"];
            order = String.IsNullOrEmpty(order) ? "" : order.ToLower();

            //不允许使用..移动到上一级目录
            if (Regex.IsMatch(path, @"\.\."))
            {
                context.Response.Write("Access is not allowed.");
                context.Response.End();
            }
            //最后一个字符不是/
            if (path != "" && !path.EndsWith("/"))
            {
                context.Response.Write("Parameter is not valid.");
                context.Response.End();
            }
            //目录不存在或不是目录
            if (!Directory.Exists(currentPath))
            {
                context.Response.Write("Directory does not exist.");
                context.Response.End();
            }

            //遍历目录取得文件信息
            string[] dirList = Directory.GetDirectories(currentPath);
            string[] fileList = Directory.GetFiles(currentPath);

            switch (order)
            {
                case "size":
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new SizeSorter());
                    break;
                case "type":
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new TypeSorter());
                    break;
                case "name":
                default:
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new NameSorter());
                    break;
            }

            Hashtable result = new Hashtable();
            result["moveup_dir_path"] = moveupDirPath;
            result["current_dir_path"] = currentDirPath;
            result["current_url"] = currentUrl;
            result["total_count"] = dirList.Length + fileList.Length;
            List<Hashtable> dirFileList = new List<Hashtable>();
            result["file_list"] = dirFileList;
            for (int i = 0; i < dirList.Length; i++)
            {
                DirectoryInfo dir = new DirectoryInfo(dirList[i]);
                Hashtable hash = new Hashtable();
                hash["is_dir"] = true;
                hash["has_file"] = (dir.GetFileSystemInfos().Length > 0);
                hash["filesize"] = 0;
                hash["is_photo"] = false;
                hash["filetype"] = "";
                hash["filename"] = dir.Name;
                hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            for (int i = 0; i < fileList.Length; i++)
            {
                FileInfo file = new FileInfo(fileList[i]);
                Hashtable hash = new Hashtable();
                hash["is_dir"] = false;
                hash["has_file"] = false;
                hash["filesize"] = file.Length;
                hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0);
                hash["filetype"] = file.Extension.Substring(1);
                hash["filename"] = file.Name;
                hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8");
            context.Response.Write(JsonMapper.ToJson(result));
            context.Response.End();
        }
Esempio n. 21
0
        public void ProcessRequest(HttpContext context)
        {
            int aid = OSRequest.GetQueryInt("id");

            //获得广告位的ID
            if (aid < 1)
            {
                context.Response.Write("document.write('错误提示,请勿提交非法字符!');");
                return;
            }

            //检查广告位是否存在
            BLL.plugins.advert abll = new BLL.plugins.advert();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('错误提示,该广告位不存在!');");
                return;
            }

            //取得该广告位详细信息
            Model.plugins.advert aModel = abll.GetModel(aid);

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            BLL.plugins.advert_banner bbll = new BLL.plugins.advert_banner();
            DataSet ds = bbll.GetList("is_lock=0 and datediff(d,start_time,getdate())>=0 and datediff(d,end_time,getdate())<=0 and aid=" + aid);

            if (ds.Tables[0].Rows.Count < 1)
            {
                context.Response.Write("document.write('该广告位下暂无广告内容');");
                return;
            }

            //=================判断广告位类别,输出广告条======================

            //新增,取得站点配置信息
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();      //获得站点配置信息


            switch (aModel.type)
            {
            case 1:     //文字
                context.Response.Write("document.write('<ul>');\n");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.view_num)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<li>');");
                    context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">" + dr["title"] + "</a>');");
                    context.Response.Write("document.write('</li>');\n");
                }
                context.Response.Write("document.write('</ul>');\n");
                break;

            case 2:     //图片
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                    context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                    context.Response.Write("document.write('</a>');");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                        context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                        context.Response.Write("document.write('</a>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 3:     //幻灯片
                StringBuilder picTitle = new StringBuilder();
                StringBuilder picUrl   = new StringBuilder();
                StringBuilder picLink  = new StringBuilder();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.view_num)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    picUrl.Append(dr["file_path"].ToString());
                    picLink.Append(dr["link_url"].ToString());
                    if (i < ds.Tables[0].Rows.Count - 1)
                    {
                        picUrl.Append("|");
                        picLink.Append("|");
                    }
                }
                context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" d=scriptmain name=scriptmain codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\">');\n");
                context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                context.Response.Write("document.write('<param name=\"loop\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                context.Response.Write("document.write('<embed src=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" loop=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" menu=\"false\"></embed>');\n");
                context.Response.Write("document.write('</object>');\n");
                break;

            case 4:     //动画
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                    context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                    context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                    context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                    context.Response.Write("document.write('</embed>');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                        context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                        context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                        context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                        context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                        context.Response.Write("document.write('</embed>');\n");
                        context.Response.Write("document.write('</object>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 5:    //视频
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=" + aModel.view_width + " height=" + aModel.view_height + " viewastext>');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/player.swf\" />');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\" />');\n");
                    context.Response.Write("document.write('<param name=\"allowFullScreen\" value=\"true\" />');\n");
                    context.Response.Write("document.write('<param name=\"FlashVars\" value=\"vcastr_file=" + dr["file_path"].ToString() + "&LogoText=www.auto.cn&BarTransparent=30&BarColor=0xffffff&IsAutoPlay=1&IsContinue=1\" />');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                break;

            case 6:    //代码
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow       dr = ds.Tables[0].Rows[i];
                    StringBuilder sb = new StringBuilder(dr["content"].ToString());
                    sb.Replace("&lt;", "<");
                    sb.Replace("&gt;", ">");
                    sb.Replace("\"", "'");
                    context.Response.Write("document.write(\"" + sb.ToString() + "\")");
                }
                break;
            }
        }
Esempio n. 22
0
        private void ManagerFile(HttpContext context)
        {
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
            //String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);

            //根目录路径,相对路径
            String rootPath = siteConfig.webpath + siteConfig.filepath + "/"; //站点目录+上传目录
            //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
            String rootUrl = siteConfig.webpath + siteConfig.filepath + "/";
            //图片扩展名
            String fileTypes = "gif,jpg,jpeg,png,bmp";

            String currentPath    = "";
            String currentUrl     = "";
            String currentDirPath = "";
            String moveupDirPath  = "";

            String dirPath = Utils.GetMapPath(rootPath);
            String dirName = context.Request.QueryString["dir"];

            //根据path参数,设置各路径和URL
            String path = context.Request.QueryString["path"];

            path = String.IsNullOrEmpty(path) ? "" : path;
            if (path == "")
            {
                currentPath    = dirPath;
                currentUrl     = rootUrl;
                currentDirPath = "";
                moveupDirPath  = "";
            }
            else
            {
                currentPath    = dirPath + path;
                currentUrl     = rootUrl + path;
                currentDirPath = path;
                moveupDirPath  = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1");
            }

            //排序形式,name or size or type
            String order = context.Request.QueryString["order"];

            order = String.IsNullOrEmpty(order) ? "" : order.ToLower();

            //不允许使用..移动到上一级目录
            if (Regex.IsMatch(path, @"\.\."))
            {
                context.Response.Write("Access is not allowed.");
                context.Response.End();
            }
            //最后一个字符不是/
            if (path != "" && !path.EndsWith("/"))
            {
                context.Response.Write("Parameter is not valid.");
                context.Response.End();
            }
            //目录不存在或不是目录
            if (!Directory.Exists(currentPath))
            {
                context.Response.Write("Directory does not exist.");
                context.Response.End();
            }

            //遍历目录取得文件信息
            string[] dirList  = Directory.GetDirectories(currentPath);
            string[] fileList = Directory.GetFiles(currentPath);

            switch (order)
            {
            case "size":
                Array.Sort(dirList, new NameSorter());
                Array.Sort(fileList, new SizeSorter());
                break;

            case "type":
                Array.Sort(dirList, new NameSorter());
                Array.Sort(fileList, new TypeSorter());
                break;

            case "name":
            default:
                Array.Sort(dirList, new NameSorter());
                Array.Sort(fileList, new NameSorter());
                break;
            }

            Hashtable result = new Hashtable();

            result["moveup_dir_path"]  = moveupDirPath;
            result["current_dir_path"] = currentDirPath;
            result["current_url"]      = currentUrl;
            result["total_count"]      = dirList.Length + fileList.Length;
            List <Hashtable> dirFileList = new List <Hashtable>();

            result["file_list"] = dirFileList;
            for (int i = 0; i < dirList.Length; i++)
            {
                DirectoryInfo dir  = new DirectoryInfo(dirList[i]);
                Hashtable     hash = new Hashtable();
                hash["is_dir"]   = true;
                hash["has_file"] = (dir.GetFileSystemInfos().Length > 0);
                hash["filesize"] = 0;
                hash["is_photo"] = false;
                hash["filetype"] = "";
                hash["filename"] = dir.Name;
                hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            for (int i = 0; i < fileList.Length; i++)
            {
                FileInfo  file = new FileInfo(fileList[i]);
                Hashtable hash = new Hashtable();
                hash["is_dir"]   = false;
                hash["has_file"] = false;
                hash["filesize"] = file.Length;
                hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0);
                hash["filetype"] = file.Extension.Substring(1);
                hash["filename"] = file.Name;
                hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8");
            context.Response.Write(JsonMapper.ToJson(result));
            context.Response.End();
        }
Esempio n. 23
0
 private int GetIsLoginAndIsStaticstatus()
 {
     Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();
     //取得管理员登录信息
     Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
     if (adminInfo == null)
         return  -1;
     else if (!new BLL.managers.manager_role().Exists(adminInfo.role_id, "app_builder_html", OSEnums.ActionEnum.Build.ToString()))
         return -2;
     else if (siteConfig.staticstatus != 2)
         return -3;
     else
         return 1;
 }
Esempio n. 24
0
        /// <summary>
        /// 重写Url
        /// </summary>
        /// <param name="sender">事件的源</param>
        /// <param name="e">包含事件数据的 EventArgs</param>
        private void ReUrl_BeginRequest(object sender, EventArgs e)
        {
            string      aspxPath    = "Aspx"; //站点aspx文件目录
            HttpContext context     = ((HttpApplication)sender).Context;
            string      requestPath = context.Request.Path.ToLower();

            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig(); //获得站点配置信息
            string patternPath = siteConfig.webpath;

            //当使用伪地址时
            if (siteConfig.staticstatus == 1)
            {            //遍历URL字典
                foreach (Model.configs.url_rewrite model in SiteUrls.GetSiteUrls().Urls)
                {
                    //遍历URL字典的子节点
                    foreach (Model.configs.url_rewrite_item item in model.url_rewrite_items)
                    {
                        string newPattern = Utils.GetUrlExtension(item.pattern, siteConfig.staticextension); //替换扩展名
                        //如果与URL节点匹配则重写
                        if (Regex.IsMatch(requestPath, string.Format("^{0}{1}$", patternPath, newPattern), RegexOptions.None | RegexOptions.IgnoreCase))
                        {
                            string queryString = Regex.Replace(requestPath, string.Format("{0}{1}", patternPath, newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                            context.RewritePath(string.Format("{0}{1}/{2}", siteConfig.webpath, YLKeys.DIRECTORY_REWRITE_ASPX, model.page), string.Empty, queryString);
                            return;
                        }
                    }
                }
            }
            else if (siteConfig.staticstatus == 2)
            {
                //遍历URL字典
                foreach (Model.configs.url_rewrite model in SiteUrls.GetSiteUrls().Urls)
                {
                    //遍历URL字典的子节点
                    foreach (Model.configs.url_rewrite_item item in model.url_rewrite_items)
                    {
                        string newPattern = Utils.GetUrlExtension(item.pattern, siteConfig.staticextension); //替换扩展名
                        //如果与URL节点匹配则重写
                        if (Regex.IsMatch(requestPath, string.Format("^{0}{1}$", patternPath, newPattern), RegexOptions.None | RegexOptions.IgnoreCase))
                        {
                            string queryString = Regex.Replace(requestPath, string.Format("{0}{1}", patternPath, newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                            context.RewritePath(string.Format("{0}{1}/{2}", siteConfig.webpath, "html", model.page), string.Empty, queryString);
                            return;
                        }
                    }
                }
            }

            //以下为兼容net4.0
            bool isAspxFile = false;

            if (requestPath.LastIndexOf(".") >= 0)
            {
                if (requestPath.Substring(requestPath.LastIndexOf(".")) == ".aspx")
                {
                    isAspxFile = true;
                }
            }
            //以下重写URL
            if (!requestPath.StartsWith(siteConfig.webpath + "ashx/") && !requestPath.StartsWith(siteConfig.webpath + siteConfig.webmanagepath.ToLower() + "/") && isAspxFile)
            {
                context.RewritePath(siteConfig.webpath + aspxPath + requestPath);
                return;
            }
        }