get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); echo "\n\n"; } $wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'); for ($i=0; $i= the //userlevel of the owner of the link then we can proceed. if (count($linkcheck) == 0) { header('Location: ' . $this_file); exit; } $all_links = join(',', $linkcheck); $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)"); foreach ($results as $row) { $ids_to_change[] = $row->link_id; } // should now have an array of links we can change $all_links = join(',', $ids_to_change); $q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)"); header('Location: ' . $this_file); break; } case 'visibility': { check_admin_referer(); // check the current user's level first. if ( !current_user_can('manage_links') ) die (__("Cheatin' uh ?")); //for each link id (in $linkcheck[]): toggle the visibility if (count($linkcheck) == 0) { header('Location: ' . $this_file); exit; } $all_links = join(',', $linkcheck); $results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)"); foreach ($results as $row) { if ($row->link_visible == 'Y') { // ok to proceed $ids_to_turnoff[] = $row->link_id; } else { $ids_to_turnon[] = $row->link_id; } } // should now have two arrays of links to change if (count($ids_to_turnoff)) { $all_linksoff = join(',', $ids_to_turnoff); $q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)"); } if (count($ids_to_turnon)) { $all_linkson = join(',', $ids_to_turnon); $q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)"); } header('Location: ' . $this_file); break; } case 'move': { check_admin_referer(); // 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) { header('Location: ' . $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)"); header('Location: ' . $this_file); break; } case 'Add': { check_admin_referer(); add_link(); header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true'); break; } // end Add case 'editlink': { check_admin_referer(); 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; $link_id = (int) $_POST['link_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': { check_admin_referer(); if ( !current_user_can('manage_links') ) die (__("Cheatin' uh ?")); $link_id = (int) $_GET['link_id']; 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 = 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.') ); ?>
Show links in category:'); ?>
Order by:');?>  
get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); echo " \n"; ?>