public HttpResponseMessage UpdateUserProfile(UserProfileDTO dto) { var upc = new UserProfileController(); var up = upc.Profiles_Get(PortalSettings.PortalId, ActiveModule.ModuleID, dto.UserId); if (up == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } if (dto.TrustLevel.HasValue) { up.TrustLevel = dto.TrustLevel.Value; } up.UserCaption = dto.UserCaption; up.Signature = dto.Signature; if (dto.RewardPoints.HasValue) { up.RewardPoints = dto.RewardPoints.Value; } upc.Profiles_Save(up); return(Request.CreateResponse(HttpStatusCode.OK)); }
private void btnSave_Click(object sender, System.EventArgs e) { if (UserId == UID || (CurrentUserType == CurrentUserTypes.Admin || CurrentUserType == CurrentUserTypes.SuperUser)) { UserProfileController upc = new UserProfileController(); UserController uc = new UserController(); UserProfileInfo upi = uc.GetUser(PortalId, ForumModuleId, UID).Profile; if (upi != null) { upi.PrefDefaultSort = Utilities.XSSFilter(drpPrefDefaultSort.SelectedItem.Value, true); upi.PrefPageSize = Convert.ToInt32(((Convert.ToInt32(nsPrefPageSize.Text) < 5) ? 5 : Convert.ToInt32(nsPrefPageSize.Text))); upi.PrefDefaultShowReplies = false; upi.PrefJumpLastPost = chkPrefJumpToLastPost.Checked; upi.PrefTopicSubscribe = chkPrefTopicSubscribe.Checked; upi.PrefSubscriptionType = SubscriptionTypes.Instant; upi.PrefUseAjax = false; upi.PrefBlockAvatars = chkPrefBlockAvatars.Checked; upi.PrefBlockSignatures = chkPrefBlockSignatures.Checked; if (MainSettings.AllowSignatures == 1 || MainSettings.AllowSignatures == 0) { upi.Signature = Utilities.XSSFilter(txtSignature.Text, true); upi.Signature = Utilities.StripHTMLTag(upi.Signature); upi.Signature = Utilities.HTMLEncode(upi.Signature); } else if (MainSettings.AllowSignatures == 2) { upi.Signature = Utilities.XSSFilter(txtSignature.Text, false); } upc.Profiles_Save(upi); Response.Redirect(NavigateUrl(TabId)); } } }
public int Reply_Save(int PortalId, ReplyInfo ri) { // Clear profile Cache to make sure the LastPostDate is updated for Flood Control UserProfileController.Profiles_ClearCache(ri.Content.AuthorId); return(Convert.ToInt32(DataProvider.Instance().Reply_Save(PortalId, ri.TopicId, ri.ReplyId, ri.ReplyToId, ri.StatusId, ri.IsApproved, ri.IsDeleted, ri.Content.Subject.Trim(), ri.Content.Body.Trim(), ri.Content.DateCreated, ri.Content.DateUpdated, ri.Content.AuthorId, ri.Content.AuthorName, ri.Content.IPAddress))); }
public int TopicSave(int PortalId, TopicInfo ti) { // Clear profile Cache to make sure the LastPostDate is updated for Flood Control UserProfileController.Profiles_ClearCache(ti.Content.AuthorId); return(Convert.ToInt32(DataProvider.Instance().Topics_Save(PortalId, ti.TopicId, ti.ViewCount, ti.ReplyCount, ti.IsLocked, ti.IsPinned, ti.TopicIcon, ti.StatusId, ti.IsApproved, ti.IsDeleted, ti.IsAnnounce, ti.IsArchived, ti.AnnounceStart, ti.AnnounceEnd, ti.Content.Subject.Trim(), ti.Content.Body.Trim(), ti.Content.Summary.Trim(), ti.Content.DateCreated, ti.Content.DateUpdated, ti.Content.AuthorId, ti.Content.AuthorName, ti.Content.IPAddress, (int)ti.TopicType, ti.Priority, ti.TopicUrl, ti.TopicData))); }
public HttpResponseMessage GetUserProfile(int userId) { var upc = new UserProfileController(); var up = upc.Profiles_Get(PortalSettings.PortalId, ActiveModule.ModuleID, userId); if(up == null) return Request.CreateResponse(HttpStatusCode.NotFound); var result = new { up.UserID, up.TrustLevel, up.UserCaption, up.Signature, up.RewardPoints }; return Request.CreateResponse(HttpStatusCode.OK, result); }
private void cbAdmin_Callback(object sender, Modules.ActiveForums.Controls.CallBackEventArgs e) { if (!(CurrentUserType == CurrentUserTypes.Anon) && !(CurrentUserType == CurrentUserTypes.Auth)) { UserProfileController upc = new UserProfileController(); UserController uc = new UserController(); UserProfileInfo upi = uc.GetUser(PortalId, ForumModuleId, UID).Profile; if (upi != null) { upi.RewardPoints = Convert.ToInt32(e.Parameters[1]); upi.UserCaption = e.Parameters[2].ToString(); upi.SignatureDisabled = Convert.ToBoolean(e.Parameters[3]); upi.AvatarDisabled = Convert.ToBoolean(e.Parameters[4]); upi.TrustLevel = Convert.ToInt32(e.Parameters[5]); upi.AdminWatch = Convert.ToBoolean(e.Parameters[6]); upi.AttachDisabled = Convert.ToBoolean(e.Parameters[7]); upc.Profiles_Save(upi); } } }
public HttpResponseMessage GetUserProfile(int userId) { var upc = new UserProfileController(); var up = upc.Profiles_Get(PortalSettings.PortalId, ActiveModule.ModuleID, userId); if (up == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } var result = new { up.UserID, up.TrustLevel, up.UserCaption, up.Signature, up.RewardPoints }; return(Request.CreateResponse(HttpStatusCode.OK, result)); }
private void btnSave_Click(object sender, System.EventArgs e) { if (UserId == UID || (CurrentUserType == CurrentUserTypes.Admin || CurrentUserType == CurrentUserTypes.SuperUser)) { UserProfileController upc = new UserProfileController(); UserController uc = new UserController(); UserProfileInfo upi = uc.GetUser(PortalId, ForumModuleId, UID).Profile; if (upi != null) { upi.PrefDefaultSort = Utilities.XSSFilter(drpPrefDefaultSort.SelectedItem.Value, true); upi.PrefPageSize = Convert.ToInt32(((Convert.ToInt32(nsPrefPageSize.Text) < 5) ? 5 : Convert.ToInt32(nsPrefPageSize.Text))); upi.PrefDefaultShowReplies = false; upi.PrefJumpLastPost = chkPrefJumpToLastPost.Checked; upi.PrefTopicSubscribe = chkPrefTopicSubscribe.Checked; upi.PrefSubscriptionType = SubscriptionTypes.Instant; upi.PrefUseAjax = false; upi.PrefBlockAvatars = chkPrefBlockAvatars.Checked; upi.PrefBlockSignatures = chkPrefBlockSignatures.Checked; if (MainSettings.AllowSignatures == 1 || MainSettings.AllowSignatures == 0) { upi.Signature = Utilities.XSSFilter(txtSignature.Text, true); upi.Signature = Utilities.StripHTMLTag(upi.Signature); upi.Signature = Utilities.HTMLEncode(upi.Signature); } else if (MainSettings.AllowSignatures == 2) { upi.Signature = Utilities.XSSFilter(txtSignature.Text, false); } upc.Profiles_Save(upi); } } }
public HttpResponseMessage UpdateUserProfile(UserProfileDTO dto) { var upc = new UserProfileController(); var up = upc.Profiles_Get(PortalSettings.PortalId, ActiveModule.ModuleID, dto.UserId); if (up == null) return Request.CreateResponse(HttpStatusCode.NotFound); if (dto.TrustLevel.HasValue) up.TrustLevel = dto.TrustLevel.Value; up.UserCaption = dto.UserCaption; up.Signature = dto.Signature; if (dto.RewardPoints.HasValue) up.RewardPoints = dto.RewardPoints.Value; upc.Profiles_Save(up); return Request.CreateResponse(HttpStatusCode.OK); }