b1f45342 |
1 | <?php |
2 | |
3 | /** |
4 | * identity.php |
5 | * |
6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
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$ |
12 | * |
13 | */ |
14 | |
15 | if (!defined('SM_PATH')) { |
16 | define('SM_PATH','../'); |
17 | } |
18 | |
19 | include_once(SM_PATH . 'include/load_prefs.php'); |
20 | |
21 | /** |
22 | * Returns an array of all the identities. |
23 | * Array is keyed: full_name, reply_to, email_address, index, signature |
24 | */ |
25 | function get_identities() { |
26 | |
27 | global $username, $data_dir; |
28 | |
29 | $num_ids = getPref($data_dir,$username,'identities'); |
30 | $identities = array(); |
31 | /* We always have this one, even if the user doesn't use multiple identities */ |
0f4f003e |
32 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'), |
b1f45342 |
33 | 'email_address' => getPref($data_dir,$username,'email_address'), |
34 | 'reply_to' => getPref($data_dir,$username,'reply_to'), |
35 | 'signature' => getSig($data_dir,$username,'g'), |
36 | 'index' => 0 ); |
37 | |
38 | /* If there are any others, add them to the array */ |
de981f8c |
39 | if (!empty($num_ids) && $num_ids > 1) { |
40 | for ($i=1;$i<$num_ids;$i++) { |
0f4f003e |
41 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i), |
b1f45342 |
42 | 'email_address' => getPref($data_dir,$username,'email_address' . $i), |
43 | 'reply_to' => getPref($data_dir,$username,'reply_to' . $i), |
44 | 'signature' => getSig($data_dir,$username,$i), |
45 | 'index' => $i ); |
46 | } |
47 | } |
48 | |
49 | return $identities; |
50 | } |
51 | |
52 | ?> |