コード例 #1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Entities.Users.UserInfo userInfo = Entities.Users.UserController.GetCurrentUserInfo();
            if (!Page.IsPostBack && userInfo != null && userInfo.UserID != Null.NullInteger)
            {
                //check view permissions - Yes?
                var portalSettings = PortalController.GetCurrentPortalSettings();
                var pageCulture    = Thread.CurrentThread.CurrentCulture.Name;
                if (string.IsNullOrEmpty(pageCulture))
                {
                    pageCulture = PortalController.GetActivePortalLanguage(portalSettings.PortalId);
                }

                List <TabInfo> tabs          = TabController.GetTabsBySortOrder(portalSettings.PortalId, pageCulture, true);
                var            sortedTabList = TabController.GetPortalTabs(tabs, Null.NullInteger, false, Null.NullString, true, false, true, true, true);

                Items.Clear();
                foreach (var _tab in sortedTabList)
                {
                    RadComboBoxItem tabItem = new RadComboBoxItem(_tab.IndentedTabName, _tab.FullUrl);
                    tabItem.Enabled = !_tab.DisableLink;

                    Items.Add(tabItem);
                }

                Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", ""));
            }

            Width = Unit.Pixel(245);
        }
コード例 #2
0
        public UserCreateStatus AddDNNUser(UserInfo AuthenticationUser)
        {
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
            PortalSecurity objSecurity     = new PortalSecurity();

            Entities.Users.UserController objDNNUsers = new Entities.Users.UserController();
            UserController objAuthUsers = new UserController();

            Entities.Users.UserInfo objDNNUser = (Entities.Users.UserInfo)AuthenticationUser;
            int AffiliateId = -1;

            if (HttpContext.Current.Request.Cookies["AffiliateId"] != null)
            {
                AffiliateId = int.Parse(HttpContext.Current.Request.Cookies["AffiliateId"].Value);
            }

            int UserID = -1;
            UserCreateStatus createStatus;

            createStatus = Entities.Users.UserController.CreateUser(ref objDNNUser);
            UserID       = objDNNUser.UserID;

            if (AuthenticationUser.AuthenticationExists && UserID > -1)
            {
                AuthenticationUser.UserID = UserID;
                AddUserRoles(_portalSettings.PortalId, AuthenticationUser);
            }

            return(createStatus);
        }
コード例 #3
0
 public TokenReplace(Scope AccessLevel, string Language, PortalSettings PortalSettings, UserInfo User, int ModuleID)
 {
     this.CurrentAccessLevel = AccessLevel;
     if (AccessLevel != Scope.NoSettings)
     {
         if (PortalSettings == null)
         {
             if (HttpContext.Current != null)
             {
                 this.PortalSettings = PortalController.GetCurrentPortalSettings();
             }
         }
         else
         {
             this.PortalSettings = PortalSettings;
         }
         if (User == null)
         {
             if (HttpContext.Current != null)
             {
                 this.User = (UserInfo)HttpContext.Current.Items["UserInfo"];
             }
             else
             {
                 this.User = new UserInfo();
             }
             this.AccessingUser = this.User;
         }
         else
         {
             this.User = User;
             if (HttpContext.Current != null)
             {
                 this.AccessingUser = (UserInfo)HttpContext.Current.Items["UserInfo"];
             }
             else
             {
                 this.AccessingUser = new UserInfo();
             }
         }
         if (string.IsNullOrEmpty(Language))
         {
             this.Language = new Localization.Localization().CurrentCulture;
         }
         else
         {
             this.Language = Language;
         }
         if (ModuleID != Null.NullInteger)
         {
             this.ModuleId = ModuleID;
         }
     }
     PropertySource["date"]     = new DateTimePropertyAccess();
     PropertySource["datetime"] = new DateTimePropertyAccess();
     PropertySource["ticks"]    = new TicksPropertyAccess();
     PropertySource["culture"]  = new CulturePropertyAccess();
 }
コード例 #4
0
 private bool CheckAccessLevel(UserVisibilityMode VisibilityMode, Entities.Users.UserInfo AccessingUser)
 {
     if (String.IsNullOrEmpty(strAdministratorRoleName) && !AccessingUser.IsSuperUser)
     {
         PortalInfo ps = new PortalController().GetPortal(objUser.PortalID);
         strAdministratorRoleName = ps.AdministratorRoleName;
     }
     return(VisibilityMode == UserVisibilityMode.AllUsers || (VisibilityMode == UserVisibilityMode.MembersOnly && AccessingUser != null && AccessingUser.UserID != -1) || (AccessingUser.IsSuperUser || objUser.UserID == AccessingUser.UserID || AccessingUser.IsInRole(strAdministratorRoleName)));
 }
コード例 #5
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Entities.Users.UserInfo userInfo = Entities.Users.UserController.GetCurrentUserInfo();
            if (!Page.IsPostBack && userInfo != null && userInfo.UserID != Null.NullInteger)
            {
                //check view permissions - Yes?
                var portalSettings = PortalController.GetCurrentPortalSettings();
                var pageCulture    = Thread.CurrentThread.CurrentCulture.Name;
                if (string.IsNullOrEmpty(pageCulture))
                {
                    pageCulture = PortalController.GetActivePortalLanguage(portalSettings.PortalId);
                }

                List <TabInfo> tabs          = TabController.GetTabsBySortOrder(portalSettings.PortalId, pageCulture, true);
                var            sortedTabList = TabController.GetPortalTabs(tabs, Null.NullInteger, false, Null.NullString, true, false, true, true, true);

                Items.Clear();
                foreach (var _tab in sortedTabList)
                {
                    var linkUrl = string.Empty;
                    switch (LinksType.ToUpperInvariant())
                    {
                    case "USETABNAME":
                        var nameLinkFormat = "http://{0}/Default.aspx?TabName={1}";
                        linkUrl = string.Format(nameLinkFormat, portalSettings.PortalAlias.HTTPAlias, HttpUtility.UrlEncode(_tab.TabName));
                        break;

                    case "USETABID":
                        var idLinkFormat = "http://{0}/Default.aspx?TabId={1}";
                        linkUrl = string.Format(idLinkFormat, portalSettings.PortalAlias.HTTPAlias, _tab.TabID);
                        break;

                    default:
                        linkUrl = _tab.FullUrl;
                        break;
                    }
                    RadComboBoxItem tabItem = new RadComboBoxItem(_tab.IndentedTabName, linkUrl);
                    tabItem.Enabled = !_tab.DisableLink;

                    Items.Add(tabItem);
                }

                Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", ""));
            }

            Width = Unit.Pixel(245);
        }
