当前位置: 首页>>代码示例>>C#>>正文


C# PortalSecurity.InputFilter方法代码示例

本文整理汇总了C#中DotNetNuke.Security.PortalSecurity.InputFilter方法的典型用法代码示例。如果您正苦于以下问题:C# PortalSecurity.InputFilter方法的具体用法?C# PortalSecurity.InputFilter怎么用?C# PortalSecurity.InputFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Security.PortalSecurity的用法示例。


在下文中一共展示了PortalSecurity.InputFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveComment

        public void SaveComment(CommentInfo comment)
        {
            var portalSecurity = new PortalSecurity();
            if (!String.IsNullOrEmpty(comment.Comment))
            {
                comment.Comment = HttpUtility.HtmlDecode(portalSecurity.InputFilter(comment.Comment, PortalSecurity.FilterFlag.NoScripting));
                comment.Comment = portalSecurity.InputFilter(comment.Comment, Security.PortalSecurity.FilterFlag.NoMarkup);
            }
            //TODO: enable once the profanity filter is working properly.
            //objCommentInfo.Comment = portalSecurity.Remove(objCommentInfo.Comment, DotNetNuke.Security.PortalSecurity.ConfigType.ListController, "ProfanityFilter", DotNetNuke.Security.PortalSecurity.FilterScope.PortalList);

            if (comment.Comment != null && comment.Comment.Length > 2000)
            {
                comment.Comment = comment.Comment.Substring(0, 1999);
            }
            string xml = null;
            if (comment.CommentXML != null)
            {
                xml = comment.CommentXML.OuterXml;
            }

            comment.CommentId = _dataService.Journal_Comment_Save(comment.JournalId, comment.CommentId, comment.UserId, comment.Comment, xml);
            var newComment = GetComment(comment.CommentId);
            comment.DateCreated = newComment.DateCreated;
            comment.DateUpdated = newComment.DateUpdated;
        }
开发者ID:biganth,项目名称:Curt,代码行数:26,代码来源:InternalJournalControllerImpl.cs

