[ Index ]

WordPress Source Cross Reference

title

Body

[close]

/wp-admin/ -> link.php (source)

   1  <?php
   2  require_once  ('admin.php');
   3  
   4  wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
   5  
   6  if ('' != $_POST['deletebookmarks'])
   7      $action = 'deletebookmarks';
   8  if ('' != $_POST['move'])
   9      $action = 'move';
  10  if ('' != $_POST['linkcheck'])
  11      $linkcheck = $_POST[linkcheck];
  12  
  13  $this_file = 'link-manager.php';
  14  
  15  switch ($action) {
  16          case 'deletebookmarks' :
  17          check_admin_referer('bulk-bookmarks');
  18  
  19          // check the current user's level first.
  20          if (!current_user_can('manage_links'))
  21              wp_die(__('Cheatin&#8217; uh?'));
  22  
  23          //for each link id (in $linkcheck[]) change category to selected value
  24          if (count($linkcheck) == 0) {
  25              wp_redirect($this_file);
  26              exit;
  27          }
  28  
  29          $deleted = 0;
  30          foreach ($linkcheck as $link_id) {
  31              $link_id = (int) $link_id;
  32              
  33              if ( wp_delete_link($link_id) )
  34                  $deleted++;
  35          }
  36  
  37          wp_redirect("$this_file?deleted=$deleted");
  38          break;
  39  
  40      case 'move' :
  41          check_admin_referer('bulk-bookmarks');
  42  
  43          // check the current user's level first.
  44          if (!current_user_can('manage_links'))
  45              wp_die(__('Cheatin&#8217; uh?'));
  46  
  47          //for each link id (in $linkcheck[]) change category to selected value
  48          if (count($linkcheck) == 0) {
  49              wp_redirect($this_file);
  50              exit;
  51          }
  52          $all_links = join(',', $linkcheck);
  53          // should now have an array of links we can change
  54          //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
  55  
  56          wp_redirect($this_file);
  57          break;
  58  
  59      case 'add' :
  60          check_admin_referer('add-bookmark');
  61  
  62          add_link();
  63  
  64          wp_redirect(wp_get_referer().'?added=true');
  65          break;
  66  
  67      case 'save' :
  68          $link_id = (int) $_POST['link_id'];
  69          check_admin_referer('update-bookmark_' . $link_id);
  70  
  71          edit_link($link_id);
  72  
  73          wp_redirect($this_file);
  74          exit;
  75          break;
  76  
  77      case 'delete' :
  78          $link_id = (int) $_GET['link_id'];
  79          check_admin_referer('delete-bookmark_' . $link_id);
  80  
  81          if (!current_user_can('manage_links'))
  82              wp_die(__('Cheatin&#8217; uh?'));
  83  
  84          wp_delete_link($link_id);
  85  
  86          wp_redirect($this_file);
  87          break;
  88  
  89      case 'edit' :
  90          wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
  91          if ( current_user_can( 'manage_categories' ) )
  92              wp_enqueue_script( 'ajaxcat' );
  93          $parent_file = 'link-manager.php';
  94          $submenu_file = 'link-manager.php';
  95          $title = __('Edit Bookmark');
  96          include_once  ('admin-header.php');
  97          if (!current_user_can('manage_links'))
  98              wp_die(__('You do not have sufficient permissions to edit the bookmarks for this blog.'));
  99  
 100          $link_id = (int) $_GET['link_id'];
 101  
 102          if (!$link = get_link_to_edit($link_id))
 103              wp_die(__('Link not found.'));
 104  
 105          include  ('edit-link-form.php');
 106          break;
 107  
 108      default :
 109          break;
 110  }
 111  
 112  include  ('admin-footer.php');
 113  ?>

Your comment here...

Name: Location:
Comments:


List: Classes | Functions | Variables | Constants | Tables

Generated: Sat Jul 15 11:57:04 2006 Courtesy of Taragana