public LanguagePropertyAccess(LanguageTokenReplace parent, PortalSettings settings)
 {
     objPortal = settings;
     objParent = parent;
 }
 public LanguagePropertyAccess(LanguageTokenReplace parent, PortalSettings settings)
 {
     objPortal = settings;
     objParent = parent;
 }
Exemple #3
0
        private bool ProcessMasterModules()
        {
            bool success = true;
            if (TabPermissionController.CanViewPage())
            {
                // Versioning checks.
                if (!TabController.CurrentPage.HasAVisibleVersion)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.ErrorPage404, string.Empty, "status=404"));
                }

                int urlVersion;
                if (TabVersionUtils.TryGetUrlVersion(out urlVersion))
                {
                    if (!TabVersionUtils.CanSeeVersionedPages())
                    {
                        AddPageMessage(this, "", Localization.GetString("TabAccess.Error"),
                            ModuleMessage.ModuleMessageType.YellowWarning);
                        return true;
                    }

                    if (TabVersionController.Instance.GetTabVersions(TabController.CurrentPage.TabID).All(tabVersion => tabVersion.Version != urlVersion))
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.ErrorPage404, string.Empty, "status=404"));
                    }
                }

                //check portal expiry date
                if (!CheckExpired())
                {
                    if ((PortalSettings.ActiveTab.StartDate < DateAndTime.Now && PortalSettings.ActiveTab.EndDate > DateAndTime.Now) || TabPermissionController.CanAdminPage() || Globals.IsLayoutMode())
                    {
                        foreach (var objModule in PortalSettingsController.Instance().GetTabModules(PortalSettings))
                        {
                            success = ProcessModule(objModule);
                        }
                    }
                    else
                    {
                        AddPageMessage(this, "", Localization.GetString("TabAccess.Error"), ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                }
                else
                {
                    AddPageMessage(this,
                                   "",
                                   string.Format(Localization.GetString("ContractExpired.Error"), PortalSettings.PortalName, Globals.GetMediumDate(PortalSettings.ExpiryDate.ToString()), PortalSettings.Email),
                                   ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
				//If request localized page which haven't complete translate yet, redirect to default language version.
	            var redirectUrl = Globals.AccessDeniedURL(Localization.GetString("TabAccess.Error"));
				Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.PortalId);
	            if (PortalSettings.ContentLocalizationEnabled &&
	                TabController.CurrentPage.CultureCode != defaultLocale.Code)
	            {
		            redirectUrl = new LanguageTokenReplace {Language = defaultLocale.Code}.ReplaceEnvironmentTokens("[URL]");
	            }

				Response.Redirect(redirectUrl, true);
            }
            return success;
        }