From 9bfe2cec621c54ab72fa0abfc054a1f6c8d4dc16 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Wed, 27 Aug 2008 19:20:23 +0000 Subject: [PATCH] Add Status: 302 header for redirects, have fun, nitrox. :) --- comment.php | 3 +++ include/functions_comments.inc.php | 2 ++ index.php | 2 ++ rss.php | 1 + serendipity_admin_image_selector.php | 2 ++ serendipity_config.inc.php | 1 + 6 files changed, 11 insertions(+) diff --git a/comment.php b/comment.php index 192d173a..3b2c2744 100644 --- a/comment.php +++ b/comment.php @@ -10,7 +10,9 @@ header('Content-Type: text/html; charset=' . LANG_CHARSET); if (isset($serendipity['GET']['delete'], $serendipity['GET']['entry'], $serendipity['GET']['type'])) { serendipity_deleteComment($serendipity['GET']['delete'], $serendipity['GET']['entry'], $serendipity['GET']['type']); if (serendipity_isResponseClean($_SERVER['HTTP_REFERER'])) { + header('Status: 302 Found'); header('Location: '. $_SERVER['HTTP_REFERER']); + exit; } } @@ -170,6 +172,7 @@ if ($type == 'trackback') { if (serendipity_saveComment($id, $comment, 'NORMAL')) { $sc_url = $serendipity['baseURL'] . 'comment.php?serendipity[entry_id]=' . $id . '&success=true&url=' . urlencode($_SERVER['HTTP_REFERER']); if (serendipity_isResponseClean($sc_url)) { + header('Status: 302 Found'); header('Location: ' . $sc_url); } exit; diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index d3f51e6a..6554afb4 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -588,7 +588,9 @@ function serendipity_allowCommentsToggle($entry_id, $switch = 'disable') { $query = "UPDATE {$serendipity['dbPrefix']}entries SET allow_comments = '" . ($switch == 'disable' ? 'false' : 'true') . "' WHERE id = '". (int)$entry_id ."' $admin"; serendipity_db_query($query); if (serendipity_isResponseClean($_SERVER['HTTP_REFERER'])) { + header('Status: 302 Found'); header('Location: '. $_SERVER['HTTP_REFERER']); + exit; } } else { die('What are you up to? You need to be an admin to close comments'); diff --git a/index.php b/index.php index e762c98a..a1e25309 100644 --- a/index.php +++ b/index.php @@ -278,6 +278,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) { $sc_url = ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . (strstr($_SERVER['REQUEST_URI'], '?') ? '&' : '?') . 'serendipity[csuccess]=' . (isset($serendipity['csuccess']) ? $serendipity['csuccess'] : 'true'); if (serendipity_isResponseClean($sc_url)) { + header('Status: 302 Found'); header('Location: ' . $sc_url); } exit; @@ -366,6 +367,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { $base = str_replace('http://', 'https://', $base); } + header('Status: 302 Found'); header("Location: {$base}serendipity_admin.php"); exit; } else if (preg_match(PAT_ARCHIVE, $uri)) { diff --git a/rss.php b/rss.php index ac7ae9dc..2a53b16d 100644 --- a/rss.php +++ b/rss.php @@ -174,6 +174,7 @@ if (is_array($plugins)) { !(serendipity_userLoggedIn() && isset($_GET['forceLocal'])) ) { $url = 'http://feeds.feedburner.com/' . $plugin->get_config('fb_id'); + header('Status: 302 Found'); header('Location: ' . $url); exit; } diff --git a/serendipity_admin_image_selector.php b/serendipity_admin_image_selector.php index 9320c56a..84aeba7d 100644 --- a/serendipity_admin_image_selector.php +++ b/serendipity_admin_image_selector.php @@ -216,11 +216,13 @@ switch ($serendipity['GET']['step']) { $curl = ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . ($_SERVER['HTTP_PORT'] != 80 ? ':' . $_SERVER['HTTP_PORT'] : ''); switch($serendipity['GET']['show']) { case 'redirect': + header('Status: 302 Found'); header('Location: ' . $curl . $file['links']['imagelinkurl']); exit; break; case 'redirectThumb': + header('Status: 302 Found'); header('Location: ' . $curl . $file['show_thumb']); exit; break; diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index 0b138866..16d9bb33 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -174,6 +174,7 @@ $serendipity['charsets'] = array( * Kill the script if we are not installed, and not inside the installer */ if ( !defined('IN_installer') && IS_installed === false ) { + header('Status: 302 Found'); header('Location: ' . (strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) . '/serendipity_admin.php'); serendipity_die(sprintf(SERENDIPITY_NOT_INSTALLED, 'serendipity_admin.php')); }