2013-06-09 08:01:21 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2013-06-10 08:01:05 +00:00
|
|
|
if (!check_perms('torrents_edit') || $LoggedUser['DisableWiki']) {
|
2013-06-09 08:01:21 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!check_perms('users_mod') && !$LoggedUser['ExtraClasses'][DELTA_TEAM]) {
|
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
|
|
|
View::show_header('Label Aliases');
|
|
|
|
|
2013-06-10 08:01:05 +00:00
|
|
|
$OrderBy = (($_GET['order'] == 'BadLabels') ? 'BadLabel' : 'AliasLabel');
|
2013-06-09 08:01:21 +00:00
|
|
|
/*
|
|
|
|
$LabelID = (int) $_GET['id'];
|
2013-06-10 08:01:05 +00:00
|
|
|
$LabelNameSQL = '';
|
2013-06-09 08:01:21 +00:00
|
|
|
//TODO join with labels table to get label name
|
2013-06-10 08:01:05 +00:00
|
|
|
if (!empty($LabelID)) {
|
|
|
|
$DB->query("
|
|
|
|
SELECT name
|
|
|
|
FROM labels
|
|
|
|
WHERE ID = '$LabelID'");
|
|
|
|
if ($DB->record_count()) {
|
2013-06-09 08:01:21 +00:00
|
|
|
list($LabelName) = $DB->next_record();
|
|
|
|
}
|
|
|
|
$LabelNameSQL = " WHERE AliasLabel = '$LabelName'";
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (isset($_POST['newalias'])) {
|
2013-06-10 08:01:05 +00:00
|
|
|
$BadLabel = db_string($_POST['BadLabel']);
|
|
|
|
$AliasLabel = db_string($_POST['AliasLabel']);
|
2013-06-09 08:01:21 +00:00
|
|
|
|
2013-06-10 08:01:05 +00:00
|
|
|
$DB->query("
|
|
|
|
INSERT INTO label_aliases (BadLabel, AliasLabel)
|
|
|
|
VALUES ('$BadLabel', '$AliasLabel')");
|
2013-06-09 08:01:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['changealias']) && is_number($_POST['aliasid'])) {
|
2013-06-10 08:01:05 +00:00
|
|
|
$AliasID = $_POST['aliasid'];
|
|
|
|
$BadLabel = db_string($_POST['BadLabel']);
|
|
|
|
$AliasLabel = db_string($_POST['AliasLabel']);
|
2013-06-09 08:01:21 +00:00
|
|
|
|
2013-06-10 08:01:05 +00:00
|
|
|
if ($_POST['save']) {
|
|
|
|
$DB->query("
|
|
|
|
UPDATE label_aliases
|
|
|
|
SET BadLabel = '$BadLabel', AliasLabel = '$AliasLabel'
|
|
|
|
WHERE ID = '$AliasID' ");
|
|
|
|
}
|
|
|
|
if ($_POST['delete']) {
|
|
|
|
$DB->query("
|
|
|
|
DELETE FROM label_aliases
|
|
|
|
WHERE ID = '$AliasID'");
|
|
|
|
}
|
2013-06-09 08:01:21 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="header">
|
2013-06-10 08:01:05 +00:00
|
|
|
<h2>Label Aliases<?=($LabelName ? " for <a href=\"labels.php?id=$LabelID\">$LabelName</a>" : '')?></h2>
|
2013-06-09 08:01:21 +00:00
|
|
|
<div class="linkbox">
|
2013-06-10 08:01:05 +00:00
|
|
|
<a href="tools.php?action=label_aliases&order=GoodLabels" class="brackets">Sort by good labels</a>
|
|
|
|
<a href="tools.php?action=label_aliases&order=BadLabels" class="brackets">Sort by bad labels</a>
|
|
|
|
</div>
|
2013-06-09 08:01:21 +00:00
|
|
|
</div>
|
|
|
|
<table width="100%">
|
|
|
|
<tr class="colhead">
|
|
|
|
<td>Label</td>
|
2013-06-10 08:01:05 +00:00
|
|
|
<td>Renamed from</td>
|
2013-06-09 08:01:21 +00:00
|
|
|
<td>Submit</td>
|
|
|
|
</tr>
|
2013-06-10 08:01:05 +00:00
|
|
|
<tr />
|
2013-06-09 08:01:21 +00:00
|
|
|
<tr>
|
|
|
|
<form method="post">
|
|
|
|
<input type="hidden" name="newalias" value="1" />
|
|
|
|
<td>
|
|
|
|
<input type="text" name="AliasLabel" />
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type="text" name="BadLabel" />
|
|
|
|
</td>
|
|
|
|
<td>
|
2013-06-10 08:01:05 +00:00
|
|
|
<input type="submit" value="Add alias" />
|
2013-06-09 08:01:21 +00:00
|
|
|
</td>
|
|
|
|
</form>
|
|
|
|
</tr>
|
2013-06-10 08:01:05 +00:00
|
|
|
<?
|
|
|
|
$DB->query("
|
|
|
|
SELECT ID, BadLabel, AliasLabel
|
|
|
|
FROM label_aliases
|
|
|
|
$LabelNameSQL
|
|
|
|
ORDER BY $OrderBy");
|
2013-06-09 08:01:21 +00:00
|
|
|
while (list($ID, $BadLabel, $AliasLabel) = $DB->next_record()) {
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<form method="post">
|
|
|
|
<input type="hidden" name="changealias" value="1" />
|
|
|
|
<input type="hidden" name="aliasid" value="<?=$ID?>" />
|
|
|
|
<td>
|
|
|
|
<input type="text" name="AliasLabel" value="<?=$AliasLabel?>" />
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type="text" name="BadLabel" value="<?=$BadLabel?>" />
|
|
|
|
</td>
|
|
|
|
<td>
|
2013-06-10 08:01:05 +00:00
|
|
|
<input type="submit" name="save" value="Save alias" />
|
|
|
|
<input type="submit" name="delete" value="Delete alias" />
|
2013-06-09 08:01:21 +00:00
|
|
|
</td>
|
|
|
|
</form>
|
|
|
|
</tr>
|
2013-06-10 08:01:05 +00:00
|
|
|
<?
|
|
|
|
} ?>
|
2013-06-09 08:01:21 +00:00
|
|
|
</table>
|
|
|
|
<? View::show_footer(); ?>
|