extract up to 3 names from an add_email call

This commit is contained in:
Miles Lott 2001-04-14 17:10:58 +00:00
parent 1e7fc18384
commit fb10b7610e

View File

@ -42,8 +42,20 @@
if ($AddVcard){ if ($AddVcard){
Header("Location: " . $phpgw->link("/addressbook/vcardin.php")); Header("Location: " . $phpgw->link("/addressbook/vcardin.php"));
} else if ($add_email) { } else if ($add_email) {
list($fields["n_given"],$fields["n_family"]) = explode(" ", $name); $named = explode(" ", $name);
$fields["email"] = $add_email; for ($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; }
if ($names[2])
{
$fields["n_given"] = $names[0];
$fields["n_middle"] = $names[1];
$fields["n_family"] = $names[2];
}
else
{
$fields["n_given"] = $names[0];
$fields["n_family"] = $names[1];
}
$fields["email"] = $add_email;
addressbook_form("","add.php","Add",$fields,'',$cat_id); addressbook_form("","add.php","Add",$fields,'',$cat_id);
} else if (! $submit && ! $add_email) { } else if (! $submit && ! $add_email) {
// Default // Default