Commit e8c7d2e0 authored by Dries's avatar Dries

- Made it possible to set and display multiple status messages.  Modified patch by
  Kjartan.
parent f6cae094
...@@ -34,17 +34,16 @@ function drupal_get_title() { ...@@ -34,17 +34,16 @@ function drupal_get_title() {
* @{ * @{
*/ */
function drupal_set_message($message = NULL, $type = "status") { function drupal_set_message($message = NULL, $type = "status") {
static $stored_message; static $stored_message = array();
if (isset($message)) { if (isset($message)) {
$stored_message->message = $message; $stored_message[] = array($message, $type);
$stored_message->type = $type;
} }
return $stored_message; return $stored_message;
} }
function drupal_get_message() { function drupal_get_messages() {
return drupal_set_message(); return drupal_set_message();
} }
// @} // @}
...@@ -437,7 +436,6 @@ function valid_input_data($data) { ...@@ -437,7 +436,6 @@ function valid_input_data($data) {
// check attributes: // check attributes:
$match += preg_match("/\W(dynsrc|datasrc|data|lowsrc|on[a-z]+)\s*=[^>]+?>/i", $data); $match += preg_match("/\W(dynsrc|datasrc|data|lowsrc|on[a-z]+)\s*=[^>]+?>/i", $data);
// check tags: // check tags:
$match += preg_match("/<\s*(applet|script|object|style|embed|form|blink|meta|html|frame|iframe|layer|ilayer|head|frameset|xml)/i", $data); $match += preg_match("/<\s*(applet|script|object|style|embed|form|blink|meta|html|frame|iframe|layer|ilayer|head|frameset|xml)/i", $data);
......
<?php <?php
// $Id$ // $Id$
function chameleon_help($section) { function chameleon_help($section) {
...@@ -66,8 +65,9 @@ function chameleon_header($title = "") { ...@@ -66,8 +65,9 @@ function chameleon_header($title = "") {
$output .= "<small>$help</small><hr />"; $output .= "<small>$help</small><hr />";
} }
if ($message = drupal_get_message()) { foreach (drupal_get_messages() as $message) {
$output .= "<strong>". t("Status") ."</strong>: ". $message->message ."<hr />"; list($message, $type) = $message;
$output .= "<strong>". t("Status") ."</strong>: $message<hr />";
} }
return $output; return $output;
......
...@@ -65,8 +65,9 @@ function marvin_header() { ...@@ -65,8 +65,9 @@ function marvin_header() {
$output .= "<small>$help</small><hr />"; $output .= "<small>$help</small><hr />";
} }
if ($message = drupal_get_message()) { foreach (drupal_get_messages() as $message) {
$output .= "<strong>". t("Status") ."</strong>: ". $message->message ."<hr />"; list($message, $type) = $message;
$output .= "<strong>". t("Status") ."</strong>: $message<hr />";
} }
return $output; return $output;
......
...@@ -111,9 +111,10 @@ function xtemplate_header() { ...@@ -111,9 +111,10 @@ function xtemplate_header() {
$xtemplate->template->parse("header.help"); $xtemplate->template->parse("header.help");
} }
if ($message = drupal_get_message()) { foreach (drupal_get_messages() as $message) {
$xtemplate->template->assign("message", ucfirst($message->message)); list($message, $type) = $message;
$xtemplate->template->assign("type", $message->type); $xtemplate->template->assign("message", ucfirst($message));
$xtemplate->template->assign("type", $type);
$xtemplate->template->parse("header.message"); $xtemplate->template->parse("header.message");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment