get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); echo "\n"; foreach ($results as $row) { echo "\n\tcat_id == $selected) echo " selected='selected'"; echo ">$row->cat_id: $row->cat_name"; if ('Y' == $row->auto_toggle) echo ' (auto toggle)'; echo "\n"; } echo "\n\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()) { $_GET = add_magic_quotes($_GET); $_POST = add_magic_quotes($_POST); $_COOKIE = add_magic_quotes($_COOKIE); } $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 $wpdb->links LEFT JOIN $wpdb->users 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 $wpdb->links 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_admin_referer(); // 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 $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': { $standalone = 1; include_once('admin-header.php'); check_admin_referer(); // 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 $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); header('Location: ' . $this_file); break; } case 'Add': { $standalone = 1; include_once('admin-header.php'); check_admin_referer(); $link_url = $_POST['linkurl']; $link_name = $_POST['name']; $link_image = $_POST['image']; $link_target = $_POST['target']; $link_category = $_POST['category']; $link_description = $_POST['description']; $link_visible = $_POST['visible']; $link_rating = $_POST['rating']; $link_rel = $_POST['rel']; $link_notes = $_POST['notes']; $link_rss_uri = $_POST['rss_uri']; $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 $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); } $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) " . " 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) . "', '$link_rss_uri')"); header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true'); break; } // end Add case 'editlink': { if (isset($submit)) { 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'); check_admin_referer(); $link_id = $_POST['link_id']; $link_url = $_POST['linkurl']; $link_name = $_POST['name']; $link_image = $_POST['image']; $link_target = $_POST['target']; $link_category = $_POST['category']; $link_description = $_POST['description']; $link_visible = $_POST['visible']; $link_rating = $_POST['rating']; $link_rel = $_POST['rel']; $link_notes = $_POST['notes']; $link_rss_uri = $_POST['rss_uri']; $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 $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); } $wpdb->query("UPDATE $wpdb->links SET link_url='" . addslashes($link_url) . "', link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "', link_target='$link_target',\n link_category=$link_category, link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "', link_rating=$link_rating, link_rel='" . addslashes($link_rel) . "', link_notes='" . addslashes($link_notes) . "', link_rss = '$link_rss_uri' 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'); check_admin_referer(); $link_id = (int) $_GET['link_id']; if ($user_level < get_settings('links_minadminlevel')) die (__("Cheatin' uh ?")); $wpdb->query("DELETE FROM $wpdb->links 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; $xfn = true; include_once ('admin-header.php'); if ($user_level < get_settings('links_minadminlevel')) { die(__('You do not have sufficient permissions to edit the links for this blog.')); } $link_id = (int) $_GET['link_id']; $row = $wpdb->get_row("SELECT * FROM $wpdb->links 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->link_category; $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); $link_rss_uri = $row->link_rss; } ?> XFN Creator:') ?> /> /> /> /> /> /> /> /> /> family /> /> /> /> /> /> /> /> /> '.$r.''); } ?> /> _blank /> _top /> target attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?> value="Y" /> value="N" /> Show links in category: %s'), gethelp_link($this_file,'link_categories'));?> Order by: %s'), gethelp_link($this_file,'order_by'));?> get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); echo " \n"; echo " " . __('All') . "\n"; foreach ($results as $row) { echo " cat_id."\""; if ($row->cat_id == $cat_id) echo " selected='selected'"; echo ">".$row->cat_id.": ".$row->cat_name; if ($row->auto_toggle == 'Y') echo ' (auto toggle)'; echo "\n"; } echo " \n"; ?> > > > > > > users.user_login, link_id, link_rating, link_rel, $wpdb->users.user_level FROM $wpdb->links LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner "; if (isset($cat_id) && ($cat_id != 'All')) { $sql .= " WHERE link_category = $cat_id "; } $sql .= ' ORDER BY link_' . $sqlorderby; // echo "$sql"; $links = $wpdb->get_results($sql); if ($links) { foreach ($links as $link) { $short_url = str_replace('http://', '', stripslashes($link->link_url)); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $link->link_name = stripslashes($link->link_name); $link->category = stripslashes($link->category); $link->link_rel = stripslashes($link->link_rel); $link->link_description = stripslashes($link->link_description); $image = ($link->link_image != null) ? __('Yes') : __('No'); $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No'); ++$i; $style = ($i % 2) ? ' class="alternate"' : ''; echo << $link->link_name LINKS; echo sprintf(__('Description: %s'), $link->link_description) . ""; echo "link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url"; echo <<$link->category $link->link_rel $image $visible LINKS; $show_buttons = 1; // default if (get_settings('links_use_adminlevels') && ($link->user_level > $user_level)) { $show_buttons = 0; } if ($show_buttons) { echo '' . __('Edit') . ''; echo '' . __('Delete') . ''; echo ''; } else { echo " \n"; } echo "\n\t"; } } ?> get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0 ORDER BY ID"); echo " \n"; foreach ($results as $row) { echo " ID."\""; echo ">".$row->user_login; echo "\n"; } echo " \n"; ?>
_blank
_top