Gazelle/sections/torrents/edit.php

225 lines
6.4 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-02-07 08:00:47 +00:00
//**********************************************************************//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Edit form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// This page relies on the TORRENT_FORM class. All it does is call //
// the necessary functions. //
//----------------------------------------------------------------------//
// At the bottom, there are grouping functions which are off limits to //
// most members. //
//**********************************************************************//
2011-03-28 14:21:28 +00:00
require(SERVER_ROOT.'/classes/class_torrent_form.php');
2013-03-02 08:00:34 +00:00
if (!is_number($_GET['id']) || !$_GET['id']) {
error(0);
}
2011-03-28 14:21:28 +00:00
$TorrentID = $_GET['id'];
2013-02-22 08:00:24 +00:00
$DB->query("SELECT
t.Media,
t.Format,
t.Encoding AS Bitrate,
t.RemasterYear,
t.Remastered,
t.RemasterTitle,
2011-03-28 14:21:28 +00:00
t.RemasterCatalogueNumber,
t.RemasterRecordLabel,
2013-02-22 08:00:24 +00:00
t.Scene,
t.FreeTorrent,
t.FreeLeechType,
t.Dupable,
t.DupeReason,
t.Description AS TorrentDescription,
2011-03-28 14:21:28 +00:00
tg.CategoryID,
tg.Name AS Title,
tg.Year,
tg.ArtistID,
tg.VanityHouse,
2011-03-28 14:21:28 +00:00
ag.Name AS ArtistName,
t.GroupID,
t.UserID,
t.HasLog,
t.HasCue,
t.LogScore,
bt.TorrentID AS BadTags,
bf.TorrentID AS BadFolders,
bfi.TorrentID AS BadFiles,
ca.TorrentID AS CassetteApproved,
2012-05-31 08:00:14 +00:00
lma.TorrentID AS LossymasterApproved,
lwa.TorrentID AS LossywebApproved
2013-02-22 08:00:24 +00:00
FROM torrents AS t
2011-03-28 14:21:28 +00:00
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
LEFT JOIN torrents_bad_tags AS bt ON bt.TorrentID=t.ID
LEFT JOIN torrents_bad_folders AS bf ON bf.TorrentID=t.ID
LEFT JOIN torrents_bad_files AS bfi ON bfi.TorrentID=t.ID
LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID=t.ID
LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID=t.ID
2012-05-31 08:00:14 +00:00
LEFT JOIN torrents_lossyweb_approved AS lwa ON lwa.TorrentID=t.id
2011-03-28 14:21:28 +00:00
WHERE t.ID='$TorrentID'");
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
2013-03-02 08:00:34 +00:00
if (!$Properties) {
error(404);
}
2011-03-28 14:21:28 +00:00
$UploadForm = $Categories[$Properties['CategoryID']-1];
2013-03-02 08:00:34 +00:00
if (($LoggedUser['ID'] != $Properties['UserID'] && !check_perms('torrents_edit')) || $LoggedUser['DisableWiki']) {
2011-03-28 14:21:28 +00:00
error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Edit torrent', 'upload');
2011-03-28 14:21:28 +00:00
2013-03-02 08:00:34 +00:00
if (!($Properties['Remastered'] && !$Properties['RemasterYear']) || check_perms('edit_unknowns')) {
2011-03-28 14:21:28 +00:00
$TorrentForm = new TORRENT_FORM($Properties, $Err, false);
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$TorrentForm->head();
switch ($UploadForm) {
case 'Music':
$TorrentForm->music_form('');
break;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
case 'Audiobooks':
case 'Comedy':
$TorrentForm->audiobook_form();
break;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
case 'Applications':
case 'Comics':
case 'E-Books':
case 'E-Learning Videos':
$TorrentForm->simple_form($Properties['CategoryID']);
break;
default:
$TorrentForm->music_form('');
}
$TorrentForm->foot();
}
2013-03-02 08:00:34 +00:00
if (check_perms('torrents_edit') && $Properties['CategoryID'] == 1) {
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2013-02-23 08:00:22 +00:00
<h2>Change group</h2>
2012-10-07 08:00:25 +00:00
<form class="edit_form" name="torrent_group" action="torrents.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="editgroupid" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" name="oldgroupid" value="<?=$Properties['GroupID']?>" />
2012-09-01 08:00:24 +00:00
<table class="layout">
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Group ID</td>
<td>
2013-02-23 08:00:22 +00:00
<input type="text" name="groupid" value="<?=$Properties['GroupID']?>" size="10" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
<td colspan="2" class="center">
2013-02-23 08:00:22 +00:00
<input type="submit" value="Change group ID" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
</table>
</form>
<h2>Split off into new group</h2>
2012-09-15 08:00:25 +00:00
<form class="split_form" name="torrent_group" action="torrents.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="newgroup" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" name="oldgroupid" value="<?=$Properties['GroupID']?>" />
2012-09-01 08:00:24 +00:00
<table class="layout">
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Artist</td>
<td>
2013-02-23 08:00:22 +00:00
<input type="text" name="artist" value="<?=$Properties['ArtistName']?>" size="50" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
<td class="label">Title</td>
<td>
2013-02-23 08:00:22 +00:00
<input type="text" name="title" value="<?=$Properties['Title']?>" size="50" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
<td class="label">Year</td>
<td>
2013-02-23 08:00:22 +00:00
<input type="text" name="year" value="<?=$Properties['Year']?>" size="10" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
<td colspan="2" class="center">
2013-02-23 08:00:22 +00:00
<input type="submit" value="Split into new group" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
</table>
</form>
<br />
2013-03-02 08:00:34 +00:00
<?
}
if (check_perms('users_mod')) { ?>
<h2>Change category</h2>
<form action="torrents.php" method="post">
<input type="hidden" name="action" value="changecategory" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" name="oldgroupid" value="<?=$Properties['GroupID']?>" />
<input type="hidden" name="oldartistid" value="<?=$Properties['ArtistID']?>" />
<input type="hidden" name="oldcategoryid" value="<?=$Properties['CategoryID']?>" />
<table>
<tr>
<td class="label">Change category</td>
<td>
<select id="newcategoryid" name="newcategoryid" onchange="ChangeCategory(this.value);">
<? foreach ($Categories as $CatID => $CatName) { ?>
<option value="<?=$CatID+1?>"<?Format::selected('CategoryID',$CatID+1,'selected',$Properties)?>><?=$CatName?></option>
<? } ?>
</select>
</td>
<tr id="split_releasetype">
<td class="label">Release type</td>
<td>
<select name="releasetype">
<? foreach ($ReleaseTypes as $RTID => $ReleaseType) { ?>
<option value="<?=$RTID?>"><?=$ReleaseType?></option>
<? } ?>
</select>
</td>
</tr>
<tr id="split_artist">
<td class="label">Artist</td>
<td>
<input type="text" name="artist" value="<?=$Properties['ArtistName']?>" size="50" />
</td>
</tr>
<tr id="split_title">
<td class="label">Title</td>
<td>
<input type="text" name="title" value="<?=$Properties['Title']?>" size="50" />
</td>
</tr>
<tr id="split_year">
<td class="label">Year</td>
<td>
<input type="text" name="year" value="<?=$Properties['Year']?>" size="10" />
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input type="submit" value="Change category" />
</td>
</tr>
</table>
<script type="text/javascript">ChangeCategory($('#newcategoryid').raw().value);</script>
</form>
<?
}
?>
2011-03-28 14:21:28 +00:00
</div>
<?
} // if check_perms('torrents_edit')
2012-10-11 08:00:15 +00:00
View::show_footer(); ?>