コード例 #1
0
ファイル: web_index.php プロジェクト: jingyexu/ezcast
/**
 * Used to remove a comment
 * @global type $input
 */
function comment_delete()
{
    global $input;
    $id = $input['comment_id'];
    comment_delete_by_id($id);
    cache_asset_threads_unset($_SESSION['album'], $_SESSION['asset']);
    $_SESSION['current_thread'] = $input['thread_id'];
    trace_append(array('3', 'comment_delete', $_SESSION['album'], $_SESSION['asset'], $input['thread_id'], $id));
    return thread_details_update();
}
コード例 #2
0
ファイル: lib_threads_pdo.php プロジェクト: jingyexu/ezcast
/**
 * Deletes a comment using his ID
 * @global null $db
 * @param int $id
 * @return boolean error flag
 */
function comment_delete_by_id($id)
{
    global $statements;
    $comment = comment_select_by_id($id);
    $statements['comment_delete_by_id']->bindParam(':id', $id);
    $res = $statements['comment_delete_by_id']->execute();
    if ($res) {
        thread_update_nbComments($comment['thread'], FALSE);
        if ($comment['nbChilds'] > 0) {
            $children = comment_children_get($id);
            foreach ($children as $child) {
                comment_delete_by_id($child['id']);
            }
        }
        if ($comment['parent'] != NULL) {
            comment_update_nbChild($comment['parent'], FALSE);
        }
    }
    log_append('Delete comment: ', 'Delete comment with id = ' . $id);
    return $res;
}