Gazelle/sections/torrents/editgroup.php

183 lines
6.0 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
/************************************************************************
2013-06-20 08:01:00 +00:00
||------------|| Edit torrent group wiki page ||-----------------------||
2011-03-28 14:21:28 +00:00
2013-02-22 08:00:24 +00:00
This page is the page that is displayed when someone feels like editing
2013-06-20 08:01:00 +00:00
a torrent group's wiki page.
2011-03-28 14:21:28 +00:00
2013-06-20 08:01:00 +00:00
It is called when $_GET['action'] == 'edit'. $_GET['groupid'] is the
ID of the torrent group and must be set.
2011-03-28 14:21:28 +00:00
2013-06-20 08:01:00 +00:00
The page inserts a new revision into the wiki_torrents table, and clears
the cache for the torrent group page.
2011-03-28 14:21:28 +00:00
************************************************************************/
$GroupID = $_GET['groupid'];
2013-05-01 08:00:16 +00:00
if (!is_number($GroupID) || !$GroupID) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-06-20 08:01:00 +00:00
// Get the torrent group name and the body of the last revision
2013-06-19 08:01:09 +00:00
$DB->query("
SELECT
tg.Name,
wt.Image,
wt.Body,
tg.WikiImage,
tg.WikiBody,
tg.Year,
tg.RecordLabel,
tg.CatalogueNumber,
tg.ReleaseType,
tg.CategoryID,
tg.VanityHouse
2011-03-28 14:21:28 +00:00
FROM torrents_group AS tg
2013-06-19 08:01:09 +00:00
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID = tg.RevisionID
WHERE tg.ID = '$GroupID'");
2013-07-10 00:08:53 +00:00
if (!$DB->has_results()) {
2013-05-01 08:00:16 +00:00
error(404);
}
list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID, $VanityHouse) = $DB->next_record();
2011-03-28 14:21:28 +00:00
2013-05-01 08:00:16 +00:00
if (!$Body) {
2013-06-19 08:01:09 +00:00
$Body = $WikiBody;
$Image = $WikiImage;
2013-05-01 08:00:16 +00:00
}
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
View::show_header('Edit torrent group');
2011-03-28 14:21:28 +00:00
// Start printing form
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Edit <a href="torrents.php?id=<?=$GroupID?>"><?=$Name?></a></h2>
</div>
2011-03-28 14:21:28 +00:00
<div class="box pad">
2012-09-15 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
<div>
<input type="hidden" name="action" value="takegroupedit" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
2013-06-20 08:01:00 +00:00
<h3>Image:</h3>
2011-03-28 14:21:28 +00:00
<input type="text" name="image" size="92" value="<?=$Image?>" /><br />
2013-06-20 08:01:00 +00:00
<h3>Torrent group description:</h3>
2011-03-28 14:21:28 +00:00
<textarea name="body" cols="91" rows="20"><?=$Body?></textarea><br />
2013-05-01 08:00:16 +00:00
<? if ($CategoryID == 1) { ?>
2014-03-23 08:00:50 +00:00
<h3>Release type:
<select id="releasetype" name="releasetype">
2013-02-07 08:00:47 +00:00
<? foreach ($ReleaseTypes as $Key => $Val) { ?>
2014-03-23 08:00:50 +00:00
<option value="<?=$Key?>"<?=($Key == $ReleaseType ? ' selected="selected"' : '')?>><?=$Val?></option>
2013-02-07 08:00:47 +00:00
<? } ?>
2014-03-23 08:00:50 +00:00
</select>
</h3>
2013-02-07 08:00:47 +00:00
<? if (check_perms('torrents_edit_vanityhouse')) { ?>
2013-06-19 08:01:09 +00:00
<h3>
<label>Vanity House: <input type="checkbox" name="vanity_house" value="1" <?=($VanityHouse ? 'checked="checked" ' : '')?>/></label>
</h3>
<?
}
}
?>
2013-06-20 08:01:00 +00:00
<h3>Edit summary:</h3>
2011-03-28 14:21:28 +00:00
<input type="text" name="summary" size="92" /><br />
<div style="text-align: center;">
<input type="submit" value="Submit" />
</div>
</div>
</form>
</div>
2013-06-19 08:01:09 +00:00
<?
$DB->query("
SELECT UserID
FROM torrents
WHERE GroupID = $GroupID");
2011-03-28 14:21:28 +00:00
//Users can edit the group info if they've uploaded a torrent to the group or have torrents_edit
2013-05-01 08:00:16 +00:00
if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit')) { ?>
2013-06-20 08:01:00 +00:00
<h3>Non-wiki torrent group editing</h3>
2011-03-28 14:21:28 +00:00
<div class="box pad">
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="nonwikiedit" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
2012-09-01 08:00:24 +00:00
<table cellpadding="3" cellspacing="1" border="0" class="layout border" width="100%">
2011-03-28 14:21:28 +00:00
<tr>
2015-10-20 08:00:27 +00:00
<td colspan="2" class="center">This is for editing the information related to the <strong>Original Release</strong> only.</td>
2011-03-28 14:21:28 +00:00
</tr>
<tr>
<td class="label">Year</td>
<td>
<input type="text" name="year" size="10" value="<?=$Year?>" />
</td>
</tr>
<tr>
<td class="label">Record label</td>
<td>
<input type="text" name="record_label" size="40" value="<?=$RecordLabel?>" />
</td>
</tr>
<tr>
2013-03-23 08:00:43 +00:00
<td class="label">Catalogue number</td>
2011-03-28 14:21:28 +00:00
<td>
<input type="text" name="catalogue_number" size="40" value="<?=$CatalogueNumber?>" />
</td>
2013-02-22 08:00:24 +00:00
</tr>
2013-06-19 08:01:09 +00:00
<? if (check_perms('torrents_freeleech')) { ?>
2011-03-28 14:21:28 +00:00
<tr>
2013-03-23 08:00:43 +00:00
<td class="label">Torrent <strong>group</strong> leech status</td>
2011-03-28 14:21:28 +00:00
<td>
2013-03-23 08:00:43 +00:00
<input type="checkbox" id="unfreeleech" name="unfreeleech" /><label for="unfreeleech"> Reset</label>
<input type="checkbox" id="freeleech" name="freeleech" /><label for="freeleech"> Freeleech</label>
<input type="checkbox" id="neutralleech" name="neutralleech" /><label for="neutralleech"> Neutral Leech</label>
2013-02-22 08:00:24 +00:00
because
<select name="freeleechtype">
2013-06-19 08:01:09 +00:00
<? $FL = array('N/A', 'Staff Pick', 'Perma-FL', 'Vanity House');
2013-05-01 08:00:16 +00:00
foreach ($FL as $Key => $FLType) { ?>
2013-03-23 08:00:43 +00:00
<option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$FLType?></option>
<? } ?>
</select>
2011-03-28 14:21:28 +00:00
</td>
2013-02-22 08:00:24 +00:00
</tr>
2013-06-19 08:01:09 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
<input type="submit" value="Edit" />
</form>
</div>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
}
2013-05-01 08:00:16 +00:00
if (check_perms('torrents_edit')) {
2013-02-22 08:00:24 +00:00
?>
2013-06-20 08:01:00 +00:00
<h3>Rename (will not merge)</h3>
2011-03-28 14:21:28 +00:00
<div class="box pad">
2012-09-15 08:00:25 +00:00
<form class="rename_form" name="torrent_group" action="torrents.php" method="post">
2011-03-28 14:21:28 +00:00
<div>
<input type="hidden" name="action" value="rename" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="text" name="name" size="92" value="<?=$Name?>" />
<div style="text-align: center;">
<input type="submit" value="Rename" />
</div>
</div>
</form>
</div>
2012-08-19 08:00:19 +00:00
<h3>Merge with another group</h3>
2011-03-28 14:21:28 +00:00
<div class="box pad">
2012-09-15 08:00:25 +00:00
<form class="merge_form" name="torrent_group" action="torrents.php" method="post">
2011-03-28 14:21:28 +00:00
<div>
<input type="hidden" name="action" value="merge" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
2014-03-23 08:00:50 +00:00
<h3>Target torrent group ID:
<input type="text" name="targetgroupid" size="10" />
</h3>
2011-03-28 14:21:28 +00:00
<div style="text-align: center;">
<input type="submit" value="Merge" />
</div>
</div>
</form>
</div>
2013-02-22 08:00:24 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</div>
2012-10-11 08:00:15 +00:00
<? View::show_footer(); ?>