diff --git a/main/inc/lib/link.lib.php b/main/inc/lib/link.lib.php index 768c8bb88f..5d62ab026a 100644 --- a/main/inc/lib/link.lib.php +++ b/main/inc/lib/link.lib.php @@ -44,12 +44,16 @@ function addlinkcategory($type) { $selectcategory = Security :: remove_XSS($_POST['selectcategory']); if ($_POST['onhomepage'] == '') { - $onhomepage = 0; - $target = '_self'; // Default target. + $onhomepage = 0; } else { $onhomepage = Security :: remove_XSS($_POST['onhomepage']); - $target = Security :: remove_XSS($_POST['target_link']); } + + if (empty($_POST['target_link'])) { + $target = '_self'; // Default target. + } else { + $target = Security :: remove_XSS($_POST['target_link']); + } $urllink = trim($urllink); $title = trim($title);