Add files via upload

This commit is contained in:
Justin 2022-07-21 07:17:24 -04:00 committed by GitHub
commit 1d53f10b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 4421 additions and 0 deletions

View file

@ -0,0 +1,98 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
?>
<script>
// THE FOLLOWING SCRIPT WAS
// MADE BY MARIOERMANDO
// GIVEN BY ANGEL
// PERFECTED BY JUSTIN
var likeBtns = document.querySelectorAll("td[id^=post_id_]");
[].forEach.call(likeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("likecnt_" + likes);
xhr.open("GET", "like.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "count.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
alert("error");
count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var dlikeBtns = document.querySelectorAll("td[id^=dpost_id_]");
[].forEach.call(dlikeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("dlikecnt_" + likes);
xhr.open("GET", "dislike.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "dcount.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
alert("error");
count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var Del = document.querySelectorAll("i[id^=pdel_]");
[].forEach.call(Del, function(dt){
dt.onclick = function(e){
if (confirm("Delete?")) {
var dto = new XMLHttpRequest();
dto.open("GET", "delete.php?id=" + dt.id.match(/([0-9]*)$/)[0], true);
dto.onreadystatechange = function(){
if (dto.readyState == 4)
if(dto.status == 200) {
upPosts();
refreshP();
}
else {
alert("error");
}
};
dto.send();
return false;
}
};
});
</script>

View file

@ -0,0 +1,474 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
# # # # # # #
# WEBSITE LOCATION #
# # # # # # #
if($u_siteloc != '/feed') {
$loc_desc = "browsin\' feed";
mysqli_query($conx, "UPDATE accounts SET site_locdesc='$loc_desc' WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET site_locurl='/feed' WHERE uid='$u_uid'");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
</style>
</head>
<body onload="resetPosts();">
<center>
<?php
$back_button = true;
$linebreak = true;
$alerts = true;
require_once("../inc/header.php");
?>
<div id="postIt" style="display: none;">
<form id="feed_form" method="post" action="ppost.php">
<table class="postbox_tb">
<tr>
<td>
<textarea id="fpostb" name="post" rows="4" class="feed_parea" placeholder="type something..."></textarea>
</td>
</tr>
</table>
<table class="postbox_tb" id="postbox_tb2">
<td class="postbox2_td" onclick="more('fd_more')">
<i id="feed_more" class="fa fa-plus" aria-hidden="true"></i>
</td>
<td class="postbox2_td2">
<input type="submit" value="post" class="postbox_sub">
</td>
<td class="postbox2_td">
<span id="loader"><i onclick="selectFile();" id="fPath" class="fa fa-paperclip fa-lg" aria-hidden="true"></i></span>
</td>
</tr>
</table>
</form>
<table id="fd_more" style="display: visible;">
<tr>
<td style="width: 33.333%;">
<form id="imgUpl" action="img_upload.php" enctype="multipart/form-data" method="post">
<input id="fBrowse" name="img" type="file" style="display: visible;">
<input id="newBrowse" name="newimg" type="text" style="display: visible;">
<input id="newBrowse2" name="newimg2" type="text" style="display: visible;">
</form>
<form id="vidUpl" action="vid_upload.php" enctype="multipart/form-data" method="post">
<input id="vBrowse" name="vid" type="file" style="display: none;">
</form>
<i class="fa fa-refresh" aria-hidden="true" onclick="upPosts();refreshP();" id="post_refresh"></i>
</td>
<td class="postbox2_td" style="width: 33.333%;">
<span id="vloader"><i onclick="var log_conf=confirm('Upload a video? \n MP4 Files Only');if(log_conf == true){selectVid();};" id="vPath" class="fa fa-film" aria-hidden="true"></i></span>
</td>
<td style="width: 33.333%;">
<i class="fa fa-bar-chart" aria-hidden="true" onclick="alert('Feed polls coming soon.')"></i>
</td>
</tr>
</table>
<br>
</div>
<div id="wPst">
<table onclick="writePost();fpostb.focus();" class="writePost" style="display: visible;">
<tr>
<td class="wpost_td">
<i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"></i> &nbsp; tap to post
</td>
</tr>
</table>
<br>
</div>
<input id="amount" type="hidden" value="10">
<?php
echo "<div id=\"ld_posts\">";
require_once("posts.php");
echo "</div>";
$cntq = mysqli_query($conx, "SELECT * FROM feed");
$count = mysqli_num_rows($cntq);
if($count > 10) {
echo "<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>";
}
require_once("../inc/footer.php");
?>
</center>
<script>
function updInfosies(i) {
$.get("dis_like_infosies.php?i=" + i, function(d) {
$("#infosies_" + i).html(d);
});
}
function resetPosts() {
document.getElementById("amount").value = "10";
}
function getAjax() {
$.get("ajextra.php", function(d) {
$("#scriptie").html(d);
});
}
setInterval('getAjax()', 1000);
function upPosts() {
$.get("posts.php", function(d) {
$("#ld_posts").html(d);
});
getAjax();
}
function refreshP() {
document.getElementById("amount").value = Number(10);
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
}
function more(id) {
var e = document.getElementById(id);
if(e.style.display == '') {
e.style.display = 'none';
document.getElementById('feed_more').className = "fa fa-plus";
}
else {
e.style.display = '';
document.getElementById('feed_more').className = "fa fa-times";
}
}
function writePost() {
expand('wPst');
expand('postIt');
}
function selectFile() {
document.getElementById('fBrowse').click();
document.getElementById('fPath').value = document.getElementById('fBrowse').value;
}
function load(){
var fr = new FileReader();
fr.onload = process;
fr.readAsArrayBuffer(this.files[0]);
}
function process(){
var dv = new DataView(this.result);
var offset = 0, recess = 0;
var pieces = [];
var i = 0;
if (dv.getUint16(offset) == 0xffd8){
offset += 2;
var app1 = dv.getUint16(offset);
offset += 2;
while (offset < dv.byteLength){
if (app1 == 0xffe1){
pieces[i] = {recess:recess,offset:offset-2};
recess = offset + dv.getUint16(offset);
i++;
}
else if (app1 == 0xffda){
break;
}
offset += dv.getUint16(offset);
var app1 = dv.getUint16(offset);
offset += 2;
}
if (pieces.length > 0){
var newPieces = [];
pieces.forEach(function(v){
newPieces.push(this.result.slice(v.recess, v.offset));
}, this);
newPieces.push(this.result.slice(recess));
var br = new Blob(newPieces, {type: 'image/jpeg'});
var reader = new FileReader();
reader.readAsDataURL(br);
reader.onloadend = function() {
var base64data = reader.result;
}
//window.open(URL.createObjectURL(br), "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");
var upload_normal = false;
document.getElementById("newBrowse").value = "base64 here";
if(confirm('Upload this BASE64 image?')) {
}
}
}
}
var newBrsw = document.querySelector('#fBrowse');
newBrsw.addEventListener('change', load);
var form = document.forms.namedItem("imgUpl");
form.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(form);
var oReq = new XMLHttpRequest();
if(confirm('Upload this image?')) {
document.getElementById('loader').innerHTML = "<img src='https://i.imgur.com/pvQ0NaJ.gif' height='12' width='12' alt='' style='border:0;'>";
//oReq.open("POST", "img_upload.php", true);
}
else {
form.reset();
}
oReq.onload = function(oEvent) {
if(oReq.status == 200) {
var img_url = oReq.responseText;
if(img_url != '') {
document.getElementById('loader').innerHTML = "<i onclick='selectFile();' id='fPath' class='fa fa-paperclip fa-lg' aria-hidden='true'></i>";
var atoinp = "[img]" + img_url + "[/img]";
document.getElementById("fpostb").value = document.getElementById("fpostb").value + atoinp;
document.getElementById("fpostb").focus();
}
else {
document.getElementById('loader').innerHTML = "<i onclick='selectFile();' id='fPath' class='fa fa-exclamation' aria-hidden='true'></i>";
}
upPosts();
form.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
function selectVid() {
document.getElementById('vBrowse').click();
document.getElementById('vPath').value = document.getElementById('vBrowse').value;
}
var vform = document.forms.namedItem("vidUpl");
vform.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(vform);
var oReq = new XMLHttpRequest();
if(confirm('Upload this video?')) {
document.getElementById('vloader').innerHTML = "<img src='https://i.imgur.com/pvQ0NaJ.gif' height='12' width='12' alt='' style='border:0;'>";
oReq.open("POST", "vid_upload.php", true);
}
else {
vform.reset();
}
oReq.onload = function(oEvent) {
if(oReq.status == 200) {
var vid_url = oReq.responseText;
if(vid_url != '') {
document.getElementById('vloader').innerHTML = "<i onclick='selectVid();' id='vPath' class='fa fa-film' aria-hidden='true'></i>";
var atoinp = "[video]" + vid_url + "[/video]";
document.getElementById("fpostb").value = document.getElementById("fpostb").value + atoinp;
document.getElementById("fpostb").focus();
}
else {
document.getElementById('vloader').innerHTML = "<i onclick='selectVid();' id='vPath' class='fa fa-exclamation' aria-hidden='true'></i>";
}
upPosts();
vform.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
$("#feed_form").submit(function(e){
e.preventDefault();
if($("textarea[name=post]").val().trim() == "")
return;
$.post("ppost.php", {body: $("textarea[name=post]").val(), submit: "send"}, function(data) {
if(data != '') {
upPosts();
writePost();
refreshP();
}
else {
upPosts();
writePost();
refreshP();
}
});
refreshP();
upPosts();
$("textarea[name=post]").val("");
upPosts();
writePost();
refreshP();
});
</script>
<div id="scriptie">
<script>
// THE FOLLOWING SCRIPT WAS
// MADE BY MARIOERMANDO
// GIVEN BY ANGEL
// PERFECTED BY JUSTIN
var likeBtns = document.querySelectorAll("td[id^=post_id_]");
[].forEach.call(likeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("likecnt_" + likes);
xhr.open("GET", "like.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "count.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
//alert("error");
//count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var dlikeBtns = document.querySelectorAll("td[id^=dpost_id_]");
[].forEach.call(dlikeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("dlikecnt_" + likes);
xhr.open("GET", "dislike.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "dcount.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
//alert("error");
//count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var Del = document.querySelectorAll("i[id^=pdel_]");
[].forEach.call(Del, function(dt){
dt.onclick = function(e){
if (confirm("Delete?")) {
var dto = new XMLHttpRequest();
dto.open("GET", "delete.php?id=" + dt.id.match(/([0-9]*)$/)[0], true);
dto.onreadystatechange = function(){
if (dto.readyState == 4)
if(dto.status == 200) {
upPosts();
UpMPcmts();
refreshP();
}
else {
upPosts();
UpMPcmts();
refreshP();
}
};
dto.send();
upPosts();
UpMPcmts();
refreshP();
return false;
}
};
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,84 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$feed_id = safe($_GET['i']);
?>
<script>
var likeBtns = document.querySelectorAll("td[id^=cmt_id_]");
[].forEach.call(likeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
xhr.open("GET", "likecmt.php?id=" + likes + "&_t=" + Math.random() + "&token=<?php echo "$u_token&&i=$feed_id"; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
else{
alert("error");
btn.innerHTML = "<i class='fa fa-thumbs-up'></i> error";
}
};
xhr.send();
btn.innerHTML = "<i class='fa fa-thumbs-up'></i> ...";
return false;
};
});
var dlikeBtns = document.querySelectorAll("td[id^=dpost_id_]");
[].forEach.call(dlikeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("dlikecnt_" + likes);
xhr.open("GET", "dislike.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "dcount.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
}
else{
alert("error");
count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var cDel = document.querySelectorAll("i[id^=cdel_]");
[].forEach.call(cDel, function(dtt){
dtt.onclick = function(e){
if (confirm("Delete?")) {
var dto = new XMLHttpRequest();
dtto.open("GET", "delcmnt.php?id=" + dtt.id.match(/([0-9]*)$/)[0], true);
dtto.onreadystatechange = function(){
if (dtto.readyState == 4)
if(dtto.status == 200) {
upComments();
UpMPcmts();
refreshP();
}
else {
alert("error");
}
};
dtto.send();
return false;
}
};
});
</script>

View file

@ -0,0 +1,6 @@
<?php
require_once("../inc/conx.php");
$getrstr = safe($_GET['i']);
$cntq = mysqli_query($conx, "SELECT id FROM feed_comments WHERE post_rstr='$getrstr'");
echo mysqli_num_rows($cntq);
?>

View file

@ -0,0 +1,52 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$id = safe($_POST['body']);
$edit = safe($_POST['edit']);
$getrstr = safe($_GET['i']);
$getidq = mysqli_query($conx, "SELECT id,uid,allow_comments FROM feed WHERE random_str='$getrstr'");
$getidr = mysqli_fetch_assoc($getidq);
$getid = $getidr['id'];
$poster = $getidr['uid'];
$commenting = $getidr['allow_comments'];
$geteidq = mysqli_query($conx, "SELECT post_rstr FROM feed_comments WHERE random_str='$getrstr'");
$geteidr = mysqli_fetch_assoc($geteidq);
$geteid = $geteidr['post_rstr'];
$edited = "";
if($edit) {
$id = $edit;
if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feed_comments WHERE random_str='$getrstr' && uid='$u_uid'")) == '1') {
mysqli_query($conx, "UPDATE feed_comments SET post='$id' WHERE random_str='$getrstr' && uid='$u_uid'");
mysqli_query($conx, "UPDATE feed_comments SET edited='yes' WHERE random_str='$getrstr' && uid='$u_uid'");
mysqli_query($conx, "UPDATE feed_comments SET tstamp='$tstamp' WHERE random_str='$getrstr' && uid='$u_uid'");
}
header("location: post.php?i=$geteid");
exit();
}
else {
if($commenting == 'no') {
exit();
die();
}
function genRand($length = 15) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
$rstr = genRand();
function genRand2($length = 10) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
$rstrTWO = genRand2();
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'+.03 WHERE uid='$u_uid'");
mysqli_query($conx, "INSERT INTO feed_comments (post_rstr, uid, tstamp, post, random_str, post_id) VALUES ('$getrstr','$u_uid','$tstamp','$id','$rstr','$getid')");
if($poster != $u_uid) {
if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM user_apps WHERE uid='$poster' && app_uqid='feed' && snooze='no'")) != '0') {
mysqli_query($conx, "INSERT INTO notifs (rstring, uid, snoozeable, app_uqid, message, view_link, tstamp) VALUES ('$rstrTWO','$poster','yes','feed','<span style=\"font-weight: bold;\">$u_username</span> commented on your post.','/feed/post.php?i=$getrstr','$tstamp')");
}
}
header("location: /feed");
exit();
}
?>

View file

@ -0,0 +1,112 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$post_id = safe($_GET['i']);
$cmt_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,edited,img FROM feed_comments WHERE post_rstr='$post_id' ORDER BY id DESC LIMIT 10");
while($cmt_r = mysqli_fetch_assoc($cmt_q)) {
$cmt_id = $cmt_r['id'];
$cmt_uid = $cmt_r['uid'];
$string = $cmt_r['post'];
$cmt_tstamp = $cmt_r['tstamp'];
$cmt_randomstr = $cmt_r['random_str'];
$cmt_edited = $cmt_r['edited'];
$cmt_img = $cmt_r['img'];
include("../inc/replace.php");
$usr_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$cmt_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$cmt_username = $usr_r['username'];
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$cmt_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
$username_color = $usri_r['username_color'];
$cmt_tcolor = $usri_r['text_color'];
}
}
$likcnt_q = mysqli_query($conx, "SELECT id FROM feedcmt_likes WHERE cmt_id='$cmt_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r == '1') {
$ls = "";
}
else {
$ls = "s";
}
echo "<div class=\"cmt_post\" id=\"fp_1\" style=\"max-width: 430px; width: 80%; background-color: $username_color;\">
<table class=\"post_table1\">
<tr>
<td class=\"ptb1_td1\" style=\"color: $cmt_tcolor;\"><a href=\"/canvas/$cmt_username\" style=\"text-decoration: none; color: $cmt_tcolor; font-weight: bold;\">$cmt_username</a></td>
<td class=\"ptb1_td2\" style=\"color: $cmt_tcolor;\"><i class=\"fa fa-angle-down\" aria-hidden=\"true\" onclick=\"expand('$cmt_randomstr')\"></i></td>
</tr>
</table>
</div>
<div id=\"$cmt_randomstr\" class=\"post_more\" style=\"max-width: 430px; width: 80%; display: none;\">";
if($cmt_edited == 'yes') {
echo "edited ";
}
else {
echo "posted ";
}
echo timeago($cmt_tstamp); echo" ago";
if($cmt_uid == $u_uid) {
if($cmt_img != 'yes') {
echo "&nbsp; <i onclick=\"window.location='editc.php?i=$cmt_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\"></i> - ";
}
else {
echo "&nbsp; ";
}
echo "<i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"cdel_$cmt_id\"></i>";
}
if($cmt_uid != $u_uid && $u_rank == 'mod') {
echo "&nbsp; <i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"cdel_$cmt_id\"></i>";
}
echo "</div>
<div class=\"cmt_post\" id=\"fp_2\" style=\"max-width: 430px; width: 80%; text-align: left;\">
<div class=\"fp_3\">";
echo bbc(atname(nl2br($string)));
echo "</div>
<table class=\"post_table2\" style=\"padding-bottom: 10px;\">
<tr>
<td class=\"ptb2_td1\" id=\"cmt_id_$cmt_id\"><span id=\"likecnt_$cmt_id\"><i class='fa fa-thumbs-up'"; if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feedcmt_likes WHERE cmt_id='$cmt_id' && uid='$u_uid'")) == '1') { echo " id=\"like_simple\" "; } echo "></i> $likcnt_r like$ls</span></td>
</tr>
</table>
</div><br>
";
}
?>
<script>
function loadmore() {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var amount = document.getElementById("amount").value;
var content = document.getElementById("ld_cmts");
$.ajax({
type: 'get',
url: 'morecmts.php?i=<?php echo $post_id; ?>',
data: {
amntcnt:amount
},
success: function(more_content) {
content.innerHTML = content.innerHTML+more_content;
document.getElementById("amount").value = Number(amount)+10;
}
});
var getcount = new XMLHttpRequest();
getcount.open("GET", "cmtamnt.php?i=<?php echo $post_id;?>", true);
getcount.onreadystatechange = function(){
if(getcount.readyState == 4)
if(getcount.status == 200) {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var numCont = getcount.responseText;
if(numCont <= Number(amount) + 10) {
document.getElementById("more_div").innerHTML = "";
}
}
else{
alert("error");
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
}
};
getcount.send();
return false;
}
</script>

View file

@ -0,0 +1,5 @@
<?php
require_once("../inc/conx.php");
$cntq = mysqli_query($conx, "SELECT id FROM feed");
echo mysqli_num_rows($cntq);
?>

View file

@ -0,0 +1,14 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['id']);
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
echo "$likcnt_r like$lsz";
?>

View file

@ -0,0 +1,14 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['id']);
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
echo "$likcnt_r dislike$lsz";
?>

View file

@ -0,0 +1,30 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$id = safe($_GET['id']);
$powner = mysqli_num_rows((mysqli_query($conx, "SELECT id FROM feed_comments WHERE uid='$u_uid' && id='$id'")));
if($powner == '1' && $u_rank != 'mod') {
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'-.03 WHERE uid='$u_uid'");
mysqli_query($conx, "DELETE FROM feed_comments WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE cmt_id='$id'");
header("location: /feed");
exit();
}
elseif($powner == '1' && $u_rank == 'mod') {
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'-.03 WHERE uid='$u_uid'");
mysqli_query($conx, "DELETE FROM feed_comments WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE cmt_id='$id'");
header("location: /feed");
exit();
}
elseif($powner != '1' && $u_rank == 'mod') {
mysqli_query($conx, "DELETE FROM feed_comments WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE cmt_id='$id'");
header("location: /feed");
exit();
}
exit();
?>

View file

@ -0,0 +1,39 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
//header("location: /");
exit();
}
$id = safe($_GET['id']);
$powner = mysqli_num_rows((mysqli_query($conx, "SELECT id FROM feed WHERE uid='$u_uid' && id='$id'")));
$psqlr = mysqli_fetch_assoc($pselc);
if($powner == '1' && $u_cont_mang != 'yes') {
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'-.05 WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET funds='$u_funds'-.25 WHERE uid='$u_uid'");
mysqli_query($conx, "DELETE FROM feed WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feed_likes WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feed_comments WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE post_id='$id'");
//header("location: /feed");
exit();
}
elseif($powner == '1' && $u_cont_mang == 'yes') {
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'-.05 WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET funds='$u_funds'-.25 WHERE uid='$u_uid'");
mysqli_query($conx, "DELETE FROM feed WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feed_likes WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feed_comments WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE post_id='$id'");
//header("location: /feed");
exit();
}
elseif($powner != '1' && $u_cont_mang == 'yes') {
mysqli_query($conx, "DELETE FROM feed WHERE id='$id'");
mysqli_query($conx, "DELETE FROM feed_likes WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feed_comments WHERE post_id='$id'");
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE post_id='$id'");
//header("location: /feed");
exit();
}
exit();
?>

View file

@ -0,0 +1,43 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$postid = safe($_GET['i']);
if($feed_id) {
$postid = $feed_id;
}
echo "liked by ";
$lcnt = mysqli_num_rows($slcq = mysqli_query($conx, "SELECT uid FROM feed_likes WHERE post_id='$postid'"));
if($lcnt == '0') {
echo "nobody <i class=\"fa fa-frown-o\" aria-hidden=\"true\"></i>";
}
$separator = '';
while($slcr = mysqli_fetch_assoc($slcq)) {
$uuid = $slcr['uid'];
$sslcq = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$uuid'");
while($sslcr = mysqli_fetch_assoc($sslcq)) {
$uusername = $sslcr['username'];
}
echo $separator;
echo "<a href=\"/canvas/$uusername\" class=\"like_username\">$uusername</a>";
if (!$separator) $separator = ', ';
}
echo "<br> disliked by ";
$dcnt = mysqli_num_rows($slcq = mysqli_query($conx, "SELECT uid FROM feed_dislikes WHERE post_id='$postid'"));
if($dcnt == '0') {
echo "nobody <i class=\"fa fa-smile-o\" aria-hidden=\"true\"></i>";
}
$sseparator = '';
while($slcr = mysqli_fetch_assoc($slcq)) {
$uuid = $slcr['uid'];
$sslcq = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$uuid'");
while($sslcr = mysqli_fetch_assoc($sslcq)) {
$uusername = $sslcr['username'];
}
echo $sseparator;
echo "<a href=\"/canvas/$uusername\" class=\"like_username\">$uusername</a>";
if (!$sseparator) $sseparator = ', ';
}
?>

View file

@ -0,0 +1,50 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['id']);
$is_post = safe($_GET['post']);
$query = mysqli_query($conx, "SELECT * FROM feed_dislikes WHERE post_id = '$id' && uid = '$u_uid'");
$amount = mysqli_num_rows($query);
if($u_token == safe($_GET['token'])){
if($amount == 0){
mysqli_query($conx, "INSERT INTO feed_dislikes (uid, post_id) VALUES ('$u_uid', '$id')");
}else{
mysqli_query($conx, "DELETE FROM feed_dislikes WHERE uid = '".$u_uid."' AND post_id = '$id'");
}
$querytwo = mysqli_query($conx, "SELECT * FROM feed_dislikes WHERE post_id = '$id' && uid = '".$u_uid."'");
$amounttwo = mysqli_num_rows($querytwo);
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
// do stuff
if(safe($_GET["_t"])) {
if($is_post == 'true') {
if($amounttwo == 1) {
echo "<span><i class='fa fa-thumbs-down' id='like_simple'></i></span> $likcnt_r dislike$lsz";
}
else {
echo "<i class='fa fa-thumbs-down'></i> $likcnt_r dislike$lsz";
}
}
else {
if($amounttwo == 1) {
echo "<span><i class='fa fa-thumbs-down'></i></span> undislike";
}
else {
echo "<i class='fa fa-thumbs-down'></i> dislike";
}
}
}
else {
// redirect
header('Location: index.php');
}
}
else {
die('Invalid token.');
}
// dis code is end
?>

View file

@ -0,0 +1,76 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$get_rstr = safe($_GET['i']);
if(mysqli_num_rows($gpostq = mysqli_query($conx, "SELECT post FROM feed WHERE random_str='$get_rstr' && uid='$u_uid' && img=''")) != 1) {
header("location: /feed");
exit();
}
$gpostr = mysqli_fetch_assoc($gpostq);
$post_text = $gpostr['post'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
</style>
</head>
<body>
<center>
<?php
$back_button = true;
$linebreak = true;
$alerts = true;
require_once("../inc/header.php");
?>
<div id="postIt">
<form id="feed_form" method="post" action="ppost.php?i=<?php echo $get_rstr; ?>">
<table class="postbox_tb">
<tr>
<td>
<textarea id="fpostb" name="edit" rows="4" class="feed_parea" placeholder="type something..."><?php echo $post_text; ?></textarea>
</td>
</tr>
</table>
<table class="postbox_tb" id="postbox_tb2">
<td class="postbox2_td2">
<input type="submit" value="edit" class="postbox_sub" style="width: 90%;">
</td>
</tr>
</table>
</form>
</div>
<?php
require_once("../inc/footer.php");
?>
</center>
</body>
</html>

View file

@ -0,0 +1,76 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$get_rstr = safe($_GET['i']);
if(mysqli_num_rows($gpostq = mysqli_query($conx, "SELECT post FROM feed_comments WHERE random_str='$get_rstr' && uid='$u_uid' && img=''")) != 1) {
header("location: /feed");
exit();
}
$gpostr = mysqli_fetch_assoc($gpostq);
$post_text = $gpostr['post'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
</style>
</head>
<body>
<center>
<?php
$back_button = true;
$linebreak = true;
$alerts = true;
require_once("../inc/header.php");
?>
<div id="postIt">
<form id="feed_form" method="post" action="cmtp.php?i=<?php echo $get_rstr; ?>">
<table class="postbox_tb">
<tr>
<td>
<textarea id="fpostb" name="edit" rows="4" class="feed_parea" placeholder="type something..."><?php echo $post_text; ?></textarea>
</td>
</tr>
</table>
<table class="postbox_tb" id="postbox_tb2">
<td class="postbox2_td2">
<input type="submit" value="edit" class="postbox_sub" style="width: 90%;">
</td>
</tr>
</table>
</form>
</div>
<?php
require_once("../inc/footer.php");
?>
</center>
</body>
</html>

View file

@ -0,0 +1,30 @@
<?php
require_once("../inc/conx.php");
$uploc = "Feed";
if ( isset($_FILES['img']) ) {
$filename = $_FILES['img']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$required_key = "make ur own";
$POST_DATA = array(
'file' => base64_encode($data),
'key' => urlencode($required_key),
'user' => urlencode($u_uid),
'imagetype' => urlencode($u_uid),
'imaeg' => urlencode($u_cloudterms),
'fieltyp' => urlencode($u_cloudterms),
'usernaem' => urlencode($u_username),
'filextension' => urlencode($u_username),
'uvia' => urlencode($uploc)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo trim($response);
curl_close ($curl);
}
?>

View file

@ -0,0 +1,432 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
# # # # # # #
# WEBSITE LOCATION #
# # # # # # #
if($u_siteloc != '/feed') {
$loc_desc = "browsin\' feed";
mysqli_query($conx, "UPDATE accounts SET site_locdesc='$loc_desc' WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET site_locurl='/feed' WHERE uid='$u_uid'");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
</style>
</head>
<body onload="resetPosts();">
<center>
<?php
$back_button = true;
$linebreak = true;
$alerts = true;
require_once("../inc/header.php");
?>
<div id="postIt" style="display: none;">
<form id="feed_form" method="post" action="ppost.php">
<table class="postbox_tb">
<tr>
<td>
<textarea id="fpostb" name="post" rows="4" class="feed_parea" placeholder="type something..."></textarea>
</td>
</tr>
</table>
<table class="postbox_tb" id="postbox_tb2">
<td class="postbox2_td" onclick="more('fd_more')">
<i id="feed_more" class="fa fa-plus" aria-hidden="true"></i>
</td>
<td class="postbox2_td2">
<input type="submit" value="post" class="postbox_sub">
</td>
<td class="postbox2_td">
<span id="loader"><i onclick="selectFile();" id="fPath" class="fa fa-paperclip fa-lg" aria-hidden="true"></i></span>
</td>
</tr>
</table>
<div id="pollForm" style="display: none;">
<table class="postbox_tb" style="padding-top: 0px; text-align: left; color: #000; font-family: 'Dosis', sans-serif; background-color: #e5e5e5;">
<tr>
<td>
<span style="font-size: 12px;">Make sure to put something in the textbox above. You can add up to five options; leave the other fields blank if you don't want to use all five [2 required]. Once done, post like normal.</span>
</td>
</tr>
</table>
<table class="postbox_tb" style="padding-top: 0px; padding-bottom: 0px; text-align: left; color: #fff; font-family: 'Dosis', sans-serif;">
<tr>
<td style="border-bottom: 1px solid #fff;">
<textarea id="pollquest" name="pollquest" rows="3" class="feed_parea" placeholder="type poll question..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #fff;">
<textarea id="pollopt1" name="pollopt1" rows="1" class="feed_parea" placeholder="* type poll option [1]..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #fff;">
<textarea id="pollopt2" name="pollopt2" rows="1" class="feed_parea" placeholder="* type poll option [2]..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #fff;">
<textarea id="pollopt3" name="pollopt3" rows="1" class="feed_parea" placeholder="type poll option [3]..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #fff;">
<textarea id="pollopt4" name="pollopt4" rows="1" class="feed_parea" placeholder="type poll option [4]..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
<tr>
<td>
<textarea id="pollopt5" name="pollopt5" rows="1" class="feed_parea" placeholder="type poll option [5]..." style="padding-bottom: 0px;"></textarea>
</td>
</tr>
</table>
</div>
</form>
<table id="fd_more" style="display: none;">
<tr>
<td style="width: 33.333%;">
<i class="fa fa-bar-chart" aria-hidden="true" onclick="attachPoll();"></i>
</td>
<td style="width: 33.333%;">
<form id="imgUpl" action="img_upload.php" enctype="multipart/form-data" method="post">
<input id="fBrowse" name="img" type="file" style="display: none;">
</form>
<form id="vidUpl" action="vid_upload.php" enctype="multipart/form-data" method="post">
<input id="vBrowse" name="vid" type="file" style="display: none;">
</form>
<i class="fa fa-refresh" aria-hidden="true" onclick="upPosts();refreshP();" id="post_refresh"></i>
</td>
<td class="postbox2_td" style="width: 33.333%;">
<span id="vloader"><i onclick="var log_conf=confirm('Upload a video? \n MP4 Files Only');if(log_conf == true){selectVid();};" id="vPath" class="fa fa-film" aria-hidden="true"></i></span>
</td>
</tr>
</table>
<br>
</div>
<div id="wPst">
<table onclick="writePost();fpostb.focus();" class="writePost" style="display: visible;">
<tr>
<td class="wpost_td">
<i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"></i> &nbsp; tap to post
</td>
</tr>
</table>
<br>
</div>
<input id="amount" type="hidden" value="10">
<?php
echo "<div id=\"ld_posts\">";
require_once("posts.php");
echo "</div>";
$cntq = mysqli_query($conx, "SELECT * FROM feed");
$count = mysqli_num_rows($cntq);
if($count > 10) {
echo "<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>";
}
require_once("../inc/footer.php");
?>
</center>
<script>
function attachPoll() {
if(confirm('Would you like to create a poll for this post? \n Polls are currently in beta. \n Time limits cannot be set yet.')) {
expand('pollForm');
}
}
function updInfosies(i) {
$.get("dis_like_infosies.php?i=" + i, function(d) {
$("#infosies_" + i).html(d);
});
}
function resetPosts() {
document.getElementById("amount").value = "10";
}
function getAjax() {
$.get("ajextra.php", function(d) {
$("#scriptie").html(d);
});
}
setInterval('getAjax()', 1000);
function upPosts() {
$.get("posts.php", function(d) {
$("#ld_posts").html(d);
});
getAjax();
}
function refreshP() {
document.getElementById("amount").value = Number(10);
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
}
function more(id) {
var e = document.getElementById(id);
if(e.style.display == '') {
e.style.display = 'none';
document.getElementById('feed_more').className = "fa fa-plus";
}
else {
e.style.display = '';
document.getElementById('feed_more').className = "fa fa-times";
}
}
function writePost() {
expand('wPst');
expand('postIt');
}
function selectFile() {
document.getElementById('fBrowse').click();
document.getElementById('fPath').value = document.getElementById('fBrowse').value;
}
var form = document.forms.namedItem("imgUpl");
form.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(form);
var oReq = new XMLHttpRequest();
if(confirm('Upload this image?')) {
document.getElementById('loader').innerHTML = "<img src='https://i.imgur.com/pvQ0NaJ.gif' height='12' width='12' alt='' style='border:0;'>";
oReq.open("POST", "img_upload.php", true);
}
else {
form.reset();
}
oReq.onload = function(oEvent) {
if(oReq.status == 200) {
var img_url = oReq.responseText;
if(img_url != '') {
document.getElementById('loader').innerHTML = "<i onclick='selectFile();' id='fPath' class='fa fa-paperclip fa-lg' aria-hidden='true'></i>";
var atoinp = "[img]" + img_url + "[/img]";
document.getElementById("fpostb").value = document.getElementById("fpostb").value + atoinp;
document.getElementById("fpostb").focus();
}
else {
document.getElementById('loader').innerHTML = "<i onclick='selectFile();' id='fPath' class='fa fa-exclamation' aria-hidden='true'></i>";
}
upPosts();
form.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
function selectVid() {
document.getElementById('vBrowse').click();
document.getElementById('vPath').value = document.getElementById('vBrowse').value;
}
var vform = document.forms.namedItem("vidUpl");
vform.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(vform);
var oReq = new XMLHttpRequest();
if(confirm('Upload this video?')) {
document.getElementById('vloader').innerHTML = "<img src='https://i.imgur.com/pvQ0NaJ.gif' height='12' width='12' alt='' style='border:0;'>";
oReq.open("POST", "vid_upload.php", true);
}
else {
vform.reset();
}
oReq.onload = function(oEvent) {
if(oReq.status == 200) {
var vid_url = oReq.responseText;
if(vid_url != '') {
document.getElementById('vloader').innerHTML = "<i onclick='selectVid();' id='vPath' class='fa fa-film' aria-hidden='true'></i>";
var atoinp = "[video]" + vid_url + "[/video]";
document.getElementById("fpostb").value = document.getElementById("fpostb").value + atoinp;
document.getElementById("fpostb").focus();
}
else {
document.getElementById('vloader').innerHTML = "<i onclick='selectVid();' id='vPath' class='fa fa-exclamation' aria-hidden='true'></i>";
}
upPosts();
vform.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
$("#feed_form").submit(function(e){
e.preventDefault();
if($("textarea[name=post]").val().trim() == "")
return;
$.post("ppost.php", {
body: $("textarea[name=post]").val(),
pollquest: $("textarea[name=pollquest]").val(),
pollopt1: $("textarea[name=pollopt1]").val(),
pollopt2: $("textarea[name=pollopt2]").val(),
pollopt3: $("textarea[name=pollopt3]").val(),
pollopt4: $("textarea[name=pollopt4]").val(),
pollopt5: $("textarea[name=pollopt5]").val(),
submit: "send"}, function(data) {
if(data != '') {
upPosts();
writePost();
refreshP();
}
else {
upPosts();
writePost();
refreshP();
}
});
refreshP();
upPosts();
$("textarea[name=post]").val("");
upPosts();
writePost();
refreshP();
});
</script>
<div id="scriptie">
<script>
// THE FOLLOWING SCRIPT WAS
// MADE BY MARIOERMANDO
// GIVEN BY ANGEL
// PERFECTED BY JUSTIN
var likeBtns = document.querySelectorAll("td[id^=post_id_]");
[].forEach.call(likeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("likecnt_" + likes);
xhr.open("GET", "like.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "count.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
//alert("error");
//count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var dlikeBtns = document.querySelectorAll("td[id^=dpost_id_]");
[].forEach.call(dlikeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("dlikecnt_" + likes);
xhr.open("GET", "dislike.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "dcount.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
//alert("error");
//count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var Del = document.querySelectorAll("i[id^=pdel_]");
[].forEach.call(Del, function(dt){
dt.onclick = function(e){
if (confirm("Delete?")) {
var dto = new XMLHttpRequest();
dto.open("GET", "delete.php?id=" + dt.id.match(/([0-9]*)$/)[0], true);
dto.onreadystatechange = function(){
if (dto.readyState == 4)
if(dto.status == 200) {
upPosts();
UpMPcmts();
refreshP();
}
else {
upPosts();
UpMPcmts();
refreshP();
}
};
dto.send();
upPosts();
UpMPcmts();
refreshP();
return false;
}
};
});
</script>
</div>
</body>
</html>

View file

@ -0,0 +1,92 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$post_id = safe($_GET['i']);
# SELECT COMMENTS
$cmt_cnt = mysqli_num_rows($cmt_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,edited FROM feed_comments WHERE post_rstr='$post_id' ORDER BY id DESC"));
if($cmt_cnt == 0) {
exit();
}
while($cmt_r = mysqli_fetch_assoc($cmt_q)) {
$cmt_id = $cmt_r['id'];
$cmt_uid = $cmt_r['uid'];
$string = $cmt_r['post'];
$cmt_tstamp = $cmt_r['tstamp'];
$cmt_randomstr = $cmt_r['random_str'];
$cmt_edited = $cmt_r['edited'];
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$cmt_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$cmt_uid = "286";
}
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$cmt_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$cmt_uid = "286";
}
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
include("../inc/replace.php");
$usr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$cmt_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$cmt_username = $usr_r['username'];
$cmt_pic = $usr_r['picture'];
$cmt_onltime = $usr_r['online_time'];
$feed_vrf = $usr_r['md_verf'];
if($feed_vrf == 'yes') {
$verif_check = "<i style=\"font-size: 14px;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i> ";
}
else {
$verif_check = "";
}
//
// DATA SAVER
if($u_datasaver == 'on') {
$cmt_pic = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABtklEQVR4AW1TNXgUYRC9HqdvoYW+PT/c3Z0KWvqWLp7drCvuDg3uVNEGh3hyro8ZLGuz31v7n/waW33i9H/oq7SlxmrjCOGBudocI5T5yd/8n9u9fI9QX0GEG0SuEPAbq/j5F/yf2pnnE9OPldT4gQAvzu88D3ON/x/zmP9brP3p6nUvwcgZuHLsCj49/4RrJ67xt8+A+ayL0cvRYFftjRZG7o+Aa+TBCMwNofQK61h83+e6ysCLzhdo1Brg4uejs4+gZJRg+v0YvYx6u3vz1E0Uxgrw1sTnCej7dch+g1EWlzxuGLg5gKh67bxGZ6ITSlb9Jy7PJfNYt9oYGx5DVH0f+I7edQJ6UwLUnMpBo3NjJrG11cLo8Gi0ePA7hPUihJQIKSuzwV3fbNP045X5Ci26gvXMeIbuZA+kjAwlpxTVVco+3zrzTGtbNby79g6lfAnNZhPF2SJeX3mN3o29ENN9LIS6SnWVVfLC0A5jA2mNBOOkAeeMC+mIjPZ0B3cXclYGJT4hLPfvbTbw7G0tq0FIiuhO9HAij7NIqSYJl3n3ttcgdKpoYsb6MtIdKSvtknPSfC//FxxTQV29mEp6AAAAAElFTkSuQmCC";
}
// DATA SAVER
//
$HUAHHH = time() - $cmt_onltime;
$mens = round($HUAHHH / 60);
if($mens <= 1) {
$cv_activeness = "#00FF00";
}
elseif($mens <= 2) {
$cv_activeness = "#FFA500";
}
elseif($mens < 5) {
$cv_activeness = "#FF0000";
}
else {
$cv_activeness = "#FF0000";
}
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$cmt_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
$username_color = $usri_r['username_color'];
$cmt_tcolor = $usri_r['text_color'];
}
}
if($cmt_uid != '286') {
echo "<table style=\"padding-bottom: 5px; padding-top: 5px; font-family: 'Dosis', sans-serif; width: 100%;\"><tr><td>
<div style=\"position: relative; width: 36px; height: 36px; border-radius: 50px;\">
<div style=\"background-color: $cv_activeness; border: 2px solid #fff; position: absolute; width: 8px; height: 8px; border-radius: 50px; display: inline-block; bottom: 0; right: 0; z-index: 3;\"></div> <img onclick=\"window.location='/canvas/$cmt_username';\" src=\"$cmt_pic\" class=\"list_picture\"></div></td>";
echo "<td style=\"width: 100%; text-align: left;\"><span onclick=\"window.location='/canvas/$cmt_username';\" style=\"color: $username_color; font-weight: bold;\">$cmt_username $verif_check</span>";
echo "<span class=\"tago\" style=\"font-size: 9px;\"> &bull; ";
echo timeago($cmt_tstamp);
echo " ago</span> &nbsp;";
if($cmt_uid == $u_uid) {
echo " <i onclick=\"window.location='editc.php?i=$cmt_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\" style=\"font-size: 13px; color: $username_color\"></i> &nbsp; ";
echo "<i onclick=\"dComment('$post_id', '$cmt_id');\" class=\"fa fa-trash\" aria-hidden=\"true\" style=\"font-size: 13px; color: $username_color\"></i>";
}
echo "<br><span style=\"font-size: 14px;\">"; echo bbc(atname(nl2br($string))); echo "</span>";
echo "</td></tr></table>";
}
}
?>

View file

@ -0,0 +1,247 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$post_uq = safe($_GET['uq']);
$feed_randomstr = $post_uq;
function polltime($session_time) {
$time_difference = $session_time - time();
$seconds = $time_difference;
$minutes = round($time_difference/60);
$hours = round($time_difference/3600);
$days = round($time_difference/86400);
$weeks = round($time_difference/604800);
$months = round($time_difference/2419200);
$years = round($time_difference/29030400);
$s_ago = "s"; $m_ago = "m"; $h_ago = "h"; $w_ago = "w"; $d_ago = "d";
if($seconds <= 59) { echo "$seconds$s_ago"; }
else if($minutes <= 59) {
if($minutes == 1) { echo "1$m_ago"; }
else { echo "$minutes$m_ago"; }
}
else if($hours <= 23) {
if($hours == 1) { echo "1$h_ago"; }
else { echo "$hours$h_ago"; }
}
else if($days <= 6) {
if($days == 1) { echo "1$d_ago"; }
else { echo "$days$d_ago"; }
}
else if($weeks > 0) {
if($weeks == 1) { echo "1$w_ago"; }
else { echo "$weeks$w_ago"; }
}
}
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
$feed_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,visibility,edited,img,allow_comments FROM feed WHERE random_str='$feed_randomstr'");
while($feed_r = mysqli_fetch_assoc($feed_q)) {
// Feed data
$feed_id = $feed_r['id'];
$feed_uid = $feed_r['uid'];
$usr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$feed_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
// Account data
$feed_username = $usr_r['username'];
$feed_vrf = $usr_r['md_verf'];
if($feed_vrf == 'yes') {
$verif_check = "<i style=\"font-size: 14px;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>";
}
else {
$verif_check = "";
}
}
# SELECT THEME COLORS FOR ACCOUNTS
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$feed_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
// Theme data
$username_color = $usri_r['username_color'];
$feed_tcolor = $usri_r['text_color'];
}
}
# SELECT POLL DATA FOR THE POST
$fpoll_q = mysqli_query($conx, "SELECT * FROM feed_polls WHERE uqid='$feed_randomstr'");
while($fpoll_r = mysqli_fetch_assoc($fpoll_q)) {
// poll data
$fpoll_question = $fpoll_r['poll_question'];
$fpoll_opt1 = $fpoll_r['poll_opt1'];
$fpoll_opt2 = $fpoll_r['poll_opt2'];
$fpoll_opt3 = $fpoll_r['poll_opt3'];
$fpoll_opt4 = $fpoll_r['poll_opt4'];
$fpoll_opt5 = $fpoll_r['poll_opt5'];
$fpoll_istimed = $fpoll_r['is_timed'];
$fpoll_tstmpend = $fpoll_r['tstamp_end'];
if(strlen($fpoll_opt1) >= 30) {
$fpoll_optc1 = trim(substr($fpoll_opt1,0,30)) . "...";
}
else {
$fpoll_optc1 = $fpoll_opt1;
}
if(strlen($fpoll_opt2) >= 30) {
$fpoll_optc2 = trim(substr($fpoll_opt2,0,30)) . "...";
}
else {
$fpoll_optc2 = $fpoll_opt2;
}
if(strlen($fpoll_opt3) >= 30) {
$fpoll_optc3 = trim(substr($fpoll_opt3,0,30)) . "...";
}
else {
$fpoll_optc3 = $fpoll_opt3;
}
if(strlen($fpoll_opt4) >= 30) {
$fpoll_optc4 = trim(substr($fpoll_opt4,0,30)) . "...";
}
else {
$fpoll_optc4 = $fpoll_opt4;
}
if(strlen($fpoll_opt5) >= 30) {
$fpoll_optc5 = trim(substr($fpoll_opt5,0,30)) . "...";
}
else {
$fpoll_optc5 = $fpoll_opt5;
}
}
# SELECT RESPONSE DATA FOR THE POLL
$fpoll_response_q = mysqli_query($conx, "SELECT * FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && uid='$u_uid'");
while($fpoll_response_r = mysqli_fetch_assoc($fpoll_response_q)) {
// poll response data
$fpoll_option_picked = $fpoll_response_r['option_picked'];
}
echo "<br>";
if($fpoll_option_picked != '') {
$current_can_vote = "no";
}
else {
$current_can_vote = "yes";
}
// total vote count
$rest_c = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr'");
$optt_cnt = mysqli_num_rows($rest_c);
// count number of votes for each option
$res_c1 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='1'");
$opt1_cnt = mysqli_num_rows($res_c1);
if($opt1_cnt != '1') {
$count1_s = "s";
}
$res_c2 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='2'");
$opt2_cnt = mysqli_num_rows($res_c2);
if($opt2_cnt != '1') {
$count2_s = "s";
}
$res_c3 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='3'");
$opt3_cnt = mysqli_num_rows($res_c3);
if($opt3_cnt != '1') {
$count3_s = "s";
}
$res_c4 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='4'");
$opt4_cnt = mysqli_num_rows($res_c4);
if($opt4_cnt != '1') {
$count4_s = "s";
}
$res_c5 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='5'");
$opt5_cnt = mysqli_num_rows($res_c5);
if($opt5_cnt != '1') {
$count5_s = "s";
}
if($fpoll_option_picked == '1') {
$current_picked1 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '2') {
$current_picked2 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '3') {
$current_picked3 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '4') {
$current_picked4 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '5') {
$current_picked5 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
echo "<span style=\"font-size: 12px; color: #808080;\">A poll has been attached to this post. <br> </span>";
if($fpoll_istimed == 'yes') {
echo "<span style=\"font-size: 12px; color: #808080;\">There is a time limit- it will stop accepting responses in ";
echo polltime($fpoll_tstmpend);
echo ".</span>";
}
else {
echo "<span style=\"font-size: 12px; color: #808080;\">There is no time limit set- responses are always accepted.</span>";
}
echo "<br><br><table style=\"width: 100%;\"><tr>";
echo "<td>";
echo "<span style=\"color: $username_color; font-weight: bold;\">$feed_username $verif_check</span><br>";
echo "</td>";
echo "</tr></table>";
echo "<div style=\"border-radius: 8em; background-color: $username_color; padding: 8px; display: inline-block;\">";
echo "<table style=\"width: 100%;\"><tr>";
echo "<td style=\"font-weight: bold; color: $feed_tcolor; padding-left: 12px; padding-right: 12px;\">";
echo "$fpoll_question";
echo "</td>";
echo "</tr></table>";
echo "</div> <br><br>";
echo "<span style=\"font-size: 12px; color: #808080;\">Select your response by tapping one of the options below.</span><br>";
if($current_can_vote == 'no') {
echo "<span style=\"font-size: 12px; color: #808080;\">You can change your response by tapping a new option.</span><br>";
}
echo "<br><table style=\"text-align: center; font-weight: bold; width: 100%;\"><tr>";
echo "<td onclick=\"pollVote('1','$feed_randomstr');\" style=\"$current_picked1;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt1";
echo "</td>";
echo "<td onclick=\"pollVote('2','$feed_randomstr');\" style=\"$current_picked2;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt2";
echo "</td>";
if($fpoll_opt3 != '') {
echo "<td onclick=\"pollVote('3','$feed_randomstr');\" style=\"$current_picked3;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt3";
echo "</td>";
}
if($fpoll_opt4 != '') {
echo "<td onclick=\"pollVote('4','$feed_randomstr');\" style=\"$current_picked4;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt4";
echo "</td>";
}
if($fpoll_opt5 != '') {
echo "<td onclick=\"pollVote('5','$feed_randomstr');\" style=\"$current_picked5;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt5";
echo "</td>";
}
echo "</tr></table>";
echo "<div id=\"presults_$feed_randomstr\">";
echo "<br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt1_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc1\"</span><br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt2_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc2\"</span><br>";
if($fpoll_opt3 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt3_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc3\"</span><br>";
}
if($fpoll_opt4 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt4_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc4\"</span><br>";
}
if($fpoll_opt5 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt5_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc5\"</span><br>";
}
echo "<br><span style=\"color: #808080; font-size: 14px; font-weight: bold;\">Total Votes Received:</span> <span style=\"color: #808080; font-size: 14px;\">$optt_cnt</span><br>";
echo "</div>";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
?>

View file

@ -0,0 +1,20 @@
<?php
require_once("../inc/conx.php");
if ( isset($_FILES['img']) ) {
$filename = $_FILES['img']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$POST_DATA = array(
'file' => base64_encode($data)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo trim($response);
curl_close ($curl);
}
?>

View file

@ -0,0 +1,23 @@
<form enctype="multipart/form-data" encoding='multipart/form-data' method='post' action="">
<input name="uploadedfile" type="file" value="choose">
<input type="submit" value="Upload">
</form>
<?php
if ( isset($_FILES['uploadedfile']) ) {
$filename = $_FILES['uploadedfile']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$POST_DATA = array(
'file' => base64_encode($data)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/image.php');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo $response;
curl_close ($curl);
}
?>

View file

@ -0,0 +1,50 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['id']);
$is_post = safe($_GET['post']);
$query = mysqli_query($conx, "SELECT * FROM feed_likes WHERE post_id = '$id' && uid = '$u_uid'");
$amount = mysqli_num_rows($query);
if($u_token == safe($_GET['token'])){
if($amount == 0){
mysqli_query($conx, "INSERT INTO feed_likes (uid, post_id) VALUES ('$u_uid', '$id')");
}else{
mysqli_query($conx, "DELETE FROM feed_likes WHERE uid = '".$u_uid."' AND post_id = '$id'");
}
$querytwo = mysqli_query($conx, "SELECT * FROM feed_likes WHERE post_id = '$id' && uid = '".$u_uid."'");
$amounttwo = mysqli_num_rows($querytwo);
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
// do stuff
if(safe($_GET["_t"])) {
if($is_post == 'true') {
if($amounttwo == 1) {
echo "<span><i class='fa fa-thumbs-up' id='like_simple'></i></span> $likcnt_r like$lsz";
}
else {
echo "<i class='fa fa-thumbs-up'></i> $likcnt_r like$lsz";
}
}
else {
if($amounttwo == 1) {
echo "<span><i class='fa fa-thumbs-up'></i></span> unlike";
}
else {
echo "<i class='fa fa-thumbs-up'></i> like";
}
}
}
else {
// redirect
header('Location: index.php');
}
}
else {
die('Invalid token.');
}
// dis code is end
?>

View file

@ -0,0 +1,40 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['id']);
$pid = safe($_GET['i']);
$query = mysqli_query($conx, "SELECT * FROM feedcmt_likes WHERE cmt_id = '$id' && uid = '$u_uid'");
$amount = mysqli_num_rows($query);
if($u_token == safe($_GET['token'])){
if($amount == 0){
mysqli_query($conx, "INSERT INTO feedcmt_likes (uid, cmt_id, post_id) VALUES ('$u_uid', '$id', '$pid')");
}else{
mysqli_query($conx, "DELETE FROM feedcmt_likes WHERE uid = '".$u_uid."' AND cmt_id = '$id'");
}
$querytwo = mysqli_query($conx, "SELECT * FROM feedcmt_likes WHERE cmt_id = '$id' && uid = '".$u_uid."'");
$amounttwo = mysqli_num_rows($querytwo);
$likcnt_q = mysqli_query($conx, "SELECT id FROM feedcmt_likes WHERE cmt_id='$id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
// do stuff
if(safe($_GET["_t"])) {
if($amounttwo == 1) {
echo "<span><i class='fa fa-thumbs-up' id='like_simple'></i></span> $likcnt_r like$lsz";
}
else {
echo "<i class='fa fa-thumbs-up'></i> $likcnt_r like$lsz";
}
}
else {
// redirect
header('location: index.php');
}
}
else {
die('Invalid token.');
}
// dis code is end
?>

View file

@ -0,0 +1,77 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$amount = safe($_GET['amntcnt']);
$post_id = safe($_GET['i']);
$cmt_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,edited,img FROM feed_comments WHERE post_rstr='$post_id' ORDER BY id DESC LIMIT $amount,10");
while($cmt_r = mysqli_fetch_assoc($cmt_q)) {
$cmt_id = $cmt_r['id'];
$cmt_uid = $cmt_r['uid'];
$string = $cmt_r['post'];
$cmt_tstamp = $cmt_r['tstamp'];
$cmt_randomstr = $cmt_r['random_str'];
$cmt_edited = $cmt_r['edited'];
$cmt_img = $cmt_r['img'];
include("../inc/replace.php");
$usr_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$cmt_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$cmt_username = $usr_r['username'];
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$cmt_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
$username_color = $usri_r['username_color'];
$cmt_tcolor = $usri_r['text_color'];
}
}
$likcnt_q = mysqli_query($conx, "SELECT id FROM feedcmt_likes WHERE cmt_id='$cmt_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r == '1') {
$ls = "";
}
else {
$ls = "s";
}
echo "<div class=\"cmt_post\" id=\"fp_1\" style=\"max-width: 430px; width: 80%; background-color: $username_color;\">
<table class=\"post_table1\">
<tr>
<td class=\"ptb1_td1\" style=\"color: $cmt_tcolor;\"><a href=\"/canvas/$cmt_username\" style=\"text-decoration: none; color: $cmt_tcolor; font-weight: bold;\">$cmt_username</a></td>
<td class=\"ptb1_td2\" style=\"color: $cmt_tcolor;\"><i class=\"fa fa-angle-down\" aria-hidden=\"true\" onclick=\"expand('$cmt_randomstr')\"></i></td>
</tr>
</table>
</div>
<div id=\"$cmt_randomstr\" class=\"post_more\" style=\"max-width: 430px; width: 80%; display: none;\">";
if($cmt_edited == 'yes') {
echo "edited ";
}
else {
echo "posted ";
}
echo timeago($cmt_tstamp); echo" ago";
if($cmt_uid == $u_uid) {
if($cmt_img != 'yes') {
echo "&nbsp; <i onclick=\"window.location='editc.php?i=$cmt_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\"></i> - ";
}
else {
echo "&nbsp; ";
}
echo "<i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"cdel_$cmt_id\"></i>";
}
if($cmt_uid != $u_uid && $u_rank == 'mod') {
echo "&nbsp; <i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"cdel_$cmt_id\"></i>";
}
echo "</div>
<div class=\"cmt_post\" id=\"fp_2\" style=\"max-width: 430px; width: 80%; text-align: left;\">
<div class=\"fp_3\">";
echo bbc(atname(nl2br($string)));
echo "</div>
<table class=\"post_table2\" style=\"padding-bottom: 10px;\">
<tr>
<td class=\"ptb2_td1\" id=\"cmt_id_$cmt_id\"><span id=\"likecnt_$cmt_id\"><i class='fa fa-thumbs-up'"; if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feedcmt_likes WHERE cmt_id='$cmt_id' && uid='$u_uid'")) == '1') { echo " id=\"like_simple\" "; } echo "></i> $likcnt_r like$ls</span></td>
</tr>
</table>
</div><br>
";
}
?>

View file

@ -0,0 +1,397 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$amount = safe($_GET['amntcnt']);
# SELECT TEN POSTS FROM FEED
$feed_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,visibility,edited,img,is_poll FROM feed ORDER BY id DESC LIMIT $amount,10");
while($feed_r = mysqli_fetch_assoc($feed_q)) {
// Feed data
$feed_id = $feed_r['id'];
$feed_uid = $feed_r['uid'];
$string = $feed_r['post'];
$feed_tstamp = $feed_r['tstamp'];
$feed_randomstr = $feed_r['random_str'];
$feed_visibility = $feed_r['visibility'];
$feed_edited = $feed_r['edited'];
$feed_img = $feed_r['img'];
$feed_is_poll = $feed_r['is_poll'];
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$feed_uid = "286";
}
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$feed_uid = "286";
}
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
// Emoji+ replacement
include("../inc/replace.php");
# SELECT ACCOUNT DATA FOR FEED POSTS
$usr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$feed_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
// Account data
$feed_username = $usr_r['username'];
$feed_picture = $usr_r['picture'];
$feed_onltime = $usr_r['online_time'];
$feed_vrf = $usr_r['md_verf'];
if($feed_vrf == 'yes') {
$verif_check = "<i style=\"font-size: 14px;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>";
}
else {
$verif_check = "";
}
//
// DATA SAVER
if($u_datasaver == 'on') {
$feed_picture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABtklEQVR4AW1TNXgUYRC9HqdvoYW+PT/c3Z0KWvqWLp7drCvuDg3uVNEGh3hyro8ZLGuz31v7n/waW33i9H/oq7SlxmrjCOGBudocI5T5yd/8n9u9fI9QX0GEG0SuEPAbq/j5F/yf2pnnE9OPldT4gQAvzu88D3ON/x/zmP9brP3p6nUvwcgZuHLsCj49/4RrJ67xt8+A+ayL0cvRYFftjRZG7o+Aa+TBCMwNofQK61h83+e6ysCLzhdo1Brg4uejs4+gZJRg+v0YvYx6u3vz1E0Uxgrw1sTnCej7dch+g1EWlzxuGLg5gKh67bxGZ6ITSlb9Jy7PJfNYt9oYGx5DVH0f+I7edQJ6UwLUnMpBo3NjJrG11cLo8Gi0ePA7hPUihJQIKSuzwV3fbNP045X5Ci26gvXMeIbuZA+kjAwlpxTVVco+3zrzTGtbNby79g6lfAnNZhPF2SJeX3mN3o29ENN9LIS6SnWVVfLC0A5jA2mNBOOkAeeMC+mIjPZ0B3cXclYGJT4hLPfvbTbw7G0tq0FIiuhO9HAij7NIqSYJl3n3ttcgdKpoYsb6MtIdKSvtknPSfC//FxxTQV29mEp6AAAAAElFTkSuQmCC";
}
// DATA SAVER
//
// Activity Dot
$new_time = time() - $feed_onltime;
$mens = round($new_time / 60);
if($mens <= 1) { $cv_activeness = "#00FF00"; } // Active within one minute
elseif($mens <= 2) { $cv_activeness = "#FFA500"; } // Active within two minutes
elseif($mens < 5) { $cv_activeness = "#FF0000"; } // Active within five minutes
else { $cv_activeness = "#FF0000"; } // Active over five minutes
# SELECT THEME COLORS FOR ACCOUNTS
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$feed_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
// Theme data
$username_color = $usri_r['username_color'];
$feed_tcolor = $usri_r['text_color'];
}
// Styling for the comment placeholders of each account attached to a post.
echo "<style type=\"text/css\">";
echo ".comment_$feed_username";
echo "[placeholder]:empty:before {";
echo "content: attr(placeholder);";
echo "color: $feed_tcolor; }</style>";
}
// If a post has more than one comment, set an 's' variable
$comcnt_q = mysqli_query($conx, "SELECT id FROM feed_comments WHERE post_id='$feed_id'");
$comcnt_r = number_format(mysqli_num_rows($comcnt_q));
if($comcnt_r == '1') { $cs = ""; } else { $cs = "s"; } // comment(s)
// If a post has more than one like, set an 's' variable
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r == '1') { $ls = ""; } else { $ls = "s"; } // like(s)
// If a post has more than one dislike, set an 's' variable
$dlikcnt_q = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id'");
$dlikcnt_r = number_format(mysqli_num_rows($dlikcnt_q));
if($dlikcnt_r == '1') { $dls = ""; } else { $dls = "s"; } // dislike(s)
# BEGIN ECHOING THE FEED POSTS
if($feed_uid != '286') {
echo "<div class=\"feed_post\" id=\"fp_1\" style=\"background-color: $username_color;\">";
echo "<table class=\"post_table1\"><tr>";
echo "<td class=\"ptb1_td1\" style=\"color: $feed_tcolor; width: 0%;\">";
echo "<div style=\"position: relative; width: 36px; height: 36px; border-radius: 50px;\">";
echo "<div style=\"background-color: $cv_activeness; border: 2px solid $username_color; position: absolute; width: 8px; height: 8px; border-radius: 50px; display: inline-block; bottom: 0; right: 0; z-index: 3;\"></div>";
echo "<img onclick=\"window.location='/canvas/$feed_username';\" src=\"$feed_picture\" class=\"list_picture\"></div></td>";
echo "<td class=\"ptb1_td1\" style=\"text-align: left; color: $feed_tcolor;\">";
echo "<a href=\"/canvas/$feed_username\" style=\"text-decoration: none; color: $feed_tcolor; font-weight: bold;\">$feed_username $verif_check</a></td>";
echo "<td class=\"ptb1_td2\" style=\"color: $feed_tcolor;\">";
echo "<i class=\"fa fa-angle-down\" aria-hidden=\"true\" onclick=\"expand('$feed_randomstr')\"></i></td></tr></table></div>";
echo "<div id=\"$feed_randomstr\" class=\"post_more\" style=\"display: none;\">";
// State whether or not a post has been edited.
if($feed_edited == 'yes') {
echo "edited ";
}
else {
echo "posted ";
}
// State the timestamp of the post.
echo timeago($feed_tstamp); echo" ago";
// If the feed UID matches the current UID.
if($feed_uid == $u_uid) {
// Option to edit the post.
echo "&nbsp; <i onclick=\"window.location='edit.php?i=$feed_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\"></i> &nbsp; ";
// Option to remove the post.
echo "<i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
// If the feed UID does not match the current UID, but the current account is a content manager.
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
if($feed_uid != $u_uid && $u_cont_mang == 'yes') {
echo "&nbsp; <i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
echo "&nbsp; <i onclick=\"window.location='post.php?i=$feed_randomstr';\" class=\"fa fa-expand\" aria-hidden=\"true\"></i>";
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
echo "</div><div class=\"feed_post\" id=\"fp_2\">";
echo "<div class=\"fp_3\">";
// Echo the post content.
echo bbc(atname(nl2br($string)));
if($feed_is_poll == 'yes') {
echo "<div id=\"innerpoll_$feed_randomstr\">";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
# SELECT POLL DATA FOR THE POST
$fpoll_q = mysqli_query($conx, "SELECT * FROM feed_polls WHERE uqid='$feed_randomstr'");
while($fpoll_r = mysqli_fetch_assoc($fpoll_q)) {
// poll data
$fpoll_question = $fpoll_r['poll_question'];
$fpoll_opt1 = $fpoll_r['poll_opt1'];
$fpoll_opt2 = $fpoll_r['poll_opt2'];
$fpoll_opt3 = $fpoll_r['poll_opt3'];
$fpoll_opt4 = $fpoll_r['poll_opt4'];
$fpoll_opt5 = $fpoll_r['poll_opt5'];
$fpoll_istimed = $fpoll_r['is_timed'];
$fpoll_tstmpend = $fpoll_r['tstamp_end'];
if(strlen($fpoll_opt1) >= 30) {
$fpoll_optc1 = trim(substr($fpoll_opt1,0,30)) . "...";
}
else {
$fpoll_optc1 = $fpoll_opt1;
}
if(strlen($fpoll_opt2) >= 30) {
$fpoll_optc2 = trim(substr($fpoll_opt2,0,30)) . "...";
}
else {
$fpoll_optc2 = $fpoll_opt2;
}
if(strlen($fpoll_opt3) >= 30) {
$fpoll_optc3 = trim(substr($fpoll_opt3,0,30)) . "...";
}
else {
$fpoll_optc3 = $fpoll_opt3;
}
if(strlen($fpoll_opt4) >= 30) {
$fpoll_optc4 = trim(substr($fpoll_opt4,0,30)) . "...";
}
else {
$fpoll_optc4 = $fpoll_opt4;
}
if(strlen($fpoll_opt5) >= 30) {
$fpoll_optc5 = trim(substr($fpoll_opt5,0,30)) . "...";
}
else {
$fpoll_optc5 = $fpoll_opt5;
}
}
# SELECT RESPONSE DATA FOR THE POLL
$fpoll_response_q = mysqli_query($conx, "SELECT * FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && uid='$u_uid'");
while($fpoll_response_r = mysqli_fetch_assoc($fpoll_response_q)) {
// poll response data
$fpoll_option_picked = $fpoll_response_r['option_picked'];
}
echo "<br>";
if($fpoll_option_picked != '') {
$current_can_vote = "no";
}
else {
$current_can_vote = "yes";
}
// total vote count
$rest_c = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr'");
$optt_cnt = mysqli_num_rows($rest_c);
// count number of votes for each option
$res_c1 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='1'");
$opt1_cnt = mysqli_num_rows($res_c1);
if($opt1_cnt != '1') {
$count1_s = "s";
}
$res_c2 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='2'");
$opt2_cnt = mysqli_num_rows($res_c2);
if($opt2_cnt != '1') {
$count2_s = "s";
}
$res_c3 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='3'");
$opt3_cnt = mysqli_num_rows($res_c3);
if($opt3_cnt != '1') {
$count3_s = "s";
}
$res_c4 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='4'");
$opt4_cnt = mysqli_num_rows($res_c4);
if($opt4_cnt != '1') {
$count4_s = "s";
}
$res_c5 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='5'");
$opt5_cnt = mysqli_num_rows($res_c5);
if($opt5_cnt != '1') {
$count5_s = "s";
}
if($fpoll_option_picked == '1') {
$current_picked1 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '2') {
$current_picked2 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '3') {
$current_picked3 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '4') {
$current_picked4 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '5') {
$current_picked5 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
echo "<span style=\"font-size: 12px; color: #808080;\">A poll has been attached to this post. <br> </span>";
if($fpoll_istimed == 'yes') {
echo "<span style=\"font-size: 12px; color: #808080;\">There is a time limit- it will stop accepting responses in ";
echo polltime($fpoll_tstmpend);
echo ".</span>";
}
else {
echo "<span style=\"font-size: 12px; color: #808080;\">There is no time limit set- responses are always accepted.</span>";
}
echo "<br><br><table style=\"width: 100%;\"><tr>";
echo "<td>";
echo "<span style=\"color: $username_color; font-weight: bold;\">$feed_username $verif_check</span><br>";
echo "</td>";
echo "</tr></table>";
echo "<div style=\"border-radius: 8em; background-color: $username_color; padding: 8px; display: inline-block;\">";
echo "<table style=\"width: 100%;\"><tr>";
echo "<td style=\"font-weight: bold; color: $feed_tcolor; padding-left: 12px; padding-right: 12px;\">";
echo "$fpoll_question";
echo "</td>";
echo "</tr></table>";
echo "</div> <br><br>";
echo "<span style=\"font-size: 12px; color: #808080;\">Select your response by tapping one of the options below.</span><br>";
if($current_can_vote == 'no') {
echo "<span style=\"font-size: 12px; color: #808080;\">You can change your response by tapping a new option.</span><br>";
}
echo "<br><table style=\"text-align: center; font-weight: bold; width: 100%;\"><tr>";
echo "<td onclick=\"pollVote('1','$feed_randomstr');\" style=\"$current_picked1;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt1";
echo "</td>";
echo "<td onclick=\"pollVote('2','$feed_randomstr');\" style=\"$current_picked2;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt2";
echo "</td>";
if($fpoll_opt3 != '') {
echo "<td onclick=\"pollVote('3','$feed_randomstr');\" style=\"$current_picked3;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt3";
echo "</td>";
}
if($fpoll_opt4 != '') {
echo "<td onclick=\"pollVote('4','$feed_randomstr');\" style=\"$current_picked4;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt4";
echo "</td>";
}
if($fpoll_opt5 != '') {
echo "<td onclick=\"pollVote('5','$feed_randomstr');\" style=\"$current_picked5;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt5";
echo "</td>";
}
echo "</tr></table>";
echo "<div id=\"presults_$feed_randomstr\">";
echo "<br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt1_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc1\"</span><br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt2_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc2\"</span><br>";
if($fpoll_opt3 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt3_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc3\"</span><br>";
}
if($fpoll_opt4 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt4_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc4\"</span><br>";
}
if($fpoll_opt5 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt5_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc5\"</span><br>";
}
echo "<br><span style=\"color: #808080; font-size: 14px; font-weight: bold;\">Total Votes Received:</span> <span style=\"color: #808080; font-size: 14px;\">$optt_cnt</span><br>";
echo "</div>";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
echo "</div>";
}
echo "</div><table class=\"post_table2\"><tr>";
echo "<td class=\"ptb2_td1\">";
// Like count within the post.
echo "<span id=\"likecnt_$feed_id\">";
echo "$likcnt_r like$ls";
echo "</span> &nbsp;&nbsp; ";
// Dislike count within the post.
echo "<span id=\"dlikecnt_$feed_id\">";
echo "$dlikcnt_r dislike$dls";
echo "</span></td><td id=\"ccmt_cnt\" class=\"ptb2_td2\">";
// Comment count within the post.
echo "<span id=\"mpcomment_count\">";
echo "$comcnt_r comment$cs";
echo "</span></td></tr></table>";
echo "<center><table class=\"post_table3\"><tr>";
echo "<td id=\"post_id_$feed_id\" class=\"ptb3_td1\">";
# Determine whether or not the current account has liked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == 0) { // Current account has not liked the post.
echo "<i class='fa fa-thumbs-up'></i> like";
}
else { // Current account has like the post.
echo "<span><i class='fa fa-thumbs-up'></i></span> unlike";
}
echo "</td><td id=\"$feed_randomstr\" class=\"ptb3_td2\" onclick=\"showComments(this);\">";
echo "<i class=\"fa fa-comment\" aria-hidden=\"true\"></i> ";
echo "<span id=\"cmtbtn_$feed_randomstr\">comment</span></td>";
echo "<td id=\"dpost_id_$feed_id\" class=\"ptb3_td3\">";
# Determine whether or not the current account has disliked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == "0") { // Current account has not disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> dislike";
}
else { // Current account has disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> undislike";
}
echo "</td></tr></table>";
echo "<div id=\"comments_$feed_randomstr\" style=\"display: none;\">";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div id=\"infosies_$feed_id\" style=\"font-family: 'Dosis', sans-serif; text-align: left; padding-bottom: 8px; padding-right: 8px; padding-left: 8px; font-size: 13px; color: #808080;\">";
include("dis_like_infosies.php");
echo "</div>";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div style=\"background-color: $username_color; width: 99%; padding: 5px;\">";
echo "<table style=\"width: 95%; text-align: center;\"><tr>";
echo "<td style=\"width: 100%;word-break:break-word;\">";
echo "<input type=\"hidden\" name=\"feedc_id\" value=\"$feed_randomstr\">";
// Write a comment.
echo "<div name=\"body\" class=\"comment_$feed_username\" id=\"comment_$feed_randomstr\" placeholder=\"Write a comment...\" style=\"font-family: 'Dosis', sans-serif; font-size: 15px; color: $feed_tcolor; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; background-color: $username_color; width: 98%; outline: none; text-align: left;\" contenteditable></div></td>";
echo "<td><button onclick=\"pComment('$feed_randomstr')\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
echo "<i class=\"fa fa-pencil\" aria-hidden=\"true\"></i></button>";
echo "</td><td><button onclick=\"cselectFile('$feed_randomstr');\" id=\"cfPath_$feed_randomstr\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
echo "<span id=\"cloader_$feed_randomstr\">";
echo "<i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>";
echo "</span></button></td></tr></table>";
echo "<form id=\"cimgUpl_$feed_randomstr\" action=\"img_upload.php\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" id=\"cfeedc_id\" value=\"$feed_randomstr\">";
echo "<input id=\"cfBrowse_$feed_randomstr\" name=\"img\" type=\"file\" style=\"display: none;\">";
echo "</form></div>";
echo "<div id=\"comments_inner_$feed_randomstr\"></div>";
echo "</div></center></div>";
echo "<br>";
}
}
?>

View file

@ -0,0 +1,12 @@
<?php
/* Coded by Neonacid64 */
require_once("../inc/conx.php");
$id = safe($_GET['i']);
$query = mysqli_query($conx, "SELECT * FROM feed_comments WHERE post_rstr= '$id'");
$amount = mysqli_num_rows($query);
if($amount != '1') {
$lsz = "s";
}
echo "$amount comment$lsz";
?>

View file

@ -0,0 +1,29 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$post_uq = safe($_POST['uq']);
$post_option = safe($_POST['op']);
$post_token = safe($_POST['token']);
if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feed_polls WHERE uqid='$post_uq'")) != '1') {
header("location: /feed");
exit();
}
if($u_token == $post_token) {
$query = mysqli_query($conx, "SELECT * FROM feed_poll_response WHERE poll_uqid = '$post_uq' && uid = '$u_uid'");
$amount = mysqli_num_rows($query);
if($amount == 0){
mysqli_query($conx, "INSERT INTO feed_poll_response (uid, tstamp, option_picked, poll_uqid) VALUES ('$u_uid', '$tstamp', '$post_option', '$post_uq')");
}
else {
mysqli_query($conx, "UPDATE feed_poll_response SET option_picked='$post_option' WHERE poll_uqid='$post_uq' && uid='$u_uid'");
}
}
?>

View file

@ -0,0 +1,845 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$post_id = safe($_GET['i']);
if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feed WHERE random_str='$post_id'")) != '1') {
header("location: /feed");
exit();
}
# # # # # # #
# WEBSITE LOCATION #
# # # # # # #
if($u_siteloc != '/feed') {
$loc_desc = "browsin\' feed";
mysqli_query($conx, "UPDATE accounts SET site_locdesc='$loc_desc' WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET site_locurl='/feed' WHERE uid='$u_uid'");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
#header_tds {
color: <?php echo $tdcolor; ?> !important;
}
</style>
</head>
<body>
<center>
<?php
$back_button = true;
$linebreak = true;
$alerts = true;
require_once("../inc/header.php");
# SELECT TEN POSTS FROM FEED
$feed_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,visibility,edited,img,allow_comments,is_poll FROM feed WHERE random_str='$post_id'");
while($feed_r = mysqli_fetch_assoc($feed_q)) {
// Feed data
$feed_id = $feed_r['id'];
$feed_uid = $feed_r['uid'];
$string = $feed_r['post'];
$feed_tstamp = $feed_r['tstamp'];
$feed_randomstr = $feed_r['random_str'];
$feed_visibility = $feed_r['visibility'];
$feed_edited = $feed_r['edited'];
$feed_img = $feed_r['img'];
$feed_ispoll = $feed_r['is_poll'];
$feed_allowcomments = $feed_r['allow_comments'];
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
header("location: /feed");
exit();
}
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
header("location: /feed");
exit();
}
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
// Emoji+ replacement
include("../inc/replace.php");
# SELECT ACCOUNT DATA FOR FEED POSTS
$usr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$feed_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
// Account data
$feed_username = $usr_r['username'];
$feed_picture = $usr_r['picture'];
$feed_onltime = $usr_r['online_time'];
$feed_vrf = $usr_r['md_verf'];
if($feed_vrf == 'yes') {
$verif_check = "<i style=\"font-size: 14px;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>";
}
else {
$verif_check = "";
}
//
// DATA SAVER
if($u_datasaver == 'on') {
$feed_picture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABtklEQVR4AW1TNXgUYRC9HqdvoYW+PT/c3Z0KWvqWLp7drCvuDg3uVNEGh3hyro8ZLGuz31v7n/waW33i9H/oq7SlxmrjCOGBudocI5T5yd/8n9u9fI9QX0GEG0SuEPAbq/j5F/yf2pnnE9OPldT4gQAvzu88D3ON/x/zmP9brP3p6nUvwcgZuHLsCj49/4RrJ67xt8+A+ayL0cvRYFftjRZG7o+Aa+TBCMwNofQK61h83+e6ysCLzhdo1Brg4uejs4+gZJRg+v0YvYx6u3vz1E0Uxgrw1sTnCej7dch+g1EWlzxuGLg5gKh67bxGZ6ITSlb9Jy7PJfNYt9oYGx5DVH0f+I7edQJ6UwLUnMpBo3NjJrG11cLo8Gi0ePA7hPUihJQIKSuzwV3fbNP045X5Ci26gvXMeIbuZA+kjAwlpxTVVco+3zrzTGtbNby79g6lfAnNZhPF2SJeX3mN3o29ENN9LIS6SnWVVfLC0A5jA2mNBOOkAeeMC+mIjPZ0B3cXclYGJT4hLPfvbTbw7G0tq0FIiuhO9HAij7NIqSYJl3n3ttcgdKpoYsb6MtIdKSvtknPSfC//FxxTQV29mEp6AAAAAElFTkSuQmCC";
}
// DATA SAVER
//
// Activity Dot
$new_time = time() - $feed_onltime;
$mens = round($new_time / 60);
if($mens <= 1) { $cv_activeness = "#00FF00"; } // Active within one minute
elseif($mens <= 2) { $cv_activeness = "#FFA500"; } // Active within two minutes
elseif($mens < 5) { $cv_activeness = "#FFA500"; } // Active within five minutes
else { $cv_activeness = "#FF0000"; } // Active over five minutes
# SELECT THEME COLORS FOR ACCOUNTS
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$feed_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
// Theme data
$username_color = $usri_r['username_color'];
$feed_tcolor = $usri_r['text_color'];
}
// Styling for the comment placeholders of each account attached to a post.
echo "<style type=\"text/css\">";
echo ".comment_$feed_username";
echo "[placeholder]:empty:before {";
echo "content: attr(placeholder);";
echo "color: $feed_tcolor; }</style>";
}
// If a post has more than one comment, set an 's' variable
$comcnt_q = mysqli_query($conx, "SELECT id FROM feed_comments WHERE post_id='$feed_id'");
$comcnt_r = number_format(mysqli_num_rows($comcnt_q));
if($comcnt_r != '1') { $cs = "s"; } // comment(s)
// If a post has more than one like, set an 's' variable
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') { $ls = "s"; } // like(s)
// If a post has more than one dislike, set an 's' variable
$dlikcnt_q = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id'");
$dlikcnt_r = number_format(mysqli_num_rows($dlikcnt_q));
if($dlikcnt_r != '1') { $dls = "s"; } // dislike(s)
# BEGIN ECHOING THE FEED POSTS
echo "<div class=\"feed_post\" id=\"fp_1\" style=\"background-color: $username_color;\">";
echo "<table class=\"post_table1\"><tr>";
echo "<td class=\"ptb1_td1\" style=\"color: $feed_tcolor; width: 0%;\">";
echo "<div style=\"position: relative; width: 36px; height: 36px; border-radius: 50px;\">";
echo "<div style=\"background-color: $cv_activeness; border: 2px solid $username_color; position: absolute; width: 8px; height: 8px; border-radius: 50px; display: inline-block; bottom: 0; right: 0; z-index: 3;\"></div>";
echo "<img onclick=\"window.location='/canvas/$feed_username';\" src=\"$feed_picture\" class=\"list_picture\"></div></td>";
echo "<td class=\"ptb1_td1\" style=\"text-align: left; color: $feed_tcolor;\">";
echo "<a href=\"/canvas/$feed_username\" style=\"text-decoration: none; color: $feed_tcolor; font-weight: bold;\">$feed_username $verif_check</a></td>";
echo "<td class=\"ptb1_td2\" style=\"color: $feed_tcolor;\">";
echo "<i class=\"fa fa-angle-down\" aria-hidden=\"true\" onclick=\"expand('$feed_randomstr')\"></i></td></tr></table></div>";
echo "<div id=\"$feed_randomstr\" class=\"post_more\" style=\"display: none;\">";
// State whether or not a post has been edited.
if($feed_edited == 'yes') {
echo "edited ";
}
else {
echo "posted ";
}
// State the timestamp of the post.
echo timeago($feed_tstamp); echo" ago";
// If the feed UID matches the current UID.
if($feed_uid == $u_uid) {
// Option to edit the post.
echo "&nbsp; <i onclick=\"window.location='edit.php?i=$feed_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\"></i> &nbsp; ";
// Option to remove the post.
echo "<i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
// If the feed UID does not match the current UID, but the current account is a content manager.
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
if($feed_uid != $u_uid && $u_cont_mang == 'yes') {
echo "&nbsp; <i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
echo "</div><div class=\"feed_post\" id=\"fp_2\">";
echo "<div class=\"fp_3\">";
// Echo the post content.
echo bbc(atname(nl2br($string)));
if($feed_ispoll == 'yes') {
echo "<div id=\"innerpoll_$feed_randomstr\">";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
# SELECT POLL DATA FOR THE POST
$fpoll_q = mysqli_query($conx, "SELECT * FROM feed_polls WHERE uqid='$feed_randomstr'");
while($fpoll_r = mysqli_fetch_assoc($fpoll_q)) {
// poll data
$fpoll_question = $fpoll_r['poll_question'];
$fpoll_opt1 = $fpoll_r['poll_opt1'];
$fpoll_opt2 = $fpoll_r['poll_opt2'];
$fpoll_opt3 = $fpoll_r['poll_opt3'];
$fpoll_opt4 = $fpoll_r['poll_opt4'];
$fpoll_opt5 = $fpoll_r['poll_opt5'];
$fpoll_istimed = $fpoll_r['is_timed'];
$fpoll_tstmpend = $fpoll_r['tstamp_end'];
if(strlen($fpoll_opt1) >= 30) {
$fpoll_optc1 = trim(substr($fpoll_opt1,0,30)) . "...";
}
else {
$fpoll_optc1 = $fpoll_opt1;
}
if(strlen($fpoll_opt2) >= 30) {
$fpoll_optc2 = trim(substr($fpoll_opt2,0,30)) . "...";
}
else {
$fpoll_optc2 = $fpoll_opt2;
}
if(strlen($fpoll_opt3) >= 30) {
$fpoll_optc3 = trim(substr($fpoll_opt3,0,30)) . "...";
}
else {
$fpoll_optc3 = $fpoll_opt3;
}
if(strlen($fpoll_opt4) >= 30) {
$fpoll_optc4 = trim(substr($fpoll_opt4,0,30)) . "...";
}
else {
$fpoll_optc4 = $fpoll_opt4;
}
if(strlen($fpoll_opt5) >= 30) {
$fpoll_optc5 = trim(substr($fpoll_opt5,0,30)) . "...";
}
else {
$fpoll_optc5 = $fpoll_opt5;
}
}
# SELECT RESPONSE DATA FOR THE POLL
$fpoll_response_q = mysqli_query($conx, "SELECT * FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && uid='$u_uid'");
while($fpoll_response_r = mysqli_fetch_assoc($fpoll_response_q)) {
// poll response data
$fpoll_option_picked = $fpoll_response_r['option_picked'];
}
echo "<br>";
if($fpoll_option_picked != '') {
$current_can_vote = "no";
}
else {
$current_can_vote = "yes";
}
// total vote count
$rest_c = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr'");
$optt_cnt = mysqli_num_rows($rest_c);
// count number of votes for each option
$res_c1 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='1'");
$opt1_cnt = mysqli_num_rows($res_c1);
if($opt1_cnt != '1') {
$count1_s = "s";
}
$res_c2 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='2'");
$opt2_cnt = mysqli_num_rows($res_c2);
if($opt2_cnt != '1') {
$count2_s = "s";
}
$res_c3 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='3'");
$opt3_cnt = mysqli_num_rows($res_c3);
if($opt3_cnt != '1') {
$count3_s = "s";
}
$res_c4 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='4'");
$opt4_cnt = mysqli_num_rows($res_c4);
if($opt4_cnt != '1') {
$count4_s = "s";
}
$res_c5 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='5'");
$opt5_cnt = mysqli_num_rows($res_c5);
if($opt5_cnt != '1') {
$count5_s = "s";
}
if($fpoll_option_picked == '1') {
$current_picked1 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '2') {
$current_picked2 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '3') {
$current_picked3 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '4') {
$current_picked4 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '5') {
$current_picked5 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
echo "<span style=\"font-size: 12px; color: #808080;\">A poll has been attached to this post. <br> </span>";
if($fpoll_istimed == 'yes') {
echo "<span style=\"font-size: 12px; color: #808080;\">There is a time limit- it will stop accepting responses in ";
echo polltime($fpoll_tstmpend);
echo ".</span>";
}
else {
echo "<span style=\"font-size: 12px; color: #808080;\">There is no time limit set- responses are always accepted.</span>";
}
echo "<br><br><table style=\"width: 100%;\"><tr>";
echo "<td>";
echo "<span style=\"color: $username_color; font-weight: bold;\">$feed_username $verif_check</span><br>";
echo "</td>";
echo "</tr></table>";
echo "<div style=\"border-radius: 8em; background-color: $username_color; padding: 8px; display: inline-block;\">";
echo "<table style=\"width: 100%;\"><tr>";
echo "<td style=\"font-weight: bold; color: $feed_tcolor; padding-left: 12px; padding-right: 12px;\">";
echo "$fpoll_question";
echo "</td>";
echo "</tr></table>";
echo "</div> <br><br>";
echo "<span style=\"font-size: 12px; color: #808080;\">Select your response by tapping one of the options below.</span><br>";
if($current_can_vote == 'no') {
echo "<span style=\"font-size: 12px; color: #808080;\">You can change your response by tapping a new option.</span><br>";
}
echo "<br><table style=\"text-align: center; font-weight: bold; width: 100%;\"><tr>";
echo "<td onclick=\"pollVote('1','$feed_randomstr');\" style=\"$current_picked1;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt1";
echo "</td>";
echo "<td onclick=\"pollVote('2','$feed_randomstr');\" style=\"$current_picked2;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt2";
echo "</td>";
if($fpoll_opt3 != '') {
echo "<td onclick=\"pollVote('3','$feed_randomstr');\" style=\"$current_picked3;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt3";
echo "</td>";
}
if($fpoll_opt4 != '') {
echo "<td onclick=\"pollVote('4','$feed_randomstr');\" style=\"$current_picked4;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt4";
echo "</td>";
}
if($fpoll_opt5 != '') {
echo "<td onclick=\"pollVote('5','$feed_randomstr');\" style=\"$current_picked5;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt5";
echo "</td>";
}
echo "</tr></table>";
echo "<div id=\"presults_$feed_randomstr\">";
echo "<br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt1_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc1\"</span><br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt2_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc2\"</span><br>";
if($fpoll_opt3 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt3_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc3\"</span><br>";
}
if($fpoll_opt4 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt4_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc4\"</span><br>";
}
if($fpoll_opt5 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt5_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc5\"</span><br>";
}
echo "<br><span style=\"color: #808080; font-size: 14px; font-weight: bold;\">Total Votes Received:</span> <span style=\"color: #808080; font-size: 14px;\">$optt_cnt</span><br>";
echo "</div>";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
echo "</div>";
}
echo "</div><table class=\"post_table2\"><tr>";
echo "<td class=\"ptb2_td1\">";
// Like count within the post.
echo "<span id=\"likecnt_$feed_id\">";
echo "$likcnt_r like$ls";
echo "</span> &nbsp;&nbsp; ";
// Dislike count within the post.
echo "<span id=\"dlikecnt_$feed_id\">";
echo "$dlikcnt_r dislike$dls";
echo "</span></td><td id=\"ccmt_cnt\" class=\"ptb2_td2\">";
// Comment count within the post.
echo "<span id=\"mpcomment_count\">";
echo "$comcnt_r comment$cs";
echo "</span></td></tr></table>";
echo "<center><table class=\"post_table3\"><tr>";
echo "<td id=\"post_id_$feed_id\" class=\"ptb3_td1\">";
# Determine whether or not the current account has liked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == 0) { // Current account has not liked the post.
echo "<i class='fa fa-thumbs-up'></i> like";
}
else { // Current account has like the post.
echo "<span><i class='fa fa-thumbs-up'></i></span> unlike";
}
echo "</td><td id=\"$feed_randomstr\" class=\"ptb3_td2\" onclick=\"showComments(this);\">";
echo "<i class=\"fa fa-comment\" aria-hidden=\"true\"></i> ";
echo "<span id=\"cmtbtn_$feed_randomstr\">comment</span></td>";
echo "<td id=\"dpost_id_$feed_id\" class=\"ptb3_td3\">";
# Determine whether or not the current account has disliked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == "0") { // Current account has not disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> dislike";
}
else { // Current account has disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> undislike";
}
echo "</td></tr></table>";
echo "<div id=\"comments_$feed_randomstr\" style=\"display: none;\">";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div id=\"infosies_$feed_id\" style=\"font-family: 'Dosis', sans-serif; text-align: left; padding-bottom: 8px; padding-right: 8px; padding-left: 8px; font-size: 13px; color: #808080;\">";
include("dis_like_infosies.php");
echo "</div>";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div style=\"background-color: $username_color; width: 97%; padding: 8px;\">";
echo "<table style=\"width: 95%; text-align: center;\"><tr>";
echo "<td style=\"width: 100%;word-break:break-word;\">";
echo "<input type=\"hidden\" name=\"feedc_id\" value=\"$feed_randomstr\">";
// Write a comment.
// If commenting is available.
if($feed_allowcomments == 'yes') {
echo "<div name=\"body\" class=\"comment_$feed_username\" id=\"comment_$feed_randomstr\" placeholder=\"Write a comment...\" style=\"font-family: 'Dosis', sans-serif; font-size: 15px; color: $feed_tcolor; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; background-color: $username_color; width: 98%; outline: none; text-align: left;\" contenteditable></div></td>";
}
else {
echo "<div name=\"body\" class=\"comment_$feed_username\" id=\"comment_$feed_randomstr\" placeholder=\"Comments disabled.\" style=\"font-family: 'Dosis', sans-serif; font-size: 15px; color: $feed_tcolor; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; background-color: $username_color; width: 98%; outline: none; text-align: left;\"></div></td>";
}
echo "<td><button onclick=\"pComment('$feed_randomstr')\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
echo "<i class=\"fa fa-pencil\" aria-hidden=\"true\"></i></button>";
if($feed_allowcomments == 'yes') {
echo "</td><td><button onclick=\"cselectFile('$feed_randomstr');\" id=\"cfPath_$feed_randomstr\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
}
else {
echo "</td><td><button id=\"cfPath_$feed_randomstr\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
}
echo "<span id=\"cloader_$feed_randomstr\">";
echo "<i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>";
echo "</span></button></td></tr></table>";
echo "<form id=\"cimgUpl_$feed_randomstr\" action=\"img_upload.php\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" id=\"cfeedc_id\" value=\"$feed_randomstr\">";
echo "<input id=\"cfBrowse_$feed_randomstr\" name=\"img\" type=\"file\" style=\"display: none;\">";
echo "</form></div>";
echo "<div id=\"comments_inner_$feed_randomstr\"></div>";
echo "</div></center></div>";
echo "<br>";
}
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
function pollVote(op,uq) {
var token = "<?php echo $u_token;?>";
$.ajax({
url: 'poll_vote.php',
type: 'POST',
data: { uq: uq, op: op, token: token },
success: function(){
pollRefresh(uq);
},
error: function() {
pollRefresh(uq);
}
});
}
function updInfosies(i) {
$.get("dis_like_infosies.php?i=" + i, function(d) {
$("#infosies_" + i).html(d);
});
}
// THE FOLLOWING SCRIPT WAS
// MADE BY MARIOERMANDO
// GIVEN BY ANGEL
// PERFECTED BY JUSTIN
var likeBtns = document.querySelectorAll("td[id^=post_id_]");
[].forEach.call(likeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("likecnt_" + likes);
xhr.open("GET", "like.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "count.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
alert("error");
count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var dlikeBtns = document.querySelectorAll("td[id^=dpost_id_]");
[].forEach.call(dlikeBtns, function(btn) {
btn.onclick = function(e){
var xhr = new XMLHttpRequest();
var a = new XMLHttpRequest();
var likes = btn.id.match(/([0-9]*)$/)[0];
var count = document.getElementById("dlikecnt_" + likes);
xhr.open("GET", "dislike.php?id=" + btn.id.match(/([0-9]*)$/)[0] + "&_t=" + Math.random() + "&token=<?php echo $u_token; ?>", true);
xhr.onreadystatechange = function(){
if (xhr.readyState == 4)
if(xhr.status == 200) {
btn.innerHTML = xhr.responseText;
}
a.open("GET", "dcount.php?id=" + btn.id.match(/([0-9]*)$/)[0], true);
a.onreadystatechange = function(){
if (a.readyState == 4)
if(a.status == 200) {
count.innerHTML = a.responseText;
updInfosies(btn.id.match(/([0-9]*)$/)[0]);
}
else{
alert("error");
count.innerHTML = "error";
}
};
a.send();
};
xhr.send();
count.innerHTML = "...";
return false;
};
});
var Del = document.querySelectorAll("i[id^=pdel_]");
[].forEach.call(Del, function(dt){
dt.onclick = function(e){
if (confirm("Delete?")) {
var dto = new XMLHttpRequest();
dto.open("GET", "delete.php?id=" + dt.id.match(/([0-9]*)$/)[0], true);
dto.onreadystatechange = function(){
if (dto.readyState == 4)
if(dto.status == 200) {
alert("success \n redirecting...");
window.location = "https://www.misdew.com/feed";
}
else {
alert("success \n redirecting...");
window.location = "https://www.misdew.com/feed";
}
};
dto.send();
return false;
}
};
});
function pollRefresh(uq) {
var rstr = uq;
var e = "innerpoll_" + rstr;
var e = document.getElementById(e);
// Fetch poll for the post
var getpolls = new XMLHttpRequest();
getpolls.open("GET", "inner_poll.php?uq=" + rstr, true);
getpolls.onreadystatechange = function(){
if(getpolls.readyState == 4)
if(getpolls.status == 200) {
var inn_polls = getpolls.responseText;
document.getElementById("innerpoll_" + rstr).innerHTML = inn_polls;
}
else {
alert("error");
}
};
getpolls.send();
return false;
}
/**
* Returns the style for a node.
*
* @param n The node to check.
* @param p The property to retrieve (usually 'display').
* @link http://www.quirksmode.org/dom/getstyles.html
*/
function getNodeStyle( n, p ) {
return n.currentStyle ?
n.currentStyle[p] :
document.defaultView.getComputedStyle(n, null).getPropertyValue(p);
}
//IF THE NODE IS NOT ACTUALLY IN THE DOM then this won't take into account <div style="display: inline;">text</div>
//however for simple things like `contenteditable` this is sufficient, however for arbitrary html this will not work
function isNodeBlock(node) {
if (node.nodeType == document.TEXT_NODE) {return false;}
var d = getNodeStyle( node, 'display' );//this is irrelevant if the node isn't currently in the current DOM.
if (d.match( /^block/ ) || d.match( /list/ ) || d.match( /row/ ) ||
node.tagName == 'BR' || node.tagName == 'HR' ||
node.tagName == 'DIV' // div,p,... add as needed to support non-DOM nodes
) {
return true;
}
return false;
}
/**
* Converts HTML to text, preserving semantic newlines for block-level
* elements.
*
* @param node - The HTML node to perform text extraction.
*/
function htmlToText( htmlOrNode, isNode ) {
var node = htmlOrNode;
if (!isNode) {node = jQuery("<span>"+htmlOrNode+"</span>")[0];}
//TODO: inject "unsafe" HTML into current DOM while guaranteeing that it won't
// change the visible DOM so that `isNodeBlock` will work reliably
var result = '';
if( node.nodeType == document.TEXT_NODE ) {
// Replace repeated spaces, newlines, and tabs with a single space.
result = node.nodeValue.replace( /\s+/g, ' ' );
} else {
for( var i = 0, j = node.childNodes.length; i < j; i++ ) {
result += htmlToText( node.childNodes[i], true );
if (i < j-1) {
if (isNodeBlock(node.childNodes[i])) {
result += '\n';
} else if (isNodeBlock(node.childNodes[i+1]) &&
node.childNodes[i+1].tagName != 'BR' &&
node.childNodes[i+1].tagName != 'HR') {
result += '\n';
}
}
}
}
return result;
}
// Post comment to a post.
function pComment(feed_randomstr) {
// Get the content of the editable div.
var comment_input_id = $('#comment_' + feed_randomstr).html();
// Convert the content.
var comment_input = htmlToText(comment_input_id);
// Post the content.
if(comment_input.trim() != '') {
$.ajax({
url: 'cmtp.php?i=' + feed_randomstr,
type: 'POST',
data: { body: comment_input },
success: function(){
$('#comment_' + feed_randomstr).empty();
commentsUp(feed_randomstr);
},
error: function() {
$('#comment_' + feed_randomstr).empty();
commentsUp(feed_randomstr);
}
});
}
}
function cselectFile(feed_randomstr) {
document.getElementById('cfBrowse_' + feed_randomstr).click();
document.getElementById('cfPath_' + feed_randomstr).value = document.getElementById('cfBrowse_' + feed_randomstr).value;
imgcUpl(feed_randomstr);
}
function imgcUpl(feed_randomstr) {
var form = document.forms.namedItem("cimgUpl_" + feed_randomstr);
form.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(form);
var oReq = new XMLHttpRequest();
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>";
oReq.open("POST", "img_upload.php", true);
oReq.onload = function(oEvent) {
if (oReq.status == 200) {
var cpic = oReq.responseText;
if(cpic != '') {
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>";
var adpti = "[img=50% auto]" + cpic + "[/img]";
document.getElementById("comment_" + feed_randomstr).innerHTML = document.getElementById("comment_" + feed_randomstr).innerHTML + adpti;
setEndOfContenteditable(document.getElementById("comment_" + feed_randomstr));
}
else
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i>";
form.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
}
function setEndOfContenteditable(contentEditableElement)
{
var range,selection;
if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
{
range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
selection.addRange(range);//make the range you have just created the visible selection
}
else if(document.selection)//IE 8 and lower
{
range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)
range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
range.select();//Select the range (make it the visible selection
}
}
function showComments(comments) {
var rstr = comments.id;
var e = "comments_" + rstr;
var e = document.getElementById(e);
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment..";
// Fetch comments for the post
var getcmts = new XMLHttpRequest();
getcmts.open("GET", "inner_comments.php?i=" + rstr, true);
getcmts.onreadystatechange = function(){
if(getcmts.readyState == 4)
if(getcmts.status == 200) {
var inn_comments = getcmts.responseText;
document.getElementById("comments_inner_" + rstr).innerHTML = inn_comments;
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment";
if(e.style.display == '')
e.style.display = 'none';
else
e.style.display = '';
}
else {
alert("error");
}
};
getcmts.send();
return false;
}
function commentsUp(fdid) {
var rstr = fdid;
var e = "comments_" + rstr;
var e = document.getElementById(e);
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment..";
// Fetch comments for the post
var getcmts = new XMLHttpRequest();
getcmts.open("GET", "inner_comments.php?i=" + rstr, true);
getcmts.onreadystatechange = function(){
if(getcmts.readyState == 4)
if(getcmts.status == 200) {
var inn_comments = getcmts.responseText;
document.getElementById("comments_inner_" + rstr).innerHTML = inn_comments;
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment";
}
else {
alert("error");
}
};
getcmts.send();
var mainPC = document.getElementById("mpcomment_count");
var xhr = new XMLHttpRequest();
xhr.open("GET", "mpcomments.php?i=" + rstr, true);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4)
if(xhr.status == 200) {
mainPC.innerHTML = xhr.responseText;
}
else {
alert("error");
mainPC.innerHTML = "error";
}
};
xhr.send();
mainPC.innerHTML = "...";
return false;
}
function expand(id) {
var e = document.getElementById(id);
if(e.style.display == '')
e.style.display = 'none';
else
e.style.display = '';
}
function loadmore() {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var amount = document.getElementById("amount").value;
var content = document.getElementById("ld_posts");
$.ajax({
type: 'get',
url: 'moreposts.php',
data: {
amntcnt:amount
},
success: function(more_content) {
content.innerHTML = content.innerHTML+more_content;
document.getElementById("amount").value = Number(amount)+10;
}
});
var getcount = new XMLHttpRequest();
getcount.open("GET", "contamnt.php", true);
getcount.onreadystatechange = function(){
if(getcount.readyState == 4)
if(getcount.status == 200) {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var numCont = getcount.responseText;
if(numCont <= Number(amount) + 10) {
document.getElementById("more_div").innerHTML = "";
}
}
else{
alert("error");
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
}
};
getcount.send();
return false;
}// Delete comment from a post.
function dComment(feed_randomstr, comment_id) {
if (confirm("Delete?")) {
$.ajax({
url: 'delcmnt.php',
type: 'GET',
data: { id: comment_id },
success: function(){
commentsUp(feed_randomstr);
},
error: function() {
//alert("error");
commentsUp(feed_randomstr);
}
});
}
}
</script>
</body>
</html>

View file

@ -0,0 +1,738 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
function polltime($session_time) {
$time_difference = $session_time - time();
$seconds = $time_difference;
$minutes = round($time_difference/60);
$hours = round($time_difference/3600);
$days = round($time_difference/86400);
$weeks = round($time_difference/604800);
$months = round($time_difference/2419200);
$years = round($time_difference/29030400);
$s_ago = "s"; $m_ago = "m"; $h_ago = "h"; $w_ago = "w"; $d_ago = "d";
if($seconds <= 59) { echo "$seconds$s_ago"; }
else if($minutes <= 59) {
if($minutes == 1) { echo "1$m_ago"; }
else { echo "$minutes$m_ago"; }
}
else if($hours <= 23) {
if($hours == 1) { echo "1$h_ago"; }
else { echo "$hours$h_ago"; }
}
else if($days <= 6) {
if($days == 1) { echo "1$d_ago"; }
else { echo "$days$d_ago"; }
}
else if($weeks > 0) {
if($weeks == 1) { echo "1$w_ago"; }
else { echo "$weeks$w_ago"; }
}
}
# SELECT TEN POSTS FROM FEED
$feed_q = mysqli_query($conx, "SELECT id,is_poll,uid,post,tstamp,random_str,visibility,edited,img,allow_comments FROM feed ORDER BY id DESC LIMIT 10");
while($feed_r = mysqli_fetch_assoc($feed_q)) {
// Feed data
$feed_id = $feed_r['id'];
$feed_uid = $feed_r['uid'];
$string = $feed_r['post'];
$feed_tstamp = $feed_r['tstamp'];
$feed_randomstr = $feed_r['random_str'];
$feed_visibility = $feed_r['visibility'];
$feed_edited = $feed_r['edited'];
$feed_img = $feed_r['img'];
$feed_allowcomments = $feed_r['allow_comments'];
$feed_is_poll = $feed_r['is_poll'];
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$feed_uid = "286";
}
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$feed_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$feed_uid = "286";
}
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
// Emoji+ replacement
include("../inc/replace.php");
# SELECT ACCOUNT DATA FOR FEED POSTS
$usr_q = mysqli_query($conx, "SELECT username,picture,online_time,md_verf FROM accounts WHERE uid='$feed_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
// Account data
$feed_username = $usr_r['username'];
$feed_picture = $usr_r['picture'];
$feed_onltime = $usr_r['online_time'];
$feed_vrf = $usr_r['md_verf'];
if($feed_vrf == 'yes') {
$verif_check = "<i style=\"font-size: 14px;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>";
}
else {
$verif_check = "";
}
//
// DATA SAVER
if($u_datasaver == 'on') {
$feed_picture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAABtklEQVR4AW1TNXgUYRC9HqdvoYW+PT/c3Z0KWvqWLp7drCvuDg3uVNEGh3hyro8ZLGuz31v7n/waW33i9H/oq7SlxmrjCOGBudocI5T5yd/8n9u9fI9QX0GEG0SuEPAbq/j5F/yf2pnnE9OPldT4gQAvzu88D3ON/x/zmP9brP3p6nUvwcgZuHLsCj49/4RrJ67xt8+A+ayL0cvRYFftjRZG7o+Aa+TBCMwNofQK61h83+e6ysCLzhdo1Brg4uejs4+gZJRg+v0YvYx6u3vz1E0Uxgrw1sTnCej7dch+g1EWlzxuGLg5gKh67bxGZ6ITSlb9Jy7PJfNYt9oYGx5DVH0f+I7edQJ6UwLUnMpBo3NjJrG11cLo8Gi0ePA7hPUihJQIKSuzwV3fbNP045X5Ci26gvXMeIbuZA+kjAwlpxTVVco+3zrzTGtbNby79g6lfAnNZhPF2SJeX3mN3o29ENN9LIS6SnWVVfLC0A5jA2mNBOOkAeeMC+mIjPZ0B3cXclYGJT4hLPfvbTbw7G0tq0FIiuhO9HAij7NIqSYJl3n3ttcgdKpoYsb6MtIdKSvtknPSfC//FxxTQV29mEp6AAAAAElFTkSuQmCC";
}
// DATA SAVER
//
// Activity Dot
$new_time = time() - $feed_onltime;
$mens = round($new_time / 60);
if($mens <= 1) { $cv_activeness = "#00FF00"; } // Active within one minute
elseif($mens <= 2) { $cv_activeness = "#FFA500"; } // Active within two minutes
elseif($mens < 5) { $cv_activeness = "#FF0000"; } // Active within five minutes
else { $cv_activeness = "#FF0000"; } // Active over five minutes
# SELECT THEME COLORS FOR ACCOUNTS
$usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$feed_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
// Theme data
$username_color = $usri_r['username_color'];
$feed_tcolor = $usri_r['text_color'];
}
// Styling for the comment placeholders of each account attached to a post.
echo "<style type=\"text/css\">";
echo ".comment_$feed_username";
echo "[placeholder]:empty:before {";
echo "content: attr(placeholder);";
echo "color: $feed_tcolor; }</style>";
}
// If a post has more than one comment, set an 's' variable
$comcnt_q = mysqli_query($conx, "SELECT id FROM feed_comments WHERE post_id='$feed_id'");
$comcnt_r = number_format(mysqli_num_rows($comcnt_q));
if($comcnt_r == '1') { $cs = ""; } else { $cs = "s"; } // comment(s)
// If a post has more than one like, set an 's' variable
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r == '1') { $ls = ""; } else { $ls = "s"; } // like(s)
// If a post has more than one dislike, set an 's' variable
$dlikcnt_q = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id'");
$dlikcnt_r = number_format(mysqli_num_rows($dlikcnt_q));
if($dlikcnt_r == '1') { $dls = ""; } else { $dls = "s"; } // dislike(s)
# BEGIN ECHOING THE FEED POSTS
if($feed_uid != '286') {
echo "<div class=\"feed_post\" id=\"fp_1\" style=\"background-color: $username_color;\">";
echo "<table class=\"post_table1\"><tr>";
echo "<td class=\"ptb1_td1\" style=\"color: $feed_tcolor; width: 0%;\">";
echo "<div style=\"position: relative; width: 36px; height: 36px; border-radius: 50px;\">";
echo "<div style=\"background-color: $cv_activeness; border: 2px solid $username_color; position: absolute; width: 8px; height: 8px; border-radius: 50px; display: inline-block; bottom: 0; right: 0; z-index: 3;\"></div>";
echo "<img onclick=\"window.location='/canvas/$feed_username';\" src=\"$feed_picture\" class=\"list_picture\"></div></td>";
echo "<td class=\"ptb1_td1\" style=\"text-align: left; color: $feed_tcolor;\">";
echo "<a href=\"/canvas/$feed_username\" style=\"text-decoration: none; color: $feed_tcolor; font-weight: bold;\">$feed_username $verif_check</a></td>";
echo "<td class=\"ptb1_td2\" style=\"color: $feed_tcolor;\">";
echo "<i class=\"fa fa-angle-down\" aria-hidden=\"true\" onclick=\"expand('$feed_randomstr')\"></i></td></tr></table></div>";
echo "<div id=\"$feed_randomstr\" class=\"post_more\" style=\"display: none;\">";
// State whether or not a post has been edited.
if($feed_edited == 'yes') {
echo "edited ";
}
else {
echo "posted ";
}
// State the timestamp of the post.
echo timeago($feed_tstamp); echo" ago";
// If the feed UID matches the current UID.
if($feed_uid == $u_uid) {
// Option to edit the post.
echo "&nbsp; <i onclick=\"window.location='edit.php?i=$feed_randomstr';\" class=\"fa fa-pencil\" aria-hidden=\"true\"></i> &nbsp; ";
// Option to remove the post.
echo "<i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
// If the feed UID does not match the current UID, but the current account is a content manager.
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
if($feed_uid != $u_uid && $u_cont_mang == 'yes') {
echo "&nbsp; &nbsp; <i class=\"fa fa-trash\" aria-hidden=\"true\" id=\"pdel_$feed_id\"></i>";
}
echo "&nbsp; <i onclick=\"window.location='post.php?i=$feed_randomstr';\" class=\"fa fa-expand\" aria-hidden=\"true\"></i>";
########## YOU WILL NEED TO MODIFY THIS CODE TO MATCH CANVAS STANDARDS FOR ROLES ##########
echo "</div><div class=\"feed_post\" id=\"fp_2\">";
echo "<div class=\"fp_3\">";
// Echo the post content.
echo bbc(atname(nl2br($string)));
if($feed_is_poll == 'yes') {
echo "<div id=\"innerpoll_$feed_randomstr\">";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
# SELECT POLL DATA FOR THE POST
$fpoll_q = mysqli_query($conx, "SELECT * FROM feed_polls WHERE uqid='$feed_randomstr'");
while($fpoll_r = mysqli_fetch_assoc($fpoll_q)) {
// poll data
$fpoll_question = $fpoll_r['poll_question'];
$fpoll_opt1 = $fpoll_r['poll_opt1'];
$fpoll_opt2 = $fpoll_r['poll_opt2'];
$fpoll_opt3 = $fpoll_r['poll_opt3'];
$fpoll_opt4 = $fpoll_r['poll_opt4'];
$fpoll_opt5 = $fpoll_r['poll_opt5'];
$fpoll_istimed = $fpoll_r['is_timed'];
$fpoll_tstmpend = $fpoll_r['tstamp_end'];
if(strlen($fpoll_opt1) >= 30) {
$fpoll_optc1 = trim(substr($fpoll_opt1,0,30)) . "...";
}
else {
$fpoll_optc1 = $fpoll_opt1;
}
if(strlen($fpoll_opt2) >= 30) {
$fpoll_optc2 = trim(substr($fpoll_opt2,0,30)) . "...";
}
else {
$fpoll_optc2 = $fpoll_opt2;
}
if(strlen($fpoll_opt3) >= 30) {
$fpoll_optc3 = trim(substr($fpoll_opt3,0,30)) . "...";
}
else {
$fpoll_optc3 = $fpoll_opt3;
}
if(strlen($fpoll_opt4) >= 30) {
$fpoll_optc4 = trim(substr($fpoll_opt4,0,30)) . "...";
}
else {
$fpoll_optc4 = $fpoll_opt4;
}
if(strlen($fpoll_opt5) >= 30) {
$fpoll_optc5 = trim(substr($fpoll_opt5,0,30)) . "...";
}
else {
$fpoll_optc5 = $fpoll_opt5;
}
}
# SELECT RESPONSE DATA FOR THE POLL
$fpoll_response_q = mysqli_query($conx, "SELECT * FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && uid='$u_uid'");
while($fpoll_response_r = mysqli_fetch_assoc($fpoll_response_q)) {
// poll response data
$fpoll_option_picked = $fpoll_response_r['option_picked'];
}
echo "<br>";
if($fpoll_option_picked != '') {
$current_can_vote = "no";
}
else {
$current_can_vote = "yes";
}
// total vote count
$rest_c = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr'");
$optt_cnt = mysqli_num_rows($rest_c);
// count number of votes for each option
$res_c1 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='1'");
$opt1_cnt = mysqli_num_rows($res_c1);
if($opt1_cnt != '1') {
$count1_s = "s";
}
$res_c2 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='2'");
$opt2_cnt = mysqli_num_rows($res_c2);
if($opt2_cnt != '1') {
$count2_s = "s";
}
$res_c3 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='3'");
$opt3_cnt = mysqli_num_rows($res_c3);
if($opt3_cnt != '1') {
$count3_s = "s";
}
$res_c4 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='4'");
$opt4_cnt = mysqli_num_rows($res_c4);
if($opt4_cnt != '1') {
$count4_s = "s";
}
$res_c5 = mysqli_query($conx, "SELECT uid FROM feed_poll_response WHERE poll_uqid='$feed_randomstr' && option_picked='5'");
$opt5_cnt = mysqli_num_rows($res_c5);
if($opt5_cnt != '1') {
$count5_s = "s";
}
if($fpoll_option_picked == '1') {
$current_picked1 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '2') {
$current_picked2 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '3') {
$current_picked3 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '4') {
$current_picked4 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
if($fpoll_option_picked == '5') {
$current_picked5 = "background-color: $username_color !important; color: $feed_tcolor !important";
}
echo "<span style=\"font-size: 12px; color: #808080;\">A poll has been attached to this post. <br> </span>";
if($fpoll_istimed == 'yes') {
echo "<span style=\"font-size: 12px; color: #808080;\">There is a time limit- it will stop accepting responses in ";
echo polltime($fpoll_tstmpend);
echo ".</span>";
}
else {
echo "<span style=\"font-size: 12px; color: #808080;\">There is no time limit set- responses are always accepted.</span>";
}
echo "<br><br><table style=\"width: 100%;\"><tr>";
echo "<td>";
echo "<span style=\"color: $username_color; font-weight: bold;\">$feed_username $verif_check</span><br>";
echo "</td>";
echo "</tr></table>";
echo "<div style=\"border-radius: 8em; background-color: $username_color; padding: 8px; display: inline-block;\">";
echo "<table style=\"width: 100%;\"><tr>";
echo "<td style=\"font-weight: bold; color: $feed_tcolor; padding-left: 12px; padding-right: 12px;\">";
echo "$fpoll_question";
echo "</td>";
echo "</tr></table>";
echo "</div> <br><br>";
echo "<span style=\"font-size: 12px; color: #808080;\">Select your response by tapping one of the options below.</span><br>";
if($current_can_vote == 'no') {
echo "<span style=\"font-size: 12px; color: #808080;\">You can change your response by tapping a new option.</span><br>";
}
echo "<br><table style=\"text-align: center; font-weight: bold; width: 100%;\"><tr>";
echo "<td onclick=\"pollVote('1','$feed_randomstr');\" style=\"$current_picked1;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt1";
echo "</td>";
echo "<td onclick=\"pollVote('2','$feed_randomstr');\" style=\"$current_picked2;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt2";
echo "</td>";
if($fpoll_opt3 != '') {
echo "<td onclick=\"pollVote('3','$feed_randomstr');\" style=\"$current_picked3;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt3";
echo "</td>";
}
if($fpoll_opt4 != '') {
echo "<td onclick=\"pollVote('4','$feed_randomstr');\" style=\"$current_picked4;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt4";
echo "</td>";
}
if($fpoll_opt5 != '') {
echo "<td onclick=\"pollVote('5','$feed_randomstr');\" style=\"$current_picked5;border-radius: 12px; padding: 4px; border: 3px solid $username_color; color: $username_color;\">";
echo "$fpoll_opt5";
echo "</td>";
}
echo "</tr></table>";
echo "<div id=\"presults_$feed_randomstr\">";
echo "<br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt1_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc1\"</span><br>";
echo "<span style=\"color: #808080; font-size: 14px;\">$opt2_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc2\"</span><br>";
if($fpoll_opt3 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt3_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc3\"</span><br>";
}
if($fpoll_opt4 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt4_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc4\"</span><br>";
}
if($fpoll_opt5 != '') {
echo "<span style=\"color: #808080; font-size: 14px;\">$opt5_cnt voted </span> <span style=\"color: #808080; font-size: 14px; font-weight: bold;\">\"$fpoll_optc5\"</span><br>";
}
echo "<br><span style=\"color: #808080; font-size: 14px; font-weight: bold;\">Total Votes Received:</span> <span style=\"color: #808080; font-size: 14px;\">$optt_cnt</span><br>";
echo "</div>";
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
// Added Feed polls. 2021
echo "</div>";
}
echo "</div><table class=\"post_table2\"><tr>";
echo "<td class=\"ptb2_td1\">";
// Like count within the post.
echo "<span id=\"likecnt_$feed_id\">";
echo "$likcnt_r like$ls";
echo "</span> &nbsp;&nbsp; ";
// Dislike count within the post.
echo "<span id=\"dlikecnt_$feed_id\">";
echo "$dlikcnt_r dislike$dls";
echo "</span></td><td id=\"ccmt_cnt\" class=\"ptb2_td2\">";
// Comment count within the post.
echo "<span id=\"mpcomment_count\">";
echo "$comcnt_r comment$cs";
echo "</span></td></tr></table>";
echo "<center><table class=\"post_table3\"><tr>";
echo "<td id=\"post_id_$feed_id\" class=\"ptb3_td1\">";
# Determine whether or not the current account has liked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == 0) { // Current account has not liked the post.
echo "<i class='fa fa-thumbs-up'></i> like";
}
else { // Current account has like the post.
echo "<span><i class='fa fa-thumbs-up'></i></span> unlike";
}
echo "</td><td id=\"$feed_randomstr\" class=\"ptb3_td2\" onclick=\"showComments(this);\">";
echo "<i class=\"fa fa-comment\" aria-hidden=\"true\"></i> ";
echo "<span id=\"cmtbtn_$feed_randomstr\">comment</span></td>";
echo "<td id=\"dpost_id_$feed_id\" class=\"ptb3_td3\">";
# Determine whether or not the current account has disliked the post.
$gett = mysqli_query($conx, "SELECT id FROM feed_dislikes WHERE post_id='$feed_id' && uid='$u_uid'");
$isit = number_format(mysqli_num_rows($gett));
if($isit == "0") { // Current account has not disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> dislike";
}
else { // Current account has disliked the post.
echo "<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> undislike";
}
echo "</td></tr></table>";
echo "<div id=\"comments_$feed_randomstr\" style=\"display: none;\">";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div id=\"infosies_$feed_id\" style=\"font-family: 'Dosis', sans-serif; text-align: left; padding-bottom: 8px; padding-right: 8px; padding-left: 8px; font-size: 13px; color: #808080;\">";
include("dis_like_infosies.php");
echo "</div>";
/* LIST OF LIKES */
/* LIST OF LIKES */
echo "<div style=\"background-color: $username_color; width: 99%; padding: 5px;\">";
echo "<table style=\"width: 95%; text-align: center;\"><tr>";
echo "<td style=\"width: 100%;word-break:break-word;\">";
echo "<input type=\"hidden\" name=\"feedc_id\" value=\"$feed_randomstr\">";
// Write a comment.
// If commenting is available.
if($feed_allowcomments == 'yes') {
echo "<div name=\"body\" class=\"comment_$feed_username\" id=\"comment_$feed_randomstr\" placeholder=\"Write a comment...\" style=\"font-family: 'Dosis', sans-serif; font-size: 15px; color: $feed_tcolor; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; background-color: $username_color; width: 98%; outline: none; text-align: left;\" contenteditable></div></td>";
}
else {
echo "<div name=\"body\" class=\"comment_$feed_username\" id=\"comment_$feed_randomstr\" placeholder=\"Comments disabled.\" style=\"font-family: 'Dosis', sans-serif; font-size: 15px; color: $feed_tcolor; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; background-color: $username_color; width: 98%; outline: none; text-align: left;\"></div></td>";
}
echo "<td><button onclick=\"pComment('$feed_randomstr')\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
echo "<i class=\"fa fa-pencil\" aria-hidden=\"true\"></i></button>";
if($feed_allowcomments == 'yes') {
echo "</td><td><button onclick=\"cselectFile('$feed_randomstr');\" id=\"cfPath_$feed_randomstr\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
}
else {
echo "</td><td><button id=\"cfPath_$feed_randomstr\" style=\"-webkit-appearance: none; -moz-appearance: none; appearance: none; border: none; width: 28px; height: 28px; padding: 2px; font-family: 'Dosis', sans-serif; text-align: center; background-color: $feed_tcolor; color: $username_color; border-radius: 30px;\">";
}
echo "<span id=\"cloader_$feed_randomstr\">";
echo "<i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>";
echo "</span></button></td></tr></table>";
echo "<form id=\"cimgUpl_$feed_randomstr\" action=\"img_upload.php\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" id=\"cfeedc_id\" value=\"$feed_randomstr\">";
echo "<input id=\"cfBrowse_$feed_randomstr\" name=\"img\" type=\"file\" style=\"display: none;\">";
echo "</form></div>";
echo "<div id=\"comments_inner_$feed_randomstr\" style=\"word-wrap: break-word; overflow: auto;\"></div>";
echo "</div></center></div>";
echo "<br>";
}
}
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
function pollVote(op,uq) {
var token = "<?php echo $u_token;?>";
$.ajax({
url: 'poll_vote.php',
type: 'POST',
data: { uq: uq, op: op, token: token },
success: function(){
pollRefresh(uq);
},
error: function() {
pollRefresh(uq);
}
});
}
/**
* Returns the style for a node.
*
* @param n The node to check.
* @param p The property to retrieve (usually 'display').
* @link http://www.quirksmode.org/dom/getstyles.html
*/
function getNodeStyle( n, p ) {
return n.currentStyle ?
n.currentStyle[p] :
document.defaultView.getComputedStyle(n, null).getPropertyValue(p);
}
//IF THE NODE IS NOT ACTUALLY IN THE DOM then this won't take into account <div style="display: inline;">text</div>
//however for simple things like `contenteditable` this is sufficient, however for arbitrary html this will not work
function isNodeBlock(node) {
if (node.nodeType == document.TEXT_NODE) {return false;}
var d = getNodeStyle( node, 'display' );//this is irrelevant if the node isn't currently in the current DOM.
if (d.match( /^block/ ) || d.match( /list/ ) || d.match( /row/ ) ||
node.tagName == 'BR' || node.tagName == 'HR' ||
node.tagName == 'DIV' // div,p,... add as needed to support non-DOM nodes
) {
return true;
}
return false;
}
/**
* Converts HTML to text, preserving semantic newlines for block-level
* elements.
*
* @param node - The HTML node to perform text extraction.
*/
function htmlToText( htmlOrNode, isNode ) {
var node = htmlOrNode;
if (!isNode) {node = jQuery("<span>"+htmlOrNode+"</span>")[0];}
//TODO: inject "unsafe" HTML into current DOM while guaranteeing that it won't
// change the visible DOM so that `isNodeBlock` will work reliably
var result = '';
if( node.nodeType == document.TEXT_NODE ) {
// Replace repeated spaces, newlines, and tabs with a single space.
result = node.nodeValue.replace( /\s+/g, ' ' );
} else {
for( var i = 0, j = node.childNodes.length; i < j; i++ ) {
result += htmlToText( node.childNodes[i], true );
if (i < j-1) {
if (isNodeBlock(node.childNodes[i])) {
result += '\n';
} else if (isNodeBlock(node.childNodes[i+1]) &&
node.childNodes[i+1].tagName != 'BR' &&
node.childNodes[i+1].tagName != 'HR') {
result += '\n';
}
}
}
}
return result;
}
// Post comment to a post.
function pComment(feed_randomstr) {
// Get the content of the editable div.
var comment_input_id = $('#comment_' + feed_randomstr).html();
// Convert the content.
var comment_input = htmlToText(comment_input_id);
// Post the content.
if(comment_input.trim() != '') {
$.ajax({
url: 'cmtp.php?i=' + feed_randomstr,
type: 'POST',
data: { body: comment_input },
success: function(){
$('#comment_' + feed_randomstr).empty();
commentsUp(feed_randomstr);
},
error: function() {
//alert("error");
$('#comment_' + feed_randomstr).empty();
commentsUp(feed_randomstr);
}
});
}
}
// Delete comment from a post.
function dComment(feed_randomstr, comment_id) {
if (confirm("Delete?")) {
$.ajax({
url: 'delcmnt.php',
type: 'GET',
data: { id: comment_id },
success: function(){
commentsUp(feed_randomstr);
},
error: function() {
//alert("error");
commentsUp(feed_randomstr);
}
});
}
}
function cselectFile(feed_randomstr) {
document.getElementById('cfBrowse_' + feed_randomstr).click();
document.getElementById('cfPath_' + feed_randomstr).value = document.getElementById('cfBrowse_' + feed_randomstr).value;
imgcUpl(feed_randomstr);
}
function imgcUpl(feed_randomstr) {
var form = document.forms.namedItem("cimgUpl_" + feed_randomstr);
form.addEventListener('change', function(ev) {
var oOutput = document.querySelector("div"),
oData = new FormData(form);
var oReq = new XMLHttpRequest();
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>";
oReq.open("POST", "img_upload.php", true);
oReq.onload = function(oEvent) {
if (oReq.status == 200) {
var cpic = oReq.responseText;
if(cpic != '') {
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>";
var adpti = "[img=50% auto]" + cpic + "[/img]";
document.getElementById("comment_" + feed_randomstr).innerHTML = document.getElementById("comment_" + feed_randomstr).innerHTML + adpti;
setEndOfContenteditable(document.getElementById("comment_" + feed_randomstr));
}
else
document.getElementById('cloader_' + feed_randomstr).innerHTML = "<i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i>";
form.reset();
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
}
function setEndOfContenteditable(contentEditableElement)
{
var range,selection;
if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
{
range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
selection.addRange(range);//make the range you have just created the visible selection
}
else if(document.selection)//IE 8 and lower
{
range = document.body.createTextRange();//Create a range (a range is a like the selection but invisible)
range.moveToElementText(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
range.select();//Select the range (make it the visible selection
}
}
function showComments(comments) {
var rstr = comments.id;
var e = "comments_" + rstr;
var e = document.getElementById(e);
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment..";
// Fetch comments for the post
var getcmts = new XMLHttpRequest();
getcmts.open("GET", "inner_comments.php?i=" + rstr, true);
getcmts.onreadystatechange = function(){
if(getcmts.readyState == 4)
if(getcmts.status == 200) {
var inn_comments = getcmts.responseText;
document.getElementById("comments_inner_" + rstr).innerHTML = inn_comments;
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment";
if(e.style.display == '')
e.style.display = 'none';
else
e.style.display = '';
}
else {
alert("getcmts error");
}
};
getcmts.send();
return false;
}
function commentsUp(fdid) {
var rstr = fdid;
var e = "comments_" + rstr;
var e = document.getElementById(e);
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment..";
// Fetch comments for the post
var getcmts = new XMLHttpRequest();
getcmts.open("GET", "inner_comments.php?i=" + rstr, true);
getcmts.onreadystatechange = function(){
if(getcmts.readyState == 4)
if(getcmts.status == 200) {
var inn_comments = getcmts.responseText;
document.getElementById("comments_inner_" + rstr).innerHTML = inn_comments;
document.getElementById("cmtbtn_" + rstr).innerHTML = "comment";
}
else {
alert("commentsUp error");
}
};
getcmts.send();
var mainPC = document.getElementById("mpcomment_count");
var xhr = new XMLHttpRequest();
xhr.open("GET", "mpcomments.php?i=" + rstr, true);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4)
if(xhr.status == 200) {
mainPC.innerHTML = xhr.responseText;
}
else {
alert("getcmts error");
mainPC.innerHTML = "getcmts error";
}
};
xhr.send();
mainPC.innerHTML = "...";
return false;
}
function pollRefresh(uq) {
var rstr = uq;
var e = "innerpoll_" + rstr;
var e = document.getElementById(e);
// Fetch poll for the post
var getpolls = new XMLHttpRequest();
getpolls.open("GET", "inner_poll.php?uq=" + rstr, true);
getpolls.onreadystatechange = function(){
if(getpolls.readyState == 4)
if(getpolls.status == 200) {
var inn_polls = getpolls.responseText;
document.getElementById("innerpoll_" + rstr).innerHTML = inn_polls;
}
else {
alert("error");
}
};
getpolls.send();
return false;
}
function expand(id) {
var e = document.getElementById(id);
if(e.style.display == '')
e.style.display = 'none';
else
e.style.display = '';
}
function loadmore() {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var amount = document.getElementById("amount").value;
var content = document.getElementById("ld_posts");
$.ajax({
type: 'get',
url: 'moreposts.php',
data: {
amntcnt:amount
},
success: function(more_content) {
content.innerHTML = content.innerHTML+more_content;
document.getElementById("amount").value = Number(amount)+10;
}
});
var getcount = new XMLHttpRequest();
getcount.open("GET", "contamnt.php", true);
getcount.onreadystatechange = function(){
if(getcount.readyState == 4)
if(getcount.status == 200) {
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
var numCont = getcount.responseText;
if(numCont <= Number(amount) + 10) {
document.getElementById("more_div").innerHTML = "";
}
}
else{
alert("getcount error");
document.getElementById("more_div").innerHTML = '<div id=\"more_div\"><table onclick=\"loadmore();\" class=\"writePost\"><tr><td class=\"wpost_td\" style=\"text-align: center;\"><i class=\"fa fa-chevron-circle-down fa-lg\" aria-hidden=\"true\"></i></td></tr></table></div>';
}
};
getcount.send();
return false;
}
</script>

View file

@ -0,0 +1,67 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: https://misdew.com");
exit();
}
$id = mysqli_real_escape_string($conx, htmlentities($_POST['body']));
$edit = mysqli_real_escape_string($conx, htmlentities($_POST['edit']));
$pollquest = mysqli_real_escape_string($conx, htmlentities($_POST['pollquest']));
$pollquest = trim($pollquest);
$pollopt1 = mysqli_real_escape_string($conx, htmlentities($_POST['pollopt1']));
$pollopt1 = trim($pollopt1);
$pollopt2 = mysqli_real_escape_string($conx, htmlentities($_POST['pollopt2']));
$pollopt2 = trim($pollopt2);
$pollopt3 = mysqli_real_escape_string($conx, htmlentities($_POST['pollopt3']));
$pollopt3 = trim($pollopt3);
$pollopt4 = mysqli_real_escape_string($conx, htmlentities($_POST['pollopt4']));
$pollopt4 = trim($pollopt4);
$pollopt5 = mysqli_real_escape_string($conx, htmlentities($_POST['pollopt5']));
$pollopt5 = trim($pollopt5);
$getrstr = safe($_GET['i']);
$getshare = safe($_GET['share']);
$getidq = mysqli_query($conx, "SELECT id FROM feed WHERE random_str='$getrstr'");
$getidr = mysqli_fetch_assoc($getidq);
$getsid = $getidr['id'];
$edited = "";
function genRand($length = 15) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
$rstr = genRand();
$rstr = $u_uid.$rstr;
if($edit) {
$id = $edit;
if(mysqli_num_rows(mysqli_query($conx, "SELECT id FROM feed WHERE random_str='$getrstr' && uid='$u_uid'")) == '1') {
mysqli_query($conx, "UPDATE feed SET post='$id' WHERE random_str='$getrstr' && uid='$u_uid'");
mysqli_query($conx, "UPDATE feed SET edited='yes' WHERE random_str='$getrstr' && uid='$u_uid'");
mysqli_query($conx, "UPDATE feed SET tstamp='$tstamp' WHERE random_str='$getrstr' && uid='$u_uid'");
}
header("location: https://misdew.com/feed/post.php?i=$getrstr");
exit();
}
elseif($getshare) {
if($getsid == '') {
header("location: https://misdew.com/feed");
exit();
}
mysqli_query($conx, "INSERT INTO feed (uid, post, tstamp, random_str, visibility, shared_id, shared_rstr) VALUES ('$u_uid','$id','$tstamp','$rstr','public','$getsid','$getrstr')");
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'+.05 WHERE uid='$u_uid'");
header("location: https://misdew.com/feed");
exit();
}
else {
mysqli_query($conx, "INSERT INTO feed (uid, post, tstamp, random_str, visibility) VALUES ('$u_uid','$id','$tstamp','$rstr','public')");
if($pollquest != '') {
mysqli_query($conx, "UPDATE feed SET is_poll='yes' WHERE random_str='$rstr'");
mysqli_query($conx, "INSERT INTO feed_polls (uid, uqid, tstamp, poll_question, poll_opt1, poll_opt2, poll_opt3, poll_opt4, poll_opt5, is_timed) VALUES ('$u_uid','$rstr','$tstamp','$pollquest','$pollopt1','$pollopt2','$pollopt3','$pollopt4','$pollopt5','no')");
}
mysqli_query($conx, "UPDATE account_figures SET activeness='$f_activeness'+.05 WHERE uid='$u_uid'");
mysqli_query($conx, "UPDATE accounts SET funds='$u_funds'+.25 WHERE uid='$u_uid'");
header("location: https://misdew.com/feed");
exit();
}
?>

View file

@ -0,0 +1,25 @@
<?php
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$feed_id = safe($_GET['i']);
$like_q = mysqli_query($conx, "SELECT uid FROM feed_likes WHERE post_id='$feed_id'");
$likcnt_r = mysqli_num_rows($like_q);
if($likcnt_r == 0) {
echo "nobody <i class=\"fa fa-frown-o\" aria-hidden=\"true\"></i>";
}
while($like_r = mysqli_fetch_array($like_q)) {
$like_uid = $like_r['uid'];
// selects user data for each heart
$likeu_q = mysqli_query($conx, "SELECT username FROM accounts WHERE uid='$like_uid'");
while($likeu_r = mysqli_fetch_array($likeu_q)) {
$like_username = $likeu_r['username'];
}
echo $separator;
echo "<a href=\"/profile/?u=$like_username\" class=\"like_username\">$like_username</a>";
if (!$separator) $separator = ', ';
}
?>

View file

@ -0,0 +1,73 @@
<?php
$this_page = "feed";
require_once("../inc/conx.php");
if($logged_in == false) {
header("location: /");
exit();
}
$get_rstr = safe($_GET['i']);
if(mysqli_num_rows($gpostq = mysqli_query($conx, "SELECT id FROM feed WHERE random_str='$get_rstr'")) != 1) {
header("location: /feed");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Feed - Misdew</title>
<meta charset="utf-8">
<meta name="description" content="We are a fairly cool social network.">
<meta name="keywords" content="Misdew, MD, Social, Network, Communication, 3DS, DSi, Nintendo">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" value="notranslate">
<meta name="theme-color" content="<?php echo $meta_theme_color; ?>">
<?php
if($css_type == "sheet") {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$g_sheet\">";
}
if($css_type == "raw") {
echo "<style type=\"text/css\">$g_raw</style>";
}
?>
<link rel="icon" type="image/png" href="/img/favicon.png">
<link rel="apple-touch-icon" href="/img/logo.png">
<style type="text/css">
body {
background-color: <?php echo $bgcolor; ?>;
}
.header_tds {
background-color: <?php echo $tdcolor; ?>;
}
</style>
</head>
<body>
<center>
<?php
$back_button = true;
$linebreak = true;
require_once("../inc/header.php");
?>
<div id="postIt">
<form id="feed_form" method="post" action="ppost.php?i=<?php echo "$get_rstr&&"; ?>share=true">
<table class="postbox_tb">
<tr>
<td>
<textarea id="fpostb" name="body" rows="4" class="feed_parea" placeholder="type something..."><?php echo $post_text; ?></textarea>
</td>
</tr>
</table>
<table class="postbox_tb" id="postbox_tb2">
<td class="postbox2_td2">
<input type="submit" value="share" class="postbox_sub" style="width: 90%;" onclick="this.disabled=true;this.value='sharing...';this.form.submit();">
</td>
</tr>
</table>
</form>
</div>
<?php
require_once("../inc/footer.php");
?>
</center>
</body>
</html>

View file

@ -0,0 +1,21 @@
<?php
/* Coded by Neonacid64 */
/*
require_once("../inc/conx.php");
$feed_q = mysqli_query($conx, "SELECT id,uid,post,tstamp,random_str,visibility,edited,img,is_poll FROM feed ORDER BY id ASC");
while($feed_r = mysqli_fetch_assoc($feed_q)) {
// Feed data
$feed_id = $feed_r['id'];
$likcnt_q = mysqli_query($conx, "SELECT id FROM feed_likes WHERE post_id='$feed_id'");
$likcnt_r = number_format(mysqli_num_rows($likcnt_q));
if($likcnt_r != '1') {
$lsz = "s";
}
echo $feed_id;
echo ": ";
echo $likcnt_r;
echo "<br>";
}
*/
?>

View file

@ -0,0 +1,30 @@
<?php
require_once("../inc/conx.php");
$uploc = "Feed";
if ( isset($_FILES['vid']) ) {
$filename = $_FILES['vid']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$required_key = "make ur own";
$POST_DATA = array(
'file' => base64_encode($data),
'key' => urlencode($required_key),
'user' => urlencode($u_uid),
'imagetype' => urlencode($u_uid),
'imaeg' => urlencode($u_cloudterms),
'fieltyp' => urlencode($u_cloudterms),
'usernaem' => urlencode($u_username),
'filextension' => urlencode($u_username),
'uvia' => urlencode($uploc)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://upl.justa.us/video.php');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo trim($response);
curl_close ($curl);
}
?>