Changeset 3746
- Timestamp:
- 10/01/09 17:28:20 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/system/plugins/undelete/undelete.plugin.php
r3715 r3746 41 41 // see the false return value, and simply return, leaving 42 42 // the post in the database. 43 if( $post->status != Post::status( 'deleted' ) && is_object( User::get_by_id( $post->user_id )) ) {43 if( $post->status != Post::status( 'deleted' ) && ACL::access_check( $post->get_access(), 'delete' ) ) { 44 44 $post->info->prior_status = $post->status; 45 45 $post->status = Post::status( 'deleted' ); … … 54 54 public function filter_post_actions($actions, $post) 55 55 { 56 if ( $post->status == Post::status('deleted') ) {56 if ( $post->status == Post::status('deleted') && ACL::access_check( $post->get_access(), 'delete' ) ) { 57 57 $actions['remove']['label']= _t('Delete forever'); 58 58 $actions['remove']['title']= _t('Permanently delete this post'); … … 76 76 { 77 77 $post = Post::get( array( 'id' => $post_id, 'status' => Post::status('any') ) ); 78 if ( $post->status == Post::status('deleted') ) {78 if ( $post->status == Post::status('deleted') && ACL::access_check( $post->get_access(), 'delete' ) ) { 79 79 $post->status = $post->info->prior_status ? $post->info->prior_status : Post::status( 'draft' ); 80 80 unset( $post->info->prior_status ); … … 106 106 } 107 107 108 private function get_perms() 109 { 110 $type_perms = array(); 111 $types = Post::list_active_post_types(); 112 foreach( $types as $key => $value ) { 113 $perm = array( 'post_' . $key => ACL::get_bitmask( 'delete' ) ); 114 $types_perms = array_merge( $type_perms, $perm ); 115 } 116 $perms = array( 'own_posts' => ACL::get_bitmask( 'delete' ), 'post_any' => ACL::get_bitmask( 'delete' ) ); 117 $perms = array_merge( $perms, $type_perms ); 118 return $perms; 119 } 120 108 121 public function filter_plugin_config( $actions, $plugin_id ) 109 122 { 110 123 if ( $plugin_id == $this->plugin_id() ) { 111 124 $actions[]= _t( 'Configure' ); 112 $actions[]= _t( 'Empty Trash' ); 125 if( User::identify()->can_any( $this->get_perms() ) ) { 126 $actions[]= _t( 'Empty Trash' ); 127 } 113 128 } 114 129 return $actions; … … 161 176 162 177 foreach($posts as $post) { 163 $post->delete(); 164 $count++; 178 if( ACL::access_check( $post->get_access(), 'delete' ) ) { 179 $post->delete(); 180 $count++; 181 } 165 182 } 166 183
Note: See TracChangeset
for help on using the changeset viewer.
