コード例 #1
0
ファイル: index.php プロジェクト: bigsony/Gazelle
     }
     //foreach ($Top10 as $Torrent)
     // Send warnings to uploaders of torrents that will be deleted this week
     $DB->query("\n\t\t\tSELECT\n\t\t\t\tt.ID,\n\t\t\t\tt.GroupID,\n\t\t\t\ttg.Name,\n\t\t\t\tt.Format,\n\t\t\t\tt.Encoding,\n\t\t\t\tt.UserID\n\t\t\tFROM torrents AS t\n\t\t\t\tJOIN torrents_group AS tg ON tg.ID = t.GroupID\n\t\t\t\tJOIN users_info AS u ON u.UserID = t.UserID\n\t\t\tWHERE t.last_action < NOW() - INTERVAL 20 DAY\n\t\t\t\tAND t.last_action != 0\n\t\t\t\tAND u.UnseededAlerts = '1'\n\t\t\tORDER BY t.last_action ASC");
     $TorrentIDs = $DB->to_array();
     $TorrentAlerts = array();
     foreach ($TorrentIDs as $TorrentID) {
         list($ID, $GroupID, $Name, $Format, $Encoding, $UserID) = $TorrentID;
         if (array_key_exists($UserID, $InactivityExceptionsMade) && time() < $InactivityExceptionsMade[$UserID]) {
             // don't notify exceptions
             continue;
         }
         if (!array_key_exists($UserID, $TorrentAlerts)) {
             $TorrentAlerts[$UserID] = array('Count' => 0, 'Msg' => '');
         }
         $ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
         if ($ArtistName) {
             $Name = "{$ArtistName} - {$Name}";
         }
         if ($Format && $Encoding) {
             $Name .= " [{$Format} / {$Encoding}]";
         }
         $TorrentAlerts[$UserID]['Msg'] .= "\n[url=" . site_url() . "torrents.php?torrentid={$ID}]" . $Name . "[/url]";
         $TorrentAlerts[$UserID]['Count']++;
     }
     foreach ($TorrentAlerts as $UserID => $MessageInfo) {
         Misc::send_pm($UserID, 0, 'Unseeded torrent notification', $MessageInfo['Count'] . " of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=" . site_url() . "wiki.php?action=article&amp;id=663]here[/url].\n\nThe following torrent" . ($MessageInfo['Count'] > 1 ? 's' : '') . ' will be removed for inactivity:' . $MessageInfo['Msg'] . "\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings.");
     }
 }
 $DB->query("\n\t\tUPDATE staff_pm_conversations\n\t\tSET Status = 'Resolved', ResolverID = '0'\n\t\tWHERE Date < NOW() - INTERVAL 1 MONTH\n\t\t\tAND Status = 'Open'\n\t\t\tAND AssignedToUser IS NULL");
 Donations::schedule();
