b1f45342 |
1 | <?php |
2 | |
3 | /** |
4 | * identity.php |
5 | * |
82d304a0 |
6 | * Copyright (c) 1999-2004 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 | * |
11 | * $Id$ |
d6c32258 |
12 | * @package squirrelmail |
b1f45342 |
13 | */ |
14 | |
d6c32258 |
15 | /** Used to simplify includes */ |
b1f45342 |
16 | if (!defined('SM_PATH')) { |
17 | define('SM_PATH','../'); |
18 | } |
19 | |
20 | include_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 | */ |
27 | function get_identities() { |
28 | |
29 | global $username, $data_dir; |
30 | |
31 | $num_ids = getPref($data_dir,$username,'identities'); |
32 | $identities = array(); |
33 | /* We always have this one, even if the user doesn't use multiple identities */ |
0f4f003e |
34 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'), |
b1f45342 |
35 | 'email_address' => getPref($data_dir,$username,'email_address'), |
36 | 'reply_to' => getPref($data_dir,$username,'reply_to'), |
37 | 'signature' => getSig($data_dir,$username,'g'), |
38 | 'index' => 0 ); |
39 | |
40 | /* If there are any others, add them to the array */ |
de981f8c |
41 | if (!empty($num_ids) && $num_ids > 1) { |
42 | for ($i=1;$i<$num_ids;$i++) { |
0f4f003e |
43 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i), |
b1f45342 |
44 | 'email_address' => getPref($data_dir,$username,'email_address' . $i), |
45 | 'reply_to' => getPref($data_dir,$username,'reply_to' . $i), |
46 | 'signature' => getSig($data_dir,$username,$i), |
47 | 'index' => $i ); |
48 | } |
49 | } |
50 | |
51 | return $identities; |
52 | } |
53 | |
54 | ?> |