protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Sueetie Modified - Adding Compressed theme/style.css and Sueetie Theme stylesheets Page.Header.Controls.Add(SueetieBlogUtils.AddBlogEngineThemeCSS()); Page.Header.Controls.Add(MakeStyleSheetControl("/themes/" + this.CurrentTheme + "/style/shared.css")); Page.Header.Controls.Add(MakeStyleSheetControl("/themes/" + this.CurrentTheme + "/style/blogs.css")); Page.Header.Controls.Add(MakeStyleSheetControl("/themes/" + this.CurrentTheme + "/style/contact.css")); Page.Header.Controls.Add(new LiteralControl("<!--[if IE]><link rel=\"stylesheet\" href=\"/themes/" + this.CurrentTheme + "/style/ie.css\" type=\"text/css\" /><![endif]-->")); MembershipUser user = Membership.GetUser(); UserLink.Text = "Welcome, Guest!"; UserLink.NavigateUrl = "/members/login.aspx"; if (Page.User.Identity.IsAuthenticated) { string _displayName = SueetieUsers.GetUserDisplayName(SueetieContext.Current.User.UserID, false); if (SueetieConfiguration.Get().Core.UseForumProfile) { UserLink.NavigateUrl = SueetieUrls.Instance.MasterAccountInfo().Url; } else { UserLink.NavigateUrl = SueetieUrls.Instance.MyAccountInfo().Url; } UserLink.Text = string.Format(SueetieLocalizer.GetString("link_greetings_member"), _displayName); } } }
protected override void Render(HtmlTextWriter writer) { SueetieUser user = SueetieContext.Current.User; string _href = SueetieUrls.Instance.MasterAccountInfo().Url; if (SueetieConfiguration.Get().Core.UseForumProfile) { _href = SueetieUrls.Instance.MyAccountInfo().Url; } string _imgUrl = "/images/avatars/noavatarthumbnail.jpg"; if (user.HasAvatarImage) { _imgUrl = "/images/avatars/" + user.UserID.ToString() + "t.jpg?d=" + DateTime.Now.ToLongTimeString(); } writer.BeginRender(); writer.Write("<span class='WelcomeText'>" + string.Format(SueetieLocalizer.GetString("welcome_back"), user.DisplayName, SueetieLocalizer.GetString("welcome_exclamation")) + "</span>"); writer.Write(string.Format("<span class='AvatarImage'><a href='{0}'><img src='{1}' alt='' /></a></span>", _href, _imgUrl)); var aspUser = System.Web.Security.Membership.GetUser(false); //System.Web.Profile.ProfileManager. writer.Write($"<!-- ProviderUserKey = {aspUser?.ProviderUserKey} ; UserName = {aspUser?.UserName} ; DisplayName = {HttpContext.Current.Profile["DisplayName"]} -->"); writer.EndRender(); }
protected void UploadUpdate_Click(object sender, System.EventArgs e) { if (File.PostedFile != null && File.PostedFile.FileName.Trim().Length > 0 && File.PostedFile.ContentLength > 0) { int width = SueetieConfiguration.Get().AvatarSettings.Width; int height = SueetieConfiguration.Get().AvatarSettings.Height; int thumbnailWidth = SueetieConfiguration.Get().AvatarSettings.ThumbnailHeight; int thumbnailHeight = SueetieConfiguration.Get().AvatarSettings.ThumbnailWidth; string imageName = CurrentUserID.ToString() + ".jpg"; string thumbnailImageName = CurrentUserID.ToString() + "t.jpg"; ImageFormat imgFormat = ImageFormat.Jpeg; try { #region Save to disk Bitmap originalBitmap = new Bitmap(File.PostedFile.InputStream); //ImageHelper.CalculateOptimizedWidthAndHeight(originalBitmap, out width, out height); int jpegQuality = SueetieConfiguration.Get().AvatarSettings.ImageQuality; string path = HttpContext.Current.Server.MapPath("/") + SueetieConfiguration.Get().AvatarSettings.AvatarFolderPath; ImageHelper.SaveImageFile(originalBitmap, path + imageName, imgFormat, width, height, jpegQuality); ImageHelper.SaveImageFile(originalBitmap, path + thumbnailImageName, imgFormat, thumbnailWidth, thumbnailHeight, jpegQuality); #endregion #region Save to database for use with Forums SueetieUserAvatar sueetieUserAvatar = new SueetieUserAvatar(); MemoryStream stream = new MemoryStream(); originalBitmap.Save(stream, ImageFormat.Bmp); byte[] data = new byte[stream.Length]; stream.Seek(0, System.IO.SeekOrigin.Begin); stream.Read(data, 0, (int)stream.Length); sueetieUserAvatar.UserID = CurrentUserID; sueetieUserAvatar.AvatarImage = data; sueetieUserAvatar.AvatarImageType = "image/jpeg"; SueetieUsers.UpdateSueetieUserAvatar(sueetieUserAvatar); SueetieUsers.ClearUserCache(sueetieUserAvatar.UserID); //Response.Redirect("myaccountinfo.aspx?av=1&bio=2&pr=2&pw=2"); Response.Redirect("myaccountinfo.aspx?av=1"); #endregion } catch { //return null; } } BindData(); }
protected void DeleteAvatar_Click(object sender, System.EventArgs e) { SueetieUsers.DeleteAvatar(CurrentUserID); string path = HttpContext.Current.Server.MapPath("/") + SueetieConfiguration.Get().AvatarSettings.AvatarFolderPath + CurrentUserID.ToString() + ".jpg"; System.IO.File.Delete(path); SueetieUsers.ClearUserCache(CurrentUserID); Response.Redirect("myaccountinfo.aspx?dv=1&bio=2"); //BindData(); }
protected void UserInfo_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { if (Membership.GetUserNameByEmail((string)e.NewValues[0]) != null && Membership.GetUserNameByEmail((string)e.NewValues[0]).ToLower() != _user.UserName.ToLower()) { UserUpdateMessage.Text += " Email used for another user. Duplicate emails not permitted."; e.Cancel = true; } else { _user.Email = (string)e.NewValues[0]; _user.Comment = (string)e.NewValues[1]; _user.IsApproved = (bool)e.NewValues[2]; _user.LastActivityDate = lastActivitydate; CheckBox chkActive = ((DetailsView)sender).FindControl("chkActive") as CheckBox; sueetieUser.IsActive = chkActive.Checked; sueetieUser.Email = _user.Email; sueetieUser.DisplayName = txtDisplayName.Text; SueetieUsers.UpdateSueetieUser(sueetieUser); try { Membership.UpdateUser(_user); UserUpdateMessage.Text = "Update Successful."; e.Cancel = true; UserInfo.ChangeMode(DetailsViewMode.ReadOnly); if ((string)e.CommandArgument == "Email") { MailMessage msg = new MailMessage(); if (SueetieConfiguration.Get().Core.SendEmails) { AddHeaders(msg, _user); AddBody(msg, _user); SendIt(msg); } UserUpdateMessage.Text += " Approval Email has been sent!"; } } catch (Exception ex) { UserUpdateMessage.Text = "Update Failed: " + ex.Message; e.Cancel = true; UserInfo.ChangeMode(DetailsViewMode.ReadOnly); } } }
public static void DownloadProductFile(int _productID, string _purchaseKey, int _cartLinkID) { int num2; HttpContext current = HttpContext.Current; Stream stream = null; SueetieProduct sueetieProduct = Products.GetSueetieProduct(_productID); ProductPurchase productPurchase = new ProductPurchase { ProductID = _productID, UserID = SueetieContext.Current.User.UserID, PurchaseKey = _purchaseKey, CartLinkID = _cartLinkID, ActionID = 1 }; Purchases.RecordPurchase(productPurchase); string marketplaceFolderName = SueetieConfiguration.Get().Core.MarketplaceFolderName; string str = sueetieProduct.DateCreated.Year.ToString(); string str2 = Guid.NewGuid() + ".zip"; string sourceFileName = siteRootPath + @"util\marketplace\downloads\" + str + @"\" + sueetieProduct.DownloadURL; string destFileName = siteRootPath + @"util\marketplace\downloads\tmp\" + str2; File.Copy(sourceFileName, destFileName); int num = 0x8000; byte[] buffer = new byte[num]; stream = File.OpenRead(destFileName); current.Response.AddHeader("Content-Disposition", "attachment; filename=" + sueetieProduct.DownloadURL); current.Response.Clear(); current.Response.ContentType = "application/zip"; current.Response.Buffer = false; stream.Position = 0L; while ((num2 = stream.Read(buffer, 0, buffer.Length)) > 0) { if (current.Response.IsClientConnected) { current.Response.OutputStream.Write(buffer, 0, num2); current.Response.Flush(); } else { return; } } if (stream != null) { stream.Close(); } current.Response.End(); }
public static SueetieMediaObject PopulateMediaObject(SueetieMediaObject _sueetieMediaObject, IGalleryObject galleryObject) { _sueetieMediaObject.IsImage = galleryObject is GalleryServerPro.Business.Image; if (_sueetieMediaObject.IsImage) { _sueetieMediaObject.ThumbnailHeight = galleryObject.Thumbnail.Height; _sueetieMediaObject.ThumbnailWidth = galleryObject.Thumbnail.Width; } else { _sueetieMediaObject.ThumbnailWidth = SueetieConfiguration.Get().Media.ThumbnailWidth; _sueetieMediaObject.ThumbnailHeight = SueetieConfiguration.Get().Media.ThumbnailHeight; } return(_sueetieMediaObject); }
private void ConfigureControls() { this.TaskHeaderText = Resources.GalleryServerPro.Task_Edit_Captions_Header_Text; this.TaskBodyText = Resources.GalleryServerPro.Task_Edit_Captions_Body_Text; this.OkButtonText = SueetieLocalizer.GetString("process_updates", "MediaGallery.xml"); this.OkButtonToolTip = Resources.GalleryServerPro.Task_Edit_Captions_Ok_Button_Tooltip; this.PageTitle = Resources.GalleryServerPro.Task_Edit_Captions_Page_Title; // Sueetie Modified - Converting GSP galleryObjects into SueetieGalleryObjects SueetieConfiguration config = SueetieConfiguration.Get(); List <SueetieMediaObject> sueetieMediaObjects = new List <SueetieMediaObject>(); IGalleryObjectCollection albumChildren = this.GetAlbum().GetChildGalleryObjects(GalleryObjectType.Album, true); foreach (IGalleryObject _galleryObject in albumChildren) { SueetieMediaAlbum _album = SueetieMedia.GetSueetieMediaAlbum(CurrentSueetieGalleryID, _galleryObject.Id); sueetieMediaObjects.Insert(0, new SueetieMediaObject { MediaObjectID = _galleryObject.Id, MediaObjectTitle = _galleryObject.Title, AlbumID = _galleryObject.Id, IsAlbum = true, MediaObjectUrl = String.Concat(Util.GetUrl(PageId.album, "aid={0}", _galleryObject.Id)), MediaObjectDescription = _album.AlbumDescription, DisplayName = _album.DisplayName, ThumbnailHeight = config.Media.ThumbnailHeight, ThumbnailWidth = config.Media.ThumbnailWidth }); } if (albumChildren.Count > 0) { const int textareaWidthBuffer = 30; // Extra width padding to allow room for the caption. const int textareaHeightBuffer = 72; // Extra height padding to allow room for the caption. SetThumbnailCssStyle(albumChildren, textareaWidthBuffer, textareaHeightBuffer); rptr.DataSource = sueetieMediaObjects; rptr.DataBind(); } else { this.RedirectToAlbumViewPage("msg={0}", ((int)Message.CannotEditCaptionsNoEditableObjectsExistInAlbum).ToString(CultureInfo.InvariantCulture)); } }
public static CommerceDataProvider LoadProvider() { _provider = SueetieCache.Current[providerKey] as CommerceDataProvider; if (_provider == null) { lock (_lock) { if (_provider == null) { SueetieConfiguration configuration = SueetieConfiguration.Get(); SueetieProvider provider = configuration.SueetieProviders.Find(sp => sp.Name == "MarketplaceSqlDataProvider"); _provider = Activator.CreateInstance(Type.GetType(provider.ProviderType), new object[] { provider.ConnectionString }) as CommerceDataProvider; SueetieCache.Current.InsertMax(providerKey, _provider, new CacheDependency(configuration.ConfigPath)); } } } return(_provider); }
public void Page_Load() { Label _menu = new Label(); string highlightedmenu = string.Empty; string htmlkey = FooterMenuHTMLCacheKey(); string MenuHTML = SueetieCache.Current[htmlkey] as string; string _currentTheme = this.CurrentTheme; if (IsAdminFooter) { _currentTheme = SueetieConfiguration.Get().Core.AdminTheme; } if (MenuHTML == null) { string file = HttpContext.Current.Server.MapPath("/themes/") + _currentTheme + "\\config\\footer.config"; StreamReader sr = new StreamReader(file); MenuHTML += sr.ReadToEnd(); sr.Close(); SueetieCache.Current.Insert(htmlkey, MenuHTML); } SueetieUser user = SueetieContext.Current.User; foreach (FooterMenuLink link in SueetieConfiguration.Get().FooterMenuLinks) { if (!IsUserAuthorizedForLink(user, link.role)) { highlightedmenu = MenuHTML.Replace("id=\"" + link.id + "\"", "id=\"" + link.id + "\" style=\"display:none;\""); } else { highlightedmenu = MenuHTML; } MenuHTML = highlightedmenu; } _menu.Text = highlightedmenu; Controls.Add(_menu); }
public static SaltieDataProvider LoadProvider() { _provider = SueetieCache.Current[providerKey] as SaltieDataProvider; if (_provider == null) { lock (_lock) { if (_provider == null) { SueetieConfiguration sueetieConfig = SueetieConfiguration.Get(); List <SueetieProvider> sueetieProviders = sueetieConfig.SueetieProviders; SueetieProvider _p = sueetieProviders.Find(delegate(SueetieProvider sp) { return(sp.Name == "SaltieSqlDataProvider"); }); _provider = Activator.CreateInstance(Type.GetType(_p.ProviderType), new object[] { _p.ConnectionString }) as SaltieDataProvider; SueetieCache.Current.InsertMax(providerKey, _provider, new CacheDependency(sueetieConfig.ConfigPath)); } } } return(_provider); }
private static CommerceStatistics Get() { string key = "SueetieCommerceStatistics" + SueetieConfiguration.Get().Core.SiteUniqueName; object obj2 = new object(); CommerceStatistics statistics = SueetieCache.Current[key] as CommerceStatistics; if (statistics == null) { lock (obj2) { statistics = SueetieCache.Current[key] as CommerceStatistics; if (statistics == null) { statistics = new CommerceStatistics(); SueetieCache.Current.InsertMax(key, statistics); } } } return(statistics); }
public List <SueetieBlogComment> GetRecentComments(int numRecords, int userID, int applicationID, bool isRestricted) { ContentQuery contentQuery = new ContentQuery { NumRecords = numRecords, UserID = userID, ContentTypeID = (int)SueetieContentType.BlogComment, GroupID = -1, ApplicationID = applicationID, IsRestricted = isRestricted, TruncateText = true }; List <SueetieBlogComment> _sueetieBlogComments = SueetieBlogs.GetSueetieBlogCommentList(contentQuery); foreach (SueetieBlogComment msg in _sueetieBlogComments) { msg.Comment = DataHelper.TruncateText(msg.Comment, SueetieConfiguration.Get().Core.TruncateTextCount); } return(_sueetieBlogComments); }
public List <SueetieForumMessage> GetRecentForumMessages(int numRecords, int userID, int applicationID, bool isRestricted) { ContentQuery contentQuery = new ContentQuery { NumRecords = numRecords, UserID = userID, ContentTypeID = (int)SueetieContentType.ForumMessage, GroupID = -1, ApplicationID = applicationID, IsRestricted = isRestricted, TruncateText = true }; List <SueetieForumMessage> _sueetieForumMessages = SueetieForums.GetSueetieForumMessageList(contentQuery); foreach (SueetieForumMessage msg in _sueetieForumMessages) { msg.Message = DataHelper.TruncateText(msg.Message, SueetieConfiguration.Get().Core.TruncateTextCount); } return(_sueetieForumMessages); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["u"] == null) { Response.Redirect("Message.aspx"); } else { int userID = DataHelper.GetIntFromQueryString("u", -1); if (userID > 0) { if (SueetieConfiguration.Get().Core.UseForumProfile) { int forumUserID = SueetieUsers.GetThinSueetieUser(userID).ForumUserID; string profileUrl = SueetieUrls.Instance.MasterProfile(forumUserID).Url; Response.Redirect(profileUrl); } UserProfiled = SueetieUsers.GetUser(int.Parse(Request.QueryString["u"].ToString())); if (UserProfiled.IsAnonymous) { Response.Redirect("Message.aspx?msg=1"); } else { if (UserProfiled.HasAvatarImage) { AvatarImg.ImageUrl = "/images/avatars/" + UserProfiled.AvatarFilename; } else { AvatarImg.ImageUrl = "/images/avatars/noavatar.jpg"; } lblMemberSince.Text = UserProfiled.DisplayName + " has been a member of the Sueetie Community since " + UserProfiled.DateJoined.ToString("y"); lblBio.Text = DataHelper.DefaultTextIt(UserProfiled.Bio, UserProfiled.DisplayName + " has not yet created a bio."); Page.Title = SueetieLocalizer.GetString("memberprofile_title") + UserProfiled.DisplayName; } } } }
public static SueetieSearchDataProvider LoadProvider() { _provider = SueetieCache.Current[providerKey] as SueetieSearchDataProvider; // Avoid claiming lock if providers are already loaded if (_provider == null) { lock (_lock) { // Do this again to make sure _provider is still null if (_provider == null) { SueetieConfiguration sueetieConfig = SueetieConfiguration.Get(); List <SueetieProvider> sueetieProviders = sueetieConfig.SueetieProviders; SueetieProvider _p = sueetieProviders.Find(delegate(SueetieProvider sp) { return(sp.Name == "SueetieSearchSqlDataProvider"); }); _provider = Activator.CreateInstance(Type.GetType(_p.ProviderType), new object[] { _p.ConnectionString }) as SueetieSearchDataProvider; SueetieCache.Current.InsertMax(providerKey, _provider, new CacheDependency(sueetieConfig.ConfigPath)); } } } return(_provider); }
private void BindData() { //Get the data associated with the album and display if (this.GalleryObjectsDataSource == null) { // Sueetie Modified - Retrieve Recent Photos if (DataHelper.GetIntFromQueryString("aid", 1) == -1) { List <SueetieMediaObject> sueetieMediaObjects = SueetieMedia.GetSueetieMediaObjectList(this.GalleryPage.CurrentSueetieGalleryID, true); sueetieMediaObjects.Sort(delegate(SueetieMediaObject x, SueetieMediaObject y) { return(DateTime.Compare(y.DateAdded, x.DateAdded)); }); int _photoCount = SueetieConfiguration.Get().Media.RecentPhotoCount; if (_photoCount > sueetieMediaObjects.Count) { _photoCount = sueetieMediaObjects.Count; } IGalleryObjectCollection _galleryObjects = new GalleryObjectCollection(); for (int i = 0; i < _photoCount; i++) { IGalleryObject _galleryObject = Factory.LoadMediaObjectInstance(sueetieMediaObjects[i].MediaObjectID); _galleryObjects.Add(_galleryObject); } _galleryObjects.Sort(); DisplayThumbnails(_galleryObjects, true); } else { DisplayThumbnails(this.GalleryPage.GetAlbum().GetChildGalleryObjects(true, this.GalleryPage.IsAnonymousUser), true); } } else { DisplayThumbnails(this.GalleryObjectsDataSource, false); } }
protected override void OnLoad(EventArgs e) { Image _avatarImage = new Image(); if (AvatarSueetieUser == null) { AvatarSueetieUser = CurrentSueetieUser; } if (AvatarSueetieUser != null) { _avatarImage.ImageUrl = SueetieUsers.GetUserAvatarUrl(AvatarSueetieUser.UserID, this.UseOriginalImage, this.UseCachedAvatarRoot); _avatarImage.AlternateText = AvatarSueetieUser.DisplayName; string _profileUrl = SueetieUrls.Instance.MasterProfile(AvatarSueetieUser.ForumUserID).Url; if (PostBackToProfile) { if (!SueetieConfiguration.Get().Core.UseForumProfile) { _profileUrl = SueetieUrls.Instance.MyProfile(AvatarSueetieUser.UserID).Url; } _avatarImage.Attributes.Add("onClick", "javascript:window.open('" + _profileUrl + "','_self')"); } } else { _avatarImage.ImageUrl = SueetieUsers.GetUserAvatarUrl(-2, this.UseOriginalImage); } _avatarImage.Style.Add("height", this.Height.ToString() + "px"); _avatarImage.Style.Add("width", this.Width.ToString() + "px"); _avatarImage.Style.Add("border-width", this.BorderWidth.ToString() + "px"); _avatarImage.CssClass = this.CssClass; Controls.Add(_avatarImage); }
public static void ClearCommerceSettingsCache() { SueetieCache.Current.Remove("CommerceSettings-" + SueetieConfiguration.Get().Core.SiteUniqueName); }
/// <summary> /// Generate the HTML that can be sent to a browser to render the media object. If the configuration file /// does not specify an HTML template for this MIME type, an empty string is returned. If the media object is /// an image but cannot be displayed in a browser (such as TIF), then return an empty string. /// </summary> /// <returns> /// Returns a string of valid HTML that can be sent to a browser to render the media object, or an empty /// string if the media object cannot be displayed in a browser. /// </returns> /// <remarks>The HTML templates used to generate the HTML code in this method are stored in the Gallery /// Server Pro configuration file, specifically at this location: /// GalleryServerPro/galleryObject/mediaObjects/mediaObject</remarks> public string GenerateHtml() { if (!String.IsNullOrEmpty(this._externalHtmlSource)) { return(this._externalHtmlSource); } if ((this.MimeType.MajorType.Equals("IMAGE", StringComparison.OrdinalIgnoreCase)) && (IsImageBrowserIncompatible())) { return(String.Empty); // Browsers can't display this image. } string htmlOutput = GetHtmlOutputFromConfig(); if (String.IsNullOrEmpty(htmlOutput)) { return(String.Empty); // No HTML rendering info in config file. } // Sueetie Modified - Get htmlOutput string from Sueetie.Config if enabled or to MobileHtmlOutput if IsMobile if (SueetieConfiguration.Get().Media.LinkToOriginalImage&& this.MimeType.MajorType.ToUpperInvariant() == "IMAGE") { htmlOutput = SueetieConfiguration.Get().Media.HtmlOutput; } if (SueetieContext.Current.IsMobile && this.MimeType.MajorType.ToUpperInvariant() == "IMAGE") { htmlOutput = SueetieConfiguration.Get().Media.MobileHtmlOutput; } htmlOutput = htmlOutput.Replace("{HostUrl}", Util.GetHostUrl()); htmlOutput = htmlOutput.Replace("{MediaObjectUrl}", GetMediaObjectUrl()); htmlOutput = htmlOutput.Replace("{MimeType}", this.MimeType.BrowserMimeType); htmlOutput = htmlOutput.Replace("{Width}", this.Width.ToString(CultureInfo.InvariantCulture)); htmlOutput = htmlOutput.Replace("{Height}", this.Height.ToString(CultureInfo.InvariantCulture)); htmlOutput = htmlOutput.Replace("{Title}", this.Title); htmlOutput = htmlOutput.Replace("{TitleNoHtml}", Util.RemoveHtmlTags(this.Title, true)); string[] cssClasses = new string[this.CssClasses.Count]; this.CssClasses.CopyTo(cssClasses, 0); htmlOutput = htmlOutput.Replace("{CssClass}", String.Join(" ", cssClasses)); bool autoStartMediaObject = Factory.LoadGallerySetting(GalleryId).AutoStartMediaObject; // Replace {AutoStartMediaObjectText} with "true" or "false". htmlOutput = htmlOutput.Replace("{AutoStartMediaObjectText}", autoStartMediaObject.ToString().ToLowerInvariant()); // Replace {AutoStartMediaObjectInt} with "1" or "0". htmlOutput = htmlOutput.Replace("{AutoStartMediaObjectInt}", autoStartMediaObject ? "1" : "0"); // Replace {AutoPlay} with "autoplay" or "". htmlOutput = htmlOutput.Replace("{AutoPlay}", autoStartMediaObject ? "autoplay" : String.Empty); if (htmlOutput.Contains("{MediaObjectAbsoluteUrlNoHandler}")) { htmlOutput = ReplaceMediaObjectAbsoluteUrlNoHandlerParameter(htmlOutput); } if (htmlOutput.Contains("{MediaObjectRelativeUrlNoHandler}")) { htmlOutput = ReplaceMediaObjectRelativeUrlNoHandlerParameter(htmlOutput); } if (htmlOutput.Contains("{GalleryPath}")) { htmlOutput = htmlOutput.Replace("{GalleryPath}", Util.GalleryRoot); } return(htmlOutput); }
public static string ProductPurchaseListCacheKey() { return(string.Format("ProductPurchaseList-{0}", SueetieConfiguration.Get().Core.SiteUniqueName)); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { this.lblPurchaseTitle.Text = SueetieLocalizer.GetMarketplaceString("productpurchase_title_success"); this.pnlLicenses.Visible = false; this.transactionXID = base.Request.QueryString["tx"]; PaymentService primaryPaymentService = CommerceContext.Current.PrimaryPaymentService; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(primaryPaymentService.TransactionUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = base.Request.BinaryRead(HttpContext.Current.Request.ContentLength); string str = Encoding.ASCII.GetString(bytes) + string.Format("&cmd=_notify-synch&tx={0}&at={1}", this.transactionXID, primaryPaymentService.IdentityToken); request.ContentLength = str.Length; StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII); writer.Write(str); writer.Close(); StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream()); string input = reader.ReadToEnd(); reader.Close(); this.lblTransactionXID.Text = this.transactionXID; List <string> list = (from s in Regex.Split(input, "\n", RegexOptions.ExplicitCapture) where !string.IsNullOrEmpty(s) select s).ToList <string>(); if (list[0] == "SUCCESS") { List <ProductPurchase> list2 = new List <ProductPurchase>(); List <ProductLicense> list3 = new List <ProductLicense>(); this.PaymentProperties = this.CreateDictionary((from t in list where t.Contains("=") select t).ToList <string>()); int num = this.GetNum("num_cart_items"); int num2 = 0; int cartLinkID = -1; int num4 = -1; this.transactionXID = this.GetString("txn_id"); for (int i = 1; i <= num; i++) { num2 = this.GetNum("quantity".AddItemNum(i)); cartLinkID = this.GetNum("item_number".AddItemNum(i)); CartLink cartLink = CommerceCommon.GetCartLink(cartLinkID); for (int j = 0; j < num2; j++) { base.CurrentSueetieProduct = Products.GetSueetieProduct(cartLink.ProductID); ProductPurchase item = new ProductPurchase { TransactionXID = this.transactionXID, UserID = base.CurrentSueetieUserID, CartLinkID = cartLinkID, ProductID = cartLink.ProductID, PurchaseKey = CommerceCommon.GeneratePurchaseKey(), ActionID = base.CurrentSueetieProduct.ActionType() }; list2.Add(item); num4 = Purchases.RecordPurchase(item); if (base.CurrentSueetieProduct.ProductTypeID == 5) { ProductPackage productPackage = CommerceCommon.GetProductPackage(cartLink.ProductID); SueetiePackageType spt = (SueetiePackageType)System.Enum.ToObject(typeof(SueetiePackageType), productPackage.PackageTypeID); ProductLicense license = new ProductLicense { PackageTypeID = productPackage.PackageTypeID, LicenseTypeID = cartLink.LicenseTypeID, Version = productPackage.Version, UserID = base.CurrentSueetieUserID, CartLinkID = cartLinkID, PurchaseID = num4, License = Guid.NewGuid().ToString().ToUpper() }; SueetieLicenseType type2 = (SueetieLicenseType)System.Enum.ToObject(typeof(SueetieLicenseType), cartLink.LicenseTypeID); license.License = LicensingCommon.CreateLicenseKey(type2, spt); list3.Add(license); Licenses.CreateProductLicense(license); } } } this.rptPurchases.DataSource = Purchases.GetPurchasesByTransaction(this.transactionXID); this.rptPurchases.DataBind(); if (list3.Count > 0) { this.rptLicenses.DataSource = Licenses.GetLicensesByTransaction(this.transactionXID); this.rptLicenses.DataBind(); this.pnlLicenses.Visible = true; } } else { this.lblPurchaseTitle.Text = SueetieLocalizer.GetMarketplaceString("productpurchase_title_failure"); this.pnlLicenses.Visible = false; this.pnlPurchases.Visible = false; this.pnlTransactionCode.Visible = false; this.pnlSuccess.Visible = false; this.pnlFailure.Visible = true; MailMessage message = new MailMessage { From = new MailAddress(SiteSettings.Instance.FromEmail, SiteSettings.Instance.FromName) }; MailAddress address = new MailAddress(SiteSettings.Instance.ContactEmail, SiteSettings.Instance.SiteName + SueetieLocalizer.GetMarketplaceString("purchase_failure_email_admin")); message.To.Add(address); message.Subject = SueetieLocalizer.GetMarketplaceString("purchase_failure_email_subject"); string str4 = SueetieLocalizer.GetMarketplaceString("purchase_failure_email_firstline") + Environment.NewLine + Environment.NewLine; object obj2 = str4 + base.CurrentSueetieUser.UserName.ToString() + " (" + base.CurrentSueetieUser.DisplayName + ")"; string str3 = string.Concat(new object[] { obj2, Environment.NewLine, DateTime.Now.ToLongDateString(), ' ', DateTime.Now.ToLongTimeString() }) + Environment.NewLine + Environment.NewLine; message.Body = str3; if (SueetieConfiguration.Get().Core.SendEmails) { EmailHelper.AsyncSendEmail(message); } } } }
public static string SueetieProductListCacheKey() { return(string.Format("SueetieAllProductList-{0}", SueetieConfiguration.Get().Core.SiteUniqueName)); }
public void Page_Load() { Label _menu = new Label(); string highlightedmenu = string.Empty; string htmlkey = MenuHTMLCacheKey(); string MenuHTML = SueetieCache.Current[htmlkey] as string; if (MenuHTML == null) { string file = HttpContext.Current.Server.MapPath("/themes/") + this.CurrentTheme + "\\config\\menu.config"; StreamReader sr = new StreamReader(file); MenuHTML += sr.ReadToEnd(); sr.Close(); SueetieCache.Current.Insert(htmlkey, MenuHTML); } SueetieUser user = SueetieContext.Current.User; bool _noLight = true; foreach (SiteMenuTab tab in SueetieConfiguration.Get().SiteMenuTabs) { if (IsUserAuthorizedForTab(user, tab.roles)) { if (IsGroup && _noLight) { highlightedmenu = MenuHTML.Replace("id=\"GroupsTab\"", "id=\"GroupsTab\" class=\"current\""); _noLight = false; } else if (HttpContext.Current.Request.RawUrl.ToLower().Contains("/search/") && _noLight) { highlightedmenu = MenuHTML.Replace("id=\"SearchTab\"", "id=\"SearchTab\" class=\"current\""); _noLight = false; } else if (HttpContext.Current.Request.RawUrl.ToLower() == tab.url && _noLight) { highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\""); _noLight = false; } else if (String.Compare(SueetieApplications.Current.ApplicationKey, tab.appkey, true) == 0 && ShowAppTab(tab) && _noLight) { highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\""); _noLight = false; } else if (String.Compare(SueetieApplications.Current.ApplicationName, tab.app, true) == 0 && ShowAppTab(tab) && _noLight) { highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" class=\"current\""); _noLight = false; } else { highlightedmenu = MenuHTML; } } else if (!IsAnonymousTab(user, tab.roles)) { highlightedmenu = MenuHTML.Replace("id=\"" + tab.id + "\"", "id=\"" + tab.id + "\" style=\"display:none;\""); } MenuHTML = highlightedmenu; } highlightedmenu = MenuHTML.Replace("id=\"" + HighlightTab + "\"", "id=\"" + HighlightTab + "\" class=\"current\""); _menu.Text = highlightedmenu; Controls.Add(_menu); }
private string FooterMenuHTMLCacheKey() { return(String.Format("FooterMenuHTML-{0}-{1}-{2}", SueetieConfiguration.Get().Core.SiteUniqueName, IsAdminFooter, this.CurrentTheme)); }
private static string MenuHTMLCacheKey() { return(String.Format("SiteMenuHTML-{0}-{1}", SueetieConfiguration.Get().Core.SiteUniqueName, SueetieContext.Current.Theme)); }
public static string PaymentServiceCacheKey() { return(string.Format("PrimaryPaymentService-{0}", SueetieConfiguration.Get().Core.SiteUniqueName)); }
public static string ActionTypeItemListCacheKey() { return(string.Format("ActionTypeItemList-{0}", SueetieConfiguration.Get().Core.SiteUniqueName)); }
/// <summary> /// Displays thumbnail versions of the specified <paramref name="galleryObjects"/>. /// </summary> /// <param name="galleryObjects">The gallery objects to display.</param> /// <param name="showAddObjectsLink">If set to <c>true</c> show a message and a link allowing the user to add objects to the /// current album as specified in the query string. Set to false when displaying objects that may belong to more than one /// album.</param> private void DisplayThumbnails(IGalleryObjectCollection galleryObjects, bool showAddObjectsLink) { string msg; if (galleryObjects.Count > 0) { // At least one album or media object in album. //msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2'>{0}</p>", Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_With_Objects); //phMsg.Controls.Add(new LiteralControl(msg)); } else if ((showAddObjectsLink) && (this.GalleryPage.UserCanAddMediaObject) && (!this.GalleryPage.GallerySettings.MediaObjectPathIsReadOnly)) { // We have no objects to display. The user is authorized to add objects to this album and the gallery is writeable, so show // message and link to add objects page. string innerMsg = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_No_Objects_User_Has_Add_MediaObject_Permission, Util.GetUrl(PageId.task_addobjects, "aid={0}", this.GalleryPage.GetAlbumId())); msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2 gsp_msgfriendly'>{0}</p>", innerMsg); phMsg.Controls.Add(new LiteralControl(msg)); } else { // No objects and/or user doesn't have permission to add media objects. msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2 gsp_msgfriendly'>{0}</p>", Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_No_Objects); phMsg.Controls.Add(new LiteralControl(msg)); } this.GalleryPage.SetThumbnailCssStyle(galleryObjects); // Sueetie Modified - Converting GSP galleryObjects into SueetieGalleryObjects SueetieConfiguration config = SueetieConfiguration.Get(); List <SueetieMediaObject> sueetieMediaObjects = new List <SueetieMediaObject>(); foreach (IGalleryObject _galleryObject in galleryObjects) { if (_galleryObject is Album) { SueetieMediaAlbum _album = SueetieMedia.GetSueetieMediaAlbum(CurrentSueetieGalleryID, _galleryObject.Id); sueetieMediaObjects.Insert(0, new SueetieMediaObject { MediaObjectID = _galleryObject.Id, MediaObjectTitle = _galleryObject.Title, AlbumID = _galleryObject.Id, IsAlbum = true, MediaObjectUrl = String.Concat(Util.GetUrl(PageId.album, "aid={0}", _galleryObject.Id)), MediaObjectDescription = _album.AlbumDescription, DisplayName = _album.DisplayName, ThumbnailHeight = config.Media.ThumbnailHeight, ThumbnailWidth = config.Media.ThumbnailWidth, DateTimeCreated = _album.DateTimeCreated, SueetieUserID = _album.SueetieUserID }); } else { SueetieMediaObject _sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(this.CurrentSueetieGalleryID, _galleryObject.Id); MediaHelper.PopulateMediaObject(_sueetieMediaObject, _galleryObject); _sueetieMediaObject.MediaObjectUrl = GenerateUrl(_galleryObject); sueetieMediaObjects.Add(_sueetieMediaObject); } } if (PagingEnabled) { rptr.DataSource = CreatePaging(sueetieMediaObjects); RegisterPagingScript(); } else { rptr.DataSource = sueetieMediaObjects; } rptr.DataBind(); }
public static string CartLinkListCacheKey() { return(string.Format("CartLinkList-{0}", SueetieConfiguration.Get().Core.SiteUniqueName)); }