コード例 #6
0
        private static PersonalizationInfo LoadProfile()
        {
            HttpContext         context            = HttpContext.Current;
            PersonalizationInfo objPersonalization = (PersonalizationInfo)context.Items["Personalization"];

            if (objPersonalization == null)
            {
                PortalSettings            _portalSettings = (PortalSettings)context.Items["PortalSettings"];
                Entities.Users.UserInfo   UserInfo        = Entities.Users.UserController.GetCurrentUserInfo();
                PersonalizationController objPersonalizationController = new PersonalizationController();
                objPersonalization = objPersonalizationController.LoadProfile(UserInfo.UserID, _portalSettings.PortalId);
                context.Items.Add("Personalization", objPersonalization);
            }
            return(objPersonalization);
        }
コード例 #7
0
ファイル: HandlerBase.cs プロジェクト: fordnn/DNN.Forum
 public virtual void ProcessRequest(HttpContext context)
 {
     if ((HttpContext.Current.Items["PortalSettings"] != null))
     {
         portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
         portalId       = portalSettings.PortalId;
     }
     else
     {
         PortalAliasInfo objPortalAliasInfo = PortalAliasController.GetPortalAliasInfo(HttpContext.Current.Request.Url.Host);
         portalId       = objPortalAliasInfo.PortalID;
         portalSettings = PortalController.GetCurrentPortalSettings();
     }
     Localization.SetThreadCultures(Localization.GetPageLocale(portalSettings), portalSettings);
     userInfo = HttpContext.Current.Request.IsAuthenticated ? Entities.Users.UserController.GetUserByName(PortalId, HttpContext.Current.User.Identity.Name) : new Entities.Users.UserInfo {
         UserID = -1
     };
 }
コード例 #8
0
 public TokenReplace(Scope AccessLevel, string Language, PortalSettings PortalSettings, UserInfo User, int ModuleID)
 {
     this.CurrentAccessLevel = AccessLevel;
     if (AccessLevel != Scope.NoSettings)
     {
         if (PortalSettings == null)
         {
             if (HttpContext.Current != null)
                 this.PortalSettings = PortalController.GetCurrentPortalSettings();
         }
         else
         {
             this.PortalSettings = PortalSettings;
         }
         if (User == null)
         {
             if (HttpContext.Current != null)
             {
                 this.User = (UserInfo)HttpContext.Current.Items["UserInfo"];
             }
             else
             {
                 this.User = new UserInfo();
             }
             this.AccessingUser = this.User;
         }
         else
         {
             this.User = User;
             if (HttpContext.Current != null)
             {
                 this.AccessingUser = (UserInfo)HttpContext.Current.Items["UserInfo"];
             }
             else
             {
                 this.AccessingUser = new UserInfo();
             }
         }
         if (string.IsNullOrEmpty(Language))
         {
             this.Language = new Localization.Localization().CurrentCulture;
         }
         else
         {
             this.Language = Language;
         }
         if (ModuleID != Null.NullInteger)
         {
             this.ModuleId = ModuleID;
         }
     }
     PropertySource["date"] = new DateTimePropertyAccess();
     PropertySource["datetime"] = new DateTimePropertyAccess();
     PropertySource["ticks"] = new TicksPropertyAccess();
     PropertySource["culture"] = new CulturePropertyAccess();
 }
コード例 #9
0
ファイル: HandlerBase.cs プロジェクト: DNNCommunity/DNN.Forum
 public virtual void ProcessRequest(HttpContext context)
 {
     if ((HttpContext.Current.Items["PortalSettings"] != null))
     {
         portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
         portalId = portalSettings.PortalId;
     }
     else
     {
         PortalAliasInfo objPortalAliasInfo = PortalAliasController.GetPortalAliasInfo(HttpContext.Current.Request.Url.Host);
         portalId = objPortalAliasInfo.PortalID;
         portalSettings = PortalController.GetCurrentPortalSettings();
     }
     Localization.SetThreadCultures(Localization.GetPageLocale(portalSettings), portalSettings);
     userInfo = HttpContext.Current.Request.IsAuthenticated ? Entities.Users.UserController.GetUserByName(PortalId, HttpContext.Current.User.Identity.Name) : new Entities.Users.UserInfo {UserID = -1};
 }
コード例 #10
0
        public string LogDetailError(ErrorCodes errorCode, string virtualPath, bool logError)
        {
            string endUserPath = string.Empty;

            if (!(string.IsNullOrEmpty(virtualPath)))
            {
                endUserPath = (string)ToEndUserPath(virtualPath);
            }

            string returnValue = GetPermissionErrorText();
            string logMsg      = string.Empty;

            switch (errorCode)
            {
            case ErrorCodes.AddFolder_NoPermission:
            case ErrorCodes.AddFolder_NotInsecureFolder:
            case ErrorCodes.CopyFolder_NoPermission:
            case ErrorCodes.CopyFolder_NotInsecureFolder:
            case ErrorCodes.DeleteFolder_NoPermission:
            case ErrorCodes.DeleteFolder_NotInsecureFolder:
            case ErrorCodes.DeleteFolder_Protected:
            case ErrorCodes.CannotMoveFolder_ChildrenVisible:
            case ErrorCodes.CannotDeleteFolder_ChildrenVisible:
            case ErrorCodes.CannotCopyFolder_ChildrenVisible:
                logMsg = GetString("ErrorCodes." + errorCode);
                break;

            case ErrorCodes.DeleteFolder_Root:
            case ErrorCodes.RenameFolder_Root:
                logMsg      = GetString("ErrorCodes." + errorCode);
                returnValue = string.Format("{0} [{1}]", GetString("ErrorCodes." + errorCode), endUserPath);
                break;

            case ErrorCodes.FileDoesNotExist:
            case ErrorCodes.FolderDoesNotExist:
                logMsg      = string.Empty;
                returnValue = string.Format("{0} [{1}]", GetString("ErrorCodes." + errorCode), endUserPath);
                break;
            }

            if (!(string.IsNullOrEmpty(logMsg)))
            {
                var log = new LogInfo {
                    LogTypeKey = EventLogController.EventLogType.ADMIN_ALERT.ToString()
                };

                log.AddProperty("From", "TelerikHtmlEditorProvider Message");

                if (PortalSettings.ActiveTab != null)
                {
                    log.AddProperty("TabID", PortalSettings.ActiveTab.TabID.ToString(CultureInfo.InvariantCulture));
                    log.AddProperty("TabName", PortalSettings.ActiveTab.TabName);
                }

                Entities.Users.UserInfo user = Entities.Users.UserController.Instance.GetCurrentUserInfo();
                if (user != null)
                {
                    log.AddProperty("UserID", user.UserID.ToString(CultureInfo.InvariantCulture));
                    log.AddProperty("UserName", user.Username);
                }

                log.AddProperty("Message", logMsg);
                log.AddProperty("Path", virtualPath);
                LogController.Instance.AddLog(log);
            }

            return(returnValue);
        }
