Notification:: -> Horde_Notification::
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 24 Jun 2009 23:38:49 +0000 (17:38 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 24 Jun 2009 23:38:49 +0000 (17:38 -0600)
19 files changed:
babel/lib/base.php
chora/lib/base.php
crumb/lib/base.php
fima/lib/base.php
folks/lib/base.php
imp/lib/Notification/Listener/StatusDimp.php [new file with mode: 0644]
imp/lib/Notification/Listener/StatusImp.php [new file with mode: 0644]
imp/lib/Notification/Listener/status-dimp.php [deleted file]
imp/lib/Notification/Listener/status.php [deleted file]
imp/lib/base.php
ingo/lib/base.php
jeta/lib/base.php
kastalia/lib/base.php
koward/lib/Koward.php
kronolith/lib/Notification/Listener/Status.php [new file with mode: 0644]
kronolith/lib/Notification/Listener/status.php [deleted file]
kronolith/lib/base.php
news/lib/base.php
skoli/lib/base.php

index 5b79ebe..eb1627f 100644 (file)
@@ -23,7 +23,7 @@ if (!defined('BABEL_BASE')) {
 require_once HORDE_BASE . '/lib/core.php';
 
 /* Notification system. */
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 /* Registry. */
@@ -31,7 +31,7 @@ $registry = &Registry::singleton();
 
 if (is_a(($pushed = $registry->pushApp('babel', !defined('AUTH_HANDLER'))), 'PEAR_Error')) {
     if ($pushed->getCode() == 'permission_denied') {
-        Horde::authenticationFailureRedirect(); 
+        Horde::authenticationFailureRedirect();
     }
     Horde::fatal($pushed, __FILE__, __LINE__, false);
 }
index cc712ad..458c51a 100644 (file)
@@ -41,7 +41,7 @@ $conf = &$GLOBALS['conf'];
 define('CHORA_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Chora base library.
index c75ffab..33fb283 100644 (file)
@@ -34,7 +34,7 @@ $conf = &$GLOBALS['conf'];
 @define('CRUMB_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Define the base file path of Crumb.
index c0dc84c..1c4906a 100644 (file)
@@ -42,7 +42,7 @@ if (!defined('FIMA_BASE')) {
 }
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Fima base library
index dd4e005..5267aac 100644 (file)
@@ -29,7 +29,7 @@ $conf = &$GLOBALS['conf'];
 define('FOLKS_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Define the base file path of Folks.
diff --git a/imp/lib/Notification/Listener/StatusDimp.php b/imp/lib/Notification/Listener/StatusDimp.php
new file mode 100644 (file)
index 0000000..fc57882
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * The IMP_Notification_Listener_StatusDimp:: class extends the
+ * IMP_Notification_Listener_StatusImp:: class to return all messages instead
+ * of printing them.
+ *
+ * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Jan Schneider <jan@horde.org>
+ * @package Horde_Notification
+ */
+class IMP_Notification_Listener_StatusDimp extends IMP_Notification_Listener_StatusImp
+{
+    /**
+     * The notified message stack.
+     *
+     * @var array
+     */
+    protected $_messageStack = array();
+
+    /**
+     * Returns all status message if there are any on the 'status' message
+     * stack.
+     *
+     * @param array &$messageStack  The stack of messages.
+     * @param array $options        An array of options.
+     */
+    public function notify(&$messageStack, $options = array())
+    {
+        while ($message = array_shift($messageStack)) {
+            $event = @unserialize($message['event']);
+            $this->_messageStack[] = array('type' => $message['type'],
+                                           'flags' => $message['flags'],
+                                           'message' => is_object($event)
+                                               ? $event->getMessage()
+                                               : null);
+        }
+    }
+
+    /**
+     * Handle every message of type dimp.*; otherwise delegate back to
+     * the parent.
+     *
+     * @param string $type  The message type in question.
+     *
+     * @return boolean  Whether this listener handles the type.
+     */
+    public function handles($type)
+    {
+        return (substr($type, 0, 5) == 'dimp.') || parent::handles($type);
+    }
+
+    /**
+     * Returns the message stack.
+     * To return something useful, notify() needs to be called first.
+     *
+     * @param boolean $encode  Encode HTML entities?
+     *
+     * @return array  List of message hashes.
+     */
+    public function getStack($encode = false)
+    {
+        $msgs = $this->_messageStack;
+        if (!$encode) {
+            return $msgs;
+        }
+
+        for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
+            if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
+                $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
+            }
+        }
+
+        return $msgs;
+    }
+
+}
diff --git a/imp/lib/Notification/Listener/StatusImp.php b/imp/lib/Notification/Listener/StatusImp.php
new file mode 100644 (file)
index 0000000..052d595
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * The IMP_Notification_Listener_StatusImp:: class extends the
+ * Notification_Listener_status:: class to display the messages for
+ * IMP's special message types 'imp.forward' and 'imp.reply'.
+ *
+ * @author  Chuck Hagenbuch <chuck@horde.org>
+ * @package Horde_Notification
+ */
+class IMP_Notification_Listener_StatusImp extends Horde_Notification_Listener_Status
+{
+    /**
+     * Constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->_handles['imp.reply'] = true;
+        $this->_handles['imp.forward'] = true;
+        $this->_handles['imp.redirect'] = true;
+    }
+
+    /**
+     * Outputs one message if it's an IMP message or calls the parent
+     * method otherwise.
+     *
+     * @param array $message  One message hash from the stack.
+     */
+    public function getMessage($message)
+    {
+        $event = $this->getEvent($message);
+        switch ($message['type']) {
+        case 'imp.reply':
+            return '<p class="notice">' . Horde::img('mail_answered.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';
+
+        case 'imp.forward':
+        case 'imp.redirect':
+            return '<p class="notice">' . Horde::img('mail_forwarded.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';
+        }
+
+        return parent::getMessage($message);
+    }
+
+}
diff --git a/imp/lib/Notification/Listener/status-dimp.php b/imp/lib/Notification/Listener/status-dimp.php
deleted file mode 100644 (file)
index 0bf46dc..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-require_once IMP_BASE . '/lib/Notification/Listener/status.php';
-require_once 'Horde/Notification/Event.php';
-
-/**
- * The Notification_Listener_status_dimp:: class extends the
- * Notification_Listener_status_imp:: class to return all messages instead of
- * printing them.
- *
- * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author  Jan Schneider <jan@horde.org>
- * @package Horde_Notification
- */
-class Notification_Listener_status_dimp extends Notification_Listener_status_imp {
-
-    /**
-     * The notified message stack.
-     *
-     * @var array
-     */
-    var $_messageStack = array();
-
-    /**
-     * Returns all status message if there are any on the 'status' message
-     * stack.
-     *
-     * @param array &$messageStack  The stack of messages.
-     * @param array $options        An array of options.
-     */
-    function notify(&$messageStack, $options = array())
-    {
-        while ($message = array_shift($messageStack)) {
-            $event = @unserialize($message['event']);
-            $this->_messageStack[] = array('type' => $message['type'],
-                                           'flags' => $message['flags'],
-                                           'message' => is_object($event)
-                                               ? $event->getMessage()
-                                               : null);
-        }
-    }
-
-    /**
-     * Handle every message of type dimp.*; otherwise delegate back to
-     * the parent.
-     *
-     * @param string $type  The message type in question.
-     *
-     * @return boolean  Whether this listener handles the type.
-     */
-    function handles($type)
-    {
-        if (substr($type, 0, 5) == 'dimp.') {
-            return true;
-        }
-        return parent::handles($type);
-    }
-
-    /**
-     * Returns the message stack.
-     * To return something useful, notify() needs to be called first.
-     *
-     * @param boolean $encode  Encode HTML entities?
-     *
-     * @return array  List of message hashes.
-     */
-    function getStack($encode = false)
-    {
-        $msgs = $this->_messageStack;
-        if (!$encode) {
-            return $msgs;
-        }
-
-        for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
-            if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
-                $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
-            }
-        }
-
-        return $msgs;
-    }
-
-}
diff --git a/imp/lib/Notification/Listener/status.php b/imp/lib/Notification/Listener/status.php
deleted file mode 100644 (file)
index 83f9025..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-require_once 'Horde/Notification/Listener/status.php';
-
-/**
- * The Notification_Listener_status_imp:: class extends the
- * Notification_Listener_status:: class to display the messages for
- * IMP's special message types 'imp.forward' and 'imp.reply'.
- *
- * @author  Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Notification
- */
-class Notification_Listener_status_imp extends Notification_Listener_status {
-
-    /**
-     * Constructor
-     */
-    function Notification_Listener_status_imp()
-    {
-        parent::Notification_Listener_status();
-        $this->_handles['imp.reply'] = true;
-        $this->_handles['imp.forward'] = true;
-        $this->_handles['imp.redirect'] = true;
-    }
-
-    /**
-     * Outputs one message if it's an IMP message or calls the parent
-     * method otherwise.
-     *
-     * @param array $message  One message hash from the stack.
-     */
-    function getMessage($message)
-    {
-        $event = $this->getEvent($message);
-        switch ($message['type']) {
-        case 'imp.reply':
-            return '<p class="notice">' . Horde::img('mail_answered.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';
-
-        case 'imp.forward':
-        case 'imp.redirect':
-            return '<p class="notice">' . Horde::img('mail_forwarded.png') . '&nbsp;&nbsp;' . $event->getMessage() . '</p>';
-        }
-
-        return parent::getMessage($message);
-    }
-
-}
index ac925d6..aaadec7 100644 (file)
@@ -19,7 +19,7 @@
  * Global variables defined:
  *   $imp_imap    - An IMP_Imap object
  *   $imp_mbox    - Current mailbox information
- *   $imp_notify  - A Notification_Listener_Mobile object
+ *   $imp_notify  - A Horde_Notification_Listener object
  *   $imp_search  - An IMP_Search object
  *   $mimp_render - (MIMP view only) A Horde_Mobile object
  *
@@ -161,18 +161,14 @@ if (($viewmode == 'dimp') && Horde_Util::nonInputVar('dimp_logout')) {
 }
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 if (($viewmode == 'mimp') ||
     (Horde_Util::nonInputVar('login_page') && $GLOBALS['browser']->isMobile())) {
-    require_once 'Horde/Notification/Listener/mobile.php';
-    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'Notification_Listener_mobile');
+    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'Horde_Notification_Listener_Mobile');
 } elseif ($viewmode == 'dimp') {
-    require_once IMP_BASE . '/lib/Notification/Listener/status-dimp.php';
-    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'Notification_Listener_status_dimp');
+    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'IMP_Notification_Listener_DimpStatus');
 } else {
-    require_once IMP_BASE . '/lib/Notification/Listener/status.php';
-    require_once 'Horde/Notification/Listener/audio.php';
-    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'Notification_Listener_status_imp');
+    $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'IMP_Notification_Listener_ImpStatus');
     $notification->attach('audio');
 }
 
