2011-03-28 14:21:28 +00:00
< ?
enforce_login ();
2013-03-29 08:00:08 +00:00
2011-08-09 21:03:28 +00:00
2012-10-27 08:00:09 +00:00
// Number of users per page
2011-03-28 14:21:28 +00:00
define ( 'BOOKMARKS_PER_PAGE' , '20' );
2013-05-01 08:00:16 +00:00
if ( empty ( $_REQUEST [ 'action' ])) {
$_REQUEST [ 'action' ] = 'view' ;
}
switch ( $_REQUEST [ 'action' ]) {
2011-08-09 21:03:28 +00:00
case 'add' :
require ( SERVER_ROOT . '/sections/bookmarks/add.php' );
break ;
case 'remove' :
require ( SERVER_ROOT . '/sections/bookmarks/remove.php' );
break ;
2012-10-27 08:00:09 +00:00
case 'mass_edit' :
require ( SERVER_ROOT . '/sections/bookmarks/mass_edit.php' );
break ;
2011-08-09 21:03:28 +00:00
case 'remove_snatched' :
authorize ();
2012-03-11 08:00:18 +00:00
$DB -> query ( " CREATE TEMPORARY TABLE snatched_groups_temp (GroupID int PRIMARY KEY) " );
$DB -> query ( " INSERT INTO snatched_groups_temp SELECT DISTINCT GroupID FROM torrents AS t JOIN xbt_snatched AS s ON s.fid=t.ID WHERE s.uid=' $LoggedUser[ID] ' " );
$DB -> query ( " DELETE b FROM bookmarks_torrents AS b JOIN snatched_groups_temp AS s USING(GroupID) WHERE b.UserID=' $LoggedUser[ID] ' " );
2013-02-25 21:16:55 +00:00
$Cache -> delete_value ( 'bookmarks_group_ids_' . $UserID );
2011-08-09 21:03:28 +00:00
header ( 'Location: bookmarks.php' );
die ();
break ;
2012-10-27 08:00:09 +00:00
case 'edit' :
2013-05-01 08:00:16 +00:00
if ( empty ( $_REQUEST [ 'type' ])) {
$_REQUEST [ 'type' ] = false ;
}
2012-10-27 08:00:09 +00:00
switch ( $_REQUEST [ 'type' ]) {
case 'torrents' :
require ( SERVER_ROOT . '/sections/bookmarks/edit_torrents.php' );
break ;
default : error ( 404 );
}
break ;
2011-08-09 21:03:28 +00:00
case 'view' :
2013-05-01 08:00:16 +00:00
if ( empty ( $_REQUEST [ 'type' ])) {
$_REQUEST [ 'type' ] = 'torrents' ;
}
2011-08-09 21:03:28 +00:00
switch ( $_REQUEST [ 'type' ]) {
case 'torrents' :
require ( SERVER_ROOT . '/sections/bookmarks/torrents.php' );
break ;
case 'artists' :
require ( SERVER_ROOT . '/sections/bookmarks/artists.php' );
break ;
case 'collages' :
$_GET [ 'bookmarks' ] = 1 ;
require ( SERVER_ROOT . '/sections/collages/browse.php' );
break ;
case 'requests' :
$_GET [ 'type' ] = 'bookmarks' ;
require ( SERVER_ROOT . '/sections/requests/requests.php' );
break ;
default :
error ( 404 );
}
break ;
default :
error ( 404 );
2011-03-28 14:21:28 +00:00
}