コード例 #11
0
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider,
                                  Entities.Users.UserInfo AccessingUser, Scope CurrentScope, ref bool PropertyNotFound)
        {
            UserMembership objMembership = new UserMembership(objUser);
            //UserMembership objMembership = objUser.Membership;
            bool UserQueriesHimself = (objUser.UserID == AccessingUser.UserID && objUser.UserID != -1);

            if (CurrentScope < Scope.DefaultSettings || (CurrentScope == Scope.DefaultSettings && !UserQueriesHimself) || ((CurrentScope != Scope.SystemMessages || objUser.IsSuperUser) && strPropertyName.ToLower().StartsWith("password")))
            {
                PropertyNotFound = true;
                return(PropertyAccess.ContentLocked);
            }
            else
            {
                string OutputFormat = string.Empty;
                if (strFormat == string.Empty)
                {
                    OutputFormat = "g";
                }
                switch (strPropertyName.ToLower())
                {
                case "approved":
                    return(PropertyAccess.Boolean2LocalizedYesNo(objMembership.Approved, formatProvider));

                case "createdondate":
                    return(objMembership.CreatedDate.ToString(OutputFormat, formatProvider));

                case "isonline":
                    return(PropertyAccess.Boolean2LocalizedYesNo(objMembership.IsOnLine, formatProvider));

                case "lastactivitydate":
                    return(objMembership.LastActivityDate.ToString(OutputFormat, formatProvider));

                case "lastlockoutdate":
                    return(objMembership.LastLockoutDate.ToString(OutputFormat, formatProvider));

                case "lastlogindate":
                    return(objMembership.LastLoginDate.ToString(OutputFormat, formatProvider));

                case "lastpasswordchangedate":
                    return(objMembership.LastPasswordChangeDate.ToString(OutputFormat, formatProvider));

                case "lockedout":
                    return(PropertyAccess.Boolean2LocalizedYesNo(objMembership.LockedOut, formatProvider));

                case "objecthydrated":
                    return(PropertyAccess.Boolean2LocalizedYesNo(true, formatProvider));

                case "password":
                    return(PropertyAccess.FormatString(objMembership.Password, strFormat));

                case "passwordanswer":
                    return(PropertyAccess.FormatString(objMembership.PasswordAnswer, strFormat));

                case "passwordquestion":
                    return(PropertyAccess.FormatString(objMembership.PasswordQuestion, strFormat));

                case "updatepassword":
                    return(PropertyAccess.Boolean2LocalizedYesNo(objMembership.UpdatePassword, formatProvider));

                case "username":
                    return(PropertyAccess.FormatString(objUser.Username, strFormat));

                case "email":
                    return(PropertyAccess.FormatString(objUser.Email, strFormat));
                }
            }
            return(PropertyAccess.GetObjectProperty(objMembership, strPropertyName, strFormat, formatProvider, ref PropertyNotFound));
        }
コード例 #12
0
        public static string ParseEmailTemplate(string template, string templateName, int portalID, int moduleID, int tabID, int forumID, int topicId, int replyId, string comments, Entities.Users.UserInfo user, int userId, int timeZoneOffset)
        {
            var portalSettings = (Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]);
            var ms             = DataCache.MainSettings(moduleID);
            var sOut           = template;

            // If we have a template name, load the template into sOut
            if (templateName != string.Empty)
            {
                if (templateName.Contains("_Subject_"))
                {
                    templateName = templateName.Replace("_Subject_" + moduleID, string.Empty);
                    var objTemplate = GetTemplateByName(templateName, moduleID, portalID);
                    sOut = objTemplate.Subject;
                }
                else
                {
                    var objTemplate = GetTemplateByName(templateName, moduleID, portalID);
                    sOut = objTemplate.TemplateHTML;
                }
            }

            // Load Subject and body from topic or reply

            var subject     = string.Empty;
            var body        = string.Empty;
            var dateCreated = Utilities.NullDate();
            var authorName  = string.Empty;

            if (topicId > 0 && replyId > 0)
            {
                var ri = new ReplyController().Reply_Get(portalID, moduleID, topicId, replyId);
                if (ri != null)
                {
                    subject     = ri.Content.Subject;
                    body        = ri.Content.Body;
                    dateCreated = ri.Content.DateCreated;
                    authorName  = ri.Content.AuthorName;
                }
            }
            else
            {
                var ti = new TopicsController().Topics_Get(portalID, moduleID, topicId);
                if (ti != null)
                {
                    subject     = ti.Content.Subject;
                    body        = ti.Content.Body;
                    dateCreated = ti.Content.DateCreated;
                    authorName  = ti.Content.AuthorName;
                }
            }

            body = Utilities.ManageImagePath(body, Common.Globals.AddHTTP(Common.Globals.GetDomainName(HttpContext.Current.Request)));

            // load the forum information
            var fi = new ForumController().Forums_Get(forumID, -1, false);

            // Load the user if needed
            if (user == null)
            {
                var objUsers = new Entities.Users.UserController();
                var objUser  = objUsers.GetUser(portalID, userId);
                user = objUser;
            }

            // Load the user properties

            string sFirstName;
            string sLastName;
            string sDisplayName;
            string sUsername;

            if (user != null)
            {
                sFirstName   = user.FirstName;
                sLastName    = user.LastName;
                sDisplayName = user.DisplayName;
                sUsername    = user.Username;
            }
            else
            {
                sFirstName   = string.Empty;
                sLastName    = string.Empty;
                sDisplayName = string.Empty;
                sUsername    = string.Empty;
            }

            // Build the link

            string link;

            if (string.IsNullOrEmpty(fi.PrefixURL) || !Utilities.IsRewriteLoaded())
            {
                if (replyId == 0)
                {
                    link = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.TopicId + "=" + topicId })
                        : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + topicId });
                }
                else
                {
                    link = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId })
                        : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId });
                }
            }
            else
            {
                var contentId = (replyId > 0) ? replyId : -1;
                link = new Data.Common().GetUrl(moduleID, -1, forumID, topicId, -1, contentId);
            }

            if (!(link.StartsWith("http")))
            {
                if (!link.StartsWith("/"))
                {
                    link = "/" + link;
                }

                if (link.IndexOf(HttpContext.Current.Request.Url.Host, StringComparison.Ordinal) == -1)
                {
                    link = Common.Globals.AddHTTP(HttpContext.Current.Request.Url.Host) + link;
                }
            }


            // Build the forum Url
            var forumURL = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID })
                : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topics });

            // Build Moderation url
            var modLink = Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ViewType + "=modtopics", ParamKeys.ForumId + "=" + forumID });

            if (modLink.IndexOf(HttpContext.Current.Request.Url.Host, StringComparison.Ordinal) == -1)
            {
                modLink = Common.Globals.AddHTTP(HttpContext.Current.Request.Url.Host) + modLink;
            }

            var result = new StringBuilder(sOut);

            result.Replace("[DISPLAYNAME]", UserProfiles.GetDisplayName(moduleID, userId, authorName, sFirstName, sLastName, sDisplayName));
            result.Replace("[USERNAME]", sUsername);
            result.Replace("[USERID]", userId.ToString());
            result.Replace("[FORUMNAME]", fi.ForumName);
            result.Replace("[PORTALID]", portalID.ToString());
            result.Replace("[FIRSTNAME]", sFirstName);
            result.Replace("[LASTNAME]", sLastName);
            result.Replace("[FULLNAME]", sFirstName + " " + sLastName);
            result.Replace("[GROUPNAME]", fi.GroupName);
            result.Replace("[POSTDATE]", Utilities.GetDate(dateCreated, moduleID, timeZoneOffset));
            result.Replace("[COMMENTS]", comments);
            result.Replace("[PORTALNAME]", portalSettings.PortalName);
            result.Replace("[MODLINK]", "<a href=\"" + modLink + "\">" + modLink + "</a>");
            result.Replace("[LINK]", "<a href=\"" + link + "\">" + link + "</a>");
            result.Replace("[HYPERLINK]", "<a href=\"" + link + "\">" + link + "</a>");
            result.Replace("[LINKURL]", link);
            result.Replace("[FORUMURL]", forumURL);
            result.Replace("[FORUMLINK]", "<a href=\"" + forumURL + "\">" + forumURL + "</a>");


            if (user != null)
            {
                result.Replace("[SENDERUSERNAME]", user.UserID.ToString());
                result.Replace("[SENDERFIRSTNAME]", user.FirstName);
                result.Replace("[SENDERLASTNAME]", user.LastName);
                result.Replace("[SENDERDISPLAYNAME]", user.DisplayName);
            }
            else
            {
                result.Replace("[SENDERUSERNAME]", string.Empty);
                result.Replace("[SENDERFIRSTNAME]", string.Empty);
                result.Replace("[SENDERLASTNAME]", string.Empty);
                result.Replace("[SENDERDISPLAYNAME]", string.Empty);
            }

            result.Replace("[SUBJECT]", subject);
            result.Replace("[BODY]", body);
            result.Replace("[Body]", body);

            return(result.ToString());
        }
