Changeset 2714
- Timestamp:
- 07/15/2005 02:16:45 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
-
wp-admin/admin-functions.php (modified) (3 diffs)
-
wp-admin/categories.php (modified) (5 diffs)
-
wp-admin/edit-form-advanced.php (modified) (1 diff)
-
wp-admin/edit-form-comment.php (modified) (1 diff)
-
wp-admin/edit.php (modified) (1 diff)
-
wp-admin/link-categories.php (modified) (4 diffs)
-
wp-admin/link-import.php (modified) (2 diffs)
-
wp-admin/link-manager.php (modified) (12 diffs)
-
wp-admin/options.php (modified) (2 diffs)
-
wp-admin/page-new.php (modified) (2 diffs)
-
wp-admin/plugin-editor.php (modified) (2 diffs)
-
wp-admin/theme-editor.php (modified) (2 diffs)
-
wp-includes/capabilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r2709 r2714 445 445 // Dandy new recursive multiple category stuff. 446 446 function cat_rows($parent = 0, $level = 0, $categories = 0) { 447 global $wpdb, $class, $current_user; 448 449 $user_level = $current_user->user_level; 447 global $wpdb, $class; 450 448 451 449 if ( !$categories ) … … 458 456 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 459 457 $pad = str_repeat('— ', $level); 460 if ( $user_level > 3)458 if ( current_user_can('manage_categories') ) 461 459 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>" . __('Edit') . "</a></td><td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return confirm('". sprintf(__("You are about to delete the category \'%s\'. All of its posts will go to the default category.\\n \'OK\' to delete, \'Cancel\' to stop."), $wpdb->escape($category->cat_name)) . "')\" class='delete'>" . __('Delete') . "</a>"; 462 460 else … … 478 476 479 477 function page_rows( $parent = 0, $level = 0, $pages = 0 ) { 480 global $wpdb, $class, $ user_level, $post;478 global $wpdb, $class, $post; 481 479 if (!$pages) 482 480 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order"); -
trunk/wp-admin/categories.php
r2695 r2714 25 25 case 'addcat': 26 26 27 if ( $user_level < 3)27 if ( !current_user_can('manage_categories') ) 28 28 die (__('Cheatin’ uh?')); 29 29 … … 37 37 check_admin_referer(); 38 38 39 if ( $user_level < 3)39 if ( !current_user_can('manage_categories') ) 40 40 die (__('Cheatin’ uh?')); 41 41 … … 94 94 95 95 case 'editedcat': 96 if ( $user_level < 3)96 if ( !current_user_can('manage_categories') ) 97 97 die (__('Cheatin’ uh?')); 98 98 … … 116 116 117 117 <div class="wrap"> 118 <?php if ( $user_level > 3) : ?>118 <?php if ( current_user_can('manage_categories') ) : ?> 119 119 <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 120 120 <?php else : ?> … … 136 136 </div> 137 137 138 <?php if ( $user_level > 3) : ?>138 <?php if ( current_user_can('manage_categories') ) : ?> 139 139 <div class="wrap"> 140 140 <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(1)) ?> -
trunk/wp-admin/edit-form-advanced.php
r2709 r2714 98 98 </fieldset> 99 99 100 <?php if ( $user_level > 4) : ?>100 <?php if ( current_user_can('edit_posts') ) : ?> 101 101 <fieldset class="dbx-box"> 102 102 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3> -
trunk/wp-admin/edit-form-comment.php
r2662 r2714 72 72 </tr> 73 73 74 <?php if ( $user_level > 4) : ?>74 <?php if ( current_user_can('edit_posts') ) : ?> 75 75 <tr> 76 76 <th scope="row"><?php _e('Edit time'); ?>:</th> -
trunk/wp-admin/edit.php
r2709 r2714 253 253 <?php comment_time('g:m:s a') ?> 254 254 <?php 255 if ( ($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {255 if ( current_user_can('edit_post', $post->ID) ) { 256 256 echo "[ <a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" . __('Edit') . "</a>"; 257 257 echo " - <a href=\"post.php?action=deletecomment&p=".$post->ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> "; -
trunk/wp-admin/link-categories.php
r2699 r2714 26 26 case 'addcat': 27 27 { 28 if ( $user_level < 5)28 if ( !current_user_can('manage_links') ) 29 29 die (__("Cheatin' uh ?")); 30 30 … … 86 86 die(sprintf(__("Can't delete the <strong>%s</strong> link category: this is the default one"), $cat_name)); 87 87 88 if ( $user_level < 5)88 if ( !current_user_can('manage_links') ) 89 89 die (__("Cheatin' uh ?")); 90 90 … … 199 199 case "editedcat": 200 200 { 201 if ( $user_level < 5)201 if ( !current_user_can('manage_links') ) 202 202 die (__("Cheatin' uh ?")); 203 203 … … 271 271 { 272 272 include_once ("admin-header.php"); 273 if ( $user_level < 5) {273 if ( !current_user_can('manage_links') ) 274 274 die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)")); 275 }276 275 ?> 277 276 -
trunk/wp-admin/link-import.php
r2699 r2714 16 16 { 17 17 include_once('admin-header.php'); 18 if ( $user_level < 5)18 if ( !current_user_can('manage_links') ) 19 19 die (__("Cheatin’ uh?")); 20 20 … … 66 66 case 1: { 67 67 include_once('admin-header.php'); 68 if ( $user_level < 5)68 if ( !current_user_can('manage_links') ) 69 69 die (__("Cheatin' uh ?")); 70 70 ?> -
trunk/wp-admin/link-manager.php
r2521 r2714 75 75 76 76 // check the current user's level first. 77 if ( $user_level < 5)77 if ( !current_user_can('manage_links') ) 78 78 die (__("Cheatin' uh ?")); 79 79 … … 86 86 } 87 87 $all_links = join(',', $linkcheck); 88 $results = $wpdb->get_results("SELECT link_id, link_owner , user_levelFROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)");88 $results = $wpdb->get_results("SELECT link_id, link_owner FROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)"); 89 89 foreach ($results as $row) { 90 if (($user_level >= $row->user_level)) { // ok to proceed 91 $ids_to_change[] = $row->link_id; 92 } 90 $ids_to_change[] = $row->link_id; 93 91 } 94 92 … … 105 103 106 104 // check the current user's level first. 107 if ( $user_level < 5)105 if ( !current_user_can('manage_links') ) 108 106 die (__("Cheatin' uh ?")); 109 107 … … 142 140 143 141 // check the current user's level first. 144 if ( $user_level < 5)142 if ( !current_user_can('manage_links') ) 145 143 die (__("Cheatin' uh ?")); 146 144 … … 176 174 $auto_toggle = get_autotoggle($link_category); 177 175 178 if ( $user_level < 5)176 if ( !current_user_can('manage_links') ) 179 177 die (__("Cheatin' uh ?")); 180 178 … … 224 222 $auto_toggle = get_autotoggle($link_category); 225 223 226 if ( $user_level < 5)224 if ( !current_user_can('manage_links') ) 227 225 die (__("Cheatin' uh ?")); 228 226 … … 254 252 $link_id = (int) $_GET['link_id']; 255 253 256 if ( $user_level < 5)254 if ( !current_user_can('manage_links') ) 257 255 die (__("Cheatin' uh ?")); 258 256 … … 275 273 $xfn = true; 276 274 include_once ('admin-header.php'); 277 if ( $user_level < 5)275 if ( !current_user_can('manage_links') ) 278 276 die(__('You do not have sufficient permissions to edit the links for this blog.')); 279 277 … … 541 539 setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600); 542 540 include_once ("./admin-header.php"); 543 if ( $user_level < 5) {541 if ( !current_user_can('manage_links') ) 544 542 die(__("You do not have sufficient permissions to edit the links for this blog.")); 545 }546 543 547 544 switch ($order_by) … … 647 644 $sql = "SELECT link_url, link_name, link_image, link_description, link_visible, 648 645 link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id, 649 link_rating, link_rel , $wpdb->users.user_level646 link_rating, link_rel 650 647 FROM $wpdb->links 651 648 LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id … … 690 687 $show_buttons = 1; // default 691 688 692 if ($link->user_level > $user_level) {693 $show_buttons = 0;694 }695 696 689 if ($show_buttons) { 697 690 echo '<td><a href="link-manager.php?link_id=' . $link->link_id . '&action=linkedit" class="edit">' . __('Edit') . '</a></td>'; … … 717 710 <?php _e('Assign ownership to:'); ?> 718 711 <?php 719 $results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0ORDER BY ID");712 $results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY ID"); 720 713 echo " <select name=\"newowner\" size=\"1\">\n"; 721 714 foreach ($results as $row) { -
trunk/wp-admin/options.php
r2624 r2714 22 22 } 23 23 24 if ( $user_level < 6)24 if ( !current_user_can('manage_options') ) 25 25 die ( __('Cheatin’ uh?') ); 26 26 … … 51 51 $options = apply_filters( 'options_to_update' , $options ); 52 52 foreach ($options as $option) { 53 // should we even bother checking? 54 if ($user_level >= $option->option_admin_level) { 55 $old_val = $option->option_value; 56 $new_val = trim($_POST[$option->option_name]); 57 if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') ) 58 $new_val = 'closed'; 59 if ($new_val !== $old_val) { 60 $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"); 61 $any_changed++; 62 } 63 } 53 $old_val = $option->option_value; 54 $new_val = trim($_POST[$option->option_name]); 55 if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') ) 56 $new_val = 'closed'; 57 if ($new_val !== $old_val) { 58 $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"); 59 $any_changed++; 60 } 64 61 } 65 62 unset($cache_settings); // so they will be re-read -
trunk/wp-admin/page-new.php
r2652 r2714 4 4 $parent_file = 'post.php'; 5 5 require_once('admin-header.php'); 6 7 get_currentuserinfo();8 6 ?> 9 7 … … 13 11 14 12 <?php 15 if ( $user_level > 0) {13 if ( current_user_can('edit_pages') ) { 16 14 $action = 'post'; 17 15 get_currentuserinfo(); -
trunk/wp-admin/plugin-editor.php
r2372 r2714 35 35 case 'update': 36 36 37 if ( $user_level < 5) {37 if ( !current_user_can('edit_plugins') ) 38 38 die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>')); 39 }40 39 41 40 $newcontent = stripslashes($_POST['newcontent']); … … 56 55 57 56 require_once('admin-header.php'); 58 if ( $user_level <= 5) {57 if ( !current_user_can('edit_plugins') ) 59 58 die(__('<p>You have do not have sufficient permissions to edit plugins for this blog.</p>')); 60 }61 59 62 60 update_recently_edited("wp-content/plugins/$file"); -
trunk/wp-admin/theme-editor.php
r2553 r2714 46 46 case 'update': 47 47 48 if ( $user_level < 5) {48 if ( !current_user_can('edit_themes') ) 49 49 die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>')); 50 }51 50 52 51 $newcontent = stripslashes($_POST['newcontent']); … … 68 67 69 68 require_once('admin-header.php'); 70 if ( $user_level <= 5) {69 if ( !current_user_can('edit_themes') ) 71 70 die(__('<p>You have do not have sufficient permissions to edit themes for this blog.</p>')); 72 }73 71 74 72 update_recently_edited($file); -
trunk/wp-includes/capabilities.php
r2713 r2714 124 124 $this->cap_key = $table_prefix . 'capabilities'; 125 125 $this->caps = &$this->data->{$this->cap_key}; 126 if ( ! is_array($this->caps) ) 127 $this->caps = array(); 126 128 $this->get_role_caps(); 127 129 }
Note: See TracChangeset
for help on using the changeset viewer.