identity.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * identity.php
  4. *
  5. * Copyright (c) 1999-2004 The SquirrelMail Project Team
  6. * Licensed under the GNU GPL. For full terms see the file COPYING.
  7. *
  8. * This contains utility functions for dealing with multiple identities
  9. *
  10. * @version $Id$
  11. * @package squirrelmail
  12. */
  13. /** Used to simplify includes */
  14. if (!defined('SM_PATH')) {
  15. define('SM_PATH','../');
  16. }
  17. include_once(SM_PATH . 'include/load_prefs.php');
  18. /**
  19. * Returns an array of all the identities.
  20. * Array is keyed: full_name, reply_to, email_address, index, signature
  21. * @return array full_name,reply_to,email_address,index,signature
  22. */
  23. function get_identities() {
  24. global $username, $data_dir;
  25. $num_ids = getPref($data_dir,$username,'identities');
  26. $identities = array();
  27. /* We always have this one, even if the user doesn't use multiple identities */
  28. $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'),
  29. 'email_address' => getPref($data_dir,$username,'email_address'),
  30. 'reply_to' => getPref($data_dir,$username,'reply_to'),
  31. 'signature' => getSig($data_dir,$username,'g'),
  32. 'index' => 0 );
  33. /* If there are any others, add them to the array */
  34. if (!empty($num_ids) && $num_ids > 1) {
  35. for ($i=1;$i<$num_ids;$i++) {
  36. $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
  37. 'email_address' => getPref($data_dir,$username,'email_address' . $i),
  38. 'reply_to' => getPref($data_dir,$username,'reply_to' . $i),
  39. 'signature' => getSig($data_dir,$username,$i),
  40. 'index' => $i );
  41. }
  42. }
  43. return $identities;
  44. }
  45. ?>