From 2bcc9979983f5a3c479e7a6da7ae4cc97f91a4cb Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 17 Jul 2009 15:26:03 -0600 Subject: [PATCH] Replace all Identity.php requires with a single, easily removable require in base.php --- imp/attachment.php | 1 - imp/compose-dimp.php | 1 - imp/compose-mimp.php | 1 - imp/compose.php | 1 - imp/lib/Block/Newmail.php | 2 -- imp/lib/Compose.php | 3 --- imp/lib/Crypt/Pgp.php | 1 - imp/lib/Crypt/Smime.php | 1 - imp/lib/IMP.php | 1 - imp/lib/Imap/Flags.php | 1 - imp/lib/Imap/Tree.php | 1 - imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php | 1 - imp/lib/LoginTasks/Task/PurgeSentmail.php | 1 - imp/lib/LoginTasks/Task/RenameSentmailMonthly.php | 3 --- imp/lib/Mime/Viewer/Itip.php | 5 ----- imp/lib/Spam.php | 1 - imp/lib/Views/Compose.php | 1 - imp/lib/Views/ListMessages.php | 2 -- imp/lib/base.php | 4 ++++ imp/message-mimp.php | 1 - imp/message.php | 1 - imp/pgp.php | 1 - 22 files changed, 4 insertions(+), 31 deletions(-) diff --git a/imp/attachment.php b/imp/attachment.php index e1b6d8754..f09ab74ff 100644 --- a/imp/attachment.php +++ b/imp/attachment.php @@ -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(); diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index a645b80c6..b515ba185 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -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'); diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index db4bad13e..4e6858d75 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -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 = ''; diff --git a/imp/compose.php b/imp/compose.php index 4e0136403..690f9cd1d 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -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(); diff --git a/imp/lib/Block/Newmail.php b/imp/lib/Block/Newmail.php index a88d92245..db755be18 100644 --- a/imp/lib/Block/Newmail.php +++ b/imp/lib/Block/Newmail.php @@ -35,8 +35,6 @@ class IMP_Block_Newmail extends Horde_Block if (empty($ids)) { $html .= '' . _("No unread messages") . ''; } 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']; diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index b71b73923..245fdac97 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -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); } diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index 1c77857ba..6f4db8c54 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -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)) { diff --git a/imp/lib/Crypt/Smime.php b/imp/lib/Crypt/Smime.php index 0b3392ee8..fc078e10f 100644 --- a/imp/lib/Crypt/Smime.php +++ b/imp/lib/Crypt/Smime.php @@ -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)) { diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index f8b0d4e3c..1176e7ce2 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -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())); diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index 5e4295009..5895b208c 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -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'])) { diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index ef48daeb9..6566f9ce4 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -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( diff --git a/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php b/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php index 1374425bb..26f600ac5 100644 --- a/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php +++ b/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php @@ -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(); diff --git a/imp/lib/LoginTasks/Task/PurgeSentmail.php b/imp/lib/LoginTasks/Task/PurgeSentmail.php index 335560ed8..11b08d82f 100644 --- a/imp/lib/LoginTasks/Task/PurgeSentmail.php +++ b/imp/lib/LoginTasks/Task/PurgeSentmail.php @@ -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(); } diff --git a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php index edefdc30d..0f03d5ad6 100644 --- a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php +++ b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php @@ -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(); diff --git a/imp/lib/Mime/Viewer/Itip.php b/imp/lib/Mime/Viewer/Itip.php index a8df9af81..6f6a8d78b 100644 --- a/imp/lib/Mime/Viewer/Itip.php +++ b/imp/lib/Mime/Viewer/Itip.php @@ -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]); diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index de88842e6..93eb06577 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -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 { diff --git a/imp/lib/Views/Compose.php b/imp/lib/Views/Compose.php index d3c4ddc66..e1d133a6a 100644 --- a/imp/lib/Views/Compose.php +++ b/imp/lib/Views/Compose.php @@ -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'); diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 82b0d1086..b1e1f1ae5 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -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(); diff --git a/imp/lib/base.php b/imp/lib/base.php index f43f12051..645be4f88 100644 --- a/imp/lib/base.php +++ b/imp/lib/base.php @@ -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(); diff --git a/imp/message-mimp.php b/imp/message-mimp.php index f878ad878..f96f2fbb5 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -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. */ diff --git a/imp/message.php b/imp/message.php index 24010bc27..8acb8285d 100644 --- a/imp/message.php +++ b/imp/message.php @@ -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. */ diff --git a/imp/pgp.php b/imp/pgp.php index 82eca7a6f..94553c981 100644 --- a/imp/pgp.php +++ b/imp/pgp.php @@ -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')); -- 2.11.0