From 1d53b7720becffe88c232177dfa26167810892bf Mon Sep 17 00:00:00 2001
From: Graham Cole <chckens@sucs.org>
Date: Sat, 26 Jan 2008 18:52:01 +0000
Subject: [PATCH] make pastebin serve redirect to newly pasted items. closes
 #54

---
 components/pastebin.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/pastebin.php b/components/pastebin.php
index dbf9154..0e3ac90 100755
--- a/components/pastebin.php
+++ b/components/pastebin.php
@@ -39,7 +39,8 @@ define('_SCRIPT_NAME', 'PasteBin/');
 define('_TABLE_NAME', 'pastebin');
 
 $smarty->assign('urifragment', '/Tools/PasteBin/');
-$smarty->assign('uri', 'http://'.$_SERVER['SERVER_NAME'].'/pb/');
+$pburi = 'https://'.$_SERVER['SERVER_NAME'].$baseurl;
+$smarty->assign('uri', $pburi.'/pb/');
 
 // Init
 $id = '';
@@ -168,6 +169,11 @@ if (isset($_POST['code'])) {
 				'INSERT INTO ' . _TABLE_NAME . ' ( id, code, username, retain_til, language) ' .
 				'VALUES (?, ?, ?, ?, ?)', 
 				array( $id, $code, $session->username, $retainTil, $pblang));
+
+			//bump user to uri of newly pasted item
+			header('Status: 303 See Other');
+			header("Location: $pburi/Tools/PasteBin/$id");
+
 			$userInfo = 'Created By ' . $session->username . ' at ' . date('Y/m/d H:i');
 			$smarty->assign('id', $id);
 			$smarty->assign('userInfo', $userInfo);
-- 
GitLab