adding Bluesome theme (#1188209).
[squirrelmail.git] / functions / identity.php
CommitLineData
b1f45342 1<?php
2
3/**
4 * identity.php
5 *
6c84ba1e 6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
b1f45342 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This contains utility functions for dealing with multiple identities
10 *
31841a9e 11 * @version $Id$
d6c32258 12 * @package squirrelmail
b1f45342 13 */
14
d6c32258 15/** Used to simplify includes */
b1f45342 16if (!defined('SM_PATH')) {
17 define('SM_PATH','../');
18}
19
20include_once(SM_PATH . 'include/load_prefs.php');
21
22/**
23* Returns an array of all the identities.
24* Array is keyed: full_name, reply_to, email_address, index, signature
d6c32258 25* @return array full_name,reply_to,email_address,index,signature
b1f45342 26*/
27function get_identities() {
28
b6e70801 29 global $username, $data_dir, $domain;
30
31 $em = getPref($data_dir,$username,'email_address');
f16477bc 32 if ( ! $em ) {
33 if (strpos($username , '@') == false) {
34 $em = $username.'@'.$domain;
35 } else {
36 $em = $username;
37 }
38 }
b1f45342 39
b1f45342 40 $identities = array();
41 /* We always have this one, even if the user doesn't use multiple identities */
0f4f003e 42 $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'),
b6e70801 43 'email_address' => $em,
b1f45342 44 'reply_to' => getPref($data_dir,$username,'reply_to'),
45 'signature' => getSig($data_dir,$username,'g'),
46 'index' => 0 );
47
b6e70801 48 $num_ids = getPref($data_dir,$username,'identities');
b1f45342 49 /* If there are any others, add them to the array */
de981f8c 50 if (!empty($num_ids) && $num_ids > 1) {
51 for ($i=1;$i<$num_ids;$i++) {
0f4f003e 52 $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
b1f45342 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),
56 'index' => $i );
57 }
58 }
59
60 return $identities;
61}
62
b6e70801 63?>