コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup page title text and image
        CurrentMaster.Title.TitleText  = GetString("Licenses_License_View.Title");
        CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_LicenseKey/object.png");

        lblLicenseKey.Text      = GetString("Licenses_License_View.LicenseKey");
        string[,] pageTitleTabs = new string[2, 3];
        pageTitleTabs[0, 0]     = GetString("Licenses_License_View.LicenseList");
        pageTitleTabs[0, 1]     = "~/CMSModules/Licenses/Pages/License_List.aspx";
        pageTitleTabs[0, 2]     = "";
        pageTitleTabs[1, 0]     = "";
        pageTitleTabs[1, 1]     = "";
        pageTitleTabs[1, 2]     = "";

        if (ValidationHelper.GetInteger(Request.QueryString["licenseid"], 0) != 0)
        {
            LicenseKeyInfo lki = LicenseKeyInfoProvider.GetLicenseKeyInfo(ValidationHelper.GetInteger(Request.QueryString["licenseid"], 0));
            if (lki != null)
            {
                pageTitleTabs[1, 0]       = lki.Domain;
                lblLicenseKeyContent.Text = lki.Key;
            }
        }

        CurrentMaster.Title.Breadcrumbs = pageTitleTabs;
    }
コード例 #2
0
    /// <summary>
    /// External data binding handler.
    /// </summary>
    object UniGridLicenses_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLower())
        {
        case "editionname":
            string edition = ValidationHelper.GetString(parameter, "").ToLower();
            try
            {
                return(LicenseHelper.GetEditionName(LicenseKeyInfoProvider.CharToEdition(edition)));
            }
            catch
            {
                return("#UNKNOWN#");
            }

        case "expiration":
            return(GetString(Convert.ToString(parameter)));

        case "licenseservers":
            int count = ValidationHelper.GetInteger(parameter, -1);
            if (count == LicenseKeyInfo.SERVERS_UNLIMITED)
            {
                return(GetString("general.unlimited"));
            }
            else if (count > 0)
            {
                return(count.ToString());
            }
            return(String.Empty);
        }
        return(parameter);
    }
コード例 #3
0
 /// <summary>
 /// Handles the UniGrid's OnAction event.
 /// </summary>
 /// <param name="actionname">Name of item (button) that throws event</param>
 /// <param name="actionargument">ID (value of Primary key) of corresponding data row</param>
 private void Control_OnAction(string actionname, object actionargument)
 {
     if (actionname == "delete")
     {
         LicenseKeyInfoProvider.DeleteLicenseKeyInfo(Convert.ToInt32(actionargument));
     }
 }
コード例 #4
0
 /// <summary>
 /// Check if license for current domain is valid. Try to add trial license if possible.
 /// </summary>
 private void CheckLicense()
 {
     // Try to add trial license
     if (CreateDBObjects)
     {
         if (AddTrialLicenseKeys())
         {
             if (hostName != "localhost" && hostName != "127.0.0.1")
             {
                 // Check if license key for current domain is present
                 LicenseKeyInfo lki = LicenseKeyInfoProvider.GetLicenseKeyInfo(hostName);
                 wzdInstaller.ActiveStepIndex = (lki == null) ? 4 : 5;
             }
             else
             {
                 wzdInstaller.ActiveStepIndex = 5;
             }
         }
         else
         {
             wzdInstaller.ActiveStepIndex = 4;
             ucLicenseDialog.SetLicenseExpired();
         }
     }
 }
コード例 #5
0
ファイル: List.ascx.cs プロジェクト: isatriya/kentico10
    private void HideUiPartsNotRelevantInLowerEditions()
    {
        var isFullContactManagementAvailable = LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.FullContactManagement);

        gridElem.NamedColumns["ContactStatusID"].Visible  = isFullContactManagementAvailable;
        gridElem.NamedColumns["ContactCountryID"].Visible = isFullContactManagementAvailable;
    }
コード例 #6
0
        private static bool AllowContextMacros()
        {
            var settingsService = Service.Resolve <ISettingsService>();
            var siteService     = Service.Resolve <ISiteService>();
            var site            = siteService.CurrentSite as SiteInfo;
            var license         = LicenseKeyInfoProvider.GetLicenseKeyInfo(site?.DomainName);

            return((license?.Edition == ProductEditionEnum.EnterpriseMarketingSolution) && settingsService[siteService.CurrentSite?.SiteName + ".CMSEnableOnlineMarketing"].ToBoolean(false));
        }
