X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;fp=index.php;h=b27c83b600a8038c09d9d90d2ea3e4190d58d217;hb=4d9fd16ddf2a7d6488c4200aca48501e9d5886fe;hp=8055a7b7bde78bfe06f290ce58ec0a647313ab57;hpb=514185e14b09d1e37c41eb5d2720e3e45b12eea9;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 8055a7b7..b27c83b6 100644 --- a/index.php +++ b/index.php @@ -1012,7 +1012,12 @@ function renderPage($conf, $pluginManager, $LINKSDB) $_SESSION['LINKS_PER_PAGE']=abs(intval($_GET['linksperpage'])); } - header('Location: '. generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('linksperpage'))); + if (! empty($_SERVER['HTTP_REFERER'])) { + $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('linksperpage')); + } else { + $location = '?'; + } + header('Location: '. $location); exit; } @@ -1024,7 +1029,12 @@ function renderPage($conf, $pluginManager, $LINKSDB) unset($_SESSION['privateonly']); // See all links } - header('Location: '. generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly'))); + if (! empty($_SERVER['HTTP_REFERER'])) { + $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly')); + } else { + $location = '?'; + } + header('Location: '. $location); exit; } @@ -1361,7 +1371,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) ) { if (isset($_POST['returnurl'])) { $location = $_POST['returnurl']; // Handle redirects given by the form - } else { + } else if (isset($_SERVER['HTTP_REFERER'])) { $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('delete_link')); } }