- // check the current user's level first.
- if ( !current_user_can('manage_links') )
- die (__("Cheatin' uh ?"));
-
- //for each link id (in $linkcheck[]) change category to selected value
- if (count($linkcheck) == 0) {
- wp_redirect($this_file);
- exit;
- }
- $all_links = join(',', $linkcheck);
- // should now have an array of links we can change
- $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
-
- wp_redirect($this_file);
- break;
- }
-
- case 'Add':
- {
- check_admin_referer('add-bookmark');
-
- add_link();
-
- wp_redirect(wp_get_referer() . '?added=true');
- break;
- } // end Add
-
- case 'editlink':
- {
- $link_id = (int) $_POST['link_id'];
- check_admin_referer('update-bookmark_' . $link_id);
-
- if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
- $cat_id = $links_show_cat_id;
-
- if (!isset($cat_id) || ($cat_id == '')) {
- if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
- $cat_id = 'All';
- }
- $links_show_cat_id = $cat_id;
-
- edit_link($link_id);
-
- setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
- wp_redirect($this_file);
- break;
- } // end Save
-
- case 'delete':
- {
- $link_id = (int) $_GET['link_id'];
- check_admin_referer('delete-bookmark_' . $link_id);
-
- if ( !current_user_can('manage_links') )
- die (__("Cheatin' uh ?"));
-
- wp_delete_link($link_id);
-
- if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
- $cat_id = $links_show_cat_id;
-
- if (!isset($cat_id) || ($cat_id == '')) {
- if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
- $cat_id = 'All';
- }
- $links_show_cat_id = $cat_id;
- setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
- wp_redirect($this_file);
- break;
- } // end Delete
-
- case 'linkedit': {
- $xfn_js = true;
- include_once ('admin-header.php');
- if ( !current_user_can('manage_links') )
- die(__('You do not have sufficient permissions to edit the links for this blog.'));
-
- $link_id = (int) $_GET['link_id'];
-
- if ( !$link = get_link_to_edit($link_id) )
- die( __('Link not found.') );
-
- include('edit-link-form.php');
- break;
- } // end linkedit
- case __("Show"):
- {
- if (!isset($cat_id) || ($cat_id == '')) {
- if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
- $cat_id = 'All';
- }
- $links_show_cat_id = $cat_id;
- if (!isset($order_by) || ($order_by == '')) {
- if (!isset($links_show_order) || ($links_show_order == ''))
- $order_by = 'order_name';
- }
- $links_show_order = $order_by;
- //break; fall through
- } // end Show
- case "popup":
- {
- $link_url = stripslashes($_GET["linkurl"]);
- $link_name = stripslashes($_GET["name"]);
- //break; fall through
- }
- default:
- {
- if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
- $cat_id = $links_show_cat_id;
-
- if (!isset($cat_id) || ($cat_id == '')) {
- if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
- $cat_id = 'All';
- }
- $links_show_cat_id = $cat_id;
- if (isset($links_show_order) && ($links_show_order != ''))
- $order_by = $links_show_order;
-
- if (!isset($order_by) || ($order_by == ''))
- $order_by = 'order_name';
- $links_show_order = $order_by;
-
- setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
- setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600);
- include_once ("./admin-header.php");
- if ( !current_user_can('manage_links') )
- die(__("You do not have sufficient permissions to edit the links for this blog."));
-
- switch ($order_by)
- {
- case 'order_id': $sqlorderby = 'id'; break;
- case 'order_url': $sqlorderby = 'url'; break;
- case 'order_desc': $sqlorderby = 'description'; break;
- case 'order_owner': $sqlorderby = 'owner'; break;
- case 'order_rating': $sqlorderby = 'rating'; break;
- case 'order_name':
- default: $sqlorderby = 'name'; break;
- }
-
- if ($action != "popup") {
-?>
-<script type="text/javascript">
-<!--
-function checkAll(form)
-{
- for (i = 0, n = form.elements.length; i < n; i++) {
- if(form.elements[i].type == "checkbox") {
- if(form.elements[i].checked == true)
- form.elements[i].checked = false;
- else
- form.elements[i].checked = true;
- }
- }
-}
-//-->
-</script>
-
-<div class="wrap">
- <form name="cats" method="post" action="">
- <table width="75%" cellpadding="3" cellspacing="3">
- <tr>
- <td>
- <?php _e('<strong>Show</strong> links in category:'); ?><br />
- </td>
- <td>
- <?php _e('<strong>Order</strong> by:');?>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td>