WordPress.org

Make WordPress Core

Ticket #2526: 2526.4.diff

File 2526.4.diff, 1.3 KB (added by robmiller, 12 years ago)

Switched admin page creation to use caps

  • wp-db-backup.php

     
    6363        } 
    6464 
    6565        function init() { 
    66                 global $user_level; 
    67                 get_currentuserinfo(); 
     66                 
     67                // Since we can't guarantee the existence of a particular role, allow users with the manage_options capability to backup. 
     68                if (!current_user_can('manage_options')) die(__('Insufficient permissions.')); 
    6869 
    69                 if ($user_level < 9) die(__('Need higher user level.')); 
    70  
    7170                if (isset($_GET['backup'])) { 
    7271                        $via = isset($_GET['via']) ? $_GET['via'] : 'http'; 
    7372 
     
    323322 
    324323        /////////////////////////////// 
    325324        function admin_menu() { 
    326                 add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu')); 
     325                add_management_page(__('Backup'), __('Backup'), 'manage_options', basename(__FILE__), array(&$this, 'backup_menu')); 
    327326        } 
    328327 
    329328        function fragment_menu() { 
    330                 add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'build_backup_script')); 
     329                add_management_page(__('Backup'), __('Backup'), 'manage_options', basename(__FILE__), array(&$this, 'build_backup_script')); 
    331330        } 
    332331 
    333332        /////////////////////////////////////////////////////////