コード例 #13
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope currentScope, ref bool PropertyNotFound)
        {
            string result = string.Empty;

            if (currentScope >= Scope.DefaultSettings && objUser != null && objUser.Profile != null)
            {
                CommonLibrary.Entities.Users.UserProfile objProfile = objUser.Profile;
                foreach (ProfilePropertyDefinition prop in objProfile.ProfileProperties)
                {
                    if (prop.PropertyName.ToLower() == strPropertyName.ToLower())
                    {
                        if (CheckAccessLevel(prop.Visibility, AccessingUser))
                        {
                            result = GetRichValue(prop, strFormat, formatProvider);
                        }
                        else
                        {
                            PropertyNotFound = true;
                            result           = PropertyAccess.ContentLocked;
                        }
                        //break;
                    }
                }
            }
            PropertyNotFound = true;
            return(result);
        }
コード例 #14
0
        public void AuthenticationLogon()
        {
            Configuration configuration = Configuration.GetConfig();

            UserController authUserController = new UserController();
            string         authCookies        = Configuration.AUTHENTICATION_KEY + "_" + _portalSettings.PortalId;
            string         LoggedOnUserName   = HttpContext.Current.Request.ServerVariables[Configuration.LOGON_USER_VARIABLE];

            // HACK : Modified to not error if object is null.
            //if( LoggedOnUserName.Length > 0 )
            if (!String.IsNullOrEmpty(LoggedOnUserName))
            {
                UserInfo authUser;

                int intUserId = 0;

                Entities.Users.UserInfo dnnUser = Entities.Users.UserController.GetUserByName(_portalSettings.PortalId, LoggedOnUserName, false);

                if (dnnUser != null)
                {
                    intUserId = dnnUser.UserID;

                    // Synchronize role membership if it's required in settings
                    if (configuration.SynchronizeRole)
                    {
                        authUser = authUserController.GetUser(LoggedOnUserName);

                        // user object might be in simple version in none active directory network
                        if (authUser.GUID.Length != 0)
                        {
                            authUser.UserID = intUserId;
                            UserController.AddUserRoles(_portalSettings.PortalId, authUser);
                        }
                    }
                }
                else
                {
                    // User not exists in DNN database, obtain user info from provider to add new
                    authUser = authUserController.GetUser(LoggedOnUserName);
                    if (authUser != null)
                    {
                        authUserController.AddDNNUser(authUser);
                        intUserId = authUser.UserID;
                        SetStatus(_portalSettings.PortalId, AuthenticationStatus.WinLogon);
                    }
                }

                if (intUserId > 0)
                {
                    FormsAuthentication.SetAuthCookie(Convert.ToString(LoggedOnUserName), true);

                    //check if user has supplied custom value for expiration
                    int PersistentCookieTimeout = 0;
                    if (Config.GetSetting("PersistentCookieTimeout") != null)
                    {
                        PersistentCookieTimeout = int.Parse(Config.GetSetting("PersistentCookieTimeout"));
                        //only use if non-zero, otherwise leave as asp.net value
                        if (PersistentCookieTimeout != 0)
                        {
                            //locate and update cookie
                            string authCookie = FormsAuthentication.FormsCookieName;
                            foreach (string cookie in HttpContext.Current.Response.Cookies)
                            {
                                if (cookie.Equals(authCookie))
                                {
                                    HttpContext.Current.Response.Cookies[cookie].Expires = DateTime.Now.AddMinutes(PersistentCookieTimeout);
                                }
                            }
                        }
                    }

                    SetStatus(_portalSettings.PortalId, AuthenticationStatus.WinLogon);

                    // Get ipAddress for eventLog
                    string ipAddress = "";
                    if (HttpContext.Current.Request.UserHostAddress != null)
                    {
                        ipAddress = HttpContext.Current.Request.UserHostAddress;
                    }

                    EventLogController eventLog     = new EventLogController();
                    LogInfo            eventLogInfo = new LogInfo();
                    eventLogInfo.AddProperty("IP", ipAddress);
                    eventLogInfo.LogPortalID   = _portalSettings.PortalId;
                    eventLogInfo.LogPortalName = _portalSettings.PortalName;
                    eventLogInfo.LogUserID     = intUserId;
                    eventLogInfo.LogUserName   = LoggedOnUserName;
                    eventLogInfo.AddProperty("WindowsAuthentication", "True");
                    eventLogInfo.LogTypeKey = "LOGIN_SUCCESS";

                    eventLog.AddLog(eventLogInfo);
                }
            }
            else
            {
                // Not Windows Authentication
            }

            // params "logon=windows" does nothing, just to force page to be refreshed
            string strURL = Globals.NavigateURL(_portalSettings.ActiveTab.TabID, "", "logon=windows");

            HttpContext.Current.Response.Redirect(strURL, true);
        }
