| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * identity.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2004 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 | * @package squirrelmail |
| 13 | */ |
| 14 | |
| 15 | /** Used to simplify includes */ |
| 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 |
| 25 | * @return array full_name,reply_to,email_address,index,signature |
| 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 */ |
| 34 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'), |
| 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 */ |
| 41 | if (!empty($num_ids) && $num_ids > 1) { |
| 42 | for ($i=1;$i<$num_ids;$i++) { |
| 43 | $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i), |
| 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 | ?> |