-function display_messages(&$tem = NULL) {
- if(!$GLOBALS['wfpl_messages']) return;
- foreach($GLOBALS['wfpl_messages'] as $msg) {
- $sub = array('text' => $msg);
- $GLOBALS['wfpl_tem_data']['message'][] = $sub;
- $GLOBALS['wfpl_tem_data']['messages'] = TRUE;
+function get_messages() {
+ if(!isset($GLOBALS['wfpl_messages'])) {
+ $messages = array();
+ } else {
+ $messages = $GLOBALS['wfpl_messages'];
+ unset($GLOBALS['wfpl_messages']);
+ }
+
+ if(function_exists('session_restore_messages')) {
+ $messages = array_merge(session_restore_messages(), $messages);
+ }
+
+ return $messages;
+}
+
+# for old-style templates
+function display_messages(&$tem = NULL, $key = 'wfpl_messages') {
+ if($tem) {
+ $tem->data[$key] = columnize(get_messages());
+ } else {
+ $GLOBALS['wfpl_template']->data[$key] = columnize(get_messages());