コード例 #15
0
        protected void DebateList_InsertCommand(object sender, TreeListCommandEventArgs e)
        {
            string ConnString = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
            string commandText = @"INSERT INTO uDebate_Forum_Posts (ThreadID, ParentID, UserID, PostLevel, SortOrder, Subject,
                                   Message, PostDate, IsPublished, PostType, Active, Published_Date, Complaint_Count, ModuleID)
                                   VALUES (@ThreadID, @ParentID, " + UserInfo.UserID + @", 1, 1, @Subject, @Message, getDate(), 1,
                                           @PostType,1,getDate(),0," + ModuleId + ")";

            SqlConnection conn = new SqlConnection(ConnString);
            SqlCommand command = new SqlCommand(commandText, conn);
            Hashtable table = new Hashtable();
            TreeListEditFormInsertItem item = e.Item as TreeListEditFormInsertItem;
            table["Subject"] = (item.FindControl("txtSubjectPost") as TextBox).Text;
            table["Message"] = (item.FindControl("txtReply") as DotNetNuke.Web.UI.WebControls.DnnEditor).GetHtml(EditorStripHtmlOptions.None).Replace("'", "\"");

            RadioButton Issue = (item.FindControl("IssueRadio") as RadioButton);
            RadioButton Alter = (item.FindControl("AlterRadio") as RadioButton);
            RadioButton Pro = (item.FindControl("ProRadio") as RadioButton);
            RadioButton Con = (item.FindControl("ConRadio") as RadioButton);
            RadioButton Comment = (item.FindControl("CommentRadio") as RadioButton);

            String selection = String.Empty;

            if (Issue.Checked)
            {
                selection = "1";
            }
            else if (Alter.Checked)
            {
                selection = "2";
            }
            else if (Pro.Checked)
            {
                selection = "3";
            }
            else if (Con.Checked)
            {
                selection = "4";
            }
            else if (Comment.Checked)
            {
                selection = "8";
            }

            table["PostType"] = selection;
            command.Parameters.AddWithValue("ThreadID", Thread_ID);
            command.Parameters.AddWithValue("Subject", table["Subject"]);
            command.Parameters.AddWithValue("Message", table["Message"]);
            command.Parameters.AddWithValue("PostType", table["PostType"]);

            object parentValue;
            if (item.ParentItem != null)
            {
                parentValue = item.ParentItem.GetDataKeyValue("ID");
            }
            else
            {
                parentValue = "0";
            }

            command.Parameters.AddWithValue("ParentID", parentValue);

            conn.Open();
            try
            {
                command.ExecuteNonQuery();
                /*if the new post is a reply we have to disable edit mode of parent and expand it */
                if (item.ParentItem != null)
                {
                    item.ParentItem.Expanded = true;
                    item.ParentItem.IsChildInserted = false;
                }
                DebateList.IsItemInserted = false;

                DebateList.Rebind();
                DataRow lastPost = getLatestPostOfThread(Thread_ID);
                if (lastPost != null)
                    FindAndSelectItem(Convert.ToInt32(lastPost["ID"]));

            }
            finally
            {
                conn.Close();
            }

            /* If a user posts to a thread we add him to the notification list*/
            AddUserToNotified(Thread_ID);
            notifyCheck.Checked = true;

            string fromAddress = "*****@*****.**";
            string subject = "OGP Ireland - New Post";
            string body = "Hi, <br /><br/>A new post has been submitted to the OGP Ireland thread \"<b>" +
                         getDescription(Thread_ID) + "\"</b>.<br /> To see this post, visit " +
                        ConfigurationManager.AppSettings["DomainName"] +/* "/" +
                        System.Threading.Thread.CurrentThread.CurrentCulture.Name +*/
                        "/udebatediscussion.aspx?Thread=" + Thread_ID + "<br /><br/>Kind Regards,<br /><br/>"+
                        PortalSettings.PortalName + "<br /><a href='" + PortalSettings.DefaultPortalAlias +
                        "'>" + PortalSettings.DefaultPortalAlias + "</a>" + "<br /><br />" +
                        "<img src='http://" + PortalSettings.DefaultPortalAlias + "/Portals/0/pbp_logo270.jpg'/>";

            SendTokenizedBulkEmail mailer = new SendTokenizedBulkEmail();

            /* Notify moderators of the new post*/
            switch (getPostLanguageByThread(Thread_ID).ToLower())
            {
                case "el-gr":
                     Entities.Users.UserInfo user = new Entities.Users.UserInfo();
                     user.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user);

                    break;
               /* case "es-es":
                    Entities.Users.UserInfo user3 = new Entities.Users.UserInfo();
                    user3.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user3);
                     Entities.Users.UserInfo user4 = new Entities.Users.UserInfo();
                    user4.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user4);
                     Entities.Users.UserInfo user5 = new Entities.Users.UserInfo();
                     user5.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user5);
                    break;
                case "it-it":
                    Entities.Users.UserInfo user7 = new Entities.Users.UserInfo();
                    user7.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user7);
                    break;
                case "hu-hu":
                    Entities.Users.UserInfo user9 = new Entities.Users.UserInfo();
                    user9.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user9);
                    break;
                case "en-gb":
                    Entities.Users.UserInfo user11 = new Entities.Users.UserInfo();
                    user11.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user11);
                     Entities.Users.UserInfo user12 = new Entities.Users.UserInfo();
                     user12.Email = "*****@*****.**";
                     mailer.AddAddressedUser(user12);
                    break;*/
                default:   break;
            }

            Entities.Users.UserInfo user14 = new Entities.Users.UserInfo();
            user14.Email = "*****@*****.**";
            mailer.AddAddressedUser(user14);

            mailer.Priority = DotNetNuke.Services.Mail.MailPriority.Normal;

            mailer.AddressMethod = DotNetNuke.Services.Mail.SendTokenizedBulkEmail.AddressMethods.Send_TO;

            Entities.Users.UserInfo senderUser = new Entities.Users.UserInfo();
            senderUser.Email = "*****@*****.**";

            mailer.SendingUser = senderUser;

            mailer.ReportRecipients = false;

            mailer.Subject = subject;

            mailer.Body = body;

            mailer.BodyFormat = DotNetNuke.Services.Mail.MailFormat.Html;

            Thread objThread = new Thread(mailer.Send);

            objThread.Start();

            /* Send an email to all the subscribed users of this thread*/
            string subjectNotify = "OGP Ireland - There is a new post in the thread you are following";
            string bodyNotify = "Hi, <br /><br/>A new post has been submitted to the OGP Ireland thread \"<b>" +
                         getDescription(Thread_ID) + "\"</b>.<br /> To see this post, visit " +
                        ConfigurationManager.AppSettings["DomainName"] + /*"/" +
                        System.Threading.Thread.CurrentThread.CurrentCulture.Name +*/
                        "/udebatediscussion.aspx?Thread=" + Thread_ID + "<br /><br/>Kind Regards,<br /><br/>"+
                        PortalSettings.PortalName + "<br /><a href='" + PortalSettings.DefaultPortalAlias +
                        "'>" + PortalSettings.DefaultPortalAlias + "</a>" + "<br /><br />" +
                        "<img src='http://" + PortalSettings.DefaultPortalAlias + "/Portals/0/pbp_logo270.jpg'/>";

            string SQL_notified = "SELECT userID,userEmail FROM uDebate_Forum_Notifications where threadID=" + Thread_ID;
            try
            {
                DataSet ds = ATC.Database.sqlExecuteDataSet(SQL_notified);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    SendTokenizedBulkEmail notificationMailer = new SendTokenizedBulkEmail();

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        // Only send email to users different than the current one (the post writer)
                        if (UserId != Int32.Parse(row["userID"].ToString()))
                        {
                            int numRecs = 100;
                            ArrayList findEmailinRegistered = Entities.Users.UserController.GetUsersByEmail(PortalId, row["userEmail"].ToString(), 0, 10, ref numRecs,false,false);

                            //Check that the user is still registered
                            if (findEmailinRegistered.Count > 0)
                            {
                                Entities.Users.UserInfo newUser = new Entities.Users.UserInfo();
                                newUser.Email = row["userEmail"].ToString();
                                notificationMailer.AddAddressedUser(newUser);
                            }
                            //if no, remove him from the list of notified users
                            else
                            {
                                RemoveUserFromNotified(row["userEmail"].ToString());

                            }
                        }
                    }

                    notificationMailer.Priority = DotNetNuke.Services.Mail.MailPriority.Normal;

                    notificationMailer.AddressMethod = DotNetNuke.Services.Mail.SendTokenizedBulkEmail.AddressMethods.Send_TO;

                    Entities.Users.UserInfo sendingUser = new Entities.Users.UserInfo();
                    sendingUser.Email = "*****@*****.**";

                    notificationMailer.SendingUser = sendingUser;

                    notificationMailer.ReportRecipients = true;

                    notificationMailer.Subject = subjectNotify;

                    notificationMailer.Body = bodyNotify;

                    notificationMailer.BodyFormat = DotNetNuke.Services.Mail.MailFormat.Html;

                    Thread objThread1 = new Thread(notificationMailer.Send);

                    objThread1.Start();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
