diff --git a/classes/bookmarks.class.php b/classes/bookmarks.class.php new file mode 100644 index 00000000..e30565b1 --- /dev/null +++ b/classes/bookmarks.class.php @@ -0,0 +1,95 @@ +get_value($CacheKey)) === FALSE) { + list ($Table, $Col) = self::bookmark_schema($Type); + $DB->query("SELECT $Col FROM $Table WHERE UserID = '$UserID'"); + $Bookmarks = $DB->collect($Col); + $Cache->cache_value($CacheKey, $Bookmarks, 0); + } + return $Bookmarks; + } +} +?> diff --git a/classes/script_start.php b/classes/script_start.php index 1149177f..da6f05f5 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -96,6 +96,9 @@ case 'BencodeTorrent': $FileName = 'class_bencodetorrent'; break; + case 'Bookmarks': + $FileName = 'bookmarks.class'; + break; case 'Format': $FileName = 'class_format'; break; diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index f6bb39af..1d89b4be 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -4,7 +4,7 @@ function compare($X, $Y){ return($Y['count'] - $X['count']); } -include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() + // Bookmarks::has_bookmarked() include(SERVER_ROOT.'/sections/requests/functions.php'); include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class @@ -225,7 +225,7 @@ function compare($X, $Y){ 'releaseType' => (int) $ReleaseType, 'wikiImage' => $WikiImage, 'groupVanityHouse' => $GroupVanityHouse == 1, - 'hasBookmarked' => $hasBookmarked = has_bookmarked('torrent', $GroupID), + 'hasBookmarked' => $hasBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID), 'torrent' => $InnerTorrents ); } @@ -295,7 +295,7 @@ function compare($X, $Y){ 'id' => (int) $ArtistID, 'name' => $Name, 'notificationsEnabled' => $notificationsEnabled, - 'hasBookmarked' => has_bookmarked('artist', $ArtistID), + 'hasBookmarked' => Bookmarks::has_bookmarked('artist', $ArtistID), 'image' => $Image, 'body' => $Text->full_format($Body), 'vanityHouse' => $VanityHouseArtist == 1, diff --git a/sections/ajax/bookmarks/artists.php b/sections/ajax/bookmarks/artists.php index 13287b95..b7045e84 100644 --- a/sections/ajax/bookmarks/artists.php +++ b/sections/ajax/bookmarks/artists.php @@ -29,7 +29,7 @@ $Sneaky = ($UserID != $LoggedUser['ID']); -//$ArtistList = all_bookmarks('artist', $UserID); +//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID); $DB->query('SELECT ag.ArtistID, ag.Name FROM bookmarks_artists AS ba diff --git a/sections/ajax/bookmarks/index.php b/sections/ajax/bookmarks/index.php index 735428b1..ae3a1b6d 100644 --- a/sections/ajax/bookmarks/index.php +++ b/sections/ajax/bookmarks/index.php @@ -1,5 +1,5 @@ $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, - 'isBookmarked' => has_bookmarked('torrent', $GroupID), + 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo ); diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 4d4de07e..63421e60 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -6,7 +6,7 @@ function compare($X, $Y){ return($Y['count'] - $X['count']); } -include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() + // Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; @@ -383,7 +383,13 @@ function compare($X, $Y){
- + + Unbookmark"; + } else { + echo " Bookmark"; + } ?> +
format()?>
@@ -475,7 +481,7 @@ function compare($X, $Y){ } } -if (has_bookmarked('artist', $ArtistID)) { +if (Bookmarks::has_bookmarked('artist', $ArtistID)) { ?> Remove bookmark diff --git a/sections/bookmarks/add.php b/sections/bookmarks/add.php index 82993de8..bf9e4dd6 100644 --- a/sections/bookmarks/add.php +++ b/sections/bookmarks/add.php @@ -4,13 +4,13 @@ authorize(); -if (!can_bookmark($_GET['type'])) { error(404); } +if (!Bookmarks::can_bookmark($_GET['type'])) { error(404); } $Feed = new FEED; $Text = new TEXT; $Type = $_GET['type']; -list($Table, $Col) = bookmark_schema($Type); +list($Table, $Col) = Bookmarks::bookmark_schema($Type); if(!is_number($_GET['id'])) { error(0); diff --git a/sections/bookmarks/artists.php b/sections/bookmarks/artists.php index 7e9bef96..b8fbc620 100644 --- a/sections/bookmarks/artists.php +++ b/sections/bookmarks/artists.php @@ -15,7 +15,7 @@ $Sneaky = ($UserID != $LoggedUser['ID']); -//$ArtistList = all_bookmarks('artist', $UserID); +//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID); $DB->query('SELECT ag.ArtistID, ag.Name FROM bookmarks_artists AS ba diff --git a/sections/bookmarks/functions.php b/sections/bookmarks/functions.php deleted file mode 100644 index 33d033e5..00000000 --- a/sections/bookmarks/functions.php +++ /dev/null @@ -1,44 +0,0 @@ -get_value($CacheKey)) === FALSE) { - list($Table, $Col) = bookmark_schema($Type); - $DB->query("SELECT $Col FROM $Table WHERE UserID = '$UserID'"); - $Bookmarks = $DB->collect($Col); - $Cache->cache_value($CacheKey, $Bookmarks, 0); - } - return $Bookmarks; -} -?> diff --git a/sections/bookmarks/index.php b/sections/bookmarks/index.php index f1ca59f3..aaf02c2b 100644 --- a/sections/bookmarks/index.php +++ b/sections/bookmarks/index.php @@ -1,6 +1,6 @@ Locked Remove bookmark diff --git a/sections/requests/request.php b/sections/requests/request.php index 2ee6471f..9a4d07d0 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -4,7 +4,7 @@ * This is the page that displays the request to the end user after being created. */ -include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() + // Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); $Text = new TEXT; @@ -93,7 +93,7 @@ if($UserCanEdit || check_perms('users_mod')) { //check_perms('site_moderate_requests')) { ?> Delete - + Remove bookmark Bookmark diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index 6d910807..dea437c3 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -1,5 +1,5 @@

Top diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 30c7d94f..6c69f823 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -7,7 +7,7 @@ function compare($X, $Y){ define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default define('MAX_COLLAGES', 5); // How many normal collages should be shown by default -include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() + // Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); $Text = NEW TEXT; @@ -93,7 +93,7 @@ function compare($X, $Y){ Revert to this revision Unbookmark