/* Are we watermarking the image? */
if ($watermark) {
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (empty($name)) {
$name = Horde_Auth::getAuth();
if ($owner == Horde_Auth::getAuth()) {
$owner_title = _("My Galleries");
} elseif (!empty($GLOBALS['conf']['gallery']['customlabel'])) {
- $uprefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $uprefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'ansel',
$owner, '', null, false);
$fullname = $uprefs->getValue('grouptitle');
if (!$fullname) {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $owner);
+ $identity = Horde_Prefs_Identity::singleton('none', $owner);
$fullname = $identity->getValue('fullname');
if (!$fullname) {
$fullname = $owner;
if (empty($user)) {
$this->addVariable(_("Use the following return address:"), 'ecard_retaddr', 'text', true);
} else {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$from_addr = $identity->getDefaultFromAddress();
$vars->set('ecard_retaddr', $from_addr);
$this->addHidden('', 'ecard_retaddr', 'text', true);
*/
public function getOwner()
{
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $this->data['share_owner']);
- return $identity;
+ return Horde_Prefs_Identity::singleton('none', $this->data['share_owner']);
}
/**
}
if (empty($watermark)) {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (empty($name)) {
$name = Horde_Auth::getAuth();
*/
function _getUserEmail($user = null)
{
- // Get user email
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $user);
- return $identity->getValue('from_addr');
+ return Horde_Prefs_Identity::singleton('none', $user)->getValue('from_addr');
}
/**
if ($owner == Horde_Auth::getAuth() && empty($this->_params['api'])) {
$list_title = _("My Galleries");
} elseif (!empty($GLOBALS['conf']['gallery']['customlabel'])) {
- $uprefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $uprefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'ansel', $owner, '', null, false);
$fullname = $uprefs->getValue('grouptitle');
if (!$fullname) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton('none', $owner);
+ $identity = Horde_Prefs_Identity::singleton('none', $owner);
$fullname = $identity->getValue('fullname');
if (!$fullname) {
$fullname = $owner;
if (isset($galleries) && count($galleries)) {
$images = $ansel_storage->getRecentImages($galleries);
if (!is_a($images, 'PEAR_Error') && count($images)) {
- require_once 'Horde/Identity.php';
- $owner = Identity::singleton('none', $id);
+ $owner = Horde_Prefs_Identity::singleton('none', $id);
$name = $owner->getValue('fullname');
$author = $owner->getValue('from_addr');
if (!$name) {
$owner_title = _("My Galleries");
$custom = '';
} elseif (!empty($GLOBALS['conf']['gallery']['customlabel'])) {
- $uprefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $uprefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'ansel',
$group, '', null, false);
$custom = $uprefs->getValue('grouptitle');
/* If the user's personal ledger doesn't exist, then create it. */
if (!$GLOBALS['fima_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
if (count(Fima::listLedgers(true)) == 0) {
// If the default share doesn't exist then create it.
if (!$GLOBALS['fima_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
// Get user security pass
$user = Horde_Util::getFormData('username');
if ($user) {
- $u_prefs = Prefs::singleton($conf['prefs']['driver'], 'horde', Horde_Auth::convertUsername($user, true), '', null, false);
+ $u_prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'horde', Horde_Auth::convertUsername($user, true), '', null, false);
$u_prefs->retrieve();
$answer = $u_prefs->getValue('security_answer');
$question = $u_prefs->getValue('security_question');
static public function getUserEmail($user)
{
// We should always realy on registration data
- // $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'horde', Horde_Auth::convertUsername($user, true), '', null, false);
+ // $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'horde', Horde_Auth::convertUsername($user, true), '', null, false);
// $prefs->retrieve();
// $email = $prefs->getValue('alternate_email') ? $prefs->getValue('alternate_email') : $prefs->getValue('from_addr');
return (boolean)$GLOBALS['prefs']->getValue('friends_approval');
}
- $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'folks', Horde_Auth::convertUsername($user, true), '', null, false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'folks', Horde_Auth::convertUsername($user, true), '', null, false);
$prefs->retrieve();
return (boolean)$prefs->getValue('friends_approval');
$user = Horde_Auth::getAuth();
}
- $u_prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'], $GLOBALS['registry']->getApp(), $user);
+ $u_prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], $GLOBALS['registry']->getApp(), $user);
$u_prefs->retrieve();
$list = $u_prefs->getValue($type);
*/
protected function _getUserFromAddr($user)
{
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $user);
- return $identity->getValue('from_addr');
+ return Horde_Prefs_Identity::singleton('none', $user)->getValue('from_addr');
}
/**
$curr_acl = $ACLDriver->getACL($folder);
$canEdit = $ACLDriver->canEdit($folder, Horde_Auth::getAuth());
-require_once 'Horde/Prefs/UI.php';
-
extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
-Prefs_UI::generateHeader(null, $chunk);
+Horde_Prefs_Ui::generateHeader(null, $chunk);
/* Set up template. */
$t = new Horde_Template();
$t->setOption('gettext', true);
$t->set('aclurl', Horde::applicationUrl('acl.php'));
$t->set('forminput', Horde_Util::formInput());
-$t->set('aclnavcell', Horde_Util::bufferOutput(array('Prefs_UI', 'generateNavigationCell'), 'acl'));
+$t->set('aclnavcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'acl'));
$t->set('changefolder', Horde::link('#', _("Change Folder"), 'smallheader', '', '', '', '', array('id' => 'changefolder')));
$t->set('sharedimg', Horde::img('shared.png', _("Change Folder")));
$t->set('options', IMP::flistSelect(array('selected' => $folder)));
} else {
/* Load $mail_user's preferences so that we can use their
* locale information for the notification message. */
- include_once 'Horde/Prefs.php';
- $prefs = Prefs::singleton($conf['prefs']['driver'], 'horde', $mail_user);
+ $prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'horde', $mail_user);
$prefs->retrieve();
- $mail_identity = Identity::singleton('none', $mail_user);
+ $mail_identity = Horde_Prefs_Identity::singleton('none', $mail_user);
$mail_address = $mail_identity->getDefaultFromAddress();
/* Ignore missing addresses, which are returned as <>. */
$get_sig = true;
$msg = '';
-$identity = Identity::singleton(array('imp', 'imp'));
+$identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
if (!$prefs->isLocked('default_identity')) {
$identity_id = Horde_Util::getFormData('identity');
if (!is_null($identity_id)) {
$header = array();
/* Set the current identity. */
-$identity = Identity::singleton(array('imp', 'imp'));
+$identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
if (!$prefs->isLocked('default_identity')) {
$identity_id = Horde_Util::getFormData('identity');
if (!is_null($identity_id)) {
$cursor_pos = $oldrtemode = $rtemode = $siglocation = null;
/* Set the current identity. */
-$identity = Identity::singleton(array('imp', 'imp'));
+$identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
if (!$prefs->isLocked('default_identity')) {
$identity_id = Horde_Util::getFormData('identity');
if (!is_null($identity_id)) {
require_once dirname(__FILE__) . '/lib/Application.php';
new IMP_Application(array('init' => true));
-require_once 'Horde/Prefs/UI.php';
extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
$group = 'filters';
-Prefs_UI::generateHeader(null, $chunk);
+Horde_Prefs_Ui::generateHeader(null, $chunk);
$t = new Horde_Template();
$t->setOption('gettext', true);
-$t->set('navcell', Horde_Util::bufferOutput(array('Prefs_UI', 'generateNavigationCell'), 'filters'));
+$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'filters'));
$t->set('prefsurl', Horde::getServiceLink('options', 'imp'));
$t->set('return_text', _("Return to Options"));
$identity_id = null;
$headers = $contents->getHeaderOb();
if (($fromaddr = Horde_Mime_Address::bareAddress($headers->getValue('from')))) {
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$identity_id = $identity->getMatchingIdentity($fromaddr);
}
if (in_array($type, array('reply_all', '*'))) {
/* Filter out our own address from the addresses we reply to. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$all_addrs = array_keys($identity->getAllFromAddresses(true));
/* Build the To: header. It is either 1) the Reply-To address
*
* @param Horde_Mime_Headers $h The headers object for the message.
*
- * @return mixed See Identity_imp::getMatchingIdentity().
+ * @return mixed See Imp_Prefs_Identity::getMatchingIdentity().
*/
protected function _getMatchingIdentity($h)
{
$msgAddresses[] = $h->getValue($val);
}
- $user_identity = Identity::singleton(array('imp', 'imp'));
+ $user_identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
return $user_identity->getMatchingIdentity($msgAddresses);
}
<?php
/**
- * The IMP_Crypt_pgp:: class contains all functions related to handling
+ * The IMP_Crypt_Pgp:: class contains all functions related to handling
* PGP messages within IMP.
*
* Copyright 2002-2009 The Horde Project (http://www.horde.org/)
/* TODO: Retrieve by ID. */
/* See if the address points to the user's public key. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$personal_pubkey = $this->getPersonalPublicKey();
if (!empty($personal_pubkey) && $identity->hasAddress($address)) {
$result = $personal_pubkey;
$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. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$personal_pubkey = $this->getPersonalPublicKey();
if (!empty($personal_pubkey) && $identity->hasAddress($address)) {
return $personal_pubkey;
Horde::compressOutput();
}
- // 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();
static public function isSpecialFolder($mbox)
{
/* Get the identities. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
return (($mbox == self::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)) || in_array($mbox, $identity->getAllSentmailFolders()));
}
+++ /dev/null
-<?php
-/**
- * This class provides an IMP-specific interface to all identities a
- * user might have. Its methods take care of any site-specific
- * restrictions configured in prefs.php and conf.php.
- *
- * Copyright 2001-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>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Identity
- */
-class Identity_imp extends Identity
-{
- /**
- * Cached alias list.
- *
- * @var array
- */
- protected $_aliases = array();
-
- /**
- * Cached from address list.
- *
- * @var array
- */
- protected $_fromList = array();
-
- /**
- * Cached names list.
- *
- * @var array
- */
- protected $_names = array();
-
- /**
- * Cached signature list.
- *
- * @var array
- */
- protected $_signatures = array();
-
- /**
- * Reads all the user's identities from the prefs object or builds
- * a new identity from the standard values given in prefs.php.
- */
- public function __construct()
- {
- parent::__construct();
- $this->_properties = array_merge(
- $this->_properties,
- array('replyto_addr', 'alias_addr', 'tieto_addr', 'bcc_addr',
- 'signature', 'sig_first', 'sig_dashes', 'save_sent_mail',
- 'sent_mail_folder')
- );
- }
-
- /**
- * Verifies and sanitizes all identity properties.
- *
- * @param integer $identity The identity to verify.
- *
- * @return boolean|object True if the properties are valid or a PEAR_Error
- * with an error description otherwise.
- */
- public function verify($identity = null)
- {
- $result = parent::verify($identity);
- if ($result instanceof PEAR_Error) {
- return $result;
- }
-
- if (!isset($identity)) {
- $identity = $this->_default;
- }
-
- /* Prepare email validator */
- require_once 'Horde/Form.php';
- $email = new Horde_Form_Type_email();
- $vars = new Horde_Variables();
- $var = new Horde_Form_Variable('', 'replyto_addr', $email, false);
-
- /* Verify From address. */
- if (!$email->isValid($var, $vars, $this->getValue('from_addr', $identity), $error_message)) {
- return PEAR::raiseError($error_message);
- }
-
- /* Verify Reply-to address. */
- if (!$email->isValid($var, $vars, $this->getValue('replyto_addr', $identity), $error_message)) {
- return PEAR::raiseError($error_message);
- }
-
- /* Clean up Alias, Tie-to, and BCC addresses. */
- foreach (array('alias_addr', 'tieto_addr', 'bcc_addr') as $val) {
- $data = $this->getValue($val, $identity);
- if (is_array($data)) {
- $data = implode("\n", $data);
- }
- $data = trim($data);
- $data = (empty($data)) ? array() : Horde_Array::prepareAddressList(preg_split("/[\n\r]+/", $data));
-
- /* Validate addresses */
- foreach ($data as $address) {
- if (!$email->isValid($var, $vars, $address, $error_message)) {
- return PEAR::raiseError($error_message);
- }
- }
-
- $this->setValue($val, $data, $identity);
- }
-
- return true;
- }
-
- /**
- * Returns a complete From: header based on all relevant factors (fullname,
- * from address, input fields, locks etc.)
- *
- * @param integer $ident The identity to retrieve the values from.
- * @param string $from_address A default from address to use if no
- * identity is selected and the from_addr
- * preference is locked.
- *
- * @return string A full From: header in the format
- * 'Fullname <user@example.com>'.
- * @throws Horde_Exception
- */
- public function getFromLine($ident = null, $from_address = '')
- {
- static $froms = array();
-
- if (isset($froms[$ident])) {
- return $froms[$ident];
- }
-
- if (!isset($ident)) {
- $address = $from_address;
- }
-
- if (empty($address) || $this->_prefs->isLocked('from_addr')) {
- $address = $this->getFromAddress($ident);
- $name = $this->getFullname($ident);
- }
-
- try {
- $ob = Horde_Mime_Address::parseAddressList($address, array('defserver' => $_SESSION['imp']['maildomain']));
- } catch (Horde_Mime_Exception $e) {
- throw new Horde_Exception (_("Your From address is not a valid email address. This can be fixed in your Personal Information options page."));
- }
-
- if (empty($name)) {
- if (!empty($ob[0]['personal'])) {
- $name = $ob[0]['personal'];
- } else {
- $name = $this->getFullname($ident);
- }
- }
-
- $from = Horde_Mime_Address::writeAddress($ob[0]['mailbox'], $ob[0]['host'], $name);
-
- $froms[$ident] = $from;
- return $from;
- }
-
- /**
- * Returns an array with From: headers from all identities
- *
- * @return array The From: headers from all identities
- */
- public function getAllFromLines()
- {
- foreach (array_keys($this->_identities) as $ident) {
- $list[$ident] = $this->getFromAddress($ident);
- }
- return $list;
- }
-
- /**
- * Returns an array with the necessary values for the identity select
- * box in the IMP compose window.
- *
- * @return array The array with the necessary strings
- */
- public function getSelectList()
- {
- $ids = $this->getAll('id');
- foreach ($ids as $key => $id) {
- $list[$key] = $this->getFromAddress($key) . ' (' . $id . ')';
- }
- return $list;
- }
-
- /**
- * Returns true if the given address belongs to one of the identities.
- * This function will search aliases for an identity automatically.
- *
- * @param string $address The address to search for in the identities.
- *
- * @return boolean True if the address was found.
- */
- public function hasAddress($address)
- {
- static $list;
-
- $address = Horde_String::lower($address);
- if (!isset($list)) {
- $list = $this->getAllFromAddresses(true);
- }
-
- return isset($list[$address]);
- }
-
- /**
- * Returns the from address based on the chosen identity. If no
- * address can be found it is built from the current user name and
- * the specified maildomain.
- *
- * @param integer $ident The identity to retrieve the address from.
- *
- * @return string A valid from address.
- */
- public function getFromAddress($ident = null)
- {
- if (!empty($this->_fromList[$ident])) {
- return $this->_fromList[$ident];
- }
-
- $val = $this->getValue('from_addr', $ident);
- if (empty($val)) {
- $val = $GLOBALS['imp_imap']->ob()->getParam('username');
- }
-
- if (!strstr($val, '@')) {
- $val .= '@' . $_SESSION['imp']['maildomain'];
- }
-
- $this->_fromList[$ident] = $val;
-
- return $val;
- }
-
- /**
- * Returns all aliases based on the chosen identity.
- *
- * @param integer $ident The identity to retrieve the aliases from.
- *
- * @return array Aliases for the identity.
- */
- public function getAliasAddress($ident)
- {
- if (empty($this->_aliases[$ident])) {
- $this->_aliases[$ident] = @array_merge($this->getValue('alias_addr', $ident),
- array($this->getValue('replyto_addr', $ident)));
- }
-
- return $this->_aliases[$ident];
- }
-
- /**
- * Returns an array with all identities' from addresses.
- *
- * @param boolean $alias Include aliases?
- *
- * @return array The array with
- * KEY - address
- * VAL - identity number
- */
- public function getAllFromAddresses($alias = false)
- {
- $list = array();
-
- foreach ($this->_identitiesWithDefaultLast() as $key => $identity) {
- /* Get From Addresses. */
- $list[Horde_String::lower($this->getFromAddress($key))] = $key;
-
- /* Get Aliases. */
- if ($alias) {
- $addrs = $this->getAliasAddress($key);
- if (!empty($addrs)) {
- foreach (array_filter($addrs) as $val) {
- $list[Horde_String::lower($val)] = $key;
- }
- }
- }
- }
-
- return $list;
- }
-
- /**
- * Get all 'tie to' address/identity pairs.
- *
- * @return array The array with
- * KEY - address
- * VAL - identity number
- */
- public function getAllTieAddresses()
- {
- $list = array();
-
- foreach ($this->_identitiesWithDefaultLast() as $key => $identity) {
- $tieaddr = $this->getValue('tieto_addr', $key);
- if (!empty($tieaddr)) {
- foreach ($tieaddr as $val) {
- $list[$val] = $key;
- }
- }
- }
-
- return $list;
- }
-
- /**
- * Returns the list of identities with the default identity positioned
- * last.
- *
- * @return array The identities list with the default identity last.
- */
- protected function _identitiesWithDefaultLast()
- {
- $ids = $this->_identities;
- $default = $this->getDefault();
- $tmp = $ids[$default];
- unset($ids[$default]);
- $ids[$default] = $tmp;
- return $ids;
- }
-
- /**
- * Returns the BCC addresses for a given identity.
- *
- * @param integer $ident The identity to retrieve the Bcc addresses from.
- *
- * @return array The array of objects (IMAP addresses).
- */
- public function getBccAddresses($ident = null)
- {
- $bcc = $this->getValue('bcc_addr', $ident);
- if (empty($bcc)) {
- return array();
- } else {
- if (!is_array($bcc)) {
- $bcc = array($bcc);
- }
- try {
- return Horde_Mime_Address::parseAddressList(implode(', ', $bcc));
- } catch (Horde_Mime_Exception $e) {
- return array();
- }
- }
- }
-
- /**
- * Returns the identity's id that matches the passed addresses.
- *
- * @param mixed $addresses Either an array or a single string or a
- * comma-separated list of email addresses.
- * @param boolean $search_ties Search for a matching identity in tied
- * addresses too?
- *
- * @return integer The id of the first identity that from or alias
- * addresses match (one of) the passed addresses or
- * null if none matches.
- */
- public function getMatchingIdentity($addresses, $search_ties = true)
- {
- static $tie_addresses, $own_addresses;
-
- if (!isset($tie_addresses)) {
- $tie_addresses = $this->getAllTieAddresses();
- $own_addresses = $this->getAllFromAddresses(true);
- }
-
- /* Normalize address list. */
- if (is_array($addresses)) {
- $addresses = array_filter($addresses);
- } else {
- $addresses = array($addresses);
- }
-
- try {
- $addr_list = Horde_Mime_Address::parseAddressList(implode(', ', $addresses));
- } catch (Horde_Mime_Exception $e) {
- return null;
- }
-
- foreach ($addr_list as $address) {
- if (empty($address['mailbox'])) {
- continue;
- }
- $find_address = $address['mailbox'];
- if (!empty($address['host'])) {
- $find_address .= '@' . $address['host'];
- }
- $find_address = Horde_String::lower($find_address);
-
- /* Search 'tieto' addresses first. */
- /* Check for this address explicitly. */
- if ($search_ties && isset($tie_addresses[$find_address])) {
- return $tie_addresses[$find_address];
- }
-
- /* If we didn't find the address, check for the domain. */
- if (!empty($address['host'])) {
- $host = '@' . $address['host'];
- if ($search_ties &&
- isset($tie_addresses[$host]) &&
- ($host != '@')) {
- return $tie_addresses[$host];
- }
- }
-
- /* Next, search all from addresses. */
- if (isset($own_addresses[$find_address])) {
- return $own_addresses[$find_address];
- }
- }
-
- return null;
- }
-
- /**
- * Returns the user's full name.
- *
- * @param integer $ident The identity to retrieve the name from.
- *
- * @return string The user's full name.
- */
- public function getFullname($ident = null)
- {
- if (isset($this->_names[$ident])) {
- return $this->_names[$ident];
- }
-
- $this->_names[$ident] = $this->getValue('fullname', $ident);
-
- return $this->_names[$ident];
- }
-
- /**
- * Returns the full signature based on the current settings for the
- * signature itself, the dashes and the position.
- *
- * @param integer $ident The identity to retrieve the signature from.
- *
- * @return string The full signature.
- * @throws Horde_Exception
- */
- public function getSignature($ident = null)
- {
- if (isset($this->_signatures[$ident])) {
- return $this->_signatures[$ident];
- }
-
- $val = $this->getValue('signature', $ident);
- if (!empty($val)) {
- $sig_first = $this->getValue('sig_first', $ident);
- $sig_dashes = $this->getValue('sig_dashes', $ident);
- $val = str_replace("\r\n", "\n", $val);
- if ($sig_dashes) {
- $val = "-- \n$val";
- }
- if (isset($sig_first) && $sig_first) {
- $val = "\n" . $val . "\n\n\n";
- } else {
- $val = "\n" . $val;
- }
- }
-
- try {
- $val = Horde::callHook('prefs_hook_signature', array($val), 'imp');
- } catch (Horde_Exception_HookNotSet $e) {}
-
- $this->_signatures[$ident] = $val;
-
- return $val;
- }
-
- /**
- * Returns an array with the signatures from all identities
- *
- * @return array The array with all the signatures.
- */
- public function getAllSignatures()
- {
- static $list;
-
- if (isset($list)) {
- return $list;
- }
-
- foreach ($this->_identities as $key => $identity) {
- $list[$key] = $this->getSignature($key);
- }
-
- return $list;
- }
-
- /**
- * @see Identity::getValue()
- */
- public function getValue($key, $identity = null)
- {
- if ($key == 'sent_mail_folder') {
- $folder = parent::getValue('sent_mail_folder', $identity);
- return strlen($folder) ? IMP::folderPref($folder, true) : '';
- }
- return parent::getValue($key, $identity);
- }
-
- /**
- * Returns an array with the sent-mail folder names from all the
- * identities.
- *
- * @return array The array with the folder names.
- */
- public function getAllSentmailFolders()
- {
- $list = array();
- foreach ($this->_identities as $key => $identity) {
- if ($folder = $this->getValue('sent_mail_folder', $key)) {
- $list[$folder] = 1;
- }
- }
-
- /* Get rid of duplicates and empty folders. */
- return array_filter(array_keys($list));
- }
-
- /**
- * Returns true if the mail should be saved and the user is allowed to.
- *
- * @param integer $ident The identity to retrieve the setting from.
- *
- * @return boolean True if the sent mail should be saved.
- */
- public function saveSentmail($ident = null)
- {
- if (!$GLOBALS['conf']['user']['allow_folders']) {
- return false;
- }
-
- return $this->getValue('save_sent_mail', $ident);
- }
-
-}
if (isset($options['personal'])) {
if (is_array($options['personal'])) {
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
foreach ($options['personal'] as $val) {
if ($identity->hasAddress($val['inner'])) {
$process['personal'] = $f['personal'];
}
/* Initialize the user's identities. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$this->_eltCache = array(
'trash' => IMP::folderPref($GLOBALS['prefs']->getValue('trash_folder'), true),
/* 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. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$imp_folder = IMP_Folder::singleton();
$sent_mail_folders = $identity->getAllSentmailFolders();
*/
protected function _getFolders()
{
- return Identity::singleton(array('imp', 'imp'))->getAllSentmailfolders();
+ return Horde_Prefs_Identity::singleton(array('imp', 'imp'))->getAllSentmailfolders();
}
}
$success = true;
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$imp_folder = IMP_Folder::singleton();
foreach ($identity->getAllSentmailfolders() as $sent_folder) {
{
IMP::initialize();
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$new_folders = $old_folders = array();
foreach ($identity->getAllSentmailfolders() as $folder) {
$vEvent_reply->setAttribute('ORGANIZER', $vEvent->getAttribute('ORGANIZER'), array_pop($organizer));
// Find out who we are and update status.
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$attendees = $vEvent->getAttribute('ATTENDEE');
if (!is_array($attendees)) {
$attendees = array($attendees);
array('startStamp' => $startStamp,
'endStamp' => $endStamp));
// Find out who we are and update status.
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$email = $identity->getFromAddress();
// Build the reply.
// Check that you are one of the attendees here.
$is_attendee = false;
if (!($attendees instanceof PEAR_Error) && !empty($attendees)) {
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
for ($i = 0, $c = count($attendees); $i < $c; ++$i) {
$attendee = parse_url($attendees[$i]);
if (!empty($attendee['path']) &&
--- /dev/null
+<?php
+/**
+ * This class provides an IMP-specific interface to all identities a
+ * user might have. Its methods take care of any site-specific
+ * restrictions configured in prefs.php and conf.php.
+ *
+ * Copyright 2001-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>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category IMP
+ * @package Horde_Prefs
+ */
+class Imp_Prefs_Identity extends Horde_Prefs_Identity
+{
+ /**
+ * Cached alias list.
+ *
+ * @var array
+ */
+ protected $_aliases = array();
+
+ /**
+ * Cached from address list.
+ *
+ * @var array
+ */
+ protected $_fromList = array();
+
+ /**
+ * Cached names list.
+ *
+ * @var array
+ */
+ protected $_names = array();
+
+ /**
+ * Cached signature list.
+ *
+ * @var array
+ */
+ protected $_signatures = array();
+
+ /**
+ * Reads all the user's identities from the prefs object or builds
+ * a new identity from the standard values given in prefs.php.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->_properties = array_merge(
+ $this->_properties,
+ array('replyto_addr', 'alias_addr', 'tieto_addr', 'bcc_addr',
+ 'signature', 'sig_first', 'sig_dashes', 'save_sent_mail',
+ 'sent_mail_folder')
+ );
+ }
+
+ /**
+ * Verifies and sanitizes all identity properties.
+ *
+ * @param integer $identity The identity to verify.
+ *
+ * @return boolean|object True if the properties are valid or a PEAR_Error
+ * with an error description otherwise.
+ */
+ public function verify($identity = null)
+ {
+ $result = parent::verify($identity);
+ if ($result instanceof PEAR_Error) {
+ return $result;
+ }
+
+ if (!isset($identity)) {
+ $identity = $this->_default;
+ }
+
+ /* Prepare email validator */
+ require_once 'Horde/Form.php';
+ $email = new Horde_Form_Type_email();
+ $vars = new Horde_Variables();
+ $var = new Horde_Form_Variable('', 'replyto_addr', $email, false);
+
+ /* Verify From address. */
+ if (!$email->isValid($var, $vars, $this->getValue('from_addr', $identity), $error_message)) {
+ return PEAR::raiseError($error_message);
+ }
+
+ /* Verify Reply-to address. */
+ if (!$email->isValid($var, $vars, $this->getValue('replyto_addr', $identity), $error_message)) {
+ return PEAR::raiseError($error_message);
+ }
+
+ /* Clean up Alias, Tie-to, and BCC addresses. */
+ foreach (array('alias_addr', 'tieto_addr', 'bcc_addr') as $val) {
+ $data = $this->getValue($val, $identity);
+ if (is_array($data)) {
+ $data = implode("\n", $data);
+ }
+ $data = trim($data);
+ $data = (empty($data)) ? array() : Horde_Array::prepareAddressList(preg_split("/[\n\r]+/", $data));
+
+ /* Validate addresses */
+ foreach ($data as $address) {
+ if (!$email->isValid($var, $vars, $address, $error_message)) {
+ return PEAR::raiseError($error_message);
+ }
+ }
+
+ $this->setValue($val, $data, $identity);
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns a complete From: header based on all relevant factors (fullname,
+ * from address, input fields, locks etc.)
+ *
+ * @param integer $ident The identity to retrieve the values from.
+ * @param string $from_address A default from address to use if no
+ * identity is selected and the from_addr
+ * preference is locked.
+ *
+ * @return string A full From: header in the format
+ * 'Fullname <user@example.com>'.
+ * @throws Horde_Exception
+ */
+ public function getFromLine($ident = null, $from_address = '')
+ {
+ static $froms = array();
+
+ if (isset($froms[$ident])) {
+ return $froms[$ident];
+ }
+
+ if (!isset($ident)) {
+ $address = $from_address;
+ }
+
+ if (empty($address) || $this->_prefs->isLocked('from_addr')) {
+ $address = $this->getFromAddress($ident);
+ $name = $this->getFullname($ident);
+ }
+
+ try {
+ $ob = Horde_Mime_Address::parseAddressList($address, array('defserver' => $_SESSION['imp']['maildomain']));
+ } catch (Horde_Mime_Exception $e) {
+ throw new Horde_Exception (_("Your From address is not a valid email address. This can be fixed in your Personal Information options page."));
+ }
+
+ if (empty($name)) {
+ if (!empty($ob[0]['personal'])) {
+ $name = $ob[0]['personal'];
+ } else {
+ $name = $this->getFullname($ident);
+ }
+ }
+
+ $from = Horde_Mime_Address::writeAddress($ob[0]['mailbox'], $ob[0]['host'], $name);
+
+ $froms[$ident] = $from;
+ return $from;
+ }
+
+ /**
+ * Returns an array with From: headers from all identities
+ *
+ * @return array The From: headers from all identities
+ */
+ public function getAllFromLines()
+ {
+ foreach (array_keys($this->_identities) as $ident) {
+ $list[$ident] = $this->getFromAddress($ident);
+ }
+ return $list;
+ }
+
+ /**
+ * Returns an array with the necessary values for the identity select
+ * box in the IMP compose window.
+ *
+ * @return array The array with the necessary strings
+ */
+ public function getSelectList()
+ {
+ $ids = $this->getAll('id');
+ foreach ($ids as $key => $id) {
+ $list[$key] = $this->getFromAddress($key) . ' (' . $id . ')';
+ }
+ return $list;
+ }
+
+ /**
+ * Returns true if the given address belongs to one of the identities.
+ * This function will search aliases for an identity automatically.
+ *
+ * @param string $address The address to search for in the identities.
+ *
+ * @return boolean True if the address was found.
+ */
+ public function hasAddress($address)
+ {
+ static $list;
+
+ $address = Horde_String::lower($address);
+ if (!isset($list)) {
+ $list = $this->getAllFromAddresses(true);
+ }
+
+ return isset($list[$address]);
+ }
+
+ /**
+ * Returns the from address based on the chosen identity. If no
+ * address can be found it is built from the current user name and
+ * the specified maildomain.
+ *
+ * @param integer $ident The identity to retrieve the address from.
+ *
+ * @return string A valid from address.
+ */
+ public function getFromAddress($ident = null)
+ {
+ if (!empty($this->_fromList[$ident])) {
+ return $this->_fromList[$ident];
+ }
+
+ $val = $this->getValue('from_addr', $ident);
+ if (empty($val)) {
+ $val = $GLOBALS['imp_imap']->ob()->getParam('username');
+ }
+
+ if (!strstr($val, '@')) {
+ $val .= '@' . $_SESSION['imp']['maildomain'];
+ }
+
+ $this->_fromList[$ident] = $val;
+
+ return $val;
+ }
+
+ /**
+ * Returns all aliases based on the chosen identity.
+ *
+ * @param integer $ident The identity to retrieve the aliases from.
+ *
+ * @return array Aliases for the identity.
+ */
+ public function getAliasAddress($ident)
+ {
+ if (empty($this->_aliases[$ident])) {
+ $this->_aliases[$ident] = @array_merge($this->getValue('alias_addr', $ident),
+ array($this->getValue('replyto_addr', $ident)));
+ }
+
+ return $this->_aliases[$ident];
+ }
+
+ /**
+ * Returns an array with all identities' from addresses.
+ *
+ * @param boolean $alias Include aliases?
+ *
+ * @return array The array with
+ * KEY - address
+ * VAL - identity number
+ */
+ public function getAllFromAddresses($alias = false)
+ {
+ $list = array();
+
+ foreach ($this->_identitiesWithDefaultLast() as $key => $identity) {
+ /* Get From Addresses. */
+ $list[Horde_String::lower($this->getFromAddress($key))] = $key;
+
+ /* Get Aliases. */
+ if ($alias) {
+ $addrs = $this->getAliasAddress($key);
+ if (!empty($addrs)) {
+ foreach (array_filter($addrs) as $val) {
+ $list[Horde_String::lower($val)] = $key;
+ }
+ }
+ }
+ }
+
+ return $list;
+ }
+
+ /**
+ * Get all 'tie to' address/identity pairs.
+ *
+ * @return array The array with
+ * KEY - address
+ * VAL - identity number
+ */
+ public function getAllTieAddresses()
+ {
+ $list = array();
+
+ foreach ($this->_identitiesWithDefaultLast() as $key => $identity) {
+ $tieaddr = $this->getValue('tieto_addr', $key);
+ if (!empty($tieaddr)) {
+ foreach ($tieaddr as $val) {
+ $list[$val] = $key;
+ }
+ }
+ }
+
+ return $list;
+ }
+
+ /**
+ * Returns the list of identities with the default identity positioned
+ * last.
+ *
+ * @return array The identities list with the default identity last.
+ */
+ protected function _identitiesWithDefaultLast()
+ {
+ $ids = $this->_identities;
+ $default = $this->getDefault();
+ $tmp = $ids[$default];
+ unset($ids[$default]);
+ $ids[$default] = $tmp;
+ return $ids;
+ }
+
+ /**
+ * Returns the BCC addresses for a given identity.
+ *
+ * @param integer $ident The identity to retrieve the Bcc addresses from.
+ *
+ * @return array The array of objects (IMAP addresses).
+ */
+ public function getBccAddresses($ident = null)
+ {
+ $bcc = $this->getValue('bcc_addr', $ident);
+ if (empty($bcc)) {
+ return array();
+ } else {
+ if (!is_array($bcc)) {
+ $bcc = array($bcc);
+ }
+ try {
+ return Horde_Mime_Address::parseAddressList(implode(', ', $bcc));
+ } catch (Horde_Mime_Exception $e) {
+ return array();
+ }
+ }
+ }
+
+ /**
+ * Returns the identity's id that matches the passed addresses.
+ *
+ * @param mixed $addresses Either an array or a single string or a
+ * comma-separated list of email addresses.
+ * @param boolean $search_ties Search for a matching identity in tied
+ * addresses too?
+ *
+ * @return integer The id of the first identity that from or alias
+ * addresses match (one of) the passed addresses or
+ * null if none matches.
+ */
+ public function getMatchingIdentity($addresses, $search_ties = true)
+ {
+ static $tie_addresses, $own_addresses;
+
+ if (!isset($tie_addresses)) {
+ $tie_addresses = $this->getAllTieAddresses();
+ $own_addresses = $this->getAllFromAddresses(true);
+ }
+
+ /* Normalize address list. */
+ if (is_array($addresses)) {
+ $addresses = array_filter($addresses);
+ } else {
+ $addresses = array($addresses);
+ }
+
+ try {
+ $addr_list = Horde_Mime_Address::parseAddressList(implode(', ', $addresses));
+ } catch (Horde_Mime_Exception $e) {
+ return null;
+ }
+
+ foreach ($addr_list as $address) {
+ if (empty($address['mailbox'])) {
+ continue;
+ }
+ $find_address = $address['mailbox'];
+ if (!empty($address['host'])) {
+ $find_address .= '@' . $address['host'];
+ }
+ $find_address = Horde_String::lower($find_address);
+
+ /* Search 'tieto' addresses first. */
+ /* Check for this address explicitly. */
+ if ($search_ties && isset($tie_addresses[$find_address])) {
+ return $tie_addresses[$find_address];
+ }
+
+ /* If we didn't find the address, check for the domain. */
+ if (!empty($address['host'])) {
+ $host = '@' . $address['host'];
+ if ($search_ties &&
+ isset($tie_addresses[$host]) &&
+ ($host != '@')) {
+ return $tie_addresses[$host];
+ }
+ }
+
+ /* Next, search all from addresses. */
+ if (isset($own_addresses[$find_address])) {
+ return $own_addresses[$find_address];
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user's full name.
+ *
+ * @param integer $ident The identity to retrieve the name from.
+ *
+ * @return string The user's full name.
+ */
+ public function getFullname($ident = null)
+ {
+ if (isset($this->_names[$ident])) {
+ return $this->_names[$ident];
+ }
+
+ $this->_names[$ident] = $this->getValue('fullname', $ident);
+
+ return $this->_names[$ident];
+ }
+
+ /**
+ * Returns the full signature based on the current settings for the
+ * signature itself, the dashes and the position.
+ *
+ * @param integer $ident The identity to retrieve the signature from.
+ *
+ * @return string The full signature.
+ * @throws Horde_Exception
+ */
+ public function getSignature($ident = null)
+ {
+ if (isset($this->_signatures[$ident])) {
+ return $this->_signatures[$ident];
+ }
+
+ $val = $this->getValue('signature', $ident);
+ if (!empty($val)) {
+ $sig_first = $this->getValue('sig_first', $ident);
+ $sig_dashes = $this->getValue('sig_dashes', $ident);
+ $val = str_replace("\r\n", "\n", $val);
+ if ($sig_dashes) {
+ $val = "-- \n$val";
+ }
+ if (isset($sig_first) && $sig_first) {
+ $val = "\n" . $val . "\n\n\n";
+ } else {
+ $val = "\n" . $val;
+ }
+ }
+
+ try {
+ $val = Horde::callHook('prefs_hook_signature', array($val), 'imp');
+ } catch (Horde_Exception_HookNotSet $e) {}
+
+ $this->_signatures[$ident] = $val;
+
+ return $val;
+ }
+
+ /**
+ * Returns an array with the signatures from all identities
+ *
+ * @return array The array with all the signatures.
+ */
+ public function getAllSignatures()
+ {
+ static $list;
+
+ if (isset($list)) {
+ return $list;
+ }
+
+ foreach ($this->_identities as $key => $identity) {
+ $list[$key] = $this->getSignature($key);
+ }
+
+ return $list;
+ }
+
+ /**
+ * @see Horde_Prefs_Identity::getValue()
+ */
+ public function getValue($key, $identity = null)
+ {
+ if ($key == 'sent_mail_folder') {
+ $folder = parent::getValue('sent_mail_folder', $identity);
+ return strlen($folder) ? IMP::folderPref($folder, true) : '';
+ }
+ return parent::getValue($key, $identity);
+ }
+
+ /**
+ * Returns an array with the sent-mail folder names from all the
+ * identities.
+ *
+ * @return array The array with the folder names.
+ */
+ public function getAllSentmailFolders()
+ {
+ $list = array();
+ foreach ($this->_identities as $key => $identity) {
+ if ($folder = $this->getValue('sent_mail_folder', $key)) {
+ $list[$folder] = 1;
+ }
+ }
+
+ /* Get rid of duplicates and empty folders. */
+ return array_filter(array_keys($list));
+ }
+
+ /**
+ * Returns true if the mail should be saved and the user is allowed to.
+ *
+ * @param integer $ident The identity to retrieve the setting from.
+ *
+ * @return boolean True if the sent mail should be saved.
+ */
+ public function saveSentmail($ident = null)
+ {
+ if (!$GLOBALS['conf']['user']['allow_folders']) {
+ return false;
+ }
+
+ return $this->getValue('save_sent_mail', $ident);
+ }
+
+}
if (!isset($imp_compose)) {
$imp_compose = IMP_Compose::singleton();
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
try {
$from_line = $identity->getFromLine();
} catch (Horde_Exception $e) {
}
$recipients = implode(', ', $recip['list']);
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Preffs_Identity::singleton(array('imp', 'imp'));
$from_addr = $identity->getFromAddress();
$headers = $contents->getHeaderOb();
$ret['from'] = _("Invalid Address");
$ret['error'] = true;
} else {
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
if ($identity->hasAddress($from['inner'])) {
/* This message was sent by one of the user's identity
* addresses - show To: information instead. */
);
/* Load Identity. */
- $identity = Identity::singleton(array('imp', 'imp'));
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
$selected_identity = $identity->getDefault();
/* Get user identities. */
}
/* Create the Identity object. */
-$user_identity = Identity::singleton(array('imp', 'imp'));
+$user_identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
/* Develop the list of headers to display. */
$basic_headers = $imp_ui->basicHeaders();
Horde_Nls::setTimeZone();
/* Initialize the user's identities. */
-$user_identity = Identity::singleton(array('imp', 'imp'));
+$user_identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
/* Run through action handlers. */
$actionID = Horde_Util::getFormData('actionID');
extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-require_once 'Horde/Prefs/UI.php';
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
-Prefs_UI::generateHeader('pgp', $chunk);
+Horde_Prefs_Ui::generateHeader('pgp', $chunk);
/* If PGP preference not active, do NOT show PGP Admin screen. */
$t = new Horde_Template();
$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 {
- $imp_identity = Identity::singleton(array('imp', 'imp'));
+ $imp_identity = Horde_Prefs_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'));
$t->set('personalkey-create-comment-help', Horde_Help::link('imp', 'pgp-personalkey-create-comment'));
extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-require_once 'Horde/Prefs/UI.php';
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
-Prefs_UI::generateHeader('smime', $chunk);
+Horde_Prefs_Ui::generateHeader('smime', $chunk);
$selfURL = Horde::applicationUrl('smime.php');
require_once dirname(__FILE__) . '/lib/Application.php';
new IMP_Application(array('init' => array('authentication' => 'horde')));
-require_once 'Horde/Prefs/UI.php';
$compose_url = Horde::getServiceLink('options', 'imp');
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
-Prefs_UI::generateHeader(null, $chunk);
+Horde_Prefs_Ui::generateHeader(null, $chunk);
$t = new Horde_Template();
$t->setOption('gettext', true);
$t->set('action', Horde::selfUrl());
$t->set('forminput', Horde_Util::formInput());
-$t->set('navcell', Horde_Util::bufferOutput(array('Prefs_UI', 'generateNavigationCell'), 'compose'));
+$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'compose'));
$slist = array();
foreach ($stationery_list as $key => $choice) {
/* Make sure we have at least one address. */
if (empty($info['addresses'])) {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none');
+ $identity = Horde_Prefs_Identity::singleton('none');
$info['addresses'] = implode("\n", $identity->getAll('from_addr'));
/* Remove empty lines. */
$info['addresses'] = preg_replace('/\n+/', "\n", $info['addresses']);
*/
protected function _retrieve($field, $readonly = false)
{
- $prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- $GLOBALS['registry']->getApp(),
- Ingo::getUser(), '', null, false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $GLOBALS['registry']->getApp(),
+ Ingo::getUser(), '', null, false);
$prefs->retrieve();
switch ($field) {
*/
protected function _store($ob)
{
- $prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- $GLOBALS['registry']->getApp(),
- Ingo::getUser(), '', null, false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $GLOBALS['registry']->getApp(),
+ Ingo::getUser(), '', null, false);
$prefs->retrieve();
switch ($ob->obType()) {
/* If personal share doesn't exist then create it. */
$signature = $_SESSION['ingo']['backend']['id'] . ':' . Horde_Auth::getAuth();
if (!$GLOBALS['ingo_shares']->exists($signature)) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
/* Make sure we have at least one address. */
if (!$vacation->getVacationAddresses()) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton('none');
+ $identity = Horde_Prefs_Identity::singleton('none');
$addresses = implode("\n", $identity->getAll('from_addr'));
/* Remove empty lines. */
$addresses = preg_replace('/\n+/', "\n", $addresses);
*/
require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Identity.php';
// Get the current attendees array from the session cache.
$attendees = (isset($_SESSION['kronolith']['attendees']) &&
$delimg = Horde::img('delete.png', _("Remove Attendee"), null,
$registry->getImageDir('horde'));
-$ident = &Identity::singleton();
+$ident = Horde_Prefs_Identity::singleton();
$identities = $ident->getAll('id');
$vars = Horde_Variables::getDefaultVariables();
$tabs = new Horde_Ui_Tabs(null, $vars);
exit;
case Horde_Data::EXPORT_ICALENDAR:
- require_once 'Horde/Identity.php';
$iCal = new Horde_iCalendar();
$calNames = array();
$fb = $cache->get($key, 360);
if (!$fb) {
if ($user) {
- $prefs = &Prefs::singleton($conf['prefs']['driver'], 'kronolith', $user, '', null, false);
+ $prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'kronolith', $user, '', null, false);
$prefs->retrieve();
Horde_Nls::setTimeZone();
$cal = @unserialize($prefs->getValue('fb_cals'));
$kronolith_authentication = 'none';
$kronolith_session_control = 'readonly';
require_once dirname(__FILE__) . '/../lib/base.php';
-require_once 'Horde/Identity.php';
$calendar = Horde_Util::getFormData('c');
$share = $kronolith_shares->getShare($calendar);
$self_url = Horde::applicationUrl($self_url, true, -1);
$owner = $share->get('owner');
-$identity = Identity::factory('none', $owner);
-$history = &Horde_History::singleton();
+$identity = Horde_Prefs_Identity::factory('none', $owner);
+$history = Horde_History::singleton();
$now = new Horde_Date(time());
$template = new Horde_Template();
if ($alarm_user == $current_user) {
$prefs = $GLOBALS['prefs'];
} else {
- $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'kronolith', $alarm_user, null,
null, false);
}
<?php
require_once 'Horde/Kolab.php';
-require_once 'Horde/Identity.php';
/**
* Horde Kronolith driver for the Kolab IMAP Server.
if (count(Kronolith::listCalendars(true)) == 0) {
// If the default share doesn't exist then create it.
if (!$GLOBALS['kronolith_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
{
global $kronolith_shares;
- require_once 'Horde/Identity.php';
-
if (!is_array($calendar)) {
$calendar = array($calendar);
}
}
/* Get the Identity for the owner of the share. */
- $identity = &Identity::singleton('none',
- $user ? $user : $owner);
+ $identity = Horde_Prefs_Identity::singleton('none', $user ? $user : $owner);
$email = $identity->getValue('from_addr');
$cn = $identity->getValue('fullname');
if (Horde_Auth::getAuth() &&
!count($GLOBALS['display_calendars']) &&
!$GLOBALS['kronolith_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
static $names = array();
if (!isset($names[$uid])) {
- require_once 'Horde/Identity.php';
- $ident = &Identity::singleton('none', $uid);
+ $ident = Horde_Prefs_Identity::singleton('none', $uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
static $emails = array();
if (!isset($emails[$uid])) {
- require_once 'Horde/Identity.php';
- $ident = &Identity::singleton('none', $uid);
+ $ident = Horde_Prefs_Identity::singleton('none', $uid);
$emails[$uid] = $ident->getValue('from_addr');
if (empty($emails[$uid])) {
$emails[$uid] = $uid;
static $emails = array();
if (!isset($emails[$uid])) {
- require_once 'Horde/Identity.php';
- $ident = &Identity::singleton('none', $uid);
+ $ident = Horde_Prefs_Identity::singleton('none', $uid);
$addrs = $ident->getAll('from_addr');
$addrs[] = $uid;
return;
}
- require_once 'Horde/Identity.php';
- $ident = &Identity::singleton('none', $event->getCreatorId());
+ $ident = Horde_Prefs_Identity::singleton('none', $event->getCreatorId());
$myemail = $ident->getValue('from_addr');
if (!$myemail) {
}
require_once 'Horde/Group.php';
- require_once 'Horde/Identity.php';
$groups = &Group::singleton();
$calendar = $event->getCalendar();
return $share;
}
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$from = $identity->getDefaultFromAddress(true);
$owner = $share->get('owner');
if (!$vals) {
continue;
}
- $identity = &Identity::singleton('none', $user);
+ $identity = Horde_Prefs_Identity::singleton('none', $user);
$email = $identity->getValue('from_addr');
if (strpos($email, '@') === false) {
continue;
*/
public static function _notificationPref($user, $mode, $calendar = null)
{
- $prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- 'kronolith', $user, '', null,
- false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ 'kronolith', $user, '', null,
+ false);
$prefs->retrieve();
$vals = array('lang' => $prefs->getValue('language'),
'tf' => $prefs->getValue('twentyFour'),
function html($active = true)
{
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
if (!$this->event || is_a($this->event, 'PEAR_Error')) {
echo '<h3>' . _("The requested event was not found.") . '</h3>';
$kronolith_authentication = 'none';
require_once dirname(__FILE__) . '/../lib/base.php';
-require_once 'Horde/Identity.php';
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
// Loop through the users and generate an agenda for them
foreach ($users as $user) {
- $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- 'kronolith', $user);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ 'kronolith', $user);
$prefs->retrieve();
$agenda_calendars = $prefs->getValue('daily_agenda');
}
// try to find an email address for the user
- $identity = Identity::singleton('none', $user);
+ $identity = Horde_Prefs_Identity::singleton('none', $user);
$email = $identity->getValue('from_addr');
if (strstr($email, '@')) {
list($mailbox, $host) = explode('@', $email);
/* Load required libraries. */
$kronolith_authentication = 'none';
require_once KRONOLITH_BASE . '/../../lib/base.php';
-require_once 'Horde/Prefs.php';
/* Prepare DB stuff. */
PEAR::staticPushErrorHandling(PEAR_ERROR_DIE);
if (!is_null($creator)) {
echo "$count\n";
}
- $prefs = Prefs::factory($conf['prefs']['driver'], 'horde',
- $row['event_creator_id']);
+ $prefs = Horde_Prefs::factory($conf['prefs']['driver'], 'horde',
+ $row['event_creator_id']);
$timezone = $prefs->getValue('timezone');
if (empty($timezone)) {
$timezone = date_default_timezone_get();
$nag_session_control = 'none';
require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Identity.php';
// We want to always generate UTF-8 iCalendar data.
Horde_Nls::setCharset('UTF-8');
Horde::fatal($result, __FILE__, __LINE__);
}
- $identity = Identity::singleton('none', $share->get('owner'));
+ $identity = Horde_Prefs_Identity::singleton('none', $share->get('owner'));
$storage->tasks->reset();
while ($task = $storage->tasks->each() ) {
$iCal->addComponent($task->toiCalendar($iCal));
$users = array($user);
}
foreach ($users as $alarm_user) {
- $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- 'nag', $alarm_user, null, null, false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'nag', $alarm_user, null, null, false);
Horde_Nls::setLanguageEnvironment($prefs->getValue('language'));
$alarm_list[] = $alarm->toAlarm($alarm_user, $prefs);
}
if (count(Nag::listTasklists(true)) == 0) {
// If the default share doesn't exist then create it.
if (!$GLOBALS['nag_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = &Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
$users = array_flip($users);
}
if (count($users)) {
- require_once 'Horde/Identity.php';
foreach (array_keys($users) as $user) {
- $identity = &Identity::singleton('none', $user);
+ $identity = Horde_Prefs_Identity::singleton('none', $user);
$fullname = $identity->getValue('fullname');
$users[$user] = strlen($fullname) ? $fullname : $user;
}
return '';
}
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $assignee);
+ $identity = Horde_Prefs_Identity::singleton('none', $assignee);
$fullname = $identity->getValue('fullname');
if (!strlen($fullname)) {
$fullname = $assignee;
/* If the user's personal tasklist doesn't exist, then create it. */
if (!$GLOBALS['nag_shares']->exists(Horde_Auth::getAuth())) {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
}
require_once 'Horde/Group.php';
- require_once 'Horde/Identity.php';
$groups = Group::singleton();
$recipients = array();
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$from = $identity->getDefaultFromAddress(true);
$owner = $share->get('owner');
if (!$vals) {
continue;
}
- $identity = Identity::singleton('none', $user);
+ $identity = Horde_Prefs_Identity::singleton('none', $user);
$email = $identity->getValue('from_addr');
if (strpos($email, '@') === false) {
continue;
$old_task->category, $task->category);
}
if ($old_task->assignee != $task->assignee) {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton('none', $old_task->assignee);
+ $identity = Horde_Prefs_Identity::singleton('none', $old_task->assignee);
$old_name = $identity->getValue('fullname');
if (!strlen($old_name)) {
$old_name = $old_task->assignee;
}
- $identity = Identity::singleton('none', $task->assignee);
+ $identity = Horde_Prefs_Identity::singleton('none', $task->assignee);
$new_name = $identity->getValue('fullname');
if (!strlen($new_name)) {
$new_name = $new_task->assignee;
static $names = array();
if (!isset($names[$uid])) {
- require_once 'Horde/Identity.php';
- $ident = Identity::singleton('none', $uid);
+ $ident = Horde_Prefs_Identity::singleton('none', $uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
*/
function _notificationPref($user, $mode, $tasklist = null)
{
- $prefs = Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
- 'nag', $user, '', null,
- false);
+ $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
+ 'nag', $user, '', null,
+ false);
$prefs->retrieve();
$vals = array('lang' => $prefs->getValue('language'),
'tf' => $prefs->getValue('twentyFour'),
*/
require_once dirname(__FILE__) . '/../lib/base.php';
-require_once 'Horde/Identity.php';
// Exit if this isn't an authenticated user.
if (!Horde_Auth::getAuth()) {
$subscribe_url = Horde::url($registry->get('webroot', 'horde') . '/rpc.php/nag/', true, -1)
. $tasklist->get('owner') . '/' . $tasklist->getName() . '.ics';
-$identity = Identity::singleton('none', $tasklist->get('owner'));
+$identity = Horde_Prefs_Identity::singleton('none', $tasklist->get('owner'));
$owner_name = $identity->getValue('fullname');
if (trim($owner_name) == '') {
$owner_name = Horde_Auth::getOriginalAuth();
function _getAddressBook()
{
require_once 'Horde/Group.php';
- require_once 'Horde/Identity.php';
$groups = Group::singleton();
$members = $groups->listAllUsers($this->_gid);
$addressbook = array();
foreach ($members as $member) {
- $identity = &Identity::singleton('none', $member);
+ $identity = Horde_Prefs_Identity::singleton('none', $member);
$name = $identity->getValue('fullname');
$email = $identity->getValue('from_addr');
// We use the email as the key since we could have multiple users
static $names = array();
if (!isset($names[$uid])) {
- require_once 'Horde/Identity.php';
- $ident = Identity::singleton('none', $uid);
+ $ident = Horde_Prefs_Identity::singleton('none', $uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
{
if (!isset($params['name'])) {
/* Sensible default for empty display names */
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton();
+ $identity = Horde_Prefs_Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
// Reset user prefs
unset($prefs);
- $prefs = &Prefs::factory($conf['prefs']['driver'], 'turba', $user, null, null, false);
+ $prefs = Horde_Prefs::factory($conf['prefs']['driver'], 'turba', $user, null, null, false);
// Reset $cfgSources for current user.
unset($cfgSources);
// Reset user prefs
unset($prefs);
- $prefs = &Prefs::factory($conf['prefs']['driver'], 'turba', $user, null, null, false);
+ $prefs = Horde_Prefs::factory($conf['prefs']['driver'], 'turba', $user, null, null, false);
// Reset $cfgSources for current user.
unset($cfgSources);