Change to Horde 4 conventions; autoloading
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 06:20:07 +0000 (23:20 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 06:21:26 +0000 (23:21 -0700)
imp/config/portal.php.dist
imp/lib/Block/Foldersummary.php [new file with mode: 0644]
imp/lib/Block/Newmail.php [new file with mode: 0644]
imp/lib/Block/foldersummary.php [deleted file]
imp/lib/Block/newmail.php [deleted file]

index e60c98d..6e25c02 100644 (file)
@@ -20,16 +20,14 @@ $collection = new Horde_Block_Collection();
 $dimp_block_list = array();
 
 // Show a folder summary of the mailbox.  All polled folders are displayed.
-require_once IMP_BASE . '/lib/Block/foldersummary.php';
 $dimp_block_list[_("Folder Summary")] = array(
-    'ob' => new Horde_Block_imp_foldersummary(array())
+    'ob' => new IMP_Block_Foldersummary(array())
 );
 
 // Alternate DIMP block - shows details of 'msgs_shown' number of the most
 // recent unseen messages.
-//require_once IMP_BASE . '/lib/Block/newmail.php';
 //$dimp_block_list[_("Newest Unseen Messages")] = array(
-//    'ob' => new Horde_Block_imp_newmail(array('msgs_shown' => 3))
+//    'ob' => new IMP_Block_Newmail(array('msgs_shown' => 3))
 //);
 
 // Show a contact search box.
diff --git a/imp/lib/Block/Foldersummary.php b/imp/lib/Block/Foldersummary.php
new file mode 100644 (file)
index 0000000..be1ad27
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+/**
+ * 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.
+ *
+ * @package Horde_Block
+ */
+
+class IMP_Block_Foldersummary extends Horde_Block
+{
+    var $_app = 'imp';
+
+    function _content()
+    {
+        if (!IMP::checkAuthentication(true)) {
+            return '';
+        }
+
+        /* Filter on INBOX display, if requested. */
+        if ($GLOBALS['prefs']->getValue('filter_on_display')) {
+            IMP_Filter::filter('INBOX');
+        }
+
+        /* Get list of mailboxes to poll. */
+        $imptree = &IMP_IMAP_Tree::singleton();
+        $folders = $imptree->getPollList(true, true);
+
+        $anyUnseen = false;
+        $newmsgs = array();
+        $html = '<table cellspacing="0" width="100%">';
+
+        foreach ($folders as $folder) {
+            if (($folder == 'INBOX') ||
+                ($_SESSION['imp']['protocol'] != 'pop')) {
+                $info = $imptree->getElementInfo($folder);
+                if (!empty($info)) {
+                    if (empty($this->_params['show_unread']) ||
+                        !empty($info['unseen'])) {
+                        if (!empty($info['newmsg'])) {
+                            $newmsgs[$folder] = $info['newmsg'];
+                        }
+                        $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'folder:' . htmlspecialchars($folder) . '\');return false;"><td>';
+                        if (!empty($info['unseen'])) {
+                            $html .= '<strong>';
+                            $anyUnseen = true;
+                        }
+                        $html .= '<a>' . IMP::displayFolder($folder) . '</a>';
+                        if (!empty($info['unseen'])) {
+                            $html .= '</strong>';
+                        }
+                        $html .= '</td><td>' .
+                            (!empty($info['unseen']) ? '<strong>' . $info['unseen'] . '</strong>' : '0') .
+                            (!empty($this->_params['show_total']) ? '</td><td>(' . $info['messages'] . ')' : '') .
+                            '</td></tr>';
+                    }
+                }
+            }
+        }
+
+        $html .= '</table>';
+
+        if (count($newmsgs) == 0 && !empty($this->_params['show_unread'])) {
+            if (count($folders) == 0) {
+                $html = _("No folders are being checked for new mail.");
+            } elseif (!$anyUnseen) {
+                $html = '<em>' . _("No folders with unseen messages") . '</em>';
+            } elseif ($GLOBALS['prefs']->getValue('nav_popup')) {
+                $html = '<em>' . _("No folders with new messages") . '</em>';
+            }
+        }
+
+        return $html;
+    }
+
+}
diff --git a/imp/lib/Block/Newmail.php b/imp/lib/Block/Newmail.php
new file mode 100644 (file)
index 0000000..2bdf456
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Copyright 2007-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.
+ *
+ * @package Horde_Block
+ * @author  Michael Slusarz <slusarz@curecanti.org>
+ */
+class IMP_Block_Newmail extends Horde_Block
+{
+    var $_app = 'imp';
+
+    function _content()
+    {
+        $GLOBALS['authentication'] = 'none';
+        require_once dirname(__FILE__) . '/../base.php';
+
+        if (!IMP::checkAuthentication(true)) {
+            return '';
+        }
+
+        /* Filter on INBOX display, if requested. */
+        if ($GLOBALS['prefs']->getValue('filter_on_display')) {
+            IMP_Filter::filter('INBOX');
+        }
+
+        $query = new Horde_Imap_Client_Search_Query();
+        $query->flag('\\seen', false);
+        $ids = $GLOBALS['imp_search']->runSearchQuery($query, 'INBOX', Horde_Imap_Client::SORT_ARRIVAL, 1);
+
+        $html = '<table cellspacing="0" width="100%">';
+        if (empty($ids)) {
+            $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
+        } else {
+            require_once 'Horde/Identity.php';
+
+            $charset = NLS::getCharset();
+            $imp_ui = new IMP_UI_Mailbox('INBOX');
+            $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
+
+            try {
+                $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array(
+                    Horde_Imap_Client::FETCH_ENVELOPE => true
+                ), array('ids' => array_slice($ids, 0, $shown)));
+                reset($fetch_ret);
+            } catch (Horde_Imap_Client_Exception $e) {
+                $fetch_ret = array();
+            }
+
+            while (list($uid, $ob) = each($fetch_ret)) {
+                $date = $imp_ui->getDate($ob['envelope']['date']);
+                $from = $imp_ui->getFrom($ob, array('specialchars' => $charset));
+                $subject = $imp_ui->getSubject($ob['envelope']['subject'], true);
+
+                $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $uid . '\');return false;"><td>' .
+                    '<strong>' . $from['from'] . '</strong><br />' .
+                    $subject . '</td>' .
+                    '<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
+            }
+
+            $more_msgs = count($ids) - $shown;
+            $text = ($more_msgs > 0)
+                ? sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs)
+                : _("Go to your Inbox...");
+            $html .= '<tr><td colspan="2" style="cursor:pointer" align="right" onclick="DimpBase.go(\'folder:INBOX\');return false;">' . $text . '</td></tr>';
+        }
+
+        return $html . '</table>';
+    }
+
+}
diff --git a/imp/lib/Block/foldersummary.php b/imp/lib/Block/foldersummary.php
deleted file mode 100644 (file)
index a6c4eaa..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * 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.
- *
- * @package Horde_Block
- */
-
-class Horde_Block_imp_foldersummary extends Horde_Block
-{
-    var $_app = 'imp';
-
-    function _content()
-    {
-        if (!IMP::checkAuthentication(true)) {
-            return '';
-        }
-
-        /* Filter on INBOX display, if requested. */
-        if ($GLOBALS['prefs']->getValue('filter_on_display')) {
-            IMP_Filter::filter('INBOX');
-        }
-
-        /* Get list of mailboxes to poll. */
-        $imptree = &IMP_IMAP_Tree::singleton();
-        $folders = $imptree->getPollList(true, true);
-
-        $anyUnseen = false;
-        $newmsgs = array();
-        $html = '<table cellspacing="0" width="100%">';
-
-        foreach ($folders as $folder) {
-            if (($folder == 'INBOX') ||
-                ($_SESSION['imp']['protocol'] != 'pop')) {
-                $info = $imptree->getElementInfo($folder);
-                if (!empty($info)) {
-                    if (empty($this->_params['show_unread']) ||
-                        !empty($info['unseen'])) {
-                        if (!empty($info['newmsg'])) {
-                            $newmsgs[$folder] = $info['newmsg'];
-                        }
-                        $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'folder:' . htmlspecialchars($folder) . '\');return false;"><td>';
-                        if (!empty($info['unseen'])) {
-                            $html .= '<strong>';
-                            $anyUnseen = true;
-                        }
-                        $html .= '<a>' . IMP::displayFolder($folder) . '</a>';
-                        if (!empty($info['unseen'])) {
-                            $html .= '</strong>';
-                        }
-                        $html .= '</td><td>' .
-                            (!empty($info['unseen']) ? '<strong>' . $info['unseen'] . '</strong>' : '0') .
-                            (!empty($this->_params['show_total']) ? '</td><td>(' . $info['messages'] . ')' : '') .
-                            '</td></tr>';
-                    }
-                }
-            }
-        }
-
-        $html .= '</table>';
-
-        if (count($newmsgs) == 0 && !empty($this->_params['show_unread'])) {
-            if (count($folders) == 0) {
-                $html = _("No folders are being checked for new mail.");
-            } elseif (!$anyUnseen) {
-                $html = '<em>' . _("No folders with unseen messages") . '</em>';
-            } elseif ($GLOBALS['prefs']->getValue('nav_popup')) {
-                $html = '<em>' . _("No folders with new messages") . '</em>';
-            }
-        }
-
-        return $html;
-    }
-
-}
diff --git a/imp/lib/Block/newmail.php b/imp/lib/Block/newmail.php
deleted file mode 100644 (file)
index c27d7db..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * Re
- * Copyright 2007-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.
- *
- * @package Horde_Block
- * @author  Michael Slusarz <slusarz@curecanti.org>
- */
-class Horde_Block_imp_newmail extends Horde_Block
-{
-    var $_app = 'imp';
-
-    function _content()
-    {
-        $GLOBALS['authentication'] = 'none';
-        require_once dirname(__FILE__) . '/../base.php';
-
-        if (!IMP::checkAuthentication(true)) {
-            return '';
-        }
-
-        /* Filter on INBOX display, if requested. */
-        if ($GLOBALS['prefs']->getValue('filter_on_display')) {
-            IMP_Filter::filter('INBOX');
-        }
-
-        $query = new Horde_Imap_Client_Search_Query();
-        $query->flag('\\seen', false);
-        $ids = $GLOBALS['imp_search']->runSearchQuery($query, 'INBOX', Horde_Imap_Client::SORT_ARRIVAL, 1);
-
-        $html = '<table cellspacing="0" width="100%">';
-        if (empty($ids)) {
-            $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
-        } else {
-            require_once 'Horde/Identity.php';
-
-            $charset = NLS::getCharset();
-            $imp_ui = new IMP_UI_Mailbox('INBOX');
-            $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
-
-            try {
-                $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array(
-                    Horde_Imap_Client::FETCH_ENVELOPE => true
-                ), array('ids' => array_slice($ids, 0, $shown)));
-                reset($fetch_ret);
-            } catch (Horde_Imap_Client_Exception $e) {
-                $fetch_ret = array();
-            }
-
-            while (list($uid, $ob) = each($fetch_ret)) {
-                $date = $imp_ui->getDate($ob['envelope']['date']);
-                $from = $imp_ui->getFrom($ob, array('specialchars' => $charset));
-                $subject = $imp_ui->getSubject($ob['envelope']['subject'], true);
-
-                $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $uid . '\');return false;"><td>' .
-                    '<strong>' . $from['from'] . '</strong><br />' .
-                    $subject . '</td>' .
-                    '<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
-            }
-
-            $more_msgs = count($ids) - $shown;
-            $text = ($more_msgs > 0)
-                ? sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs)
-                : _("Go to your Inbox...");
-            $html .= '<tr><td colspan="2" style="cursor:pointer" align="right" onclick="DimpBase.go(\'folder:INBOX\');return false;">' . $text . '</td></tr>';
-        }
-
-        return $html . '</table>';
-    }
-
-}