mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 15:38:27 +01:00
Give us a better chance at a good filename
This commit is contained in:
parent
d4d317c6df
commit
b837322370
@ -41,7 +41,9 @@
|
|||||||
$fieldlist = addressbook_read_entry($ab_id,$qfields);
|
$fieldlist = addressbook_read_entry($ab_id,$qfields);
|
||||||
$fields = $fieldlist[0];
|
$fields = $fieldlist[0];
|
||||||
|
|
||||||
|
$email = $fields["email"];
|
||||||
$emailtype = $fields["email_type"]; if (!$emailtype) { $fields["email_type"] = 'INTERNET'; }
|
$emailtype = $fields["email_type"]; if (!$emailtype) { $fields["email_type"] = 'INTERNET'; }
|
||||||
|
$hemail = $fields["email_home"];
|
||||||
$hemailtype = $fields["email_home_type"]; if (!$hemailtype) { $fields["email_home_type"] = 'INTERNET'; }
|
$hemailtype = $fields["email_home_type"]; if (!$hemailtype) { $fields["email_home_type"] = 'INTERNET'; }
|
||||||
$firstname = $fields["n_given"];
|
$firstname = $fields["n_given"];
|
||||||
$lastname = $fields["n_family"];
|
$lastname = $fields["n_family"];
|
||||||
@ -58,11 +60,21 @@
|
|||||||
"nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
|
"nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-type: text/x-vcard");
|
if ($email)
|
||||||
|
{
|
||||||
$fn = explode("@",$email);
|
$fn = explode("@",$email);
|
||||||
$filename = sprintf("%s.vcf", $fn[0]);
|
$filename = sprintf("%s.vcf", $fn[0]);
|
||||||
|
}
|
||||||
header("Content-Disposition: attachment; filename=$filename");
|
elseif ($hemail)
|
||||||
|
{
|
||||||
|
$fn = explode("@",$hemail);
|
||||||
|
$filename = sprintf("%s.vcf", $fn[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fn = strtolower($firstname);
|
||||||
|
$filename = sprintf("%s.vcf", $fn);
|
||||||
|
}
|
||||||
|
|
||||||
// create vcard object
|
// create vcard object
|
||||||
$vcard = CreateObject("phpgwapi.vcard");
|
$vcard = CreateObject("phpgwapi.vcard");
|
||||||
@ -79,6 +91,8 @@
|
|||||||
// create a vcard from this translated array
|
// create a vcard from this translated array
|
||||||
$entry = $vcard->out($buffer);
|
$entry = $vcard->out($buffer);
|
||||||
// print it
|
// print it
|
||||||
|
header("Content-type: text/x-vcard");
|
||||||
|
header("Content-Disposition: attachment; filename=$filename");
|
||||||
echo $entry;
|
echo $entry;
|
||||||
$phpgw->common->exit;
|
$phpgw->common->exit;
|
||||||
} /* !nolname && !nofname */
|
} /* !nolname && !nofname */
|
||||||
|
Loading…
Reference in New Issue
Block a user