mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 19:06:27 +00:00
Empty commit
This commit is contained in:
parent
ea11c1a88d
commit
d34618314d
@ -1,7 +1,7 @@
|
||||
<?
|
||||
class TEXT {
|
||||
// tag=>max number of attributes
|
||||
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, '#'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'code'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0, 'important'=>0
|
||||
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, '#'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'code'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0, 'important'=>0, 'torrent'=>0
|
||||
);
|
||||
private $Smileys = array(
|
||||
':angry:' => 'angry.gif',
|
||||
@ -370,6 +370,9 @@ function parse($Str) {
|
||||
case 'artist':
|
||||
$Array[$ArrayPos] = array('Type'=>'artist', 'Val'=>$Block);
|
||||
break;
|
||||
case 'torrent':
|
||||
$Array[$ArrayPos] = array('Type'=>'torrent', 'Val'=>$Block);
|
||||
break;
|
||||
case 'tex':
|
||||
$Array[$ArrayPos] = array('Type'=>'tex', 'Val'=>$Block);
|
||||
break;
|
||||
@ -450,6 +453,23 @@ function to_html($Array) {
|
||||
case 'artist':
|
||||
$Str.='<a href="artist.php?artistname='.urlencode(undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
|
||||
break;
|
||||
case 'torrent':
|
||||
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php?.*id=)?(\d+)($|&|#)/';
|
||||
$Matches = array();
|
||||
if (preg_match($Pattern, $Block['Val'], $Matches)) {
|
||||
if (isset($Matches[2])) {
|
||||
$Groups = get_groups(array($Matches[2]), true, true, false);
|
||||
if (!empty($Groups['matches'][$Matches[2]])) {
|
||||
$Group = $Groups['matches'][$Matches[2]];
|
||||
$Str .= display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$Matches[2].'">'.$Group['Name'].'</a>';
|
||||
} else {
|
||||
$Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$Str .= '[torrent]'.$Block['Val'].'[/torrent]';
|
||||
}
|
||||
break;
|
||||
case 'wiki':
|
||||
$Str.='<a href="wiki.php?action=article&name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
||||
break;
|
||||
|
@ -1748,14 +1748,15 @@ function display_artist($Artist, $MakeLink = true, $Escape = true) {
|
||||
|
||||
// Function to get data and torrents for an array of GroupIDs.
|
||||
// In places where the output from this is merged with sphinx filters, it will be in a different order.
|
||||
function get_groups($GroupIDs, $Return = true, $GetArtists = true) {
|
||||
function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true) {
|
||||
global $DB, $Cache;
|
||||
|
||||
$Found = array_flip($GroupIDs);
|
||||
$NotFound = array_flip($GroupIDs);
|
||||
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
|
||||
|
||||
foreach($GroupIDs as $GroupID) {
|
||||
$Data = $Cache->get_value('torrent_group_'.$GroupID);
|
||||
$Data = $Cache->get_value($Key.$GroupID);
|
||||
if(!empty($Data) && (@$Data['ver'] >= 4)) {
|
||||
unset($NotFound[$GroupID]);
|
||||
$Found[$GroupID] = $Data['d'];
|
||||
@ -1780,14 +1781,21 @@ function get_groups($GroupIDs, $Return = true, $GetArtists = true) {
|
||||
$Found[$Group['ID']]['Torrents'] = array();
|
||||
$Found[$Group['ID']]['Artists'] = array();
|
||||
}
|
||||
|
||||
$DB->query("SELECT
|
||||
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
|
||||
FROM torrents AS t WHERE GroupID IN($IDs) ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
|
||||
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
||||
|
||||
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'], array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||
|
||||
if ($Torrents) {
|
||||
$DB->query("SELECT
|
||||
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
|
||||
FROM torrents AS t WHERE GroupID IN($IDs) ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
|
||||
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
||||
|
||||
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'], array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||
$Cache->cache_value('torrent_group_light_'.$Torrent['GroupID'], array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||
}
|
||||
} else {
|
||||
foreach ($Found as $Group) {
|
||||
$Cache->cache_value('torrent_group_light_'.$Group['ID'], array('ver'=>4, 'd'=>$Found[$Group['ID']]), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($GetArtists) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?
|
||||
|
||||
authorize(true);
|
||||
|
||||
include(SERVER_ROOT.'/sections/requests/functions.php');
|
||||
|
||||
$Queries = array();
|
||||
|
@ -36,7 +36,8 @@
|
||||
|
||||
$DB->query("INSERT INTO torrents_tags_votes (GroupID, TagID, UserID, Way) VALUES ('$GroupID', '$TagID', '$UserID', 'up')");
|
||||
|
||||
|
||||
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Tag "'.$TagName.'" added to group')."')");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,17 @@
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM tags WHERE ID='$TagID'");
|
||||
if (list($TagName) = $DB->next_record()) {
|
||||
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Tag "'.$TagName.'" removed from group')."')");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM torrents_tags_votes WHERE GroupID='$GroupID' AND TagID='$TagID'");
|
||||
$DB->query("DELETE FROM torrents_tags WHERE GroupID='$GroupID' AND TagID='$TagID'");
|
||||
|
||||
|
||||
|
||||
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
|
||||
update_hash($GroupID);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user