Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckPermissions(false))
        {
            return;
        }

        int          eventId = QueryHelper.GetInteger("eventid", 0);
        EventLogInfo ev      = EventLogInfo.Provider.Get(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>
    /// 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());
    }