コード例 #16
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            if (dr == null)
            {
                return(string.Empty);
            }
            object valueObject  = dr[strPropertyName];
            string OutputFormat = strFormat;

            if (string.IsNullOrEmpty(strFormat))
            {
                OutputFormat = "g";
            }
            if (valueObject != null)
            {
                switch (valueObject.GetType().Name)
                {
                case "String":
                    return(PropertyAccess.PropertyAccess.FormatString(Convert.ToString(valueObject), strFormat));

                case "Boolean":
                    return(PropertyAccess.PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(valueObject), formatProvider));

                case "DateTime":
                case "Double":
                case "Single":
                case "Int32":
                case "Int64":
                    return(((IFormattable)valueObject).ToString(OutputFormat, formatProvider));

                default:
                    return(PropertyAccess.PropertyAccess.FormatString(valueObject.ToString(), strFormat));
                }
            }
            else
            {
                PropertyNotFound = true;
                return(string.Empty);
            }
        }
コード例 #17
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            CultureInfo ci = formatProvider;

            if (strPropertyName.ToLower() == CultureDropDownTypes.EnglishName.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.EnglishName), strFormat));
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.Lcid.ToString().ToLowerInvariant())
            {
                return(ci.LCID.ToString());
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.Name.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(ci.Name, strFormat));
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.NativeName.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.NativeName), strFormat));
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.TwoLetterIsoCode.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(ci.TwoLetterISOLanguageName, strFormat));
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.ThreeLetterIsoCode.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(ci.ThreeLetterISOLanguageName, strFormat));
            }
            else if (strPropertyName.ToLower() == CultureDropDownTypes.DisplayName.ToString().ToLowerInvariant())
            {
                return(PropertyAccess.PropertyAccess.FormatString(ci.DisplayName, strFormat));
            }
            PropertyNotFound = true;
            return(string.Empty);
        }
コード例 #18
0
 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     return(string.Empty);
 }
コード例 #19
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "now":
                return(DateTime.Now.Ticks.ToString());

            case "today":
                return(DateTime.Today.Ticks.ToString());

            case "ticksperday":
                return(TimeSpan.TicksPerDay.ToString());
            }
            PropertyNotFound = true;
            return(string.Empty);
        }
コード例 #20
0
ファイル: CategoryInfo.cs プロジェクト: valadas/DNNStore
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string propertyValue = null;

            switch (strPropertyName.ToLower())
            {
            case "name":
                propertyValue = _name;
                break;

            case "categorypagelink":
                propertyValue = Globals.NavigateURL(_storePageID, "", new string[] { "categoryid=" + _categoryID });
                break;

            default:
                propertyNotFound = true;
                break;
            }
            return(propertyValue);
        }
コード例 #21
0
 public static string ParseEmailTemplate(string templateName, int portalID, int moduleID, int tabID, int forumID, int topicId, int replyId, Entities.Users.UserInfo user, int timeZoneOffset)
 {
     return(ParseEmailTemplate(string.Empty, templateName, portalID, moduleID, tabID, forumID, topicId, replyId, string.Empty, user, -1, timeZoneOffset));
 }
