Fix a few bugs..
--- a/action/ajax.php Tue May 31 21:14:06 2016 +0200
+++ b/action/ajax.php Wed Jun 01 18:02:25 2016 +0200
@@ -115,6 +115,7 @@
if($contactdata['result'] === false)
{
echo hsc($contactdata['formattedname']);
+ return;
}
echo '<div class="plugin_davcard_popup_container">';
foreach($contactdata['photo'] as $data)
--- a/helper.php Tue May 31 21:14:06 2016 +0200
+++ b/helper.php Wed Jun 01 18:02:25 2016 +0200
@@ -47,9 +47,9 @@
$settings = $wdc->getConnection($connectionId);
if($settings === false)
- return array('formattedname' => $this->getLang('settings_not_found'));
+ return array('formattedname' => $this->getLang('settings_not_found'), 'result' => false);
if($settings['type'] !== 'contacts')
- return array('formattedname' => $this->getLang('wrong_type'));
+ return array('formattedname' => $this->getLang('wrong_type'), 'result' => false);
$entries = $wdc->getAddressbookEntries($connectionId);
}
@@ -65,7 +65,7 @@
case 'structuredname':
$contactdata = explode(';', strtolower($entry['structuredname']));
if(count($contactdata) < 2) // We need at least first and last name
- return array('formattedname' => sprintf($this->getLang('contact_not_found'), $params['firstname']. ' '.$params['lastname']));
+ return array('formattedname' => sprintf($this->getLang('contact_not_found'), $params['firstname']. ' '.$params['lastname']), 'result' => false);
if(($params['lastname'] != '') &&
($contactdata[0] === $params['lastname'])
|| $params['lastname'] === '')
@@ -92,7 +92,7 @@
$info = $this->parseVcard($entry['contactdata'], $entry['uri']);
foreach($info['mail'] as $data)
{
- if($data['mail'] === strtolower($params['email']))
+ if(trim(strtolower($data['mail'])) === $params['email'])
return $info;
}
break;
@@ -383,7 +383,6 @@
public function addContactEntryToAddressbookForPage($id, $user, $params)
{
require_once(DOKU_PLUGIN.'davcard/vendor/autoload.php');
-
$vcard = new \Sabre\VObject\Component\VCard();
$formattedname = $params['firstname'].' '.$params['lastname']; // FIXME: Make this configurable?
$structuredname = array($params['lastname'], $params['firstname'], '', '', '');
--- a/syntax/book.php Tue May 31 21:14:06 2016 +0200
+++ b/syntax/book.php Wed Jun 01 18:02:25 2016 +0200
@@ -97,6 +97,18 @@
if(is_null($meta))
$meta = array();
$meta['addressbooks'] = $data;
+ // Add webdavclient information so that we can disable caching if need be
+ foreach($data['id'] as $addrbkid)
+ {
+ if(strpos($addrbkid, 'webdav://') === 0)
+ {
+ $connectionId = str_replace('webdav://', '', $addrbkid);
+ if(!is_array($meta['webdavclient']))
+ $meta['webdavclient'] = array();
+ if(!in_array($addrbkid, $meta['webdavclient']))
+ $meta['webdavclient'][] = $connectionId;
+ }
+ }
p_set_metadata($ID, array('plugin_davcard' => $meta));
return $data;
}