mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-31 10:31:37 +00:00
Empty commit
This commit is contained in:
parent
a26061ad5c
commit
d3fa17b905
36
classes/class_lastfm.php
Normal file
36
classes/class_lastfm.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?
|
||||
define('LASTFM_API_URL', 'http://ws.audioscrobbler.com/2.0/?method=');
|
||||
|
||||
class LastFM {
|
||||
|
||||
public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
|
||||
global $Cache;
|
||||
$ArtistEvents = $Cache->get_value('artist_events_'.$ArtistID);
|
||||
if(empty($ArtistEvents)) {
|
||||
$ArtistEvents = self::lastfm_request("artist.getEvents", array("artist" => $Artist, "limit" => $Limit));
|
||||
$Cache->cache_value('artist_events_'.$ArtistID, $ArtistEvents, 432000);
|
||||
}
|
||||
return $ArtistEvents;
|
||||
}
|
||||
|
||||
private static function lastfm_request($Method, $Args) {
|
||||
$Url = LASTFM_API_URL.$Method;
|
||||
if(is_array($Args)) {
|
||||
foreach ($Args as $Key => $Value) {
|
||||
$Url .= "&".$Key."=".urlencode($Value);
|
||||
}
|
||||
$Url .= "&format=json&api_key=".LASTFM_KEY;
|
||||
|
||||
$Curl=curl_init();
|
||||
curl_setopt($Curl,CURLOPT_HEADER,0);
|
||||
curl_setopt($Curl,CURLOPT_CONNECTTIMEOUT,30);
|
||||
curl_setopt($Curl,CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($Curl,CURLOPT_URL,$Url);
|
||||
$Return=curl_exec($Curl);
|
||||
curl_close($Curl);
|
||||
return json_decode($Return, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ function show() {
|
||||
<span id="format_warning" class="important_text"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="bitrate_row">
|
||||
<td class="label">Bitrate</td>
|
||||
<td>
|
||||
<select id="bitrate" name="bitrate" onchange="Bitrate()">
|
||||
@ -457,6 +457,25 @@ function show() {
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if($this->NewTorrent) { ?>
|
||||
<tr id="upload_logs" class="hidden">
|
||||
<td class="label">
|
||||
Log Files
|
||||
</td>
|
||||
<td id="logfields">
|
||||
Check your log files here before uploading: <a href="logchecker.php" target="_blank">logchecker.php</a><br />
|
||||
<input id="file" type="file" name="logfiles[]" size="50" /> [<a href="javascript:;" onclick="AddLogField();">+</a>] [<a href="javascript:;" onclick="RemoveLogField();">-</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
} ?>
|
||||
<tr>
|
||||
<td class="label">Multi Format Uploader</td>
|
||||
<td><input type="button" value="+" id="add_format" /><input type="button" style="display: none" value="-" id="remove_format" /></td>
|
||||
</tr>
|
||||
<tr id="placeholder_row_top"></tr>
|
||||
<tr id="placeholder_row_bottom"></tr>
|
||||
<? if (check_perms('torrents_edit_vanityhouse') && $this->NewTorrent) { ?>
|
||||
<tr>
|
||||
<td class="label">Vanity House:</td>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?
|
||||
class Votes {
|
||||
/**
|
||||
* Generate voting links for torrent pages, etc.
|
||||
|
@ -134,6 +134,9 @@
|
||||
case 'Votes':
|
||||
$FileName = 'class_votes';
|
||||
break;
|
||||
case 'LastFM':
|
||||
$FileName = 'class_lastfm';
|
||||
break;
|
||||
default:
|
||||
die("Couldn't import class " . $ClassName);
|
||||
}
|
||||
|
@ -205,6 +205,15 @@ CREATE TABLE `comments_edits` (
|
||||
KEY `PostHistory` (`Page`,`PostID`,`EditTime`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `concerts` (
|
||||
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ConcertID` int(10) NOT NULL,
|
||||
`TopicID` int(10) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
KEY `ConcertID` (`ConcertID`),
|
||||
KEY `TopicID` (`TopicID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `do_not_upload` (
|
||||
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
|
@ -520,6 +520,9 @@ function compare($X, $Y){
|
||||
<a href="artist.php?action=history&artistid=<?=$ArtistID?>">[View history]</a>
|
||||
<a href="artist.php?id=<?=$ArtistID?>#info">[Info]</a>
|
||||
<a href="artist.php?id=<?=$ArtistID?>#artistcomments">[Comments]</a>
|
||||
<!-- <strip>-->
|
||||
<a href="artist.php?id=<?=$ArtistID?>#concerts">[Concerts]</a>
|
||||
<!-- </strip>-->
|
||||
<? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
|
||||
<a href="artist.php?action=delete&artistid=<?=$ArtistID?>&auth=<?=$LoggedUser['AuthKey']?>">[Delete]</a>
|
||||
<? }
|
||||
@ -902,6 +905,7 @@ function require(file, callback) {
|
||||
</div>
|
||||
<div id="body" class="body"><?=$Text->full_format($Body)?></div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<?php
|
||||
// --- Comments ---
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
enforce_login() is run here - the entire artist pages are off limits for
|
||||
non members.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
// Width and height of similar artist map
|
||||
@ -46,7 +45,9 @@
|
||||
}
|
||||
|
||||
$ArtistID = $_POST['artistid'];
|
||||
if(!$ArtistID) { error(404); }
|
||||
if (!$ArtistID) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM artist_comments AS ac WHERE ac.ArtistID='" . db_string($ArtistID) . "')/" . TORRENT_COMMENTS_PER_PAGE . ") AS Pages");
|
||||
list($Pages) = $DB->next_record();
|
||||
@ -78,16 +79,21 @@
|
||||
case 'take_warn' :
|
||||
include(SERVER_ROOT . '/sections/artist/take_warn.php');
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'concert_thread':
|
||||
include(SERVER_ROOT . '/sections/artist/concert_thread.php');
|
||||
break;
|
||||
case 'take_concert_thread':
|
||||
include(SERVER_ROOT . '/sections/artist/take_concert_thread.php');
|
||||
break;
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
} elseif (!empty($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
case 'get_post':
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); }
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("SELECT Body FROM artist_comments WHERE ID='" . db_string($_GET['post']) . "'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
echo trim($Body);
|
||||
@ -97,10 +103,14 @@
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); }
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
// Make sure they are moderators
|
||||
if (!check_perms('site_moderate_forums')) { error(403); }
|
||||
if (!check_perms('site_moderate_forums')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
@ -137,7 +147,9 @@
|
||||
$Text = new TEXT;
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_POST['post'] || !is_number($_POST['post'])) { error(0); }
|
||||
if (!$_POST['post'] || !is_number($_POST['post'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
// Mainly
|
||||
$DB->query("SELECT
|
||||
@ -152,8 +164,12 @@
|
||||
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_POST[post]");
|
||||
list($Page) = $DB->next_record();
|
||||
|
||||
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); }
|
||||
if ($DB->record_count()==0) { error(404); }
|
||||
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
||||
error(404);
|
||||
}
|
||||
if ($DB->record_count() == 0) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
// Perform the update
|
||||
$DB->query("UPDATE artist_comments SET
|
||||
@ -222,6 +238,7 @@
|
||||
break;
|
||||
default:
|
||||
error(0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!empty($_GET['id'])) {
|
||||
|
@ -56,3 +56,30 @@ function check_forumperm($ForumID, $Perm = 'Read') {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Function to get basic information on a forum
|
||||
// Uses class CACHE
|
||||
function get_forum_info($ForumID) {
|
||||
global $DB, $Cache;
|
||||
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
|
||||
if(!$Forum) {
|
||||
$DB->query("SELECT
|
||||
Name,
|
||||
MinClassRead,
|
||||
MinClassWrite,
|
||||
MinClassCreate,
|
||||
COUNT(forums_topics.ID) AS Topics
|
||||
FROM forums
|
||||
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
|
||||
WHERE forums.ID='$ForumID'
|
||||
GROUP BY ForumID");
|
||||
if($DB->record_count() == 0) {
|
||||
return false;
|
||||
}
|
||||
// Makes an array, with $Forum['Name'], etc.
|
||||
$Forum = $DB->next_record(MYSQLI_ASSOC);
|
||||
|
||||
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
|
||||
}
|
||||
return $Forum;
|
||||
}
|
@ -151,29 +151,3 @@
|
||||
require(SERVER_ROOT.'/sections/forums/main.php');
|
||||
}
|
||||
|
||||
// Function to get basic information on a forum
|
||||
// Uses class CACHE
|
||||
function get_forum_info($ForumID) {
|
||||
global $DB, $Cache;
|
||||
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
|
||||
if(!$Forum) {
|
||||
$DB->query("SELECT
|
||||
Name,
|
||||
MinClassRead,
|
||||
MinClassWrite,
|
||||
MinClassCreate,
|
||||
COUNT(forums_topics.ID) AS Topics
|
||||
FROM forums
|
||||
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
|
||||
WHERE forums.ID='$ForumID'
|
||||
GROUP BY ForumID");
|
||||
if($DB->record_count() == 0) {
|
||||
return false;
|
||||
}
|
||||
// Makes an array, with $Forum['Name'], etc.
|
||||
$Forum = $DB->next_record(MYSQLI_ASSOC);
|
||||
|
||||
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
|
||||
}
|
||||
return $Forum;
|
||||
}
|
||||
|
@ -149,9 +149,11 @@ function RemoveAnswerField() {
|
||||
<input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> />
|
||||
<label for="subscribebox">Subscribe to topic</label>
|
||||
</div>
|
||||
<div id="buttons" class="center">
|
||||
<input type="button" value="Preview" onclick="Newthread_Preview(1);" id="newthreadpreviewbutton" />
|
||||
<input type="button" value="Editor" onclick="Newthread_Preview(0);" id="newthreadeditbutton" class="hidden" />
|
||||
<input type="submit" id="submit_button" value="Create thread" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -133,11 +133,11 @@ function compare($X, $Y){
|
||||
?>
|
||||
<div class="box box_artists">
|
||||
<div class="head"><strong>Artists</strong>
|
||||
<?=(check_perms('torrents_edit')) ? '<span style="float:right;"><a onclick="ArtistManager(); return false;" href="#">[Edit]</a></span>' : ''?>
|
||||
<?=(check_perms('torrents_edit')) ? '<span style="float:right;" class="edit_artists"><a onclick="ArtistManager(); return false;" href="#">[Edit]</a></span>' : ''?>
|
||||
</div>
|
||||
<ul class="stats nobullet" id="artist_list">
|
||||
<? if(!empty($Artists[4]) && count($Artists[4]) > 0) {
|
||||
print ' <li class="artists_composers"><strong>Composers:</strong></li>';
|
||||
print ' <li class="artists_composers"><strong class="artists_label">Composers:</strong></li>';
|
||||
foreach($Artists[4] as $Artist) {
|
||||
?>
|
||||
<li class="artists_composers">
|
||||
@ -156,7 +156,7 @@ function compare($X, $Y){
|
||||
<? }
|
||||
}
|
||||
if (!empty($Artists[6]) && count($Artists[6]) > 0) {
|
||||
print ' <li class="artists_dj"><strong>DJ / Compiler:</strong></li>';
|
||||
print ' <li class="artists_dj"><strong class="artists_label">DJ / Compiler:</strong></li>';
|
||||
foreach($Artists[6] as $Artist) {
|
||||
?>
|
||||
<li class="artists_dj">
|
||||
@ -176,9 +176,9 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
if ((count($Artists[6]) > 0) && (count($Artists[1]) > 0)) {
|
||||
print ' <li class="artists_main"><strong>Artists:</strong></li>';
|
||||
print ' <li class="artists_main"><strong class="artists_label">Artists:</strong></li>';
|
||||
} elseif ((count($Artists[4]) > 0) && (count($Artists[1]) > 0)) {
|
||||
print ' <li class="artists_main"><strong>Performers:</strong></li>';
|
||||
print ' <li class="artists_main"><strong class="artists_label">Performers:</strong></li>';
|
||||
}
|
||||
foreach($Artists[1] as $Artist) {
|
||||
?>
|
||||
@ -197,7 +197,7 @@ function compare($X, $Y){
|
||||
<?
|
||||
}
|
||||
if(!empty($Artists[2]) && count($Artists[2]) > 0) {
|
||||
print ' <li class="artists_with"><strong>With:</strong></li>';
|
||||
print ' <li class="artists_with"><strong class="artists_label">With:</strong></li>';
|
||||
foreach($Artists[2] as $Artist) {
|
||||
?>
|
||||
<li class="artist_guest">
|
||||
@ -217,7 +217,7 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
if(!empty($Artists[5]) && count($Artists[5]) > 0) {
|
||||
print ' <li class="artists_conductors"><strong>Conducted by:</strong></li>';
|
||||
print ' <li class="artists_conductors"><strong class="artists_label">Conducted by:</strong></li>';
|
||||
foreach($Artists[5] as $Artist) {
|
||||
?>
|
||||
<li class="artists_conductors">
|
||||
@ -237,7 +237,7 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
if (!empty($Artists[3]) && count($Artists[3]) > 0) {
|
||||
print ' <li class="artists_remix"><strong>Remixed by:</strong></li>';
|
||||
print ' <li class="artists_remix"><strong class="artists_label">Remixed by:</strong></li>';
|
||||
foreach($Artists[3] as $Artist) {
|
||||
?>
|
||||
<li class="artists_remix">
|
||||
@ -257,7 +257,7 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
if (!empty($Artists[7]) && count($Artists[7]) > 0) {
|
||||
print ' <li class="artists_producer"><strong>Produced by:</strong></li>';
|
||||
print ' <li class="artists_producer"><strong class="artists_label">Produced by:</strong></li>';
|
||||
foreach($Artists[7] as $Artist) {
|
||||
?>
|
||||
<li class="artists_producer">
|
||||
@ -282,7 +282,7 @@ function compare($X, $Y){
|
||||
<?
|
||||
if(check_perms('torrents_add_artist')) { ?>
|
||||
<div class="box box_addartists">
|
||||
<div class="head"><strong>Add artist</strong><span style="float:right;"><a onclick="AddArtistField(); return false;" href="#">[+]</a></span></div>
|
||||
<div class="head"><strong>Add artist</strong><span style="float:right;" class="additional_add_artist"><a onclick="AddArtistField(); return false;" href="#">[+]</a></span></div>
|
||||
<div class="body">
|
||||
<form class="add_form" name="artists" action="torrents.php" method="post">
|
||||
<div id="AddArtists">
|
||||
@ -321,12 +321,12 @@ function compare($X, $Y){
|
||||
?>
|
||||
<li>
|
||||
<a href="torrents.php?taglist=<?=$Tag['name']?>" style="float:left; display:block;"><?=display_str($Tag['name'])?></a>
|
||||
<div style="float:right; display:block; letter-spacing: -1px;">
|
||||
<a href="torrents.php?action=vote_tag&way=down&groupid=<?=$GroupID?>&tagid=<?=$Tag['id']?>&auth=<?=$LoggedUser['AuthKey']?>" style="font-family: monospace;" title="Vote this tag down">[-]</a>
|
||||
<div style="float:right; display:block; letter-spacing: -1px;" class="edit_tags_votes">
|
||||
<a href="torrents.php?action=vote_tag&way=down&groupid=<?=$GroupID?>&tagid=<?=$Tag['id']?>&auth=<?=$LoggedUser['AuthKey']?>" style="font-family: monospace;" title="Vote this tag down" class="vote_tag_down">[-]</a>
|
||||
<?=$Tag['score']?>
|
||||
<a href="torrents.php?action=vote_tag&way=up&groupid=<?=$GroupID?>&tagid=<?=$Tag['id']?>&auth=<?=$LoggedUser['AuthKey']?>" style="font-family: monospace;" title="Vote this tag up">[+]</a>
|
||||
<a href="torrents.php?action=vote_tag&way=up&groupid=<?=$GroupID?>&tagid=<?=$Tag['id']?>&auth=<?=$LoggedUser['AuthKey']?>" style="font-family: monospace;" title="Vote this tag up" class="vote_tag_up">[+]</a>
|
||||
<? if(check_perms('users_warn')){ ?>
|
||||
<a href="user.php?id=<?=$Tag['userid']?>" title="View the profile of the user that added this tag">[U]</a>
|
||||
<a href="user.php?id=<?=$Tag['userid']?>" title="View the profile of the user that added this tag" class="view_tag_user">[U]</a>
|
||||
<? } ?>
|
||||
<? if(check_perms('site_delete_tag')){ ?>
|
||||
<span class="remove remove_tag"><a href="torrents.php?action=delete_tag&groupid=<?=$GroupID?>&tagid=<?=$Tag['id']?>&auth=<?=$LoggedUser['AuthKey']?>" title="Remove tag">[X]</a></span>
|
||||
|
@ -8,7 +8,7 @@
|
||||
$Voted = isset($UserVotes[$GroupID])?$UserVotes[$GroupID]['Type']:false;
|
||||
?>
|
||||
<div class="box" id="votes">
|
||||
<div class="head"><strong>Album Votes</strong></div>
|
||||
<div class="head"><strong>Album votes</strong></div>
|
||||
<div class="album_votes body">
|
||||
This has <span id="upvotes" class="favoritecount"><?=$UpVotes?></span> <?=(($UpVotes==1)?'upvote':'upvotes')?> out of <span id="totalvotes" class="favoritecount"><?=$TotalVotes?></span> total<span id="upvoted" <?=($Voted!='Up'?'class="hidden"':'')?>>, including your upvote</span><span id="downvoted" <?=($Voted!='Down'?'class="hidden"':'')?>>, including your downvote</span>.
|
||||
<br /><br />
|
||||
|
74
sections/upload/generate_extra_torrents.php
Normal file
74
sections/upload/generate_extra_torrents.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?
|
||||
$ExtraTorrentsInsert = array();
|
||||
foreach ($ExtraTorrents as $ExtraTorrent) {
|
||||
$Name = $ExtraTorrent['Name'];
|
||||
$ExtraTorrentsInsert[$Name] = array();
|
||||
$ExtraTorrentsInsert[$Name] = $ExtraTorrent;
|
||||
|
||||
$ExtraFile = fopen($Name, 'rb'); // open file for reading
|
||||
$ExtraContents = fread($ExtraFile, 10000000);
|
||||
$ExtraTor = new TORRENT($ExtraContents); // New TORRENT object
|
||||
|
||||
// Remove uploader's passkey from the torrent.
|
||||
// We put the downloader's passkey in on download, so it doesn't matter what's in there now,
|
||||
// so long as it's not useful to any leet hax0rs looking in an unprotected /torrents/ directory
|
||||
$ExtraTor->set_announce_url('ANNOUNCE_URL'); // We just use the string "ANNOUNCE_URL"
|
||||
|
||||
// $ExtraPrivate is true or false. true means that the uploaded torrent was private, false means that it wasn't.
|
||||
$ExtraPrivate = $ExtraTor->make_private();
|
||||
// The torrent is now private.
|
||||
|
||||
// File list and size
|
||||
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
|
||||
$ExtraTorrentsInsert[$Name]['TotalSize'] = $ExtraTotalSize;
|
||||
$ExtraDirName = $ExtraTor->get_name();
|
||||
|
||||
$ExtraTmpFileList = array();
|
||||
|
||||
foreach ($ExtraFileList as $ExtraFile) {
|
||||
list($ExtraSize, $ExtraName) = $ExtraFile;
|
||||
|
||||
check_file($ExtraType, $ExtraName);
|
||||
|
||||
// Make sure the filename is not too long
|
||||
if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
|
||||
$Err = 'The torrent contained one or more files with too long a name (' . $ExtraName . ')';
|
||||
}
|
||||
|
||||
// Add file and size to array
|
||||
$ExtraTmpFileList[] = $ExtraName . '{{{' . $ExtraSize . '}}}'; // Name {{{Size}}}
|
||||
}
|
||||
|
||||
// To be stored in the database
|
||||
$ExtraFilePath = isset($ExtraTor->Val['info']->Val['files']) ? db_string(Format::make_utf8($ExtraDirName)) : "";
|
||||
$ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath;
|
||||
// Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}}
|
||||
$ExtraFileString = "'" . db_string(Format::make_utf8(implode('|||', $ExtraTmpFileList))) . "'";
|
||||
$ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString;
|
||||
// Number of files described in torrent
|
||||
$ExtraNumFiles = count($ExtraFileList);
|
||||
$ExtraTorrentsInsert[$Name]['NumFiles'] = $ExtraNumFiles;
|
||||
// The string that will make up the final torrent file
|
||||
$ExtraTorrentText = $ExtraTor->enc();
|
||||
|
||||
|
||||
// Infohash
|
||||
|
||||
$ExtraInfoHash = pack("H*", sha1($ExtraTor->Val['info']->enc()));
|
||||
$ExtraTorrentsInsert[$Name]['InfoHash'] = $ExtraInfoHash;
|
||||
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ExtraInfoHash) . "'");
|
||||
if ($DB->record_count() > 0) {
|
||||
list($ExtraID) = $DB->next_record();
|
||||
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = " . $ExtraID);
|
||||
if ($DB->record_count() > 0) {
|
||||
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">The exact same torrent file already exists on the site!</a>';
|
||||
} else {
|
||||
//One of the lost torrents.
|
||||
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '" . db_string($ExtraTor->dump_data()) . "')");
|
||||
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">Thankyou for fixing this torrent</a>';
|
||||
}
|
||||
}
|
||||
$ExtraTorrentsInsert[$Name]['Tor'] = $ExtraTor;
|
||||
}
|
||||
|
||||
?>
|
43
sections/upload/get_extra_torrents.php
Normal file
43
sections/upload/get_extra_torrents.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?
|
||||
//extra torrent files
|
||||
$ExtraTorrents = array();
|
||||
$DupeNames = array();
|
||||
$DupeNames[] = $_FILES['file_input']['name'];
|
||||
|
||||
if (isset($_POST['extra_format']) && isset($_POST['extra_bitrate'])) {
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
if (isset($_FILES['extra_file_' . $i])) {
|
||||
$ExtraFile = $_FILES['extra_file_' . $i];
|
||||
$ExtraTorrentName = $ExtraFile['tmp_name'];
|
||||
if (!is_uploaded_file($ExtraTorrentName) || !filesize($ExtraTorrentName)) {
|
||||
$Err = 'No extra torrent file uploaded, or file is empty.';
|
||||
} else if (substr(strtolower($ExtraFile['name']), strlen($ExtraFile['name']) - strlen(".torrent")) !== ".torrent") {
|
||||
$Err = "You seem to have put something other than an extra torrent file into the upload field. (" . $ExtraFile['name'] . ").";
|
||||
} else if (in_array($ExtraFile['name'], $DupeNames)) {
|
||||
$Err = "One or more torrents has been entered into the form twice.";
|
||||
} else {
|
||||
$j = $i - 1;
|
||||
$ExtraTorrents[$ExtraTorrentName]['Name'] = $ExtraTorrentName;
|
||||
$ExtraFormat = $_POST['extra_format'][$j];
|
||||
if (empty($ExtraFormat)) {
|
||||
$Err = "Missing format for extra torrent.";
|
||||
break;
|
||||
} else {
|
||||
$ExtraTorrents[$ExtraTorrentName]['Format'] = "'" . db_string(trim($ExtraFormat)) . "'";
|
||||
}
|
||||
$ExtraBitrate = $_POST['extra_bitrate'][$j];
|
||||
if (empty($ExtraBitrate)) {
|
||||
$Err = "Missing bitrate for extra torrent.";
|
||||
break;
|
||||
} else {
|
||||
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = "'" . db_string(trim($ExtraBitrate)) . "'";
|
||||
}
|
||||
$ExtraReleaseDescription = $_POST['extra_release_desc'][$j];
|
||||
$ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = "'" . db_string(trim($ExtraReleaseDescription)) . "'";
|
||||
$DupeNames[] = $ExtraFile['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
35
sections/upload/insert_extra_torrents.php
Normal file
35
sections/upload/insert_extra_torrents.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?
|
||||
foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
|
||||
$ExtraHasLog = "'0'";
|
||||
$ExtraHasCue = "'0'";
|
||||
|
||||
// Torrent
|
||||
$DB->query("
|
||||
INSERT INTO torrents
|
||||
(GroupID, UserID, Media, Format, Encoding,
|
||||
Remastered, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber,
|
||||
HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
|
||||
Description, LogScore, FreeTorrent, FreeLeechType)
|
||||
VALUES
|
||||
(" . $GroupID . ", " . $LoggedUser['ID'] . ", " . $T['Media'] . ", " . $ExtraTorrent['Format'] . ", " . $ExtraTorrent['Encoding'] . ",
|
||||
" . $T['Remastered'] . ", " . $T['RemasterYear'] . ", " . $T['RemasterTitle'] . ", " . $T['RemasterRecordLabel'] . ", " . $T['RemasterCatalogueNumber'] . ", " . $ExtraHasLog . ", " . $ExtraHasCue . ", '" . db_string($ExtraTorrent['InfoHash']) . "', " . $ExtraTorrent['NumFiles'] . ", " . $ExtraTorrent['FileString'] . ", '" . $ExtraTorrent['FilePath'] . "', " . $ExtraTorrent['TotalSize'] . ", '" . sqltime() . "',
|
||||
" . $ExtraTorrent['TorrentDescription'] . ", '" . (($HasLog == "'1'") ? $LogScoreAverage : 0) . "', '" . $T['FreeLeech'] . "', '" . $T['FreeLeechType'] . "')");
|
||||
|
||||
$Cache->increment('stats_torrent_count');
|
||||
$ExtraTorrentID = $DB->inserted_id();
|
||||
|
||||
Tracker::update_tracker('add_torrent', array('id' => $ExtraTorrentID, 'info_hash' => rawurlencode($ExtraTorrent['InfoHash']), 'freetorrent' => $T['FreeLeech']));
|
||||
|
||||
|
||||
|
||||
//******************************************************************************//
|
||||
//--------------- Write torrent file -------------------------------------------//
|
||||
|
||||
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraTorrentID, '" . db_string($ExtraTorrent['Tor']->dump_data()) . "')");
|
||||
|
||||
Misc::write_log("Torrent $ExtraTorrentID ($LogName) (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . " MB) was uploaded by " . $LoggedUser['Username']);
|
||||
Torrents::write_group_log($GroupID, $ExtraTorrentID, $LoggedUser['ID'], "uploaded (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . " MB)", 0);
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
}
|
||||
?>
|
@ -10,7 +10,7 @@
|
||||
//*********************************************************************//
|
||||
|
||||
ini_set('max_file_uploads','100');
|
||||
View::show_header('Upload','upload,jquery,valid_tags,musicbrainz');
|
||||
View::show_header('Upload','upload,jquery,valid_tags,musicbrainz,multiformat_uploader');
|
||||
|
||||
if(empty($Properties) && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
|
||||
$DB->query("SELECT
|
||||
|
@ -247,6 +247,10 @@
|
||||
$Err = "You seem to have put something other than a torrent file into the upload field. (".$File['name'].").";
|
||||
}
|
||||
|
||||
if($Type == 'Music') {
|
||||
include(SERVER_ROOT.'/sections/upload/get_extra_torrents.php');
|
||||
}
|
||||
|
||||
$LogScoreAverage = 0;
|
||||
$SendPM = 0;
|
||||
$LogMessage = "";
|
||||
@ -415,7 +419,9 @@
|
||||
$Err = '<a href="torrents.php?torrentid='.$ID.'">Thankyou for fixing this torrent</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if($Type == 'Music') {
|
||||
include(SERVER_ROOT.'/sections/upload/generate_extra_torrents.php');
|
||||
}
|
||||
|
||||
if(!empty($Err)) { // Show the upload form, with the data the user entered
|
||||
$UploadForm=$Type;
|
||||
@ -637,6 +643,7 @@
|
||||
$Cache->increment('stats_torrent_count');
|
||||
$TorrentID = $DB->inserted_id();
|
||||
|
||||
|
||||
Tracker::update_tracker('add_torrent', array('id' => $TorrentID, 'info_hash' => rawurlencode($InfoHash), 'freetorrent' => $T['FreeLeech']));
|
||||
|
||||
|
||||
@ -651,6 +658,11 @@
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
if($Type == 'Music') {
|
||||
include(SERVER_ROOT.'/sections/upload/insert_extra_torrents.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
6
static/functions/jquery.js
vendored
6
static/functions/jquery.js
vendored
File diff suppressed because one or more lines are too long
114
static/functions/multiformat_uploader.js
Normal file
114
static/functions/multiformat_uploader.js
Normal file
@ -0,0 +1,114 @@
|
||||
(function ($) {
|
||||
var count = 1;
|
||||
var MAX_EXTRAS = 5;
|
||||
var FORMATS = [ 'MP3', 'FLAC', 'Ogg Vorbis', 'AAC', 'AC3', 'DTS' ];
|
||||
var BITRATES = [ '192', 'APS (VBR)', 'V2 (VBR)', 'V1 (VBR)', '256', 'APX (VBR)', 'V0 (VBR)', 'q8.x (VBR)', '320', 'Lossless', '24bit Lossless'];
|
||||
var filenames = new Array();
|
||||
$(document).ready(function () {
|
||||
$("#add_format").click(function () {
|
||||
createRow();
|
||||
});
|
||||
|
||||
$("#remove_format").click(function () {
|
||||
removeRow();
|
||||
});
|
||||
});
|
||||
|
||||
function createRow() {
|
||||
if (count >= 1) {
|
||||
$("#remove_format").show();
|
||||
}
|
||||
if (count == MAX_EXTRAS) {
|
||||
$("#add_format").hide();
|
||||
}
|
||||
var after = count > 1 ? "#extra_format_row_" + (count - 1) : '#placeholder_row_top';
|
||||
var master = $(document.createElement("tr")).attr({
|
||||
id:'extra_format_row_' + count
|
||||
}).insertAfter(after);
|
||||
|
||||
$(document.createElement("td")).addClass('label').html("Extra Format " + count).appendTo(master);
|
||||
var row = $(document.createElement("td")).appendTo(master);
|
||||
addFile(row);
|
||||
addFormats(row);
|
||||
addBitrates(row);
|
||||
addReleaseDescription(row);
|
||||
count++;
|
||||
}
|
||||
|
||||
function addFile(row) {
|
||||
var id = count;
|
||||
$(document.createElement("input")).attr({
|
||||
id:"extra_file_" + count,
|
||||
type:'file',
|
||||
name:"extra_file_" + count,
|
||||
size:'30'
|
||||
}).appendTo(row);
|
||||
|
||||
}
|
||||
|
||||
function addFormats(row) {
|
||||
$(document.createElement("span")).html(" Format: ").appendTo(row);
|
||||
$(document.createElement("select")).attr({
|
||||
id:"format_" + count,
|
||||
name:'extra_format[]'
|
||||
}).html(createDropDownOptions(FORMATS)).appendTo(row);
|
||||
}
|
||||
|
||||
function addBitrates(row) {
|
||||
$(document.createElement("span")).html(" Bitrate: ").appendTo(row);
|
||||
$(document.createElement("select")).attr({
|
||||
id:"bitrate_" + count,
|
||||
name:'extra_bitrate[]'
|
||||
}).html(createDropDownOptions(BITRATES)).appendTo(row);
|
||||
/*change(
|
||||
function () {
|
||||
var id = $(this).attr('id');
|
||||
if ($(this).val() == 'Other') {
|
||||
$(this).after(
|
||||
'<span id="other_bitrate_span_' + id
|
||||
+ '" class=""> <input type="text" name="extra_other_bitrate[]" size="5" id="other_bitrate_' + id
|
||||
+ '"><input type="checkbox" id="vbr_' + id + '" name="extra_vbr[]"><label for="vbr_' + id
|
||||
+ '"> (VBR)</label> </span>');
|
||||
} else {
|
||||
$("#other_bitrate_span_" + id).remove();
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
function addReleaseDescription(row) {
|
||||
var id = count;
|
||||
var desc_row = $(document.createElement("tr")).attr({ id:"desc_row"}).css('cursor', 'pointer').appendTo(row);
|
||||
$(document.createElement("a")).html(" [Add Release Description]").css('marginLeft', '-5px').appendTo(desc_row).click(function () {
|
||||
$("#extra_release_desc_" + id).toggle(300);
|
||||
});
|
||||
$(document.createElement("textarea")).attr({
|
||||
id:"extra_release_desc_" + id,
|
||||
name:"extra_release_desc[]",
|
||||
cols:60,
|
||||
rows:4,
|
||||
style:'display:none; margin-left: 5px; margin-top: 10px; margin-bottom: 10px;'
|
||||
}).appendTo(desc_row);
|
||||
}
|
||||
|
||||
function createDropDownOptions(array) {
|
||||
s = "<option value='0'>---</option>";
|
||||
for (var i in array) {
|
||||
s += ("<option value=\"" + array[i] + "\">" + array[i] + "</option>");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function removeRow() {
|
||||
if (count > 1) {
|
||||
$("#placeholder_row_bottom").prev().remove();
|
||||
$("#add_format").show();
|
||||
filenames.pop();
|
||||
count--;
|
||||
}
|
||||
if (count == 1) {
|
||||
$("#remove_format").hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})(jQuery);
|
@ -12,6 +12,7 @@ function Remaster() {
|
||||
} else {
|
||||
$('#remaster_true').hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Format() {
|
||||
@ -87,6 +88,28 @@ function RemoveLogField() {
|
||||
LogCount--;
|
||||
}
|
||||
|
||||
var ExtraLogCount = 1;
|
||||
|
||||
function AddExtraLogField(id) {
|
||||
if(LogCount >= 200) { return; }
|
||||
var LogField = document.createElement("input");
|
||||
LogField.type = "file";
|
||||
LogField.id = "file_" + id;
|
||||
LogField.name = "logfiles_" + id + "[]";
|
||||
LogField.size = 50;
|
||||
var x = $('#logfields_' + id).raw();
|
||||
x.appendChild(document.createElement("br"));
|
||||
x.appendChild(LogField);
|
||||
LogCount++;
|
||||
}
|
||||
|
||||
function RemoveLogField() {
|
||||
if(LogCount == 1) { return; }
|
||||
var x = $('#logfields').raw();
|
||||
for (i=0; i<2; i++) { x.removeChild(x.lastChild); }
|
||||
LogCount--;
|
||||
}
|
||||
|
||||
var FormatCount = 0;
|
||||
|
||||
function AddFormat() {
|
||||
@ -113,9 +136,6 @@ function AddFormat() {
|
||||
NewRow.appendChild(NewCell1);
|
||||
NewRow.appendChild(NewCell2);
|
||||
|
||||
var x = $('#tags_row').raw();
|
||||
x.parentNode.insertBefore(NewRow, x);
|
||||
|
||||
NewRow = document.createElement("tr");
|
||||
NewRow.id = "new_format_row"+FormatCount;
|
||||
NewRow.setAttribute("style","border-left-width: 5px; border-right-width: 5px;");
|
||||
@ -125,12 +145,12 @@ function AddFormat() {
|
||||
|
||||
NewCell2 = document.createElement("td");
|
||||
tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
|
||||
|
||||
var formats=["Saab","Volvo","BMW"];
|
||||
for(var i in formats) {
|
||||
tmp += "<option value='"+formats[i]+"'>"+formats[i]+"</option>\n";
|
||||
}
|
||||
tmp += "</select>";
|
||||
|
||||
var bitrates=["1","2","3"];
|
||||
tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
|
||||
for(var i in bitrates) {
|
||||
tmp += "<option value='"+bitrates[i]+"'>"+bitrates[i]+"</option>\n";
|
||||
@ -141,8 +161,6 @@ function AddFormat() {
|
||||
NewRow.appendChild(NewCell1);
|
||||
NewRow.appendChild(NewCell2);
|
||||
|
||||
x = $('#tags_row').raw();
|
||||
x.parentNode.insertBefore(NewRow, x);
|
||||
|
||||
NewRow = document.createElement("tr");
|
||||
NewRow.id = "new_description_row"+FormatCount;
|
||||
@ -156,9 +174,6 @@ function AddFormat() {
|
||||
|
||||
NewRow.appendChild(NewCell1);
|
||||
NewRow.appendChild(NewCell2);
|
||||
|
||||
x = $('#tags_row').raw();
|
||||
x.parentNode.insertBefore(NewRow, x);
|
||||
}
|
||||
|
||||
function RemoveFormat() {
|
||||
@ -281,7 +296,6 @@ function ToggleUnknown() {
|
||||
|
||||
function GroupRemaster() {
|
||||
var remasters = json.decode($('#json_remasters').raw().value);
|
||||
|
||||
var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value;
|
||||
if(index != "") {
|
||||
$('#remaster_year').raw().value = remasters[index][1];
|
||||
@ -290,3 +304,4 @@ function GroupRemaster() {
|
||||
$('#remaster_catalogue_number').raw().value = remasters[index][4];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1703,11 +1703,12 @@ div.box[style=""] .head{
|
||||
#forums img[width="500"] {width:100%;height:100%;border-right:5px #007DC6 solid;cursor:pointer;margin:2px auto;}
|
||||
|
||||
.forum_post ul, .main_column .box ul {
|
||||
margin: 0 0 -7px 10px;
|
||||
margin: 0 0 -0px 10px;
|
||||
list-style-position: inside;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
|
||||
/* update - 07/12/2009 */
|
||||
|
||||
.edition_info {
|
||||
@ -1727,6 +1728,7 @@ div.box[style=""] .head{
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
#inbox #searchbox {
|
||||
margin: 0 auto 20px auto;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user