267 lines
14 KiB
PHP
267 lines
14 KiB
PHP
<?php
|
|
require_once("../inc/conx.php");
|
|
if($logged_in == false) {
|
|
header("location: /");
|
|
exit();
|
|
}
|
|
mysqli_query($conx, "UPDATE accounts SET chat_time='$tstamp' WHERE uid='$u_uid'");
|
|
echo "<center><span style=\"color: #827a99; font-size: 12px; font-family: 'Dosis', sans-serif;\">Current rate per message: +$chat_msg_per_rate MDF - don't spam</span></center>";
|
|
$chat_q = mysqli_query($conx, "SELECT id,uid,tstamp,message,pmuid,msgtype,display_name,mtype,imgurl FROM chat ORDER BY id DESC LIMIT 30");
|
|
while($chat_r = mysqli_fetch_assoc($chat_q)) {
|
|
$chat_id = $chat_r['id'];
|
|
$chat_uid = $chat_r['uid'];
|
|
$chat_tstamp = $chat_r['tstamp'];
|
|
$string = $chat_r['message'];
|
|
$pmuid = $chat_r['pmuid'];
|
|
$msg_type = $chat_r['msgtype'];
|
|
$displayname = $chat_r['display_name'];
|
|
$mtype = $chat_r['mtype'];
|
|
$c_imgurl = $chat_r['imgurl'];
|
|
// ************************ //
|
|
// *** BLOCKING SYSTEM *** //
|
|
// ************************ //
|
|
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$chat_uid'");
|
|
$blkc = mysqli_num_rows($blks);
|
|
if($blkc > 0) {
|
|
$chat_uid = "286";
|
|
}
|
|
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$chat_uid'");
|
|
$blkc = mysqli_num_rows($blks);
|
|
if($blkc > 0) {
|
|
$chat_uid = "286";
|
|
}
|
|
// ************************ //
|
|
// *** BLOCKING SYSTEM *** //
|
|
// ************************ //
|
|
if($chat_uid != '286') {
|
|
include("../inc/replace.php");
|
|
$usr_q = mysqli_query($conx, "SELECT username,csplit,sticker,md_verf FROM accounts WHERE uid='$chat_uid'");
|
|
while($usr_r = mysqli_fetch_assoc($usr_q)) {
|
|
$chat_username = $usr_r['username'];
|
|
$chat_sticker = $usr_r['sticker'];
|
|
$chat_csplit = $usr_r['csplit'];
|
|
$chat_md_verf = $usr_r['md_verf'];
|
|
if($chat_md_verf == 'yes') {
|
|
$verif_check = "<i style=\"\" style=\"color: #827a99;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i> ";
|
|
}
|
|
else {
|
|
$verif_check = "";
|
|
}
|
|
$usri_q = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$chat_uid' && theme_id='$g_themeid'");
|
|
while($usri_r = mysqli_fetch_assoc($usri_q)) {
|
|
$username_color = "#827a99";
|
|
$chat_tcolor = "#827a99";
|
|
$csplit1_color = "#827a99";
|
|
$csplit2_color = "#827a99";
|
|
$csplit3_color = "#827a99";
|
|
$csplit1_name = $usri_r['csplit1_name'];
|
|
$csplit2_name = $usri_r['csplit2_name'];
|
|
$csplit3_name = $usri_r['csplit3_name'];
|
|
}
|
|
}
|
|
// whisper data
|
|
$usr_qq = mysqli_query($conx, "SELECT username,csplit,sticker,md_verf FROM accounts WHERE uid='$pmuid'");
|
|
while($usr_rr = mysqli_fetch_assoc($usr_qq)) {
|
|
$chat_usernamer = $usr_rr['username'];
|
|
$chat_csplitt = $usr_rr['csplit'];
|
|
$chat_stickerr = $usr_rr['sticker'];
|
|
$chat_md_verffffff = $usr_rr['md_verf'];
|
|
if($chat_md_verffffff == 'yes') {
|
|
$verif_checkkkkk = "<i style=\"\" style=\"color: #827a99;\" class=\"fa fa-check-circle\" aria-hidden=\"true\"></i> ";
|
|
}
|
|
else {
|
|
$verif_checkkkkk = "";
|
|
}
|
|
$usri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$pmuid' && theme_id='$g_themeid'");
|
|
while($usri_rr = mysqli_fetch_assoc($usri_qq)) {
|
|
$username_colorr = "#827a99";
|
|
$chat_tcolorr = "#827a99";
|
|
$csplit1_colorr = "#827a99";
|
|
$csplit2_colorr = "#827a99";
|
|
$csplit3_colorr = "#827a99";
|
|
$csplit1_namee = $usri_rr['csplit1_name'];
|
|
$csplit2_namee = $usri_rr['csplit2_name'];
|
|
$csplit3_namee = $usri_rr['csplit3_name'];
|
|
}
|
|
}
|
|
/* vvv IF THE CHAT MESSAGE TYPE IS A WHISPER vvvv */
|
|
if($msg_type == 'pm') {
|
|
if($chat_username == $u_username) {
|
|
if($chat_csplitt == 'on') {
|
|
if($chat_stickerr != '') {
|
|
$whisper_stickerr = "<img src=\"$chat_stickerr\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
if($chat_sticker != '') {
|
|
$whisper_sticker = "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
$tochat_usernamer = "to <span style=\"color: $csplit1_colorr !important;\">$csplit1_namee</span><span style=\"color: $csplit2_colorr !important;\">$csplit2_namee</span><span style=\"color: $csplit3_colorr !important;\">$csplit3_namee</span> $verif_checkkkkk $whisper_stickerr";
|
|
}
|
|
else {
|
|
$tochat_usernamer = "to $chat_usernamer $verif_checkkkkk <img src=\"$chat_stickerr\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
if($chat_stickerr != '') {
|
|
$whisper_stickerr = "<img src=\"$chat_stickerr\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
if($chat_sticker != '') {
|
|
$whisper_sticker = "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\"> ";
|
|
}
|
|
if($displayname == 'no') {
|
|
$chat_username = "";
|
|
$tochat_usernamer = "";
|
|
$csplit1_name = "";
|
|
$csplit2_name = "";
|
|
$csplit3_name = "";
|
|
$whisper_sticker = "";
|
|
$whisper_stickerr = "";
|
|
$verif_checkkkkk = "";
|
|
$verif_check = "";
|
|
}
|
|
echo " <div style=\"display:block\">
|
|
<table style=\"float: right; width: 100%; text-align: right;\"><tr><td onclick=\"csplBox();expand('csplit_hidden');\" style=\"color: #FFFCB6; font-family: 'Dosis', sans-serif; font-weight: bold;\">";
|
|
if($chat_csplit == 'on') {
|
|
echo "$whisper_sticker<span style=\"color: $csplit1_color !important;\">$verif_check$csplit1_name</span><span style=\"color: $csplit2_color !important;\">$csplit2_name</span><span style=\"color: $csplit3_color !important;\">$csplit3_name</span>";
|
|
}
|
|
else {
|
|
echo "$whisper_sticker$verif_check$chat_username";
|
|
}
|
|
echo " <span style=\"color: #827a99; font-family: 'Dosis', sans-serif; font-weight: normal;\">$tochat_usernamer</span></td></tr></table>
|
|
<div onclick=\"expand('$chat_id')\" style=\"border: 1px solid #827a99; word-wrap: break-word; background-color: #FFFCB6; padding: 10px; padding-left: 25px; padding-right: 25px; color: $chat_tcolor; font-family: 'Dosis', sans-serif; display: inline-block; float: right; max-width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">" . $string . "</div>
|
|
<table id=\"$chat_id\" style=\"display: none; float: right; width: 100%; text-align: right;\"><tr><td class=\"tago\">sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table>
|
|
</div>";
|
|
}
|
|
elseif($pmuid == $u_uid) {
|
|
if($chat_csplit == 'on') {
|
|
$chat_username_cspl = "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\"> <span style=\"color: $csplit1_color !important;\">$csplit1_name</span><span style=\"color: $csplit2_color !important;\">$csplit2_name</span><span style=\"color: $csplit3_color !important;\">$csplit3_name</span>";
|
|
}
|
|
else {
|
|
$chat_username_cspl = "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\"> $chat_username";
|
|
}
|
|
$fromchatr_usernamer = "$chat_username_cspl $verif_check <i onclick=\"sendBox('/pm $chat_username ')\" class=\"fa fa-reply\" aria-hidden=\"true\"></i>";
|
|
if($displayname == 'no') {
|
|
$chat_username = "";
|
|
$fromchatr_usernamer = "";
|
|
}
|
|
echo "<div style=\"display:block\">
|
|
<table style=\"float: left; width: 100%; text-align: left;\"><tr><td style=\"color: #827a99; font-family: 'Dosis', sans-serif; font-weight: bold;\">$fromchatr_usernamer</td></tr></table>
|
|
<div onclick=\"expand('$chat_id')\" style=\"border: 1px solid #827a99; word-wrap: break-word; background-color: #FFFCB6; padding: 10px; padding-left: 25px; padding-right: 25px; color: $chat_tcolor; font-family: 'Dosis', sans-serif; display: inline-block; float: left; max-width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">" . $string . "</div>
|
|
<table id=\"$chat_id\" style=\"display: none; float: right; width: 100%; text-align: left;\"><tr><td class=\"tago\">sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table>
|
|
</div>";
|
|
}
|
|
}
|
|
/* ^^^ IF THE CHAT MESSAGE TYPE IS A WHISPER ^^^ */
|
|
/* #################################################### */
|
|
/* vvv IF THE CHAT MESSAGE IS NORMAL vvvv */
|
|
else {
|
|
if($chat_username == $u_username) {
|
|
if($displayname == 'no') {
|
|
$chat_username = "";
|
|
$csplit1_name = "";
|
|
$csplit2_name = "";
|
|
$csplit3_name = "";
|
|
$verif_check = "";
|
|
}
|
|
echo "<div style=\"display:block\"><table style=\"float: right; width: 100%; text-align: right;\"><tr><td onclick=\"csplBox();expand('csplit_hidden');\" style=\"color: $username_color; font-family: 'Dosis', sans-serif; font-weight: bold;\">";
|
|
if($chat_csplit == 'on') {
|
|
echo $verif_check;
|
|
echo "<span style=\"color: $csplit1_color !important;\">$csplit1_name</span><span style=\"color: $csplit2_color !important;\">$csplit2_name</span><span style=\"color: $csplit3_color !important;\">$csplit3_name</span>";
|
|
if($chat_sticker != '' && $displayname != 'no') {
|
|
echo " <img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
}
|
|
else {
|
|
echo $verif_check;
|
|
echo $chat_username;
|
|
if($chat_sticker != '' && $displayname != 'no') {
|
|
echo " <img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\">";
|
|
}
|
|
}
|
|
echo "</td></tr></table>";
|
|
// if message is an image
|
|
if($mtype == 'img') {
|
|
//
|
|
// Data Saver
|
|
if($u_datasaver == 'on') {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; border-radius: 20px; border: 1px solid #827a99; font-family: 'Dosis', sans-serif; display: inline-block; float: right; max-width: 60%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">[view image]</div>";
|
|
}
|
|
else {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; border-radius: 20px; border: 1px solid #827a99; font-family: 'Dosis', sans-serif; display: inline-block; float: right; max-width: 60%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\"><img src=\"$c_imgurl\" alt=\"\" width=\"100%\" style=\"display: block; height: auto;\"></div>";
|
|
}
|
|
// Data Saver
|
|
//
|
|
}
|
|
// if message is normal
|
|
else {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; background-color: #FFFCB6; padding: 10px; padding-left: 25px; padding-right: 25px; border-radius: 20px; border: 1px solid #827a99; color: $chat_tcolor; font-family: 'Dosis', sans-serif; display: inline-block; float: right; max-width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">" . $string . "</div>";
|
|
}
|
|
echo "<table id=\"$chat_id\" style=\"display: none; float: right; width: 100%; text-align: right;\"><tr>";
|
|
if($mtype == 'img') {
|
|
echo "<td class=\"tago\"><a href=\"$c_imgurl\" class=\"link_view\" target=\"_blank\">view image</a> <br>";
|
|
echo "sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table></div>";
|
|
}
|
|
else {
|
|
echo "<td class=\"tago\">sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table></div>";
|
|
}
|
|
}
|
|
else {
|
|
if($displayname == 'no') {
|
|
$chat_username = "";
|
|
$csplit1_name = "";
|
|
$csplit2_name = "";
|
|
$csplit3_name = "";
|
|
$verif_check = "";
|
|
}
|
|
echo "<div style=\"display:block\"><table style=\"float: left; width: 100%; text-align: left;\"><tr><td style=\"color: $username_color; font-family: 'Dosis', sans-serif; font-weight: bold;\"><span onclick=\"sendBox('/pm $chat_username ')\">";
|
|
if($chat_csplit == 'on') {
|
|
if($chat_sticker != '' && $displayname != 'no') {
|
|
echo "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\"> ";
|
|
}
|
|
echo "<span style=\"color: $csplit1_color !important;\">$csplit1_name</span><span style=\"color: $csplit2_color !important;\">$csplit2_name</span><span style=\"color: $csplit3_color !important;\">$csplit3_name</span>";
|
|
}
|
|
else {
|
|
if($chat_sticker != '' && $displayname != 'no') {
|
|
echo "<img src=\"$chat_sticker\" alt=\"\" style=\"height: 16px;\"> ";
|
|
}
|
|
echo $chat_username;
|
|
}
|
|
echo " " . $verif_check;
|
|
echo "</span></td></tr></table>";
|
|
// if message is an image
|
|
if($mtype == 'img') {
|
|
//
|
|
// Data Saver
|
|
if($u_datasaver == 'on') {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; border-radius: 20px; border: 1px solid #827a99; font-family: 'Dosis', sans-serif; display: inline-block; float: left; max-width: 60%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">[view image]</div>";
|
|
}
|
|
else {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; border-radius: 20px; border: 1px solid #827a99; font-family: 'Dosis', sans-serif; display: inline-block; float: left; max-width: 60%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\"><img src=\"$c_imgurl\" alt=\"\" width=\"100%\" style=\"display: block; height: auto;\"></div>";
|
|
}
|
|
// Data Saver
|
|
//
|
|
}
|
|
// if message is normal
|
|
else {
|
|
echo "<div onclick=\"expand('$chat_id')\" style=\"word-wrap: break-word; background-color: #FFFCB6; padding: 10px; padding-left: 25px; padding-right: 25px; border-radius: 20px; border: 1px solid #827a99; color: $chat_tcolor; font-family: 'Dosis', sans-serif; display: inline-block; float: left; max-width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">" . $string . "</div>";
|
|
}
|
|
echo "<table id=\"$chat_id\" style=\"display: none; float: right; width: 100%; text-align: left;\"><tr>";
|
|
if($mtype == 'img') {
|
|
echo "<td class=\"tago\"><a href=\"$c_imgurl\" class=\"link_view\" target=\"_blank\">view image</a> <br>";
|
|
echo "sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table></div>";
|
|
}
|
|
else {
|
|
echo "<td class=\"tago\">sent "; echo timeago($chat_tstamp); echo " ago</td></tr></table></div>";
|
|
}
|
|
}
|
|
}
|
|
/* ^^^ IF THE CHAT MESSAGE TYPE IS NORMAL ^^^ */
|
|
}
|
|
}
|
|
?>
|
|
<script>
|
|
function expand(id) {
|
|
var e = document.getElementById(id);
|
|
if(e.style.display == '')
|
|
e.style.display = 'none';
|
|
else
|
|
e.style.display = '';
|
|
}
|
|
</script>
|