Gazelle/sections/collages/edit.php

103 lines
3.3 KiB
PHP
Raw Permalink Normal View History

2011-03-28 14:21:28 +00:00
<?
2012-11-03 08:00:19 +00:00
if (!empty($_GET['collageid']) && is_number($_GET['collageid'])) {
$CollageID = $_GET['collageid'];
}
if (!is_number($CollageID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-07-12 08:00:46 +00:00
$DB->query("
SELECT Name, Description, TagList, UserID, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Featured
FROM collages
WHERE ID = '$CollageID'");
list($Name, $Description, $TagList, $UserID, $CategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Featured) = $DB->next_record();
2011-03-28 14:21:28 +00:00
$TagList = implode(', ', explode(' ', $TagList));
2012-11-03 08:00:19 +00:00
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
View::show_header('Edit collage');
2012-11-03 08:00:19 +00:00
if (!empty($Err)) {
if (isset($ErrNoEscape)) {
echo '<div class="save_message error">'.$Err.'</div>';
} else {
echo '<div class="save_message error">'.display_str($Err).'</div>';
}
}
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Edit collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
</div>
2012-09-15 08:00:25 +00:00
<form class="edit_form" name="collage" action="collages.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="edit_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
2012-09-01 08:00:24 +00:00
<table id="edit_collage" class="layout">
2013-07-12 08:00:46 +00:00
<? if (check_perms('site_collages_delete') || ($CategoryID == 0 && $UserID == $LoggedUser['ID'] && check_perms('site_collages_renamepersonal'))) { ?>
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Name</td>
<td><input type="text" name="name" size="60" value="<?=$Name?>" /></td>
</tr>
2013-07-12 08:00:46 +00:00
<?
}
2013-05-05 08:00:31 +00:00
if ($CategoryID > 0 || check_perms('site_collages_delete')) { ?>
2011-03-28 14:21:28 +00:00
<tr>
<td class="label"><strong>Category</strong></td>
<td>
<select name="category">
2013-07-12 08:00:46 +00:00
<?
foreach ($CollageCats as $CatID => $CatName) {
2012-11-03 08:00:19 +00:00
if (!check_perms('site_collages_delete') && $CatID == 0) {
// Only mod-type get to make things personal
continue;
}
?>
2013-02-18 08:00:22 +00:00
<option value="<?=$CatID?>"<?=$CatID == $CategoryID ? ' selected="selected"' : ''?>><?=$CatName?></option>
2011-03-28 14:21:28 +00:00
<? } ?>
</select>
</td>
</tr>
2013-07-12 08:00:46 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Description</td>
<td>
<textarea name="description" id="description" cols="60" rows="10"><?=$Description?></textarea>
</td>
</tr>
<tr>
<td class="label">Tags</td>
<td><input type="text" name="tags" size="60" value="<?=$TagList?>" /></td>
</tr>
2013-07-12 08:00:46 +00:00
<? if ($CategoryID == 0) { // CategoryID == 0 is for "personal" collages ?>
<tr>
2013-08-28 23:08:41 +00:00
<td class="label"><span class="tooltip" title="A &quot;featured&quot; personal collage will be listed first on your profile, along with a preview of the included torrents.">Featured</span></td>
2013-02-18 08:00:22 +00:00
<td><input type="checkbox" name="featured"<?=($Featured ? ' checked="checked"' : '')?> /></td>
</tr>
2013-07-12 08:00:46 +00:00
<?
}
2013-05-05 08:00:31 +00:00
if (check_perms('site_collages_delete')) { ?>
2011-03-28 14:21:28 +00:00
<tr>
2012-11-03 08:00:19 +00:00
<td class="label">Locked</td>
<td><input type="checkbox" name="locked" <?=$Locked ? 'checked="checked" ' : ''?>/></td>
2011-03-28 14:21:28 +00:00
</tr>
<tr>
<td class="label">Max groups</td>
<td><input type="text" name="maxgroups" size="5" value="<?=$MaxGroups?>" /></td>
</tr>
<tr>
<td class="label">Max groups per user</td>
<td><input type="text" name="maxgroupsperuser" size="5" value="<?=$MaxGroupsPerUser?>" /></td>
</tr>
2013-02-18 08:00:22 +00:00
2011-03-28 14:21:28 +00:00
<? } ?>
<tr>
<td colspan="2" class="center"><input type="submit" value="Edit collage" /></td>
</tr>
</table>
</form>
</div>
2012-10-11 08:00:15 +00:00
<? View::show_footer(); ?>