[Fusionforge-commits] FusionForge branch master updated. 91ab96f2c8b61e18cc1c43875049bcb97d950049

Alain Peyrat aljeux at fusionforge.org
Thu Dec 13 17:55:02 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  91ab96f2c8b61e18cc1c43875049bcb97d950049 (commit)
      from  8c24ad36e049f81b693f62cb50d1da1801477bd5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 91ab96f2c8b61e18cc1c43875049bcb97d950049
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Thu Dec 13 17:54:50 2012 +0100

    Use cookies to pass feedback,warning_msg,error_msg during session_redirect()

diff --git a/src/common/include/pre.php b/src/common/include/pre.php
index 9774110..379a0be 100644
--- a/src/common/include/pre.php
+++ b/src/common/include/pre.php
@@ -21,11 +21,11 @@
  * with FusionForge; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
+require_once $gfcommon.'include/escapingUtils.php';
+require_once $gfcommon.'include/utils.php';
 
 // Declare and init variables to store messages
-$feedback = '';
-$warning_msg = '';
-$error_msg = '';
+util_init_messages();
 
 require_once $gfcommon.'include/escapingUtils.php';
 require_once $gfcommon.'include/config.php';
@@ -299,9 +299,6 @@ if (forge_get_config('database_name') != "") {
 		// HTML layout class, may be overriden by the Theme class
 		require_once $gfwww.'include/Layout.class.php';
 
-		// Various HTML utilities
-		require_once $gfcommon.'include/utils.php';
-
 		// Various HTML libs like button bar, themable
 		require_once $gfwww.'include/html.php';
 
diff --git a/src/common/include/session.php b/src/common/include/session.php
index 906afef..f127475 100644
--- a/src/common/include/session.php
+++ b/src/common/include/session.php
@@ -341,12 +341,12 @@ function session_set_cookie($name ,$value, $domain = '', $expiration = 0) {
 }
 
 /**
- *	session_redirect() - Redirect browser within the site
+ * session_redirect() - Redirect browser within the site and exit.
  *
- *	@param		string	Absolute path within the site
- *	@return never returns
+ * @param  string $loc    Absolute path within the site
  */
 function session_redirect($loc) {
+	util_save_messages();
 	session_redirect_external(util_make_url ($loc));
 	exit;
 }
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 97492b1..b07483b 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -1703,10 +1703,29 @@ function util_sanitise_multiline_submission($text) {
 	return $text;
 }
 
-
 function util_is_html($string) {
 	return (strip_tags(util_unconvert_htmlspecialchars($string)) != $string);
 }
+
+function util_init_messages() {
+	global $feedback, $warning_msg, $error_msg;
+
+	$feedback = getStringFromCookie('feedback', '');
+	setcookie('feedback');
+	$warning_msg = getStringFromCookie('warning_msg', '');
+	setcookie('warning_msg');
+	$error_msg = getStringFromCookie('error_msg', '');
+	setcookie('error_msg');
+}
+
+function util_save_messages() {
+	global $feedback, $warning_msg, $error_msg;
+
+	setcookie('feedback', $feedback, time() + 10);
+	setcookie('warning_msg', $warning_msg, time() + 10);
+	setcookie('error_msg', $error_msg, time() + 10);
+}
+
 // Local Variables:
 // mode: php
 // c-file-style: "bsd"

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/pre.php     |    9 +++------
 src/common/include/session.php |    6 +++---
 src/common/include/utils.php   |   21 ++++++++++++++++++++-
 3 files changed, 26 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list