Gazelle/sections/wiki/add_alias.php

20 lines
675 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
//Todo, check that loggeduser > edit
if(!is_number($_POST['article']) || $_POST['article'] == ''){ error(0); }
$ArticleID = $_POST['article'];
$NewAlias = $Alias->convert($_POST['alias']);
$Dupe = $Alias->to_id($_POST['alias']);
if($NewAlias!='' && $NewAlias!='addalias' && !$Dupe){ //Not null, and not dupe
$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);