Utility functions to deal with identities. Only one so far: get_identities(), which...
authortassium <tassium@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Jun 2003 17:45:43 +0000 (17:45 +0000)
committertassium <tassium@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 19 Jun 2003 17:45:43 +0000 (17:45 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5097 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/identity.php [new file with mode: 0644]

diff --git a/functions/identity.php b/functions/identity.php
new file mode 100644 (file)
index 0000000..3977ac2
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * identity.php
+ *
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This contains utility functions for dealing with multiple identities
+ *
+ * $Id$
+ *
+ */
+
+if (!defined('SM_PATH')) {
+    define('SM_PATH','../');
+}
+
+include_once(SM_PATH . 'include/load_prefs.php');
+
+/**
+* Returns an array of all the identities.
+* Array is keyed: full_name, reply_to, email_address, index, signature
+*/
+function get_identities() {
+
+    global $username, $data_dir;
+
+    $num_ids = getPref($data_dir,$username,'identities');
+    $identities = array();
+    /* We always have this one, even if the user doesn't use multiple identities */
+    $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'),
+        'email_address' => getPref($data_dir,$username,'email_address'),
+        'reply_to' => getPref($data_dir,$username,'reply_to'),
+        'signature' => getSig($data_dir,$username,'g'),
+        'index' => 0 );
+
+    /* If there are any others, add them to the array */
+    if (!empty($num_ids) && $num_ids > 1) {                                                                 for ($i=1;$i<$num_ids;$i++) {
+            $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
+            'email_address' => getPref($data_dir,$username,'email_address' . $i),
+            'reply_to' => getPref($data_dir,$username,'reply_to' . $i),
+            'signature' => getSig($data_dir,$username,$i),
+            'index' => $i );
+        }
+    }
+
+    return $identities;
+}
+
+?>