コード例 #2
0
ファイル: torrents.class.php プロジェクト: Kufirc/Gazelle
 /**
  * Update the cache and sphinx delta index to keep everything up-to-date.
  *
  * @param int $GroupID
  */
 public static function update_hash($GroupID)
 {
     $QueryID = G::$DB->get_query_id();
     G::$DB->query("\n\t\t\tUPDATE torrents_group\n\t\t\tSET TagList = (\n\t\t\t\t\tSELECT REPLACE(GROUP_CONCAT(tags.Name SEPARATOR ' '), '.', '_')\n\t\t\t\t\tFROM torrents_tags AS t\n\t\t\t\t\t\tINNER JOIN tags ON tags.ID = t.TagID\n\t\t\t\t\tWHERE t.GroupID = '{$GroupID}'\n\t\t\t\t\tGROUP BY t.GroupID\n\t\t\t\t\t)\n\t\t\tWHERE ID = '{$GroupID}'");
     // Fetch album vote score
     G::$DB->query("\n\t\t\tSELECT Score\n\t\t\tFROM torrents_votes\n\t\t\tWHERE GroupID = {$GroupID}");
     if (G::$DB->has_results()) {
         list($VoteScore) = G::$DB->next_record();
     } else {
         $VoteScore = 0;
     }
     // Fetch album artists
     G::$DB->query("\n\t\t\tSELECT GROUP_CONCAT(aa.Name separator ' ')\n\t\t\tFROM torrents_artists AS ta\n\t\t\t\tJOIN artists_alias AS aa ON aa.AliasID = ta.AliasID\n\t\t\tWHERE ta.GroupID = {$GroupID}\n\t\t\t\tAND ta.Importance IN ('1', '4', '5', '6')\n\t\t\tGROUP BY ta.GroupID");
     if (G::$DB->has_results()) {
         list($ArtistName) = G::$DB->next_record(MYSQLI_NUM, false);
     } else {
         $ArtistName = '';
     }
     G::$DB->query("\n\t\t\tREPLACE INTO sphinx_delta\n\t\t\t\t(ID, GroupID, GroupName, TagList, Year, CategoryID, Time, ReleaseType, RecordLabel,\n\t\t\t\tCatalogueNumber, VanityHouse, Size, Snatched, Seeders, Leechers, LogScore, Scene, HasLog,\n\t\t\t\tHasCue, FreeTorrent, Media, Format, Encoding, Description, RemasterYear, RemasterTitle,\n\t\t\t\tRemasterRecordLabel, RemasterCatalogueNumber, FileList, VoteScore, ArtistName)\n\t\t\tSELECT\n\t\t\t\tt.ID, g.ID, Name, TagList, Year, CategoryID, UNIX_TIMESTAMP(t.Time), ReleaseType,\n\t\t\t\tRecordLabel, CatalogueNumber, VanityHouse, Size, Snatched, Seeders,\n\t\t\t\tLeechers, LogScore, CAST(Scene AS CHAR), CAST(HasLog AS CHAR), CAST(HasCue AS CHAR),\n\t\t\t\tCAST(FreeTorrent AS CHAR), Media, Format, Encoding, Description,\n\t\t\t\tRemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber,\n\t\t\t\tREPLACE(REPLACE(FileList, '_', ' '), '/', ' ') AS FileList, {$VoteScore}, '" . db_string($ArtistName) . "'\n\t\t\tFROM torrents AS t\n\t\t\t\tJOIN torrents_group AS g ON g.ID = t.GroupID\n\t\t\tWHERE g.ID = {$GroupID}");
     G::$Cache->delete_value("torrents_details_{$GroupID}");
     G::$Cache->delete_value("torrent_group_{$GroupID}");
     G::$Cache->delete_value("torrent_group_light_{$GroupID}");
     $ArtistInfo = Artists::get_artist($GroupID);
     foreach ($ArtistInfo as $Importances => $Importance) {
         foreach ($Importance as $Artist) {
             G::$Cache->delete_value('artist_groups_' . $Artist['id']);
             //Needed for at least freeleech change, if not others.
         }
     }
     G::$Cache->delete_value("groups_artists_{$GroupID}");
     G::$DB->set_query_id($QueryID);
 }
