コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DeleteRule runs when the Delete button for a specified rule is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [jbrinkman]	5/28/2007  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void DeleteRule(object source, DataListCommandEventArgs e)
        {
            //Get the index of the row to delete
            int index = e.Item.ItemIndex;

            //Remove the rule from the rules collection
            Rules.RemoveAt(index);
            try
            {
                //Save the new collection
                RequestFilterSettings.Save(Rules);
            }
            catch (UnauthorizedAccessException exc)
            {
                DnnLog.Debug(exc);

                lblErr.InnerText = Localization.GetString("unauthorized", LocalResourceFile);
                lblErr.Visible   = true;
                //This forces the system to reload the settings from DotNetNuke.Config
                //since we have already deleted the entry from the Rules list.
                Rules = null;
            }

            //Rebind the collection
            BindRules();
        }
コード例 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadModuleControl loads the ModuleControl (PortalModuelBase)
        /// </summary>
        /// <history>
        ///     [cnurse]	12/15/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void LoadModuleControl()
        {
            try
            {
                if (DisplayContent())
                {
                    //if the module supports caching and caching is enabled for the instance and the user does not have Edit rights or is currently in View mode
                    if (SupportsCaching() && IsViewMode())
                    {
                        //attempt to load the cached content
                        _isCached = TryLoadCached();
                    }
                    if (!_isCached)
                    {
                        // load the control dynamically
                        _control = ModuleControlFactory.LoadModuleControl(Page, _moduleConfiguration);
                    }
                }
                else //content placeholder
                {
                    _control = ModuleControlFactory.CreateModuleControl(_moduleConfiguration);
                }
                if (Skin != null)
                {
                    //check for IMC
                    Skin.Communicator.LoadCommunicator(_control);
                }

                //add module settings
                ModuleControl.ModuleContext.Configuration = _moduleConfiguration;
            }
            catch (ThreadAbortException exc)
            {
                DnnLog.Debug(exc);

                Thread.ResetAbort();
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);

                //add module settings
                _control = ModuleControlFactory.CreateModuleControl(_moduleConfiguration);
                ModuleControl.ModuleContext.Configuration = _moduleConfiguration;
                if (TabPermissionController.CanAdminPage())
                {
                    //only display the error to page administrators
                    Exceptions.ProcessModuleLoadException(_control, exc);
                }
                else
                {
                    // Otherwise just log the fact that an exception occurred
                    new ExceptionLogController().AddLog(exc);
                }
            }
        }
コード例 #3
0
ファイル: CaptchaControl.cs プロジェクト: misterPaul0/Curt
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Decrypts the CAPTCHA Text
        /// </summary>
        /// <param name="encryptedContent">The encrypted text</param>
        /// <history>
        ///     [cnurse]	03/17/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static string Decrypt(string encryptedContent)
        {
            string decryptedText = string.Empty;

            try
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encryptedContent);
                if ((!ticket.Expired))
                {
                    decryptedText = ticket.UserData;
                }
            }
            catch (ArgumentException exc)
            {
                DnnLog.Debug(exc);
            }
            return(decryptedText);
        }
コード例 #4
0
        private bool InstallPackageItems(string packageType, CheckBoxList list, Label errorLabel, string errorKey)
        {
            bool   success         = false;
            string strErrorMessage = Null.NullString;

            //Get current Script time-out
            int scriptTimeOut = Server.ScriptTimeout;

            try
            {
                //Set Script timeout to MAX value
                Server.ScriptTimeout = int.MaxValue;

                string InstallPath = Globals.ApplicationMapPath + "\\Install\\" + packageType;
                foreach (ListItem packageItem in list.Items)
                {
                    if (packageItem.Selected)
                    {
                        success = Upgrade.InstallPackage(InstallPath + "\\" + packageItem.Value, packageType, false);
                        if (!success)
                        {
                            strErrorMessage += string.Format(Localization.GetString(errorKey, LocalResourceFile), packageItem.Text);
                        }
                    }
                }
                success = string.IsNullOrEmpty(strErrorMessage);
            }
            catch (Exception ex)
            {
                DnnLog.Debug(ex);
                strErrorMessage = ex.StackTrace;
            }
            finally
            {
                //restore Script timeout
                Server.ScriptTimeout = scriptTimeOut;
            }
            if (!success)
            {
                errorLabel.Text += strErrorMessage;
            }
            return(success);
        }
