+ /**
+ * Determine internal database field name given one of
+ * the SquirrelMail SM_ABOOK_FIELD_* constants
+ *
+ * @param integer $field The SM_ABOOK_FIELD_* contant to look up
+ *
+ * @return string The desired field name, or the string "ERROR"
+ * if the $field is not understood (the caller
+ * is responsible for handing errors)
+ *
+ */
+ function get_field_name($field) {
+ switch ($field) {
+ case SM_ABOOK_FIELD_NICKNAME:
+ return 'nickname';
+ case SM_ABOOK_FIELD_FIRSTNAME:
+ return 'firstname';
+ case SM_ABOOK_FIELD_LASTNAME:
+ return 'lastname';
+ case SM_ABOOK_FIELD_EMAIL:
+ return 'email';
+ case SM_ABOOK_FIELD_LABEL:
+ return 'label';
+ default:
+ return 'ERROR';
+ }
+ }
+