diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php index 17263261056..5cbf34fd13c 100644 --- a/htdocs/bookmarks/fiche.php +++ b/htdocs/bookmarks/fiche.php @@ -28,12 +28,14 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; $langs->load("other"); -$action=GETPOST("action"); -$title=GETPOST("title"); -$url=GETPOST("url"); -$target=GETPOST("target"); -$userid=GETPOST("userid"); -$position=GETPOST("position"); +$id=GETPOST("id"); +$action=GETPOST("action","alpha"); +$title=GETPOST("title","alpha"); +$url=GETPOST("url","alpha"); +$target=GETPOST("target","alpha"); +$userid=GETPOST("userid","int"); +$position=GETPOST("position","int"); +$backtopage=GETPOST('backtopage','alpha'); /* @@ -42,10 +44,10 @@ $position=GETPOST("position"); if ($action == 'add' || $action == 'addproduct' || $action == 'update') { - if ($_POST["cancel"]) + if (GETPOST("cancel")) { - $urlsource=(! empty($_REQUEST["urlsource"]))?$_REQUEST["urlsource"]:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/liste.php'); - header("Location: ".$urlsource); + if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/liste.php')); + header("Location: ".$backtopage); exit; } @@ -71,8 +73,8 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if ($res > 0) { - $urlsource=! empty($_REQUEST["urlsource"])?urldecode($_REQUEST["urlsource"]):DOL_URL_ROOT.'/bookmarks/liste.php'; - header("Location: ".$urlsource); + if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):DOL_URL_ROOT.'/bookmarks/liste.php'); + header("Location: ".$backtopage); exit; } else @@ -96,7 +98,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') } } -if ($_GET["action"] == 'delete') +if ($action == 'delete') { $bookmark=new Bookmark($db); $bookmark->id=$_GET["bid"]; @@ -133,10 +135,10 @@ if ($action == 'create') * Fact bookmark creation mode */ - print '
'; + if ($action == 'edit') print ''; dol_fiche_end(); @@ -264,13 +267,13 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"])) print "