private List <HtmlTag> GetChildNodes()
        {
            List <HtmlTag> nodes = new List <HtmlTag>();

            if (EndTagType != EndTag.EndTag)
            {
                return(nodes);
            }
            string tempInner = InnerHtml.Replace('\n', ' ').Replace('\0', ' ');
            var    temp      = Regex.Matches(tempInner, @"(?!</)(<(\w+).*?>)", RegexOptions.Compiled | RegexOptions.IgnoreCase);

            while (temp.Count > 0)
            {
                EndTag endType = EndTag.SelfEnd;
                var    node    = new HtmlTag();
                node.Name = temp[0].Groups[2].Value.ToUpper();
                var s = Regex.Matches(temp[0].Value, @"\w+");
                if (s.Count > 0)
                {
                    node.Html = TagReader.ReadToEndTag(tempInner, node.Name, temp[0], out endType);
                }
                tempInner       = tempInner.Substring(node.Html.Length);
                temp            = Regex.Matches(tempInner, @"(?!</)(<(\w+).*?>)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                node.EndTagType = endType;
                nodes.Add(node);
            }
            return(nodes);
        }
Exemple #2
0
        internal override string show()
        {
            if (Provider.Request["genericFormForm"] == this.Id.ToString())
            {
                string rowFormat = "<tr><td valign=top>{0} :</td><td valign=top>{1}</td></tr>";

                StringBuilder sbMsg = new StringBuilder();
                sbMsg.Append("<table>");
                foreach (string key in Provider.Request.Form.AllKeys)
                {
                    if (key == "genericFormForm")
                    {
                        continue;                           //***
                    }
                    sbMsg.AppendFormat(rowFormat, key, Provider.Request[key]);
                }
                sbMsg.Append("</table>");
                sbMsg.Append("<hr/>");
                sbMsg.Append("<table>");
                sbMsg.AppendFormat(rowFormat, Provider.GetModuleResource("Date"), DateTime.Now);
                sbMsg.AppendFormat(rowFormat, Provider.GetModuleResource("User"), Provider.User.Name + " (ID: " + Provider.User.Id + ")");
                sbMsg.AppendFormat(rowFormat, Provider.GetModuleResource("IP"), Provider.Request.UserHostAddress);
                sbMsg.AppendFormat(rowFormat, Provider.GetModuleResource("Referrer"), Provider.Request.UrlReferrer.ToString());
                sbMsg.AppendFormat(rowFormat, Provider.GetModuleResource("User Agent"), Provider.Request.UserAgent);
                sbMsg.Append("</table>");

                try
                {
                    if (InnerHtml.Contains("_CAPTCHA_") && Provider.Session["captcha"].ToString() != Provider.Request["capt"])
                    {
                        throw new Exception("Lütfen işlem sonucunu tekrar giriniz.");
                    }

                    Provider.SendMailWithAttachment(this.Subject, sbMsg.ToString());
                    return(thanksMessage);
                }
                catch (Exception ex)
                {
                    errorMessage = ex.Message.Replace("\n", "<br/>\n");
                }
            }

            var r = new Random();
            int a = r.Next(10) + 1;
            int b = r.Next(10) + 1;

            Provider.Session["captcha"] = (a + b).ToString();
            string captcha = "<span class=\"capCont\"><label>" + (a + " + " + b + " = ? </label>");

            captcha += "<input class=\"capt\" type=\"text\" name=\"capt\" value=\"\" size=\"3\"/><br/></span>";

            InnerHtml = InnerHtml.Replace("_CAPTCHA_", captcha);

            return(base.show());
        }