aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/notification.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/notification.php')
-rw-r--r--engine/lib/notification.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index fd4f3a9d0..f8b41cdd1 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -47,7 +47,7 @@
/**
* Send a notification message using a pre-registered method.
*
- * @param string $method The method used
+ * @param mixed $method The method used as a string, or an array if multiple methods should be used.
* @param mixed $to Either a guid or an array of guid's to notify
* @param string $message A message
* @param array $params Optional method specific parameters as an associative array, for example "subject", "from"
@@ -62,18 +62,24 @@
if (!is_array($to))
$to = (int)$to;
- if ($method=="")
+ if (!$method)
throw new NotificationException("No notification method specified.");
+ if (!is_array($method))
+ $method = array($method);
+
if ((!array_key_exists($method, $NOTIFICATION_HANDLERS)) || (!is_callable($NOTIFICATION_HANDLERS[$method])))
throw new NotificationExceptions("No handler found for '$method' or it was not callable.");
if (!is_array($to))
$to = array($to);
- foreach ($to as $guid)
- if (!$NOTIFICATION_HANDLERS[$method]($guid, sanitise_string($method), $params))
+ foreach ($to as $guid)
+ {
+ foreach ($method as $m)
+ if (!$NOTIFICATION_HANDLERS[$m]($guid, sanitise_string($m), $params))
throw new NotificationException("There was an error while notifying $guid");
+ }
return true;
}