Gazelle/sections/wiki/takelink.php

21 lines
610 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-06-11 08:01:24 +00:00
if (preg_match('/^'.SITELINK_REGEX.'\/wiki\.php\?action=article\&id=([0-9]+)/i',$_POST['url'],$Match)) {
2013-04-20 08:01:01 +00:00
$ArticleID = $Match[2];
2011-03-28 14:21:28 +00:00
}
2013-06-11 08:01:24 +00:00
if (preg_match('/^'.SITELINK_REGEX.'\/wiki\.php\?action=article\&name=(.+)/i',$_POST['url'],$Match)) {
2011-03-28 14:21:28 +00:00
$ArticleID = $Alias->to_id($Match[2]);
}
2013-04-20 08:01:01 +00:00
if (!$ArticleID) {
2011-03-28 14:21:28 +00:00
error('Unable to link alias to an article.');
}
$NewAlias = $Alias->convert($_POST['alias']);
2013-04-20 08:01:01 +00:00
if ($NewAlias != '') {
2011-03-28 14:21:28 +00:00
$DB->query("INSERT INTO wiki_aliases (Alias, ArticleID) VALUES ('$NewAlias', '$ArticleID')");
$Alias->flush();
}
header('Location: wiki.php?action=article&id='.$ArticleID);
?>