コード例 #7
0
    /// <summary>
    /// Test if campaign is valid.
    /// </summary>
    public override bool IsValid()
    {
        String value = ValidationHelper.GetString(usCampaign.Value, String.Empty).Trim();

        if (value != String.Empty && value != UniSelector.US_NONE_RECORD.ToString())
        {
            String domain = RequestContext.CurrentDomain;
            if (DataHelper.GetNotEmpty(domain, "") != "")
            {
                string parsedDomain = LicenseKeyInfoProvider.ParseDomainName(domain);
                if (!LicenseKeyInfoProvider.IsFeatureAvailable(parsedDomain, FeatureEnum.CampaignAndConversions))
                {
                    ValidationError = GetString("campaignselector.nolicence");
                    return(false);
                }
            }

            if (!ValidationHelper.IsCodeName(value))
            {
                ValidationError = GetString("campaign.validcodename");
                return(false);
            }

            // If campaign object not found
            CampaignInfo ci = CampaignInfoProvider.GetCampaignInfo(value, SiteInfoProvider.GetSiteName(SiteID));

            // Handle info not found
            if (ci == null)
            {
                if (!CreateOnUnknownName)
                {
                    // Selector is not set to create new campaigns so error out
                    ValidationError = GetString("campaign.validcodename");
                    return(false);
                }

                // Or check permissions ..
                if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageCampaigns"))
                {
                    ValidationError = GetString("campaign.notallowedcreate");
                    return(false);
                }

                // .. and try to create a new one.
                ci = new CampaignInfo();
                ci.CampaignName        = value;
                ci.CampaignUTMCode     = value;
                ci.CampaignDisplayName = value;
                ci.CampaignEnabled     = true;
                ci.CampaignSiteID      = SiteID;

                CampaignInfoProvider.SetCampaignInfo(ci);
            }
        }

        return(true);
    }
コード例 #8
0
    private void HideTypeSelectionForNonEMSLicenses()
    {
        var license = LicenseKeyInfoProvider.GetLicenseKeyInfo(RequestContext.CurrentDomain);

        if (license.Edition != ProductEditionEnum.EnterpriseMarketingSolution)
        {
            NewForm.FieldsToHide.Add("NewsletterType");
        }
    }
コード例 #9
0
 protected string[] Tabs_OnTabCreated(CMS.SiteProvider.UIElementInfo element, string[] parameters, int tabIndex)
 {
     // Skip objects tab element if not have proper license
     if ((element.ElementName.ToLower() == "myrecyclebin.objects") && !LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.ObjectVersioning))
     {
         return(null);
     }
     return(parameters);
 }
コード例 #10
0
 protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
 {
     // Skip objects tab element if not have proper license
     if ((element.ElementName.ToLowerCSafe() == "myrecyclebin.objects") && !LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.ObjectVersioning))
     {
         return(null);
     }
     return(tab);
 }
コード例 #11
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        errorOccured = false;
        try
        {
            LicenseKeyInfo lk = new LicenseKeyInfo();
            lk.LoadLicense(tbLicenseKey.Text.Trim(), "");

            if (lk != null)
            {
                switch (lk.ValidationResult)
                {
                case LicenseValidationEnum.Expired:
                    ShowError(GetString("Licenses_License_New.LicenseNotValid.Expired"));
                    break;

                case LicenseValidationEnum.Invalid:
                    ShowError(GetString("Licenses_License_New.LicenseNotValid.Invalid"));
                    break;

                case LicenseValidationEnum.NotAvailable:
                    ShowError(GetString("Licenses_License_New.LicenseNotValid.NotAvailable"));
                    break;

                case LicenseValidationEnum.WrongFormat:
                    ShowError(GetString("Licenses_License_New.LicenseNotValid.WrongFormat"));
                    break;

                case LicenseValidationEnum.Valid:
                    if (LicenseKeyInfoProvider.IsLicenseExistForDomain(lk))
                    {
                        // License for domain already exist
                        ShowError(GetString("Licenses_License_New.DomainAlreadyExists").Replace("%%name%%", lk.Domain));
                    }
                    else
                    {
                        // Insert license
                        LicenseKeyInfoProvider.SetLicenseKeyInfo(lk);
                        UserInfoProvider.ClearLicenseValues();
                        Functions.ClearHashtables();
                    }
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException("License", "NEW", ex);
            ShowError(GetString("general.saveerror"), ex.Message, null);
        }

        if (!errorOccured)
        {
            URLHelper.Redirect("License_List.aspx");
        }
    }
コード例 #12
0
ファイル: Filter.ascx.cs プロジェクト: isatriya/kentico10
    private void HideUiPartsNotRelevantInLowerEditions()
    {
        var isFullContactManagementAvailable = LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.FullContactManagement);

        fltContactStatus.StopProcessing       = !isFullContactManagementAvailable;
        plcFullContactProfile.Visible         = isFullContactManagementAvailable;
        plcMiddleFullContactProfile.Visible   = isFullContactManagementAvailable;
        plcAdvancedFullContactProfile.Visible = isFullContactManagementAvailable;
        plcMiddle.Visible = isFullContactManagementAvailable;
    }
