From 1c479a740e1d078916a56cdfa06c7e969d8f79c2 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 16 Jun 2012 18:06:10 +0200 Subject: [PATCH] Fix string encoding probs. --- ajax/contacts.php | 2 +- ajax/editaddress.php | 13 ++++++++++++- index.php | 2 +- templates/part.contacts.php | 2 +- templates/part.edit_address_dialog.php | 22 +++++++++------------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ajax/contacts.php b/ajax/contacts.php index 37d396cd..dbc9be5c 100644 --- a/ajax/contacts.php +++ b/ajax/contacts.php @@ -13,7 +13,7 @@ OCP\JSON::checkAppEnabled('contacts'); $ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser()); $contacts = OC_Contacts_VCard::all($ids); $tmpl = new OCP\Template("contacts", "part.contacts"); -$tmpl->assign('contacts', $contacts); +$tmpl->assign('contacts', $contacts, false); $page = $tmpl->fetchPage(); OCP\JSON::success(array('data' => array( 'page' => $page ))); diff --git a/ajax/editaddress.php b/ajax/editaddress.php index 969aeeba..2d7aba11 100644 --- a/ajax/editaddress.php +++ b/ajax/editaddress.php @@ -20,7 +20,18 @@ if($checksum) { $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum); $element = $vcard->children[$line]; $adr = OC_Contacts_VCard::structureProperty($element); - $tmpl->assign('adr',$adr); + $types = array(); + if(isset($adr['parameters']['TYPE'])) { + if(is_array($adr['parameters']['TYPE'])) { + $types = array_map('htmlspecialchars', $adr['parameters']['TYPE']); + $types = array_map('strtoupper', $types); + } else { + $types = array(strtoupper(htmlspecialchars($adr['parameters']['TYPE']))); + } + } + $tmpl->assign('types', $types, false); + $adr = array_map('htmlspecialchars', $adr['value']); + $tmpl->assign('adr', $adr, false); } $tmpl->assign('id',$id); diff --git a/index.php b/index.php index 74b7c43c..bdb52c12 100644 --- a/index.php +++ b/index.php @@ -66,7 +66,7 @@ $tmpl->assign('phone_types', $phone_types); $tmpl->assign('email_types', $email_types); $tmpl->assign('categories', $categories); $tmpl->assign('addressbooks', $addressbooks); -$tmpl->assign('contacts', $contacts); +$tmpl->assign('contacts', $contacts, false); $tmpl->assign('details', $details ); $tmpl->assign('id',$id); $tmpl->printPage(); diff --git a/templates/part.contacts.php b/templates/part.contacts.php index 00a61f72..57517505 100644 --- a/templates/part.contacts.php +++ b/templates/part.contacts.php @@ -8,5 +8,5 @@ } } ?> -
  • +
  • diff --git a/templates/part.edit_address_dialog.php b/templates/part.edit_address_dialog.php index 7684795f..d5ea95ba 100644 --- a/templates/part.edit_address_dialog.php +++ b/templates/part.edit_address_dialog.php @@ -1,13 +1,9 @@
    -
    @@ -22,43 +18,43 @@ foreach(isset($adr['parameters']['TYPE'])?array($adr['parameters']['TYPE']):arra
    - +
    - +
    - +
    - +
    - +
    - +
    - +