71 lines
4.1 KiB
PHP
71 lines
4.1 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");
|
||
|
|
date_default_timezone_set("UTC");
|
||
|
|
$args = array(
|
||
|
|
'uid' => FILTER_VALIDATE_INT,
|
||
|
|
'vid' => FILTER_VALIDATE_INT,
|
||
|
|
'thepost' => FILTER_SANITIZE_STRING
|
||
|
|
);
|
||
|
|
$sanitizeinputs = filter_input_array(INPUT_POST, $args);
|
||
|
|
$pathtopurifier=$_SERVER["DOCUMENT_ROOT"].'/include/htmlpurifier/library/';
|
||
|
|
require_once $pathtopurifier.'HTMLPurifier.includes.php';
|
||
|
|
//require_once $pathtopurifier.'HTMLPurifier.auto.php';
|
||
|
|
$config = HTMLPurifier_Config::createDefault();
|
||
|
|
$config->set('HTML.Allowed', 'b,i,br,img');
|
||
|
|
$config->set('HTML.AllowedAttributes', 'src,alt');
|
||
|
|
$purifier = new HTMLPurifier($config);
|
||
|
|
$thepost=$_POST['thepost'];
|
||
|
|
$vidid=$_POST['vid'];
|
||
|
|
$userid=$_POST['uid'];
|
||
|
|
$username=$_POST["username"];
|
||
|
|
$userphoto=$_POST["userphoto"];
|
||
|
|
$thepost=str_replace("’", "'", $thepost);
|
||
|
|
$thepost=str_replace("“", '"', $thepost);
|
||
|
|
$thepost=str_replace("â€", "'", $thepost);
|
||
|
|
$thepost=str_replace("‘", "'", $thepost);
|
||
|
|
$thepost=str_replace("…", "...", $thepost);
|
||
|
|
$thepost=str_replace("—", "-", $thepost);
|
||
|
|
$thepost=str_replace("–", "-", $thepost);
|
||
|
|
$thepost=str_replace("😜", " ", $thepost);
|
||
|
|
$thepost=filter_words($thepost);
|
||
|
|
$thepost = $purifier->purify($thepost);
|
||
|
|
$em="";
|
||
|
|
|
||
|
|
$sql=sprintf("INSERT INTO `mms_comments` (`mms_comments`.`vid`,`mms_comments`.`userid`,`mms_comments`.`thecomment`, `mms_comments`.`thedate`)
|
||
|
|
VALUES (%s,%s,%s,UTC_TIMESTAMP())",
|
||
|
|
GetSQLValueString($vidid, "int"),
|
||
|
|
GetSQLValueString($userid, "int"),
|
||
|
|
GetSQLValueString($thepost, "text"));
|
||
|
|
$query=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
$mmsid=$database->database_insert_id();
|
||
|
|
$now = time();
|
||
|
|
$ndate = date('Y-m-d H:i:s',$now);
|
||
|
|
$number = (((int)($userid/1000))*1000)+1000;
|
||
|
|
if($userphoto=="")
|
||
|
|
{
|
||
|
|
$uimage="/images/nophoto.png";
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
|
||
|
|
$uimage="/uploads_user/".$number."/".$userid."/".$userphoto;
|
||
|
|
$thepath = pathinfo($uimage);
|
||
|
|
$uimage_thumb="/uploads_user/".$number."/".$userid."/".$thepath['filename']."_thumb.".$thepath['extension'];
|
||
|
|
$uimage_thumb_file=$_SERVER["DOCUMENT_ROOT"]. "/uploads_user/".$number."/".$userid."/".$thepath['filename']."_thumb.".$thepath['extension'];
|
||
|
|
if (file_exists($uimage_thumb_file)) {$uimage=$uimage_thumb;} else {}
|
||
|
|
|
||
|
|
}
|
||
|
|
$thecomment="";
|
||
|
|
$thecomment=$thecomment.'<div id="comment_'.$mmsid.'" class="tempcomment"><div style="margin-top: 10px; margin-bottom: 20px;">
|
||
|
|
<div style="float: left; text-align: center; width: 90px;"><img src="'.$uimage.'" class="photo" width="75" border="0"></div>';
|
||
|
|
$thecomment=$thecomment.'<div style="overflow: hidden;"><div class="profile_comment_author"><b>'.$username.'</b></div><div class="profile_comment_date">'.$ndate.'</div><div class="profile_comment_body" id="profile_comment_body_'.$mmsid.'" style="max-width:none;font-size:110%;line-height:140%;max-height:100px;overflow:auto;">'.$thepost.'</div>';
|
||
|
|
$thecomment=$thecomment.'<div class="profile_comment_links" id="profile_comment_links_'.$mmsid.'"><a class="commentDeleteLink" href="javascript:void(0);" id="comment_delete_link_'.$mmsid.'" onclick="deletecomment('.$mmsid.')" style="color:red;">delete</a> -
|
||
|
|
<a class="commentEditLink" href="javascript:void(0);" id="comment_edit_link_'.$mmsid.'" onclick="edit_comment_post('.$mmsid.');">edit</a> </div><div style="display:none;text-align:right;" id="update_comment_'.$mmsid.'"><a href="javascript:void(0);" onclick="cancel_edit_comment('.$mmsid.')">Cancel</a><span style="padding:0px 5px;"> </span><a href="javascript:void(0);" onclick="update_comment('.$mmsid.');">Update</a></div><div id="edit_spin_'.$mmsid.'" style="text-align:center;display:none;"><i class="fa fa-circle-o-notch fa-spin"></i></div>';
|
||
|
|
$thecomment=$thecomment.'</div></div><div class="clear"></div></div>';
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$arr = array ('error' => $em, 'mmsid'=>$mmsid, 'thecomment'=>$thepost,'thecomment'=>$thecomment);
|
||
|
|
echo json_encode($arr);
|
||
|
|
?>
|