get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); echo ' \n"; } function add_magic_quotes($array) { foreach ($array as $k => $v) { if (is_array($v)) { $array[$k] = add_magic_quotes($v); } else { $array[$k] = addslashes($v); } } return $array; } if (!get_magic_quotes_gpc()) { $HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS); $HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS); $HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS); } $wpvarstoreset = array('action','standalone','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, user_level FROM $tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)"); foreach ($results as $row) { if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed $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 $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)"); header('Location: '.$this_file); break; } case 'Visibility': { $standalone = 1; include_once('admin-header.php'); // check the current user's level first. if ($user_level < get_settings('links_minadminlevel')) 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 $tablelinks 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 $tablelinks 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 $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)"); } header('Location: '.$this_file); break; } case 'Move': { $standalone = 1; include_once('admin-header.php'); // check the current user's level first. if ($user_level < get_settings('links_minadminlevel')) 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 $tablelinks SET link_category='$category' WHERE link_id IN ($all_links)"); header('Location: '.$this_file); break; } case 'Add': { $standalone = 1; include_once('admin-header.php'); $link_url = $HTTP_POST_VARS["linkurl"]; $link_name = $HTTP_POST_VARS["name"]; $link_image = $HTTP_POST_VARS["image"]; $link_target = $HTTP_POST_VARS["target"]; $link_category = $HTTP_POST_VARS["category"]; $link_description = $HTTP_POST_VARS["description"]; $link_visible = $HTTP_POST_VARS["visible"]; $link_rating = $HTTP_POST_VARS["rating"]; $link_rel = $HTTP_POST_VARS["rel"]; $link_notes = $HTTP_POST_VARS["notes"]; $auto_toggle = get_autotoggle($link_category); if ($user_level < get_settings('links_minadminlevel')) die ("Cheatin' uh ?"); // if we are in an auto toggle category and this one is visible then we // need to make the others invisible before we add this new one. if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"); } $wpdb->query("INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes) " . " VALUES('" . addslashes($link_url) . "','" . addslashes($link_name) . "', '" . addslashes($link_image) . "', '$link_target', $link_category, '" . addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "', '" . addslashes($link_notes) . "')"); header('Location: '.$this_file); break; } // end Add case 'editlink': { if (isset($submit) && ($submit == "Save")) { 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; $standalone = 1; include_once('admin-header.php'); $link_id = $HTTP_POST_VARS["link_id"]; $link_url = $HTTP_POST_VARS["linkurl"]; $link_name = $HTTP_POST_VARS["name"]; $link_image = $HTTP_POST_VARS["image"]; $link_target = $HTTP_POST_VARS["target"]; $link_category = $HTTP_POST_VARS["category"]; $link_description = $HTTP_POST_VARS["description"]; $link_visible = $HTTP_POST_VARS["visible"]; $link_rating = $HTTP_POST_VARS["rating"]; $link_rel = $HTTP_POST_VARS["rel"]; $link_notes = $HTTP_POST_VARS["notes"]; $auto_toggle = get_autotoggle($link_category); if ($user_level < get_settings('links_minadminlevel')) die ("Cheatin' uh ?"); // if we are in an auto toggle category and this one is visible then we // need to make the others invisible before we update this one. if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"); } $wpdb->query("UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',\n " . " link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',\n " . " link_target='$link_target',\n link_category=$link_category,\n " . " link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',\n " . " link_rating=$link_rating,\n" . " link_rel='" . addslashes($link_rel) . "',\n" . " link_notes='" . addslashes($link_notes) . "'\n" . " WHERE link_id=$link_id"); } // end if save setcookie('links_show_cat_id_'.$cookiehash, $links_show_cat_id, time()+600); header('Location: '.$this_file); break; } // end Save case 'Delete': { $standalone = 1; include_once('admin-header.php'); $link_id = $HTTP_POST_VARS["link_id"]; if ($user_level < get_settings('links_minadminlevel')) die ("Cheatin' uh ?"); $wpdb->query("DELETE FROM $tablelinks WHERE link_id = '$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); header('Location: '.$this_file); break; } // end Delete case 'linkedit': { $standalone=0; include_once ('admin-header.php'); if ($user_level < get_settings('links_minadminlevel')) { die("You have no right to edit the links for this blog.
Ask for a promotion to your blog admin. :)"); } $row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes " . " FROM $tablelinks " . " WHERE link_id = $link_id"); if ($row) { $link_url = stripslashes($row->link_url); $link_name = stripslashes($row->link_name); $link_image = $row->link_image; $link_target = $row->link_target; $link_category = $row->cat_id; $link_description = stripslashes($row->link_description); $link_visible = $row->link_visible; $link_rating = $row->link_rating; $link_rel = stripslashes($row->link_rel); $link_notes = stripslashes($row->link_notes); } ?>
Edit a link:
URL:
Display Name/Alt text:
Image:
Description:
Rel:
Notes:
Rating:  (Leave at 0 for no rating.)
Target:    
Visible:  
:
 
Ask for a promotion to your blog admin :)"); } 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") { ?>
Show links in category:
Order by:  
get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); echo " \n"; ?>
Manage Multiple Links:
Use the checkboxes on the right to select multiple links and choose an action below:
ownership to: get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID"); echo " \n"; ?> Toggle to category Toggle Checkboxes
Add a link:
URL:
Display Name/Alt text:
Image:
Description:
rel:
XFN:
friendship
physical
professional
geographical
family
romantic
Notes:
Rating:  (Leave at 0 for no rating.)
Target:    
Visible:  
:

You can drag link this to your toolbar and when you click it a window will pop up that will allow you to add whatever site you're on to your links! Right now this only works on Mozilla or Netscape, but we're working on it.