Skip to content
Snippets Groups Projects
Commit 4abebd3f authored by Graham Cole's avatar Graham Cole
Browse files

add a new function to save a message flash in the session data to be displayed...

add a new function to save a message flash in the session data to be displayed on the next page load (e.g. when we're doing post/redirect/get)
parent 55ed4fde
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,13 @@ function message_flash($message) {
$messages['info'][] = $message;
}
function message_flash_postponed($message) {
global $session;
$session->data['messages']['info'][] = $message;
$session->save();
}
set_error_handler("handle_messages", (E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE));
// empty messages array was causing PHP to spew notices
......
......@@ -153,6 +153,18 @@ private $datahash=''; // hash of data field
// update time stamp
$DB->Execute( "update {$this->table} set lastseen=NOW() where hash=?", array($this->token));
// check to see if there any messages stored for this user
if (isset($this->data['messages'])) {
global $messages;
if (is_array($messages)) {
$messages += $this->data['messages'];
} else {
$messages = $this->data['messages'];
}
unset($this->data['messages']);
$this->save();
}
}
// generate a string suitable to be used as a session ID
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment