$value) { $_POST[$key]=$value; } } if(!empty($_POST['user']) && !empty($_POST['pass'])){ $user = new User(0, $_POST['user'], $_POST['pass']); $user->login(false, true); } if (!User::canComment()) { die('{"error":"'.__("Permission denied").'"}'); } require_once 'comment.php'; if(!empty($_POST['id'])){ $_POST['id'] = intval($_POST['id']); if(Comment::userCanEditComment($_POST['id'])){ $obj = new Comment("", 0, $_POST['id']); $obj->setComment($_POST['comment']); } }else{ $obj = new Comment($_POST['comment'], $_POST['video']); $obj->setComments_id_pai($_POST['comments_id']); } echo '{"status":"'.$obj->save().'"}';