index b9b45df..b2d9d62 100644 (file)
@@ -33,7 +33,7 @@ if (!defined('INGO_TEMPLATES')) {
 }
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Redirect the user to the Horde login page if they haven't authenticated.
index 93858d9..6197653 100644 (file)
@@ -38,7 +38,7 @@ $conf = &$GLOBALS['conf'];
 define('JETA_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Includes.
index bbf2e9e..7eeb500 100755 (executable)
@@ -31,7 +31,7 @@ $conf = &$GLOBALS['conf'];
 @define('KASTALIA_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Define the base file path of Kastalia.
index 7c325ea..c6bafc6 100644 (file)
@@ -56,10 +56,9 @@ class Koward {
         include_once 'Horde/NLS.php';
         include_once 'Horde/Auth.php';
         include_once 'Horde/Perms.php';
-        include_once 'Horde/Notification.php';
         include_once 'Horde/Registry.php';
 
-        $notification = Notification::singleton();
+        $notification = &Horde_Notification::singleton();
         $notification->attach('status');
 
         $registry = Registry::singleton();
diff --git a/kronolith/lib/Notification/Listener/Status.php b/kronolith/lib/Notification/Listener/Status.php
new file mode 100644 (file)
index 0000000..91958a3
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * The Kronolith_Notification_Listener_Status:: class extends the
+ * Horde_Notification_Listener_Status:: class to return all messages instead
+ * of printing them.
+ *
+ * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @todo    Move this into Notification core functionality
+ * @author  Jan Schneider <jan@horde.org>
+ * @package Horde_Notification
+ */
+class Kronolith_Notification_Listener_Status extends Horde_Notification_Listener_Status
+{
+    /**
+     * The notified message stack.
+     *
+     * @var array
+     */
+    protected $_messageStack = array();
+
+    /**
+     * Returns all status message if there are any on the 'status' message
+     * stack.
+     *
+     * @param array &$messageStack  The stack of messages.
+     * @param array $options        An array of options.
+     */
+    public function notify(&$messageStack, $options = array())
+    {
+        while ($message = array_shift($messageStack)) {
+            $event = @unserialize($message['event']);
+            $this->_messageStack[] = array('type' => $message['type'],
+                                           'flags' => $message['flags'],
+                                           'message' => is_object($event)
+                                               ? $event->getMessage()
+                                               : null);
+        }
+    }
+
+    /**
+     * Handle every message of type dimp.*; otherwise delegate back to
+     * the parent.
+     *
+     * @param string $type  The message type in question.
+     *
+     * @return boolean  Whether this listener handles the type.
+     */
+    public function handles($type)
+    {
+        return (substr($type, 0, 10) == 'kronolith.') || parent::handles($type);
+    }
+
+    /**
+     * Returns the message stack.
+     * To return something useful, notify() needs to be called first.
+     *
+     * @param boolean $encode  Encode HTML entities?
+     *
+     * @return array  List of message hashes.
+     */
+    public function getStack($encode = false)
+    {
+        $msgs = $this->_messageStack;
+        if (!$encode) {
+            return $msgs;
+        }
+
+        for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
+            if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
+                $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
+            }
+        }
+
+        return $msgs;
+    }
+
+}
diff --git a/kronolith/lib/Notification/Listener/status.php b/kronolith/lib/Notification/Listener/status.php
deleted file mode 100644 (file)
index ec792d6..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-require_once 'Horde/Notification/Listener/status.php';
-require_once 'Horde/Notification/Event.php';
-
-/**
- * The Notification_Listener_status_kronolith:: class extends the
- * Notification_Listener_status:: class to return all messages instead of
- * printing them.
- *
- * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @todo    Move this into Notification core functionality
- * @author  Jan Schneider <jan@horde.org>
- * @package Horde_Notification
- */
-class Notification_Listener_status_kronolith extends Notification_Listener_status {
-
-    /**
-     * The notified message stack.
-     *
-     * @var array
-     */
-    var $_messageStack = array();
-
-    /**
-     * Returns all status message if there are any on the 'status' message
-     * stack.
-     *
-     * @param array &$messageStack  The stack of messages.
-     * @param array $options        An array of options.
-     */
-    function notify(&$messageStack, $options = array())
-    {
-        while ($message = array_shift($messageStack)) {
-            $event = @unserialize($message['event']);
-            $this->_messageStack[] = array('type' => $message['type'],
-                                           'flags' => $message['flags'],
-                                           'message' => is_object($event)
-                                               ? $event->getMessage()
-                                               : null);
-        }
-    }
-
-    /**
-     * Handle every message of type dimp.*; otherwise delegate back to
-     * the parent.
-     *
-     * @param string $type  The message type in question.
-     *
-     * @return boolean  Whether this listener handles the type.
-     */
-    function handles($type)
-    {
-        if (substr($type, 0, 10) == 'kronolith.') {
-            return true;
-        }
-        return parent::handles($type);
-    }
-
-    /**
-     * Returns the message stack.
-     * To return something useful, notify() needs to be called first.
-     *
-     * @param boolean $encode  Encode HTML entities?
-     *
-     * @return array  List of message hashes.
-     */
-    function getStack($encode = false)
-    {
-        $msgs = $this->_messageStack;
-        if (!$encode) {
-            return $msgs;
-        }
-
-        for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
-            if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
-                $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
-            }
-        }
-
-        return $msgs;
-    }
-
-}
index ca3348b..5b3f6dc 100644 (file)
@@ -38,9 +38,8 @@ $conf = &$GLOBALS['conf'];
 define('KRONOLITH_TEMPLATES', $registry->get('templates'));
 
 /* Notification system. */
-$notification = &Notification::singleton();
-require_once KRONOLITH_BASE . '/lib/Notification/Listener/status.php';
-$GLOBALS['kronolith_notify'] = &$notification->attach('status', null, 'Notification_Listener_status_kronolith');
+$notification = &Horde_Notification::singleton();
+$GLOBALS['kronolith_notify'] = &$notification->attach('status', null, 'Kronolith_Notification_Listener_Status');
 
 /* Kronolith base library. */
 require_once KRONOLITH_BASE . '/lib/Kronolith.php';
index 5fae630..a22f0e4 100644 (file)
@@ -34,7 +34,7 @@ $conf = &$GLOBALS['conf'];
 define('NEWS_TEMPLATES', $registry->get('templates'));
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Define the base file path of News.
index 6d208e1..6f31e12 100644 (file)
@@ -32,7 +32,7 @@ $conf = &$GLOBALS['conf'];
 require_once 'Horde/History.php';
 
 // Notification system.
-$notification = &Notification::singleton();
+$notification = &Horde_Notification::singleton();
 $notification->attach('status');
 
 // Define the base file path of Skoli.