コード例 #22
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            if (custom == null)
            {
                return(string.Empty);
            }
            object valueObject  = null;
            string OutputFormat = strFormat;

            if (string.IsNullOrEmpty(strFormat))
            {
                OutputFormat = "g";
            }
            int intIndex = int.Parse(strPropertyName);

            if ((custom != null) && custom.Count > intIndex)
            {
                valueObject = custom[intIndex].ToString();
            }
            if ((valueObject != null))
            {
                switch (valueObject.GetType().Name)
                {
                case "String":
                    return(PropertyAccess.PropertyAccess.FormatString((string)valueObject, strFormat));

                case "Boolean":
                    return(PropertyAccess.PropertyAccess.Boolean2LocalizedYesNo((bool)valueObject, formatProvider));

                case "DateTime":
                case "Double":
                case "Single":
                case "Int32":
                case "Int64":
                    return(((IFormattable)valueObject).ToString(OutputFormat, formatProvider));

                default:
                    return(PropertyAccess.PropertyAccess.FormatString(valueObject.ToString(), strFormat));
                }
            }
            else
            {
                PropertyNotFound = true;
                return(string.Empty);
            }
        }
コード例 #23
0
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "commentlink":
                return(CommentLink);

            case "likelink":
                return(LikeLink);

            case "likelist":
                return(LikeList);

            case "commentarea":
                return(CommentArea);

            case "authornamelink":
                return(AuthorNameLink);
            }

            propertyNotFound = true;
            return(string.Empty);
        }
コード例 #24
0
        protected void DebateList_InsertCommand(object sender, TreeListCommandEventArgs e)
        {
            string ConnString  = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
            string commandText = @"INSERT INTO uDebate_Forum_Posts (ThreadID, ParentID, UserID, PostLevel, SortOrder, Subject,
                                   Message, PostDate, IsPublished, PostType, Active, Published_Date, Complaint_Count, ModuleID)
                                   VALUES (@ThreadID, @ParentID, " + UserInfo.UserID + @", 1, 1, @Subject, @Message, getDate(), 1,
                                           @PostType,1,getDate(),0," + ModuleId + ")";

            SqlConnection conn              = new SqlConnection(ConnString);
            SqlCommand    command           = new SqlCommand(commandText, conn);
            Hashtable     table             = new Hashtable();
            TreeListEditFormInsertItem item = e.Item as TreeListEditFormInsertItem;

            table["Subject"] = (item.FindControl("txtSubjectPost") as TextBox).Text;
            table["Message"] = (item.FindControl("txtReply") as DotNetNuke.Web.UI.WebControls.DnnEditor).GetHtml(EditorStripHtmlOptions.None).Replace("'", "\"");

            RadioButton Issue   = (item.FindControl("IssueRadio") as RadioButton);
            RadioButton Alter   = (item.FindControl("AlterRadio") as RadioButton);
            RadioButton Pro     = (item.FindControl("ProRadio") as RadioButton);
            RadioButton Con     = (item.FindControl("ConRadio") as RadioButton);
            RadioButton Comment = (item.FindControl("CommentRadio") as RadioButton);

            String selection = String.Empty;

            if (Issue.Checked)
            {
                selection = "1";
            }
            else if (Alter.Checked)
            {
                selection = "2";
            }
            else if (Pro.Checked)
            {
                selection = "3";
            }
            else if (Con.Checked)
            {
                selection = "4";
            }
            else if (Comment.Checked)
            {
                selection = "8";
            }

            table["PostType"] = selection;
            command.Parameters.AddWithValue("ThreadID", Thread_ID);
            command.Parameters.AddWithValue("Subject", table["Subject"]);
            command.Parameters.AddWithValue("Message", table["Message"]);
            command.Parameters.AddWithValue("PostType", table["PostType"]);

            object parentValue;

            if (item.ParentItem != null)
            {
                parentValue = item.ParentItem.GetDataKeyValue("ID");
            }
            else
            {
                parentValue = "0";
            }

            command.Parameters.AddWithValue("ParentID", parentValue);

            conn.Open();
            try
            {
                command.ExecuteNonQuery();
                /*if the new post is a reply we have to disable edit mode of parent and expand it */
                if (item.ParentItem != null)
                {
                    item.ParentItem.Expanded        = true;
                    item.ParentItem.IsChildInserted = false;
                }
                DebateList.IsItemInserted = false;

                DebateList.Rebind();
                DataRow lastPost = getLatestPostOfThread(Thread_ID);
                if (lastPost != null)
                {
                    FindAndSelectItem(Convert.ToInt32(lastPost["ID"]));
                }
            }
            finally
            {
                conn.Close();
            }

            /* If a user posts to a thread we add him to the notification list*/
            AddUserToNotified(Thread_ID);
            notifyCheck.Checked = true;

            string fromAddress = "*****@*****.**";
            string subject     = "OGP Ireland - New Post";
            string body        = "Hi, <br /><br/>A new post has been submitted to the OGP Ireland thread \"<b>" +
                                 getDescription(Thread_ID) + "\"</b>.<br /> To see this post, visit " +
                                 ConfigurationManager.AppSettings["DomainName"] +/* "/" +
                                                                                  * System.Threading.Thread.CurrentThread.CurrentCulture.Name +*/
                                 "/udebatediscussion.aspx?Thread=" + Thread_ID + "<br /><br/>Kind Regards,<br /><br/>" +
                                 PortalSettings.PortalName + "<br /><a href='" + PortalSettings.DefaultPortalAlias +
                                 "'>" + PortalSettings.DefaultPortalAlias + "</a>" + "<br /><br />" +
                                 "<img src='http://" + PortalSettings.DefaultPortalAlias + "/Portals/0/pbp_logo270.jpg'/>";

            SendTokenizedBulkEmail mailer = new SendTokenizedBulkEmail();

            /* Notify moderators of the new post*/
            switch (getPostLanguageByThread(Thread_ID).ToLower())
            {
            case "el-gr":
                Entities.Users.UserInfo user = new Entities.Users.UserInfo();
                user.Email = "*****@*****.**";
                mailer.AddAddressedUser(user);

                break;

            /* case "es-es":
             *   Entities.Users.UserInfo user3 = new Entities.Users.UserInfo();
             *   user3.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user3);
             *    Entities.Users.UserInfo user4 = new Entities.Users.UserInfo();
             *   user4.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user4);
             *    Entities.Users.UserInfo user5 = new Entities.Users.UserInfo();
             *    user5.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user5);
             *   break;
             * case "it-it":
             *   Entities.Users.UserInfo user7 = new Entities.Users.UserInfo();
             *   user7.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user7);
             *   break;
             * case "hu-hu":
             *   Entities.Users.UserInfo user9 = new Entities.Users.UserInfo();
             *   user9.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user9);
             *   break;
             * case "en-gb":
             *   Entities.Users.UserInfo user11 = new Entities.Users.UserInfo();
             *   user11.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user11);
             *    Entities.Users.UserInfo user12 = new Entities.Users.UserInfo();
             *    user12.Email = "*****@*****.**";
             *    mailer.AddAddressedUser(user12);
             *   break;*/
            default:   break;
            }

            Entities.Users.UserInfo user14 = new Entities.Users.UserInfo();
            user14.Email = "*****@*****.**";
            mailer.AddAddressedUser(user14);

            mailer.Priority = DotNetNuke.Services.Mail.MailPriority.Normal;

            mailer.AddressMethod = DotNetNuke.Services.Mail.SendTokenizedBulkEmail.AddressMethods.Send_TO;

            Entities.Users.UserInfo senderUser = new Entities.Users.UserInfo();
            senderUser.Email = "*****@*****.**";

            mailer.SendingUser = senderUser;

            mailer.ReportRecipients = false;

            mailer.Subject = subject;

            mailer.Body = body;

            mailer.BodyFormat = DotNetNuke.Services.Mail.MailFormat.Html;

            Thread objThread = new Thread(mailer.Send);

            objThread.Start();

            /* Send an email to all the subscribed users of this thread*/
            string subjectNotify = "OGP Ireland - There is a new post in the thread you are following";
            string bodyNotify    = "Hi, <br /><br/>A new post has been submitted to the OGP Ireland thread \"<b>" +
                                   getDescription(Thread_ID) + "\"</b>.<br /> To see this post, visit " +
                                   ConfigurationManager.AppSettings["DomainName"] + /*"/" +
                                                                                     * System.Threading.Thread.CurrentThread.CurrentCulture.Name +*/
                                   "/udebatediscussion.aspx?Thread=" + Thread_ID + "<br /><br/>Kind Regards,<br /><br/>" +
                                   PortalSettings.PortalName + "<br /><a href='" + PortalSettings.DefaultPortalAlias +
                                   "'>" + PortalSettings.DefaultPortalAlias + "</a>" + "<br /><br />" +
                                   "<img src='http://" + PortalSettings.DefaultPortalAlias + "/Portals/0/pbp_logo270.jpg'/>";


            string SQL_notified = "SELECT userID,userEmail FROM uDebate_Forum_Notifications where threadID=" + Thread_ID;

            try
            {
                DataSet ds = ATC.Database.sqlExecuteDataSet(SQL_notified);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    SendTokenizedBulkEmail notificationMailer = new SendTokenizedBulkEmail();

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        // Only send email to users different than the current one (the post writer)
                        if (UserId != Int32.Parse(row["userID"].ToString()))
                        {
                            int       numRecs = 100;
                            ArrayList findEmailinRegistered = Entities.Users.UserController.GetUsersByEmail(PortalId, row["userEmail"].ToString(), 0, 10, ref numRecs, false, false);

                            //Check that the user is still registered
                            if (findEmailinRegistered.Count > 0)
                            {
                                Entities.Users.UserInfo newUser = new Entities.Users.UserInfo();
                                newUser.Email = row["userEmail"].ToString();
                                notificationMailer.AddAddressedUser(newUser);
                            }
                            //if no, remove him from the list of notified users
                            else
                            {
                                RemoveUserFromNotified(row["userEmail"].ToString());
                            }
                        }
                    }

                    notificationMailer.Priority = DotNetNuke.Services.Mail.MailPriority.Normal;

                    notificationMailer.AddressMethod = DotNetNuke.Services.Mail.SendTokenizedBulkEmail.AddressMethods.Send_TO;

                    Entities.Users.UserInfo sendingUser = new Entities.Users.UserInfo();
                    sendingUser.Email = "*****@*****.**";

                    notificationMailer.SendingUser = sendingUser;

                    notificationMailer.ReportRecipients = true;

                    notificationMailer.Subject = subjectNotify;

                    notificationMailer.Body = bodyNotify;

                    notificationMailer.BodyFormat = DotNetNuke.Services.Mail.MailFormat.Html;

                    Thread objThread1 = new Thread(notificationMailer.Send);

                    objThread1.Start();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
