Files
Testing/js/act/wallpost_act.php

148 lines
3.7 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php header('Content-type: application/json');
chdir("../..");
include("header.php");
chdir("js/act");
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
include(PATHTOINCLUDES."base.php");
include(PATHTOINCLUDES."word_filter.php");
$args = array(
'uid' => FILTER_VALIDATE_INT,
'thepost' => FILTER_SANITIZE_STRING,
'displayname' => FILTER_SANITIZE_STRING,
'userphoto' => FILTER_SANITIZE_STRING
);
$sanitizeinputs = filter_input_array(INPUT_POST, $args);
$em="";
$uid=$_POST["uid"];
$thepost=$_POST["thepost"];
$thephoto=$_POST["userphoto"];
$thepost=strip_tags($thepost,"<strong>,<em>");
$thepost=filter_words($thepost);
$displayname=$_POST["displayname"];
date_default_timezone_set('America/Phoenix');
$thedate=time();
$thedate = date('YmdHis',$thedate);
$number = (((int)($uid/1000))*1000)+1000;
$ifp=$_SERVER["DOCUMENT_ROOT"]."/uploads_user/".$number."/".$uid."/";
if (!file_exists($ifp)) {
$thephoto="";
}
$actions->actions_add($user, "commwallcomment", Array($user->user_info['user_username'], $user->user_displayname, $thepost), Array(), 0, FALSE, "user", $user->user_info['user_id'], 0);
$sql=sprintf("INSERT INTO `community_wall` (`community_wall`.`msg`,`community_wall`.`userid`,`community_wall`.`datecreated`,`community_wall`.`displayname`,`community_wall`.`photo`)
VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($thepost, "text"),
GetSQLValueString($uid, "int"),
GetSQLValueString($thedate, "date"),
GetSQLValueString($displayname, "text"),
GetSQLValueString($thephoto, "text"));
$query=$database->database_query($sql) or $em=$em.$database->database_error();
$wid=$database->database_insert_id();
$number = (((int)($uid/1000))*1000)+1000;
//$uimage="/uploads_user/".$number."/".$row['userid']."/".$row['user_photo'];
if($thephoto=="")
{
$uimage="/images/nophoto.png";
}
else {
$uimage="/uploads_user/".$number."/".$uid."/".$thephoto;
}
$thephoto=$uimage;
$firstrow='<div class="wall-msg firstrow" id="wall_post_0">
<div class="wall-msg-pad">
<a href="http://bateworld.com/profile.php?user='.stripslashes($displayname).'" target="_community"><img src="'.$thephoto.'" width="50" /></a>
<div>
<span class="from_msg">Posted by <a href="http://bateworld.com/profile.php?user='.stripslashes($displayname).'" target="_community">'.stripslashes($displayname).'</a></span>
<span class="date_msg">Most Recent Post &lt; 1H</span>
<div class="wall-clear-right">&nbsp;</div>
</div>
<div class="wmsg" id="wmsg_'.$wid.'" style="border:none; outline: none;">'.stripslashes($thepost).'</div>
<div class="wall-clear">&nbsp;</div>
</div>';
if(isset($_SESSION["cp_userid"])){
if($_SESSION["cp_userid"]==21092 || $_SESSION["cp_userid"]==7653 || $_SESSION["cp_userid"]==6286 || $_SESSION["cp_userid"]==8){
$firstrow=$firstrow."<div style=\"position:relative;text-align:center;\">";
$firstrow=$firstrow."<input type=\"button\" value=\"D\" class=\"bl_delbutton\" onclick=\"del_wall_post('".$wid."','0')\" />";
$firstrow=$firstrow."<input type=\"button\" value=\"E\" class=\"bl_editbutton\" onclick=\"edit_wall_post('".$wid."','0')\" />";
$firstrow=$firstrow."<input type=\"button\" value=\"Update\" class=\"bl_updatebutton\" onclick=\"update_wall_post('".$wid."','0')\" />";
$firstrow=$firstrow."</div>";
}}
$firstrow=$firstrow."</div>";
$arr = array ('error' => $em, 'firstrow' => $firstrow, 'wid' => $wid);
echo json_encode($arr);
?>