2 require_once ('admin.php');
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[]'));
6 if ( ! current_user_can('manage_links') )
7 wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
9 if ('' != $_POST['deletebookmarks'])
10 $action = 'deletebookmarks';
11 if ('' != $_POST['move'])
13 if ('' != $_POST['linkcheck'])
14 $linkcheck = $_POST[linkcheck];
16 $this_file = 'link-manager.php';
19 case 'deletebookmarks' :
20 check_admin_referer('bulk-bookmarks');
22 //for each link id (in $linkcheck[]) change category to selected value
23 if (count($linkcheck) == 0) {
24 wp_redirect($this_file);
29 foreach ($linkcheck as $link_id) {
30 $link_id = (int) $link_id;
32 if ( wp_delete_link($link_id) )
36 wp_redirect("$this_file?deleted=$deleted");
41 check_admin_referer('bulk-bookmarks');
43 //for each link id (in $linkcheck[]) change category to selected value
44 if (count($linkcheck) == 0) {
45 wp_redirect($this_file);
48 $all_links = join(',', $linkcheck);
49 // should now have an array of links we can change
50 //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
52 wp_redirect($this_file);
57 check_admin_referer('add-bookmark');
61 wp_redirect( wp_get_referer() . '?added=true' );
66 $link_id = (int) $_POST['link_id'];
67 check_admin_referer('update-bookmark_' . $link_id);
71 wp_redirect($this_file);
76 $link_id = (int) $_GET['link_id'];
77 check_admin_referer('delete-bookmark_' . $link_id);
79 wp_delete_link($link_id);
81 wp_redirect($this_file);
86 wp_enqueue_script('link');
87 wp_enqueue_script('xfn');
88 wp_enqueue_script('thickbox');
90 $parent_file = 'edit.php';
91 $submenu_file = 'link-manager.php';
92 $title = __('Edit Link');
94 $link_id = (int) $_GET['link_id'];
96 if (!$link = get_link_to_edit($link_id))
97 wp_die(__('Link not found.'));
99 include_once ('admin-header.php');
100 include ('edit-link-form.php');
101 include ('admin-footer.php');