Ejemplo n.º 1
0
        private void PutSystemLabel(string labelname, XmlNodeList bnode)
        {
            string        labelName = labelname;
            List <string> list      = new List <string>();

            list.Add("webmaster");
            list.Add("webmasteremail");
            list.Add("managedir");
            list.Add("readfile");
            if (list.Contains(labelname))
            {
                this.PutErrMessage(labelname + "标签禁止AJAX访问!");
            }
            else
            {
                foreach (XmlNode node in bnode)
                {
                    if (node.FirstChild != null)
                    {
                        string str2 = labelName;
                        labelName = str2 + " " + node.FirstChild.Name.Trim() + "=\"" + node.FirstChild.InnerText.Trim() + "\"";
                    }
                }
                this.XmlResponseWriter.WriteElementString("status", "ok");
                this.XmlResponseWriter.WriteElementString("body", LabelTransform.GetSiteConfigLabel(labelName).ToString());
            }
        }
        /// <summary>
        ///  系统标签转换
        /// </summary>
        /// <param name="templateInfo"></param>
        /// <param name="queryList"></param>
        private void SystemLabeTransform(TemplateInfo templateInfo, NameValueCollection queryList)
        {
            string pattern = "@Request(int|Bool|Date|Dec)?_";

            foreach (Match match in Regex.Matches(templateInfo.TemplateContent, pattern, RegexOptions.IgnoreCase))
            {
                for (int i = 0; i < queryList.Count; i++)
                {
                    string str4 = match.Groups[1].Value.ToLower();
                    if (str4 == null)
                    {
                        goto Label_0185;
                    }
                    if (!(str4 == "int"))
                    {
                        if (str4 == "bool")
                        {
                            goto Label_00D4;
                        }
                        if (str4 == "date")
                        {
                            goto Label_0112;
                        }
                        if (str4 == "dec")
                        {
                            goto Label_014A;
                        }
                        goto Label_0185;
                    }
                    templateInfo.TemplateContent = Regex.Replace(templateInfo.TemplateContent, match.Value + queryList.GetKey(i), DataConverter.CLng(queryList.Get(i)).ToString(), RegexOptions.IgnoreCase);
                    continue;
Label_00D4:
                    templateInfo.TemplateContent = Regex.Replace(templateInfo.TemplateContent, match.Value + queryList.GetKey(i), DataConverter.CBoolean(queryList.Get(i)).ToString(), RegexOptions.IgnoreCase);
                    continue;
Label_0112:
                    templateInfo.TemplateContent = Regex.Replace(templateInfo.TemplateContent, match.Value + queryList.GetKey(i), this.SysCDate(queryList.Get(i)).ToString(), RegexOptions.IgnoreCase);
                    continue;
Label_014A:
                    templateInfo.TemplateContent = Regex.Replace(templateInfo.TemplateContent, match.Value + queryList.GetKey(i), DataConverter.CDecimal(queryList.Get(i)).ToString(), RegexOptions.IgnoreCase);
                    continue;
Label_0185:
                    templateInfo.TemplateContent = Regex.Replace(templateInfo.TemplateContent, match.Value + queryList.GetKey(i), DataSecurity.FilterBadChar(queryList.Get(i)), RegexOptions.IgnoreCase);
                }
            }
            pattern = @"{PE\.SiteConfig\.(([\s\S](?!{PE))*?)\/}";
            foreach (Match match2 in Regex.Matches(templateInfo.TemplateContent, pattern, RegexOptions.IgnoreCase))
            {
                if (match2.Groups.Count > 1)
                {
                    string siteConfigLabel = LabelTransform.GetSiteConfigLabel(match2.Groups[1].Value.Trim().ToLower());
                    templateInfo.TemplateContent = templateInfo.TemplateContent.Replace(match2.Value, siteConfigLabel);
                }
                else
                {
                    templateInfo.TemplateContent = templateInfo.TemplateContent.Replace(match2.Value, "[err:系统标签'" + match2.Value.Replace("{", string.Empty).Replace("}", string.Empty) + "'错误!]");
                }
            }
        }