--- /dev/null
+inc/config.php
+/cache/
$filename = $entry['givenname'].'_'.$entry['name'].'.vcf';
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-type: text/x-vcard; name=\"$filename\"; charset=utf-8");
- $smarty->display($template);
+ $output = $smarty->fetch($template) . "\n";
+ $output = str_replace("\n", "\r\n", $output);
+ echo $output;
}else{
header('Content-Type: text/html; charset=utf-8');
$smarty->display($template);
+++ /dev/null
-<?php
-
- // LDAP URL; if set, takes precedence over ldapserver and ldapport
- #$conf['ldapurl'] = 'ldaps://ldap.example.com/';
-
- // Which LDAP Server to use?
- $conf['ldapserver'] = 'ldap';
-
- // Which LDAP Port Server to use? (389 is standard, 636 for ssl)
- $conf['ldapport'] = 389;
-
- // Use LDAP protocol version 3? (0|1)
- $conf['ldapv3'] = 1;
-
- // What is the root dn on this Server?
- $conf['ldaprootdn'] = 'o=cosmocode, c=de';
-
- // Where are the user Accounts stored?
- $conf['usertree'] = 'ou=people, '.$conf['ldaprootdn'];
-
- // How to match users? %u is replaced by the given login
- $conf['userfilter'] = '(&(uid=%u)(objectClass=posixAccount))';
-
- // Show the users as contacts, too?
- $conf['displayusertree'] = 0;
-
- // Use these values to bind to the ldap directory when not logged in (leave blank for anonymous bind)
- $conf['anonbinddn'] = '';
- $conf['anonbindpw'] = '';
-
- // Which language to use (see lang directory)
- $conf['lang'] = 'en';
-
- // Default Country for new entries (ISO3166)
- $conf['country'] = 'US';
-
- // Where to store public contacts?
- $conf['publicbook'] = 'ou=contacts, '.$conf['ldaprootdn'];
-
- // Where to store private contacts (relative to $conf['usertree'])
- $conf['privatebook'] = 'ou=contacts';
-
- // What fields to look at when searching?
- $conf['searchfields'] = array('uid','mail','name','givenname','o');
-
- // Should the public address book be viewable by logged in users only? (0|1)
- $conf['userlogreq'] = 0;
-
- // Should we try to login using the username and password provided by httpd? (0|1)
- $conf['httpd_auth'] = 0;
-
- // Store the first 4 tags in Thunderbird's custom fields when using ldapab.schema
- $conf['tbtaghack'] = 1;
-
- // Dateformat for birthdays and anniversary
- // see http://www.php.net/manual/en/function.strftime.php
- $conf['dateformat'] = '%Y/%m/%d';
- #$conf['dateformat'] = '%d.%m.%Y';
-
- // Google maps key, you can specify multiple when running the app through different vhosts
- $conf['gmaps'] = array(
- 'localhost' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSoniRWQPYZHIWuWPbij8hFqvrEuw',
- 'intranet.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTxyuybgLnXtMVD7dljhze3zUboVhTqk9yc-rQVvv2YwFFJN20RCNbIVA',
- 'intranet' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTjlGRJ-JcA4ENdYSxSTUELqnaldxSOyZdbUNylw_BZHH1bBLrQNGtjZg',
- 'fileserver.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RQ2oMD1p7-NjsUZiDyjvzpK3IuhixTXdHGQRp8jtjwAl-P4oPPEB_hGgw',
- );
-
- // Force recompilation of smarty templates?
- $conf['smartycompile'] = 0;
-
-
--- /dev/null
+<?php
+
+ // LDAP URL; if set, takes precedence over ldapserver and ldapport
+ #$conf['ldapurl'] = 'ldaps://ldap.example.com/';
+
+ // Which LDAP Server to use?
+ $conf['ldapserver'] = 'ldap';
+
+ // Which LDAP Port Server to use? (389 is standard, 636 for ssl)
+ $conf['ldapport'] = 389;
+
+ // Use LDAP protocol version 3? (0|1)
+ $conf['ldapv3'] = 1;
+
+ // What is the root dn on this Server?
+ $conf['ldaprootdn'] = 'o=cosmocode, c=de';
+
+ // Where are the user Accounts stored?
+ $conf['usertree'] = 'ou=people, '.$conf['ldaprootdn'];
+
+ // How to match users? %u is replaced by the given login
+ $conf['userfilter'] = '(&(uid=%u)(objectClass=posixAccount))';
+
+ // Show the users as contacts, too?
+ $conf['displayusertree'] = 0;
+
+ // Use these values to bind to the ldap directory when not logged in (leave blank for anonymous bind)
+ $conf['anonbinddn'] = '';
+ $conf['anonbindpw'] = '';
+
+ // Which language to use (see lang directory)
+ $conf['lang'] = 'en';
+
+ // Default Country for new entries (ISO3166)
+ $conf['country'] = 'US';
+
+ // Where to store public contacts?
+ $conf['publicbook'] = 'ou=contacts, '.$conf['ldaprootdn'];
+
+ // Where to store private contacts (relative to $conf['usertree'])
+ $conf['privatebook'] = 'ou=contacts';
+
+ // What fields to look at when searching?
+ $conf['searchfields'] = array('uid','mail','name','givenname','o');
+
+ // Should the public address book be viewable by logged in users only? (0|1)
+ $conf['userlogreq'] = 0;
+
+ // Should we try to login using the username and password provided by httpd? (0|1)
+ $conf['httpd_auth'] = 0;
+
+ // Store the first 4 tags in Thunderbird's custom fields when using ldapab.schema
+ $conf['tbtaghack'] = 1;
+
+ // Dateformat for birthdays and anniversary
+ // see http://www.php.net/manual/en/function.strftime.php
+ $conf['dateformat'] = '%Y/%m/%d';
+ #$conf['dateformat'] = '%d.%m.%Y';
+
+ // Google maps key, you can specify multiple when running the app through different vhosts
+ $conf['gmaps'] = array(
+ 'localhost' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSoniRWQPYZHIWuWPbij8hFqvrEuw',
+ 'intranet.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTxyuybgLnXtMVD7dljhze3zUboVhTqk9yc-rQVvv2YwFFJN20RCNbIVA',
+ 'intranet' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTjlGRJ-JcA4ENdYSxSTUELqnaldxSOyZdbUNylw_BZHH1bBLrQNGtjZg',
+ 'fileserver.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RQ2oMD1p7-NjsUZiDyjvzpK3IuhixTXdHGQRp8jtjwAl-P4oPPEB_hGgw',
+ );
+
+ // Force recompilation of smarty templates?
+ $conf['smartycompile'] = 0;
+
+// LDAP classes to store with contacts.
+$conf['oclasses'] = array(
+ 'inetOrgPerson',
+ //'contactPerson',
+ //'OXUserObject',
+ //'evolutionPerson',
+ //'officePerson',
+);
+
+//custom LDAP field mappings, see inc/fields.php
+$conf['customFields'] = array();
* handled by the template as well)
*/
+global $conf;
/**
* The object classes to store with contacts
*/
-$OCLASSES[] = 'inetOrgPerson';
+$OCLASSES = $conf['oclasses'];
/**
* The standard fields suported by OpenLDAP's default schemas
* If the provided "extended" schema is used the following fields
* and object classes are added
*/
-$OCLASSES[] = 'contactPerson';
-$FIELDS['anniversary'] = 'anniversary';
-$FIELDS['_marker'] = 'marker'; // aka. tags
-$FIELDS['country'] = 'c';
+if (array_search('contactPerson', $conf['oclasses']) !== false) {
+ $FIELDS['anniversary'] = 'anniversary';
+ $FIELDS['_marker'] = 'marker'; // aka. tags
+ $FIELDS['country'] = 'c';
+}
/**
* If the open exchange schema is used the following fields
* and object classes are added
*/
-/* comment in if you want to use it
-$OCLASSES[] = 'OXUserObject';
-$FIELDS['country'] = 'userCountry';
-$FIELDS['birthday'] = 'birthDay';
-$FIELDS['ipphone'] = 'IPPhone';
-$FIELDS['_marker'] = 'OXUserCategories';
-$FIELDS['instantmessenger'] = 'OXUserInstantMessenger';
-$FIELDS['timezone'] = 'OXTimeZone';
-$FIELDS['position'] = 'OXUserPosition';
-$FIELDS['certificate'] = 'relClientCert';
-$FIELDS['domain'] = 'domain';
-*/
+if (array_search('OXUserObject', $conf['oclasses']) !== false) {
+ $FIELDS['country'] = 'userCountry';
+ $FIELDS['birthday'] = 'birthDay';
+ $FIELDS['ipphone'] = 'IPPhone';
+ $FIELDS['_marker'] = 'OXUserCategories';
+ $FIELDS['instantmessenger'] = 'OXUserInstantMessenger';
+ $FIELDS['timezone'] = 'OXTimeZone';
+ $FIELDS['position'] = 'OXUserPosition';
+ $FIELDS['certificate'] = 'relClientCert';
+ $FIELDS['domain'] = 'domain';
+}
/**
* If the Evolution schema is used the following fields
* and object classes are added
*/
-/* comment in if you want to use it
-$OCLASSES[] = 'evolutionPerson';
-$OCLASSES[] = 'officePerson';
-$FIELDS['department'] = 'ou';
-$FIELDS['state'] = 'st';
-$FIELDS['country'] = 'c';
-$FIELDS['phone'] = 'primaryPhone';
-$FIELDS['switchboard'] = 'companyPhone';
-$FIELDS['note'] = 'note';
-$FIELDS['manager'] = 'seeAlso';
-$FIELDS['birthday'] = 'birthDate';
-$FIELDS['spouse'] = 'spouseName';
-*/
+if (array_search('evolutionPerson', $conf['oclasses']) !== false) {
+ $FIELDS['anniversary'] = 'anniversary';
+ $FIELDS['department'] = 'ou';
+ $FIELDS['state'] = 'st';
+ $FIELDS['phone'] = 'primaryPhone';
+ $FIELDS['switchboard'] = 'companyPhone';
+ $FIELDS['note'] = 'note';
+ $FIELDS['manager'] = 'seeAlso';
+ $FIELDS['birthday'] = 'birthDate';
+ $FIELDS['spouse'] = 'spouseName';
+ $FIELDS['_marker'] = 'categories'; // aka. tags
+}
+// add custom fields from config
+$FIELDS = array_merge($FIELDS, $conf['customFields']);
/**
* Flip the array
$add['objectClass'] = $set;
$r = @ldap_mod_replace($LDAP_CON,$dn,$add);
- tpl_ldaperror();
+ tpl_ldaperror('store object classes');
/* print '<pre>';
print_r($set);
$result3 = array();
// public addressbook
- $sr = @ldap_list($LDAP_CON,$conf['publicbook'],
+ $sr = @ldap_search($LDAP_CON,$conf['publicbook'],
$filter,$types);
tpl_ldaperror();
$result1 = ldap_get_binentries($LDAP_CON, $sr);
if($errno){
$__LDAPERROR__ .= ldap_err2str($errno);
if(!empty($message)){
- $__LDAPERROR__ .= "($message)";
+ $__LDAPERROR__ .= " ($message)";
}elseif($errno == 4){
- $__LDAPERROR__ .= "(You need to increase this limit in your server config)";
+ $__LDAPERROR__ .= " (You need to increase this limit in your server config)";
}
$__LDAPERROR__ .= '<br />';
}
if(!empty($marker)){
// Search by tag
- $ldapfilter = '(&(objectClass=contactPerson)';
+ $ldapfilter = '(&(objectClass=evolutionPerson)';
$marker = explode(',',$marker);
foreach($marker as $m){
$m = trim($m);