コード例 #5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [VMasanas]  9/28/2004   Changed redirect to Access Denied
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                if (ParentModule == null)
                {
                    DataBind();
                }
            }
            catch (ThreadAbortException exc) //Do nothing if ThreadAbort as this is caused by a redirect
            {
                DnnLog.Debug(exc);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #6
0
        public void OnBeginRequest(object s, EventArgs e)
        {
            var app           = (HttpApplication)s;
            var server        = app.Server;
            var request       = app.Request;
            var response      = app.Response;
            var requestedPath = app.Request.Url.AbsoluteUri;

            if (RewriterUtils.OmitFromRewriteProcessing(request.Url.LocalPath))
            {
                return;
            }

            //'Carry out first time initialization tasks
            Initialize.Init(app);
            if (request.Url.LocalPath.ToLower().Contains("/install/install.aspx") ||
                request.Url.LocalPath.ToLower().Contains("/install/upgradewizard.aspx") ||
                request.Url.LocalPath.ToLower().Contains("/install/installwizard.aspx") ||
                request.Url.LocalPath.ToLower().Contains("captcha.aspx") ||
                request.Url.LocalPath.ToLower().Contains("scriptresource.axd") ||
                request.Url.LocalPath.ToLower().Contains("webresource.axd") ||
                request.Url.LocalPath.ToLower().Contains("dmxdav.axd")
                )
            {
                return;
            }



            //URL validation
            //check for ".." escape characters commonly used by hackers to traverse the folder tree on the server
            //the application should always use the exact relative location of the resource it is requesting
            var strURL             = request.Url.AbsolutePath;
            var strDoubleDecodeURL = server.UrlDecode(server.UrlDecode(request.RawUrl));

            if (Regex.Match(strURL, "[\\\\/]\\.\\.[\\\\/]").Success || Regex.Match(strDoubleDecodeURL, "[\\\\/]\\.\\.[\\\\/]").Success)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request);
            }
            try
            {
                //fix for ASP.NET canonicalization issues http://support.microsoft.com/?kbid=887459
                if ((request.Path.IndexOf("\\") >= 0 || Path.GetFullPath(request.PhysicalPath) != request.PhysicalPath))
                {
                    DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request);
                }
            }
            catch (Exception exc)
            {
                //DNN 5479
                //request.physicalPath throws an exception when the path of the request exceeds 248 chars.
                //example to test: http://localhost/dotnetnuke_2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/default.aspx
                DnnLog.Error("RawUrl:" + request.RawUrl + " / Referrer:" + request.UrlReferrer.AbsoluteUri, exc);
            }
#if DEBUG
            var timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            app.Context.Items.Add("UrlRewrite:Timer", timer);
