6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This contains utility functions for dealing with multiple identities
12 * @package squirrelmail
15 /** Used to simplify includes */
16 if (!defined('SM_PATH')) {
17 define('SM_PATH','../');
20 include_once(SM_PATH
. 'include/load_prefs.php');
23 * Returns an array of all the identities.
24 * Array is keyed: full_name, reply_to, email_address, index, signature
25 * @return array full_name,reply_to,email_address,index,signature
27 function get_identities() {
29 global $username, $data_dir, $domain;
31 $em = getPref($data_dir,$username,'email_address');
33 if (strpos($username , '@') == false) {
34 $em = $username.'@'.$domain;
40 $identities = array();
41 /* We always have this one, even if the user doesn't use multiple identities */
42 $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'),
43 'email_address' => $em,
44 'reply_to' => getPref($data_dir,$username,'reply_to'),
45 'signature' => getSig($data_dir,$username,'g'),
48 $num_ids = getPref($data_dir,$username,'identities');
49 /* If there are any others, add them to the array */
50 if (!empty($num_ids) && $num_ids > 1) {
51 for ($i=1;$i<$num_ids;$i++
) {
52 $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
53 'email_address' => getPref($data_dir,$username,'email_address' . $i),
54 'reply_to' => getPref($data_dir,$username,'reply_to' . $i),
55 'signature' => getSig($data_dir,$username,$i),