diff --git a/wp-admin/linkmanager.php b/wp-admin/linkmanager.php index e6da8071b5..df627bbf24 100644 --- a/wp-admin/linkmanager.php +++ b/wp-admin/linkmanager.php @@ -32,6 +32,23 @@ require_once("../wp-links/links.php"); $title = 'Manage Links'; +function category_dropdown($fieldname, $selected = 0) { + global $wpdb, $tablelinkcategories; + + $results = $wpdb->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)) { @@ -51,7 +68,7 @@ if (!get_magic_quotes_gpc()) { $b2varstoreset = 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'); + 'notes', 'linkcheck[]'); for ($i=0; $i= the //userlevel of the owner of the link then we can proceed. - + + if (count($linkcheck) == 0) { + header('Location: linkmanager.php'); + 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) { @@ -101,6 +123,65 @@ switch ($action) { header('Location: linkmanager.php'); break; } + case 'Visibility': + { + $standalone = 1; + include_once('b2header.php'); + + // check the current user's level first. + if ($user_level < $minadminlevel) + die ("Cheatin' uh ?"); + + //for each link id (in $linkcheck[]): toggle the visibility + if (count($linkcheck) == 0) { + header('Location: linkmanager.php'); + 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: linkmanager.php'); + break; + } + case 'Move': + { + $standalone = 1; + include_once('b2header.php'); + // check the current user's level first. + if ($user_level < $minadminlevel) + die ("Cheatin' uh ?"); + + //for each link id (in $linkcheck[]) change category to selected value + if (count($linkcheck) == 0) { + header('Location: linkmanager.php'); + 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: linkmanager.php'); + break; + } + case 'Add': { $standalone = 1; @@ -311,20 +392,7 @@ switch ($action) { : -get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); - echo " \n"; -?> + @@ -556,25 +624,35 @@ LINKS; ?> + + +
+ + - + +
Manage Multiple Links:
Use the checkboxes on the right to select multiple links and choose an action below:
Assign ownership (of checked) to: + + ownership to: get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID"); - echo " \n"; foreach ($results as $row) { - echo " \n"; } - echo " \n"; + echo " \n"; ?> - + + Toggle + + to category + - Toggle Checkboxes -   - + Toggle Checkboxes
@@ -646,20 +724,7 @@ LINKS; : -get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); - echo " \n"; -?> +