#endif

            String domainName;
            RewriteUrl(app, out domainName);

            //blank DomainName indicates RewriteUrl couldn't locate a current portal
            //reprocess url for portal alias if auto add is an option
            if (domainName == "" && CanAutoAddPortalAlias())
            {
                domainName = Globals.GetDomainName(app.Request, true);
            }

            //from this point on we are dealing with a "standard" querystring ( ie. http://www.domain.com/default.aspx?tabid=## )
            //if the portal/url was succesfully identified

            var             tabId           = Null.NullInteger;
            var             portalId        = Null.NullInteger;
            string          portalAlias     = null;
            PortalAliasInfo portalAliasInfo = null;
            var             parsingError    = false;

            // get TabId from querystring ( this is mandatory for maintaining portal context for child portals )
            if (!string.IsNullOrEmpty(request.QueryString["tabid"]))
            {
                if (!Int32.TryParse(request.QueryString["tabid"], out tabId))
                {
                    tabId        = Null.NullInteger;
                    parsingError = true;
                }
            }

            // get PortalId from querystring ( this is used for host menu options as well as child portal navigation )
            if (!string.IsNullOrEmpty(request.QueryString["portalid"]))
            {
                if (!Int32.TryParse(request.QueryString["portalid"], out portalId))
                {
                    portalId     = Null.NullInteger;
                    parsingError = true;
                }
            }

            if (parsingError)
            {
                //The tabId or PortalId are incorrectly formatted (potential DOS)
                DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request);
            }


            try
            {
                //alias parameter can be used to switch portals
                if (request.QueryString["alias"] != null)
                {
                    // check if the alias is valid
                    var childAlias = request.QueryString["alias"];
                    if (!Globals.UsePortNumber())
                    {
                        childAlias = childAlias.Replace(":" + request.Url.Port, "");
                    }

                    if (PortalAliasController.GetPortalAliasInfo(childAlias) != null)
                    {
                        //check if the domain name contains the alias
                        if (childAlias.IndexOf(domainName, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            //redirect to the url defined in the alias
                            app.Response.AppendHeader("X-Redirect-Reason", "alias parameter");
                            response.Redirect(Globals.GetPortalDomainName(childAlias, request, true), true);
                        }
                        else //the alias is the same as the current domain
                        {
                            portalAlias = childAlias;
                        }
                    }
                }

                //PortalId identifies a portal when set
                if (portalAlias == null)
                {
                    if (portalId != Null.NullInteger)
                    {
                        portalAlias = PortalAliasController.GetPortalAliasByPortal(portalId, domainName);
                    }
                }

                //TabId uniquely identifies a Portal
                if (portalAlias == null)
                {
                    if (tabId != Null.NullInteger)
                    {
                        //get the alias from the tabid, but only if it is for a tab in that domain
                        portalAlias = PortalAliasController.GetPortalAliasByTab(tabId, domainName);
                        if (String.IsNullOrEmpty(portalAlias))
                        {
                            //if the TabId is not for the correct domain
                            //see if the correct domain can be found and redirect it
                            portalAliasInfo = PortalAliasController.GetPortalAliasInfo(domainName);
                            if (portalAliasInfo != null && !request.Url.LocalPath.ToLower().EndsWith("/linkclick.aspx"))
                            {
                                if (app.Request.Url.AbsoluteUri.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
                                {
                                    strURL = "https://" + portalAliasInfo.HTTPAlias.Replace("*.", "");
                                }
                                else
                                {
                                    strURL = "http://" + portalAliasInfo.HTTPAlias.Replace("*.", "");
                                }
                                if (strURL.IndexOf(domainName, StringComparison.InvariantCultureIgnoreCase) == -1)
                                {
                                    strURL += app.Request.Url.PathAndQuery;
                                }
                                app.Response.AppendHeader("X-Redirect-Reason", "not correct domain");
                                response.Redirect(strURL, true);
                            }
                        }
                    }
                }

                //else use the domain name
                if (String.IsNullOrEmpty(portalAlias))
                {
                    portalAlias = domainName;
                }
                //using the DomainName above will find that alias that is the domainname portion of the Url
                //ie. dotnetnuke.com will be found even if zzz.dotnetnuke.com was entered on the Url
                portalAliasInfo = PortalAliasController.GetPortalAliasInfo(portalAlias);
                if (portalAliasInfo != null)
                {
                    portalId = portalAliasInfo.PortalID;
                }

                //if the portalid is not known
                if (portalId == Null.NullInteger)
                {
                    bool autoAddPortalAlias = CanAutoAddPortalAlias();

                    if (!autoAddPortalAlias && !request.Url.LocalPath.EndsWith(Globals.glbDefaultPage, StringComparison.InvariantCultureIgnoreCase))
                    {
                        // allows requests for aspx pages in custom folder locations to be processed
                        return;
                    }

                    if (autoAddPortalAlias)
                    {
                        var portalAliasController = new PortalAliasController();
                        portalId = Host.HostPortalID;
                        //the domain name was not found so try using the host portal's first alias
                        if (portalId > Null.NullInteger)
                        {
                            portalAliasInfo           = new PortalAliasInfo();
                            portalAliasInfo.PortalID  = portalId;
                            portalAliasInfo.HTTPAlias = portalAlias;
                            portalAliasController.AddPortalAlias(portalAliasInfo);
                            app.Response.AppendHeader("X-Redirect-Reason", "auto add portalalis");
                            response.Redirect(app.Request.Url.ToString(), true);
                        }
                    }
                }
            }
            catch (ThreadAbortException exc)
            {
                //Do nothing if Thread is being aborted - there are two response.redirect calls in the Try block
                DnnLog.Debug(exc);
            }
            catch (Exception ex)
            {
                //500 Error - Redirect to ErrorPage
                DnnLog.Error(ex);

                strURL = "~/ErrorPage.aspx?status=500&error=" + server.UrlEncode(ex.Message);
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Server.Transfer(strURL);
            }
            if (portalId != -1)
            {
                //load the PortalSettings into current context
                var portalSettings = new PortalSettings(tabId, portalAliasInfo);
                app.Context.Items.Add("PortalSettings", portalSettings);

                // load PortalSettings and HostSettings dictionaries into current context
                // specifically for use in DotNetNuke.Web.Client, which can't reference DotNetNuke.dll to get settings the normal way
                app.Context.Items.Add("PortalSettingsDictionary", PortalController.GetPortalSettingsDictionary(portalId));
                app.Context.Items.Add("HostSettingsDictionary", HostController.Instance.GetSettingsDictionary());
#if DNN71
                if (portalSettings.PortalAliasMappingMode == PortalSettings.PortalAliasMapping.Redirect &&
                    portalAliasInfo != null && !portalAliasInfo.IsPrimary && !request.IsLocal)
                {
#else
                if (portalSettings.PortalAliasMappingMode == PortalSettings.PortalAliasMapping.Redirect &&
                    !String.IsNullOrEmpty(portalSettings.DefaultPortalAlias) &&
                    portalAliasInfo != null &&
                    portalAliasInfo.HTTPAlias != portalSettings.DefaultPortalAlias && !request.IsLocal)
                {
#endif

                    //Permanently Redirect
                    response.StatusCode = 301;

                    var redirectAlias = Globals.AddHTTP(portalSettings.DefaultPortalAlias);
                    var checkAlias    = Globals.AddHTTP(portalAliasInfo.HTTPAlias);
                    var redirectUrl   = redirectAlias + request.RawUrl;
                    if (redirectUrl.StartsWith(checkAlias, StringComparison.InvariantCultureIgnoreCase))
                    {
                        redirectUrl = redirectAlias + redirectUrl.Substring(checkAlias.Length);
                    }
                    app.Response.AppendHeader("X-Redirect-Reason", "alias redirect");
                    response.AppendHeader("Location", redirectUrl);
                }

                //manage page URL redirects - that reach here because they bypass the built-in navigation
                //ie Spiders, saved favorites, hand-crafted urls etc
                if (!String.IsNullOrEmpty(portalSettings.ActiveTab.Url) && request.QueryString["ctl"] == null && request.QueryString["fileticket"] == null)
                {
                    //Target Url
                    var redirectUrl = portalSettings.ActiveTab.FullUrl;
                    app.Response.AppendHeader("X-Redirect-Reason", "page url redirect");
                    if (portalSettings.ActiveTab.PermanentRedirect)
                    {
                        //Permanently Redirect

                        response.StatusCode = 301;
                        response.AppendHeader("Location", redirectUrl);
                    }
                    else
                    {
                        //Normal Redirect
                        response.Redirect(redirectUrl, true);
                    }
                }

                //manage secure connections
                if (request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.InvariantCultureIgnoreCase))
                {
                    //request is for a standard page
                    strURL = "";
                    //if SSL is enabled
                    if (portalSettings.SSLEnabled)
                    {
                        //if page is secure and connection is not secure orelse ssloffload is enabled and server value exists
                        if ((portalSettings.ActiveTab.IsSecure && !request.IsSecureConnection) && (IsSSLOffloadEnabled(request) == false))
                        {
                            //switch to secure connection
                            strURL = requestedPath.Replace("http://", "https://");
                            strURL = FormatDomain(strURL, portalSettings.STDURL, portalSettings.SSLURL);
                        }
                    }
                    //if SSL is enforced
                    if (portalSettings.SSLEnforced)
                    {
                        //if page is not secure and connection is secure
                        if ((!portalSettings.ActiveTab.IsSecure && request.IsSecureConnection))
                        {
                            //check if connection has already been forced to secure orelse ssloffload is disabled
                            if (request.QueryString["ssl"] == null)
                            {
                                strURL = requestedPath.Replace("https://", "http://");
                                strURL = FormatDomain(strURL, portalSettings.SSLURL, portalSettings.STDURL);
                            }
                        }
                    }

                    //if a protocol switch is necessary
                    if (!String.IsNullOrEmpty(strURL))
                    {
                        if (strURL.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
                        {
                            //redirect to secure connection
                            app.Response.AppendHeader("X-Redirect-Reason", "redirect to secure");
                            response.Redirect(strURL, true);
                        }
                        else //when switching to an unsecure page, use a clientside redirector to avoid the browser security warning
                        {
                            response.Clear();
                            //add a refresh header to the response
                            response.AddHeader("Refresh", "0;URL=" + strURL);
                            //add the clientside javascript redirection script
                            response.Write("<html><head><title></title>");
                            response.Write("<!-- <script language=\"javascript\">window.location.replace(\"" + strURL + "\")</script> -->");
                            response.Write("</head><body></body></html>");
                            //send the response
                            response.End();
                        }
                    }
                }
            }
            else
            {
                //alias does not exist in database
                //and all attempts to find another have failed
                //this should only happen if the HostPortal does not have any aliases
                //404 Error - Redirect to ErrorPage
                strURL = "~/ErrorPage.aspx?status=404&error=" + domainName;
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Server.Transfer(strURL);
            }

            if (app.Context.Items["FirstRequest"] != null)
            {
                app.Context.Items.Remove("FirstRequest");

                //Process any messages in the EventQueue for the Application_Start_FirstRequest event
                EventQueueController.ProcessMessages("Application_Start_FirstRequest");
            }
#if DEBUG
            app.Response.AddHeader("X-OpenUrlRewriter-OnBeginRequest", timer.Elapsed.TotalMilliseconds.ToString());
#endif
        }
コード例 #7
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Site Settings
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        /// </history>
        protected void OnUpdateClick(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    var objModules        = new ModuleController();
                    var allTabsChanged    = false;
                    var searchOnceChanged = false;

                    //tab administrators can only manage their own tab
                    if (!TabPermissionController.CanAdminPage())
                    {
                        chkAllTabs.Enabled    = false;
                        chkNewTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        chkSearchOnce.Enabled = false;
                        cboTab.Enabled        = false;
                    }
                    Module.ModuleID    = _moduleId;
                    Module.ModuleTitle = txtTitle.Text;
                    Module.Alignment   = cboAlign.SelectedItem.Value;
                    Module.Color       = txtColor.Text;
                    Module.Border      = txtBorder.Text;
                    Module.IconFile    = ctlIcon.Url;
                    if (!String.IsNullOrEmpty(txtCacheDuration.Text))
                    {
                        Module.CacheTime = Int32.Parse(txtCacheDuration.Text);
                    }
                    else
                    {
                        Module.CacheTime = 0;
                    }
                    Module.CacheMethod = cboCacheProvider.SelectedValue;
                    Module.TabID       = TabId;
                    if (Module.AllTabs != chkAllTabs.Checked)
                    {
                        allTabsChanged = true;
                    }
                    Module.AllTabs = chkAllTabs.Checked;
                    objModules.UpdateTabModuleSetting(Module.TabModuleID, "hideadminborder", chkAdminBorder.Checked.ToString());

                    //check whether searchonce value is changed
                    var searchOnce = Settings.ContainsKey("searchonce") ? Convert.ToBoolean(Settings["searchonce"]) : false;
                    if (searchOnce != chkSearchOnce.Checked)
                    {
                        searchOnceChanged = true;
                    }
                    objModules.UpdateTabModuleSetting(Module.TabModuleID, "searchonce", chkSearchOnce.Checked.ToString());
                    switch (Int32.Parse(cboVisibility.SelectedItem.Value))
                    {
                    case 0:
                        Module.Visibility = VisibilityState.Maximized;
                        break;

                    case 1:
                        Module.Visibility = VisibilityState.Minimized;
                        break;

                    case 2:
                        Module.Visibility = VisibilityState.None;
                        break;
                    }
                    Module.IsDeleted = false;
                    Module.Header    = txtHeader.Text;
                    Module.Footer    = txtFooter.Text;

                    if (startDatePicker.SelectedDate != null)
                    {
                        Module.StartDate = startDatePicker.SelectedDate.Value;
                    }
                    else
                    {
                        Module.StartDate = Null.NullDate;
                    }

                    if (endDatePicker.SelectedDate != null)
                    {
                        Module.EndDate = endDatePicker.SelectedDate.Value;
                    }
                    else
                    {
                        Module.EndDate = Null.NullDate;
                    }

                    Module.ContainerSrc = moduleContainerCombo.SelectedValue;
                    Module.ModulePermissions.Clear();
                    Module.ModulePermissions.AddRange(dgPermissions.Permissions);
                    Module.Terms.Clear();
                    Module.Terms.AddRange(termsSelector.Terms);
                    Module.InheritViewPermissions = chkInheritPermissions.Checked;
                    Module.DisplayTitle           = chkDisplayTitle.Checked;
                    Module.DisplayPrint           = chkDisplayPrint.Checked;
                    Module.DisplaySyndicate       = chkDisplaySyndicate.Checked;
                    Module.IsWebSlice             = chkWebSlice.Checked;
                    Module.WebSliceTitle          = txtWebSliceTitle.Text;

                    if (diWebSliceExpiry.SelectedDate != null)
                    {
                        Module.WebSliceExpiryDate = diWebSliceExpiry.SelectedDate.Value;
                    }
                    else
                    {
                        Module.WebSliceExpiryDate = Null.NullDate;
                    }

                    if (!string.IsNullOrEmpty(txtWebSliceTTL.Text))
                    {
                        Module.WebSliceTTL = Convert.ToInt32(txtWebSliceTTL.Text);
                    }
                    Module.IsDefaultModule = chkDefault.Checked;
                    Module.AllModules      = chkAllModules.Checked;
                    objModules.UpdateModule(Module);

                    //Update Custom Settings
                    if (SettingsControl != null)
                    {
                        try
                        {
                            SettingsControl.UpdateSettings();
                        }
                        catch (ThreadAbortException exc)
                        {
                            DnnLog.Debug(exc);

                            Thread.ResetAbort(); //necessary
                        }
                        catch (Exception ex)
                        {
                            Exceptions.LogException(ex);
                        }
                    }

                    //These Module Copy/Move statements must be
                    //at the end of the Update as the Controller code assumes all the
                    //Updates to the Module have been carried out.

                    //Check if the Module is to be Moved to a new Tab
                    if (!chkAllTabs.Checked)
                    {
                        var newTabId = Int32.Parse(cboTab.SelectedItem.Value);
                        if (TabId != newTabId)
                        {
                            //First check if there already is an instance of the module on the target page
                            var tmpModule = objModules.GetModule(_moduleId, newTabId);
                            if (tmpModule == null)
                            {
                                //Move module
                                objModules.MoveModule(_moduleId, TabId, newTabId, Globals.glbDefaultPane);
                            }
                            else
                            {
                                //Warn user
                                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                                return;
                            }
                        }
                    }

                    //Check if Module is to be Added/Removed from all Tabs
                    if (allTabsChanged)
                    {
                        var listTabs = TabController.GetPortalTabs(PortalSettings.PortalId, Null.NullInteger, false, true);
                        if (chkAllTabs.Checked)
                        {
                            if (!chkNewTabs.Checked)
                            {
                                foreach (var destinationTab in listTabs)
                                {
                                    var module = objModules.GetModule(_moduleId, destinationTab.TabID);
                                    if (module != null)
                                    {
                                        if (module.IsDeleted)
                                        {
                                            objModules.RestoreModule(module);
                                        }
                                    }
                                    else
                                    {
                                        objModules.CopyModule(Module, destinationTab, Module.PaneName, true);
                                    }
                                }
                            }
                        }
                        else
                        {
                            objModules.DeleteAllModules(_moduleId, TabId, listTabs);
                        }
                    }

                    //if searchonce is changed, then should update all other tabmodules to update the setting value.
                    if (searchOnceChanged)
                    {
                        objModules.GetAllTabsModulesByModuleID(_moduleId)
                        .Cast <ModuleInfo>()
                        .Where(t => t.TabID != TabId)
                        .ToList()
                        .ForEach(tm =>
                        {
                            if (chkSearchOnce.Checked)
                            {
                                objModules.UpdateTabModuleSetting(tm.TabModuleID, "DisableSearch", "true");
                            }
                            else
                            {
                                objModules.DeleteTabModuleSetting(tm.TabModuleID, "DisableSearch");
                            }
                        });
                    }

                    //Navigate back to admin page
                    Response.Redirect(Globals.NavigateURL(), true);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #8
0
ファイル: Logger.cs プロジェクト: misterPaul0/Curt
 protected override void SetItem(int index, LogEntry item)
 {
     DnnLog.Debug(item.ToString());
     base.InsertItem(index, item);
 }