<?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 ### */

	$mImageId = $p["imageId"];
	if($systemExecution->runQuery("SELECT COUNT(id) AS timelineCount FROM web_timeline WHERE post_image_id = '%s'", $mImageId)->fetch_object()->timelineCount > 0) {
		$mSource = $systemExecution->runQuery("SELECT * FROM web_timeline WHERE post_image_id = '%s'", $mImageId)->fetch_assoc();
		$mUser = new systemUSER($mSource["post_user_id"]);
		
		$a["fullName"] = $mUser->mFullname;
		$a["userId"] = $mUser->mUserId;
		$a["userPicture"] = $mUser->mProfilePicture;
		$a["timelineId"] = $mSource["id"];
		$a["timeAgo"] = $systemCore->timeAgo($mSource["post_submit_date"]);
		$a["iconPublicy"] = $mSource["post_privacy"] == 1 ? "globe" : ($mSource["post_privacy"] == 2 ? "user" : "lock");
		$a["postText"] = $systemSmilies->initializeSmilies($mSource["post_text"]);
	}
	
	/* ### DO NOT CHANGE ANYTHING FROM HERE ### */
	header("Content-Type: application/json");
	echo json_encode($mPong);
?>