Fix a regression: permalinks change when old links are edited

fixes #713
This commit is contained in:
ArthurHoaro 2016-12-15 11:18:56 +01:00
parent 624f999fb7
commit 826c6af7c0
1 changed files with 3 additions and 1 deletions

View File

@ -1249,10 +1249,12 @@ function renderPage($conf, $pluginManager)
// Edit
$created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
$updated = new DateTime();
$shortUrl = $LINKSDB[$id]['shorturl'];
} else {
// New link
$created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
$updated = null;
$shortUrl = link_small_hash($created, $id);
}
// Remove multiple spaces.
@ -1279,7 +1281,7 @@ function renderPage($conf, $pluginManager)
'created' => $created,
'updated' => $updated,
'tags' => str_replace(',', ' ', $tags),
'shorturl' => link_small_hash($created, $id),
'shorturl' => $shortUrl,
);
// If title is empty, use the URL as title.