Fix saving and deleting LDAP contacts; skip client-side input validation for contacts, this is done server-side

release-0.6
thomascube 13 years ago
parent 077cfdac2d
commit 0f1faec392

@ -728,6 +728,15 @@ class rcube_ldap extends rcube_addressbook
$newdata = array(); $newdata = array();
$replacedata = array(); $replacedata = array();
$deletedata = array(); $deletedata = array();
// flatten composite fields in $record
if (is_array($record['address'])) {
foreach ($record['address'] as $i => $struct) {
foreach ($struct as $col => $val) {
$record[$col][$i] = $val;
}
}
}
foreach ($this->fieldmap as $col => $fld) { foreach ($this->fieldmap as $col => $fld) {
$val = $save_cols[$col]; $val = $save_cols[$col];
@ -843,10 +852,10 @@ class rcube_ldap extends rcube_addressbook
{ {
if (!is_array($ids)) { if (!is_array($ids)) {
// Not an array, break apart the encoded DNs. // Not an array, break apart the encoded DNs.
$dns = explode(',', $ids); $ids = explode(',', $ids);
} // end if } // end if
foreach ($dns as $id) { foreach ($ids as $id) {
$dn = base64_decode($id); $dn = base64_decode($id);
$this->_debug("C: Delete [dn: $dn]"); $this->_debug("C: Delete [dn: $dn]");
// Delete the record. // Delete the record.
@ -869,7 +878,7 @@ class rcube_ldap extends rcube_addressbook
} }
} // end foreach } // end foreach
return count($dns); return count($ids);
} }

@ -642,11 +642,6 @@ function rcube_webmail()
if (props == 'reload') { if (props == 'reload') {
form.action += '?_reload=1'; form.action += '?_reload=1';
} }
else if ((input = $("input[name='_name']", form)) &&input.length && input.val() == '') {
alert(this.get_label('nonamewarning'));
input.focus();
break;
}
else if (this.task == 'settings' && (this.env.identities_level % 2) == 0 && else if (this.task == 'settings' && (this.env.identities_level % 2) == 0 &&
(input = $("input[name='_email']", form)) && input.length && !rcube_check_email(input.val()) (input = $("input[name='_email']", form)) && input.length && !rcube_check_email(input.val())
) { ) {
@ -4427,7 +4422,7 @@ function rcube_webmail()
this.set_photo_actions = function(id) this.set_photo_actions = function(id)
{ {
var n, buttons = this.buttons['upload-photo']; var n, buttons = this.buttons['upload-photo'];
for (n=0; n < buttons.length; n++) for (n=0; n < buttons && buttons.length; n++)
$('#'+buttons[n].id).html(this.get_label(id == '-del-' ? 'addphoto' : 'replacephoto')); $('#'+buttons[n].id).html(this.get_label(id == '-del-' ? 'addphoto' : 'replacephoto'));
$('#ff_photo').val(id); $('#ff_photo').val(id);

Loading…
Cancel
Save