From e1e66c3adc595534b61e440eefb4e2d75e3e92e9 Mon Sep 17 00:00:00 2001
From: Robert Sesek <rsesek@bluestatic.org>
Date: Sun, 21 Jan 2007 23:52:51 +0000
Subject: [PATCH] r1379: Merging r1378 from trunk back to the 1.1.x branch
 because this feature was easy enough to add

---
 docs/changes.txt                    |  1 +
 includes/class_message_reporter.php | 19 +++++++------------
 includes/settings.php               |  3 ++-
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/docs/changes.txt b/docs/changes.txt
index 9c247c6..3052876 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -4,6 +4,7 @@
 - Fixed a potential SQL error on search.php because no results were found (bug://report/62)
 - Fixed a SQL error on admin/user.php when adding a new user from the admin section (bug://report/63)
 - When adding a new user from the admin section, email options were not saved properly
+- Added an option to only perform header redirects instead of intermediate-stage redirects (bug://report/65)
 
 1.1.4
 ===============================
diff --git a/includes/class_message_reporter.php b/includes/class_message_reporter.php
index 8ddae4d..a28eb2f 100755
--- a/includes/class_message_reporter.php
+++ b/includes/class_message_reporter.php
@@ -27,12 +27,6 @@ class Message_Reporter
 	*/
 	var $url = '';
 	
-	/**
-	* Use a Location header to redirect
-	* @var	bool
-	*/
-	var $useheaders = false;
-	
 	/**
 	* Phrase array; null by default
 	* @var	array
@@ -123,15 +117,16 @@ class Message_Reporter
 		$this->process = ($text ? $text : $this->process);
 		$this->url = ($url ? $url : $this->url);
 		
-		$this->check_process();
-		
-		eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");');
-		
-		if ($this->useheaders)
+		if ($bugsys->options['redirectheaders'])
 		{
-			header("Location: {$this->url}");
+			header("Location: $url");
+			exit;
 		}
 		
+		$this->check_process();
+		
+		eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");');
+
 		exit;
 	}
 	
diff --git a/includes/settings.php b/includes/settings.php
index e95aa50..16eb4e2 100755
--- a/includes/settings.php
+++ b/includes/settings.php
@@ -50,7 +50,8 @@ $settings = array(
 	'dateformat'		=> array('textbox', 'F j, Y h:i:s A', false, _('Date Format'), _('Set the date format used for bug report and comment information. This is based on PHP\'s date() function.')),
 	'defaulttimezone'	=> array('" . construct_option_select("setting[defaulttimezone]", $bugsys->datef->fetch_timezone_list(), $bugsys->options["defaulttimezone"]) . "', 0, false, _('Default Time Zone'), _('This controls the time zone that all unregistered users view the tracker with.')),
 	'defaultlanguage'	=> array('" . construct_option_select("setting[defaultlanguage]", $bugsys->datastore["language"], $bugsys->options["defaultlanguage"], "languageid", "title") . "', 1, false, _('Default Language'), _('You can set the default language that all new users (and guests) will use.')),
-	'syndicateditems'	=> array('textbox', 10, false, _('Number of Syndicated Items'), _('The number of bugs to be syndicated at any one time by the Atom XML feed.'))
+	'syndicateditems'	=> array('textbox', 10, false, _('Number of Syndicated Items'), _('The number of bugs to be syndicated at any one time by the Atom XML feed.')),
+	'redirectheaders'	=> array('yesno', 0, false, _('Use Header Redirects'), _('Instead of displaying an intermediate page informing the user that their action was a success and a redirect is occurring, just send the user to the next screen using HTTP headers. This can save bandwidth.')),
 ),
 
 'reporting' => array(
-- 
2.43.5