Files

403 lines
6.9 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php header('Content-type: application/json');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
include(PATHTOINCLUDES."base.php");
$em="";
$hc_pid=$_POST["thepid"];
$test="";
$hc_icomments="";
$sqlpi="SELECT
`halloween_contest`.`hcuid`,
`halloween_contest`.`hcuname`,
`halloween_contest`.`hcapproved`,
DATE_FORMAT(`halloween_contest`.`thedate`,'%a %b %e, %Y') AS thedate
FROM
`halloween_contest`
WHERE
`halloween_contest`.`hcidu` = ".$hc_pid."
LIMIT 1";
$queryc=$database->database_query($sqlpi) or $em .= $database->database_error();
$row = $database->database_fetch_row($queryc);
$hcpuid=$row[0];
$hcpuname=$row[1];
$isapproved=$row[2];
$entrydate=$row[3];
$sqlcu="SELECT
`se_users`.`user_photo`,
`se_users`.`user_blocklist`,
`se_users`.`user_invisible`
FROM
`se_users`
WHERE
`se_users`.`user_id` = ".$hcpuid."
LIMIT 1";
$querycu=$database->database_query($sqlcu) or $em .= $database->database_error();
$row = $database->database_fetch_row($querycu);
$uimg=$row[0];
$ubl=$row[1];
$uinv=$row[2];
if($uimg != "")
{
$uipi = pathinfo($uimg);
$uiname=$uipi['filename'];
$uiext=$uipi['extension'];
$udir = (((int)($hcpuid/1000))*1000)+1000;
$theudir=$_SERVER["DOCUMENT_ROOT"]."/uploads_user/".$udir."/".$hcpuid."/";
$uthumb=$theudir.$uiname."_thumb.".$uiext;
if(file_exists($uthumb))
{
$uphoto="/uploads_user/".$udir."/".$hcpuid."/".$uiname."_thumb.".$uiext;
}
else
{
$ufull=$theudir.$uiname.".".$uiext;
if(file_exists($ufull))
{
$uphoto="/uploads_user/".$udir."/".$hcpuid."/".$uiname.".".$uiext;
}
else
{
$uphoto="/images/nophoto.png";
}
}
//
}
else
{
$uphoto="/images/nophoto.png";
}
$sqlc="SELECT
Count(`hc_comment`.`hc_cid`) as `cpid`
FROM
`hc_comment`
WHERE
`hc_comment`.`hc_imgid` = ".$hc_pid;
$queryc=$database->database_query($sqlc) or $em .= $database->database_error();
$thecount = $database->database_result($queryc,0);
if($thecount > 0)
{
$sqld="SELECT
`hc_comment`.`hc_cid`,
`hc_comment`.`hc_imgid`,
`hc_comment`.`hc_uid`,
`hc_comment`.`hc_uname`,
`hc_comment`.`hc_comment`,
`hc_comment`.`hc_thedate`
FROM
`hc_comment`
WHERE
`hc_comment`.`hc_imgid` = ".$hc_pid;
$queryd=$database->database_query($sqld) or $em .= $database->database_error();
while ($row = $database->database_fetch_assoc($queryd)) {
$sqle="SELECT
`se_users`.`user_photo`,
`se_users`.`user_blocklist`,
`se_users`.`user_invisible`
FROM
`se_users`
WHERE
`se_users`.`user_id` = ".$row["hc_uid"]."
LIMIT 1";
$querye=$database->database_query($sqle) or $em .= $database->database_error();
$u = $database->database_fetch_row($querye);
$uimg=$u[0];
$ubl=$u[1];
$uinv=$u[2];
if($uimg != "")
{
$uipi = pathinfo($uimg);
$uiname=$uipi['filename'];
$uiext=$uipi['extension'];
$udir = (((int)($row["hc_uid"]/1000))*1000)+1000;
$theudir=$_SERVER["DOCUMENT_ROOT"]."/uploads_user/".$udir."/".$row["hc_uid"]."/";
$uthumb=$theudir.$uiname."_thumb.".$uiext;
if(file_exists($uthumb))
{
$iuphoto="/uploads_user/".$udir."/".$row["hc_uid"]."/".$uiname."_thumb.".$uiext;
}
else
{
$ufull=$theudir.$uiname.".".$uiext;
if(file_exists($ufull))
{
$iuphoto="/uploads_user/".$udir."/".$row["hc_uid"]."/".$uiname.".".$uiext;
}
else
{
$iuphoto="/images/nophoto.png";
}
}
}
else
{
$iuphoto="/images/nophoto.png";
}
if($row["hc_uid"] != $_POST["theuid"] && $_POST["theuid"] != '21092' && $_POST["theuid"] != '8' && $_POST["theuid"] != '9')
{
$hc_icomments .=' <div id="comment_'.$row["hc_cid"].'">
<div style="margin-top: 10px; margin-bottom: 20px;">
<div style="float: left; text-align: center; width: 90px;">
<a href="http://bateworld.com/profile.php?user='.stripslashes($row["hc_uname"]).'" target="_blank"><img src="'.$iuphoto.'" class="photo" width="75" border="0" style="height:auto;"></a></div><div style="overflow: hidden;"><div class="profile_comment_author"><a href="http://bateworld.com/profile.php?user="'.stripslashes($row["hc_uname"]).'" target="_blank"><b>'.stripslashes($row["hc_uname"]).'</b></a><span id="hc_cmsg_'.$row["hc_cid"].'" style="padding-left:20px;font-weight:bold;"></span></div><div class="profile_comment_date">'.$row["hc_thedate"].'</div><div class="profile_comment_body" id="profile_comment_body_'.$row["hc_cid"].'">'.stripslashes($row["hc_comment"]).'</div><div class="profile_comment_links"><a href="javascript:TB_show(\'Compose New Message\', \'user_messages_new.php?to_user='.stripslashes($row["hc_uname"]).'&to_id='.stripslashes($row["hc_uname"]).'&TB_iframe=true&height=400&width=450\', \'\', \'./images/trans.gif\');">message</a>&nbsp;</div></div></div></div>';
}
else
{
$hc_icomments .=' <div id="comment_'.$row["hc_cid"].'">
<div style="margin-top: 10px; margin-bottom: 20px;">
<div style="float: left; text-align: center; width: 90px;">
<a href="http://bateworld.com/profile.php?user='.stripslashes($row["hc_uname"]).'" target="_blank"><img src="'.$iuphoto.'" class="photo" width="75" border="0" style="height:auto;"></a></div><div style="overflow: hidden;"><div class="profile_comment_author"><a href="http://bateworld.com/profile.php?user='.stripslashes($row["hc_uname"]).'" target="_blank"><b>'.stripslashes($row["hc_uname"]).'</b></a><span id="hc_cmsg_'.$row["hc_cid"].'" style="padding-left:20px;font-weight:bold;"></span></div><div class="profile_comment_date">'.$row["hc_thedate"].'</div><div class="profile_comment_body" id="profile_comment_body_'.$row["hc_cid"].'" contenteditable="true" onblur="edit_comment_act(\''.$row["hc_cid"].'\');">'.stripslashes($row["hc_comment"]).'</div><div class="profile_comment_links"><input type="button" class="button" style="padding:2px 6px 2px 6px;color:yellow;background:red;border-radius:2px;" value="delete" onclick="del_comment_act(\''.$row["hc_cid"].'\');"> <input type="button" class="button" value="edit" style="padding:2px 6px 2px 6px;color:#ccc;background:black;border-radius:2px;" onclick="edit_comment(\''.$row["hc_cid"].'\');"></div></div></div></div>';
}
} // end while
} // end count gt 0
else
{
}
$somestuff="";
if($_POST["theuid"]=="21092" || $_POST["theuid"]=="9" || $_POST["theuid"]=="8")
{
$therej="";
$theappr="";
if($isapproved=="no")
{
$therej='checked="checked"';
}
if($isapproved=="yes"){
$theappr='checked="checked"';
}
$somestuff='<div style="text-align:right;padding-right:5px;">Approve<input type="checkbox" name="hc_approve" id="hc_approve" onclick="hc_approve_entry(\''.$hc_pid.'\');" '.$theappr.' /> Reject<input type="checkbox" name="hc_reject" id="hc_reject" onclick="hc_reject_entry(\''.$hc_pid.'\');" '.$therej.'/></div>';
}
$arr = array ('error'=>$em,'uphoto'=>$uphoto,'uname'=>$hcpuname,'entrydate'=>$entrydate,'ccount'=>$thecount,'allcomments'=>$hc_icomments,'somestuff'=>$somestuff);
echo json_encode($arr);
?>