示例2: RenderAttributes

        protected override void RenderAttributes(HtmlTextWriter writer)
        {
            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
            base.RenderAttributes(htmlWriter);
            string html = stringWriter.ToString();

            // Locate and replace action attribute
            int startPoint = html.IndexOf("action=\"");
            if (startPoint >= 0) //does action exist?
            {
                int endPoint = html.IndexOf("\"", startPoint + 8) + 1;
                html = html.Remove(startPoint, endPoint - startPoint);
                PortalSecurity objSecurity = new PortalSecurity();
                html = html.Insert(startPoint, "action=\"" + objSecurity.InputFilter(HttpContext.Current.Request.RawUrl, PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets | PortalSecurity.FilterFlag.NoMarkup) + "\"");
            }

            //' Locate and replace id attribute
            if (base.ID != null)
            {
                startPoint = html.IndexOf("id=\"");
                if (startPoint >= 0) //does id exist?
                {
                    int EndPoint = html.IndexOf("\"", startPoint + 4) + 1;
                    html = html.Remove(startPoint, EndPoint - startPoint);
                    html = html.Insert(startPoint, "id=\"" + base.ClientID + "\"");
                }
            }

            writer.Write(html);
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:31,代码来源:Form.cs

示例3: FilterScripts

			public static string FilterScripts(string text)
			{
				if (string.IsNullOrEmpty(text))
				{
					return string.Empty;
				}
				PortalSecurity objPortalSecurity = new PortalSecurity();
				try
				{
					text = objPortalSecurity.InputFilter(text, PortalSecurity.FilterFlag.NoScripting);
				}
				catch (Exception ex)
				{

				}

				string pattern = "<script.*/*>|</script>|<[a-zA-Z][^>]*=['\"]+javascript:\\w+.*['\"]+>|<\\w+[^>]*\\son\\w+=.*[ /]*>";
				text = Regex.Replace(text, pattern, string.Empty, RegexOptions.IgnoreCase);
				string strip = "/*,*/,alert,document.,window.,eval(,eval[,@import,vbscript,javascript,jscript,msgbox";
				foreach (string s in strip.Split(','))
				{
					if (text.ToUpper().Contains(s.ToUpper()))
					{
						text = text.Replace(s.ToUpper(), string.Empty);
						text = text.Replace(s, string.Empty);
					}
				}
				return text;
			}
开发者ID:allanedk,项目名称:ActiveForums,代码行数:29,代码来源:TextUtils.cs

示例4: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var objSecurity = new PortalSecurity();
            if ((Request.Params["Tag"] != null))
            {
                _tagQuery = HttpContext.Current.Server.HtmlEncode(objSecurity.InputFilter(Request.Params["Tag"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup));
            }

            if (_tagQuery.Length > 0)
            {
            //                if (!Page.IsPostBack)
            //                {
                    BindData();
            //                }
            }
            else
            {
                if (IsEditable)
                {
                   UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleHidden", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                }
                else
                {
                    ContainerControl.Visible = false;
                }
            }
        }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:29,代码来源:ContentList.ascx.cs

示例5: GetFilteredValue

 private static string GetFilteredValue(PortalSecurity objSecurity, string value)
 {
     return objSecurity.InputFilter(
         value,
         PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets
         | PortalSecurity.FilterFlag.NoMarkup);
 }
开发者ID:shahinhemati,项目名称:project-example-a,代码行数:7,代码来源:QAServiceController.cs

示例6: GetProperty

        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider,
                                  UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            if (_nameValueCollection == null)
                return string.Empty;
            var value = _nameValueCollection[strPropertyName];

            if (string.IsNullOrEmpty(strFormat)) strFormat = string.Empty;
            if (value != null)
            {
                var security = new PortalSecurity();
                value = security.InputFilter(value, PortalSecurity.FilterFlag.NoScripting);
                return security.InputFilter(PropertyAccess.FormatString(value, strFormat),
                                            PortalSecurity.FilterFlag.NoScripting);
            }
            else
            {
                propertyNotFound = true;
                return string.Empty;
            }
        }
开发者ID:DNNCommunity,项目名称:DNN.XML,代码行数:21,代码来源:FilteredNameValueCollectionPropertyAccess.cs

示例7: GetTagsCompletionList

        public string[] GetTagsCompletionList(string prefixText, int count, string contextKey)
        {
            var objSecurity = new PortalSecurity();

            DataTable dt = Tag.GetTagsByString(objSecurity.InputFilter(HttpUtility.UrlDecode(prefixText), PortalSecurity.FilterFlag.NoSQL), Convert.ToInt32(contextKey, CultureInfo.InvariantCulture));

            var returnTags = new string[dt.Rows.Count];
            foreach (DataRow dr in dt.Rows)
            {
                returnTags[0] = dr["name"].ToString();
            }

            return returnTags;
        }
开发者ID:ChrisHammond,项目名称:Engage-Publish,代码行数:14,代码来源:PublishServices.asmx.cs

示例8: GetProperty

 /// <summary>
 /// Get Property out of NameValueCollection
 /// </summary>
 /// <param name="strPropertyName"></param>
 /// <param name="strFormat"></param>
 /// <param name="formatProvider"></param>
 /// <param name="AccessingUser"></param>
 /// <param name="AccessLevel"></param>
 /// <param name="PropertyNotFound"></param>
 /// <returns></returns>
 public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     if (NameValueCollection == null)
         return string.Empty;
     var value = NameValueCollection[strPropertyName];
     //string OutputFormat = null;
     //if (strFormat == string.Empty)
     //{
     //    OutputFormat = "g";
     //}
     //else
     //{
     //    OutputFormat = string.Empty;
     //}
     if (value != null)
     {
         var Security = new PortalSecurity();
         value = Security.InputFilter(value, PortalSecurity.FilterFlag.NoScripting);
         return Security.InputFilter(PropertyAccess.FormatString(value, strFormat), PortalSecurity.FilterFlag.NoScripting);
     }
     PropertyNotFound = true;
     return string.Empty;
 }
开发者ID:BravoSierra,项目名称:2sxc,代码行数:33,代码来源:FilteredNameValueCollectionPropertyAccess.cs