コード例 #13
0
 protected void Page_Init(object sender, EventArgs e)
 {
     // Set page tabs
     InitTabs("recbin_content");
     SetTab(0, GetString("general.documents"), "RecycleBin_Documents.aspx", "SetHelpTopic('helpTopic', 'recycle_bin');");
     if (LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.ObjectVersioning))
     {
         SetTab(1, GetString("staging.objects"), "RecycleBin_Objects.aspx", "SetHelpTopic('helpTopic', 'objectsrecycle_bin');");
     }
 }
コード例 #14
0
 /// <summary>
 /// Handles the UniGrid's OnAction event.
 /// </summary>
 /// <param name="actionName">Name of item (button) that threw event</param>
 /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
 protected void UniGridLicenses_OnAction(string actionName, object actionArgument)
 {
     if (actionName == "delete")
     {
         LicenseKeyInfoProvider.DeleteLicenseKeyInfo(Convert.ToInt32(actionArgument));
     }
     else if (actionName == "view")
     {
         URLHelper.Redirect("License_View.aspx?licenseid=" + actionArgument.ToString());
     }
 }
コード例 #15
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionname">Name of item (button) that throws event</param>
    /// <param name="actionargument">ID (value of Primary key) of corresponding data row</param>
    private void Control_OnAction(string actionname, object actionargument)
    {
        if (actionname == "delete")
        {
            LicenseKeyInfoProvider.DeleteLicenseKeyInfo(Convert.ToInt32(actionargument));

            // Reload the application
            var url = URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "reload", "true");
            URLHelper.Redirect(url);
        }
    }
コード例 #16
0
    /// <summary>
    /// Initializes the license owner label.
    /// </summary>
    private void InitializeLicenseOwner()
    {
        var lic = LicenseKeyInfoProvider.GetLicenseKeyInfo(RequestContext.CurrentDomain);

        // Display the license owner if present in license
        if ((lic != null) && !string.IsNullOrEmpty(lic.Owner))
        {
            pnlLicenseOwner.Visible = true;
            lblLicenseOwner.Text    = HTMLHelper.HTMLEncode(String.Format(GetString("cms.dashboard.licenseowner"), lic.Owner));
        }
    }
コード例 #17
0
ファイル: List.ascx.cs プロジェクト: isatriya/kentico10
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get modify permission of current user
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        var editUrl = UIContextHelper.GetElementUrl(ModuleName.CONTACTMANAGEMENT, "EditContact");

        editUrl = URLHelper.AddParameterToUrl(editUrl, "objectid", "{0}");
        editUrl = URLHelper.AddParameterToUrl(editUrl, "displaytitle", "0");

        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = editUrl;
        gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
        gridElem.FilteredZeroRowsText = GetString("om.contact.nocontacts.filtered");

        if (QueryHelper.GetBoolean("deleteasync", false))
        {
            ShowConfirmation(GetString("om.contact.massdeletestarted"));
        }

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }

                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                if (LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.FullContactManagement))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }
            }
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
コード例 #18
0
 private static string GetEditionName(string editionChar)
 {
     try
     {
         ProductEditionEnum edition = LicenseKeyInfoProvider.CharToEdition(editionChar);
         return(LicenseHelper.GetEditionName(edition));
     }
     catch
     {
         return("#UNKNOWN#");
     }
 }
