Ejemplo n.º 1
0
		public void DeleteNow(object o, System.EventArgs e)
		{
			if (ObjectTypeDropDown.SelectedValue.Equals("Photo"))
			{
				Photo c = new Photo(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Gallery"))
			{
				Gallery c = new Gallery(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Venue"))
			{
				Venue c = new Venue(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Event"))
			{
				Event c = new Event(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Comment"))
			{
				Comment c = new Comment(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Thread"))
			{
				Thread c = new Thread(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Usr"))
			{
				Usr c = new Usr(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Article"))
			{
				Article c = new Article(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			DoneLabel.Visible = true;
		}
Ejemplo n.º 2
0
		public static Dictionary<string, string> GetDataItem(Article a)
		{
			return new Dictionary<string, string>()
			{
				{Columns.PicPath.ToString(), a.PicPath},
				{Columns.Title.ToString(), a.Title},
				{Columns.Summary.ToString(), a.Summary},
				{Columns.OwnerUrl.ToString(), a.Owner.Url()},
				{Columns.OwnerNickName.ToString(), a.Owner.NickName},
				{Columns.DiscussionUrl.ToString(), a.UrlDiscussion()},
				{Columns.Comments.ToString(), a.TotalComments.ToString()},
				{Columns.Views.ToString(), a.Views.ToString()},
				{Columns.Url.ToString(), a.Url()},
				{Columns.Date.ToString(), Cambro.Misc.Utility.FriendlyDate(a.EnabledDateTime)},
			};

		}
Ejemplo n.º 3
0
		public void ForumInfo_Load(object o, System.EventArgs e)
		{
			if (!CurrentForumCheck)
				return;

			PanelThreadDescTypeNone.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.None);
			PanelThreadDescTypeEvent.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Event);
			PanelThreadDescTypeVenue.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Venue);
			PanelThreadDescTypePlace.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Place);
			PanelThreadDescTypeCountry.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Country);
			PanelThreadDescTypeArticle.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Article);
			PanelThreadDescTypeBrand.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Brand);
			PanelThreadDescTypeGroup.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Group);
			PanelThreadDescRelatedPanel.Visible = false;
			PanelThreadDescGroupBrandPanel.Visible = false;
			PanelThreadDescBrandPanel.Visible = false;
			FavouriteGroupPanel.Visible = (ThreadParentType.Equals(Model.Entities.ObjectType.Group) && CurrentGroupUsr != null && CurrentGroupUsr.IsMember);

			SetPageTitle("General discussions");

			if (ThreadParentType.Equals(Model.Entities.ObjectType.None))
			{
				ThreadDescWorldwideHomeCountryLink.InnerText = ThreadDescWorldwideHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName);
				ThreadDescWorldwideHomeCountryLink.HRef = Country.Current.UrlDiscussion();
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Event))
			{
				Event ev = new Event(ObjectK);
				ThreadDescEventEventLink.InnerText = ev.Name;
				ThreadDescEventEventLink.HRef = ev.Url();

				ThreadDescEventVenueLink.InnerText = ev.Venue.Name;
				ThreadDescEventVenueLink.HRef = ev.Venue.Url();

				ThreadDescEventPlaceLink.InnerText = ev.Venue.Place.Name;
				ThreadDescEventPlaceLink.HRef = ev.Venue.Place.Url();

				ThreadDescEventDateLabel.Text = ev.FriendlyDate(false);

				PanelThreadDescRelatedPanel.Visible = ev.Brands.Count > 0;
				string brandsHtml = "";
				for (int i = 0; i < ev.Brands.Count; i++)
				{
					brandsHtml += (i == 0 ? "" : (i == (ev.Brands.Count - 1) ? " or " : ", ")) + "the <b><a href=\"" + ev.Brands[i].UrlDiscussion() + "\">" + ev.Brands[i].Name + " forum</a></b>";
				}
				PanelThreadDescRelatedPh.Controls.Add(new LiteralControl(brandsHtml));

				SetPageTitle(ev.Name + " discussions");


			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Venue))
			{
				Venue v = new Venue(ObjectK);

				ThreadDescVenueVenueLink.InnerText = v.Name;
				ThreadDescVenueVenueLink.HRef = v.Url();

				ThreadDescVenuePlaceLink.InnerText = v.Place.Name;
				ThreadDescVenuePlaceLink.HRef = v.Place.Url();
				SetPageTitle(v.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Place))
			{
				Place t = new Place(ObjectK);

				ThreadDescPlacePlaceLink.InnerText = t.Name;
				ThreadDescPlacePlaceLink.HRef = t.Url();
				SetPageTitle(t.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Country))
			{
				Country c = new Country(ObjectK);

				ThreadDescCountryLabel.Text = c.FriendlyName;
				ThreadDescCountryLink.HRef = c.Url();
				SetPageTitle(c.FriendlyName + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Article))
			{
				Article a = new Article(ObjectK);
				ThreadDescArticleArticleLink.InnerText = a.Title;
				ThreadDescArticleArticleLink.HRef = a.Url();
				SetPageTitle(a.Title + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Brand))
			{
				Brand b = new Brand(ObjectK);
				ThreadDescBrandBrandLink.InnerText = b.Name;
				ThreadDescBrandBrandLink.HRef = b.Url();
				SetPageTitle(b.Name + " discussions");
				if (b.Group.TotalComments > 0)
				{
					PanelThreadDescBrandPanel.Visible = true;
					PanelThreadDescBrandGroupChatAnchor.InnerText = b.Group.FriendlyName + " group chat";
					PanelThreadDescBrandGroupChatAnchor.HRef = b.Group.UrlDiscussion();
					PanelThreadDescBrandGroupChatCommentsLabel.Text = b.Group.TotalComments.ToString("#,##0") + " comment" + (b.Group.TotalComments == 1 ? "" : "s");
				}
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Group))
			{
				ThreadDescGroupGroupLink.InnerText = CurrentGroup.FriendlyName + " group";
				ThreadDescGroupGroupLink.HRef = CurrentGroup.Url();
				SetPageTitle(CurrentGroup.FriendlyName + " discussions");
				if (CurrentGroup.BrandK > 0)
				{
					PanelThreadDescGroupBrandPanel.Visible = true;
					PanelThreadDescGroupBrandAnchor.HRef = CurrentGroup.Brand.UrlDiscussion();
					PanelThreadDescGroupBrandAnchor.InnerText = CurrentGroup.Brand.Name + " public chat";
					PanelThreadDescGroupBrandCommentsLabel.Text = CurrentGroup.Brand.TotalComments.ToString("#,##0") + " comment" + (CurrentGroup.Brand.TotalComments == 1 ? "" : "s");
				}
			}
		}
Ejemplo n.º 4
0
		public void AddButtonDone(object o, System.EventArgs e)
		{
			if (Page.IsValid)
			{
				//Add article and paragraphs
				Article art = new Article();
				art.AddedDateTime = DateTime.Now;
				art.Title = Cambro.Web.Helpers.StripHtml(AddArticleTitleTextBox.Text.Trim());
				art.Summary = Cambro.Web.Helpers.StripHtml(AddArticleSummaryTextBox.Text.Trim());
				string[] paraAry = AddArticleBodyHtml.GetParaHtml();
				art.Update();
				int order = 1;
				foreach (string s in paraAry)
				{
					if (s.Length > 0)
					{
						Para p = new Para();

						p.ArticleK = art.K;
						p.Page = 1;
						p.Order = order;
						order++;
						p.Type = Para.TypeEnum.Para;
						p.PhotoK = 0;
						p.Text = s;
						p.ThreadK = 0;
						p.Update();
					}
				}
				art.OwnerUsrK = Usr.Current.K;
				art.Status = Article.StatusEnum.New;
				if (CurrentEvent != null)
				{
					art.ParentObjectType = Model.Entities.ObjectType.Event;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Venue;
					art.ParentObjectK = CurrentEvent.K;
				}
				else if (AddArticleScopeEvent.Checked)
				{
					art.ParentObjectType = Model.Entities.ObjectType.Event;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Venue;
					art.ParentObjectK = this.AddArticleScopeMultiPicker.Event.K;
				}
				else if (AddArticleScopeVenue.Checked)
				{
					art.ParentObjectType = Model.Entities.ObjectType.Venue;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Venue;
					art.ParentObjectK = this.AddArticleScopeMultiPicker.Venue.K;
				}
				else if (AddArticleScopePlace.Checked)
				{
					art.ParentObjectType = Model.Entities.ObjectType.Place;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Place;
					art.ParentObjectK = this.AddArticleScopeMultiPicker.Place.K;
				}
				else if (AddArticleScopeCountry.Checked)
				{
					art.ParentObjectType = Model.Entities.ObjectType.Country;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Country;
					art.ParentObjectK = this.AddArticleScopeMultiPicker.Country.K;
				}
				else
				{
					art.ParentObjectType = Model.Entities.ObjectType.None;
					art.Relevance = Model.Entities.Article.RelevanceEnum.Worldwide;
				}
				art.HasSingleThread = true;
				art.AdminNote = "Article added by owner " + DateTime.Now.ToString();
				art.Update();
				art.UpdateAncestorLinks();

				Response.Redirect(UrlInfo.PageUrl("myarticles", "mode", "edit", "k", art.K.ToString()));
			}
		}
Ejemplo n.º 5
0
		public bool CanEdit(Article a)
		{
			if (this.IsAdmin)
				return true;
			if (this.IsSuper)
				return a.Status.Equals(Article.StatusEnum.Edit) || a.Status.Equals(Article.StatusEnum.New);
			if (this.K == a.OwnerUsrK
				|| (a.Event != null && this.IsEnabledPromoterOfEventConfirmed(a.Event))
				|| (a.Venue != null && this.IsEnabledPromoterOfConfirmedVenue(a.Venue)))
				return a.Status.Equals(Article.StatusEnum.New);

			return false;
		}
Ejemplo n.º 6
0
		public static IBob Get(Model.Entities.ObjectType type, int k)
		{
			IBob b = null;
			bool wrongType = false;
			try
			{
				switch (type)
				{
					case Model.Entities.ObjectType.Photo:
						b = new Photo(k);
						break;
					case Model.Entities.ObjectType.Event:
						b = new Event(k);
						break;
					case Model.Entities.ObjectType.Venue:
						b = new Venue(k);
						break;
					case Model.Entities.ObjectType.Place:
						b = new Place(k);
						break;
					case Model.Entities.ObjectType.Thread:
						b = new Thread(k);
						break;
					case Model.Entities.ObjectType.Country:
						b = new Country(k);
						break;
					case Model.Entities.ObjectType.Article:
						b = new Article(k);
						break;
					case Model.Entities.ObjectType.Para:
						b = new Para(k);
						break;
					case Model.Entities.ObjectType.Brand:
						b = new Brand(k);
						break;
					case Model.Entities.ObjectType.Promoter:
						b = new Promoter(k);
						break;
					case Model.Entities.ObjectType.Usr:
						b = new Usr(k);
						break;
					case Model.Entities.ObjectType.Region:
						b = new Region(k);
						break;
					case Model.Entities.ObjectType.Gallery:
						b = new Gallery(k);
						break;
					case Model.Entities.ObjectType.Group:
						b = new Group(k);
						break;
					case Model.Entities.ObjectType.Banner:
						b = new Banner(k);
						break;
					case Model.Entities.ObjectType.GuestlistCredit:
						b = new GuestlistCredit(k);
						break;
					case Model.Entities.ObjectType.Ticket:
						b = new Ticket(k);
						break;
					case Model.Entities.ObjectType.Invoice:
						b = new Invoice(k);
						break;
					case Model.Entities.ObjectType.InsertionOrder:
						b = new InsertionOrder(k);
						break;
					case Model.Entities.ObjectType.CampaignCredit:
						b = new CampaignCredit(k);
						break;
					case Model.Entities.ObjectType.UsrDonationIcon:
						b = new UsrDonationIcon(k);
						break;
					default:
						wrongType = true;
						b = null;
						break;
				}
			}
			catch { }
			if (wrongType)
				throw new Exception("Bob.Get attempted to get " + type.ToString() + " - can't do it!!! DUH!");
			return b;
		}
Ejemplo n.º 7
0
		public string dsiTagReplacement(Match m)
		{
			string tagName = "dsi";
			try
			{
				//string[] arrParts = m.Groups[1].Value.Split[" "];
				//Dictionary<string, string> parts = new Dictionary<string, string>();
				SgmlReader sgml = new SgmlReader();
				string inStr = m.Groups[0].Value;
				if (inStr.StartsWith("<dsi:link"))
					inStr += "</dsi:link>";
				sgml.InputStream = new StringReader(inStr);
				sgml.DocType = "HTML";
				sgml.Read();

				tagName = sgml.Name;
				string uniqueId = Guid.NewGuid().ToString("N");

				#region Parse attributes
				Dictionary<string, string> attributes = new Dictionary<string, string>();
				while (sgml.MoveToNextAttribute())
				{
					attributes.Add(sgml.Name.ToLower(), sgml.Value);
				}
				#endregion

				string typeAtt = attributes.ContainsKey("type") ? attributes["type"] : null;
				string refAtt = attributes.ContainsKey("ref") ? attributes["ref"] : null;

				#region Parse styles
				Dictionary<string, string> style = new Dictionary<string, string>();
				if (attributes.ContainsKey("style"))
				{
					foreach (string s in attributes["style"].Split(';'))
					{
						try
						{
							if (s.Contains(":"))
								style[s.Split(':')[0].Trim()] = s.Split(':')[1].Trim();
						}
						catch
						{
						}
					}
				}
				#endregion

				#region Parse class
				List<string> classes = new List<string>();
				if (attributes.ContainsKey("class"))
				{
					foreach (string s in attributes["class"].Split(' '))
					{
						try
						{
							classes.Add(s);
						}
						catch
						{
						}
					}
				}
				#endregion

				if (tagName == "dsi:video")
				{
					#region dsi:video
					/*
					<dsi:video 
						type = [dsi | flv | youtube | google | metacafe | myspace | break | collegehumor | redtube | ebaumsworld | dailymotion] 
						ref = [dsi-photo-k | site-ref]
						src = [flv-url]
						width = [width] (optional)
						height = [height] (optional)
						nsfw = [true | false] (optional)
						/> 
					*/
					bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false;
					string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto";
					if (typeAtt == "youtube")
					{
						#region youtube
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 355;

						//<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.youtube.com/v/" + refAtt + "&rel=1");
						#endregion
					}
					else if (typeAtt == "metacafe")
					{
						#region metacafe
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345;

						//<embed src="http://www.metacafe.com/fplayer/1029494/how_to_make_fire_balls.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed><br><font size = 1><a href="http://www.metacafe.com/watch/1029494/how_to_make_fire_balls/">How To Make Fire Balls</a> - <a href="http://www.metacafe.com/">The funniest videos clips are here</a></font>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.metacafe.com/fplayer/" + refAtt + ".swf");
						#endregion
					}
					else if (typeAtt == "google")
					{
						#region google
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 326;

						//<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-7477616603879486362&hl=en-GB" flashvars=""> </embed>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://video.google.com/googleplayer.swf?docId=" + refAtt + "&hl=en-GB");
						#endregion
					}
					else if (typeAtt == "flv")
					{
						#region flv
						string flvUrl = attributes.ContainsKey("src") ? attributes["src"] : null;
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357;

						return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", flvUrl, "autoStart", "0");
						#endregion
					}
					else if (typeAtt == "dsi")
					{
						#region dsi
						try
						{
							Photo p = new Photo(int.Parse(refAtt));
							if (p.MediaType != Photo.MediaTypes.Video)
							{
								return "[Invalid ref " + refAtt + " - this is not a video]";
							}
							else
							{
								if (p.ContentDisabled)
								{
									return "[Invalid ref " + refAtt + " - video disabled]";
								}
								else
								{
									if (p.Status == Photo.StatusEnum.Enabled)
									{
										//int width = p.VideoMedWidth;
										//int height = p.VideoMedHeight + 20;

										int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : p.VideoMedWidth;
										int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : (p.VideoMedHeight + 20);

										return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", p.VideoMedPath, "autoStart", "0", "jpg", p.WebPath);
									}
									else if (p.Status == Photo.StatusEnum.Moderate)
									{
										return "[Invalid ref " + refAtt + " - video waiting for moderation]";
									}
									else if (p.Status == Photo.StatusEnum.Processing)
									{
										return "[Invalid ref " + refAtt + " - video still processing]";
									}
								}
							}
						}
						catch
						{
							return "[Invalid ref " + refAtt + " - video not found]";
						}
						return "[Invalid ref " + refAtt + " - error]";
						#endregion
					}
					else if (typeAtt == "collegehumor")
					{
						#region collegehumor
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 337;

						//<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" width="480" height="360" ><param name="allowfullscreen" value="true" /><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" /></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=" + refAtt + "&fullscreen=1");
						#endregion
					}
					else if (typeAtt == "myspace")
					{
						#region myspace
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 430;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 346;

						//<embed src="http://lads.myspace.com/videos/vplayer.swf" flashvars="m=25330587&v=2&type=video" type="application/x-shockwave-flash" width="430" height="346"></embed>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://lads.myspace.com/videos/vplayer.swf", "m", refAtt, "v", "2", "type", "video");
						#endregion
					}
					else if (typeAtt == "break")
					{
						#region break
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 464;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 392;

						//<object width="464" height="392"><param name="movie" value="http://embed.break.com/NDMyNjg3"></param><embed src="http://embed.break.com/NDMyNjg3" type="application/x-shockwave-flash" width="464" height="392"></embed></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://embed.break.com/" + refAtt);
						#endregion
					}
					else if (typeAtt == "redtube")
					{
						#region redtube
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 434;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 344;

						//<object height="344" width="434"><param name="movie" value="http://embed.redtube.com/player/"><param name="FlashVars" value="id=2394&style=redtube"><embed src="http://embed.redtube.com/player/?id=2394&style=redtube" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="344" width="434"></object>
						return GetFlash(uniqueId, height, width, true, draw, "http://embed.redtube.com/player/?id=" + refAtt + "&style=redtube", "id", refAtt, "style", "redtube");
						#endregion
					}
					else if (typeAtt == "ebaumsworld")
					{
						#region ebaumsworld
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345;

						//<embed src="http://www.ebaumsworld.com/mediaplayer.swf" flashvars="file=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.flv&displayheight=321&image=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.jpg" loop="false" menu="false" quality="high" bgcolor="#ffffff" width="425" height="345" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.ebaumsworld.com/mediaplayer.swf", "file", "http://media.ebaumsworld.com/" + refAtt + ".flv", "displayheight", (height - 24).ToString(), "image", "http://media.ebaumsworld.com/" + refAtt + ".jpg");
						#endregion
					}
					else if (typeAtt == "dailymotion")
					{
						#region dailymotion
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 420;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 331;

						//<div><object width="420" height="331"><param name="movie" value="http://www.dailymotion.com/swf/x3xmzx"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/x3xmzx" type="application/x-shockwave-flash" width="420" height="331" allowFullScreen="true" allowScriptAccess="always"></embed></object><br /><b><a href="http://www.dailymotion.com/video/x3xmzx_time-attack-evo-crash-knockhill-200_auto">TIME ATTACK EVO CRASH KNOCKHILL 2007</a></b><br /><i>Uploaded by <a href="http://www.dailymotion.com/TIMEATTACKTV">TIMEATTACKTV</a></i></div>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.dailymotion.com/swf/" + refAtt);
						#endregion
					}
					else if (typeAtt == "veoh")
					{
						return "[Veoh videos disabled]";
						#region veoh
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 365;

						//<embed src="http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=v1644215kQ3H8PG2&id=anonymous" allowFullScreen="true" width="540" height="438" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><br/><a href="http://www.veoh.com/">Online Videos by Veoh.com</a>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=" + refAtt + "&id=anonymous");
						#endregion
					}
					else
					{
						return "[Invalid type attribute]";
					}
					#endregion
				}
				else if (tagName == "dsi:audio")
				{
					#region dsi:audio
					/*
					<dsi:audio 
						type = [mp3]
						src = [mp3-url]
						nsfw = [true | false] (optional)
					/>
					*/
					if (typeAtt == "mp3")
					{
						#region mp3
						string mp3Url = attributes.ContainsKey("src") ? attributes["src"] : null;
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24;

						string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix);

						return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", mp3Url, "autoStart", "no") +
								@"<a href=""" + mp3Url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>";
						#endregion
					}
					else
					{
						return "[Invalid type attribute]";
					}
					#endregion
				}
				else if (tagName == "dsi:flash")
				{
					#region dsi:flash
					/*
					<dsi:flash 
						src = [swf-url]
						width = [width] 
						height = [height]
						nsfw = [true | false] (optional)
						play = [true | false] (optional)
						loop = [true | false] (optional)
						menu = [true | false] (optional)
						quality = [low | autolow | autohigh | medium | high | best] (optional)
						scale = [default | noorder | exactfit] (optional)
						align = [l | t | r | b] (optional)
						salign = [l | t | r | b | tl | tr | bl | br] (optional)
						wmode = [window | opaque | transparent] (optional)
						bgcolor = [colour] (optional)
						base = [base-url] (optional)
						flashvars = [flashvars] (optional)
						/>
					*/
					string swfUrl = attributes.ContainsKey("src") ? attributes["src"] : null;
					return getFlashAttributesFromSgml(uniqueId, swfUrl, attributes);
					#endregion
				}
				else if (tagName == "dsi:quote")
				{
					#region dsi:quote
					Usr u = null;
					try
					{
						u = new Usr(int.Parse(refAtt));
					}
					catch { }

					if (u != null)
					{
						StringBuilder sb = new StringBuilder();
						sb.Append("<div class=\"QuoteName\">");
						sb.Append(u.Link());
						sb.Append(" said:");
						sb.Append("</div>");
						sb.Append("<div class=\"QuoteBody\">");
						return sb.ToString();
					}
					else
					{
						return "<div class=\"QuoteBody\">";
					}
					#endregion
				}
				else if (tagName == "dsi:object" || tagName == "dsi:link")
				{
					#region dsi:object, dsi:link
					/*
					<dsi:object
						type = [usr | event | venue | place | group | brand | photo | misc]
						ref = [object-k]
						style = [
							content: {text* | icon | text-under-icon};   // for type=usr, event, venue, place, group, brand
							details: {none* | venue | place | country};  // for type=event, venue, place
							date: {false* | true};                       // for type=event
							snip: {number};                              // for type=event
							rollover: {true* | false}                    // for type=usr, photo
							photo: {icon* | thumb | web}                 // for type=photo
							link: {true* | false}
						]
					/>
					*/

					string app = attributes.ContainsKey("app") ? (attributes["app"] == "home" ? null : attributes["app"]) : null;
					string date = attributes.ContainsKey("date") ? attributes["date"].Replace('-', '/') : null;
					string jump = attributes.ContainsKey("jump") ? "#" + attributes["jump"] : "";
					string parStr = attributes.ContainsKey("par") ? attributes["par"] : null;
					#region Decode par array
					string[] par = null;
					if (parStr != null)
					{
						List<string> parList = new List<string>();
						foreach (string s in parStr.Split('&'))
						{
							if (s.Contains("="))
							{
								parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[0]));
								parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[1]));
							}
							else
							{
								parList.Add(System.Web.HttpUtility.UrlDecode(s));
								parList.Add("");
							}
						}
						par = parList.ToArray();
					}
					#endregion

					string styleContent = style.ContainsKey("content") ? style["content"] : "text";
					string styleDetails = style.ContainsKey("details") ? style["details"] : "none";
					bool styleDate = style.ContainsKey("date") ? bool.Parse(style["date"]) : false;
					int styleSnip = style.ContainsKey("snip") ? int.Parse(style["snip"]) : 0;
					bool styleRollover = style.ContainsKey("rollover") ? bool.Parse(style["rollover"]) : true;
					string stylePhoto = style.ContainsKey("photo") ? style["photo"] : "icon";
					bool styleLink = style.ContainsKey("link") ? bool.Parse(style["link"]) : true;

					string extraHtmlAttributes = "";
					string extraStyleAttribute = "";
					string extraStyleElements = "";
					string extraClassAttribute = "";
					string extraClassElements = "";
					foreach (string k in attributes.Keys)
					{
						if (k != "href" && k != "src" && k != "type" && k != "ref" && k != "style" && k != "app" && k != "date" && k != "par" && k != "class")
						{
							extraHtmlAttributes += " " + k + "=\"" + attributes[k] + "\"";
						}
					}

					foreach (string s in style.Keys)
					{
						if (s != "content" && s != "details" && s != "date" && s != "snip" && s != "rollover" && s != "photo" && s != "link")
						{
							extraStyleElements += s + ":" + style[s] + ";";
						}
					}
					if (extraStyleElements.Length > 0)
					{
						extraStyleAttribute = " style=\"" + extraStyleElements + "\"";
					}

					foreach (string s in classes)
					{
						extraClassElements += " " + s;
					}
					if (extraClassElements.Length > 0)
					{
						extraClassAttribute = " class=\"" + extraClassElements + "\"";
					}

					if (typeAtt == "usr")
					{
						#region Usr
						Usr u = new Usr(int.Parse(refAtt));
						string url = getObectPageUrl(u, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						string rolloverHtml = styleRollover ? ((styleContent == "icon" || styleContent == "text-under-icon") ? u.RolloverNoPic : u.Rollover) : "";

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(rolloverHtml);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(u.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");
							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}
						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Nickname
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(rolloverHtml);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append(getObjectName(u.NickNameDisplay, app, styleSnip));
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}
						return sb.ToString();
						#endregion
					}
					else if (typeAtt == "event")
					{
						#region Event
						Event e = new Event(int.Parse(refAtt));
						string url = getObectPageUrl(e, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDate || styleDetails == "venue" || styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(e.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");

							if (styleLink)
								sb.Append("</a>");

							if (styleContent == "text-under-icon")
								sb.Append("<br />");

							#endregion
						}
						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Event link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}

							sb.Append(getObjectName(e.Name, app, styleSnip));

							if (styleLink)
								sb.Append("</a>");
							#endregion

							#region Venue link
							if (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" @ ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(e.Venue.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Name, styleSnip));
								if (styleLink)
									sb.Append("</a>");
							}
							#endregion

							#region Place link
							if (styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" in ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(e.Venue.Place.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								if (styleDetails == "country")
								{
									sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.Name, styleSnip));
								}
								else
								{
									sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.NamePlain, styleSnip));
								}
								if (styleLink)
									sb.Append("</a>");

							}
							#endregion

							#region Date
							if (styleDate)
							{
								sb.Append(", ");
								sb.Append(e.FriendlyDate(false));
							}
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "venue")
					{
						#region Venue
						Venue v = new Venue(int.Parse(refAtt));
						string url = getObectPageUrl(v, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(v.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");

							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}

						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Venue link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}

							sb.Append(getObjectName(v.Name, app, styleSnip));

							if (styleLink)
								sb.Append("</a>");
							#endregion

							#region Place link
							if (styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" in ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(v.Place.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								if (styleDetails == "country")
								{
									sb.Append(Cambro.Misc.Utility.Snip(v.Place.Name, styleSnip));
								}
								else
								{
									sb.Append(Cambro.Misc.Utility.Snip(v.Place.NamePlain, styleSnip));
								}
								if (styleLink)
									sb.Append("</a>");
							}
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "place")
					{
						#region Place
						Place p = new Place(int.Parse(refAtt));
						string url = getObectPageUrl(p, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(p.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								if (style.ContainsKey("border"))
								{
									sb.Append(extraClassAttribute);
								}
								else
								{
									sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								}
								
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");
							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}

						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Place link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							if (styleDetails == "country")
							{
								sb.Append(getObjectName(p.Name, app, styleSnip));
							}
							else
							{
								sb.Append(getObjectName(p.NamePlain, app, styleSnip));
							}
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "group")
					{
						#region Group
						Group g = new Group(int.Parse(refAtt));
						string url = getObectPageUrl(g, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Group link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(g.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "brand")
					{
						#region Brand
						Brand b = new Brand(int.Parse(refAtt));
						string url = getObectPageUrl(b, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Brand link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(b.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "photo")
					{
						#region Photo
						Photo p = new Photo(int.Parse(refAtt));
						string url = getObectPageUrl(p, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (app != null && app == "chat")
						{
							#region For chat app, just show the name of the parent...
							sb.Append(Cambro.Misc.Utility.Snip(((IName)p.ParentObject).Name, styleSnip) + " (chat)");
							#endregion
						}
						else
						{
							#region Image tag
							sb.Append("<img");

							#region Src attribute
							sb.Append(" src=\"");
							if (stylePhoto == "thumb")
								sb.Append(p.ThumbPath);
							else if (stylePhoto == "icon")
								sb.Append(p.IconPath);
							else if (stylePhoto == "web")
								sb.Append(p.WebPath);
							sb.Append("\"");
							#endregion

							#region Width attribute
							if (styleLink || !attributes.ContainsKey("width"))
							{
								sb.Append(" width=\"");
								if (stylePhoto == "thumb")
									sb.Append(p.ThumbWidth);
								else if (stylePhoto == "icon")
									sb.Append("100");
								else if (stylePhoto == "web")
									sb.Append(p.WebWidth);
								sb.Append("\"");
							}
							#endregion

							#region Height attribute
							if (styleLink || !attributes.ContainsKey("height"))
							{
								sb.Append(" height=\"");
								if (stylePhoto == "thumb")
									sb.Append(p.ThumbHeight);
								else if (stylePhoto == "icon")
									sb.Append("100");
								else if (stylePhoto == "web")
									sb.Append(p.WebHeight);
								sb.Append("\"");
							}
							#endregion

							#region Extra html attributes
							if (!styleLink)
							{
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
							}
							#endregion

							#region Style attribute
							if (styleLink)
							{
								
								sb.Append(" class=\"BorderBlack All\"");
							}
							else if (style.ContainsKey("border"))
							{
								sb.Append(extraClassAttribute);
							}
							else
							{
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
							}
							#endregion

							#region Rollover
							if (styleRollover && stylePhoto != "web")
							{
								sb.Append(" onmouseover=\"stm('<img src=" + p.WebPath + " width=" + p.WebWidth + " height=" + p.WebHeight + " class=Block />');\" onmouseout=\"htm();\"");
							}
							#endregion

							sb.Append(" />");
							#endregion
						}

						#region End link
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "misc")
					{
						#region Misc
						Misc mi = new Misc(int.Parse(refAtt));

						if (tagName == "dsi:link")
							return "<a href=\"" + mi.Url() + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						if (mi.Extention.ToLower() == "jpg" || mi.Extention.ToLower() == "jpeg" || mi.Extention.ToLower() == "gif" || mi.Extention.ToLower() == "png")
						{
							StringBuilder sb = new StringBuilder();

							#region Width and height
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : mi.Width;
							int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : mi.Height;
							#endregion

							#region Image tag
							sb.Append("<img src=\"");
							sb.Append(mi.Url());
							sb.Append("\" width=\"");
							sb.Append(width);
							sb.Append("\" height=\"");
							sb.Append(height);
							sb.Append("\" border=\"0\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(" />");
							#endregion

							return sb.ToString();

						}
						else if (mi.Extention.ToLower() == "swf")
						{
							#region Swf
							return getFlashAttributesFromSgml(uniqueId, mi.Url(), attributes);
							#endregion
						}
						#endregion
					}
					else if (typeAtt == "article")
					{
						#region Article
						Article a = new Article(int.Parse(refAtt));
						string url = getObectPageUrl(a, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Article link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(a.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "url") //if (attributes.ContainsKey("href"))
					{
						#region Url
						string url = attributes.ContainsKey("href") ? attributes["href"] : "";
						#region Get name
						string name = url;
						string path = url;
						string domain = url;
						string targetAttribute = "";
						try
						{
							if (UrlRegex.IsMatch(url))
							{
								Match urlMatch = UrlRegex.Match(url);
								if (urlMatch.Groups[3].Value.StartsWith("www."))
									name = urlMatch.Groups[3].Value.Substring(4);
								else
									name = urlMatch.Groups[3].Value;

								domain = urlMatch.Groups[3].Value;
								path = urlMatch.Groups[4].Value;
								if (!domain.ToLower().EndsWith(".dontstayin.com") && !attributes.ContainsKey("target"))
									targetAttribute = " target=\"_blank\"";

							}
						}
						catch
						{ }
						#endregion

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + targetAttribute + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						if (path.ToLower().EndsWith(".jpg") || path.ToLower().EndsWith(".jpeg") || path.ToLower().EndsWith(".gif") || path.ToLower().EndsWith(".png"))
						{
							#region Image tag
							sb.Append("<img");

							#region Src attribute
							sb.Append(" src=\"");
							sb.Append(url);
							sb.Append("\"");
							#endregion

							sb.Append(extraHtmlAttributes);

							#region Style attribute
							if (domain.EndsWith(".dontstayin.com") && !style.ContainsKey("border"))
							{
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
							}
							else
							{
								sb.Append(extraClassAttribute);
							}
							#endregion

							sb.Append(extraStyleAttribute);

							sb.Append(" />");
							#endregion
						}
						else if (path.ToLower().EndsWith(".mp3") || path.ToLower().EndsWith(".wav"))
						{
							#region Audio
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290;
							int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24;
							string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix);
							return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", url, "autoStart", "no") +
								@"<a href=""" + url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>";
							#endregion
						}
						else if (path.ToLower().EndsWith(".swf"))
						{
							#region Swf
							return getFlashAttributesFromSgml(uniqueId, path, attributes);
							#endregion
						}
						else if (path.ToLower().EndsWith(".flv"))
						{
							#region Flv
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
							int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357;
							bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false;
							string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto";
							return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", url, "autoStart", "0");
							#endregion
						}
						else
						{
							#region Link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(targetAttribute);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							#endregion
							#region Name
							sb.Append(name);
							#endregion
							#region End link
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "room")
					{
						#region Chat room
						Guid guid = refAtt.UnPackGuid();
						Chat.RoomSpec room = Chat.RoomSpec.FromGuid(guid);

						if (room == null)
							return "[Room not found]";
						
						StringBuilder sb = new StringBuilder();
						
						if (tagName == "dsi:link")
							room.LinkHtmlAppendJustStartOfAnchorTag(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute);
						else
							room.LinkHtmlAppend(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute);

						return sb.ToString();

						#endregion
					}
					#endregion
				}
				return "[Invalid tag " + tagName + "]";
			}
			catch (Exception ex)
			{
				if (Vars.DevEnv)
					throw ex;

				return "[Error in " + tagName + " tag]";
			}
		}
Ejemplo n.º 8
0
		void UpdateAncestors(Article a)
		{
			this.ArticleK = a.K;
			if (a.ParentObjectType.Equals(Model.Entities.ObjectType.Event))
				UpdateAncestors(a.ParentEvent);
			else if (a.ParentObjectType.Equals(Model.Entities.ObjectType.Venue))
				UpdateAncestors(a.ParentVenue);
			else if (a.ParentObjectType.Equals(Model.Entities.ObjectType.Place))
				UpdateAncestors(a.ParentPlace);
			else if (a.ParentObjectType.Equals(Model.Entities.ObjectType.Country))
				UpdateAncestors(a.ParentCountry);
		}
Ejemplo n.º 9
0
		public UrlPartTypes ProcessFilterPart(ref int currentIndex, string[] urlParts)
		{
			if (HasYearFilter && urlParts[currentIndex].Equals("tickets"))
			{
				#region tickets calendar
				PageType = PageTypes.Pages;
				PageName = "CalendarTickets";
				CurrentApplication = "tickets";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (HasYearFilter && urlParts[currentIndex].Equals("free"))
			{
				#region Free Guestlist calendar
				PageType = PageTypes.Pages;
				PageName = "CalendarFreeGuestlist";
				CurrentApplication = "free";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("tags"))
			{
				#region tags
				PageType = PageTypes.Pages;
				PageName = "TagSearch";
				CurrentApplication = "tags";
				HasTagFilter = true;

				currentIndex++;
				if (urlParts.Length > currentIndex)
				{

					CurrentApplication = "tags/" + urlParts[currentIndex];

					foreach (string s in urlParts[currentIndex].Split('-'))
					{
						if (!s.Equals("all"))
							TagFilter.Add(Cambro.Web.Helpers.UrlTextDeSerialize(s));
					}

					currentIndex++;
				}
				return UrlPartTypes.Application;
				#endregion
			}
			else if ((HasBrandObjectFilter || HasVenueObjectFilter) && (urlParts[currentIndex].Equals("tickets") || urlParts[currentIndex].Equals("photos")))
			{
				#region Styled page
				currentIndex++;
				PageType = PageTypes.Styled;
				PageName = "Home";
				if (urlParts.Length > currentIndex &&
					YearRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //year and month
					int year = int.Parse(urlParts[currentIndex]);
					if (year > 1990 && year < 2030)
					{
						HasYearFilter = true;
						DateFilter = new DateTime(year, 1, 1);
						PageName = "Calendar";
						currentIndex++;
						if (urlParts.Length > currentIndex &&
							MonthRegex.IsMatch(urlParts[currentIndex]))
						{
							int month = MonthNumber(urlParts[currentIndex]);
							HasMonthFilter = true;
							DateFilter = new DateTime(year, month, 1);
							currentIndex++;
						}
						return UrlPartTypes.Application;
					}
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					MonthRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //month only - infer the year
					int requestedMonth = MonthNumber(urlParts[currentIndex]);
					HasYearFilter = true;
					HasMonthFilter = true;
					int requestedMonthIndex = (DateTime.Today.Year * 12) + requestedMonth;
					int currentMonthIndex = (DateTime.Today.Year * 12) + DateTime.Today.Month;
					DateTime d = new DateTime(DateTime.Today.Year, requestedMonth, 1);

					if (currentMonthIndex - requestedMonthIndex > 4)
					{
						d = new DateTime(DateTime.Today.Year + 1, requestedMonth, 1);
					}
					else if (currentMonthIndex - requestedMonthIndex < -7)
					{
						d = new DateTime(DateTime.Today.Year - 1, requestedMonth, 1);
					}

					DateFilter = d;
					PageName = "Calendar";
					currentIndex++;
					return UrlPartTypes.Application;
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					urlParts[currentIndex].ToLower().Equals("calendar"))
				{
					#region //todays month
					DateFilter = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
					PageName = "Calendar";
					currentIndex++;
					return UrlPartTypes.Application;
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					NumericRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //event id
					PageName = "EventDetail";
					return UrlPartTypes.Application;
					#endregion
				}
				return UrlPartTypes.ObjectFilter;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("parties"))
			{
				#region brand
				currentIndex++;
				Query brandQuery = new Query();
				brandQuery.NoLock = true;
				brandQuery.Columns = new ColumnSet(Brand.Columns.K);
				brandQuery.QueryCondition = new Q(Brand.Columns.UrlName, urlParts[currentIndex]);
				BrandSet bs = new BrandSet(brandQuery);
				if (bs.Count > 0)
				{
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Brand;
					ObjectFilterK = bs[0].K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/parties/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("groups"))
			{
				#region group
				currentIndex++;
				if (urlParts.Length > currentIndex)
				{
					string groupUrlName = urlParts[currentIndex];
					if (urlParts[currentIndex].Equals("parties"))
					{
						currentIndex++;
						groupUrlName = "parties/" + urlParts[currentIndex];
					}
					Query groupQuery = new Query();
					groupQuery.NoLock = true;
					groupQuery.Columns = new ColumnSet(Bobs.Group.Columns.K);
					groupQuery.QueryCondition = new Q(Bobs.Group.Columns.UrlName, groupUrlName);
					GroupSet gs = new GroupSet(groupQuery);
					if (gs.Count > 0)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Group;
						ObjectFilterK = gs[0].K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/groups/" + groupUrlName;
						currentIndex++;
						return UrlPartTypes.ObjectFilter;
					}
				}
				PageType = PageTypes.Pages;
				PageName = "GroupBrowser";
				CurrentApplication = "groups";
				return UrlPartTypes.Application;
				#endregion
			}
			else if (!HasObjectFilter && urlParts[currentIndex].Equals("promoters"))
			{
				#region promoter
				currentIndex++;
				Query promoterQuery = new Query();
				promoterQuery.NoLock = true;
				promoterQuery.Columns = new ColumnSet(Promoter.Columns.K);
				promoterQuery.QueryCondition = new Q(Promoter.Columns.UrlName, urlParts[currentIndex]);
				PromoterSet ps = new PromoterSet(promoterQuery);
				if (ps.Count > 0)
				{
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Promoter;
					ObjectFilterK = ps[0].K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/promoters/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (!HasObjectFilter && urlParts[currentIndex].Equals("members"))
			{
				#region members - usr
				currentIndex++;
				if (urlParts[currentIndex].Length > 0)
				{
					Usr usr = Usr.GetFromNickName(urlParts[currentIndex]);
					if (usr != null)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Usr;
						ObjectFilterK = usr.K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/members/" + urlParts[currentIndex];
						currentIndex++;
						return UrlPartTypes.ObjectFilter;
					}
					//Query usrQuery = new Query();
					//usrQuery.NoLock = true;
					//usrQuery.Columns = new ColumnSet(Usr.Columns.K);
					//usrQuery.QueryCondition = new Q(Usr.Columns.NickName, urlParts[currentIndex]);
					//UsrSet us = new UsrSet(usrQuery);
					//if (us.Count > 0)
					//{
					//    HasObjectFilter = true;
					//    ObjectFilterType = Model.Entities.ObjectType.Usr;
					//    ObjectFilterK = us[0].K;
					//    PageType = PageTypes.Application;
					//    PageName = "Home";
					//    CurrentFilter += "/members/" + urlParts[currentIndex];
					//    currentIndex++;
					//    return UrlPartTypes.ObjectFilter;
					//}
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("event-"))
			{
				#region event
				try
				{
					Event ev = new Event(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Event;
					ObjectFilterK = ev.K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("gallery-"))
			{
				#region gallery
				try
				{
					Gallery g = new Gallery(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Gallery;
					ObjectFilterK = g.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("photo-"))
			{
				#region photo
				try
				{
					Photo p = new Photo(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Photo;
					ObjectFilterK = p.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("article-"))
			{
				#region article
				try
				{
					Article a = new Article(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Article;
					ObjectFilterK = a.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (GetMusicTypeK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region music filter
				this.HasMusicFilter = true;
				this.MusicFilterK = GetMusicTypeK(urlParts[currentIndex].ToLower());
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.MusicFilter;
				#endregion
			}
			else if (GetThemeK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region theme filter
				this.HasThemeFilter = true;
				this.ThemeFilterK = GetThemeK(urlParts[currentIndex].ToLower());
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.ThemeFilter;
				#endregion
			}
			else if (GetCountryK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region Lookup country / place / venue
				HasObjectFilter = true;
				ObjectFilterType = Model.Entities.ObjectType.Country;
				ObjectFilterK = GetCountryK(urlParts[currentIndex].ToLower());
				PageType = PageTypes.Application;
				PageName = "Home";
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				int countryK = this.ObjectFilterK;

				if (urlParts.Length > currentIndex)
				{
					Country country = new Country(countryK);
					Q regionQ = new Q(true);
					if (country.UseRegion)
					{
						Query qRegion = new Query();
						qRegion.NoLock = true;
						qRegion.Columns = new ColumnSet(Region.Columns.K);
						qRegion.TopRecords = 1;
						qRegion.QueryCondition = new And(
							new Q(Region.Columns.CountryK, countryK),
							new Q(Region.Columns.Abbreviation, urlParts[currentIndex]));
						RegionSet rs = new RegionSet(qRegion);
						if (rs.Count > 0)
						{
							HasObjectFilter = true;
							ObjectFilterType = Model.Entities.ObjectType.Region;
							ObjectFilterK = rs[0].K;
							PageType = PageTypes.Application;
							PageName = "Home";
							int regionK = ObjectFilterK;
							regionQ = new Q(Place.Columns.RegionK, regionK);
							CurrentFilter += "/" + urlParts[currentIndex].ToLower();

							currentIndex++;

							if (!(urlParts.Length > currentIndex))
								return UrlPartTypes.ObjectFilter;
						}


					}
					#region Lookup place
					Query placeQuery = new Query();
					placeQuery.NoLock = true;
					placeQuery.Columns = new ColumnSet(Place.Columns.K);
					placeQuery.QueryCondition = new And(
						new Q(Place.Columns.Enabled, true),
						new Q(Place.Columns.CountryK, countryK),
						new Q(Place.Columns.UrlName, urlParts[currentIndex].ToLower()),
						regionQ
					);
					PlaceSet ps = new PlaceSet(placeQuery);
					if (ps.Count > 0)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Place;
						ObjectFilterK = ps[0].K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/" + urlParts[currentIndex].ToLower();
						currentIndex++;
						int placeK = this.ObjectFilterK;

						if (urlParts.Length > currentIndex)
						{
							#region Lookup venue
							Query venueQuery = new Query();
							venueQuery.NoLock = true;
							venueQuery.Columns = new ColumnSet(Venue.Columns.K);
							venueQuery.QueryCondition = new And(
								new Q(Venue.Columns.PlaceK, placeK),
								new Q(Venue.Columns.UrlName, urlParts[currentIndex].ToLower())
								);
							VenueSet vs = new VenueSet(venueQuery);
							if (vs.Count > 0)
							{
								HasObjectFilter = true;
								ObjectFilterType = Model.Entities.ObjectType.Venue;
								ObjectFilterK = vs[0].K;
								PageType = PageTypes.Application;
								PageName = "Home";
								CurrentFilter += "/" + urlParts[currentIndex].ToLower();
								currentIndex++;
								int venueK = this.ObjectFilterK;
							}
							#endregion
						}
					}
					#endregion
				}
				return UrlPartTypes.ObjectFilter;
				#endregion
			}
			else if (YearRegex.IsMatch(urlParts[currentIndex]))
			{
				#region year / month / day
				int year = int.Parse(urlParts[currentIndex]);
				if (year > 1990 && year < 2030)
				{
					HasYearFilter = true;
					DateFilter = new DateTime(year, 1, 1);
					PageType = PageTypes.Pages;
					PageName = "Calendar";
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					if (urlParts.Length > currentIndex && MonthRegex.IsMatch(urlParts[currentIndex]))
					{
						int month = MonthNumber(urlParts[currentIndex]);
						HasMonthFilter = true;
						DateFilter = new DateTime(year, month, 1);
						PageType = PageTypes.Pages;
						PageName = "Calendar";
						CurrentFilter += "/" + urlParts[currentIndex];
						currentIndex++;
						if (urlParts.Length > currentIndex && DayRegex.IsMatch(urlParts[currentIndex]))
						{
							int day = int.Parse(urlParts[currentIndex]);
							try
							{
								DateFilter = new DateTime(year, month, day);
								HasDayFilter = true;
								PageType = PageTypes.Pages;
								PageName = "Calendar";
								CurrentFilter += "/" + urlParts[currentIndex];
								currentIndex++;
							}
							catch
							{
								currentIndex++;
							}
						}
					}
					return UrlPartTypes.DateFilter;
				}
				else
					return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("chat") || urlParts[currentIndex].Equals("messages"))
			{
				#region chat application
				PageType = PageTypes.Pages;
				PageName = "Chat";
				CurrentApplication = "chat";
				currentIndex++;
				if (ObjectFilterType.Equals(Model.Entities.ObjectType.Usr))
				{
					PageType = PageTypes.PagesFolder;
					PageFolder = "Usrs";
					PageName = "MyComments";
					CurrentApplication = "chat";
				}
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("archive"))
			{
				#region archive application
				PageType = PageTypes.Pages;
				PageName = "Archive";
				CurrentApplication = "archive";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("hottickets"))
			{
				#region hot tickets application
				PageType = PageTypes.Pages;
				PageName = "HotTickets";
				CurrentApplication = "hottickets";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("home"))
			{
				#region home application
				CurrentApplication = "home";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (HasUsrObjectFilter && urlParts[currentIndex].Equals("photosof"))
			{
				#region photosof page
				currentIndex++;
				PageType = PageTypes.Application;
				PageName = "photosof";
				CurrentApplication = "photosof/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else
			{
				if (urlParts.Length > currentIndex)
				{
					if (!PageType.Equals(PageTypes.Styled))
						PageType = PageTypes.Application;
					PageName = urlParts[currentIndex].ToLower();
					CurrentApplication = urlParts[currentIndex].ToLower();
					currentIndex++;
					return UrlPartTypes.Application;
				}
				else
				{
					currentIndex++;
					return UrlPartTypes.Null;
				}
			}
		}
Ejemplo n.º 10
0
		public static void CreateArticlePublish(Usr u, Article a)
		{
			Query q = new Query();
			q.QueryCondition = new And(
				new Q(FacebookPost.Columns.DateTime, QueryOperator.GreaterThan, System.DateTime.Now.AddDays(-1)),
				new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid),
				new Q(FacebookPost.Columns.Type, TypeEnum.ArticlePublish));
			FacebookPostSet fps = new FacebookPostSet(q);
			if (fps.Count < 15)
			{
				Query q1 = new Query();
				q1.QueryCondition = new And(
					new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid),
					new Q(FacebookPost.Columns.DataInt, a.K),
					new Q(FacebookPost.Columns.Type, TypeEnum.ArticlePublish));
				FacebookPostSet fps1 = new FacebookPostSet(q1);
				if (fps1.Count == 0)
				{

					FacebookPost fp = new FacebookPost();
					fp.Hits = 0;
					fp.FacebookUid = u.Facebook.Uid;
					fp.DateTime = System.DateTime.Now;
					fp.Type = TypeEnum.ArticlePublish;
					fp.Content = "ArticleK=" + a.K.ToString();
					fp.DataInt = a.K;
					fp.UsrK = u.K;
					fp.Update();

					//send facebook message
					//http://developers.facebook.com/docs/reference/api/post
					Dictionary<string, object> par = new Dictionary<string, object>();
					if (a.HasPic)
					{
						par["picture"] = a.PicPath;
					}
					par["link"] = "http://" + Vars.DomainName + a.Url() + "?fbpk=" + fp.K.ToString();
					par["name"] = a.Title.TruncateWithDots(50);
					par["caption"] = "Don't Stay In";

					par["description"] = a.Summary.TruncateWithDots(990);
					u.Facebook.PutWallPost("", par);
				}
			}
		}