Gazelle/sections/wiki/add_alias.php

22 lines
682 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-04-20 08:01:01 +00:00
//TODO, check that loggeduser > edit
if (!is_number($_POST['article']) || $_POST['article'] == '') {
error(0);
}
2011-03-28 14:21:28 +00:00
$ArticleID = $_POST['article'];
$NewAlias = $Alias->convert($_POST['alias']);
$Dupe = $Alias->to_id($_POST['alias']);
2013-04-20 08:01:01 +00:00
if ($NewAlias != '' && $NewAlias!='addalias' && !$Dupe) { //Not null, and not dupe
2011-03-28 14:21:28 +00:00
$DB->query("INSERT INTO wiki_aliases (Alias, UserID, ArticleID) VALUES ('$NewAlias', '$LoggedUser[ID]', '$ArticleID')");
$Alias->flush();
} else {
error('The alias you attempted to add was either null or already in the database.');
}
$Cache->delete_value('wiki_article_'.$ArticleID);
header('Location: wiki.php?action=article&id='.$ArticleID);