diff options
author | Dominik Eckelmann <deckelmann@gmail.com> | 2010-06-24 14:26:15 +0200 |
---|---|---|
committer | Adrian Lang <lang@cosmocode.de> | 2010-06-24 14:36:50 +0200 |
commit | 69266de50f71b3d43011378cf0b0e8b8185c3609 (patch) | |
tree | 2ecb5aa85b7d02012bc0dbb4edb4346b45e5e5ea | |
parent | b0f6db0c1350beb85dcff044dc2770f404a1b540 (diff) | |
download | rpg-69266de50f71b3d43011378cf0b0e8b8185c3609.tar.gz rpg-69266de50f71b3d43011378cf0b0e8b8185c3609.tar.bz2 |
fixed handling of MSG
msg() now stores always the message to the MSG array until headers are
sent. After this, a call of msg will print out all messages from the MSG
array immediately through html_msgarea.
This prevents double posting and losses of messages from the MSG array.
-rw-r--r-- | inc/infoutils.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/inc/infoutils.php b/inc/infoutils.php index 32baa9450..096662d24 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -265,17 +265,15 @@ function msg($message,$lvl=0,$line='',$file=''){ if($line || $file) $message.=' ['.basename($file).':'.$line.']'; - if(!headers_sent()){ - if(!isset($MSG)) $MSG = array(); - $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); - }else{ - $MSG = array(); - $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + if(!isset($MSG)) $MSG = array(); + $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + if(headers_sent()){ if(function_exists('html_msgarea')){ html_msgarea(); }else{ print "ERROR($lvl) $message"; } + unset($GLOBALS['MSG']); } } |