protected void Page_Load(object sender, EventArgs e) { if (!CheckPermissions(false)) { return; } int eventId = QueryHelper.GetInteger("eventid", 0); EventLogInfo ev = EventLogProvider.GetEventLogInfo(eventId); // Set edited object EditedObject = ev; if (ev != null) { UTF8Encoding enc = new UTF8Encoding(); string text = HTMLHelper.StripTags(HttpUtility.HtmlDecode(EventLogHelper.GetEventText(ev))); byte[] file = enc.GetBytes(text); Response.AddHeader("Content-disposition", "attachment; filename=eventdetails.txt"); Response.ContentType = "text/plain"; Response.BinaryWrite(file); RequestHelper.EndResponse(); } }
/// <summary> /// Loads data of specific EventLog from DB. /// </summary> protected void LoadData() { EventLogInfo ev = EventLogProvider.GetEventLogInfo(eventId); //Set edited object EditedObject = ev; if (ev != null) { string eventType = ValidationHelper.GetString(ev.GetValue("EventType"), string.Empty); // Rewrite event type text. lblEventTypeValue.Text = EventLogHelper.GetEventTypeText(eventType); lblEventIDValue.Text = ValidationHelper.GetString(ev.GetValue("EventID"), string.Empty); lblEventTimeValue.Text = ValidationHelper.GetString(ev.GetValue("EventTime"), string.Empty); lblSourceValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("Source"), string.Empty)); lblEventCodeValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventCode"), string.Empty)); lblUserIDValue.Text = ValidationHelper.GetString(ev.GetValue("UserID"), string.Empty); plcUserID.Visible = (lblUserIDValue.Text != string.Empty); lblUserNameValue.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(ValidationHelper.GetString(ev.GetValue("UserName"), string.Empty))); plcUserName.Visible = (lblUserNameValue.Text != string.Empty); lblIPAddressValue.Text = ValidationHelper.GetString(ev.GetValue("IPAddress"), string.Empty); lblNodeIDValue.Text = ValidationHelper.GetString(ev.GetValue("NodeID"), string.Empty); plcNodeID.Visible = (lblNodeIDValue.Text != string.Empty); lblNodeNameValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("DocumentName"), string.Empty)); plcNodeName.Visible = (lblNodeNameValue.Text != string.Empty); string description = HTMLHelper.StripTags(ValidationHelper.GetString(ev.GetValue("EventDescription"), string.Empty).Replace("<br />", "\r\n").Replace("<br/>", "\r\n")); lblEventDescriptionValue.Text = HTMLHelper.EnsureLineEnding(HTMLHelper.HTMLEncode(description), "<br />"); if (!DataHelper.IsEmpty(ev.GetValue("SiteID"))) { SiteInfo si = SiteInfoProvider.GetSiteInfo(Convert.ToInt32(ev.GetValue("SiteID"))); if (si != null) { lblSiteNameValue.Text = HTMLHelper.HTMLEncode(si.DisplayName); } } else { plcSite.Visible = false; } lblMachineNameValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventMachineName"), string.Empty)); lblEventUrlValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUrl"), string.Empty)); lblUrlReferrerValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUrlReferrer"), string.Empty)); lblUserAgentValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUserAgent"), string.Empty)); } }
/// <summary> /// Returns system information. /// </summary> private static string GetSystemInformation() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("CMS version: {0} Build: {1}", CMSVersion.MainVersion, CMSVersion.GetVersion(true, true, true, true)); sb.AppendLine(); sb.AppendFormat("OS version: {0}", Environment.OSVersion); sb.AppendLine(); LicenseKeyInfo licenseKey = null; if (SiteContext.CurrentSite != null) { licenseKey = LicenseKeyInfoProvider.GetLicenseKeyInfo(SiteContext.CurrentSite.DomainName); } if (licenseKey != null) { sb.AppendFormat("License info: {0}, {1}, {2}, {3}", licenseKey.Domain, licenseKey.Edition, licenseKey.ExpirationDateReal.ToString(DateTimeHelper.DefaultIFormatProvider), licenseKey.Version); string packages = ValidationHelper.GetString(licenseKey.GetValue("LicensePackages"), string.Empty); if (!string.IsNullOrEmpty(packages)) { sb.AppendFormat(", {0}", packages); } } int eventId = QueryHelper.GetInteger("eventid", 0); if (eventId > 0) { EventLogInfo ev = EventLogProvider.GetEventLogInfo(eventId); if (ev != null) { sb.AppendLine(); sb.Append(HttpUtility.HtmlDecode(EventLogHelper.GetEventText(ev))); } } return(sb.ToString()); }