示例9: OnSaveEntryClick

        /// <summary>
        ///     Handles cmdSaveEntry.Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        ///     Using "CommandName" property of cmdSaveEntry to determine action to take (ListUpdate/AddEntry/AddList)
        /// </remarks>
        protected void OnSaveEntryClick(object sender, EventArgs e)
        {
            String entryValue;
            String entryText;
            if (UserInfo.IsSuperUser)
            {
                entryValue = txtEntryValue.Text;
                entryText = txtEntryText.Text;
            }
            else
            {
                var ps = new PortalSecurity();

                entryValue = ps.InputFilter(txtEntryValue.Text, PortalSecurity.FilterFlag.NoScripting);
                entryText = ps.InputFilter(txtEntryText.Text, PortalSecurity.FilterFlag.NoScripting);
            }
            var listController = new ListController();
            var entry = new ListEntryInfo();
            {
                entry.DefinitionID = Null.NullInteger;
                entry.PortalID = ListPortalID;
                entry.ListName = txtEntryName.Text;
                entry.Value = entryValue;
                entry.Text = entryText;
            }
            if (Page.IsValid)
            {
                Mode = "ListEntries";
                switch (cmdSaveEntry.CommandName.ToLower())
                {
                    case "update":
                        entry.ParentKey = SelectedList.ParentKey;
                        entry.EntryID = Int16.Parse(txtEntryID.Text);
                        bool canUpdate = true;
                        foreach (var curEntry in listController.GetListEntryInfoItems(SelectedList.Name, entry.ParentKey, entry.PortalID))
                        {
                            if (entry.EntryID != curEntry.EntryID) //not the same item we are trying to update
                            {
                                if (entry.Value == curEntry.Value && entry.Text == curEntry.Text)
                                {
                                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                                    canUpdate = false;
                                    break;
                                }

                            }
                        }

                        if (canUpdate)
                        {
                            listController.UpdateListEntry(entry);
                            DataBind();
                        }
                        break;
                    case "saveentry":
                        if (SelectedList != null)
                        {
                            entry.ParentKey = SelectedList.ParentKey;
                            entry.ParentID = SelectedList.ParentID;
                            entry.Level = SelectedList.Level;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
                        {
                            entry.SortOrder = 0;
                        }

                        if (listController.AddListEntry(entry) == Null.NullInteger) //entry already found in database
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ItemAlreadyPresent", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        }

                        DataBind();
                        break;
                    case "savelist":
                        if (ddlSelectParent.SelectedIndex != -1)
                        {
                            int parentID = Int32.Parse(ddlSelectParent.SelectedItem.Value);
                            ListEntryInfo parentEntry = listController.GetListEntryInfo(parentID);
                            entry.ParentID = parentID;
                            entry.DefinitionID = parentEntry.DefinitionID;
                            entry.Level = parentEntry.Level + 1;
                            entry.ParentKey = parentEntry.Key;
                        }
                        if (chkEnableSortOrder.Checked)
                        {
                            entry.SortOrder = 1;
                        }
                        else
//.........这里部分代码省略.........
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:101,代码来源:ListEntries.ascx.cs

示例10: OnLoad

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        /// 	[cnurse]	11/11/2004	documented
        ///     [cnurse]    12/13/2004  Switched to using a DataGrid for Search Results
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            dgResults.PageIndexChanged += dgResults_PageIndexChanged;
            ctlPagingControl.PageChanged += ctlPagingControl_PageChanged;

            var objSecurity = new PortalSecurity();
            if (Request.Params["Search"] != null)
            {
                _SearchQuery = HttpContext.Current.Server.HtmlEncode(objSecurity.InputFilter(Request.Params["Search"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup));
            }
            if (!String.IsNullOrEmpty(_SearchQuery))
            {
                if (!Page.IsPostBack)
                {
                    BindData();
                }
            }
            else
            {
                if (IsEditable)
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleHidden", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                }
                else
                {
                    ContainerControl.Visible = false;
                }
            }
        }
开发者ID:ReneProc,项目名称:BoatRouteKeeper,代码行数:40,代码来源:SearchResults.ascx.cs

示例11: ProcessSavePostBody

 /// <summary>
 /// Processes a post's body content prior to submission to the data store. It performs all content manipulation including security checks and returns it for saving to the data store.
 /// </summary>
 /// <param name="content"></param>
 /// <returns>This will likely be updated w/ more content manipulation prior to save.</returns>
 public static string ProcessSavePostBody(string content)
 {
     var cntSecurity = new PortalSecurity();
     var cleanContent = cntSecurity.InputFilter(content, PortalSecurity.FilterFlag.NoScripting);
     return (cleanContent);
 }
开发者ID:shahinhemati,项目名称:project-example-a,代码行数:11,代码来源:Utils.cs

示例12: NewUrl

        /// <summary>
        /// newUrl returns the new URL based on the new language.
        /// Basically it is just a call to NavigateUrl, with stripped qs parameters
        /// </summary>
        /// <param name="newLanguage"></param>
        /// <history>
        ///     [erikvb]   20070814    added
        /// </history>
        private string NewUrl(string newLanguage)
        {
            var objSecurity = new PortalSecurity();
            Locale newLocale = LocaleController.Instance.GetLocale(newLanguage);

            //Ensure that the current ActiveTab is the culture of the new language
            int tabId = objPortal.ActiveTab.TabID;
            bool islocalized = false;

            TabInfo localizedTab = TabController.Instance.GetTabByCulture(tabId, objPortal.PortalId, newLocale);
            if (localizedTab != null)
            {
                islocalized = true;
                if (localizedTab.IsDeleted || !TabPermissionController.CanViewPage(localizedTab))
                {
                    PortalInfo localizedPortal = PortalController.Instance.GetPortal(objPortal.PortalId, newLocale.Code);
                    tabId = localizedPortal.HomeTabId;
                }
                else
                {
                    string fullurl = "";
                    switch (localizedTab.TabType)
                    {
                        case TabType.Normal:
                            //normal tab
                            tabId = localizedTab.TabID;
                            break;
                        case TabType.Tab:
                            //alternate tab url                                
                            fullurl = TestableGlobals.Instance.NavigateURL(Convert.ToInt32(localizedTab.Url));
                            break;
                        case TabType.File:
                            //file url
                            fullurl = TestableGlobals.Instance.LinkClick(localizedTab.Url, localizedTab.TabID, Null.NullInteger);
                            break;
                        case TabType.Url:
                            //external url
                            fullurl = localizedTab.Url;
                            break;
                    }
                    if (!string.IsNullOrEmpty(fullurl))
                    {
                        return objSecurity.InputFilter(fullurl, PortalSecurity.FilterFlag.NoScripting);
                    }
                }
            }

            // on localised pages most of the querystring parameters have no sense and generate duplicate urls for the same content
            // because we are on a other tab with other modules (example : ?returntab=/en-US/about)
            string rawQueryString = "";
            if (DotNetNuke.Entities.Host.Host.UseFriendlyUrls && !islocalized )
            {
                rawQueryString = new Uri(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.RawUrl).Query;
            }

            return
                objSecurity.InputFilter(
                    TestableGlobals.Instance.NavigateURL(tabId, objPortal.ActiveTab.IsSuperTab, objPortal, HttpContext.Current.Request.QueryString["ctl"], newLanguage, GetQsParams(newLocale.Code, islocalized)) +
                    rawQueryString,
                    PortalSecurity.FilterFlag.NoScripting);
        }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:69,代码来源:LanguageTokenReplace.cs

示例13: cmdSendPassword_Click

        /// <summary>
        /// cmdSendPassword_Click runs when the Password Reminder button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	03/21/2006  Created
        /// </history>
        protected void cmdSendPassword_Click( Object sender, EventArgs e )
        {
            string strMessage = Null.NullString;
            bool canSend = true;

            if( ( UseCaptcha && ctlCaptcha.IsValid ) || ( ! UseCaptcha ) )
            {
                if( txtUsername.Text.Trim() != "" )
                {
                    PortalSecurity objSecurity = new PortalSecurity();

                    UserInfo objUser = UserController.GetUserByName( PortalSettings.PortalId, txtUsername.Text, false );
                    if( objUser != null )
                    {
                        if( MembershipProviderConfig.PasswordRetrievalEnabled )
                        {
                            try
                            {
                                objUser.Membership.Password = UserController.GetPassword( ref objUser, txtAnswer.Text );
                            }
                            catch( Exception )
                            {
                                canSend = false;
                                strMessage = Localization.GetString( "PasswordRetrievalError", this.LocalResourceFile );
                            }
                        }
                        else
                        {
                            canSend = false;
                            strMessage = Localization.GetString( "PasswordRetrievalDisabled", this.LocalResourceFile );
                        }
                        if( canSend )
                        {
                            try
                            {
                                Mail.SendMail( objUser, MessageType.PasswordReminder, PortalSettings );
                                strMessage = Localization.GetString( "PasswordSent", this.LocalResourceFile );
                            }
                            catch( Exception )
                            {
                                canSend = false;
                            }
                        }
                    }
                    else
                    {
                        strMessage = Localization.GetString( "UsernameError", this.LocalResourceFile );
                        canSend = false;
                    }

                    if( canSend )
                    {
                        EventLogController objEventLog = new EventLogController();
                        LogInfo objEventLogInfo = new LogInfo();
                        objEventLogInfo.AddProperty( "IP", ipAddress );
                        objEventLogInfo.LogPortalID = PortalSettings.PortalId;
                        objEventLogInfo.LogPortalName = PortalSettings.PortalName;
                        objEventLogInfo.LogUserID = UserId;
                        objEventLogInfo.LogUserName = objSecurity.InputFilter( txtUsername.Text, PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets | PortalSecurity.FilterFlag.NoMarkup );
                        objEventLogInfo.LogTypeKey = "PASSWORD_SENT_SUCCESS";
                        objEventLog.AddLog( objEventLogInfo );

                        UI.Skins.Skin.AddModuleMessage( this, strMessage, ModuleMessageType.GreenSuccess );
                    }
                    else
                    {
                        EventLogController objEventLog = new EventLogController();
                        LogInfo objEventLogInfo = new LogInfo();
                        objEventLogInfo.AddProperty( "IP", ipAddress );
                        objEventLogInfo.LogPortalID = PortalSettings.PortalId;
                        objEventLogInfo.LogPortalName = PortalSettings.PortalName;
                        objEventLogInfo.LogUserID = UserId;
                        objEventLogInfo.LogUserName = objSecurity.InputFilter( txtUsername.Text, PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets | PortalSecurity.FilterFlag.NoMarkup );
                        objEventLogInfo.LogTypeKey = "PASSWORD_SENT_FAILURE";
                        objEventLog.AddLog( objEventLogInfo );

                        UI.Skins.Skin.AddModuleMessage( this, strMessage, ModuleMessageType.RedError );
                    }
                }
                else
                {
                    strMessage = Localization.GetString( "EnterUsername", this.LocalResourceFile );
                    UI.Skins.Skin.AddModuleMessage( this, strMessage, ModuleMessageType.RedError );
                }
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:94,代码来源:SendPassword.ascx.cs

示例14: SaveJournalItem

        // Journal Items
        public void SaveJournalItem(JournalItem journalItem, int tabId, int moduleId)
        {
            if (journalItem.UserId < 1)
            {
                throw new ArgumentException("journalItem.UserId must be for a real user");
            }
            UserInfo currentUser = UserController.GetUserById(journalItem.PortalId, journalItem.UserId);
            if (currentUser == null)
            {
                throw new Exception("Unable to locate the current user");
            }

            string xml = null;
            var portalSecurity = new PortalSecurity();
            if (!String.IsNullOrEmpty(journalItem.Title))
            {
                journalItem.Title = portalSecurity.InputFilter(journalItem.Title, PortalSecurity.FilterFlag.NoMarkup);
            }
            if (!String.IsNullOrEmpty(journalItem.Summary))
            {
                journalItem.Summary = HttpUtility.HtmlDecode(portalSecurity.InputFilter(journalItem.Summary, PortalSecurity.FilterFlag.NoScripting));
            }
            if (!String.IsNullOrEmpty(journalItem.Body))
            {
                journalItem.Body = HttpUtility.HtmlDecode(portalSecurity.InputFilter(journalItem.Body, PortalSecurity.FilterFlag.NoScripting));
            }

            if (!String.IsNullOrEmpty(journalItem.Body))
            {
                var xDoc = new XmlDocument();
                XmlElement xnode = xDoc.CreateElement("items");
                XmlElement xnode2 = xDoc.CreateElement("item");
                xnode2.AppendChild(CreateElement(xDoc, "id", "-1"));
                xnode2.AppendChild(CreateCDataElement(xDoc, "body", journalItem.Body));
                xnode.AppendChild(xnode2);
                xDoc.AppendChild(xnode);
                XmlDeclaration xDec = xDoc.CreateXmlDeclaration("1.0", null, null);
                xDec.Encoding = "UTF-16";
                xDec.Standalone = "yes";
                XmlElement root = xDoc.DocumentElement;
                xDoc.InsertBefore(xDec, root);
                journalItem.JournalXML = xDoc;
                xml = journalItem.JournalXML.OuterXml;
            }
            if (journalItem.ItemData != null)
            {
                if (!String.IsNullOrEmpty(journalItem.ItemData.Title))
                {
                    journalItem.ItemData.Title = portalSecurity.InputFilter(journalItem.ItemData.Title, PortalSecurity.FilterFlag.NoMarkup);
                }
                if (!String.IsNullOrEmpty(journalItem.ItemData.Description))
                {
                    journalItem.ItemData.Description = HttpUtility.HtmlDecode(portalSecurity.InputFilter(journalItem.ItemData.Description, PortalSecurity.FilterFlag.NoScripting));
                }
                if (!String.IsNullOrEmpty(journalItem.ItemData.Url))
                {
                    journalItem.ItemData.Url = portalSecurity.InputFilter(journalItem.ItemData.Url, PortalSecurity.FilterFlag.NoScripting);
                }
                if (!String.IsNullOrEmpty(journalItem.ItemData.ImageUrl))
                {
                    journalItem.ItemData.ImageUrl = portalSecurity.InputFilter(journalItem.ItemData.ImageUrl, PortalSecurity.FilterFlag.NoScripting);
                }
            }
            string journalData = journalItem.ItemData.ToJson();
            if (journalData == "null")
            {
                journalData = null;
            }

            PrepareSecuritySet(journalItem, currentUser);

            journalItem.JournalId = _dataService.Journal_Save(journalItem.PortalId,
                                                     journalItem.UserId,
                                                     journalItem.ProfileId,
                                                     journalItem.SocialGroupId,
                                                     journalItem.JournalId,
                                                     journalItem.JournalTypeId,
                                                     journalItem.Title,
                                                     journalItem.Summary,
                                                     journalItem.Body,
                                                     journalData,
                                                     xml,
                                                     journalItem.ObjectKey,
                                                     journalItem.AccessKey,
                                                     journalItem.SecuritySet,
                                                     journalItem.CommentsDisabled,
                                                     journalItem.CommentsHidden);

            var updatedJournalItem = GetJournalItem(journalItem.PortalId, journalItem.UserId, journalItem.JournalId);
            journalItem.DateCreated = updatedJournalItem.DateCreated;
            journalItem.DateUpdated = updatedJournalItem.DateUpdated;
            var cnt = new Content();

            if (journalItem.ContentItemId > 0)
            {
                cnt.UpdateContentItem(journalItem, tabId, moduleId);
                _dataService.Journal_UpdateContentItemId(journalItem.JournalId, journalItem.ContentItemId);
            }
            else
//.........这里部分代码省略.........
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:101,代码来源:JournalControllerImpl.cs

示例15: SaveSettings

        private void SaveSettings()
        {
            var ctlRole = new RoleController();
            RoleInfo role = ctlRole.GetRole(GroupId, PortalId);
            var sec = new PortalSecurity();

            role.RoleName = sec.InputFilter(txtGroupName.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup);

            SaveSetting(ref role, FeatureController.KEY_COUNTRY, cboCountry.SelectedValue);
            SaveSetting(ref role, FeatureController.KEY_COUNTRYFULL, cboCountry.SelectedItem.Text);

            SaveSetting(ref role, FeatureController.KEY_REGION, sec.InputFilter(ParseRegionSaveSetting(), PortalSecurity.FilterFlag.NoMarkup));
            if (role.Settings[FeatureController.KEY_REGION] == cboRegion.SelectedValue)
            {
                SaveSetting(ref role, FeatureController.KEY_REGIONFULL, cboRegion.SelectedItem.Text);
            }
            else
            {
                SaveSetting(ref role, FeatureController.KEY_REGIONFULL, sec.InputFilter(txtRegion.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
            }

            SaveSetting(ref role, FeatureController.KEY_CITY, sec.InputFilter(txtCity.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_DEFAULTLANGUAGE, cboDefaultLanguage.SelectedValue);

            SaveSetting(ref role, FeatureController.KEY_WEBSITEURL, sec.InputFilter(txtWebsiteUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_FACEBOOKURL, sec.InputFilter(txtFacebookUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_TWITTERURL, sec.InputFilter(txtTwitterUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_LINKEDINURL, sec.InputFilter(txtLinkedInUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_GOOGLEPLUSURL, sec.InputFilter(txtGooglePlusUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_MEETUPURL, sec.InputFilter(txtMeetUpUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            SaveSetting(ref role, FeatureController.KEY_YOUTUBEURL, sec.InputFilter(txtYouTubeUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));

            // update the role to save the name change
            ctlRole.UpdateRole(role);

            // save the settings
            TestableRoleController.Instance.UpdateRoleSettings(role, true);
        }
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:45,代码来源:View.ascx.cs


注:本文中的DotNetNuke.Security.PortalSecurity.InputFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。