Try:
<?php if (current_user_can('edit_post', $post->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>
You can decide when to empty the WordPress trash by adding this code to the wp-config.php file in your WordPress root directory.
define('EMPTY_TRASH_DAYS', 1 );
The 1 in the code signifies you want to empty the trash everyday. If you set to 0, the trash functionality will be disabled.
Finally, WordPress doesn't delete images when they are no longer attached to a page. See this ticket for an explanation: http://core.trac.wordpress.org/ticket/12108 Gist being that
media files may be used by other posts
as well, which is why they must be
deleted in the media library. If we
changed it so that deleting a file
from a post deleted it altogether from
the system, it would break the
existing behavior and cause a lot of
unintentional deletions.
If you want to go against that rational, you can add this to your functions.php:
function delete_post_children($post_id) {
global $wpdb;
$ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_parent = $post_id AND post_type = 'attachment'");
foreach ( $ids as $id )
wp_delete_attachment($id);
}
add_action('delete_post', 'delete_post_children');
Also see Upload Janitor if you want to go the plug-in route for deleting unattached images.