aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php34
1 files changed, 9 insertions, 25 deletions
diff --git a/index.php b/index.php
index 5cc440bb..190d7f6b 100644
--- a/index.php
+++ b/index.php
@@ -1349,31 +1349,15 @@ function renderPage($conf, $pluginManager, $LINKSDB)
1349 1349
1350 // If we are called from the bookmarklet, we must close the popup: 1350 // If we are called from the bookmarklet, we must close the popup:
1351 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; } 1351 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; }
1352 // Pick where we're going to redirect 1352
1353 // ============================================================= 1353 $location = '?';
1354 // Basically, we can't redirect to where we were previously if it was a permalink 1354 if (isset($_SERVER['HTTP_REFERER'])) {
1355 // or an edit_link, because it would 404. 1355 // Don't redirect to where we were previously if it was a permalink or an edit_link, because it would 404.
1356 // Cases: 1356 $location = generateLocation(
1357 // - / : nothing in $_GET, redirect to self 1357 $_SERVER['HTTP_REFERER'],
1358 // - /?page : redirect to self 1358 $_SERVER['HTTP_HOST'],
1359 // - /?searchterm : redirect to self (there might be other links) 1359 ['delete_link', 'edit_link', $link['shorturl']]
1360 // - /?searchtags : redirect to self 1360 );
1361 // - /permalink : redirect to / (the link does not exist anymore)
1362 // - /?edit_link : redirect to / (the link does not exist anymore)
1363 // PHP treats the permalink as a $_GET variable, so we need to check if every condition for self
1364 // redirect is not satisfied, and only then redirect to /
1365 $location = "?";
1366 // Self redirection
1367 if (count($_GET) == 0
1368 || isset($_GET['page'])
1369 || isset($_GET['searchterm'])
1370 || isset($_GET['searchtags'])
1371 ) {
1372 if (isset($_POST['returnurl'])) {
1373 $location = $_POST['returnurl']; // Handle redirects given by the form
1374 } else if (isset($_SERVER['HTTP_REFERER'])) {
1375 $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('delete_link'));
1376 }
1377 } 1361 }
1378 1362
1379 header('Location: ' . $location); // After deleting the link, redirect to appropriate location 1363 header('Location: ' . $location); // After deleting the link, redirect to appropriate location