protected virtual void LoadSettings() { FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p != null) { fileSystem = p.GetFileSystem(); } current = SiteUtils.GetCurrentSiteUser(); if (current != null) { author = KLAuthor.GetKLAuthorByUserID(current.UserId); GeneralVariables.NameAuthor = current.Name; GeneralVariables.Level = author.LevelAuthor; if (author != null) { txtfb.Text = author.LinkFacebook; txtinstagram.Text = author.LinkInstagram; txtpinterest.Text = author.LinkPinterest; txttwinter.Text = author.LinkTwitter; txtFullName.Text = author.Name; txtEmail.Text = current.Email; editDescription.Content = current.Signature; ImageAvatar.ImageUrl = AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, author.UserID); } } else { WebUtils.SetupRedirect(this, SiteRoot); } }
protected string getImageURL() { return(AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, current.UserId)); }
protected string getImageURL(int userid) { return(AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, userid)); }
protected string getimgURL(int CommentId) { KLNewsComment com = new KLNewsComment(CommentId); return(AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, com.UserID)); }
private int Save() { Page.Validate("Author"); if (!Page.IsValid) { return(-1); } try { author.LinkFacebook = txtfb.Text; author.LinkInstagram = txtinstagram.Text; author.LinkPinterest = txtpinterest.Text; author.LinkTwitter = txttwinter.Text; author.Name = txtFullName.Text; SiteUser temp = new SiteUser(siteSettings, author.UserID); temp.Signature = editDescription.Text; if (fileImage.UploadedFiles.Count > 0) { imageFolderPath = AuthorHepper.MediaFolderPath(siteSettings.SiteId, author.UserID); AuthorHepper.VerifyAuthorFolders(fileSystem, imageFolderPath); foreach (UploadedFile file in fileImage.UploadedFiles) { string ext = file.GetExtension(); if (SiteUtils.IsAllowedUploadBrowseFile(ext, WebConfigSettings.ImageFileExtensions)) { ContentMedia media = new ContentMedia(); media.SiteGuid = siteSettings.SiteGuid; //image.Title = txtImageTitle.Text; media.DisplayOrder = 0; string newFileName = file.FileName.ToCleanFileName(WebConfigSettings.ForceLowerCaseForUploadedFiles); string newImagePath = VirtualPathUtility.Combine(imageFolderPath, newFileName); if (media.MediaFile == newFileName) { // an existing image delete the old one fileSystem.DeleteFile(newImagePath); } else { // this is a new newsImage instance, make sure we don't use the same file name as any other instance int i = 1; while (fileSystem.FileExists(VirtualPathUtility.Combine(imageFolderPath, newFileName))) { newFileName = i.ToInvariantString() + newFileName; i += 1; } } newImagePath = VirtualPathUtility.Combine(imageFolderPath, newFileName); file.SaveAs(Server.MapPath(newImagePath)); media.MediaFile = newFileName; media.ThumbnailFile = newFileName; author.Avatar = newFileName; media.Save(); AuthorHepper.ProcessImage(media, fileSystem, imageFolderPath, file.FileName); } } } if (temp.Save() && author.Save()) { ImageAvatar.ImageUrl = AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, author.UserID); LogActivity.Write("Update Author", author.Name); message.SuccessMessage = ResourceHelper.GetResourceString("CustomResources", "UpdateAuthorSuccess"); } } catch (Exception ex) { log.Error(ex.Message); } return(author.AuthorID); }
protected string getGuestImage(int authorid) { int userid = new KLAuthor(authorid).UserID; return(AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, userid)); }