コード例 #25
0
ファイル: ItemData.cs プロジェクト: valadas/Dnn.Platform.Copy
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "url":
                return(PropertyAccess.FormatString(Url, format));

            case "title":
                return(PropertyAccess.FormatString(Title, format));

            case "description":
                return(PropertyAccess.FormatString(Description, format));

            case "imageurl":
                return(PropertyAccess.FormatString(ImageUrl, format));
            }

            propertyNotFound = true;
            return(string.Empty);
        }
コード例 #26
0
ファイル: JournalItem.cs プロジェクト: misterPaul0/Curt
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "journalid":
                return(PropertyAccess.FormatString(JournalId.ToString(), format));

            case "journaltypeid":
                return(PropertyAccess.FormatString(JournalTypeId.ToString(), format));

            case "profileid":
                return(PropertyAccess.FormatString(ProfileId.ToString(), format));

            case "socialgroupid":
                return(PropertyAccess.FormatString(SocialGroupId.ToString(), format));

            case "datecreated":
                return(PropertyAccess.FormatString(DateCreated.ToString(), format));

            case "title":
                return(PropertyAccess.FormatString(Title, format));

            case "summary":
                return(PropertyAccess.FormatString(Summary, format));

            case "body":
                return(PropertyAccess.FormatString(Body, format));

            case "timeframe":
                return(PropertyAccess.FormatString(TimeFrame, format));
            }

            propertyNotFound = true;
            return(string.Empty);
        }
コード例 #27
0
ファイル: CommentInfo.cs プロジェクト: misterPaul0/Curt
 public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
 {
     throw new NotImplementedException();
 }
コード例 #28
0
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            DateTime now = UserTime.CurrentTimeForUser(AccessingUser);

            switch (strPropertyName.ToLower())
            {
            case "current":
                if (strFormat == string.Empty)
                {
                    strFormat = "D";
                }
                return(now.ToString(strFormat, formatProvider));

            case "now":
                if (strFormat == string.Empty)
                {
                    strFormat = "g";
                }
                return(now.ToString(strFormat, formatProvider));

            default:
                PropertyNotFound = true;
                return(string.Empty);
            }
        }
コード例 #29
0
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "id":
                return(PropertyAccess.FormatString(Id.ToString(), format));

            case "name":
                return(PropertyAccess.FormatString(Name.ToString(), format));

            case "vanity":
                return(PropertyAccess.FormatString(Vanity.ToString(), format));

            case "avatar":
                return(PropertyAccess.FormatString(Avatar.ToString(), format));
            }

            propertyNotFound = true;
            return(string.Empty);
        }
コード例 #30
0
 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     if (obj == null)
     {
         return(string.Empty);
     }
     return(PropertyAccess.GetObjectProperty(obj, strPropertyName, strFormat, formatProvider, ref PropertyNotFound));
 }