Ejemplo n.º 1
0
        private void BindLogTypeDropDown()
        {
            //ddlLogType.Items.Add(new ListItem(Localization.GetString("All"), "*"));
            ddlLogType.AddItem(Localization.GetString("All"), "*");
            var logController = new LogController();

            List<LogTypeConfigInfo> logTypes;
            if (String.IsNullOrEmpty(EventFilter))
            {
                logTypes = logController.GetLogTypeConfigInfo().Cast<LogTypeConfigInfo>()
                    .Where(l => l.LoggingIsActive)
                    .OrderBy(l => l.LogTypeFriendlyName).ToList();
            }
            else
            {
                logTypes = logController.GetLogTypeConfigInfo().Cast<LogTypeConfigInfo>()
                    .Where(l => l.LogTypeKey.StartsWith(EventFilter) && l.LoggingIsActive)
                    .OrderBy(l => l.LogTypeFriendlyName).ToList();
            }

            foreach (var logType in logTypes)
            {
                //ddlLogType.Items.Add(new ListItem(logType.LogTypeFriendlyName, logType.LogTypeKey));
                ddlLogType.AddItem(logType.LogTypeFriendlyName, logType.LogTypeKey);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Logs the 404 error to a table for later checking 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="settings"></param>
        /// <param name="result"></param>
        public static void Log404(HttpRequest request, FriendlyUrlSettings settings, UrlAction result)
        {
            var controller = new LogController();
            var log = new LogInfo
                {
                    LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                    LogPortalID = (result.PortalAlias != null) ? result.PortalId : -1
                };
            log.LogProperties.Add(new LogDetailInfo("TabId", (result.TabId > 0) ? result.TabId.ToString() : String.Empty));
            log.LogProperties.Add(new LogDetailInfo("PortalAlias",  (result.PortalAlias != null) ? result.PortalAlias.HTTPAlias : String.Empty));
            log.LogProperties.Add(new LogDetailInfo("OriginalUrl",  result.RawUrl));

            if (request != null)
            {
                if (request.UrlReferrer != null)
                {
                    log.LogProperties.Add(new LogDetailInfo("Referer", request.UrlReferrer.AbsoluteUri));
                }
                log.LogProperties.Add(new LogDetailInfo("Url", request.Url.AbsoluteUri));
                log.LogProperties.Add(new LogDetailInfo("UserAgent", request.UserAgent));
                log.LogProperties.Add(new LogDetailInfo("HostAddress", request.UserHostAddress));
                log.LogProperties.Add(new LogDetailInfo("HostName", request.UserHostName));
            }

            controller.AddLog(log);
        }
        public override object GetData(ITabContext context)
        {
            try
            {
                var portalSettings = PortalSettings.Current;

                int totalRecords = 0;
                LogInfoArray logs = new LogController().GetLog(portalSettings.PortalId, 15, 0, ref totalRecords);

                if (logs.Count == 0)
                    return null;

                var data = new List<object[]> {new object[] {"Created Date", "Log Type", "UserName", "Content"}};
                for (int i = 0; i < logs.Count; i++)
                {
                    var log = logs.GetItem(i);

                    var logProperties = new List<object[]> {new object[] {"Property", "Value"}};
                    for (int j = 0; j < log.LogProperties.Count; j++)
                    {
                        var logDetail = (LogDetailInfo)log.LogProperties[j];
                        logProperties.Add(new object[] { logDetail.PropertyName, logDetail.PropertyValue });
                    }

                    data.Add(new object[] {log.LogCreateDate, log.LogTypeKey, log.LogUserName, logProperties});
                }

                return data;
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return "There was an error loading the data for this tab";
            }
        }        
Ejemplo n.º 4
0
        public void AddLog(Exception objException, ExceptionLogType LogType)
        {
            var objLogController = new LogController();
            var objLogInfo = new LogInfo();
            objLogInfo.LogTypeKey = LogType.ToString();
            if (LogType == ExceptionLogType.SEARCH_INDEXER_EXCEPTION)
            {
				//Add SearchException Properties
                var objSearchException = (SearchException) objException;
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objSearchException.SearchItem.ModuleId.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("SearchItemId", objSearchException.SearchItem.SearchItemId.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Title", objSearchException.SearchItem.Title));
                objLogInfo.LogProperties.Add(new LogDetailInfo("SearchKey", objSearchException.SearchItem.SearchKey));
                objLogInfo.LogProperties.Add(new LogDetailInfo("GUID", objSearchException.SearchItem.GUID));
            }
            else if (LogType == ExceptionLogType.MODULE_LOAD_EXCEPTION)
            {
				//Add ModuleLoadException Properties
                var objModuleLoadException = (ModuleLoadException) objException;
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objModuleLoadException.ModuleId.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleDefId", objModuleLoadException.ModuleDefId.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("FriendlyName", objModuleLoadException.FriendlyName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleControlSource", objModuleLoadException.ModuleControlSource));
            }
            else if (LogType == ExceptionLogType.SECURITY_EXCEPTION)
            {
				//Add SecurityException Properties
                var objSecurityException = (SecurityException) objException;
                objLogInfo.LogProperties.Add(new LogDetailInfo("Querystring", objSecurityException.Querystring));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IP", objSecurityException.IP));
            }
			
			//Add BasePortalException Properties
            var objBasePortalException = new BasePortalException(objException.ToString(), objException);
            objLogInfo.LogProperties.Add(new LogDetailInfo("AssemblyVersion", objBasePortalException.AssemblyVersion));
            objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objBasePortalException.PortalID.ToString()));
            objLogInfo.LogProperties.Add(new LogDetailInfo("PortalName", objBasePortalException.PortalName));
            objLogInfo.LogProperties.Add(new LogDetailInfo("UserID", objBasePortalException.UserID.ToString()));
            objLogInfo.LogProperties.Add(new LogDetailInfo("UserName", objBasePortalException.UserName));
            objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabID", objBasePortalException.ActiveTabID.ToString()));
            objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabName", objBasePortalException.ActiveTabName));
            objLogInfo.LogProperties.Add(new LogDetailInfo("RawURL", objBasePortalException.RawURL));
            objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURL", objBasePortalException.AbsoluteURL));
            objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURLReferrer", objBasePortalException.AbsoluteURLReferrer));
            objLogInfo.LogProperties.Add(new LogDetailInfo("UserAgent", objBasePortalException.UserAgent));
            objLogInfo.LogProperties.Add(new LogDetailInfo("DefaultDataProvider", objBasePortalException.DefaultDataProvider));
            objLogInfo.LogProperties.Add(new LogDetailInfo("ExceptionGUID", objBasePortalException.ExceptionGUID));
            objLogInfo.LogProperties.Add(new LogDetailInfo("InnerException", objBasePortalException.InnerException.Message));
            objLogInfo.LogProperties.Add(new LogDetailInfo("FileName", objBasePortalException.FileName));
            objLogInfo.LogProperties.Add(new LogDetailInfo("FileLineNumber", objBasePortalException.FileLineNumber.ToString()));
            objLogInfo.LogProperties.Add(new LogDetailInfo("FileColumnNumber", objBasePortalException.FileColumnNumber.ToString()));
            objLogInfo.LogProperties.Add(new LogDetailInfo("Method", objBasePortalException.Method));
            objLogInfo.LogProperties.Add(new LogDetailInfo("StackTrace", objBasePortalException.StackTrace));
            objLogInfo.LogProperties.Add(new LogDetailInfo("Message", objBasePortalException.Message));
            objLogInfo.LogProperties.Add(new LogDetailInfo("Source", objBasePortalException.Source));
            objLogInfo.LogPortalID = objBasePortalException.PortalID;
            objLogController.AddLog(objLogInfo);
        }
        /// <summary>
        /// Gets the data to send to the Glimpse client.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>Data to send the the Glimpse client.</returns>
        public object GetData(HttpContextBase context)
        {
            try
            {
                var portalSettings = PortalSettings.Current;

                // get the logs
                int totalRecords = 0;
                LogInfoArray logs = new LogController().GetLog(portalSettings.PortalId, 15, 1, ref totalRecords);

                // bail if we don't have any
                if (logs.Count == 0)
                    return null;

                // add to data to send
                var data = new List<object[]> {new object[] {"Created Date", "Log Type", "UserName", "Content"}};
                for (int i = 0; i < logs.Count; i++)
                {
                    var log = logs.GetItem(i);

                    // get log properties 
                    var logProperties = new List<object[]> {new object[] {"Property", "Value"}};
                    for (int j = 0; j < log.LogProperties.Count; j++)
                    {
                        var logDetail = log.LogProperties[j] as LogDetailInfo;
                        logProperties.Add(new object[] {logDetail.PropertyName, logDetail.PropertyValue});
                    }

                    data.Add(new object[] {log.LogCreateDate, log.LogTypeKey, log.LogUserName, logProperties});
                }

                return data;
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return null;
            }
        }        
        public void BindData()
        {
            if (UserInfo.IsSuperUser)
            {
                if (!Page.IsPostBack && Request.QueryString["pid"] != null)
                {
                    ddlPortalid.FindItemByValue(Request.QueryString["pid"]).Selected = true;
                }
                _portalId = Int32.Parse(ddlPortalid.SelectedItem.Value);
            }
            else
            {
                _portalId = PortalId;
            }

            var totalRecords = 0;
            var pageSize = Convert.ToInt32(ddlRecordsPerPage.SelectedValue);
            if (!Page.IsPostBack && Request.QueryString["LogTypeKey"] != null)
            {
                var li = ddlLogType.FindItemByValue(Request.QueryString["LogTypeKey"]);
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            _logTypeKey = ddlLogType.SelectedItem.Value;

            var currentPage = _pageIndex;
            if (currentPage > 0)
            {
                currentPage = currentPage - 1;
            }

            var logController = new LogController();
            var filteredKey = _logTypeKey;
            if (_logTypeKey == "*" && !String.IsNullOrEmpty(EventFilter))
            {
                filteredKey = EventFilter + "%";
            }
            var logs = logController.GetLogs(_portalId, filteredKey == "*" ? String.Empty : filteredKey, pageSize, currentPage, ref totalRecords);

            if (logs.Count > 0)
            {
                dlLog.Visible = true;
                btnDelete.Visible = UserInfo.IsSuperUser;
                btnClear.Visible = UserInfo.IsSuperUser;
                dlLog.DataSource = logs;
                dlLog.DataBind();
                InitializePaging(ctlPagingControlBottom, totalRecords, pageSize);
            }
            else
            {
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoEntries", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                dlLog.Visible = false;
                btnDelete.Visible = false;
                btnClear.Visible = false;

                ctlPagingControlBottom.Visible = false;
            }

            editSettings.Visible = UserInfo.IsSuperUser;
        }
Ejemplo n.º 7
0
        private void BindSummaryData()
        {
            var objLogController = new LogController();
            ArrayList arrLogTypeConfigInfo = objLogController.GetLogTypeConfigInfo();

            //Localize the Headers
            if (!Page.IsPostBack)
            {
                Localization.LocalizeDataGrid(ref dgLogTypeConfigInfo, LocalResourceFile);
            }
            dgLogTypeConfigInfo.DataSource = arrLogTypeConfigInfo;
            dgLogTypeConfigInfo.DataBind();
            pnlEditLogTypeConfigInfo.Visible = false;
            pnlLogTypeConfigInfo.Visible = true;
        }
Ejemplo n.º 8
0
        public void AddLog(object objCBO, PortalSettings _PortalSettings, int UserID, string UserName, EventLogType objLogType)
        {
            LogController objLogController = new LogController();
            LogInfo       objLogInfo       = new LogInfo();

            objLogInfo.LogUserID     = UserID;
            objLogInfo.LogPortalID   = _PortalSettings.PortalId;
            objLogInfo.LogTypeKey    = objLogType.ToString();
            objLogInfo.LogPortalName = _PortalSettings.PortalName;
            switch (objCBO.GetType().FullName)
            {
            case "DotNetNuke.Entities.Portals.PortalInfo":

                PortalInfo objPortal = (PortalInfo)objCBO;
                objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objPortal.PortalID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("PortalName", objPortal.PortalName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objPortal.Description));
                objLogInfo.LogProperties.Add(new LogDetailInfo("KeyWords", objPortal.KeyWords));
                objLogInfo.LogProperties.Add(new LogDetailInfo("LogoFile", objPortal.LogoFile));
                break;

            case "DotNetNuke.Entities.Tabs.TabInfo":

                TabInfo objTab = (TabInfo)objCBO;
                objLogInfo.LogProperties.Add(new LogDetailInfo("TabID", objTab.TabID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objTab.PortalID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("TabName", objTab.TabName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Title", objTab.Title));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objTab.Description));
                objLogInfo.LogProperties.Add(new LogDetailInfo("KeyWords", objTab.KeyWords));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Url", objTab.Url));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ParentId", objTab.ParentId.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IconFile", objTab.IconFile));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IsVisible", objTab.IsVisible.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("SkinSrc", objTab.SkinSrc));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ContainerSrc", objTab.ContainerSrc));
                break;

            case "DotNetNuke.Entities.Modules.ModuleInfo":

                ModuleInfo objModule = (ModuleInfo)objCBO;
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objModule.ModuleID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleTitle", objModule.ModuleTitle));
                objLogInfo.LogProperties.Add(new LogDetailInfo("TabModuleID", objModule.TabModuleID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("TabID", objModule.TabID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objModule.PortalID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleDefId", objModule.ModuleDefID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("FriendlyName", objModule.FriendlyName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IconFile", objModule.IconFile));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Visibility", objModule.Visibility.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("ContainerSrc", objModule.ContainerSrc));
                break;

            case "DotNetNuke.Entities.Users.UserInfo":

                UserInfo objUser = (UserInfo)objCBO;
                objLogInfo.LogProperties.Add(new LogDetailInfo("UserID", objUser.UserID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("FirstName", objUser.Profile.FirstName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("LastName", objUser.Profile.LastName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("UserName", objUser.Username));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Email", objUser.Email));
                break;

            case "DotNetNuke.Security.Roles.RoleInfo":

                RoleInfo objRole = (RoleInfo)objCBO;
                objLogInfo.LogProperties.Add(new LogDetailInfo("RoleID", objRole.RoleID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("RoleName", objRole.RoleName));
                objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objRole.PortalID.ToString()));
                objLogInfo.LogProperties.Add(new LogDetailInfo("Description", objRole.Description));
                objLogInfo.LogProperties.Add(new LogDetailInfo("IsPublic", objRole.IsPublic.ToString()));
                break;

            default:     //Serialise using XmlSerializer

                objLogInfo.LogProperties.Add(new LogDetailInfo("logdetail", XmlUtils.Serialize(objCBO)));
                break;
            }
            objLogController.AddLog(objLogInfo);
        }
 private XmlDocument GetSelectedExceptions()
 {
     var objXML = new XmlDocument();
     try
     {
         var s = Request.Form["Exception"];
         if (s != null)
         {
             string[] excPositions = null;
             if (s.LastIndexOf(",") > 0)
             {
                 excPositions = s.Split(Convert.ToChar(","));
             }
             else if (!String.IsNullOrEmpty(s))
             {
                 excPositions = new[] {s};
             }
             var objLoggingController = new LogController();
             objXML.LoadXml("<LogEntries></LogEntries>");
             if (excPositions != null)
             {
                 var j = excPositions.Length;
                 for (var i = 0; i < excPositions.Length; i++)
                 {
                     j -= 1;
                     var excKey = excPositions[j].Split(Convert.ToChar("|"));
                     var objLogInfo = new LogInfo {LogGUID = excKey[0], LogFileID = excKey[1]};
                     var objNode = objXML.ImportNode((XmlNode) objLoggingController.GetSingleLog(objLogInfo, LoggingProvider.ReturnType.XML), true);
                     if (objXML.DocumentElement != null)
                     {
                         objXML.DocumentElement.AppendChild(objNode);
                     }
                 }
             }
         }
     }
     catch (Exception exc)
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
     return objXML;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// this ensures that all portals have any logtypes (and sometimes configuration) required
        /// </summary>
        public static void EnsureRequiredEventLogTypesExist()
        {
            var logController = new LogController();
            if (!DoesLogTypeExists(EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString()))
            {
                //Add 404 Log
                var logTypeInfo = new LogTypeInfo
                {
                    LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                    LogTypeFriendlyName = "HTTP Error Code 404 Page Not Found",
                    LogTypeDescription = "",
                    LogTypeCSSClass = "OperationFailure",
                    LogTypeOwner = "DotNetNuke.Logging.EventLogType"
                };
                logController.AddLogType(logTypeInfo);

                //Add LogType
                var logTypeConf = new LogTypeConfigInfo
                {
                    LoggingIsActive = true,
                    LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                    KeepMostRecent = "100",
                    NotificationThreshold = 1,
                    NotificationThresholdTime = 1,
                    NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                    MailFromAddress = Null.NullString,
                    MailToAddress = Null.NullString,
                    LogTypePortalID = "*"
                };
                logController.AddLogTypeConfigInfo(logTypeConf);
            }


            if (!DoesLogTypeExists(EventLogController.EventLogType.IP_LOGIN_BANNED.ToString()))
            {
                //Add IP filter log type
                var logTypeFilterInfo = new LogTypeInfo
                {
                    LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                    LogTypeFriendlyName = "HTTP Error Code Forbidden IP address rejected",
                    LogTypeDescription = "",
                    LogTypeCSSClass = "OperationFailure",
                    LogTypeOwner = "DotNetNuke.Logging.EventLogType"
                };
                logController.AddLogType(logTypeFilterInfo);

                //Add LogType
                var logTypeFilterConf = new LogTypeConfigInfo
                {
                    LoggingIsActive = true,
                    LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                    KeepMostRecent = "100",
                    NotificationThreshold = 1,
                    NotificationThresholdTime = 1,
                    NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                    MailFromAddress = Null.NullString,
                    MailToAddress = Null.NullString,
                    LogTypePortalID = "*"
                };
                logController.AddLogTypeConfigInfo(logTypeFilterConf);
            }

            if (!DoesLogTypeExists(EventLogController.EventLogType.TABURL_CREATED.ToString()))
            {
                var logTypeInfo = new LogTypeInfo
                {
                    LogTypeKey = EventLogController.EventLogType.TABURL_CREATED.ToString(),
                    LogTypeFriendlyName = "TabURL created",
                    LogTypeDescription = "",
                    LogTypeCSSClass = "OperationSuccess",
                    LogTypeOwner = "DotNetNuke.Logging.EventLogType"
                };
                logController.AddLogType(logTypeInfo);

                logTypeInfo.LogTypeKey = EventLogController.EventLogType.TABURL_UPDATED.ToString();
                logTypeInfo.LogTypeFriendlyName = "TabURL updated";
                logController.AddLogType(logTypeInfo);

                logTypeInfo.LogTypeKey = EventLogController.EventLogType.TABURL_DELETED.ToString();
                logTypeInfo.LogTypeFriendlyName = "TabURL deleted";
                logController.AddLogType(logTypeInfo);

                //Add LogType
                var logTypeUrlConf = new LogTypeConfigInfo
                {
                    LoggingIsActive = false,
                    LogTypeKey = EventLogController.EventLogType.TABURL_CREATED.ToString(),
                    KeepMostRecent = "100",
                    NotificationThreshold = 1,
                    NotificationThresholdTime = 1,
                    NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                    MailFromAddress = Null.NullString,
                    MailToAddress = Null.NullString,
                    LogTypePortalID = "*"
                };
                logController.AddLogTypeConfigInfo(logTypeUrlConf);
                
                logTypeUrlConf.LogTypeKey = EventLogController.EventLogType.TABURL_UPDATED.ToString();
                logController.AddLogTypeConfigInfo(logTypeUrlConf);

                logTypeUrlConf.LogTypeKey = EventLogController.EventLogType.TABURL_DELETED.ToString();
                logController.AddLogTypeConfigInfo(logTypeUrlConf);
            }

            if (!DoesLogTypeExists(EventLogController.EventLogType.SCRIPT_COLLISION.ToString()))
            {
                //Add IP filter log type
                var logTypeFilterInfo = new LogTypeInfo
                {
                    LogTypeKey = EventLogController.EventLogType.SCRIPT_COLLISION.ToString(),
                    LogTypeFriendlyName = "Javscript library registration resolved script collision",
                    LogTypeDescription = "",
                    LogTypeCSSClass = "OperationFailure",
                    LogTypeOwner = "DotNetNuke.Logging.EventLogType"
                };
                logController.AddLogType(logTypeFilterInfo);

                //Add LogType
                var logTypeFilterConf = new LogTypeConfigInfo
                {
                    LoggingIsActive = true,
                    LogTypeKey = EventLogController.EventLogType.SCRIPT_COLLISION.ToString(),
                    KeepMostRecent = "100",
                    NotificationThreshold = 1,
                    NotificationThresholdTime = 1,
                    NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                    MailFromAddress = Null.NullString,
                    MailToAddress = Null.NullString,
                    LogTypePortalID = "*"
                };
                logController.AddLogTypeConfigInfo(logTypeFilterConf);
            }

        }
Ejemplo n.º 11
0
 private void BindLogTypeDropDown()
 {
     LogController objLogController = new LogController();
     ArrayList arrLogTypes = objLogController.GetLogTypeInfo();
     arrLogTypes.Sort( new LogTypeSortFriendlyName() );
     ddlLogType.DataTextField = "LogTypeFriendlyName";
     ddlLogType.DataValueField = "LogTypeKey";
     ddlLogType.DataSource = arrLogTypes;
     ddlLogType.DataBind();
     ListItem ddlAllPortals = new ListItem( Localization.GetString( "All" ), "*" );
     ddlLogType.Items.Insert( 0, ddlAllPortals );
 }
Ejemplo n.º 12
0
        private void BindData()
        {
            btnEmail.Attributes.Add( "onclick", "return CheckExceptions();" );

            if( ColorCodingOn )
            {
                chkColorCoding.Checked = true;
            }
            else
            {
                chkColorCoding.Checked = false;
            }

            if( ColorCodingLegendOn )
            {
                pnlLegend.Visible = true;
            }
            else
            {
                pnlLegend.Visible = false;
            }

            if( UserInfo.IsSuperUser )
            {
                btnClear.Visible = true;
                btnDelete.Visible = true;
                if( Page.IsPostBack && Request.QueryString["PortalID"] != null )
                {
                    ddlPortalid.Items.FindByValue( Request.QueryString["PortalID"] ).Selected = true;
                }
                intPortalID = int.Parse( ddlPortalid.SelectedItem.Value );
            }
            else
            {
                btnClear.Visible = false;
                btnDelete.Visible = false;
                intPortalID = PortalId;
            }

            int TotalRecords = 0;
            int PageSize = Convert.ToInt32( ddlRecordsPerPage.SelectedValue );

            if( Page.IsPostBack && Request.QueryString["LogTypeKey"] != null )
            {
                ddlLogType.Items.FindByValue( Request.QueryString["LogTypeKey"] ).Selected = true;
            }

            strLogTypeKey = ddlLogType.SelectedItem.Value;

            LogInfoArray objLog;
            int CurrentPage = PageIndex;
            if( CurrentPage > 0 )
            {
                CurrentPage--;
            }
            LogController objLogController = new LogController();
            if( intPortalID == - 1 && strLogTypeKey == "*" )
            {
                objLog = objLogController.GetLog( PageSize, CurrentPage, ref TotalRecords );
            }
            else if( intPortalID == - 1 && strLogTypeKey != "*" )
            {
                objLog = objLogController.GetLog( strLogTypeKey, PageSize, CurrentPage, ref TotalRecords );
            }
            else if( intPortalID != - 1 && strLogTypeKey == "*" )
            {
                objLog = objLogController.GetLog( intPortalID, PageSize, CurrentPage, ref TotalRecords );
            }
            else if( intPortalID != - 1 && strLogTypeKey != "*" )
            {
                objLog = objLogController.GetLog( intPortalID, strLogTypeKey, PageSize, CurrentPage, ref TotalRecords );
            }
            else
            {
                objLog = objLogController.GetLog( strLogTypeKey, PageSize, CurrentPage, ref TotalRecords );
            }

            if( objLog.Count > 0 )
            {
                dlLog.Visible = true;
                pnlSendExceptions.Visible = true;
                if( UserInfo.IsSuperUser )
                {
                    btnDelete.Visible = true;
                    btnClear.Visible = true;
                }
                pnlOptions.Visible = true;
                tblInstructions.Visible = true;
                dlLog.DataSource = objLog;
                dlLog.DataBind();

                InitializePaging( ctlPagingControlBottom, TotalRecords, PageSize );
            }
            else
            {
                UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "NoEntries", this.LocalResourceFile ), ModuleMessageType.YellowWarning );
                dlLog.Visible = false;
                pnlSendExceptions.Visible = false;
                btnDelete.Visible = false;
                btnClear.Visible = false;
                pnlLegend.Visible = false;
                tblInstructions.Visible = false;
            }
        }
Ejemplo n.º 13
0
 private static void UpgradeToVersion501()
 {
     //add new Cache Error Event Type
     var logController = new LogController();
     string configFile = string.Format("{0}Logs\\LogConfig\\CacheErrorTemplate.xml.resources", Globals.HostMapPath);
     logController.AddLogType(configFile, Null.NullString);
 }
Ejemplo n.º 14
0
 protected void btnClear_Click( Object sender, EventArgs e )
 {
     LogController objLoggingController = new LogController();
     objLoggingController.ClearLog();
     UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "LogCleared", this.LocalResourceFile ), ModuleMessageType.GreenSuccess );
     BindPortalDropDown();
     dlLog.Visible = false;
     pnlSendExceptions.Visible = false;
     btnDelete.Visible = false;
     btnClear.Visible = false;
     pnlOptions.Visible = false;
     pnlLegend.Visible = false;
     tblInstructions.Visible = false;
 }
Ejemplo n.º 15
0
        protected void Page_Init( Object sender, EventArgs e )
        {
            
            LogController l = new LogController();
            arrLogTypeInfo = l.GetLogTypeInfo();

            htLogTypeInfo = new Hashtable();

            int i;
            for( i = 0; i <= arrLogTypeInfo.Count - 1; i++ )
            {
                LogTypeInfo objLogTypeInfo = (LogTypeInfo)arrLogTypeInfo[i];
                htLogTypeInfo.Add( objLogTypeInfo.LogTypeKey, objLogTypeInfo );
            }

            string ColorCoding;
            ColorCoding = Convert.ToString( Personalization.GetProfile( "LogViewer", "ColorCoding" ) );
            if( ColorCoding == "0" )
            {
                ColorCodingOn = false;
            }
            else if( ColorCoding == "1" )
            {
                ColorCodingOn = true;
            }
            else
            {
                ColorCodingOn = true;
            }

            string ColorCodingLegend;
            ColorCodingLegend = Convert.ToString( Personalization.GetProfile( "LogViewer", "ColorCodingLegend" ) );
            if( ColorCodingLegend == "0" )
            {
                ColorCodingLegendOn = false;
            }
            else if( ColorCodingLegend == "1" )
            {
                ColorCodingLegendOn = true;
            }
            else
            {
                ColorCodingLegendOn = true;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// The Page_Load runs when the page loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///   [cnurse] 17/9/2004  Updated for localization, Help and 508
        /// </history>
        protected void Page_Load( Object sender, EventArgs e )
        {
            try
            {
                

                // If this is the first visit to the page, populate the site data
                if( Page.IsPostBack == false )
                {
                    LogController objLC = new LogController();
                    objLC.PurgeLogBuffer();

                    if( Request.QueryString["CurrentPage"] != null )
                    {
                        PageIndex = Convert.ToInt32( Request.QueryString["CurrentPage"] );
                    }
                    else
                    {
                        PageIndex = 1;
                    }

                    if( Request.QueryString["PageRecords"] != null )
                    {
                        ddlRecordsPerPage.SelectedValue = Request.QueryString["PageRecords"];
                    }

                    BindPortalDropDown();
                    BindLogTypeDropDown();
                    BindData();
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
Ejemplo n.º 17
0
        private XmlDocument GetSelectedExceptions()
        {
            XmlDocument objXML = new XmlDocument();
            try
            {
                
                string s = Request.Form["Exception"];
                if( s != null )
                {
                    string[] arrExcPositions = new string[0];
                    if( s.LastIndexOf( "," ) > 0 )
                    {
                        arrExcPositions = s.Split( Convert.ToChar( "," ) );
                    }
                    else if( s.Length > 0 )
                    {
                        arrExcPositions = new string[1];
                        arrExcPositions[0] = s;
                    }

                    LogController objLoggingController = new LogController();

                    objXML.LoadXml( "<LogEntries></LogEntries>" );

                    int i;
                    int j = arrExcPositions.Length;
                    for( i = 1; i <= arrExcPositions.Length; i++ )
                    {
                        j--;
                        string[] excKey;
                        excKey = arrExcPositions[j].Split( Convert.ToChar( "|" ) );
                        LogInfo objLogInfo = new LogInfo();
                        objLogInfo.LogGUID = excKey[0];
                        objLogInfo.LogFileID = excKey[1];
                        XmlNode objNode;
                        objNode = objXML.ImportNode( ( (XmlNode)objLoggingController.GetSingleLog( objLogInfo, LoggingProvider.ReturnType.XML ) ), true );
                        objXML.DocumentElement.AppendChild( objNode );
                    }
                }
            }
            catch( Exception exc )
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
            return objXML;
        }
Ejemplo n.º 18
0
        private void DeleteSelectedExceptions()
        {
            try
            {
                
                string s = Request.Form["Exception"];
                if( s != null )
                {
                    string[] arrExcPositions = new string[0];
                    if( s.LastIndexOf( "," ) > 0 )
                    {
                        arrExcPositions = s.Split( Convert.ToChar( "," ) );
                    }
                    else if( s.Length > 0 )
                    {
                        arrExcPositions = new string[1];
                        arrExcPositions[0] = s;
                    }

                    LogController objLoggingController = new LogController();

                    int i;
                    int j = arrExcPositions.Length;
                    for( i = 1; i <= arrExcPositions.Length; i++ )
                    {
                        j--;
                        string[] excKey;
                        excKey = arrExcPositions[j].Split( Convert.ToChar( "|" ) );
                        LogInfo objLogInfo = new LogInfo();
                        objLogInfo.LogGUID = excKey[0];
                        objLogInfo.LogFileID = excKey[1];
                        objLoggingController.DeleteLog( objLogInfo );
                    }
                    UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "DeleteSuccess", this.LocalResourceFile ), ModuleMessageType.GreenSuccess );
                }
                BindPortalDropDown();
                BindData();
            }
            catch( Exception exc )
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
Ejemplo n.º 19
0
        protected void dgLogTypeConfigInfo_EditCommand(object source, DataGridCommandEventArgs e)
        {
            var LogID = Convert.ToString(dgLogTypeConfigInfo.DataKeys[e.Item.ItemIndex]);
            ViewState["LogID"] = LogID;

            BindDetailData();

            var l = new LogController();

            LogTypeConfigInfo objLogTypeConfigInfo = l.GetLogTypeConfigInfoByID(LogID);

            chkIsActive.Checked = objLogTypeConfigInfo.LoggingIsActive;
            chkEmailNotificationStatus.Checked = objLogTypeConfigInfo.EmailNotificationIsActive;

            if (ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey) != null)
            {
                ddlLogTypeKey.ClearSelection();
                ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey).Selected = true;
            }
            if (ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID) != null)
            {
                ddlLogTypePortalID.ClearSelection();
                ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID).Selected = true;
            }
            if (ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent) != null)
            {
                ddlKeepMostRecent.ClearSelection();
                ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent).Selected = true;
            }
            if (ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString()) != null)
            {
                ddlThreshold.ClearSelection();
                ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString()).Selected = true;
            }
            if (ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString()) != null)
            {
                ddlThresholdNotificationTime.ClearSelection();
                ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString()).Selected = true;
            }
            if (ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()) != null)
            {
                ddlThresholdNotificationTimeType.ClearSelection();
                ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()).Selected = true;
            }
            txtMailFromAddress.Text = objLogTypeConfigInfo.MailFromAddress;
            txtMailToAddress.Text = objLogTypeConfigInfo.MailToAddress;
            DisableLoggingControls();
        }
        protected void DgLogTypeConfigInfoEditCommand(object source, GridCommandEventArgs e)
        {
            var logID = Convert.ToString(((GridDataItem)e.Item).GetDataKeyValue("ID"));
            ViewState["LogID"] = logID;

            BindDetailData();

            var l = new LogController();

            LogTypeConfigInfo objLogTypeConfigInfo = l.GetLogTypeConfigInfoByID(logID);

            chkIsActive.Checked = objLogTypeConfigInfo.LoggingIsActive;
            chkEmailNotificationStatus.Checked = objLogTypeConfigInfo.EmailNotificationIsActive;

            if (ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey) != null)
            {
                ddlLogTypeKey.ClearSelection();
                ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey).Selected = true;
            }
            if (ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID) != null)
            {
                ddlLogTypePortalID.ClearSelection();
                ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID).Selected = true;
            }
            if (ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent) != null)
            {
                ddlKeepMostRecent.ClearSelection();
                ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent).Selected = true;
            }
            if (ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString(CultureInfo.InvariantCulture)) != null)
            {
                ddlThreshold.ClearSelection();
                ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString(CultureInfo.InvariantCulture)).Selected = true;
            }
            if (ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString(CultureInfo.InvariantCulture)) != null)
            {
                ddlThresholdNotificationTime.ClearSelection();
                ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString(CultureInfo.InvariantCulture)).Selected = true;
            }
            if (ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()) != null)
            {
                ddlThresholdNotificationTimeType.ClearSelection();
                ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()).Selected = true;
            }
            txtMailFromAddress.Text = objLogTypeConfigInfo.MailFromAddress;
            txtMailToAddress.Text = objLogTypeConfigInfo.MailToAddress;
            DisableLoggingControls();

            e.Canceled = true; //disable inline editing in grid
        }
