Gazelle/sections/wiki/add_alias.php

28 lines
847 B
PHP
Raw Permalink Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-12-24 08:00:55 +00:00
if (!isset($_POST['article']) || !is_number($_POST['article'])) {
2013-04-20 08:01:01 +00:00
error(0);
}
2011-03-28 14:21:28 +00:00
2013-12-24 08:00:55 +00:00
$ArticleID = (int)$_POST['article'];
2011-03-28 14:21:28 +00:00
2013-12-24 08:00:55 +00:00
$DB->query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
list($MinClassEdit) = $DB->next_record();
if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
error(403);
}
$NewAlias = Wiki::normalize_alias($_POST['alias']);
$Dupe = Wiki::alias_to_id($_POST['alias']);
if ($NewAlias != '' && $NewAlias!='addalias' && $Dupe === false) { //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')");
} else {
error('The alias you attempted to add was either null or already in the database.');
}
2013-12-24 08:00:55 +00:00
Wiki::flush_aliases();
Wiki::flush_article($ArticleID);
2011-03-28 14:21:28 +00:00
header('Location: wiki.php?action=article&id='.$ArticleID);