keep undisplayed messages over redirects
When act_redirect is executed (post data was received and mode show is called) all undisplayed messages (from calls to msg()) are saved in the session now. These messages are then revived in inc/init.php. This makes sure no errors that occured before the redirect are lost. darcs-hash:20080929203831-7ad00-d0869fd3093f57c1ea64ccbaf05d7fd98f68c5e1.gz
This commit is contained in:
parent
7fe75c1e16
commit
14a122de54
|
@ -312,9 +312,24 @@ function act_save($act){
|
|||
return 'show';
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a redirect after receiving post data
|
||||
*
|
||||
* Tries to add the section id as hash mark after section editing
|
||||
*/
|
||||
function act_redirect($id,$preact){
|
||||
global $PRE;
|
||||
global $TEXT;
|
||||
global $MSG;
|
||||
|
||||
//are there any undisplayed messages? keep them in session for display
|
||||
//on the next page
|
||||
if(isset($MSG) && count($MSG)){
|
||||
//reopen session, store data and close session again
|
||||
@session_start();
|
||||
$_SESSION[DOKU_COOKIE]['msg'] = $MSG;
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
//get section name when coming from section edit
|
||||
if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){
|
||||
|
|
|
@ -118,6 +118,12 @@
|
|||
session_set_cookie_params(0,DOKU_REL,'',($conf['securecookie'] && is_ssl()));
|
||||
}
|
||||
session_start();
|
||||
|
||||
// load left over messages
|
||||
if(isset($_SESSION[DOKU_COOKIE]['msg'])){
|
||||
$MSG = $_SESSION[DOKU_COOKIE]['msg'];
|
||||
unset($_SESSION[DOKU_COOKIE]['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
// kill magic quotes
|
||||
|
|
Loading…
Reference in New Issue