Ejemplo n.º 21
0
 private static void UpgradeToVersion323()
 {
     //add new SecurityException
     var logController = new LogController();
     string configFile = Globals.HostMapPath + "Logs\\LogConfig\\SecurityExceptionTemplate.xml.resources";
     logController.AddLogType(configFile, Null.NullString);
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the Update Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/17/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnUpdateClick(Object sender, EventArgs e)
        {
            var objLogTypeConfigInfo = new LogTypeConfigInfo
                                           {
                                               LoggingIsActive = chkIsActive.Checked,
                                               LogTypeKey = ddlLogTypeKey.SelectedItem.Value,
                                               LogTypePortalID = ddlLogTypePortalID.SelectedItem.Value,
                                               KeepMostRecent = ddlKeepMostRecent.SelectedItem.Value,

                                               EmailNotificationIsActive = chkEmailNotificationStatus.Checked,
                                               NotificationThreshold = Convert.ToInt32(ddlThreshold.SelectedItem.Value),
                                               NotificationThresholdTime = Convert.ToInt32(ddlThresholdNotificationTime.SelectedItem.Value),
                                               NotificationThresholdTimeType =
                                                   (LogTypeConfigInfo.NotificationThresholdTimeTypes)
                                                   Enum.Parse(typeof (LogTypeConfigInfo.NotificationThresholdTimeTypes), ddlThresholdNotificationTimeType.SelectedItem.Value),
                                               MailFromAddress = txtMailFromAddress.Text,
                                               MailToAddress = txtMailToAddress.Text
                                           };
            var l = new LogController();

            if (ViewState["LogID"] != null)
            {
                objLogTypeConfigInfo.ID = Convert.ToString(ViewState["LogID"]);
                l.UpdateLogTypeConfigInfo(objLogTypeConfigInfo);
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ConfigUpdated", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
            }
            else
            {
                objLogTypeConfigInfo.ID = Guid.NewGuid().ToString();
                l.AddLogTypeConfigInfo(objLogTypeConfigInfo);
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ConfigAdded", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
            }
            BindSummaryData();
        }
Ejemplo n.º 23
0
        private static void UpgradeToVersion710()
        {
            //create a placeholder entry - uses the most common 5 character password (seed list is 6 characters and above)
            const string listName = "BannedPasswords";
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = Null.NullInteger;
                entry.ListName = listName;
                entry.Value = "12345";
                entry.Text = "Placeholder";
                entry.SystemList = false;
            }

            //add list to each portal and update primary alias
            var portalController = new PortalController();
            foreach (PortalInfo portal in portalController.GetPortals())
            {
                entry.PortalID = portal.PortalID;
                entry.SystemList = false;
                entry.ListName = listName + "-" + portal.PortalID;
                listController.AddListEntry(entry);

                var defaultAlias = PortalController.GetPortalSetting("DefaultPortalAlias", portal.PortalID, String.Empty);
                if (!String.IsNullOrEmpty(defaultAlias))
                {
                    foreach (var alias in TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(portal.PortalID).Where(alias => alias.HTTPAlias == defaultAlias))
                    {
                        alias.IsPrimary = true;
                        TestablePortalAliasController.Instance.UpdatePortalAlias(alias);
                    }
                }
            }

            int advancedFeaturesTabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host//ProfessionalFeatures", Null.NullString);

            //Add Pages under Advanced Features Tab
            AddProfessionalPreviewPage(advancedFeaturesTabID,
                        "//Host//ProfessionalFeatures//AdvancedUrlManagement",
                        "ProfessionalPreview",
                        "Advanced URL Management",
                        "Manage web servers in a web farm.",
                        "~/Icons/Sigma/AdvancedUrlMngmt_16x16.png",
                        "~/Icons/Sigma/AdvancedUrlMngmt_32x32.png");

            // Add File Content Type
            var typeController = new ContentTypeController(); 
            var contentTypeFile = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();

            if (contentTypeFile == null)
            {
                typeController.AddContentType(new ContentType { ContentType = "File" });
            }

            var fileContentType = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault();
           

            //only perform following for an existing installation upgrading
            if (Globals.Status == Globals.UpgradeStatus.Upgrade)
            {
                UpdateFoldersForParentId();
                ImportDocumentLibraryCategories();
                ImportDocumentLibraryCategoryAssoc(fileContentType);   
            }
            
            //Add 404 Log
            var logController = new LogController();
            var logTypeInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 404 Page Not Found",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            logController.AddLogType(logTypeInfo);

            //Add LogType
            var logTypeConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
                LogTypeKey = EventLogController.EventLogType.PAGE_NOT_FOUND_404.ToString(),
                KeepMostRecent = "100",
                NotificationThreshold = 1,
                NotificationThresholdTime = 1,
                NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                MailFromAddress = Null.NullString,
                MailToAddress = Null.NullString,
                LogTypePortalID = "*"
            };
            logController.AddLogTypeConfigInfo(logTypeConf);

            UninstallPackage("DotNetNuke.SearchInput");

            //enable password strength meter for new installs only
            HostController.Instance.Update("EnableStrengthMeter", Globals.Status == Globals.UpgradeStatus.Install ? "Y" : "N");

            //Add IP filter log type
            var logTypeFilterInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                LogTypeFriendlyName = "HTTP Error Code 403.6 forbidden ip address rejected",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationFailure",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            logController.AddLogType(logTypeFilterInfo);

            //Add LogType
            var logTypeFilterConf = new LogTypeConfigInfo
            {
                LoggingIsActive = true,
                LogTypeKey = EventLogController.EventLogType.IP_LOGIN_BANNED.ToString(),
                KeepMostRecent = "100",
                NotificationThreshold = 1,
                NotificationThresholdTime = 1,
                NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                MailFromAddress = Null.NullString,
                MailToAddress = Null.NullString,
                LogTypePortalID = "*"
            };
            logController.AddLogTypeConfigInfo(logTypeFilterConf);

            var tabController = new TabController();

            int tabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host//SearchAdmin", Null.NullString);
            if (tabID > Null.NullInteger)
                tabController.DeleteTab(tabID, Null.NullInteger);

            var modDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Search Admin");

            if (modDef != null)
                AddAdminPages("Search Admin", "Manage search settings associated with DotNetNuke's search capability.", "~/Icons/Sigma/Search_16x16_Standard.png", "~/Icons/Sigma/Search_32x32_Standard.png", true, modDef.ModuleDefID, "Search Admin", "");

	        CopyGettingStartedStyles();
        }
        private void BindSummaryData()
        {
            var objLogController = new LogController();
            ArrayList arrLogTypeConfigInfo = objLogController.GetLogTypeConfigInfo();

            dgLogTypeConfigInfo.DataSource = arrLogTypeConfigInfo;
            dgLogTypeConfigInfo.DataBind();
            pnlEditLogTypeConfigInfo.Visible = false;
            pnlLogTypeConfigInfo.Visible = true;
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            jQuery.RequestDnnPluginsRegistration();

            btnClear.Click += BtnClearClick;
            btnDelete.Click += BtnDeleteClick;
            btnEmail.Click += BtnEmailClick;
            ddlLogType.SelectedIndexChanged += DdlLogTypeSelectedIndexChanged;
            ddlPortalid.SelectedIndexChanged += DdlPortalIDSelectedIndexChanged;
            ddlRecordsPerPage.SelectedIndexChanged += DdlRecordsPerPageSelectedIndexChanged;

            if (Request.QueryString["CurrentPage"] != null)
            {
                _pageIndex = Convert.ToInt32(Request.QueryString["CurrentPage"]);
            }

            var logController = new LogController();
            _logTypeDictionary = logController.GetLogTypeInfoDictionary();
        }
