本文整理汇总了PHP中Artists::get_artists方法的典型用法代码示例。如果您正苦于以下问题:PHP Artists::get_artists方法的具体用法?PHP Artists::get_artists怎么用?PHP Artists::get_artists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artists
的用法示例。
在下文中一共展示了Artists::get_artists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
</div>
</div>
<?php
}
//polls();
?>
</div>
<div class="main_column">
<?php
$Recommend = $Cache->get_value('recommend');
$Recommend_artists = $Cache->get_value('recommend_artists');
if (!is_array($Recommend) || !is_array($Recommend_artists)) {
$DB->query("\n\t\tSELECT\n\t\t\ttr.GroupID,\n\t\t\ttr.UserID,\n\t\t\tu.Username,\n\t\t\ttg.Name,\n\t\t\ttg.TagList\n\t\tFROM torrents_recommended AS tr\n\t\t\tJOIN torrents_group AS tg ON tg.ID = tr.GroupID\n\t\t\tLEFT JOIN users_main AS u ON u.ID = tr.UserID\n\t\tORDER BY tr.Time DESC\n\t\tLIMIT 10");
$Recommend = $DB->to_array();
$Cache->cache_value('recommend', $Recommend, 1209600);
$Recommend_artists = Artists::get_artists($DB->collect('GroupID'));
$Cache->cache_value('recommend_artists', $Recommend_artists, 1209600);
}
if (count($Recommend) >= 4) {
$Cache->increment('usage_index');
?>
<div class="box" id="recommended">
<div class="head colhead_dark">
<strong>Latest Vanity House additions</strong>
<a href="#" onclick="$('#vanityhouse').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Show</a>
</div>
<table class="torrent_table hidden" id="vanityhouse">
<?php
foreach ($Recommend as $Recommendations) {
list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
示例2: foreach
</a>
</td>
<?php
}
?>
</tr>
</table>
<?php
}
}
if (check_paranoia_here('uploads')) {
$RecentUploads = $Cache->get_value("recent_uploads_{$UserID}");
if ($RecentUploads === false) {
$DB->query("\n\t\t\tSELECT\n\t\t\t\tg.ID,\n\t\t\t\tg.Name,\n\t\t\t\tg.WikiImage\n\t\t\tFROM torrents_group AS g\n\t\t\t\tINNER JOIN torrents AS t ON t.GroupID = g.ID\n\t\t\tWHERE t.UserID = '{$UserID}'\n\t\t\t\tAND g.CategoryID = '1'\n\t\t\t\tAND g.WikiImage != ''\n\t\t\tGROUP BY g.ID\n\t\t\tORDER BY t.Time DESC\n\t\t\tLIMIT 5");
$RecentUploads = $DB->to_array();
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
}
$Cache->cache_value("recent_uploads_{$UserID}", $RecentUploads, 0);
//inf cache
}
if (!empty($RecentUploads)) {
?>
<table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">
Recent Uploads
</td>
</tr>
<tr>
示例3: get_groups
/**
* Function to get data and torrents for an array of GroupIDs. Order of keys doesn't matter
*
* @param array $GroupIDs
* @param boolean $Return if false, nothing is returned. For priming cache.
* @param boolean $GetArtists if true, each group will contain the result of
* Artists::get_artists($GroupID), in result[$GroupID]['ExtendedArtists']
* @param boolean $Torrents if true, each group contains a list of torrents, in result[$GroupID]['Torrents']
*
* @return array each row of the following format:
* GroupID => (
* ID
* Name
* Year
* RecordLabel
* CatalogueNumber
* TagList
* ReleaseType
* VanityHouse
* WikiImage
* CategoryID
* Torrents => {
* ID => {
* GroupID, Media, Format, Encoding, RemasterYear, Remastered,
* RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene,
* HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers,
* Seeders, Snatched, Time, HasFile, PersonalFL, IsSnatched
* }
* }
* Artists => {
* {
* id, name, aliasid // Only main artists
* }
* }
* ExtendedArtists => {
* [1-6] => { // See documentation on Artists::get_artists
* id, name, aliasid
* }
* }
* Flags => {
* IsSnatched
* }
*/
public static function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true)
{
$Found = $NotFound = array_fill_keys($GroupIDs, false);
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
foreach ($GroupIDs as $i => $GroupID) {
if (!is_number($GroupID)) {
unset($GroupIDs[$i], $Found[$GroupID], $NotFound[$GroupID]);
continue;
}
$Data = G::$Cache->get_value($Key . $GroupID, true);
if (!empty($Data) && is_array($Data) && $Data['ver'] == CACHE::GROUP_VERSION) {
unset($NotFound[$GroupID]);
$Found[$GroupID] = $Data['d'];
}
}
// Make sure there's something in $GroupIDs, otherwise the SQL will break
if (count($GroupIDs) === 0) {
return array();
}
/*
Changing any of these attributes returned will cause very large, very dramatic site-wide chaos.
Do not change what is returned or the order thereof without updating:
torrents, artists, collages, bookmarks, better, the front page,
and anywhere else the get_groups function is used.
Update self::array_group(), too
*/
if (count($NotFound) > 0) {
$IDs = implode(',', array_keys($NotFound));
$NotFound = array();
$QueryID = G::$DB->get_query_id();
G::$DB->query("\n\t\t\t\tSELECT\n\t\t\t\t\tID, Name, Year, RecordLabel, CatalogueNumber, TagList, ReleaseType, VanityHouse, WikiImage, CategoryID\n\t\t\t\tFROM torrents_group\n\t\t\t\tWHERE ID IN ({$IDs})");
while ($Group = G::$DB->next_record(MYSQLI_ASSOC, true)) {
$NotFound[$Group['ID']] = $Group;
$NotFound[$Group['ID']]['Torrents'] = array();
$NotFound[$Group['ID']]['Artists'] = array();
}
G::$DB->set_query_id($QueryID);
if ($Torrents) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle,\n\t\t\t\t\t\tRemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore,\n\t\t\t\t\t\tFileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile\n\t\t\t\t\tFROM torrents\n\t\t\t\t\tWHERE GroupID IN ({$IDs})\n\t\t\t\t\tORDER BY GroupID, Remastered, (RemasterYear != 0) DESC, RemasterYear, RemasterTitle,\n\t\t\t\t\t\t\tRemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
while ($Torrent = G::$DB->next_record(MYSQLI_ASSOC, true)) {
$NotFound[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
}
G::$DB->set_query_id($QueryID);
}
foreach ($NotFound as $GroupID => $GroupInfo) {
G::$Cache->cache_value($Key . $GroupID, array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 0);
}
$Found = $NotFound + $Found;
}
// Filter out orphans (elements that are == false)
$Found = array_filter($Found);
if ($GetArtists) {
$Artists = Artists::get_artists($GroupIDs);
} else {
$Artists = array();
}
//.........这里部分代码省略.........
示例4: error
break;
case 'seeding':
if (!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$SQL = "\n\t\t\t\t\tJOIN xbt_files_users AS xfu ON t.ID = xfu.fid\n\t\t\t\tWHERE xfu.uid = '{$UserID}'\n\t\t\t\t\tAND xfu.remaining = 0";
$Month = "FROM_UNIXTIME(xfu.mtime)";
break;
default:
error(0);
}
}
$DownloadsQ = $DB->query("\n\tSELECT\n\t\tt.ID AS TorrentID,\n\t\tDATE_FORMAT({$Month}, '%Y - %m') AS Month,\n\t\tt.GroupID,\n\t\tt.Media,\n\t\tt.Format,\n\t\tt.Encoding,\n\t\tIF(t.RemasterYear = 0, tg.Year, t.RemasterYear) AS Year,\n\t\ttg.Name,\n\t\tt.Size\n\tFROM torrents AS t\n\t\tJOIN torrents_group AS tg ON t.GroupID = tg.ID\n\t{$SQL}\n\tGROUP BY TorrentID");
$Collector = new TorrentsDL($DownloadsQ, "{$Username}'s " . ucfirst($_GET['type']));
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentIDs = array_keys($GroupIDs);
$TorrentFilesQ = $DB->query('
SELECT TorrentID, File
FROM torrents_files
WHERE TorrentID IN (' . implode(',', $TorrentIDs) . ')', false);
if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive
foreach ($TorrentIDs as $TorrentID) {
$Download =& $Downloads[$TorrentID];
$Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
$Collector->fail_file($Download);
}
continue;
}
while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) {
示例5: set_message
//Everything is legit, let's just confim they're not retarded
if (empty($_POST['confirm'])) {
$DB->query("\n\t\tSELECT Name\n\t\tFROM torrents_group\n\t\tWHERE ID = {$OldGroupID}");
if (!$DB->has_results()) {
//Trying to move to an empty group? I think not!
set_message('The destination torrent group does not exist!');
header('Location: ' . $_SERVER['HTTP_REFERER']);
die;
}
list($Name) = $DB->next_record();
$DB->query("\n\t\tSELECT CategoryID, Name\n\t\tFROM torrents_group\n\t\tWHERE ID = {$GroupID}");
list($CategoryID, $NewName) = $DB->next_record();
if ($Categories[$CategoryID - 1] != 'Music') {
error('Destination torrent group must be in the "Music" category.');
}
$Artists = Artists::get_artists(array($OldGroupID, $GroupID));
View::show_header();
?>
<div class="thin">
<div class="header">
<h2>Torrent Group ID Change Confirmation</h2>
</div>
<div class="box pad">
<form class="confirm_form" name="torrent_group" action="torrents.php" method="post">
<input type="hidden" name="action" value="editgroupid" />
<input type="hidden" name="auth" value="<?php
echo $LoggedUser['AuthKey'];
?>
" />
<input type="hidden" name="confirm" value="true" />
<input type="hidden" name="torrentid" value="<?php
示例6: error
if ($NewGroupID == $GroupID) {
error('Old group ID is the same as new group ID!');
}
$DB->query("\n\tSELECT CategoryID, Name\n\tFROM torrents_group\n\tWHERE ID = '{$NewGroupID}'");
if (!$DB->has_results()) {
error('Target group does not exist.');
}
list($CategoryID, $NewName) = $DB->next_record();
if ($Categories[$CategoryID - 1] != 'Music') {
error('Only music groups can be merged.');
}
$DB->query("\n\tSELECT Name\n\tFROM torrents_group\n\tWHERE ID = {$GroupID}");
list($Name) = $DB->next_record();
// Everything is legit, let's just confim they're not retarded
if (empty($_POST['confirm'])) {
$Artists = Artists::get_artists(array($GroupID, $NewGroupID));
View::show_header();
?>
<div class="center thin">
<div class="header">
<h2>Merge Confirm!</h2>
</div>
<div class="box pad">
<form class="confirm_form" name="torrent_group" action="torrents.php" method="post">
<input type="hidden" name="action" value="merge" />
<input type="hidden" name="auth" value="<?php
echo $LoggedUser['AuthKey'];
?>
" />
<input type="hidden" name="confirm" value="true" />
<input type="hidden" name="groupid" value="<?php
示例7: generate_torrent_table
//.........这里部分代码省略.........
?>
/images/leechers.png" alt="Leechers" title="Leechers" class="tooltip" /></td>
<td style="text-align: right;">Peers</td>
</tr>
<?php
// Server is already processing a top10 query. Starting another one will make things slow
if ($Details === false) {
?>
<tr class="rowb">
<td colspan="9" class="center">
Server is busy processing another top list request. Please try again in a minute.
</td>
</tr>
</table><br />
<?php
return;
}
// in the unlikely event that query finds 0 rows...
if (empty($Details)) {
?>
<tr class="rowb">
<td colspan="9" class="center">
Found no torrents matching the criteria.
</td>
</tr>
</table><br />
<?php
return;
}
$Rank = 0;
foreach ($Details as $Detail) {
$GroupIDs[] = $Detail[1];
}
$Artists = Artists::get_artists($GroupIDs);
foreach ($Details as $Detail) {
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TagsList, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
$IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID);
$IsSnatched = Torrents::has_snatched($TorrentID);
// highlight every other row
$Rank++;
$Highlight = $Rank % 2 ? 'a' : 'b';
// generate torrent's title
$DisplayName = '';
if (!empty($Artists[$GroupID])) {
$DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
}
$DisplayName .= "<a href=\"torrents.php?id={$GroupID}&torrentid={$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>";
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName .= " [{$GroupYear}]";
}
if ($GroupCategoryID == 1 && $ReleaseType > 0) {
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
}
// append extra info to torrent title
$ExtraInfo = '';
$AddExtra = '';
if (empty($GroupBy)) {
if ($Format) {
$ExtraInfo .= $Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo .= $AddExtra . $Encoding;
$AddExtra = ' / ';
}
// "FLAC / Lossless / Log (100%) / Cue / CD";
示例8: get_artist
/**
* Convenience function for get_artists, when you just need one group.
*
* @param int $GroupID
* @return array - see get_artists
*/
public static function get_artist($GroupID)
{
$Results = Artists::get_artists(array($GroupID));
return $Results[$GroupID];
}