Files
Testing/wall/include/wall/wall_insert_text_message.php
sean 343b4a3f3f
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-19 18:32:17 -05:00

70 lines
3.9 KiB
PHP

<?php header('Content-type: application/json');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/wall/include/');
include(PATHTOINCLUDES."base.php");
include(PATHTOINCLUDES."/wall/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=filter_words($thepost);
$displayname=$_POST["displayname"];
date_default_timezone_set('UTC');
$number = (((int)($uid/1000))*1000)+1000;
$ifp=$_SERVER["DOCUMENT_ROOT"]."/uploads_user/".$number."/".$uid."/";
if (!file_exists($ifp)) { $thephoto="";}
//$pathtopurifier=$_SERVER["DOCUMENT_ROOT"].'/include/analytics/purifier/library/';
$pathtopurifier=$_SERVER["DOCUMENT_ROOT"].'/include/htmlpurifier/library/';
require_once $pathtopurifier.'HTMLPurifier.includes.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'b,i,br,img');
$config->set('HTML.AllowedAttributes', 'src,alt');
$purifier = new HTMLPurifier($config);
$thepost = $purifier->purify($thepost);
$sql=sprintf("INSERT INTO `community_wall` (`community_wall`.`msg`,`community_wall`.`userid`,`community_wall`.`datecreated`,`community_wall`.`displayname`,`community_wall`.`photo`)
VALUES (%s, %s,UTC_TIMESTAMP(), %s, %s)",
GetSQLValueString($thepost, "text"),
GetSQLValueString($uid, "int"),
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;
if($thephoto=="")
{
$uimage="/images/nophoto.png";
}
else {
$uimage="/uploads_user/".$number."/".$uid."/".$thephoto;
}
$ug="&lt; 1HR";
$thephoto=$uimage;
$userpost="";
$userpost=$userpost."<div class=\"wall-msg clearfix\" id=\"wall_post_last\" style=\"border-bottom:1px solid #333;background-color:#FFE5B4;color:#000 !important; \">
<div class=\"wall-msg-pad\" style=\"padding:10px 10px 10px 75px;position:relative;text-align:left;\">
<div class=\"msg_header\">
<a href=\"/profile.php?user=".stripslashes($displayname)."\" target=\"_community\"><img src=\"".$uimage."\" width=\"60\" height=\"60\" style=\"border-radius:50px 50px 0 0;position:absolute;top:8px; left:5px;\" /></a><span class=\"from_msg\" style=\"font-weight:700;line-height:140%;\"><a href=\"/profile.php?user=".stripslashes($displayname)."\" target=\"_community\">".stripslashes($displayname)."</a></span>
<time class=\"date_msg\" style=\"float:right;color:#000;\">".$ug."</time>
</div>
<div class=\"wmsg\" id=\"wmsg_".$wid."\" style=\"border:none; outline: none;line-height:140%;color:#000;\">".stripslashes($thepost)."</div>
<div class=\"wall-msg-footer\" style=\"min-height:20px;\"></div>
</div>";
if($_SESSION["cp_userid"]==21092 || $_SESSION["cp_userid"]==7563 || $_SESSION["cp_userid"]==6286 || $_SESSION["cp_userid"]==8 || $_SESSION["cp_userid"]==58188){
$userpost=$userpost."<div style=\"position:relative;text-align:center;\">";
$userpost=$userpost."<input type=\"button\" value=\"D\" class=\"bl_delbutton\" onclick=\"del_wall_post('".$wid."','0')\" />";
$userpost=$userpost."<input type=\"button\" value=\"E\" class=\"bl_editbutton\" onclick=\"edit_wall_post('".$wid."','last')\" />";
$userpost=$userpost."<input type=\"button\" value=\"Update\" class=\"bl_updatebutton\" onclick=\"update_wall_post('".$wid."','last')\" />";
$userpost=$userpost."</div>";
}
$userpost=$userpost."</div>";
$arr = array ('error' => $em, 'userpost'=>$userpost, 'wid' => $wid);
echo json_encode($arr);
?>