aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-01-16 12:40:00 +0100
committerGitHub <noreply@github.com>2017-01-16 12:40:00 +0100
commit4d9fd16ddf2a7d6488c4200aca48501e9d5886fe (patch)
tree7dcc7f32db8decb0387f140561d3cb2eb98c4b3e /index.php
parent514185e14b09d1e37c41eb5d2720e3e45b12eea9 (diff)
parent8bbf02e0dbc60395a3ec4e8482d652011379fb60 (diff)
downloadShaarli-4d9fd16ddf2a7d6488c4200aca48501e9d5886fe.tar.gz
Shaarli-4d9fd16ddf2a7d6488c4200aca48501e9d5886fe.tar.zst
Shaarli-4d9fd16ddf2a7d6488c4200aca48501e9d5886fe.zip
Merge pull request #761 from ArthurHoaro/hotfix/referrer-warning
Prevent warning if HTTP_REFERER isn't set
Diffstat (limited to 'index.php')
-rw-r--r--index.php16
1 files changed, 13 insertions, 3 deletions
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)
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 }