diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-01-15 17:58:19 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-01-15 17:58:19 +0100 |
commit | 8bbf02e0dbc60395a3ec4e8482d652011379fb60 (patch) | |
tree | 397f5020c5b503857d76d2f4cdab55a065d9b57b | |
parent | 9977c418d6d0de9e22e4ec276e7d476e184b5d01 (diff) | |
download | Shaarli-8bbf02e0dbc60395a3ec4e8482d652011379fb60.tar.gz Shaarli-8bbf02e0dbc60395a3ec4e8482d652011379fb60.tar.zst Shaarli-8bbf02e0dbc60395a3ec4e8482d652011379fb60.zip |
Prevent warning if HTTP_REFERER isn't set
Fixes #723
-rw-r--r-- | index.php | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1012,7 +1012,12 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1012 | $_SESSION['LINKS_PER_PAGE']=abs(intval($_GET['linksperpage'])); | 1012 | $_SESSION['LINKS_PER_PAGE']=abs(intval($_GET['linksperpage'])); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | header('Location: '. generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('linksperpage'))); | 1015 | if (! empty($_SERVER['HTTP_REFERER'])) { |
1016 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('linksperpage')); | ||
1017 | } else { | ||
1018 | $location = '?'; | ||
1019 | } | ||
1020 | header('Location: '. $location); | ||
1016 | exit; | 1021 | exit; |
1017 | } | 1022 | } |
1018 | 1023 | ||
@@ -1024,7 +1029,12 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1024 | unset($_SESSION['privateonly']); // See all links | 1029 | unset($_SESSION['privateonly']); // See all links |
1025 | } | 1030 | } |
1026 | 1031 | ||
1027 | header('Location: '. generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly'))); | 1032 | if (! empty($_SERVER['HTTP_REFERER'])) { |
1033 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly')); | ||
1034 | } else { | ||
1035 | $location = '?'; | ||
1036 | } | ||
1037 | header('Location: '. $location); | ||
1028 | exit; | 1038 | exit; |
1029 | } | 1039 | } |
1030 | 1040 | ||
@@ -1361,7 +1371,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) | |||
1361 | ) { | 1371 | ) { |
1362 | if (isset($_POST['returnurl'])) { | 1372 | if (isset($_POST['returnurl'])) { |
1363 | $location = $_POST['returnurl']; // Handle redirects given by the form | 1373 | $location = $_POST['returnurl']; // Handle redirects given by the form |
1364 | } else { | 1374 | } else if (isset($_SERVER['HTTP_REFERER'])) { |
1365 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('delete_link')); | 1375 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('delete_link')); |
1366 | } | 1376 | } |
1367 | } | 1377 | } |