Пример #1
0
 /// <summary>
 /// 栏目页
 /// </summary>
 public static string Class(bool _isHtml, string _siteDir, bool urlRewrite, int page)
 {
     string strXmlFile = HttpContext.Current.Server.MapPath(_siteDir + "_data/config/pageformat.config");
     JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
     string TempUrl = "";
     if (_isHtml)
     {
         if (page == 1)
             TempUrl = XmlTool.GetText("Pages/Class/P_2_1");
         else
             TempUrl = XmlTool.GetText("Pages/Class/P_2_N");
     }
     else
     {
         if (urlRewrite)
             if (page == 1)
                 TempUrl = XmlTool.GetText("Pages/Class/P_1_1");
             else
                 TempUrl = XmlTool.GetText("Pages/Class/P_1_N");
         else
             if (page == 1)
                 TempUrl = XmlTool.GetText("Pages/Class/P_0_1");
             else
                 TempUrl = XmlTool.GetText("Pages/Class/P_0_N");
     }
     XmlTool.Dispose();
     return TempUrl;
 }
Пример #2
0
 static DiscuzSessionHelper()
 {
     string strXmlFile = System.Web.HttpContext.Current.Server.MapPath("~/_data/config/site.config");
     JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
     apikey = XmlTool.GetText("Root/ForumAPIKey");//API Key
     secret = XmlTool.GetText("Root/ForumSecret");//密钥
     url = XmlTool.GetText("Root/ForumUrl");//论坛地址
     XmlTool.Dispose();
     ds = new DiscuzSession(apikey, secret, url);
 }
Пример #3
0
 /// <summary>
 /// 频道首页
 /// </summary>
 public static string Channel(string _siteDir, bool urlRewrite)
 {
     string strXmlFile = HttpContext.Current.Server.MapPath(_siteDir + "_data/config/pageformat.config");
     JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
     string TempUrl = "";
     if (urlRewrite)
         TempUrl = XmlTool.GetText("Pages/Channel/P_1");
     else
         TempUrl = XmlTool.GetText("Pages/Channel/P_0");
     XmlTool.Dispose();
     return TempUrl;
 }
Пример #4
0
        public static JumboTCMS.Entity.MailServer MailServer()
        {
            JumboTCMS.Entity.Site site = (JumboTCMS.Entity.Site)System.Web.HttpContext.Current.Application["jcmsV5"];
            System.Collections.IList _FromAddresss = new System.Collections.ArrayList();
            System.Collections.IList _FromNames = new System.Collections.ArrayList();
            System.Collections.IList _FromPwds = new System.Collections.ArrayList();
            System.Collections.IList _SmtpHosts = new System.Collections.ArrayList();
            System.Collections.IList _Useds = new System.Collections.ArrayList();
            string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/jcms(emailserver).config");
            JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
            DataTable dtTemp = XmlTool.GetTable("Mails");
            XmlTool.Dispose();
            if (dtTemp.Rows.Count > 0)
            {
                dtTemp.DefaultView.Sort = "Used ASC";
                DataTable dt = dtTemp.DefaultView.ToTable();
                dtTemp.Clear();
                dtTemp.Dispose();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (string.CompareOrdinal(dt.Rows[i]["Used"].ToString(), DateTime.Now.AddSeconds(0 - site.MailTimeCycle).ToString("yyyy-MM-dd HH:mm:ss")) <= 0)//确保周期内只发送一次
                    {
                        _FromAddresss.Add(dt.Rows[i]["FromAddress"].ToString());
                        _FromNames.Add(dt.Rows[i]["FromName"].ToString());
                        _FromPwds.Add(dt.Rows[i]["FromPwd"].ToString());
                        _SmtpHosts.Add(dt.Rows[i]["SmtpHost"].ToString());
                        _Useds.Add(dt.Rows[i]["Used"].ToString());
                    }
                }
                dt.Clear();
                dt.Dispose();

                JumboTCMS.Entity.MailServer _MailServer = new JumboTCMS.Entity.MailServer();
                _MailServer.FromAddresss = _FromAddresss;
                _MailServer.FromNames = _FromNames;
                _MailServer.FromPwds = _FromPwds;
                _MailServer.SmtpHosts = _SmtpHosts;
                _MailServer.Useds = _Useds;
                return _MailServer;
            }
            else
            {
                dtTemp.Clear();
                dtTemp.Dispose();
                System.IO.StreamWriter sw = new System.IO.StreamWriter(HttpContext.Current.Server.MapPath("~/_data/log/mailerror.log"), true, System.Text.Encoding.UTF8);
                sw.WriteLine(System.DateTime.Now.ToString());
                sw.WriteLine("\tIP 地 址:" + Const.GetUserIp);
                sw.WriteLine("\t邮箱服务器配置失败");
                sw.WriteLine("---------------------------------------------------------------------------------------------------");
                sw.Close();
                return null;
            }
        }
Пример #5
0
        static Config()
        {
            string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/payment_alipay.config");
            JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
            seller_email = XmlTool.GetText("Root/seller_email");                     //商家签约时的支付宝帐号,即收款的支付宝帐号
            partner = XmlTool.GetText("Root/partner"); 		//partner合作伙伴id(必须填写)
            key = XmlTool.GetText("Root/key"); //partner 的对应交易安全校验码(必须填写)
            XmlTool.Dispose();

            return_url = JumboTCMS.Utils.App.Url + JumboTCMS.Utils.App.Path + "api/alipay/return_url.aspx";
            notify_url = JumboTCMS.Utils.App.Url + JumboTCMS.Utils.App.Path + "api/alipay/notify_url.aspx";

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

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

            //签名方式 不需修改
            sign_type = "MD5";

            //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
            transport = "https";
        }
