public string GetTweet() { // Displays the tweet that the user clicked on from the web list. string id = Request.QueryString["id"] ?? ""; if (id == "") { return("N/A"); } MarkRead(id, gUser(this).UserId); string sql = "Select * from Tweet left Join Users on Users.ID = Tweet.UserID where Tweet.id = @id"; SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@id", id); DataTable dt = gData.GetDataTable(command); if (dt.Rows.Count < 1) { MsgBox("Not Found", "We are unable to find this item.", this); return(""); } SavedObject s = RowToObject(dt.Rows[0]); string sUserPic = DataOps.GetAvatar(s.Props.Picture); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sHTMLBody = ReplaceURLs(s.Props.Body); string sBody = "<div style='min-height:300px'><span style=''>" + sHTMLBody + "</span></div>"; string div = "<table style='padding:10px;' width=73%><tr><td>User:<td>" + sUserPic + "</tr>" + "<tr><td>User Name:<td>" + sUserName + "</tr>" + "<tr><td>Added:<td>" + s.Props.Added.ToString() + "</td></tr>" + "<tr><td>Subject:<td>" + s.Props.Subject + "</td></tr>" + "<tr><td> </tr><tr><td width=8%>Body:<td style='border:1px solid lightgrey;min-height:300px' colspan=1 xbgcolor='grey' width=40%>" + sBody + "</td></tr></table>"; div += UICommon.GetComments(id, this); return(div); }
public string GetPrayer() { // Displays the prayer that the user clicked on from the web list. string id = Request.QueryString["id"] ?? ""; if (id == "") { return("N/A"); } string sql = "Select * from PrayerRequest Inner Join Users on Users.ID = PrayerRequest.UserID where prayerrequest.id = @id"; SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@id", id); DataTable dt = gData.GetDataTable(command); if (dt.Rows.Count < 1) { MsgBox("Not Found", "We are unable to find this prayer.", this); return(""); } SavedObject s = RowToObject(dt.Rows[0]); string sUserPic = DataOps.GetAvatar(s.Props.Picture); string sUserName = NotNull(s.Props.UserName); if (sUserName == "") { sUserName = "******"; } string sBody = " <textarea style='width: 70%;' id=txtbody rows=25 cols=65>" + s.Props.Body + "</textarea>"; string div = "<table style='padding:10px;' width=100%><tr><td>User:<td>" + sUserPic + "</tr>" + "<tr><td>User Name:<td><h2>" + sUserName + "</h2></tr>" + "<tr><td>Added:<td>" + s.Props.Added.ToString() + "</td></tr>" + "<tr><td>Subject:<td>" + s.Props.Subject + "</td></tr>" + "<tr><td>Body:<td colspan=2>" + sBody + "</td></tr></table>"; div += UICommon.GetComments(id, this); return(div); }
public string GetMedia() { string category = Request.QueryString["category"].ToNonNullString(); string mediaid = Request.QueryString["mediaid"].ToNonNullString(); double dWatching = GetDouble(Request.QueryString["watching"].ToNonNullString()); double dReward = GetDouble(Request.QueryString["reward"].ToNonNullString()); double dLimited = GetDouble(Request.QueryString["limit"].ToNonNullString()); if (dWatching == 1) { return(""); } string sql = "Select * from Rapture where category=@cat order by added desc"; if (mediaid != "") { sql = "Update Rapture set ViewCount=isnull(viewcount,0)+1 where id='" + BMS.PurifySQL(mediaid, 100) + "'"; gData.Exec(sql); sql = "Select * from Rapture Where ID='" + Saved.Code.BMS.PurifySQL(mediaid, 64) + "'"; } string html = ""; if (dReward == 1) { sql = "Select top 1 * from Rapture where id=@id order by added desc"; SqlCommand c = new SqlCommand(sql); c.Parameters.AddWithValue("@id", mediaid); string sVideoID = gData.GetScalarString(c, "id"); string sCategory = gData.GetScalarString(c, "category"); string sURL = gData.GetScalarString(c, "url"); if (sVideoID.Length > 1) { string sSuffix = "?token=" + SignVideoURL(); string sFullURL = sURL + sSuffix; double nReward = GetDouble(GetBMSConfigurationKeyValue("VideoRewardAmount")); double dSize = Saved.Code.BMS.GetWebResourceSize(sFullURL); string sql1 = "Insert into Tip (id,userid,amount,added,videoid,starttime,size,category,watchcount) values (newid(),'" + gUser(this).UserId.ToString() + "','" + nReward.ToString() + "',getdate(),'" + sVideoID + "',getdate(),'" + dSize.ToString() + "','" + sCategory + "',0)"; gData.Exec(sql1); html += "<br>Congratulations! You will be rewarded up to " + nReward.ToString() + " for watching this video. Please do not click away until you gain something from the video, otherwise you will not receive the full reward. <br><br> "; } } SqlCommand command = new SqlCommand(sql); command.Parameters.AddWithValue("@cat", category); command.Parameters.AddWithValue("@id", mediaid); DataTable dt = gData.GetDataTable(command); bool fAdmin = gUser(this).Admin; bool fRelink = dt.Rows.Count > 1; string sTable = "<table cellpadding=25px cellspacing=25px>"; html += sTable; double nLimit = 0; for (int y = 0; y < dt.Rows.Count; y++) { nLimit++; if (dLimited > 0 && nLimit > dLimited) { break; } string sNotes = GetNotesHTML(dt.Rows[y]["Notes"].ToString()); if (sNotes.Length > 256) { sNotes = sNotes.Substring(0, 256); } string sEditURL = "<a href=Markup.aspx?type=Rapture&id=" + dt.Rows[y]["id"].ToString() + ">Edit</a>"; string sAnchor = "<div><a href=Media.aspx?mediaid=" + dt.Rows[y]["id"].ToString() + ">"; string sUserID = dt.Rows[y]["userid"].ToString(); string sUserName = GetUserName(sUserID); double nViewCount = GetDouble(dt.Rows[y]["ViewCount"].ToNonNullString()); string sWidth = dt.Rows.Count == 1 ? "100%" : "40%"; string sDiv = "<tr><td width='" + sWidth + "'>"; if (fRelink) { sDiv += sAnchor; } string sAutoPlay = !fRelink ? "autostart autoplay controls playsinline" : "preload='metadata'"; string sDims = dt.Rows.Count == 1 ? "width='1000' height='768'" : "width='400' height='240'"; sDiv += "<video id='video1' class='connect-bg' " + sDims + " " + sAutoPlay + " style='background-color:black'>"; string sLoc = !fRelink ? "" : "#t=7"; string sBaseURL = dt.Rows[y]["URL"].ToString(); string sSuffix = "?token=" + SignVideoURL(); string sFullURL = sBaseURL + sSuffix + sLoc; string sSpeed1 = "<a id='aSlow' href='#' onclick='slowPlaySpeed();'>.5x</a>"; string sSpeed2 = "<a id='aNormal' href='#' onclick='normalPlaySpeed();'>1x</a>"; string sSpeed3 = "<a id='aFast' href='#' onclick='fastPlaySpeed();'>1.75x</a>"; // Add the token sDiv += "<source src='" + sFullURL + "' type='video/mp4'></video>"; if (fRelink) { sDiv += "</a></div>"; } string sFooter = sSpeed1 + " • " + sSpeed2 + " • " + sSpeed3 + " • " + nViewCount.ToString() + " view(s) • " + dt.Rows[y]["Added"].ToString(); if (sUserName != "") { sFooter += " • Uploaded by " + sUserName; } if (dt.Rows.Count == 1) { sDiv += "</td></tr><tr>"; } sDiv += "<td style='padding:10px;font-size:14px;' width=70%>" + sNotes + "<br><small>" + sFooter + "</small><br><br></td>"; if (fAdmin) { sDiv += "<td>" + sEditURL + "</td>"; } sDiv += "</tr>"; html += sDiv; } html += "</table>"; if (mediaid != "") { html += UICommon.GetComments(mediaid, this); } return(html); }