From: Michael M Slusarz Date: Wed, 24 Jun 2009 23:38:49 +0000 (-0600) Subject: Notification:: -> Horde_Notification:: X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=19dfab4fe9bbcddaca56cecdf9790b1624bde7df;p=horde.git Notification:: -> Horde_Notification:: --- diff --git a/babel/lib/base.php b/babel/lib/base.php index 5b79ebe5d..eb1627fb6 100644 --- a/babel/lib/base.php +++ b/babel/lib/base.php @@ -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); } diff --git a/chora/lib/base.php b/chora/lib/base.php index cc712adb8..458c51ae8 100644 --- a/chora/lib/base.php +++ b/chora/lib/base.php @@ -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. diff --git a/crumb/lib/base.php b/crumb/lib/base.php index c75ffab39..33fb283aa 100644 --- a/crumb/lib/base.php +++ b/crumb/lib/base.php @@ -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. diff --git a/fima/lib/base.php b/fima/lib/base.php index c0dc84c44..1c4906a44 100644 --- a/fima/lib/base.php +++ b/fima/lib/base.php @@ -42,7 +42,7 @@ if (!defined('FIMA_BASE')) { } // Notification system. -$notification = &Notification::singleton(); +$notification = &Horde_Notification::singleton(); $notification->attach('status'); // Fima base library diff --git a/folks/lib/base.php b/folks/lib/base.php index dd4e00554..5267aacf1 100644 --- a/folks/lib/base.php +++ b/folks/lib/base.php @@ -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 index 000000000..fc578827c --- /dev/null +++ b/imp/lib/Notification/Listener/StatusDimp.php @@ -0,0 +1,80 @@ + + * @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 index 000000000..052d595e1 --- /dev/null +++ b/imp/lib/Notification/Listener/StatusImp.php @@ -0,0 +1,44 @@ + + * @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 '

' . Horde::img('mail_answered.png') . '  ' . $event->getMessage() . '

'; + + case 'imp.forward': + case 'imp.redirect': + return '

' . Horde::img('mail_forwarded.png') . '  ' . $event->getMessage() . '

'; + } + + 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 index 0bf46dcf7..000000000 --- a/imp/lib/Notification/Listener/status-dimp.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @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 index 83f9025e5..000000000 --- a/imp/lib/Notification/Listener/status.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @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 '

' . Horde::img('mail_answered.png') . '  ' . $event->getMessage() . '

'; - - case 'imp.forward': - case 'imp.redirect': - return '

' . Horde::img('mail_forwarded.png') . '  ' . $event->getMessage() . '

'; - } - - return parent::getMessage($message); - } - -} diff --git a/imp/lib/base.php b/imp/lib/base.php index ac925d658..aaadec71e 100644 --- a/imp/lib/base.php +++ b/imp/lib/base.php @@ -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'); } diff --git a/ingo/lib/base.php b/ingo/lib/base.php index b9b45dfd3..b2d9d629c 100644 --- a/ingo/lib/base.php +++ b/ingo/lib/base.php @@ -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. diff --git a/jeta/lib/base.php b/jeta/lib/base.php index 93858d948..61976533a 100644 --- a/jeta/lib/base.php +++ b/jeta/lib/base.php @@ -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. diff --git a/kastalia/lib/base.php b/kastalia/lib/base.php index bbf2e9e4c..7eeb5008e 100755 --- a/kastalia/lib/base.php +++ b/kastalia/lib/base.php @@ -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. diff --git a/koward/lib/Koward.php b/koward/lib/Koward.php index 7c325ea2c..c6bafc61c 100644 --- a/koward/lib/Koward.php +++ b/koward/lib/Koward.php @@ -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 index 000000000..91958a30f --- /dev/null +++ b/kronolith/lib/Notification/Listener/Status.php @@ -0,0 +1,81 @@ + + * @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 index ec792d60e..000000000 --- a/kronolith/lib/Notification/Listener/status.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @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; - } - -} diff --git a/kronolith/lib/base.php b/kronolith/lib/base.php index ca3348bef..5b3f6dc74 100644 --- a/kronolith/lib/base.php +++ b/kronolith/lib/base.php @@ -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'; diff --git a/news/lib/base.php b/news/lib/base.php index 5fae630a5..a22f0e4a2 100644 --- a/news/lib/base.php +++ b/news/lib/base.php @@ -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. diff --git a/skoli/lib/base.php b/skoli/lib/base.php index 6d208e171..6f31e129e 100644 --- a/skoli/lib/base.php +++ b/skoli/lib/base.php @@ -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.