コード例 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing || ((NewsletterID <= 0) && (IssueID <= 0)))
        {
            return;
        }

        mAreCampaignsAvailable = LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.CampaignAndConversions);
        ToggleUTMCampaignInput();
        mUTMCampaignTextBox = GetUTMCampaignTextBox();

        ReloadData(false);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Prepare object data
        mIssue = (IssueInfo)EditedObject;
        mMonitorBouncedEmails = NewsletterHelper.MonitorBouncedEmails(CurrentSiteName);
        issueLinks.IssueID    = mIssue.IssueID;
        issueLinks.NoDataText = GetString("newsletter.issue.overviewnoclicks");

        mParentAndVariantsIDs = IssueInfoProvider.GetIssues()
                                .Column("IssueID")
                                .WhereEquals("IssueVariantOfIssueID", mIssue.IssueID)
                                .GetListResult <int>();

        mParentAndVariantsIDs.Add(mIssue.IssueID);

        if (!ShouldDisplayOverviewPage())
        {
            ShowInformation(GetString("newsletter.issue.overviewnotsentyet"));
            pnlContent.Visible = false;
            return;
        }

        if (!mMonitorBouncedEmails)
        {
            ShowInformation(GetString("newsletter.viewadditionalstatsmessage"));
        }

        // Hide default submit button
        issueForm.SubmitButton.Visible = false;

        // Set campaign link
        if (issueForm.FieldControls.Contains("IssueUTMCampaign"))
        {
            bool areCampaignsAvailable = LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.CampaignAndConversions);

            issueForm.FieldControls["IssueUTMCampaign"].Value =
                areCampaignsAvailable ?
                GetUtmCampaignNameHtmlOutput() :
                mIssue.IssueUTMCampaign;
        }

        // Init engagement statistics
        InitEngagement();
        InitFunnel();
        InitOverview();

        pnlDelivery.Visible = mMonitorBouncedEmails;

        // Ensure tooltips
        RegisterTooltipScript();
    }
コード例 #21
0
    /// <summary>
    /// Checks the total count of files to not exceed the license limitations.
    /// </summary>
    /// <param name="selectedFilesCount">Selected files count</param>
    private bool CheckFilesCount(long selectedFilesCount)
    {
        long    currentDocumentsCount = 0;
        DataSet dsDocuments           = TreeHelper.GetDocuments(CMSContext.CurrentSiteName, "/%", TreeProvider.ALL_CULTURES, true, null, null, null, TreeProvider.ALL_LEVELS, false, -1, TreeProvider.SELECTNODES_REQUIRED_COLUMNS);

        if (!DataHelper.DataSourceIsEmpty(dsDocuments))
        {
            currentDocumentsCount += DataHelper.GetItemsCount(dsDocuments);
        }
        int versionLimitations = LicenseKeyInfoProvider.VersionLimitations(LicenseHelper.CurrentLicenseInfo, FeatureEnum.Documents);

        allowedFilesCount = (versionLimitations - currentDocumentsCount);
        return(!((versionLimitations != 0) && (versionLimitations < (currentDocumentsCount + selectedFilesCount))));
    }
コード例 #22
0
    /// <summary>
    /// Initializes tabs.
    /// </summary>
    protected void InitalizeTabs()
    {
        if (urlQuery != String.Empty)
        {
            urlQuery = "&" + urlQuery;
        }
        string roleName = "";

        if (role != null)
        {
            roleName = role.RoleName;
        }

        bool displayUsers = ((roleName != RoleInfoProvider.EVERYONE) && (roleName != RoleInfoProvider.AUTHENTICATED) && (roleName != RoleInfoProvider.NOTAUTHENTICATED));

        bool showMembershipTab = LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Membership);

        string generalString         = GetString("general.general");
        string usersString           = GetString("general.users");
        string permissionsString     = GetString("administration.roles.permissions");
        string personalizationString = GetString("administration.roles.uipersonalization");
        string membershipString      = GetString("membership.title.plular");

        string[,] tabs = new string[5, 4];
        tabs[0, 0]     = generalString;
        tabs[0, 1]     = "SetHelpTopic('title', 'general_tab9');";
        tabs[0, 2]     = "Role_Edit_General.aspx?roleid=" + roleId + "&siteId=" + siteID;
        if (displayUsers)
        {
            tabs[1, 0] = usersString;
            tabs[1, 1] = "SetHelpTopic('title', 'users_tab');";
            tabs[1, 2] = "Role_Edit_Users.aspx?roleid=" + roleId + "&siteId=" + siteID;

            if (showMembershipTab)
            {
                tabs[2, 0] = membershipString;
                tabs[2, 1] = "SetHelpTopic('title', 'membership_tab');";
                tabs[2, 2] = "Role_Edit_Memberships.aspx?roleid=" + roleId + "&siteId=" + siteID;
            }
        }
        tabs[3, 0] = permissionsString;
        tabs[3, 1] = "SetHelpTopic('title', 'permissions_tab');";
        tabs[3, 2] = "Role_Edit_Permissions_Default.aspx?roleid=" + roleId + "&siteId=" + siteID;
        tabs[4, 0] = personalizationString;
        tabs[4, 1] = "SetHelpTopic('title', 'personalization_tab');";
        tabs[4, 2] = "Role_Edit_UI_Frameset.aspx?roleid=" + roleId + urlQuery;

        CurrentMaster.Tabs.UrlTarget = "content";
        CurrentMaster.Tabs.Tabs      = tabs;
    }
