<?php
	require_once("../system.engine/system.core.php");
	
	$mPong = array();
	$a = &$mPong;
	$p = &$_POST;
	
	global $systemHandler;
	$systemExecution = $systemHandler->loadHandler("EXECUTION");
	$systemHash = $systemHandler->loadHandler("HASH");
	$systemSmilies = $systemHandler->loadHandler("SMILIES");
	/* ### DO YOUR CODES ONLY FROM HERE ### */
	
	$mCommentId = $p["commentId"];
	$mUserId = $systemHandler->loadHandler("USER")->mUserId;
	
	$a["newCommentHTML"] = null;
	
	if($systemExecution->runQuery("SELECT COUNT(id) AS commentCount FROM web_comments WHERE id = '%s' AND user_id = '%s'", array($mCommentId, $mUserId))->fetch_object()->commentCount > 0) {
		$a["newCommentHTML"] = htmlspecialchars($systemExecution->runQuery("SELECT comment_text FROM web_comments WHERE id = '%s'", $mCommentId)->fetch_object()->comment_text);
	}
	
	/* ### DO NOT CHANGE ANYTHING FROM HERE ### */
	header("Content-Type: application/json");
	echo json_encode($mPong);
?>