Empty commit

This commit is contained in:
Git 2013-05-11 08:00:29 +00:00
parent 13568d1565
commit c483573095
11 changed files with 18 additions and 106 deletions

View File

@ -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,

View File

@ -11,8 +11,6 @@
*/
include(SERVER_ROOT.'/sections/requests/functions.php');
// Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
@ -191,6 +189,7 @@
'requestId' => (int) $RequestID,
'requestorId' => (int) $RequestorID,
'requestorName' => $RequestorName,
'isBookmarked' => Bookmarks::has_bookmarked('request', $RequestID),
'requestTax' => $RequestTax,
'timeAdded' => $TimeAdded,
'canEdit' => $CanEdit,

View File

@ -1,8 +1,5 @@
<?php
<?
require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
@ -12,7 +9,7 @@
$TorrentID = (int)$_GET['id'];
$TorrentHash = (string)$_GET['hash'];
if ($GroupID && $TorrentHash) {
if ($TorrentID && $TorrentHash) {
json_die("failure", "bad parameters");
}
@ -39,6 +36,12 @@
list($TorrentDetails, $TorrentList) = $TorrentCache;
if (!isset($TorrentList[$TorrentID])) {
json_die("failure", "bad id parameter");
}
$GroupID = $TorrentDetails['ID'];
$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
$CategoryName = "Unknown";
@ -74,11 +77,11 @@
'categoryName' => $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) {

View File

@ -1,5 +1,4 @@
<?
//TODO: replace 24-43 with Users::user_info()
/*
User post history page
*/
@ -34,25 +33,8 @@ function error_out($reason = '') {
list($Page,$Limit) = Format::page_limit($PerPage);
if (($UserInfo = $Cache->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 {
$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']['']);

View File

@ -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;

View File

@ -1,46 +0,0 @@
<?
function can_bookmark($Type) {
return in_array($Type, array('torrent', 'artist', 'collage', 'request'));
}
// Recommended usage:
// list($Table, $Col) = bookmark_schema('torrent');
function bookmark_schema($Type) {
switch ($Type) {
case 'torrent':
return array('bookmarks_torrents', 'GroupID');
break;
case 'artist':
return array('bookmarks_artists', 'ArtistID');
break;
case 'collage':
return array('bookmarks_collages', 'CollageID');
break;
case 'request':
return array('bookmarks_requests', 'RequestID');
break;
default:
die('HAX');
}
}
function has_bookmarked($Type, $ID) {
return in_array($ID, all_bookmarks($Type));
}
function all_bookmarks($Type, $UserID = false) {
global $DB, $Cache, $LoggedUser;
if ($UserID === false) {
$UserID = $LoggedUser['ID'];
}
$CacheKey = 'bookmarks_'.$Type.'_'.$UserID;
if (($Bookmarks = $Cache->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;
}
?>

View File

@ -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;

View File

@ -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;

View File

@ -1,6 +1,4 @@
<?
// Bookmarks::has_bookmarked()
$Where = array();
if (!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {

View File

@ -7,7 +7,6 @@ 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
// Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT;

View File

@ -1,5 +1,4 @@
<?
//TODO: replace 24-43 with Users::user_info()
/*
User post history page
*/
@ -26,25 +25,8 @@
list($Page,$Limit) = Format::page_limit($PerPage);
if (($UserInfo = $Cache->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 {
$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');