コード例 #3
0
ファイル: download.php プロジェクト: mohirt/Gazelle
$ScriptUAs = array('BTWebClient*', 'Python-urllib*', 'python-requests*', 'uTorrent*');
if (Misc::in_array_partial($_SERVER['HTTP_USER_AGENT'], $ScriptUAs)) {
    $DB->query("\n\t\tSELECT 1\n\t\tFROM users_downloads\n\t\tWHERE UserID = {$UserID}\n\t\t\tAND TorrentID = {$TorrentID}\n\t\tLIMIT 4");
    if ($DB->record_count() === 4) {
        error('You have already downloaded this torrent file four times. If you need to download it again, please do so from your browser.', true);
        die;
    }
}
$Info = $Cache->get_value('torrent_download_' . $TorrentID);
if (!is_array($Info) || !array_key_exists('PlainArtists', $Info) || empty($Info[10])) {
    $DB->query("\n\t\tSELECT\n\t\t\tt.Media,\n\t\t\tt.Format,\n\t\t\tt.Encoding,\n\t\t\tIF(t.RemasterYear = 0, tg.Year, t.RemasterYear),\n\t\t\ttg.ID AS GroupID,\n\t\t\ttg.Name,\n\t\t\ttg.WikiImage,\n\t\t\ttg.CategoryID,\n\t\t\tt.Size,\n\t\t\tt.FreeTorrent,\n\t\t\tt.info_hash\n\t\tFROM torrents AS t\n\t\t\tINNER JOIN torrents_group AS tg ON tg.ID = t.GroupID\n\t\tWHERE t.ID = '" . db_string($TorrentID) . "'");
    if (!$DB->has_results()) {
        error(404);
    }
    $Info = array($DB->next_record(MYSQLI_NUM, array(4, 5, 6, 10)));
    $Artists = Artists::get_artist($Info[0][4], false);
    $Info['Artists'] = Artists::display_artists($Artists, false, true);
    $Info['PlainArtists'] = Artists::display_artists($Artists, false, true, false);
    $Cache->cache_value("torrent_download_{$TorrentID}", $Info, 0);
}
if (!is_array($Info[0])) {
    error(404);
}
list($Media, $Format, $Encoding, $Year, $GroupID, $Name, $Image, $CategoryID, $Size, $FreeTorrent, $InfoHash) = array_shift($Info);
// used for generating the filename
$Artists = $Info['Artists'];
// If he's trying use a token on this, we need to make sure he has one,
// deduct it, add this to the FLs table, and update his cache key.
if ($_REQUEST['usetoken'] && $FreeTorrent == '0') {
    if (isset($LoggedUser)) {
        $FLTokens = $LoggedUser['FLTokens'];
コード例 #4
0
ファイル: torrents.php プロジェクト: karamanolev/Gazelle
function generate_torrent_json($Caption, $Tag, $Details, $Limit)
{
    global $LoggedUser, $Categories;
    $results = array();
    foreach ($Details as $Detail) {
        list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TorrentTags, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
        $Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
        $TruncArtist = substr($Artist, 0, strlen($Artist) - 3);
        $TagList = array();
        if ($TorrentTags != '') {
            $TorrentTags = explode(' ', $TorrentTags);
            foreach ($TorrentTags as $TagKey => $TagName) {
                $TagName = str_replace('_', '.', $TagName);
                $TagList[] = $TagName;
            }
        }
        // Append to the existing array.
        $results[] = array('torrentId' => (int) $TorrentID, 'groupId' => (int) $GroupID, 'artist' => $TruncArtist, 'groupName' => $GroupName, 'groupCategory' => (int) $GroupCategory, 'groupYear' => (int) $GroupYear, 'remasterTitle' => $RemasterTitle, 'format' => $Format, 'encoding' => $Encoding, 'hasLog' => $HasLog == 1, 'hasCue' => $HasCue == 1, 'media' => $Media, 'scene' => $Scene == 1, 'year' => (int) $Year, 'tags' => $TagList, 'snatched' => (int) $Snatched, 'seeders' => (int) $Seeders, 'leechers' => (int) $Leechers, 'data' => (int) $Data, 'size' => (int) $Size);
    }
    return array('caption' => $Caption, 'tag' => $Tag, 'limit' => (int) $Limit, 'results' => $results);
}
コード例 #5
0
ファイル: details.php プロジェクト: Kufirc/Gazelle
} else {
    $RevisionID = 0;
}
include SERVER_ROOT . '/sections/torrents/functions.php';
$TorrentCache = get_group_info($GroupID, true, $RevisionID);
$TorrentDetails = $TorrentCache[0];
$TorrentList = $TorrentCache[1];
// Group details
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID, $GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes, $GroupFlags) = array_values($TorrentDetails);
$DisplayName = "<span dir=\"ltr\">{$GroupName}</span>";
$AltName = $GroupName;
// Goes in the alt text of the image
$Title = $GroupName;
// goes in <title>
$WikiBody = Text::full_format($WikiBody);
$Artists = Artists::get_artist($GroupID);
if ($Artists) {
    $DisplayName = Artists::display_artists($Artists, true) . "{$DisplayName}";
    $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
    $Title = $AltName;
}
if ($GroupYear > 0) {
    $DisplayName .= " [{$GroupYear}]";
    $AltName .= " [{$GroupYear}]";
    $Title .= " [{$GroupYear}]";
}
if ($GroupVanityHouse) {
    $DisplayName .= ' [Vanity House]';
    $AltName .= ' [Vanity House]';
}
if ($GroupCategoryID == 1) {
コード例 #6
0
ファイル: torrent.php プロジェクト: Kufirc/Gazelle
        }
    }
}
if ($TorrentID <= 0) {
    json_die("failure", "bad id parameter");
}
$TorrentCache = get_torrent_info($TorrentID, true, 0, true, true);
if (!$TorrentCache) {
    json_die("failure", "bad id parameter");
}
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";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo, 'tags' => $TagList);
$Torrent = $TorrentList[$TorrentID];
$Reports = Torrents::get_reports($TorrentID);
コード例 #7
0
ファイル: new_edit.php プロジェクト: Kufirc/Gazelle
                foreach ($Media as $Key => $Val) {
                    if (in_array($Val, $MediaTemp)) {
                        $MediaArray[] = $Key;
                    }
                }
            }
        }
        $Tags = implode(', ', $Request['Tags']);
    }
}
if ($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) {
    $DB->query("\n\t\tSELECT Name\n\t\tFROM artists_group\n\t\tWHERE artistid = " . $_GET['artistid'] . "\n\t\tLIMIT 1");
    list($ArtistName) = $DB->next_record();
    $ArtistForm = array(1 => array(array('name' => trim($ArtistName))), 2 => array(), 3 => array());
} elseif ($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
    $ArtistForm = Artists::get_artist($_GET['groupid']);
    $DB->query("\n\t\tSELECT\n\t\t\ttg.Name,\n\t\t\ttg.Year,\n\t\t\ttg.ReleaseType,\n\t\t\ttg.WikiImage,\n\t\t\tGROUP_CONCAT(t.Name SEPARATOR ', '),\n\t\t\ttg.CategoryID\n\t\tFROM torrents_group AS tg\n\t\t\tJOIN torrents_tags AS tt ON tt.GroupID = tg.ID\n\t\t\tJOIN tags AS t ON t.ID = tt.TagID\n\t\tWHERE tg.ID = " . $_GET['groupid']);
    if (list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) {
        $GroupID = trim($_REQUEST['groupid']);
    }
}
View::show_header($NewRequest ? 'Create a request' : 'Edit a request', 'requests,form_validate');
?>
<div class="thin">
	<div class="header">
		<h2><?php 