コード例 #23
0
    /// <summary>
    /// Test if conversion is valid and create new conversion if not exists
    /// </summary>
    public override bool IsValid()
    {
        // Get validated string
        String value = ValidationHelper.GetString(usConversions.Value, String.Empty).Trim();

        if (value != String.Empty)
        {
            String domain = RequestContext.CurrentDomain;
            if (DataHelper.GetNotEmpty(domain, "") != "")
            {
                string parsedDomain = LicenseKeyInfoProvider.ParseDomainName(domain);
                if (!LicenseKeyInfoProvider.IsFeatureAvailable(parsedDomain, FeatureEnum.CampaignAndConversions))
                {
                    ValidationError = GetString("conversionselector.nolicence");
                    return(false);
                }
            }

            // Validate for code name
            if (!ValidationHelper.IsCodeName(value))
            {
                ValidationError = GetString("conversion.validcodename");
                return(false);
            }

            // Test if selected name exists
            ConversionInfo ci = ConversionInfoProvider.GetConversionInfo(value, SiteContext.CurrentSiteName);

            // If not exist create new one
            if (ci == null)
            {
                if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageConversions"))
                {
                    ValidationError = GetString("conversion.notallowedcreate");
                    return(false);
                }

                // Create new object
                ci = new ConversionInfo();
                ci.ConversionName        = value;
                ci.ConversionDisplayName = value;
                ci.ConversionSiteID      = SiteContext.CurrentSiteID;

                // Save to database
                ConversionInfoProvider.SetConversionInfo(ci);
            }
        }

        return(true);
    }
コード例 #24
0
    /// <summary>
    /// Gets a link control that opens post details dialog when clicked. Post's content is used as link text.
    /// </summary>
    /// <param name="postId">Facebook post identifier.</param>
    private object GetFacebookPostDetailLink(int postId)
    {
        FacebookPostInfo post = FacebookPostInfoProvider.GetFacebookPostInfo(postId);

        if (LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.SocialMarketingInsights))
        {
            string dialogUrl = String.Format(mFacebookPostDetailsUrlFormat, post.FacebookPostID);
            return(String.Format("<a href=\"{0}\" onclick=\"modalDialog('{0}', 'PostDetails', 480, 570); return false;\" title=\"{1}\">{2}</a>",
                                 dialogUrl,
                                 ResHelper.GetString("sm.facebook.posts.detail.tooltip"),
                                 HTMLHelper.HTMLEncode(TextHelper.LimitLength(post.FacebookPostText, 80))
                                 ));
        }
        return(HTMLHelper.HTMLEncode(TextHelper.LimitLength(post.FacebookPostText, 80)));
    }
コード例 #25
0
    protected void LoadData()
    {
        // For each edition
        foreach (ProductEditionEnum edition in Enum.GetValues(typeof(ProductEditionEnum)))
        {
            // Get edition infromation
            string editionChar = LicenseKeyInfoProvider.EditionToChar(edition);
            string editionName = Enum.GetName(typeof(ProductEditionEnum), edition);

            // Add item
            ListItem item = new ListItem(editionName, editionChar);
            item.Selected = mEditions.Contains(editionChar);
            chckLicenses.Items.Add(item);
        }
    }
コード例 #26
0
    /// <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());
    }
