private String LoadChildren() { StringBuilder sbChildList = new StringBuilder(); foreach (int child in Children) { Topic t = new Topic(child); sbChildList.Append("<p align=\"left\">"); sbChildList.Append("   <img border=\"0\" src=\"" + AppLogic.LocateImageURL("App_Themes/skin_" + ThisCustomer.SkinID.ToString() + "/images/redarrow.gif", ThisCustomer.LocaleSetting) + "\"></img> "); sbChildList.Append("<a href=\"" + SE.MakeDriver2Link(XmlCommon.GetLocaleEntry(t.TopicName, ThisCustomer.LocaleSetting, true)) + "\">"); sbChildList.Append(XmlCommon.GetLocaleEntry(t.SectionTitle, ThisCustomer.LocaleSetting, true)); sbChildList.Append("</a>"); sbChildList.Append("</p>"); } return(sbChildList.ToString()); }
private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the Topic, IF those Topic results are not "empty strings" protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (TopicName.Length != 0) { Contents.Text = "Topic: " + TopicName; } else { Contents.Text = "Topic"; } } else { m_SkinBase = (SkinBase)this.Page; try { if (m_SkinBase != null) { if (TopicID != 0) { m_T = new Topic(TopicID, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser); } else { m_T = new Topic(TopicName, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser); } m_SkinID = m_SkinBase.ThisCustomer.SkinID; m_LocaleSetting = m_SkinBase.ThisCustomer.LocaleSetting; } else { m_LocaleSetting = Localization.GetDefaultLocale(); if (TopicID != 0) { m_T = new Topic(TopicID, m_LocaleSetting, m_SkinID, null); } else { m_T = new Topic(TopicName, m_LocaleSetting, m_SkinID, null); } } StringBuilder tmpS = new StringBuilder(4096); String xpdd = m_SkinBase.ThisCustomer.ThisCustomerSession["Topic" + XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)]; if (xpdd.Length != 0) { // don't let decrypt failure crash, just set xpdd to string.empty so it fails. try { xpdd = Security.UnmungeString(xpdd); } catch { xpdd = String.Empty; // some kind of decrypt failure, deny access, not sure what else to do here. } } if (EnforcePassword && m_T.Password.Length != 0 && xpdd != m_T.Password) { String Url = String.Empty; if (CommonLogic.GetThisPageName(false).Equals("driver.aspx", StringComparison.InvariantCultureIgnoreCase)) { Url = SE.MakeDriverLink(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)); } else { Url = SE.MakeDriver2Link(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)); } tmpS.Append("<form method=\"POST\" action=\"" + Url + "\">\n"); tmpS.Append("<p><b>"); tmpS.Append(AppLogic.GetString("driver.aspx.1", m_SkinID, m_LocaleSetting)); tmpS.Append("</b></p>\n"); tmpS.Append("<p>"); tmpS.Append(AppLogic.GetString("driver.aspx.2", m_SkinID, m_LocaleSetting)); tmpS.Append(" <input type=\"text\" name=\"Password\" size=\"20\" maxlength=\"100\"><input type=\"submit\" value=\""); tmpS.Append(AppLogic.GetString("driver.aspx.5", m_SkinID, m_LocaleSetting)); tmpS.Append("\" name=\"B1\"></p>\n"); tmpS.Append("</form>\n"); m_SkinBase.ThisCustomer.RequireCustomerRecord(); } else { if (EnforceDisclaimer && m_T.RequiresDisclaimer && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + HttpContext.Current.Server.UrlEncode(ThisPageURL)); } if (EnforceSubscription && m_T.RequiresSubscription && m_SkinBase.ThisCustomer.SubscriptionExpiresOn.AddDays((double)AppLogic.AppConfigNativeInt("SubscriptionExpiredGracePeriod")) < System.DateTime.Now) { String Msg = AppLogic.AppConfig("Suscription.ExpiredMessageWhenViewingTopic"); if (Msg.Length == 0) { Msg = "<p><b>" + AppLogic.GetString("driver.aspx.3", m_SkinID, m_LocaleSetting) + "</b></p>"; } tmpS.Append(Msg); } else { tmpS.Append("<!-- READ FROM "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE")); tmpS.Append(" -->"); tmpS.Append(m_T.Contents); tmpS.Append("<!-- END OF "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE")); tmpS.Append(" -->"); } } Contents.Text = tmpS.ToString(); } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (m_SkinBase != null && m_AllowSEPropogation && m_T != null) { if (m_T.SectionTitle.Length != 0) { m_SkinBase.SectionTitle = m_T.SectionTitle; } if (m_T.SETitle.Length != 0) { m_SkinBase.SETitle = m_T.SETitle; } if (m_T.SEKeywords.Length != 0) { m_SkinBase.SEKeywords = m_T.SEKeywords; } if (m_T.SEDescription.Length != 0) { m_SkinBase.SEDescription = m_T.SEDescription; } if (m_T.SENoScript.Length != 0) { m_SkinBase.SENoScript = m_T.SENoScript; } } } }
private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the Topic, IF those Topic results are not "empty strings" protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (TopicName.Length != 0) { Contents.Text = "Topic: " + TopicName; } else { Contents.Text = "Topic"; } } else { try { if (Page != null) { m_T = new Topic(TopicName.Replace("-", " "), ThisCustomer.LocaleSetting, ThisCustomer.SkinID, Page.GetParser); m_SkinID = ThisCustomer.SkinID; m_LocaleSetting = ThisCustomer.LocaleSetting; } else { m_LocaleSetting = Localization.WebConfigLocale; m_T = new Topic(TopicName.Replace("-", " "), m_LocaleSetting, m_SkinID, null); } if (m_T.ShowOnWeb == false && (Request.Url.LocalPath.Contains("driver.aspx") || Request.Url.LocalPath.Contains("driver2.aspx"))) { //If topic does not exists redirect to 404 error page. HttpContext.Current.Response.Redirect("~/t-error404.aspx"); } StringBuilder tmpS = new StringBuilder(4096); string password = string.Empty; if (m_T.Password.Length != 0) { password = InterpriseHelper.TopicPassword(m_T.TopicID, m_LocaleSetting); } string xpdd = m_SkinBase.ThisCustomer.ThisCustomerSession["Topic" + XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)]; if (EnforcePassword && m_T.Password.Length != 0 && xpdd != password) { string Url = string.Empty; bool isDriverEquals = "driver.aspx".Equals(CommonLogic.GetThisPageName(false), StringComparison.InvariantCultureIgnoreCase); Url = CommonLogic.IIF(isDriverEquals, SE.MakeDriverLink(m_T.TopicName), SE.MakeDriver2Link(m_T.TopicName)); tmpS.Append("<form method=\"POST\" action=\"" + Url + "\">\n"); tmpS.Append("<p><b>"); tmpS.Append(AppLogic.GetString("driver.aspx.1", m_SkinID, m_LocaleSetting)); tmpS.Append("</b></p>\n"); tmpS.Append("<p>"); tmpS.Append(AppLogic.GetString("driver.aspx.2", m_SkinID, m_LocaleSetting)); tmpS.Append(" <input type=\"password\" name=\"Password\" size=\"20\" maxlength=\"100\" TextMode=\"Password\"><input type=\"submit\" value=\""); tmpS.Append(AppLogic.GetString("driver.aspx.4", m_SkinID, m_LocaleSetting)); tmpS.Append("\" name=\"B1\"></p>\n"); tmpS.Append("</form>\n"); } else { if (EnforceDisclaimer && m_T.RequiresDisclaimer && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0) { string ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } if (EnforceSubscription && m_T.RequiresSubscription && ThisCustomer.SubscriptionExpiresOn < System.DateTime.Now) { tmpS.Append("<p><b>" + AppLogic.GetString("driver.aspx.3", m_SkinID, m_LocaleSetting) + "</b></p>"); } else { tmpS.Append("<!-- READ FROM "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE: " + m_T.FN)); tmpS.Append(" -->"); tmpS.Append(m_T.Contents); tmpS.Append("<!-- END OF "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE: " + m_T.FN)); tmpS.Append(" -->"); } } Contents.Text = tmpS.ToString(); } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (Page != null && m_AllowSEPropogation) { if (m_T.SectionTitle.Length != 0) { Page.SectionTitle = m_T.SectionTitle; } if (m_T.SETitle.Length != 0) { Page.SETitle = m_T.SETitle; } if (m_T.SEKeywords.Length != 0) { Page.SEKeywords = m_T.SEKeywords; } if (m_T.SEDescription.Length != 0) { Page.SEDescription = m_T.SEDescription; } if (m_T.SENoScript.Length != 0) { Page.SENoScript = m_T.SENoScript; } } } }