Skip to:
Content

bbPress.org

Changeset 728


Ignore:
Timestamp:
02/26/2007 10:48:35 PM (14 years ago)
Author:
mdawaffe
Message:

Clean up edit_deleted cap. It should only be used in meta caps. re #459

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/delete-post.php

    r662 r728  
    33
    44$post_id = (int) $_GET['id'];
    5 
    6 if ( bb_current_user_can('edit_deleted') && 'all' == $_GET['view'] ) {
    7     add_filter('get_topic_where', 'no_where');
    8     add_filter('bb_delete_post', 'topics_replied_on_undelete_post');
    9 }
    105
    116if ( !bb_current_user_can( 'delete_post', $post_id ) ) {
     
    2217    bb_die(__('There is a problem with that post, pardner.'));
    2318
     19if ( 0 == $status && 0 != $bb_post->post_status ) // We're undeleting
     20    add_filter('bb_delete_post', 'topics_replied_on_undelete_post');
     21
    2422bb_delete_post( $post_id, $status );
    2523
  • trunk/bb-admin/delete-topic.php

    r662 r728  
    11<?php
    22require('admin-action.php');
    3 
    4 if ( bb_current_user_can('edit_deleted') && 'all' == $_GET['view'] ) {
    5     add_filter('get_topic_where', 'no_where');
    6     add_filter('get_thread_post_ids_where', 'no_where');
    7 }
    83
    94$topic_id = (int) $_GET['id'];
     
    1611bb_check_admin_referer( 'delete-topic_' . $topic_id );
    1712
    18 $topic    =  get_topic ( $topic_id );
     13$topic = get_topic( $topic_id );
    1914
    2015if ( !$topic )
  • trunk/bb-edit.php

    r516 r728  
    33
    44bb_auth();
    5 
    6 if ( bb_current_user_can('edit_deleted') && 'all' == $_GET['view'] ) {
    7     add_filter('bb_is_first_where', 'no_where');
    8 }
    95
    106$post_id = (int) $_POST['post_id'];
     
    2218bb_check_admin_referer( 'edit-post_' . $post_id );
    2319
     20if ( 0 != $bb_post->post_status && 'all' == $_GET['view'] ) // We're trying to edit a deleted post
     21    add_filter('bb_is_first_where', 'no_where');
     22
    2423if ( bb_is_first( $bb_post->post_id ) && bb_current_user_can( 'edit_topic', $bb_post->topic_id ) )
    2524    bb_update_topic( $_POST['topic'], $bb_post->topic_id);
  • trunk/bb-includes/capabilities.php

    r723 r728  
    4646                        'view_by_ip' => true,       // view-ip.php
    4747                        'edit_closed' => true,      // Edit closed topics
    48                         'edit_deleted' => true,     // Edit deleted topics
     48                        'edit_deleted' => true,     // Edit deleted topics/posts
    4949                        'browse_deleted' => true,   // Use 'deleted' view
    5050                        'edit_others_tags' => true,
     
    364364            $caps[] = 'ignore_edit_lock';
    365365        break;
     366    case 'delete_post' : // edit_deleted, delete_posts
     367        if ( !$bb_post = bb_get_post( $args[0] ) ) :
     368            $caps[] = 'magically_provide_data_given_bad_input';
     369            return $caps;
     370        endif;
     371        if ( 0 != $bb_post->post_status )
     372            $caps[] = 'edit_deleted';
     373        // NO BREAK
    366374    case 'manage_posts' : // back compat
    367     case 'delete_post' :
    368375        $caps[] = 'delete_posts';
    369376        break;
     
    395402    case 'delete_topic' :
    396403        $caps[] = 'delete_topics';
     404        add_filter( 'get_topic_where', 'no_where', 9999 );
     405        if ( !$topic = get_topic( $args[0] ) ) :
     406            $caps[] = 'magically_provide_data_given_bad_input';
     407            return $caps;
     408        endif;
     409        if ( 0 != $topic->topic_status )
     410            $caps[] = 'edit_deleted';
     411        remove_filter( 'get_topic_where', 'no_where', 9999 );
    397412        break;
    398413    case 'manage_topics' : // back compat
  • trunk/bb-includes/functions.php

    r722 r728  
    953953        if ( $new_status == $old_status )
    954954            return;
     955        if ( 0 != $old_status && 0 == $new_status )
     956            add_filter('get_thread_post_ids_where', 'no_where');
    955957        $post_ids = get_thread_post_ids( $topic_id );
    956958        $post_ids['post'] = array_reverse((array) $post_ids['post']);
  • trunk/edit.php

    r636 r728  
    33
    44bb_auth();
    5 
    6 if ( bb_current_user_can('edit_deleted') && 'all' == $_GET['view'] ) {
    7     add_filter('bb_is_first_where', 'no_where');
    8 }
    95
    106$post_id = (int) $_GET['id'];
     
    1612    die();
    1713}
     14
     15if ( 0 != $bb_post->post_status && 'all' == $_GET['view'] ) // We're trying to edit a deleted post
     16    add_filter('bb_is_first_where', 'no_where');
    1817
    1918$topic = get_topic( $bb_post->topic_id );
Note: See TracChangeset for help on using the changeset viewer.