+ /**
+ * Determine internal attribute name given one of
+ * the SquirrelMail SM_ABOOK_FIELD_* constants
+ *
+ * @param integer $attr The SM_ABOOK_FIELD_* contant to look up
+ *
+ * @return string The desired attribute name, or the string "ERROR"
+ * if the $field is not understood (the caller
+ * is responsible for handing errors)
+ *
+ */
+ function get_attr_name($attr) {
+ switch ($attr) {
+ case SM_ABOOK_FIELD_NICKNAME:
+ return 'cn';
+ case SM_ABOOK_FIELD_FIRSTNAME:
+ return 'givenName';
+ case SM_ABOOK_FIELD_LASTNAME:
+ return 'sn';
+ case SM_ABOOK_FIELD_EMAIL:
+ return 'mail';
+ case SM_ABOOK_FIELD_LABEL:
+ return 'description';
+ default:
+ return 'ERROR';
+ }
+ }
+