Ejemplo n.º 26
0
        private static void UpgradeToVersion711()
        {
            DesktopModuleController.DeleteDesktopModule("FileManager");

            //Add TabUrl Logtypes
            var logController = new LogController();
            var logTypeInfo = new LogTypeInfo
            {
                LogTypeKey = EventLogController.EventLogType.TABURL_CREATED.ToString(),
                LogTypeFriendlyName = "TabURL created",
                LogTypeDescription = "",
                LogTypeCSSClass = "OperationSuccess",
                LogTypeOwner = "DotNetNuke.Logging.EventLogType"
            };
            logController.AddLogType(logTypeInfo);

            logTypeInfo.LogTypeKey = EventLogController.EventLogType.TABURL_UPDATED.ToString();
            logTypeInfo.LogTypeFriendlyName = "TabURL updated";
            logController.AddLogType(logTypeInfo);

            logTypeInfo.LogTypeKey = EventLogController.EventLogType.TABURL_DELETED.ToString();
            logTypeInfo.LogTypeFriendlyName = "TabURL deleted";
            logController.AddLogType(logTypeInfo);

        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// cmdDelete_Click runs when the delete Button is clicked
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[cnurse]	9/17/2004	Updated to reflect design changes for Help, 508 support
 ///                       and localisation
 /// </history>
 /// -----------------------------------------------------------------------------
 protected void OnDeleteClick(Object sender, EventArgs e)
 {
     var objLogTypeConfigInfo = new LogTypeConfigInfo();
     var l = new LogController();
     objLogTypeConfigInfo.ID = Convert.ToString(ViewState["LogID"]);
     try
     {
         l.DeleteLogTypeConfigInfo(objLogTypeConfigInfo);
         UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ConfigDeleted", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
         BindSummaryData();
     }
     catch
     {
         UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DeleteError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
     }
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Page_Load runs when the page loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///   [cnurse] 17/9/2004  Updated for localization, Help and 508
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                // If this is the first visit to the page, populate the site data
                if (Page.IsPostBack == false)
                {
                    var logController = new LogController();
                    logController.PurgeLogBuffer();
                    if (Request.QueryString["PageRecords"] != null)
                    {
                        ddlRecordsPerPage.SelectedValue = Request.QueryString["PageRecords"];
                    }
                    BindPortalDropDown();
                    BindLogTypeDropDown();
                    BindData();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        private void BindDetailData()
        {
            var pc = new PortalController();
            ddlLogTypePortalID.DataTextField = "PortalName";
            ddlLogTypePortalID.DataValueField = "PortalID";
            ddlLogTypePortalID.DataSource = pc.GetPortals();
            ddlLogTypePortalID.DataBind();

            // ReSharper disable LocalizableElement
            var i = new ListItem {Text = Localization.GetString("All"), Value = "*"};
            // ReSharper restore LocalizableElement
            ddlLogTypePortalID.Items.Insert(0, i);

            pnlEditLogTypeConfigInfo.Visible = true;
            pnlLogTypeConfigInfo.Visible = false;
            var logController = new LogController();

            var arrLogTypeInfo = logController.GetLogTypeInfoDictionary().Values.OrderBy(t => t.LogTypeFriendlyName);

            ddlLogTypeKey.DataTextField = "LogTypeFriendlyName";
            ddlLogTypeKey.DataValueField = "LogTypeKey";
            ddlLogTypeKey.DataSource = arrLogTypeInfo;
            ddlLogTypeKey.DataBind();

            int[] items = {1, 2, 3, 4, 5, 10, 25, 100, 250, 500};
            ddlKeepMostRecent.Items.Clear();
            ddlKeepMostRecent.Items.Add(new ListItem(Localization.GetString("All"), "*"));
            foreach (int item in items)
            {
                ddlKeepMostRecent.Items.Add(item == 1
                                                ? new ListItem(item + Localization.GetString("LogEntry", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))
                                                : new ListItem(item + Localization.GetString("LogEntries", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)));
            }
            int[] items2 = {1, 2, 3, 4, 5, 10, 25, 100, 250, 500, 1000};
            ddlThreshold.Items.Clear();
            foreach (int item in items2)
            {
                ddlThreshold.Items.Add(item == 1
                                           ? new ListItem(item + Localization.GetString("Occurence", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))
                                           : new ListItem(item + Localization.GetString("Occurences", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)));
            }
            // ReSharper disable LocalizableElement
            var j = new ListItem {Text = Localization.GetString("All"), Value = "*"};
            // ReSharper restore LocalizableElement
            ddlLogTypeKey.Items.Insert(0, j);
        }
        private void BtnClearClick(Object sender, EventArgs e)
        {
            var objLoggingController = new LogController();
            objLoggingController.ClearLog();
            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("LogCleared", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
            var objEventLog = new EventLogController();

            //add entry to log recording it was cleared
            objEventLog.AddLog(Localization.GetString("LogCleared", LocalResourceFile),
                               Localization.GetString("Username", LocalResourceFile) + ":" + UserInfo.Username,
                               PortalSettings,
                               -1,
                               EventLogController.EventLogType.ADMIN_ALERT);
            BindPortalDropDown();
            dlLog.Visible = false;
            btnDelete.Visible = false;
            btnClear.Visible = false;
            ctlPagingControlBottom.Visible = false;
        }
 private void DeleteSelectedExceptions()
 {
     try
     {
         var s = Request.Form["Exception"];
         if (s != null)
         {
             string[] positions = null;
             if (s.LastIndexOf(",") > 0)
             {
                 positions = s.Split(Convert.ToChar(","));
             }
             else if (!String.IsNullOrEmpty(s))
             {
                 positions = new[] {s};
             }
             var objLoggingController = new LogController();
             if (positions != null)
             {
                 var j = positions.Length;
                 for (var i = 0; i < positions.Length; i++)
                 {
                     j -= 1;
                     var excKey = positions[j].Split(Convert.ToChar("|"));
                     var objLogInfo = new LogInfo {LogGUID = excKey[0], LogFileID = excKey[1]};
                     objLoggingController.DeleteLog(objLogInfo);
                 }
             }
             UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DeleteSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
         }
         BindPortalDropDown();
         BindData();
     }
     catch (Exception exc)
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
Ejemplo n.º 32
0
        public void AddLog(LogInfo objEventLogInfo)
        {
            LogController objLogController = new LogController();

            objLogController.AddLog(objEventLogInfo);
        }