private string getSpottedDisplayHtml(Usr usr) { if (usr.NickName != "") { return usr.Link(); } if (Usr.Current != null) { try { Buddy b = new Buddy(Usr.Current.K, usr.K); return "<span onmouseover=\"stt('" + usr.Email + "');\" onmouseout=\"htm();\">" + (b.SkeletonName != "" ? b.SkeletonName : usr.Email.TruncateWithDots(10) )+ "</span>"; } catch (BobNotFound) { } } return null; }
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]"; } }
static void loginAndSetAuthCookie(Usr u, Hashtable returnValue, string facebookAccessToken) { //normal login stuff u.LoginCount++; u.DateTimeLastAccess = DateTime.Now; if (facebookAccessToken.Length > 0) u.FacebookAccessToken = facebookAccessToken; u.Update(); u.LogInAsThisUserDontSetCookieNew(); Hashtable authUsr = new Hashtable(); authUsr["NickName"] = u.NickName; if (u.NickName.Length > 0) authUsr["Link"] = u.Link(); authUsr["Email"] = u.Email; authUsr["HasNullPassword"] = u.HasNullPassword; returnValue["AuthUsr"] = authUsr; returnValue["AuthCookie"] = getAuthCookie(u.GetAuthCookie(), u.K); }
public static Hashtable GetUserByFacebookUID(int autoLoginUsrK, string autoLoginUsrLoginString) { var facebook = new FacebookGraphAPI(Facebook.Apps.Dsi); Hashtable ret = new Hashtable(); ret["FacebookUIDMatch"] = false; ret["FacebookAutoLoginUsrMatch"] = false; ret["FacebookEmailMatch"] = false; ret["FacebookEmailMatchToCurrentUser"] = false; #region add data about the AutoLoginUsr (so we can display this if we don't end up logged in as it) if (autoLoginUsrK > 0) { Usr u = null; try { u = new Usr(autoLoginUsrK); } catch { } if (u != null) { Hashtable autoLoginUsrHash = new Hashtable(); autoLoginUsrHash["NickName"] = u.NickName; if (u.LoginString.ToLower() == autoLoginUsrLoginString.ToLower()) { autoLoginUsrHash["LoginStringMatch"] = true; autoLoginUsrHash["Email"] = u.Email; } else autoLoginUsrHash["LoginStringMatch"] = false; if (u.NickName.Length > 0) autoLoginUsrHash["Link"] = u.Link(); autoLoginUsrHash["HasNullPassword"] = u.HasNullPassword; ret["AutoLoginUsr"] = autoLoginUsrHash; } } #endregion #region try to find usr linked by UID Query qUID = new Query(); qUID.QueryCondition = new Q(Usr.Columns.FacebookUID, facebook.Uid); UsrSet usUID = new UsrSet(qUID); if (usUID.Count > 0) { Usr u = usUID[0]; if (!u.IsEmailVerified && autoLoginUsrK > 0 && autoLoginUsrK == u.K && u.LoginString.ToLower() == autoLoginUsrLoginString.ToLower()) { u.IsEmailVerified = true; u.Update(); } ret["FacebookUIDMatch"] = true; loginAndSetAuthCookie(u, ret, facebook.AccessToken); return ret; } #endregion #region if we have a forced usr (auto login link), we should link it immediatly if (autoLoginUsrK > 0) { Usr u = null; try { u = new Usr(autoLoginUsrK); } catch { } if (u != null && u.LoginString.ToLower() == autoLoginUsrLoginString.ToLower() && !u.EnhancedSecurity) { if (!u.IsEmailVerified) { u.IsEmailVerified = true; u.Update(); } ret["FacebookAutoLoginUsrMatch"] = true; return ret; } } #endregion #region if we have a user that matches the email from facebook, we should suggest it, but not log in var user = facebook.GetObject("me", null); string email = user.Value<string>("email"); if (email.Length > 0) { Query qEmail = new Query(); qEmail.QueryCondition = new Q(Usr.Columns.Email, email); UsrSet usEmail = new UsrSet(qEmail); if (usEmail.Count > 0) { ret["FacebookEmailMatch"] = true; ret["FacebookEmailMatchToCurrentUser"] = !usEmail[0].IsSkeleton && usEmail[0].DateTimeLastAccess.AddMonths(2) > DateTime.Now; if (usEmail[0].EnhancedSecurity) ret["EnhancedSecurity"] = true; Hashtable emailMatchUsr = new Hashtable(); emailMatchUsr["NickName"] = usEmail[0].NickName; emailMatchUsr["Email"] = usEmail[0].Email; if (usEmail[0].NickName.Length > 0) emailMatchUsr["Link"] = usEmail[0].Link(); emailMatchUsr["HasNullPassword"] = usEmail[0].HasNullPassword; ret["EmailMatchUsr"] = emailMatchUsr; return ret; } } #endregion return ret; }
public Return Invite(Usr TargetUsr, GroupUsr TargetGroupUsr, Usr PerformingUsr, GroupUsr PerformingGroupUsr, string InviteMessage, bool InviteByEmail) { Return r = new Return(); string targetUsr = ""; if (InviteByEmail && TargetUsr.NickName.Length==0) targetUsr = TargetUsr.Email; else targetUsr = TargetUsr.Link(); if (this.Restriction.Equals(Group.RestrictionEnum.Custom)) { r.Success=false; r.MessageHtml="The "+this.FriendlyName+" group is a special group - the membership "+ "is automatically controlled. You can't invite people to this group."; return r; } if (!PerformingUsr.IsAdmin && (PerformingGroupUsr==null || !PerformingGroupUsr.IsMember)) { r.Success=false; r.MessageHtml="You're not a member of the "+this.FriendlyName+" group!"; return r; } if (TargetGroupUsr==null) { if (this.Restriction.Equals(Group.RestrictionEnum.Moderator)) { //nothing now //if the current user is a moderator, we add an invite request. //If the current user isn't a mod, we add a recommend. if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success=true; r.MessageHtml="You have invited "+targetUsr+" to the "+ this.FriendlyName+" group. They will be sent a message shortly."; } else { RecommendPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success=true; r.MessageHtml="Since "+this.FriendlyName+" is a restricted group, only "+ "moderators may send invites. "+targetUsr+" has been recommended "+ "as a possible member. A moderator will decide whether to send the invite."; } } else { InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success=true; r.MessageHtml="You have invited "+targetUsr+" to the "+this.FriendlyName+" group. "+ "They will be sent a message shortly."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member)) { // This person is a member of the group r.Success=false; r.MessageHtml=targetUsr+" is already a member of the "+this.FriendlyName+" group."; } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Request)) { // This person has requested membership // if the current user is a moderator, we must enable the request. // If the current user isn't a mod, we must show an error. if (this.Restriction.Equals(Group.RestrictionEnum.Moderator)) { if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { JoinPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr); r.Success=true; r.MessageHtml=targetUsr+" had already requested to join the "+ this.FriendlyName+" group, so we've instantly made them a member."; } else { r.Success=false; r.MessageHtml=targetUsr+" has already requested to be a member "+ "of this group. The group moderators will deal with the request and either accept or "+ "deny the request."; } } else { JoinPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr); r.Success=true; r.MessageHtml=targetUsr+" had already requested to join the "+ this.FriendlyName+" group, so we've instantly made them a member."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.RequestRejected)) { // A previous membership request was denied // if the current user is a moderator, we must enable them straight away. // If the current user isn't a mod, we must show an error. if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { JoinPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr); r.Success=true; r.MessageHtml=targetUsr+" had already requested to join the "+ this.FriendlyName+", so we've instantly made them a member."; } else { r.Success=false; r.MessageHtml=targetUsr+" has already requested to be a member, "+ "but their request was denied. You can't invite this person to this group. Contact "+ "a group moderator if you think this person should be a member."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Invite)) { // The person has been officially invited to the group - if they accept they will become a // member instantly r.Success=false; r.MessageHtml=targetUsr+" has already been invited to the "+ this.FriendlyName+" group. You can't send another invite."; } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Exited)) { // The person exited the group themselves r.Success=false; r.MessageHtml=targetUsr+" was previously a member of the "+ this.FriendlyName+" group, but they exited it. You can't invite them back."; } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Barred)) { // The person has been barred by a moderator if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { r.Success = false; r.MessageHtml = targetUsr+" has been barred from the "+ this.FriendlyName+" group. You must first un-bar them on the "+ "<a href=\""+this.UrlApp("admin","mode","membership")+"\">group options page</a>."; } else { r.Success = false; r.MessageHtml = targetUsr+" has been barred from the "+ this.FriendlyName+" group by a moderator. You can't send an invite."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Recommend)) { // A member has recommended this person as a group member. The membership admins will either // change the status to Invited, or change it to RecommendRejected. This status level is // only used in groups with restricted membership if (this.Restriction.Equals(Group.RestrictionEnum.Moderator)) { if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success = true; r.MessageHtml = "You have invited "+targetUsr+" to the "+ this.FriendlyName+" group. They will be sent a message shortly."; } else { r.Success = false; r.MessageHtml = "Since "+this.FriendlyName+" is a restricted group, only "+ "moderators may send invites. "+targetUsr+" has been recommended as a "+ "possible member. A moderator will decide whether to send the invite."; } } else { InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success = true; r.MessageHtml = "You have invited "+targetUsr+" to the "+ this.FriendlyName+" group. They will be sent a message shortly."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.RecommendRejected)) { // A member has recommended this person as a member of the group, but they were rejected by a // membership moderator. This status level is only used in groups with restricted membership if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr)) { InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage); r.Success = true; r.MessageHtml = "You have invited "+targetUsr+" to the "+ this.FriendlyName+" group. They will be sent a message shortly."; } else { r.Success = false; r.MessageHtml = targetUsr+" has previously been rejected by a "+ "moderator, so you can't send an invite. Contact a group moderator if you think "+ "this person should be a member."; } } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.InviteRejected)) { // This person was invited to the group, but decided they didn't want to be a member r.Success = false; r.MessageHtml = targetUsr+" has already been invited to the "+ this.FriendlyName+" group, but they rejected the invitation. You can't send another invite."; } return r; }