Contacts: Add id to vars with id in them

This commit is contained in:
Bart Visscher 2012-02-12 16:12:46 +01:00
parent 623afb69b6
commit f5385e4a63
1 changed files with 7 additions and 7 deletions

View File

@ -9,20 +9,20 @@
require_once ("../../lib/base.php"); require_once ("../../lib/base.php");
OC_Util::checkLoggedIn(); OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts'); OC_Util::checkAppEnabled('contacts');
$book = isset($_GET['bookid']) ? $_GET['bookid'] : NULL; $bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL;
$contact = isset($_GET['contactid']) ? $_GET['contactid'] : NULL; $contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL;
$nl = "\n"; $nl = "\n";
if(isset($book)){ if(isset($bookid)){
$addressbook = OC_Contacts_App::getAddressbook($book); $addressbook = OC_Contacts_App::getAddressbook($bookid);
$cardobjects = OC_Contacts_VCard::all($book); $cardobjects = OC_Contacts_VCard::all($bookid);
header('Content-Type: text/directory'); header('Content-Type: text/directory');
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf'); header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
foreach($cardobjects as $card) { foreach($cardobjects as $card) {
echo $card['carddata'] . $nl; echo $card['carddata'] . $nl;
} }
}elseif(isset($contact)){ }elseif(isset($contactid)){
$data = OC_Contacts_App::getContactObject($contact); $data = OC_Contacts_App::getContactObject($contactid);
header('Content-Type: text/directory'); header('Content-Type: text/directory');
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf'); header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
echo $data['carddata']; echo $data['carddata'];