/* Collect moderators emails, and send them the notify */
$emails = array();
foreach ($forum['moderators'] as $moderator) {
- $identity = Horde_Prefs_Identity::singleton('none', $moderator);
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($moderator);
$address = $identity->getValue('from_addr');
if (!empty($address)) {
$emails[] = $address;
if (!$view_bodies) {
/* Get the author's avatar. */
if ($conf['avatar']['allow_avatars']) {
- $identity = Horde_Prefs_Identity::singleton('none', $message['message_author']);
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($message['message_author']);
$avatar_path = $identity->getValue('avatar_path');
$message_author_avatar = Agora::validateAvatar($avatar_path) ? Agora::getAvatarUrl($avatar_path) : false;
$view->message_author_avatar = $message_author_avatar;
/* Are we watermarking the image? */
if ($watermark) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (empty($name)) {
$name = Horde_Auth::getAuth();
$owner, '', null, false);
$fullname = $uprefs->getValue('grouptitle');
if (!$fullname) {
- $identity = Horde_Prefs_Identity::singleton('none', $owner);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($owner);
$fullname = $identity->getValue('fullname');
if (!$fullname) {
$fullname = $owner;
if (empty($user)) {
$this->addVariable(_("Use the following return address:"), 'ecard_retaddr', 'text', true);
} else {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$from_addr = $identity->getDefaultFromAddress();
$vars->set('ecard_retaddr', $from_addr);
$this->addHidden('', 'ecard_retaddr', 'text', true);
*/
public function getOwner()
{
- return Horde_Prefs_Identity::singleton('none', $this->data['share_owner']);
+ return $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($this->data['share_owner']);
}
/**
}
if (empty($watermark)) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (empty($name)) {
$name = Horde_Auth::getAuth();
*/
function _getUserEmail($user = null)
{
- return Horde_Prefs_Identity::singleton('none', $user)->getValue('from_addr');
+ return $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user)->getValue('from_addr');
}
/**
'ansel', $this->_owner, '', null, false);
$fullname = $uprefs->getValue('grouptitle');
if (!$fullname) {
- $identity = Horde_Prefs_Identity::singleton('none', $this->_owner);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($this->_owner);
$fullname = $identity->getValue('fullname');
if (!$fullname) {
$fullname = $this->_owner;
if (isset($galleries) && count($galleries)) {
$images = $ansel_storage->getRecentImages($galleries);
if (!is_a($images, 'PEAR_Error') && count($images)) {
- $owner = Horde_Prefs_Identity::singleton('none', $id);
+ $owner = $injector->getInstance('Horde_Prefs_Identity')->getOb($id);
$name = $owner->getValue('fullname');
$author = $owner->getValue('from_addr');
if (!$name) {
/* If the user's personal ledger doesn't exist, then create it. */
if (!$GLOBALS['fima_shares']->exists(Horde_Auth::getAuth())) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$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())) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
*/
protected function _getUserFromAddr($user)
{
- return Horde_Prefs_Identity::singleton('none', $user)->getValue('from_addr');
+ return $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user)->getValue('from_addr');
}
/**
if (empty($alarm['user'])) {
return;
}
- $identity = Horde_Prefs_Identity::singleton('none', $alarm['user']);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($alarm['user']);
$email = $identity->getDefaultFromAddress(true);
} else {
$email = $alarm['params']['mail']['email'];
--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Core
+ */
+class Horde_Core_Binder_Identity implements Horde_Injector_Binder
+{
+ public function create(Horde_Injector $injector)
+ {
+ return new Horde_Core_Factory_Identity($injector);
+ }
+
+ public function equals(Horde_Injector_Binder $binder)
+ {
+ return false;
+ }
+}
--- /dev/null
+<?php
+/**
+ * A Horde_Injector:: based Horde_Identity:: factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * A Horde_Injector:: based Horde_Identity:: factory.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Core
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_Identity
+{
+ /**
+ * Instances.
+ *
+ * @var array
+ */
+ private $_instances = array();
+
+ /**
+ * The injector.
+ *
+ * @var Horde_Injector
+ */
+ private $_injector;
+
+ /**
+ * Constructor.
+ *
+ * @param Horde_Injector $injector The injector to use.
+ */
+ public function __construct(Horde_Injector $injector)
+ {
+ $this->_injector = $injector;
+ }
+
+ /**
+ * Return the Horde_Identity:: instance.
+ *
+ * @param string $user The user to use, if not the current user.
+ * @param string $driver The identity driver. Either empty (use default
+ * driver) or an application name.
+ *
+ * @return Horde_Identity The singleton identity instance.
+ * @throws Horde_Exception
+ */
+ public function getOb($user = null, $driver = null)
+ {
+ $class = empty($driver)
+ ? 'Horde_Prefs_Identity'
+ : Horde_String::ucfirst($driver) . '_Prefs_Identity';
+ $key = $class . '|' . $user;
+
+ if (!isset($this->_instances[$key])) {
+ if (!class_exists($class)) {
+ throw new Horde_Exception('Class definition of ' . $class . ' not found.');
+ }
+
+ $params = array(
+ 'user' => is_null($user) ? Horde_Auth::getAuth() : $user,
+ );
+
+ if (isset($GLOBALS['prefs']) &&
+ ($params['user'] == Horde_Auth::getAuth())) {
+ $params['prefs'] = $GLOBALS['prefs'];
+ } else {
+ $params['prefs'] = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], $GLOBALS['registry']->getApp(), $user, '', null, false);
+ $params['prefs']->retrieve();
+ }
+
+ $this->_instances[$key] = new $class($params);
+ $this->_instances[$key]->init();
+ }
+
+ return $this->_instances[$key];
+ }
+
+}
*/
protected function _identityHeader($members)
{
- $identity = Horde_Prefs_Identity::singleton(($this->app == 'horde') ? null : array($this->app, $this->app));
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb(null, $this->app);
$default_identity = $identity->getDefault();
$t = $GLOBALS['injector']->createInstance('Horde_Template');
{
global $conf, $notification, $prefs;
- $identity = Horde_Prefs_Identity::singleton(($this->app == 'horde') ? null : array($this->app, $this->app));
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb(null, $this->app);
if ($this->vars->delete_identity) {
$id = intval($this->vars->id);
'Horde_Memcache' => new Horde_Core_Binder_Memcache(),
'Horde_Notification' => new Horde_Core_Binder_Notification(),
'Horde_Perms' => new Horde_Core_Binder_Perms(),
+ 'Horde_Prefs_Identity' => new Horde_Core_Binder_Identity(),
// 'Horde_Registry' - initialized below
'Horde_Secret' => new Horde_Core_Binder_Secret(),
'Horde_Template' => new Horde_Core_Binder_Template(),
<file name="Dns.php" role="php" />
<file name="Editor.php" role="php" />
<file name="History.php" role="php" />
+ <file name="Identity.php" role="php" />
<file name="Lock.php" role="php" />
<file name="Logger.php" role="php" />
<file name="Mail.php" role="php" />
</dir> <!-- /lib/Horde/Core/Binder -->
<dir name="Factory">
<file name="Editor.php" role="php" />
+ <file name="Identity.php" role="php" />
<file name="KolabServer.php" role="php" />
<file name="KolabSession.php" role="php" />
<file name="KolabStorage.php" role="php" />
<install name="lib/Horde/Core/Binder/Dns.php" as="Horde/Core/Binder/Dns.php" />
<install name="lib/Horde/Core/Binder/Editor.php" as="Horde/Core/Binder/Editor.php" />
<install name="lib/Horde/Core/Binder/History.php" as="Horde/Core/Binder/History.php" />
+ <install name="lib/Horde/Core/Binder/Identity.php" as="Horde/Core/Binder/Identity.php" />
<install name="lib/Horde/Core/Binder/Lock.php" as="Horde/Core/Binder/Lock.php" />
<install name="lib/Horde/Core/Binder/Logger.php" as="Horde/Core/Binder/Logger.php" />
<install name="lib/Horde/Core/Binder/Mail.php" as="Horde/Core/Binder/Mail.php" />
<install name="lib/Horde/Core/Binder/Token.php" as="Horde/Core/Binder/Token.php" />
<install name="lib/Horde/Core/Binder/Vfs.php" as="Horde/Core/Binder/Vfs.php" />
<install name="lib/Horde/Core/Factory/Editor.php" as="Horde/Core/Factory/Editor.php" />
+ <install name="lib/Horde/Core/Factory/Identity.php" as="Horde/Core/Factory/Identity.php" />
<install name="lib/Horde/Core/Factory/KolabServer.php" as="Horde/Core/Factory/KolabServer.php" />
<install name="lib/Horde/Core/Factory/KolabSession.php" as="Horde/Core/Factory/KolabSession.php" />
<install name="lib/Horde/Core/Factory/KolabStorage.php" as="Horde/Core/Factory/KolabStorage.php" />
$mod = array(), $err = array())
{
/* Set up some variables we use later. */
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$from_addr = $identity->getDefaultFromAddress();
$to = $this->getMdnReturnAddr();
class Horde_Prefs_Identity
{
/**
- * Singleton instances.
- *
- * @var array
- */
- static protected $_instances = array();
-
- /**
* Array containing all the user's identities.
*
* @var array
/**
* Constructor.
*
- * Reads all the user's identities from the prefs object or builds a new
- * identity from the standard values given in prefs.php.
- *
- * @param string $user If specified, we read another user's identities
- * instead of the current user.
+ * @param array $params Parameters:
+ * <pre>
+ * 'prefs' - (Horde_Prefs) [REQUIRED] The prefs object to use.
+ * 'user' - (string) [REQUIRED] The user whose prefs we are handling.
+ * </pre>
*/
- public function __construct($user = null)
+ public function __construct($params = array())
{
- $this->_user = is_null($user)
- ? Horde_Auth::getAuth()
- : $user;
-
- if ((is_null($user) || $user == Horde_Auth::getAuth()) &&
- isset($GLOBALS['prefs'])) {
- $this->_prefs = $GLOBALS['prefs'];
- } else {
- $this->_prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], $GLOBALS['registry']->getApp(), $user, '', null, false);
- $this->_prefs->retrieve();
- }
+ $this->_prefs = $params['prefs'];
+ $this->_user = $params['user'];
if (!($this->_identities = @unserialize($this->_prefs->getValue('identities', false)))) {
- /* Convert identities from the old format. */
- $this->_identities = @unserialize($this->_prefs->getValue('identities'));
- } elseif (is_array($this->_identities)) {
+ $this->_identities = $this->_prefs->getDefault('identities');
+ } else {
$this->_identities = $this->_prefs->convertFromDriver($this->_identities, Horde_Nls::getCharset());
}
return array(sprintf(_("The email address %s has been added to your identities. You can close this window now."), $verified['from_addr']), 'horde.success');
}
- /**
- * Attempts to return a concrete instance based on $type.
- *
- * @param mixed $driver The type of concrete Identity subclass to return.
- * This is based on the storage driver. The code is
- * dynamically included. If $type is an array, then
- * we will look in $driver[0]/lib/Prefs/Identity/
- * for the subclass implementation named
- * $driver[1].php.
- * @param string $user If specified, we read another user's identities
- * instead of the current user.
- *
- * @return Horde_Prefs_Identity The newly created instance.
- * @throws Horde_Exception
- */
- static public function factory($driver = 'None', $user = null)
- {
- if (is_array($driver)) {
- list($app, $driv_name) = $driver;
- $driver = basename($driv_name);
- } else {
- $driver = basename($driver);
- }
-
- /* Return a base Identity object if no driver is specified. */
- if (empty($driver) || (strcasecmp($driver, 'none') == 0)) {
- $instance = new self($user);
- $instance->init();
- return $instance;
- }
-
- $class = (empty($app) ? 'Horde' : $app) . '_Prefs_Identity';
-
- if (class_exists($class)) {
- $instance = new $class($user);
- $instance->init();
- return $instance;
- }
-
- throw new Horde_Exception('Class definition of ' . $class . ' not found.');
- }
-
- /**
- * Attempts to return a reference to a concrete instance based on
- * $type. It will only create a new instance if no instance with
- * the same parameters currently exists.
- *
- * This should be used if multiple types of identities (and, thus,
- * multiple instances) are required.
- *
- * This method must be invoked as:
- * $var = Horde_Prefs_Identity::singleton()
- *
- * @param mixed $type The type of concrete subclass to return.
- * This is based on the storage driver ($type). The
- * code is dynamically included. If $type is an array,
- * then we will look in $type[0]/lib/Prefs/Identity/
- * for the subclass implementation named
- * $type[1].php.
- * @param string $user If specified, we read another user's identities
- * instead of the current user.
- *
- * @return Horde_Prefs_Identity The concrete reference.
- * @throws Horde_Exception
- */
- static public function singleton($type = 'None', $user = null)
- {
- $signature = hash('md5', serialize(array($type, $user)));
- if (!isset(self::$_instances[$signature])) {
- self::$_instances[$signature] = self::factory($type, $user);
- }
-
- return self::$_instances[$signature];
- }
-
}
}
}
- return Horde_Prefs_Identity::singleton('none', $share->get('owner'));
+ return $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($share->get('owner'));
}
/**
$notification->push(sprintf(_("There was a problem updating \"%s\": %s"),
$user_name_1, $result->getMessage()), 'horde.error');
} else {
- $identity = Horde_Prefs_Identity::singleton('none', $user_name_1);
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($user_name_1);
$identity->setValue('fullname', $fullname);
$identity->setValue('from_addr', $email);
$identity->save();
require HORDE_TEMPLATES . '/admin/menu.inc';
if (isset($update_form) && $auth->hasCapability('list')) {
- $identity = Horde_Prefs_Identity::singleton('none', $f_user_name);
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($f_user_name);
require HORDE_TEMPLATES . '/admin/user/update.inc';
} elseif (isset($remove_form) &&
$auth->hasCapability('list') &&
// Import identities
if (isset($prefs_cache['identities']) && $prefs_cache['identities'] > 1) {
- $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'), $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user, 'imp');
// Intentionally off-by-one
for ($i = 1; $i < $prefs_cache['identities']; $i++) {
$new_identity = array('id' => 'Identity #' . ($i + 1),
require_once dirname(__FILE__) . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('nologintasks' => true));
-$identity = Horde_Prefs_Identity::singleton();
+$identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
list($message, $type) = $identity->confirmIdentity(Horde_Util::getFormData('h'));
$notification->push($message, $type);
Horde_Registry::appInit('horde');
// Get full name.
-$identity = Horde_Prefs_Identity::singleton();
+$identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$fullname = $identity->getValue('fullname');
if (empty($fullname)) {
$fullname = Horde_Auth::convertUsername(Horde_Auth::getAuth(), false);
require_once dirname(__FILE__) . '/../../lib/Application.php';
Horde_Registry::appInit('horde');
-$identity = Horde_Prefs_Identity::singleton();
+$identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$fullname = $identity->getValue('fullname');
if (empty($fullname)) {
$fullname = Horde_Auth::getAuth();
_returnToPage();
}
-$identity = Horde_Prefs_Identity::singleton();
+$identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$email = $identity->getValue('from_addr');
if (!$email) {
$email = Horde_Util::getFormData('email', Horde_Auth::getAuth());
$prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'horde', $mail_user);
$prefs->retrieve();
- $mail_identity = Horde_Prefs_Identity::singleton('none', $mail_user);
+ $mail_identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($mail_user);
$mail_address = $mail_identity->getDefaultFromAddress();
/* Ignore missing addresses, which are returned as <>. */
/* Set up the mail headers and read the log file. */
$msg_headers = new Horde_Mime_Headers();
$msg_headers->addReceivedHeader(array(
- 'dns' => $GLOBALS['injector']->getInstance('Net_DNS_Resolver'),
- 'server' => $GLOBALS['conf']['server']['name']
+ 'dns' => $injector->getInstance('Net_DNS_Resolver'),
+ 'server' => $conf['server']['name']
));
$msg_headers->addMessageIdHeader();
$msg_headers->addUserAgentHeader();
*/
public function create(Horde_Injector $injector)
{
- return Horde_Prefs_Identity::singleton(array('imp', 'imp'));
+ return $injector->getInstance('Horde_Prefs_Identity')->getOb(null, 'imp');
}
/**
/**
* Reads all the user's identities from the prefs object or builds
* a new identity from the standard values given in prefs.php.
+ *
+ * @see Horde_Prefs_Identity::__construct()
*/
- public function __construct()
+ public function __construct($params)
{
- parent::__construct();
+ parent::__construct($params);
$this->_properties = array_merge(
$this->_properties,
/* Make sure we have at least one address. */
if (empty($info['addresses'])) {
- $identity = Horde_Prefs_Identity::singleton('none');
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
/* Remove empty lines. */
$info['addresses'] = preg_replace('/\n{2,}/', "\n", implode("\n", $identity->getAll('from_addr')));
if (empty($addresses)) {
/* If personal share doesn't exist then create it. */
$signature = $_SESSION['ingo']['backend']['id'] . ':' . Horde_Auth::getAuth();
if (!$GLOBALS['ingo_shares']->exists($signature)) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
/* Make sure we have at least one address. */
if (!$vacation->getVacationAddresses()) {
- $identity = Horde_Prefs_Identity::singleton('none');
+ $identity = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$addresses = implode("\n", $identity->getAll('from_addr'));
/* Remove empty lines. */
$addresses = preg_replace('/\n+/', "\n", $addresses);
// Pre-format our delete image/link.
$delimg = Horde::img('delete.png', _("Remove Attendee"));
-$ident = Horde_Prefs_Identity::singleton();
+$ident = $injector->getInstance('Horde_Prefs_Identity')->getOb();
$identities = $ident->getAll('id');
$vars = Horde_Variables::getDefaultVariables();
$tabs = new Horde_Ui_Tabs(null, $vars);
}
/* Get the Identity for the owner of the share. */
- $identity = Horde_Prefs_Identity::singleton('none', $user ? $user : $owner);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user ? $user : $owner);
$email = $identity->getValue('from_addr');
$cn = $identity->getValue('fullname');
if (empty($mail) && empty($cn)) {
if (Horde_Auth::getAuth() &&
!count($GLOBALS['display_calendars']) &&
!$GLOBALS['kronolith_shares']->exists(Horde_Auth::getAuth())) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
static $names = array();
if (!isset($names[$uid])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
static $emails = array();
if (!isset($emails[$uid])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$emails[$uid] = $ident->getValue('from_addr');
if (empty($emails[$uid])) {
$emails[$uid] = $uid;
static $emails = array();
if (!isset($emails[$uid])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$addrs = $ident->getAll('from_addr');
$addrs[] = $uid;
return;
}
- $ident = Horde_Prefs_Identity::singleton('none', $event->creator);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($event->creator);
$myemail = $ident->getValue('from_addr');
if (!$myemail) {
throw new Kronolith_Exception($share);
}
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$from = $identity->getDefaultFromAddress(true);
$owner = $share->get('owner');
if (!$vals) {
continue;
}
- $identity = Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$email = $identity->getValue('from_addr');
if (strpos($email, '@') === false) {
continue;
exit;
}
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
if ($this->event->hasPermission(Horde_Perms::EDIT)) {
$calendar_id = $this->event->calendar;
}
// try to find an email address for the user
- $identity = Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$email = $identity->getValue('from_addr');
if (strstr($email, '@')) {
list($mailbox, $host) = explode('@', $email);
static $names = array();
if (!isset($names[$uid])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
/* If the user's personal notepad doesn't exist, then create it. */
if (!$GLOBALS['mnemo_shares']->exists(Horde_Auth::getAuth())) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::removeHook(Horde_Auth::getAuth());
}
if (count($users)) {
foreach (array_keys($users) as $user) {
- $identity = Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$fullname = $identity->getValue('fullname');
$users[$user] = strlen($fullname) ? $fullname : $user;
}
return '';
}
- $identity = Horde_Prefs_Identity::singleton('none', $assignee);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($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())) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
$groups = Group::singleton();
$recipients = array();
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$from = $identity->getDefaultFromAddress(true);
$owner = $share->get('owner');
if (!$vals) {
continue;
}
- $identity = Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$email = $identity->getValue('from_addr');
if (strpos($email, '@') === false) {
continue;
$old_task->category, $task->category);
}
if ($old_task->assignee != $task->assignee) {
- $identity = Horde_Prefs_Identity::singleton('none', $old_task->assignee);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($old_task->assignee);
$old_name = $identity->getValue('fullname');
if (!strlen($old_name)) {
$old_name = $old_task->assignee;
}
- $identity = Horde_Prefs_Identity::singleton('none', $task->assignee);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($task->assignee);
$new_name = $identity->getValue('fullname');
if (!strlen($new_name)) {
$new_name = $new_task->assignee;
static $names = array();
if (!isset($names[$uid])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
. ($tasklist->get('owner') ? $tasklist->get('owner') : '')
. '/' . $tasklist->getName() . '.ics';
-$identity = Horde_Prefs_Identity::singleton('none', $tasklist->get('owner'));
+$identity = $injector->getInstance('Horde_Prefs_Identity')->getOb($tasklist->get('owner'));
$owner_name = $identity->getValue('fullname');
if (trim($owner_name) == '') {
$owner_name = Horde_Auth::getOriginalAuth();
$members = $groups->listAllUsers($this->_gid);
$addressbook = array();
foreach ($members as $member) {
- $identity = Horde_Prefs_Identity::singleton('none', $member);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($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])) {
- $ident = Horde_Prefs_Identity::singleton('none', $uid);
+ $ident = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($uid);
$ident->setDefault($ident->getDefault());
$names[$uid] = $ident->getValue('fullname');
if (empty($names[$uid])) {
{
if (!isset($params['name'])) {
/* Sensible default for empty display names */
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
$name = Horde_Auth::getOriginalAuth();
if ($auth->hasCapability('list')) {
foreach ($auth->listUsers() as $user) {
- $identity = Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$addrs = $identity->getAll('from_addr');
foreach ($addrs as $addr) {
if (strcasecmp($from, $addr) == 0) {
}
/* Build message template. */
- $identity = &Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$name = $identity->getValue('fullname');
if (empty($name)) {
$name = Horde_Auth::getBareAuth();
}
} catch (Horde_Mime_Exception $e) {}
} else {
- $identity = &Horde_Prefs_Identity::singleton('none', $user);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($user);
$results[$user]['name'] = $identity->getValue('fullname');
$results[$user]['email'] = $identity->getValue('from_addr');
return _("Guest");
}
- $identity = &Horde_Prefs_Identity::singleton(null, $modify);
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb($modify);
$name = $identity->getValue('fullname');
if (!empty($name)) {
$modify = $name;
$conf['wicked']['guest_address'] :
$conf['wicked']['notify_address'];
if (Horde_Auth::getAuth()) {
- $identity = Horde_Prefs_Identity::singleton();
+ $identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getOb();
$from = $identity->getValue('fullname');
if (empty($from)) {
$from = $registry->get('name');