echo $NewRequest ? 'Create a request' : 'Edit a request';
?>
</h2>
	</div>
コード例 #8
0
ファイル: upload.php プロジェクト: Kufirc/Gazelle
			tg.Year,
			tg.RecordLabel,
			tg.CatalogueNumber,
			tg.WikiImage AS Image,
			tg.WikiBody AS GroupDescription,
			tg.ReleaseType,
			tg.VanityHouse
		FROM torrents_group AS tg
			LEFT JOIN torrents AS t ON t.GroupID = tg.ID
		WHERE tg.ID = ' . $_GET['groupid'] . '
		GROUP BY tg.ID');
    if ($DB->has_results()) {
        list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
        $UploadForm = $Categories[$Properties['CategoryID'] - 1];
        $Properties['CategoryName'] = $Categories[$Properties['CategoryID'] - 1];
        $Properties['Artists'] = Artists::get_artist($_GET['groupid']);
        $DB->query("\n\t\t\tSELECT\n\t\t\t\tGROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList\n\t\t\tFROM torrents_tags AS tt\n\t\t\t\tJOIN tags ON tags.ID = tt.TagID\n\t\t\tWHERE tt.GroupID = '{$_GET['groupid']}'");
        list($Properties['TagList']) = $DB->next_record();
    } else {
        unset($_GET['groupid']);
    }
    if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
        $Properties['RequestID'] = $_GET['requestid'];
    }
} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
    $DB->query('
		SELECT
			ID AS RequestID,
			CategoryID,
			Title AS Title,
			Year,
コード例 #9
0
ファイル: feat_album.php プロジェクト: Kufirc/Gazelle
if ($FeaturedAlbum === false) {
    $DB->query('
		SELECT
			fa.GroupID,
			tg.Name,
			tg.WikiImage,
			fa.ThreadID,
			fa.Title
		FROM featured_albums AS fa
			JOIN torrents_group AS tg ON tg.ID = fa.GroupID
		WHERE Ended = 0');
    $FeaturedAlbum = $DB->next_record();
    $Cache->cache_value('featured_album', $FeaturedAlbum, 0);
}
if (is_number($FeaturedAlbum['GroupID'])) {
    $Artists = Artists::get_artist($FeaturedAlbum['GroupID']);
    ?>
		<div class="box">
			<div class="head colhead_dark"><strong>Featured Album</strong></div>
			<div class="center pad">
				<?php 
    echo Artists::display_artists($Artists, true, true);
    ?>
<a href="torrents.php?id=<?php 
    echo $FeaturedAlbum['GroupID'];
    ?>
"><?php 
    echo $FeaturedAlbum['Name'];
    ?>
</a>
			</div>