Пример #6
0
 protected void ajaxCreateJavascript()
 {
     string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/javascript.config");
     JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
     try
     {
         XmlTool.RemoveAll("Lis");
         XmlTool.Save();
         doh.Reset();
         doh.SqlCmd = "Select [Id],[Title],[Code],[TemplateContent] FROM [jcms_normal_javascript] ORDER BY id asc";
         DataTable dt = doh.GetDataTable();
         string _id = string.Empty;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             _id = dt.Rows[i]["Id"].ToString();
             XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
             XmlTool.InsertNode("Lis", "Li", "ID", _id);
             XmlTool.InsertElement("Lis/Li[ID=\"" + _id + "\"]", "Title", dt.Rows[i]["Title"].ToString(), false);
             XmlTool.InsertElement("Lis/Li[ID=\"" + _id + "\"]", "Code", dt.Rows[i]["Code"].ToString(), true);
             XmlTool.InsertElement("Lis/Li[ID=\"" + _id + "\"]", "TemplateContent", dt.Rows[i]["TemplateContent"].ToString(), true);
             XmlTool.Save();
         }
         XmlTool.Dispose();
     }
     catch
     {
     }
 }
Пример #7
0
 /// <summary>
 /// 发送邮件
 /// </summary>
 /// <param name="MailTo">接收人用户名,单封邮件</param>
 /// <param name="MailSubject">邮件主题</param>
 /// <param name="MailBody">邮件内容</param>
 /// <param name="IsHtml">邮件正文是否为HTML格式</param>
 /// <param name="_MailServer"></param>
 /// <returns></returns>
 public static bool SendOK(string MailTo, string MailSubject, string MailBody, bool IsHtml, JumboTCMS.Entity.MailServer _MailServer)
 {
     if (_MailServer == null)
         return false;
     if (_MailServer.FromAddresss.Count == 0)
         return false;
     bool _SendOK = false;
     for (int i = 0; i < _MailServer.FromAddresss.Count; i++)
     {
         JumboTCMS.Utils.Mail.MailMessage message = new JumboTCMS.Utils.Mail.MailMessage();
         message.MaxRecipientNum = 80;//最大收件人
         message.From = System.Configuration.ConfigurationManager.AppSettings["JumboTCMS:WebmasterEmail"];
         message.FromName = _MailServer.FromNames[i].ToString();
         string[] _mail = MailTo.Split(',');
         for (int j = 0; j < _mail.Length; j++)
         {
             message.AddRecipients(_mail[j]);
         }
         message.Subject = MailSubject;
         if (IsHtml)
             message.BodyFormat = JumboTCMS.Utils.Mail.MailFormat.HTML;
         else
             message.BodyFormat = JumboTCMS.Utils.Mail.MailFormat.Text;
         message.Priority = JumboTCMS.Utils.Mail.MailPriority.Normal;
         message.Body = MailBody;
         JumboTCMS.Utils.Mail.SmtpClient smtp = new JumboTCMS.Utils.Mail.SmtpClient(_MailServer.SmtpHosts[i].ToString(), Convert.ToInt16(_MailServer.SmtpPorts[i].ToString()));
         if (smtp.Send(message, _MailServer.FromAddresss[i].ToString(), _MailServer.FromPwds[i].ToString()))
         {
             string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/jcms(emailserver).config");
             JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
             XmlTool.Update("Mails/Mail[FromAddress=\"" + _MailServer.FromAddresss[i].ToString() + "\"]/Used", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
             XmlTool.Save();
             XmlTool.Dispose();
             _SendOK = true;
             SaveSucLog(MailTo, _MailServer.FromAddresss[i].ToString(), _MailServer.FromNames[i].ToString(), _MailServer.SmtpHosts[i].ToString());
             break;//跳出循环
         }
         else
         {
             SaveErrLog(MailTo, _MailServer.FromAddresss[i].ToString(), _MailServer.FromNames[i].ToString(), _MailServer.SmtpHosts[i].ToString(), smtp.ErrMsg + "\r\n当前共有:" + _MailServer.FromAddresss.Count + "个发件人在队列中.");
             continue;
         }
         //try
         //{
         //    System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
         //    message.From = new System.Net.Mail.MailAddress(_MailServer.FromAddresss[i].ToString(), _MailServer.FromNames[i].ToString(), Encoding.GetEncoding("gb2312"));
         //    string[] _mail = MailTo.Split(',');
         //    for (int j = 0; j < _mail.Length; j++)
         //    {
         //        message.To.Add(_mail[j]);
         //    }
         //    message.Subject = MailSubject;
         //    message.Body = MailBody;
         //    message.IsBodyHtml = IsHtml;
         //    message.Priority = System.Net.Mail.MailPriority.Normal;
         //    message.BodyEncoding = Encoding.GetEncoding("gb2312");
         //    System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(_MailServer.SmtpHosts[i].ToString());
         //    smtp.Credentials = new System.Net.NetworkCredential(_MailServer.FromAddresss[i].ToString(), _MailServer.FromPwds[i].ToString());
         //    smtp.Send(message);
         //    string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/jcms(emailserver).config");
         //    JumboTCMS.DBUtility.XmlControl XmlTool = new JumboTCMS.DBUtility.XmlControl(strXmlFile);
         //    XmlTool.Update("Mails/Mail[FromAddress=\"" + _MailServer.FromAddresss[i].ToString() + "\"]/Used", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
         //    XmlTool.Save();
         //    XmlTool.Dispose();
         //    _SendOK = true;
         //    break;//跳出循环
         //}
         //catch (Exception)
         //{ }
     }
     return _SendOK;
 }