Source for file identity.php
Documentation is available at identity.php
* This contains utility functions for dealing with multiple identities
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: identity.php,v 1.19 2006/07/15 12:00:44 tokul Exp $
* Returns an array of all the identities.
* Array is keyed: full_name, reply_to, email_address, index, signature
* @return array full_name,reply_to,email_address,index,signature
$em =
getPref($data_dir,$username,'email_address');
if (strpos($username , '@') ==
false) {
$em =
$username.
'@'.
$domain;
/* We always have this one, even if the user doesn't use multiple identities */
$identities[] =
array('full_name' =>
getPref($data_dir,$username,'full_name'),
'reply_to' =>
getPref($data_dir,$username,'reply_to'),
'signature' =>
getSig($data_dir,$username,'g'),
$num_ids =
getPref($data_dir,$username,'identities');
/* If there are any others, add them to the array */
if (!empty($num_ids) &&
$num_ids >
1) {
for ($i=
1;$i<
$num_ids;$i++
) {
$identities[] =
array('full_name' =>
getPref($data_dir,$username,'full_name' .
$i),
'email_address' =>
getPref($data_dir,$username,'email_address' .
$i),
'reply_to' =>
getPref($data_dir,$username,'reply_to' .
$i),
'signature' =>
getSig($data_dir,$username,$i),
* Function to save the identities array
* @param array $identities Array of identities
if (empty($identities) ||
!is_array($identities)) {
$num_cur =
getPref($data_dir, $username, 'identities');
$cnt =
count($identities);
// Remove any additional identities in prefs //
for($i=
$cnt; $i <=
$num_cur; $i++
) {
removePref($data_dir, $username, 'full_name' .
$i);
removePref($data_dir, $username, 'email_address' .
$i);
removePref($data_dir, $username, 'reply_to' .
$i);
setSig($data_dir, $username, $i, '');
foreach($identities as $id=>
$ident) {
setPref($data_dir, $username, 'full_name' .
$key, $ident['full_name']);
setPref($data_dir, $username, 'email_address' .
$key, $ident['email_address']);
setPref($data_dir, $username, 'reply_to' .
$key, $ident['reply_to']);
setSig($data_dir, $username, 'g', $ident['signature']);
setSig($data_dir, $username, $key, $ident['signature']);
setPref($data_dir, $username, 'identities', $cnt);
* Returns an array with a fixed set of identities
* @param array $identities Array of identities
* @param int $id Identity to modify
* @param string $action Action to perform
if (empty($identities) ||
!is_array($identities)) {
foreach( $identities as $key=>
$ident ) {
// inform plugins about renumbering of ids
do_hook('options_identities_renumber', $id, 'default');
// inform plugins about renumbering of ids
do_hook('options_identities_renumber', $id , $id -
1);
// inform plugins about deleted id
do_hook('options_identities_process', $action, $id);
// Process actions from plugins and save/update action //
* send action and id information. number of hook arguments
* differs from 1.4.4 or older and 1.5.0. count($args) can
* be used to detect modified hook. Older hook does not
* provide information that can be useful for plugins.
do_hook('options_identities_process', $action, $id);
* Function to test if identity is empty
* @param array $identity Identitiy Array
if (empty($ident['full_name']) &&
empty($ident['email_address']) &&
empty($ident['signature']) &&
empty($ident['reply_to'])) {
Documentation generated on Sat, 07 Oct 2006 16:11:32 +0300 by phpDocumentor 1.3.0RC6