Merge pull request #429 from ArthurHoaro/changetag-buttons
Fixes #428: validate buttons presence instead of value
This commit is contained in:
commit
a327d891b3
1 changed files with 9 additions and 9 deletions
14
index.php
14
index.php
|
@ -1453,19 +1453,20 @@ function renderPage()
|
||||||
// -------- User wants to rename a tag or delete it
|
// -------- User wants to rename a tag or delete it
|
||||||
if ($targetPage == Router::$PAGE_CHANGETAG)
|
if ($targetPage == Router::$PAGE_CHANGETAG)
|
||||||
{
|
{
|
||||||
if (empty($_POST['fromtag']))
|
if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) {
|
||||||
{
|
|
||||||
$PAGE->assign('linkcount', count($LINKSDB));
|
$PAGE->assign('linkcount', count($LINKSDB));
|
||||||
$PAGE->assign('token', getToken());
|
$PAGE->assign('token', getToken());
|
||||||
$PAGE->assign('tags', $LINKSDB->allTags());
|
$PAGE->assign('tags', $LINKSDB->allTags());
|
||||||
$PAGE->renderPage('changetag');
|
$PAGE->renderPage('changetag');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (!tokenOk($_POST['token'])) die('Wrong token.');
|
|
||||||
|
if (!tokenOk($_POST['token'])) {
|
||||||
|
die('Wrong token.');
|
||||||
|
}
|
||||||
|
|
||||||
// Delete a tag:
|
// Delete a tag:
|
||||||
if (!empty($_POST['deletetag']) && !empty($_POST['fromtag']))
|
if (isset($_POST['deletetag']) && !empty($_POST['fromtag'])) {
|
||||||
{
|
|
||||||
$needle=trim($_POST['fromtag']);
|
$needle=trim($_POST['fromtag']);
|
||||||
$linksToAlter = $LINKSDB->filterTags($needle,true); // True for case-sensitive tag search.
|
$linksToAlter = $LINKSDB->filterTags($needle,true); // True for case-sensitive tag search.
|
||||||
foreach($linksToAlter as $key=>$value)
|
foreach($linksToAlter as $key=>$value)
|
||||||
|
@ -1481,8 +1482,7 @@ function renderPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rename a tag:
|
// 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']);
|
$needle=trim($_POST['fromtag']);
|
||||||
$linksToAlter = $LINKSDB->filterTags($needle,true); // true for case-sensitive tag search.
|
$linksToAlter = $LINKSDB->filterTags($needle,true); // true for case-sensitive tag search.
|
||||||
foreach($linksToAlter as $key=>$value)
|
foreach($linksToAlter as $key=>$value)
|
||||||
|
|
Loading…
Reference in a new issue