예제 #1
0
파일: create.php 프로젝트: sebadorn/aestas3
/**
 * Update the comment.
 * @return {int} ID of the comment.
 */
function updateComment()
{
    if (!isset($_POST['edit-id'], $_POST['comment-author-name'], $_POST['comment-author-email'], $_POST['comment-author-url'], $_POST['comment-content'], $_POST['comment-user']) || $_POST['comment-content'] === '') {
        header('Location: ../admin.php?error=missing_data_for_comment');
        exit;
    }
    $content = nl2br($_POST['comment-content']);
    $comment = new ae_CommentModel();
    $comment->load($_POST['edit-id']);
    $comment->setAuthorName($_POST['comment-author-name']);
    $comment->setAuthorEmail($_POST['comment-author-email']);
    $comment->setAuthorUrl($_POST['comment-author-url']);
    $comment->setContent($content);
    $comment->setUserId($_POST['comment-user']);
    if (!$comment->save()) {
        return FALSE;
    }
    return $comment->getId();
}