94 lines
4.5 KiB
PHP
94 lines
4.5 KiB
PHP
<?php header('Content-type: application/json');
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/wall/include/');
|
|
include(PATHTOINCLUDES."base.php");
|
|
date_default_timezone_set("UTC");
|
|
$thevid=$_POST["vid"];
|
|
$theuid=$_POST["uid"];
|
|
$em="";
|
|
$limit=1;
|
|
if(isset($_POST["offset"])){$offset=$_POST["offset"];} else{$offset=0;}
|
|
if(isset($_POST["limit"])){$limit=$_POST["limit"];} else{$limit=20;}
|
|
|
|
$sql="SELECT
|
|
`mms_comments`.`mmsid`,
|
|
`mms_comments`.`vid`,
|
|
`mms_comments`.`userid`,
|
|
`mms_comments`.`thecomment`,
|
|
`mms_comments`.`thedate`,
|
|
DATE_FORMAT(`mms_comments`.`thedate`,'%b %d %Y %h:%i %p') AS DC,
|
|
`se_users`.`user_username`,
|
|
`se_users`.`user_blocklist`,
|
|
`se_users`.`user_photo`,
|
|
`se_users`.`thumb`
|
|
FROM
|
|
`mms_comments`
|
|
Left Outer Join `se_users` ON `se_users`.`user_id` = `mms_comments`.`userid`
|
|
WHERE
|
|
`mms_comments`.`vid` = ".$thevid."
|
|
ORDER BY
|
|
`mms_comments`.`thedate` DESC
|
|
LIMIT ".$limit." OFFSET ".$offset."";
|
|
$result=$database->database_query($sql) or $em=$em.$database->database_error();
|
|
|
|
$thecount=0;
|
|
$sql2="SELECT count(`mms_comments`.`mmsid`) AS cuid FROM `mms_comments` WHERE
|
|
`mms_comments`.`vid` = ".$thevid."";
|
|
$rcount=$database->database_query($sql2);
|
|
$thecount = $database->database_result($rcount,0);
|
|
$database->database_free_result($rcount);
|
|
$thecomments="";
|
|
$rownum=0;
|
|
while ($row = $database->database_fetch_assoc($result)) {
|
|
$rownum=$rownum+1;
|
|
|
|
|
|
$blocklist = explode(",", $row["user_blocklist"]);
|
|
$user_key = array_search($theuid, $blocklist);
|
|
|
|
if($user_key!==true){
|
|
$number = (((int)($row['userid']/1000))*1000)+1000;
|
|
if($row['user_photo']=="")
|
|
{
|
|
$uimage="/images/nophoto.png";
|
|
}
|
|
else {
|
|
|
|
$uimage="/uploads_user/".$number."/".$row['userid']."/".$row['user_photo'];
|
|
$thepath = pathinfo($uimage);
|
|
$uimage_thumb="/uploads_user/".$number."/".$row['userid']."/".$thepath['filename']."_thumb.".$thepath['extension'];
|
|
|
|
$uimage_thumb_file=$_SERVER["DOCUMENT_ROOT"]. "/uploads_user/".$number."/".$row['userid']."/".$thepath['filename']."_thumb.".$thepath['extension'];
|
|
if (file_exists($uimage_thumb_file)) {$uimage=$uimage_thumb;} else {}
|
|
|
|
}
|
|
$thecomments=$thecomments.'<div id="comment_'.$row["mmsid"].'"><div style="margin-top: 10px; margin-bottom: 20px;">
|
|
<div style="float: left; text-align: center; width: 90px;"><a href="/profile.php?user='.$row["user_username"].'"><img src="'.$uimage.'" class="photo" width="75" border="0"></a></div>';
|
|
$thecomments=$thecomments.'<div style="overflow: hidden;"><div class="profile_comment_author"><a href="/profile.php?user='.$row["user_username"].'"><b>'.$row["user_username"].'</b></a></div><div class="profile_comment_date">'.$row["DC"].'</div><div class="profile_comment_body" id="profile_comment_body_'.$row["mmsid"].'" style="max-width:none;font-size:110%;line-height:140%;max-height:100px;overflow:auto;">'.$row["thecomment"].'</div>';
|
|
|
|
if($theuid==$row["userid"] || $theuid==21092 || $theuid==9 || $theuid==58188 || $theuid==8 || $theuid==105406)
|
|
{
|
|
$thecomments=$thecomments.'<div class="profile_comment_links" id="profile_comment_links_'.$row["mmsid"].'"><a class="commentDeleteLink" href="javascript:void(0);" id="comment_delete_link_'.$row["mmsid"].'" onclick="deletecomment('.$row["mmsid"].')" style="color:red;">delete</a> -
|
|
<a class="commentEditLink" href="javascript:void(0);" id="comment_edit_link_'.$row["mmsid"].'" onclick="edit_comment_post('.$row["mmsid"].');">edit</a> </div><div style="display:none;text-align:right;" id="update_comment_'.$row["mmsid"].'"><a href="javascript:void(0);" onclick="cancel_edit_comment('.$row["mmsid"].')">Cancel</a><span style="padding:0px 5px;"> </span><a href="javascript:void(0);" onclick="update_comment('.$row["mmsid"].');">Update</a></div><div id="edit_spin_'.$row["mmsid"].'" style="text-align:center;display:none;"><i class="fa fa-circle-o-notch fa-spin"></i></div>';
|
|
}
|
|
else
|
|
{
|
|
$thecomments=$thecomments.'<div class="profile_comment_links"><a href="javascript:TB_show(\'Compose New Message\', \'user_messages_new.php?to_user='.$row["user_username"].'&to_id='.$row["user_username"].'&TB_iframe=true&height=400&width=450\', \'\', \'./images/trans.gif\');">message</a> </div>';
|
|
}
|
|
$thecomments=$thecomments.'</div></div><div class="clear"></div></div>';
|
|
}//exclude blocklist
|
|
}
|
|
|
|
$morebutton="off";
|
|
|
|
if($thecount-$offset > $limit)
|
|
{
|
|
//need more button -- must pass offset to js and update
|
|
$morebutton="on";
|
|
//$offset=$offset + $limit;
|
|
$limit=$limit+$limit;
|
|
}
|
|
|
|
$arr = array ('error' => $em, 'thecount'=>$thecount, 'thecomments'=>$thecomments, 'theoffset'=>$offset, 'thelimit'=>$limit,'more'=>$morebutton);
|
|
echo json_encode($arr);
|
|
|
|
?>
|