diff --git a/js/otherbackendconfig.js b/js/otherbackendconfig.js index 10a320a5..aa31f324 100644 --- a/js/otherbackendconfig.js +++ b/js/otherbackendconfig.js @@ -12,7 +12,6 @@ OC.Contacts = OC.Contacts || {}; OC.Contacts.OtherBackendConfig = OtherBackendConfig; OtherBackendConfig.prototype.openAddressbookUi = function() { - var self = this; this.addressbookUiInit(); }; @@ -69,8 +68,8 @@ OC.Contacts = OC.Contacts || {}; $('#addressbooks-ui-ldapvcardconnector').append($option); } if (custom) { - console.log("custom selected"); var $option = $('').attr('selected','selected'); + $('#addressbooks-ui-ldapvcardconnector').append($option); $('#addressbooks-ui-ldapvcardconnector-value-p').show(); $('#addressbooks-ui-ldapvcardconnector-copyfrom-p').show(); $.when(self.storage.getConnectors($('#addressbooks-ui-backend').val())) @@ -91,10 +90,9 @@ OC.Contacts = OC.Contacts || {}; $('#addressbooks-ui-ldapvcardconnector-value').text(addressbook.ldap_vcard_connector); } else { - console.log("custom not selected"); var $option = $(''); + $('#addressbooks-ui-ldapvcardconnector').append($option); } - $('#addressbooks-ui-ldapvcardconnector').append($option); }) .fail(function(jqxhr, textStatus, error) { var err = textStatus + ', ' + error; @@ -232,12 +230,12 @@ OC.Contacts = OC.Contacts || {}; } }); $('#addressbooks-ui-ldapbasednsearch').change(function() { - if ($('#addressbooks-ui-ldapbasednmodify').val() == '') { + if ($('#addressbooks-ui-ldapbasednmodify').val() === '') { $('#addressbooks-ui-ldapbasednmodify').val($('#addressbooks-ui-ldapbasednsearch').val()); } }); $('#addressbooks-ui-ldapbasednmodify').change(function() { - if ($('#addressbooks-ui-ldapbasednsearch').val() == '') { + if ($('#addressbooks-ui-ldapbasednsearch').val() === '') { $('#addressbooks-ui-ldapbasednsearch').val($('#addressbooks-ui-ldapbasednmodify').val()); } }); @@ -246,7 +244,7 @@ OC.Contacts = OC.Contacts || {}; $('#addressbooks-ui-ldapvcardconnector').empty(); var $option = null; for (var id = 0; id < response.data.length; id++) { - if (response.data[id] != null) { + if (response.data[id] !== null) { $option = $(''); $('#addressbooks-ui-ldapvcardconnector').append($option); } @@ -261,7 +259,7 @@ OC.Contacts = OC.Contacts || {}; }); $('#addressbooks-ui-ldapvcardconnector').change(function() { // Custom connector - if ($('#addressbooks-ui-ldapvcardconnector').val() == '') { + if ($('#addressbooks-ui-ldapvcardconnector').val() === '') { $('#addressbooks-ui-ldapvcardconnector-value-p').show(); $('#addressbooks-ui-ldapvcardconnector-copyfrom-p').show(); $.when(self.storage.getConnectors($('#addressbooks-ui-backend').val())) @@ -270,7 +268,7 @@ OC.Contacts = OC.Contacts || {}; var $option = $('').attr('selected','selected'); $('#addressbooks-ui-ldapvcardconnector-copyfrom').append($option); for (var id = 0; id < response.data.length; id++) { - var $option = $(''); + $option = $(''); $('#addressbooks-ui-ldapvcardconnector-copyfrom').append($option); } }) @@ -285,11 +283,11 @@ OC.Contacts = OC.Contacts || {}; } }); $('#addressbooks-ui-ldapvcardconnector-copyfrom').change(function() { - if ($('#addressbooks-ui-ldapvcardconnector-copyfrom').val() != '') { + if ($('#addressbooks-ui-ldapvcardconnector-copyfrom').val() !== '') { $.when(self.storage.getConnectors($('#addressbooks-ui-backend').val())) .then(function(response) { for (var id = 0; id < response.data.length; id++) { - if ($('#addressbooks-ui-ldapvcardconnector-copyfrom').val() == response.data[id].id) { + if ($('#addressbooks-ui-ldapvcardconnector-copyfrom').val() === response.data[id].id) { console.log(response.data[id].id); $('#addressbooks-ui-ldapvcardconnector-value').text(response.data[id].xml); } diff --git a/lib/backend/ldap.php b/lib/backend/ldap.php index 9fd02422..b8714017 100644 --- a/lib/backend/ldap.php +++ b/lib/backend/ldap.php @@ -45,7 +45,7 @@ class Ldap extends AbstractBackend { * The cached address books. * @var array[] */ - public $addressBooks; + public $addressbooks; /** * @brief validates and sets the ldap parameters @@ -728,7 +728,6 @@ class Ldap extends AbstractBackend { public function deleteContact($addressbookid, $id, array $options = array()) { self::setLdapParams($addressbookid); self::ldapCreateAndBindConnection(); - $card=null; if (is_array($id)) { $card = self::getContact($addressbookid, $id); } else { diff --git a/lib/connector/ldapconnector.php b/lib/connector/ldapconnector.php index ddcdb045..1b1cbf47 100644 --- a/lib/connector/ldapconnector.php +++ b/lib/connector/ldapconnector.php @@ -57,20 +57,20 @@ class LdapConnector { for ($i=0; $i<$ldapEntry["count"]; $i++) { // ldap property name : $ldap_entry[$i] - $l_property = $ldapEntry[$i]; - for ($j=0;$j<$ldapEntry[$l_property]["count"];$j++){ + $lProperty = $ldapEntry[$i]; + for ($j=0;$j<$ldapEntry[$lProperty]["count"];$j++){ // What to do : // convert the ldap property into vcard property, type and position (if needed) // $v_params format: array('property' => property, 'type' => array(types), 'position' => position) - $v_params = $this->getVCardProperty($l_property); + $v_params = $this->getVCardProperty($lProperty); foreach ($v_params as $v_param) { if (isset($v_param['unassigned'])) { // if the value comes from the unassigned entry, it's a vcard property dumped try { - $property = \Sabre\VObject\Reader::read($ldapEntry[$l_property][$j]); + $property = \Sabre\VObject\Reader::read($ldapEntry[$lProperty][$j]); $vcard->add($property); } catch (exception $e) { } @@ -82,9 +82,9 @@ class LdapConnector { // modify the property with the new data if (strcasecmp($v_param['image'], 'true') == 0) { - $this->updateVCardImageProperty($v_property, $ldapEntry[$l_property][$j], $vcard->VERSION); + $this->updateVCardImageProperty($v_property, $ldapEntry[$lProperty][$j], $vcard->VERSION); } else { - $this->updateVCardProperty($v_property, $ldapEntry[$l_property][$j], $v_param['position']); + $this->updateVCardProperty($v_property, $ldapEntry[$lProperty][$j], $v_param['position']); } } } @@ -186,16 +186,16 @@ class LdapConnector { /** * @brief gets the vcard property values from an ldif entry name - * @param $l_property the ldif property name + * @param $lProperty the ldif property name * @return array('property' => property, 'type' => type, 'position' => position) */ - public function getVCardProperty($l_property) { + public function getVCardProperty($lProperty) { $properties = array(); - if (strcmp($l_property, $this->getUnassignedVCardProperty()) == 0) { + if (strcmp($lProperty, $this->getUnassignedVCardProperty()) == 0) { $properties[] = array('unassigned' => true); } else { foreach ($this->config_content->ldap_entries->ldif_entry as $ldif_entry) { - if ($l_property == $ldif_entry['name']) { + if ($lProperty == $ldif_entry['name']) { // $ldif_entry['name'] is the right config xml foreach ($ldif_entry->vcard_entry as $vcard_entry) { $type=isset($vcard_entry['type'])?$vcard_entry['type']:""; @@ -438,9 +438,9 @@ class LdapConnector { public function insertEmptyEntries($source, &$dest) { for ($i=0; $i<$source["count"]; $i++) { - $l_property = $source[$i]; - if (!isset($dest[$l_property]) && $l_property != 'modifytimestamp') { - $dest[$l_property] = array(); + $lProperty = $source[$i]; + if (!isset($dest[$lProperty]) && $lProperty != 'modifytimestamp') { + $dest[$lProperty] = array(); } } } diff --git a/lib/dispatcher.php b/lib/dispatcher.php index 270c606f..63150278 100644 --- a/lib/dispatcher.php +++ b/lib/dispatcher.php @@ -74,7 +74,7 @@ class Dispatcher extends MainApp { return new AddressBookController($this->appName, $request, $app); }); $this->container->registerService('BackendController', function(IAppContainer $container) use($app) { - return new BackendController($container, $app); + return new BackendController($container, $request, $app); }); $this->container->registerService('GroupController', function(IAppContainer $container) use($app) { $request = $container->query('Request');