Replace all Identity.php requires with a single, easily removable require in base.php
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Jul 2009 21:26:03 +0000 (15:26 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 19 Jul 2009 01:21:25 +0000 (19:21 -0600)
22 files changed:
imp/attachment.php
imp/compose-dimp.php
imp/compose-mimp.php
imp/compose.php
imp/lib/Block/Newmail.php
imp/lib/Compose.php
imp/lib/Crypt/Pgp.php
imp/lib/Crypt/Smime.php
imp/lib/IMP.php
imp/lib/Imap/Flags.php
imp/lib/Imap/Tree.php
imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php
imp/lib/LoginTasks/Task/PurgeSentmail.php
imp/lib/LoginTasks/Task/RenameSentmailMonthly.php
imp/lib/Mime/Viewer/Itip.php
imp/lib/Spam.php
imp/lib/Views/Compose.php
imp/lib/Views/ListMessages.php
imp/lib/base.php
imp/message-mimp.php
imp/message.php
imp/pgp.php

index e1b6d87..f09ab74 100644 (file)
@@ -77,7 +77,6 @@ if ($conf['compose']['link_attachments_notify']) {
             $prefs = Prefs::singleton($conf['prefs']['driver'], 'horde', $mail_user);
             $prefs->retrieve();
 
-            include_once 'Horde/Identity.php';
             $mail_identity = Identity::singleton('none', $mail_user);
             $mail_address = $mail_identity->getDefaultFromAddress();
 
index a645b80..b515ba1 100644 (file)
@@ -40,7 +40,6 @@ $action = Horde_Util::getFormData('action');
 $get_sig = true;
 $msg = '';
 
-require_once 'Horde/Identity.php';
 $identity = Identity::singleton(array('imp', 'imp'));
 if (!$prefs->isLocked('default_identity')) {
     $identity_id = Horde_Util::getFormData('identity');
index db4bad1..4e6858d 100644 (file)
@@ -27,7 +27,6 @@ function _getIMPContents($index, $mailbox)
 }
 
 require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Identity.php';
 
 /* The message text and headers. */
 $msg = '';
index 4e01364..690f9cd 100644 (file)
@@ -59,7 +59,6 @@ function _getIMPContents($index, $mailbox)
 $compose_page = true;
 $session_control = 'netscape';
 require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Identity.php';
 
 /* The message headers and text. */
 $header = array();
index a88d922..db755be 100644 (file)
@@ -35,8 +35,6 @@ class IMP_Block_Newmail extends Horde_Block
         if (empty($ids)) {
             $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
         } else {
-            require_once 'Horde/Identity.php';
-
             $charset = Horde_Nls::getCharset();
             $imp_ui = new IMP_UI_Mailbox('INBOX');
             $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
index b71b739..245fdac 100644 (file)
@@ -323,7 +323,6 @@ class IMP_Compose
         $identity_id = null;
         $headers = $contents->getHeaderOb();
         if (($fromaddr = Horde_Mime_Address::bareAddress($headers->getValue('from')))) {
-            require_once 'Horde/Identity.php';
             $identity = Identity::singleton(array('imp', 'imp'));
             $identity_id = $identity->getMatchingIdentity($fromaddr);
         }
@@ -1229,7 +1228,6 @@ class IMP_Compose
 
         if (in_array($actionID, array('reply_all', '*'))) {
             /* Filter out our own address from the addresses we reply to. */
-            require_once 'Horde/Identity.php';
             $identity = Identity::singleton(array('imp', 'imp'));
             $all_addrs = array_keys($identity->getAllFromAddresses(true));
 
@@ -1448,7 +1446,6 @@ class IMP_Compose
             $msgAddresses[] = $h->getValue($val);
         }
 
-        require_once 'Horde/Identity.php';
         $user_identity = Identity::singleton(array('imp', 'imp'));
         return $user_identity->getMatchingIdentity($msgAddresses);
     }
index 1c77857..6f4db8c 100644 (file)
@@ -187,7 +187,6 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp
             /* TODO: Retrieve by ID. */
 
             /* See if the address points to the user's public key. */
-            require_once 'Horde/Identity.php';
             $identity = Identity::singleton(array('imp', 'imp'));
             $personal_pubkey = $this->getPersonalPublicKey();
             if (!empty($personal_pubkey) && $identity->hasAddress($address)) {
index 0b3392e..fc078e1 100644 (file)
@@ -168,7 +168,6 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime
             $key = $GLOBALS['registry']->call('contacts/getField', array($address, self::PUBKEY_FIELD, $params['sources'], false, true));
         } catch (Horde_Exception $e) {
             /* See if the address points to the user's public key. */
-            require_once 'Horde/Identity.php';
             $identity = Identity::singleton(array('imp', 'imp'));
             $personal_pubkey = $this->getPersonalPublicKey();
             if (!empty($personal_pubkey) && $identity->hasAddress($address)) {
index f8b0d4e..1176e7c 100644 (file)
@@ -1171,7 +1171,6 @@ class IMP
     static public function isSpecialFolder($mbox)
     {
         /* Get the identities. */
-        require_once 'Horde/Identity.php';
         $identity = Identity::singleton(array('imp', 'imp'));
 
         return (($mbox == self::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)) || in_array($mbox, $identity->getAllSentmailFolders()));
index 5e42950..5895b20 100644 (file)
@@ -264,7 +264,6 @@ class IMP_Imap_Flags
 
         if (isset($options['personal'])) {
             if (is_array($options['personal'])) {
-                require_once 'Horde/Identity.php';
                 $identity = Identity::singleton(array('imp', 'imp'));
                 foreach ($options['personal'] as $val) {
                     if ($identity->hasAddress($val['inner'])) {
index ef48dae..6566f9c 100644 (file)
@@ -1796,7 +1796,6 @@ class IMP_Imap_Tree
         global $prefs, $registry;
 
         /* Initialize the user's identities. */
-        require_once 'Horde/Identity.php';
         $identity = Identity::singleton(array('imp', 'imp'));
 
         return array(
index 1374425..26f600a 100644 (file)
@@ -34,7 +34,6 @@ class IMP_LoginTasks_Task_DeleteSentmailMonthly extends Horde_LoginTasks_Task
         /* Get list of all folders, parse through and get the list of all
            old sent-mail folders. Then sort this array according to
            the date. */
-        include_once 'Horde/Identity.php';
         $identity = Identity::singleton(array('imp', 'imp'));
         $imp_folder = IMP_Folder::singleton();
         $sent_mail_folders = $identity->getAllSentmailFolders();
index 335560e..11b08d8 100644 (file)
@@ -96,7 +96,6 @@ class IMP_LoginTasks_Task_PurgeSentmail extends Horde_LoginTasks_Task
      */
     protected function _getFolders()
     {
-        require_once 'Horde/Identity.php';
         return Identity::singleton(array('imp', 'imp'))->getAllSentmailfolders();
     }
 
index edefdc3..0f03d5a 100644 (file)
@@ -33,8 +33,6 @@ class IMP_LoginTasks_Task_RenameSentmailMonthly extends Horde_LoginTasks_Task
     {
         $success = true;
 
-        include_once 'Horde/Identity.php';
-
         $identity = Identity::singleton(array('imp', 'imp'));
         $imp_folder = IMP_Folder::singleton();
 
@@ -66,7 +64,6 @@ class IMP_LoginTasks_Task_RenameSentmailMonthly extends Horde_LoginTasks_Task
      */
     public function describe()
     {
-        include_once 'Horde/Identity.php';
         $identity = Identity::singleton(array('imp', 'imp'));
 
         $new_folders = $old_folders = array();
index a8df9af..6f6a8d7 100644 (file)
@@ -230,8 +230,6 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver
                     $organizer = $vEvent->getAttribute('ORGANIZER', true);
                     $organizerName = isset($organizer['cn']) ? $organizer['cn'] : '';
 
-                    require_once 'Horde/Identity.php';
-
                     // Build the reply.
                     $vCal = new Horde_iCalendar();
                     $vCal->setAttribute('PRODID', '-//The Horde Project//' . HORDE_AGENT_HEADER . '//EN');
@@ -397,8 +395,6 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver
                     $vfb_reply = $registry->call('calendar/getFreeBusy',
                                                  array('startStamp' => $startStamp,
                                                        'endStamp' => $endStamp));
-                    require_once 'Horde/Identity.php';
-
                     // Find out who we are and update status.
                     $identity = Identity::singleton();
                     $email = $identity->getFromAddress();
@@ -632,7 +628,6 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver
                 // Check that you are one of the attendees here.
                 $is_attendee = false;
                 if (!is_a($attendees, 'PEAR_Error') && !empty($attendees)) {
-                    require_once 'Horde/Identity.php';
                     $identity = Identity::singleton(array('imp', 'imp'));
                     for ($i = 0, $c = count($attendees); $i < $c; ++$i) {
                         $attendee = parse_url($attendees[$i]);
index de88842..93eb065 100644 (file)
@@ -105,7 +105,6 @@ class IMP_Spam
                     }
 
                     if (!isset($imp_compose)) {
-                        require_once 'Horde/Identity.php';
                         $imp_compose = IMP_Compose::singleton();
                         $identity = Identity::singleton(array('imp', 'imp'));
                         try {
index d3c4ddc..e1d133a 100644 (file)
@@ -37,7 +37,6 @@ class IMP_Views_Compose
         );
 
         /* Load Identity. */
-        require_once 'Horde/Identity.php';
         $identity = Identity::singleton(array('imp', 'imp'));
         $selected_identity = $identity->getDefault();
         $sent_mail_folder = $identity->getValue('sent_mail_folder');
index 82b0d10..b1e1f1a 100644 (file)
@@ -229,8 +229,6 @@ class IMP_Views_ListMessages
             return $msgs;
         }
 
-        require_once 'Horde/Identity.php';
-
         /* Get mailbox information. */
         $overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => array('list-post', 'x-priority'), 'structure' => $GLOBALS['prefs']->getValue('atc_flag')));
         $charset = Horde_Nls::getCharset();
index f43f120..645be4f 100644 (file)
@@ -68,11 +68,15 @@ try {
     }
     throw $e;
 }
+
 $conf = &$GLOBALS['conf'];
 if (!defined('IMP_TEMPLATES')) {
     define('IMP_TEMPLATES', $registry->get('templates'));
 }
 
+// TODO: Remove once this can be autoloaded
+require_once 'Horde/Identity.php';
+
 // Initialize global $imp_imap object.
 if (!isset($GLOBALS['imp_imap'])) {
     $GLOBALS['imp_imap'] = new IMP_Imap();
index f878ad8..f96f2fb 100644 (file)
@@ -153,7 +153,6 @@ if (($actionID == 'c') && !is_null($atc_id)) {
 $imp_ui = new IMP_UI_Message();
 
 /* Create the Identity object. */
-require_once 'Horde/Identity.php';
 $user_identity = Identity::singleton(array('imp', 'imp'));
 
 /* Develop the list of headers to display. */
index 24010bc..8acb828 100644 (file)
@@ -50,7 +50,6 @@ $imp_message = IMP_Message::singleton();
 Horde_Nls::setTimeZone();
 
 /* Initialize the user's identities. */
-require_once 'Horde/Identity.php';
 $user_identity = Identity::singleton(array('imp', 'imp'));
 
 /* Run through action handlers. */
index 82eca7a..94553c9 100644 (file)
@@ -368,7 +368,6 @@ if ($prefs->getValue('use_pgp')) {
             $t->set('deletekeypair', addslashes(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")));
             $t->set('personalkey-delete-help', Horde_Help::link('imp', 'pgp-personalkey-delete'));
         } else {
-            require_once 'Horde/Identity.php';
             $imp_identity = Identity::singleton(array('imp', 'imp'));
             $t->set('fullname', $imp_identity->getFullname());
             $t->set('personalkey-create-name-help', Horde_Help::link('imp', 'pgp-personalkey-create-name'));