X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;fp=index.php;h=cd83600bf7c4ab5c87d4606deced9a4c481cea1b;hb=88c15abb2a2b24f05ca926c0ddbdec18a407e47d;hp=2815f02e5e40e93f946051a2580da138f0744ca4;hpb=eefb636cea7acef9ddfd02a90749820f5fafc9f6;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 2815f02e..cd83600b 100644 --- a/index.php +++ b/index.php @@ -1470,19 +1470,20 @@ function renderPage() // -------- User wants to rename a tag or delete it if ($targetPage == Router::$PAGE_CHANGETAG) { - if (empty($_POST['fromtag'])) - { - $PAGE->assign('linkcount',count($LINKSDB)); - $PAGE->assign('token',getToken()); + if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { + $PAGE->assign('linkcount', count($LINKSDB)); + $PAGE->assign('token', getToken()); $PAGE->assign('tags', $LINKSDB->allTags()); $PAGE->renderPage('changetag'); exit; } - if (!tokenOk($_POST['token'])) die('Wrong token.'); + + if (!tokenOk($_POST['token'])) { + die('Wrong token.'); + } // Delete a tag: - if (!empty($_POST['deletetag']) && !empty($_POST['fromtag'])) - { + if (isset($_POST['deletetag']) && !empty($_POST['fromtag'])) { $needle=trim($_POST['fromtag']); // True for case-sensitive tag search. $linksToAlter = $LINKSDB->filter(LinkFilter::$FILTER_TAG, $needle, true); @@ -1499,8 +1500,7 @@ function renderPage() } // Rename a tag: - if (!empty($_POST['renametag']) && !empty($_POST['fromtag']) && !empty($_POST['totag'])) - { + if (isset($_POST['renametag']) && !empty($_POST['fromtag']) && !empty($_POST['totag'])) { $needle=trim($_POST['fromtag']); // True for case-sensitive tag search. $linksToAlter = $LINKSDB->filter(LinkFilter::$FILTER_TAG, $needle, true);