identity.php 1.5 KB

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