2003-05-22 14:12:53 +02:00
< ? php
// Links
2003-08-07 02:00:55 +02:00
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
2003-12-08 04:46:42 +01:00
2004-10-19 05:03:06 +02:00
require_once ( 'admin.php' );
2003-05-22 14:12:53 +02:00
2004-04-25 01:07:51 +02:00
$title = __ ( 'Manage Links' );
2004-08-23 01:24:50 +02:00
$this_file = $parent_file = 'link-manager.php' ;
2006-01-10 06:16:17 +01:00
$list_js = true ;
2003-05-22 14:12:53 +02:00
2004-10-19 05:03:06 +02:00
$wpvarstoreset = array ( 'action' , 'cat_id' , 'linkurl' , 'name' , 'image' ,
2003-05-22 14:12:53 +02:00
'description' , 'visible' , 'target' , 'category' , 'link_id' ,
2003-07-27 01:52:36 +02:00
'submit' , 'order_by' , 'links_show_cat_id' , 'rating' , 'rel' ,
2003-07-29 18:45:19 +02:00
'notes' , 'linkcheck[]' );
2003-12-28 09:38:31 +01:00
2003-12-18 10:36:13 +01:00
for ( $i = 0 ; $i < count ( $wpvarstoreset ); $i += 1 ) {
$wpvar = $wpvarstoreset [ $i ];
if ( ! isset ( $$wpvar )) {
2004-04-21 00:56:47 +02:00
if ( empty ( $_POST [ " $wpvar " ])) {
if ( empty ( $_GET [ " $wpvar " ])) {
2003-12-18 10:36:13 +01:00
$$wpvar = '' ;
2003-05-22 14:12:53 +02:00
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_GET [ " $wpvar " ];
2003-05-22 14:12:53 +02:00
}
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_POST [ " $wpvar " ];
2003-05-22 14:12:53 +02:00
}
}
}
2004-10-10 20:02:30 +02:00
$links_show_cat_id = $_COOKIE [ 'links_show_cat_id_' . COOKIEHASH ];
$links_show_order = $_COOKIE [ 'links_show_order_' . COOKIEHASH ];
2003-05-22 14:12:53 +02:00
2004-04-25 03:02:52 +02:00
if ( '' != $_POST [ 'assign' ]) $action = 'assign' ;
if ( '' != $_POST [ 'visibility' ]) $action = 'visibility' ;
if ( '' != $_POST [ 'move' ]) $action = 'move' ;
2005-02-24 19:59:52 +01:00
if ( '' != $_POST [ 'linkcheck' ]) $linkcheck = $_POST [ linkcheck ];
2003-05-22 14:12:53 +02:00
switch ( $action ) {
2004-04-25 03:02:52 +02:00
case 'assign' :
2003-07-27 01:52:36 +02:00
{
2006-05-12 01:05:45 +02:00
check_admin_referer ( 'bulk-bookmarks' );
2004-05-17 22:34:05 +02:00
2003-07-27 01:52:36 +02:00
// check the current user's level first.
2005-07-15 04:16:45 +02:00
if ( ! current_user_can ( 'manage_links' ) )
2004-04-25 01:07:51 +02:00
die ( __ ( " Cheatin' uh ? " ));
2003-07-30 16:44:57 +02:00
2003-07-27 01:52:36 +02:00
//for each link id (in $linkcheck[]): if the current user level >= the
//userlevel of the owner of the link then we can proceed.
2003-07-29 18:45:19 +02:00
if ( count ( $linkcheck ) == 0 ) {
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-29 18:45:19 +02:00
exit ;
}
2003-07-27 01:52:36 +02:00
$all_links = join ( ',' , $linkcheck );
2005-07-15 04:16:45 +02:00
$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 ) " );
2003-07-27 01:52:36 +02:00
foreach ( $results as $row ) {
2005-07-15 04:16:45 +02:00
$ids_to_change [] = $row -> link_id ;
2003-07-27 01:52:36 +02:00
}
// should now have an array of links we can change
$all_links = join ( ',' , $ids_to_change );
2004-05-24 10:22:18 +02:00
$q = $wpdb -> query ( " update $wpdb->links SET link_owner=' $newowner ' WHERE link_id IN ( $all_links ) " );
2003-07-27 01:52:36 +02:00
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-27 01:52:36 +02:00
break ;
}
2004-04-25 03:02:52 +02:00
case 'visibility' :
2003-07-29 18:45:19 +02:00
{
2006-05-12 01:05:45 +02:00
check_admin_referer ( 'bulk-bookmarks' );
2004-05-17 22:34:05 +02:00
2003-07-29 18:45:19 +02:00
// check the current user's level first.
2005-07-15 04:16:45 +02:00
if ( ! current_user_can ( 'manage_links' ) )
2004-04-25 01:07:51 +02:00
die ( __ ( " Cheatin' uh ? " ));
2003-07-30 16:44:57 +02:00
2003-07-29 18:45:19 +02:00
//for each link id (in $linkcheck[]): toggle the visibility
if ( count ( $linkcheck ) == 0 ) {
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-29 18:45:19 +02:00
exit ;
}
$all_links = join ( ',' , $linkcheck );
2004-05-24 10:22:18 +02:00
$results = $wpdb -> get_results ( " SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ( $all_links ) " );
2003-07-29 18:45:19 +02:00
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 );
2004-05-24 10:22:18 +02:00
$q = $wpdb -> query ( " update $wpdb->links SET link_visible='N' WHERE link_id IN ( $all_linksoff ) " );
2003-07-29 18:45:19 +02:00
}
2003-07-30 16:44:57 +02:00
2003-07-29 18:45:19 +02:00
if ( count ( $ids_to_turnon )) {
$all_linkson = join ( ',' , $ids_to_turnon );
2004-05-24 10:22:18 +02:00
$q = $wpdb -> query ( " update $wpdb->links SET link_visible='Y' WHERE link_id IN ( $all_linkson ) " );
2003-07-29 18:45:19 +02:00
}
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-29 18:45:19 +02:00
break ;
}
2004-04-25 03:02:52 +02:00
case 'move' :
2003-07-29 18:45:19 +02:00
{
2006-05-12 01:05:45 +02:00
check_admin_referer ( 'bulk-bookmarks' );
2004-05-17 22:34:05 +02:00
2003-07-29 18:45:19 +02:00
// check the current user's level first.
2005-07-15 04:16:45 +02:00
if ( ! current_user_can ( 'manage_links' ) )
2004-04-25 01:07:51 +02:00
die ( __ ( " Cheatin' uh ? " ));
2003-07-30 16:44:57 +02:00
2003-07-29 18:45:19 +02:00
//for each link id (in $linkcheck[]) change category to selected value
if ( count ( $linkcheck ) == 0 ) {
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-29 18:45:19 +02:00
exit ;
}
$all_links = join ( ',' , $linkcheck );
// should now have an array of links we can change
2004-05-24 10:22:18 +02:00
$q = $wpdb -> query ( " update $wpdb->links SET link_category=' $category ' WHERE link_id IN ( $all_links ) " );
2003-07-29 18:45:19 +02:00
2006-06-28 01:10:02 +02:00
wp_redirect ( $this_file );
2003-07-29 18:45:19 +02:00
break ;
}
2003-05-23 10:29:51 +02:00
case 'Add' :
2003-05-22 14:12:53 +02:00
{
2006-05-12 01:05:45 +02:00
check_admin_referer ( 'add-bookmark' );
2004-05-17 22:34:05 +02:00
2005-09-18 21:44:14 +02:00
add_link ();
2006-06-28 01:10:02 +02:00
wp_redirect ( wp_get_referer () . '?added=true' );
2003-05-22 14:12:53 +02:00
break ;
} // end Add
2003-05-23 10:29:51 +02:00
case 'editlink' :
2003-05-22 14:12:53 +02:00
{
2006-05-12 01:05:45 +02:00
$link_id = ( int ) $_POST [ 'link_id' ];
2006-06-04 23:00:32 +02:00
check_admin_referer ( 'update-bookmark_' . $link_id );
2005-09-18 21:44:14 +02:00
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 ;
2003-05-22 14:12:53 +02:00
2005-09-18 21:44:14 +02:00
edit_link ( $link_id );
2004-10-10 20:02:30 +02:00
setcookie ( 'links_show_cat_id_' . COOKIEHASH , $links_show_cat_id , time () + 600 );
2005-03-13 17:36:09 +01:00
wp_redirect ( $this_file );
2003-05-22 14:12:53 +02:00
break ;
} // end Save
2006-06-09 03:05:51 +02:00
case 'delete' :
2003-05-22 14:12:53 +02:00
{
2006-05-12 01:05:45 +02:00
$link_id = ( int ) $_GET [ 'link_id' ];
2006-06-09 03:05:51 +02:00
check_admin_referer ( 'delete-bookmark_' . $link_id );
2004-05-17 22:34:05 +02:00
2005-07-15 04:16:45 +02:00
if ( ! current_user_can ( 'manage_links' ) )
2004-04-25 01:07:51 +02:00
die ( __ ( " Cheatin' uh ? " ));
2003-05-22 14:12:53 +02:00
2005-09-18 21:44:14 +02:00
wp_delete_link ( $link_id );
2003-05-22 14:12:53 +02:00
if ( isset ( $links_show_cat_id ) && ( $links_show_cat_id != '' ))
$cat_id = $links_show_cat_id ;
2003-07-23 02:26:03 +02:00
2003-05-22 14:12:53 +02:00
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 ;
2004-10-10 20:02:30 +02:00
setcookie ( 'links_show_cat_id_' . COOKIEHASH , $links_show_cat_id , time () + 600 );
2005-03-13 17:36:09 +01:00
wp_redirect ( $this_file );
2003-05-22 14:12:53 +02:00
break ;
} // end Delete
2003-07-23 02:26:03 +02:00
2004-12-12 21:41:19 +01:00
case 'linkedit' : {
2006-01-10 06:16:17 +01:00
$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' ];
2005-09-18 21:44:14 +02:00
if ( ! $link = get_link_to_edit ( $link_id ) )
die ( __ ( 'Link not found.' ) );
2006-01-10 06:16:17 +01:00
2005-09-19 02:47:58 +02:00
include ( 'edit-link-form.php' );
2006-01-10 06:16:17 +01:00
break ;
2003-05-22 14:12:53 +02:00
} // end linkedit
2004-04-25 01:07:51 +02:00
case __ ( " Show " ) :
2003-05-22 14:12:53 +02:00
{
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 ;
2003-07-19 22:45:27 +02:00
if ( ! isset ( $order_by ) || ( $order_by == '' )) {
if ( ! isset ( $links_show_order ) || ( $links_show_order == '' ))
$order_by = 'order_name' ;
}
$links_show_order = $order_by ;
2003-05-22 14:12:53 +02:00
//break; fall through
} // end Show
case " popup " :
{
2004-04-21 00:56:47 +02:00
$link_url = stripslashes ( $_GET [ " linkurl " ]);
$link_name = stripslashes ( $_GET [ " name " ]);
2003-05-22 14:12:53 +02:00
//break; fall through
}
default :
{
if ( isset ( $links_show_cat_id ) && ( $links_show_cat_id != '' ))
$cat_id = $links_show_cat_id ;
2003-07-23 02:26:03 +02:00
2003-05-22 14:12:53 +02:00
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 ;
2003-07-19 22:45:27 +02:00
if ( isset ( $links_show_order ) && ( $links_show_order != '' ))
$order_by = $links_show_order ;
2003-07-23 02:26:03 +02:00
2003-05-22 14:12:53 +02:00
if ( ! isset ( $order_by ) || ( $order_by == '' ))
2003-06-01 12:16:04 +02:00
$order_by = 'order_name' ;
2003-07-19 22:45:27 +02:00
$links_show_order = $order_by ;
2004-10-10 20:02:30 +02:00
setcookie ( 'links_show_cat_id_' . COOKIEHASH , $links_show_cat_id , time () + 600 );
setcookie ( 'links_show_order_' . COOKIEHASH , $links_show_order , time () + 600 );
2003-12-11 01:22:36 +01:00
include_once ( " ./admin-header.php " );
2005-07-15 04:16:45 +02:00
if ( ! current_user_can ( 'manage_links' ) )
2004-04-25 19:35:13 +02:00
die ( __ ( " You do not have sufficient permissions to edit the links for this blog. " ));
2003-05-22 14:12:53 +02:00
switch ( $order_by )
{
2003-06-01 12:16:04 +02:00
case 'order_id' : $sqlorderby = 'id' ; break ;
2003-05-22 14:12:53 +02:00
case 'order_url' : $sqlorderby = 'url' ; break ;
case 'order_desc' : $sqlorderby = 'description' ; break ;
case 'order_owner' : $sqlorderby = 'owner' ; break ;
case 'order_rating' : $sqlorderby = 'rating' ; break ;
2003-07-23 02:26:03 +02:00
case 'order_name' :
2003-06-01 12:16:04 +02:00
default : $sqlorderby = 'name' ; break ;
2003-05-22 14:12:53 +02:00
}
2003-07-23 02:26:03 +02:00
2003-05-22 14:12:53 +02:00
if ( $action != " popup " ) {
?>
2003-07-27 01:52:36 +02:00
< script type = " text/javascript " >
2003-07-30 16:44:57 +02:00
<!--
2003-07-27 01:52:36 +02:00
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 ;
}
}
}
//-->
2003-07-30 16:44:57 +02:00
</ script >
2004-08-23 01:24:50 +02:00
2003-05-23 10:29:51 +02:00
< div class = " wrap " >
2003-12-28 12:44:05 +01:00
< form name = " cats " method = " post " action = " " >
2003-12-08 04:46:42 +01:00
< table width = " 75% " cellpadding = " 3 " cellspacing = " 3 " >
2003-05-22 14:12:53 +02:00
< tr >
< td >
2004-08-04 05:35:49 +02:00
< ? php _e ( '<strong>Show</strong> links in category:' ); ?> <br />
2003-05-22 14:12:53 +02:00
</ td >
< td >
2004-08-04 05:35:49 +02:00
< ? php _e ( '<strong>Order</strong> by:' ); ?>
2003-05-22 14:12:53 +02:00
</ td >
2003-12-08 04:46:42 +01:00
< td >& nbsp ; </ td >
2003-05-22 14:12:53 +02:00
</ tr >
< tr >
< td >
< ? php
2004-05-24 10:22:18 +02:00
$results = $wpdb -> get_results ( " SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id " );
2003-05-22 14:12:53 +02:00
echo " <select name= \" cat_id \" > \n " ;
echo " <option value= \" All \" " ;
if ( $cat_id == 'All' )
2003-12-28 12:44:05 +01:00
echo " selected='selected' " ;
2004-05-23 19:24:38 +02:00
echo " > " . __ ( 'All' ) . " </option> \n " ;
2003-07-19 22:45:27 +02:00
foreach ( $results as $row ) {
2003-05-22 14:12:53 +02:00
echo " <option value= \" " . $row -> cat_id . " \" " ;
if ( $row -> cat_id == $cat_id )
2003-12-28 12:44:05 +01:00
echo " selected='selected' " ;
2004-12-12 21:41:19 +01:00
echo " > " . $row -> cat_id . " : " . wp_specialchars ( $row -> cat_name );
2003-05-22 14:12:53 +02:00
if ( $row -> auto_toggle == 'Y' )
2005-12-12 23:48:30 +01:00
echo ' ' . __ ( '(auto toggle)' );
2003-05-22 14:12:53 +02:00
echo " </option> \n " ;
}
echo " </select> \n " ;
?>
</ td >
< td >
< select name = " order_by " >
2004-04-25 01:07:51 +02:00
< option value = " order_id " < ? php if ( $order_by == 'order_id' ) echo " selected='selected' " ; ?> ><?php _e('Link ID') ?></option>
< option value = " order_name " < ? php if ( $order_by == 'order_name' ) echo " selected='selected' " ; ?> ><?php _e('Name') ?></option>
< option value = " order_url " < ? php if ( $order_by == 'order_url' ) echo " selected='selected' " ; ?> ><?php _e('URI') ?></option>
< option value = " order_desc " < ? php if ( $order_by == 'order_desc' ) echo " selected='selected' " ; ?> ><?php _e('Description') ?></option>
< option value = " order_owner " < ? php if ( $order_by == 'order_owner' ) echo " selected='selected' " ; ?> ><?php _e('Owner') ?></option>
< option value = " order_rating " < ? php if ( $order_by == 'order_rating' ) echo " selected='selected' " ; ?> ><?php _e('Rating') ?></option>
2003-05-22 14:12:53 +02:00
</ select >
</ td >
< td >
2004-04-25 01:07:51 +02:00
< input type = " submit " name = " action " value = " <?php _e('Show') ?> " />
2003-05-22 14:12:53 +02:00
</ td >
</ tr >
</ table >
</ form >
2003-05-23 10:29:51 +02:00
</ div >
2004-06-11 20:23:12 +02:00
< form name = " links " id = " links " method = " post " action = " " >
2003-05-23 10:29:51 +02:00
< div class = " wrap " >
2003-05-22 14:12:53 +02:00
2006-05-12 01:05:45 +02:00
< ? php wp_nonce_field ( 'bulk-bookmarks' ) ?>
2003-05-22 14:12:53 +02:00
< input type = " hidden " name = " link_id " value = " " />
< input type = " hidden " name = " action " value = " " />
2004-12-12 21:41:19 +01:00
< input type = " hidden " name = " order_by " value = " <?php echo wp_specialchars( $order_by , 1); ?> " />
< input type = " hidden " name = " cat_id " value = " <?php echo (int) $cat_id ?> " />
2005-08-31 04:39:17 +02:00
< table id = " the-list-x " width = " 100% " cellpadding = " 3 " cellspacing = " 3 " >
2003-07-23 02:26:03 +02:00
< tr >
2004-08-04 05:35:49 +02:00
< th width = " 15% " >< ? php _e ( 'Name' ) ?> </th>
2004-04-25 03:09:47 +02:00
< th >< ? php _e ( 'URI' ) ?> </th>
< th >< ? php _e ( 'Category' ) ?> </th>
< th >< ? php _e ( 'rel' ) ?> </th>
< th >< ? php _e ( 'Image' ) ?> </th>
< th >< ? php _e ( 'Visible' ) ?> </th>
< th colspan = " 2 " >< ? php _e ( 'Action' ) ?> </th>
2003-07-27 01:52:36 +02:00
< th >& nbsp ; </ th >
2003-06-01 12:16:04 +02:00
</ tr >
2003-05-22 14:12:53 +02:00
< ? php
2003-07-19 22:45:27 +02:00
$sql = " SELECT link_url, link_name, link_image, link_description, link_visible,
2004-05-24 10:22:18 +02:00
link_category AS cat_id , cat_name AS category , $wpdb -> users . user_login , link_id ,
2005-07-15 04:16:45 +02:00
link_rating , link_rel
2004-05-24 10:22:18 +02:00
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 " ;
2003-07-27 01:52:36 +02:00
2003-05-22 14:12:53 +02:00
if ( isset ( $cat_id ) && ( $cat_id != 'All' )) {
2003-07-27 01:52:36 +02:00
$sql .= " WHERE link_category = $cat_id " ;
2003-05-22 14:12:53 +02:00
}
2003-06-01 12:16:04 +02:00
$sql .= ' ORDER BY link_' . $sqlorderby ;
// echo "$sql";
$links = $wpdb -> get_results ( $sql );
2003-06-04 00:42:13 +02:00
if ( $links ) {
foreach ( $links as $link ) {
2004-12-12 21:41:19 +01:00
$link -> link_name = wp_specialchars ( $link -> link_name );
$link -> link_category = wp_specialchars ( $link -> link_category );
$link -> link_description = wp_specialchars ( $link -> link_description );
$link -> link_url = wp_specialchars ( $link -> link_url );
2004-06-18 02:22:09 +02:00
$short_url = str_replace ( 'http://' , '' , $link -> link_url );
2003-06-04 00:42:13 +02:00
$short_url = str_replace ( 'www.' , '' , $short_url );
2003-07-23 02:26:03 +02:00
if ( '/' == substr ( $short_url , - 1 ))
$short_url = substr ( $short_url , 0 , - 1 );
if ( strlen ( $short_url ) > 35 )
$short_url = substr ( $short_url , 0 , 32 ) . '...' ;
2004-04-25 03:09:47 +02:00
$image = ( $link -> link_image != null ) ? __ ( 'Yes' ) : __ ( 'No' );
$visible = ( $link -> link_visible == 'Y' ) ? __ ( 'Yes' ) : __ ( 'No' );
2003-06-04 00:42:13 +02:00
++ $i ;
2005-08-31 04:39:17 +02:00
$style = ( $i % 2 ) ? '' : ' class="alternate"' ;
2005-04-09 06:32:38 +02:00
?>
2005-08-31 04:39:17 +02:00
< tr id = " link-<?php echo $link->link_id ; ?> " valign = " middle " < ? php echo $style ; ?> >
2005-04-09 06:32:38 +02:00
< td >< strong >< ? php echo $link -> link_name ; ?> </strong><br />
< ? php
2004-05-23 19:24:38 +02:00
echo sprintf ( __ ( 'Description: %s' ), $link -> link_description ) . " </td> " ;
echo " <td><a href= \" $link->link_url\ " title = \ " " . sprintf ( __ ( 'Visit %s' ), $link -> link_name ) . " \" > $short_url </a></td> " ;
echo <<< LINKS
2003-07-23 02:26:03 +02:00
< td > $link -> category </ td >
< td > $link -> link_rel </ td >
2003-12-08 04:46:42 +01:00
< td align = 'center' > $image </ td >
< td align = 'center' > $visible </ td >
2003-07-27 01:52:36 +02:00
LINKS ;
$show_buttons = 1 ; // default
2003-07-30 16:44:57 +02:00
2003-07-27 01:52:36 +02:00
if ( $show_buttons ) {
2004-05-23 19:24:38 +02:00
echo '<td><a href="link-manager.php?link_id=' . $link -> link_id . '&action=linkedit" class="edit">' . __ ( 'Edit' ) . '</a></td>' ;
2006-06-24 03:20:01 +02:00
echo '<td><a href="' . wp_nonce_url ( 'link-manager.php?link_id=' . $link -> link_id . '&action=delete' , 'delete-bookmark_' . $link -> link_id ) . '"' . " class='delete' onclick= \" return deleteSomething( 'link', $link->link_id , ' " . sprintf ( __ ( " You are about to delete the "%s" bookmark to %s. \\ n"Cancel" to stop, "OK" to delete. " ), js_escape ( $link -> link_name ), js_escape ( $link -> link_url )) . '\' );" class="delete">' . __ ( 'Delete' ) . '</a></td>' ;
2004-05-23 19:24:38 +02:00
echo '<td><input type="checkbox" name="linkcheck[]" value="' . $link -> link_id . '" /></td>' ;
2003-07-27 01:52:36 +02:00
} else {
2003-12-08 04:46:42 +01:00
echo " <td> </td><td> </td><td> </td> \n " ;
2003-07-27 01:52:36 +02:00
}
2006-05-12 01:05:45 +02:00
2005-08-31 04:39:17 +02:00
echo " \n </tr> \n " ;
2003-06-04 00:42:13 +02:00
}
}
2003-05-22 14:12:53 +02:00
?>
2003-07-27 01:52:36 +02:00
</ table >
2003-12-08 04:46:42 +01:00
2005-08-31 04:39:17 +02:00
< div id = " ajax-response " ></ div >
2003-07-29 18:45:19 +02:00
</ div >
< div class = " wrap " >
2003-12-08 04:46:42 +01:00
< table width = " 100% " cellpadding = " 3 " cellspacing = " 3 " >
2004-04-25 03:02:52 +02:00
< tr >< th colspan = " 4 " >< ? php _e ( 'Manage Multiple Links:' ) ?> </th></tr>
< tr >< td colspan = " 4 " >< ? php _e ( 'Use the checkboxes on the right to select multiple links and choose an action below:' ) ?> </td></tr>
2003-07-27 01:52:36 +02:00
< tr >
2003-07-29 18:45:19 +02:00
< td >
2004-08-04 05:35:49 +02:00
< ? php _e ( 'Assign ownership to:' ); ?>
2003-07-27 01:52:36 +02:00
< ? php
2005-07-15 04:16:45 +02:00
$results = $wpdb -> get_results ( " SELECT ID, user_login FROM $wpdb->users ORDER BY ID " );
2003-07-29 18:45:19 +02:00
echo " <select name= \" newowner \" size= \" 1 \" > \n " ;
2003-07-27 01:52:36 +02:00
foreach ( $results as $row ) {
2003-07-29 18:45:19 +02:00
echo " <option value= \" " . $row -> ID . " \" " ;
2003-07-27 01:52:36 +02:00
echo " > " . $row -> user_login ;
echo " </option> \n " ;
}
2003-07-29 18:45:19 +02:00
echo " </select> \n " ;
2003-07-27 01:52:36 +02:00
?>
2004-04-25 03:02:52 +02:00
< input name = " assign " type = " submit " id = " assign " value = " <?php _e('Go') ?> " />
2003-07-29 18:45:19 +02:00
</ td >
< td >
2004-08-04 05:35:49 +02:00
< input name = " visibility " type = " submit " id = " visibility " value = " <?php _e('Toggle Visibility') ?> " />
2003-07-29 18:45:19 +02:00
</ td >
< td >
2005-09-19 02:47:58 +02:00
< ? php _e ( 'Move to category:' ); link_category_dropdown ( 'category' ); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" />
2003-07-27 01:52:36 +02:00
</ td >
< td align = " right " >
2004-12-16 00:09:46 +01:00
< a href = " # " onclick = " checkAll(document.getElementById('links')); return false; " >< ? php _e ( 'Toggle Checkboxes' ) ?> </a>
2003-07-27 01:52:36 +02:00
</ td >
</ tr >
2003-06-01 12:16:04 +02:00
</ table >
2003-12-28 12:44:05 +01:00
2003-05-22 14:12:53 +02:00
< ? php
} // end if !popup
?>
2003-05-23 10:29:51 +02:00
</ div >
2004-06-11 20:23:12 +02:00
</ form >
2003-05-22 14:12:53 +02:00
< ? php
break ;
} // end default
} // end case
?>
2005-04-09 06:32:38 +02:00
< ? php include ( 'admin-footer.php' ); ?>