Class Identity

Description

This class provides an interface to all identities a user might have. Its methods take care of any site-specific restrictions configured in prefs.php and conf.php.

$Horde: framework/Prefs/Identity.php,v 1.1.2.15 2011-01-06 17:07:05 jan Exp $

Copyright 2001-2009 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.

Located in /Prefs/Identity.php (line 22)


	
			
Variable Summary
 integer $_default
 array $_identities
 array $_properties
 string $_user
Method Summary
 Identity Identity ([string $user = null])
 integer add ([array $identity = array()])
 array confirmIdentity (string $hash)
 array delete (integer $identity)
 Identity &factory ([mixed $type = 'none'], [string $user = null])
 array get ([integer $identity = null])
 array getAll (string $key)
 integer getDefault ()
 string getDefaultFromAddress ([boolean $fullname = false])
 mixed getValue (string $key, [integer $identity = null])
 boolean hasValue (string $key,  $valueA, string $value)
 void init ()
 boolean isLocked ()
 void save ()
 boolean setDefault (integer $identity)
 boolean setValue (string $key, mixed $val, [integer $identity = null])
 Identity &singleton ([mixed $type = 'none'], [string $user = null])
 bool|object verify ([integer $identity = null])
 void verifyIdentity (integer $id, string $old_addr)
Variables
integer $_default = 0 (line 38)

A pointer to the user's standard identity.

This one is used by the methods returning values if no other one is specified.

array $_identities = array() (line 29)

Array containing all the user's identities.

Prefs $_prefs (line 59)

Reference to the prefs object that this Identity points to.

array $_properties = array('id', 'fullname', 'from_addr') (line 52)

Array containing all of the properties in this identity.

string $_user = null (line 45)

The user whose identities these are.

Methods
Constructor Identity (line 68)

Reads all the user's identities from the prefs object or builds a new identity from the standard values given in prefs.php.

Identity Identity ([string $user = null])
  • string $user: If specified, we read another user's identities instead of the current user.
add (line 146)

Adds a new identity to the array of identities.

  • return: The pointer to the created identity
integer add ([array $identity = array()])
  • array $identity: An identity hash to add.
confirmIdentity (line 458)

Checks whether an identity confirmation is valid, and adds the validated identity.

  • return: A message for the user, and the message level.
array confirmIdentity (string $hash)
  • string $hash: The saved hash of the identity being validated.
delete (line 174)

Removes an identity from the array of identities.

  • return: The removed identity
array delete (integer $identity)
  • integer $identity: The pointer to the identity to be removed
factory (line 509)

Attempts to return a concrete Identity instance based on $type.

  • return: The newly created concrete Identity instance, or false on an error.
Identity &factory ([mixed $type = 'none'], [string $user = null])
  • mixed $type: The type of concrete Identity 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/Identity/ for the subclass implementation named $type[1].php.
  • string $user: If specified, we read another user's identities instead of the current user.
get (line 159)

Returns a complete identity hash.

  • return: An identity hash.
array get ([integer $identity = null])
  • integer $identity: The identity to retrieve.
getAll (line 246)

Returns an array with the specified property from all existing identities.

  • return: The array with the values from all identities
array getAll (string $key)
  • string $key: The property to retrieve.
getDefault (line 191)

Returns a pointer to the current default identity.

  • return: The pointer to the current default identity
integer getDefault ()
getDefaultFromAddress (line 361)

Generates the from address to use for the default identity.

  • return: The default from address.
string getDefaultFromAddress ([boolean $fullname = false])
  • boolean $fullname: Include the fullname information.
getValue (line 223)

Returns a property from one of the identities. If this value doesn't exist or is locked, the property is retrieved from the prefs backend.

  • return: The value of the property.
mixed getValue (string $key, [integer $identity = null])
  • string $key: The property to retrieve.
  • integer $identity: The identity to retrieve the property from.
hasValue (line 303)

Returns true if the given address belongs to one of the identities.

  • return: True if the $value was found in $key.
boolean hasValue (string $key,  $valueA, string $value)
  • string $key: The identity key to search.
  • string $value: The value to search for in $key.
  • $valueA
init (line 99)

Creates a default identity if none exists yet and sets the preferences up if the identities are locked.

void init ()
isLocked (line 284)

Returns true if all properties are locked and therefore nothing in the identities can be changed.

  • return: True if all properties are locked, false otherwise
boolean isLocked ()
save (line 128)

Saves all identities in the prefs backend.

void save ()
setDefault (line 204)

Sets the current default identity.

If the identity doesn't exist, the old default identity stays the same.

  • return: True on success, false on failure
boolean setDefault (integer $identity)
  • integer $identity: The pointer to the new default identity
setValue (line 264)

Sets a property with a specified value.

  • return: True on success, false on failure (property was locked)
boolean setValue (string $key, mixed $val, [integer $identity = null])
  • string $key: The property to set
  • mixed $val: The value to which the property should be set
  • integer $identity: The identity to set the property in.
singleton (line 563)

Attempts to return a reference to a concrete Identity instance based on $type. It will only create a new instance if no Identity instance with the same parameters currently exists.

This should be used if multiple types of identities (and, thus, multiple Identity instances) are required.

This method must be invoked as: $var = &Identity::singleton()

  • return: The concrete Identity reference, or false on an error.
Identity &singleton ([mixed $type = 'none'], [string $user = null])
  • mixed $type: The type of concrete Identity 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/Identity/ for the subclass implementation named $type[1].php.
  • string $user: If specified, we read another user's identities instead of the current user.
verify (line 323)

Verifies and sanitizes all identity properties.

  • return: True if the properties are valid or a PEAR_Error with an error description otherwise.
bool|object verify ([integer $identity = null])
  • integer $identity: The identity to verify.
verifyIdentity (line 393)

Sends a message to an email address supposed to be added to the identity.

A message is send to this address containing a link to confirm that the address really belongs to that user.

void verifyIdentity (integer $id, string $old_addr)
  • integer $id: The identity's ID.
  • string $old_addr: The old From: address.

Documentation generated on Sun, 30 Jan 2011 05:18:19 +0000 by phpDocumentor 1.4.3