From e317e7d740a83999d9f12da570c36b99e9b23aef Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Thu, 14 Aug 2014 21:50:25 +0000
Subject: [PATCH] Support packing system messages into the session

Messages are extracted on post-action redirect.
---
 main.inc.php      | 8 ++++++++
 scp/staff.inc.php | 3 ---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/main.inc.php b/main.inc.php
index 4f4b01bfb..026e440ca 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -43,4 +43,12 @@ $_POST=Format::strip_slashes($_POST);
 $_GET=Format::strip_slashes($_GET);
 $_REQUEST=Format::strip_slashes($_REQUEST);
 }
+
+// extract system messages
+$errors = array();
+$msg=$warn=$sysnotice='';
+if ($_SESSION['::sysmsgs']) {
+    extract($_SESSION['::sysmsgs']);
+    unset($_SESSION['::sysmsgs']);
+}
 ?>
diff --git a/scp/staff.inc.php b/scp/staff.inc.php
index 9330717e3..d4399c74b 100644
--- a/scp/staff.inc.php
+++ b/scp/staff.inc.php
@@ -110,9 +110,6 @@ $_SESSION['TZ_DST']=$thisstaff->observeDaylight();
 
 define('PAGE_LIMIT', $thisstaff->getPageLimit()?$thisstaff->getPageLimit():DEFAULT_PAGE_LIMIT);
 
-//Clear some vars. we use in all pages.
-$errors=array();
-$msg=$warn=$sysnotice='';
 $tabs=array();
 $submenu=array();
 $exempt = in_array(basename($_SERVER['SCRIPT_NAME']), array('logout.php', 'ajax.php', 'logs.php', 'upgrade.php'));
-- 
GitLab