コード例 #27
0
    private bool AreSubscriptionLicensesValid(out int numberOfInvalidLicenses, out bool onlyWarning, out int daysToExpiration)
    {
        numberOfInvalidLicenses = 0;
        onlyWarning             = false;
        daysToExpiration        = 0;

        var subscriptionLicenses = CacheHelper.Cache(cs =>
        {
            cs.CacheDependency = CacheHelper.GetCacheDependency($"{LicenseKeyInfo.OBJECT_TYPE}|all");

            return(LicenseKeyInfoProvider.GetLicenseKeys()
                   .TypedResult
                   .Where(l => l.LicenseGuid != null));
        }, new CacheSettings(60, "Header", "AreSubscriptionLicensesValid"));

        var expiredLicenses = subscriptionLicenses.Where(license => DateIsLessThan30Days(license.ExpirationDateReal));

        if (expiredLicenses.Any())
        {
            numberOfInvalidLicenses = expiredLicenses.Count();
            daysToExpiration        = expiredLicenses.Min(license => (license.ExpirationDateReal.Date - DateTime.Now.Date).Days);
            onlyWarning             = false;

            return(false);
        }


        // Subscription licenses have grace period of 30 days included in their real expiration date during which error message above is calculated.
        // From the customers point of view the warning is displayed 30 days before the license expires.
        // The license has not yet entered the grace period thats why we subtract the 30 day grace period to calculate
        // expiration and remaining days for the warning message.
        var aboutToExpireLicenses = subscriptionLicenses.Where(license => DateIsLessThan30Days(license.ExpirationDateReal.AddDays(-LicenseListControlExtender.SUBSCRIPTION_LICENSE_EXPIRATION_GRACE_DAYS)));

        if (aboutToExpireLicenses.Any())
        {
            numberOfInvalidLicenses = aboutToExpireLicenses.Count();
            daysToExpiration        = aboutToExpireLicenses.Min(license => (license.ExpirationDateReal.AddDays(-LicenseListControlExtender.SUBSCRIPTION_LICENSE_EXPIRATION_GRACE_DAYS).Date - DateTime.Now.Date).Days);
            onlyWarning             = true;
            return(false);
        }

        return(true);

        bool DateIsLessThan30Days(DateTime licenseExpirationDate)
        {
            return((licenseExpirationDate.Date - DateTime.Now.Date).Days <= 30);
        }
    }
コード例 #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing || ((NewsletterID <= 0) && (IssueID <= 0)))
        {
            return;
        }

        mAreCampaignsAvailable = LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.CampaignAndConversions);
        ToggleUTMCampaignInput();
        mUTMCampaignTextBox = GetUTMCampaignTextBox();

        // Add shadow below header actions
        ScriptHelper.RegisterModule(Page, "CMS/HeaderShadow");

        LoadForm();
    }
コード例 #29
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionname">Name of item (button) that throws event</param>
    /// <param name="actionargument">ID (value of Primary key) of corresponding data row</param>
    private void Control_OnAction(string actionname, object actionargument)
    {
        if (actionname == "delete")
        {
            LicenseKeyInfoProvider.DeleteLicenseKeyInfo(Convert.ToInt32(actionargument));

            using (new CMSActionContext {
                AllowLicenseRedirect = false
            })
            {
                UserInfoProvider.ClearLicenseValues();
                Functions.ClearHashtables();
            }

            mRefreshUI = true;
        }
    }
コード例 #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string domain = QueryHelper.GetText("domainname", String.Empty);

        if (domain != String.Empty)
        {
            LicenseKeyInfo lki = LicenseKeyInfoProvider.GetLicenseKeyInfo(domain);
            if (lki != null)
            {
                string feature = QueryHelper.GetText("feature", String.Empty);

                if (feature != String.Empty)
                {
                    LabelMessage.Text = String.Format(GetString("general.specifiedFeatureNotAvailable"), feature);

                    // Log message to event log
                    EventLogProvider.LogEvent(
                        EventType.WARNING,
                        "Feature not available page",
                        "FeatureNotAvailable",
                        "Feature '" + feature + "' is not available in the CMS edition you are using: " + LicenseHelper.GetEditionName(lki.Edition),
                        RequestContext.CurrentURL
                        );
                }
                else
                {
                    LabelMessage.Text = GetString("general.FeatureNotAvailable");

                    // Log message to event log
                    EventLogProvider.LogEvent(
                        EventType.WARNING,
                        "Feature not available page",
                        "FeatureNotAvailable",
                        "The requested feature is not available in the CMS edition you are using: " + LicenseHelper.GetEditionName(lki.Edition),
                        RequestContext.CurrentURL
                        );
                }
            }
            else
            {
                LabelMessage.Text = GetString("general.licensenotfound").Replace("%%name%%", domain);
            }
        }
        titleElem.TitleText = GetString("general.AccessDenied");
    }