diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index fe097dac..1a1a6229 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -4,9 +4,7 @@ function compare($X, $Y) { return($Y['count'] - $X['count']); } -// Bookmarks::has_bookmarked() include(SERVER_ROOT.'/sections/requests/functions.php'); -include(SERVER_ROOT.'/sections/bookmarks/functions.php'); include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; @@ -231,7 +229,7 @@ function compare($X, $Y) { 'releaseType' => (int) $ReleaseType, 'wikiImage' => $WikiImage, 'groupVanityHouse' => $GroupVanityHouse == 1, - 'hasBookmarked' => $hasBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID), + 'hasBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'torrent' => $InnerTorrents ); } @@ -319,7 +317,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/request.php b/sections/ajax/request.php index e6f38e49..e527cf83 100644 --- a/sections/ajax/request.php +++ b/sections/ajax/request.php @@ -11,13 +11,11 @@ */ include(SERVER_ROOT.'/sections/requests/functions.php'); - -// Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); $Text = new TEXT; if (empty($_GET['id']) || !is_number($_GET['id'])) { - json_die("failure"); + json_die("failure"); } $RequestID = $_GET['id']; @@ -191,6 +189,7 @@ 'requestId' => (int) $RequestID, 'requestorId' => (int) $RequestorID, 'requestorName' => $RequestorName, + 'isBookmarked' => Bookmarks::has_bookmarked('request', $RequestID), 'requestTax' => $RequestTax, 'timeAdded' => $TimeAdded, 'canEdit' => $CanEdit, diff --git a/sections/ajax/torrent.php b/sections/ajax/torrent.php index f1ba79e5..28e4ddfc 100644 --- a/sections/ajax/torrent.php +++ b/sections/ajax/torrent.php @@ -1,8 +1,5 @@ - $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, - 'isBookmarked' => has_bookmarked('torrent', $GroupID), + 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo ); -$Torrent = array_pop($TorrentList); +$Torrent = $TorrentList[$TorrentID]; // Convert file list back to the old format $FileList = explode("\n", $Torrent['FileList']); foreach ($FileList as &$File) { diff --git a/sections/ajax/userhistory/post_history.php b/sections/ajax/userhistory/post_history.php index e36a763f..c692ee68 100644 --- a/sections/ajax/userhistory/post_history.php +++ b/sections/ajax/userhistory/post_history.php @@ -1,5 +1,4 @@ get_value('user_info_'.$UserID)) === false) { - $DB->query("SELECT - m.Username, - m.Enabled, - m.Title, - i.Avatar, - i.Donor, - i.Warned - FROM users_main AS m - JOIN users_info AS i ON i.UserID = m.ID - WHERE m.ID = $UserID"); - - if ($DB->record_count() == 0) { // If user doesn't exist - error_out('User does not exist!'); - } - list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record(); -} else { - extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); -} +$UserInfo = Users::user_info($UserID); +extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); if ($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); diff --git a/sections/artist/artist.php b/sections/artist/artist.php index ec7e81f5..ca41d962 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -6,7 +6,6 @@ function compare($X, $Y) { return($Y['count'] - $X['count']); } -// Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; diff --git a/sections/bookmarks/functions.php b/sections/bookmarks/functions.php deleted file mode 100644 index 05bf6373..00000000 --- a/sections/bookmarks/functions.php +++ /dev/null @@ -1,46 +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/collages/collage.php b/sections/collages/collage.php index 1e0c8c25..a88f8d78 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -7,7 +7,6 @@ function compare($X, $Y) { return($Y['count'] - $X['count']); } -// Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; diff --git a/sections/requests/request.php b/sections/requests/request.php index 8f928df4..a8b103e9 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -4,7 +4,6 @@ * This is the page that displays the request to the end user after being created. */ -// Bookmarks::has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); $Text = new TEXT; diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index fb970771..2a5773cf 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -1,6 +1,4 @@ get_value('user_info_'.$UserID)) === false) { - $DB->query("SELECT - m.Username, - m.Enabled, - m.Title, - i.Avatar, - i.Donor, - i.Warned - FROM users_main AS m - JOIN users_info AS i ON i.UserID = m.ID - WHERE m.ID = $UserID"); - - if ($DB->record_count() == 0) { // If user doesn't exist - error(404); - } - list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record(); -} else { - extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); -} +$UserInfo = Users::user_info($UserID); +extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); View::show_header('Post history for '.$Username,'subscriptions,comments,bbcode');