diff options
-rw-r--r-- | program/steps/settings/delete_identity.inc | 15 | ||||
-rw-r--r-- | program/steps/settings/save_identity.inc | 63 |
2 files changed, 38 insertions, 40 deletions
diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc index 42c1da61f..06bcab906 100644 --- a/program/steps/settings/delete_identity.inc +++ b/program/steps/settings/delete_identity.inc @@ -31,16 +31,13 @@ if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(RCUBE_INPUT_GPC)) { if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) { $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid)); - - if (!$plugin['abort']) { - if ($USER->delete_identity($iid)) { - $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false); - } - else { - $OUTPUT->show_message('nodeletelastidentity', 'error', null, false); - } + + if (!$plugin['abort'] && $USER->delete_identity($iid)) { + $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false); + } + else { + $OUTPUT->show_message('nodeletelastidentity', 'error', null, false); } - // send response if ($OUTPUT->ajax_call) $OUTPUT->send(); diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc index 8673d4099..6c2cd8136 100644 --- a/program/steps/settings/save_identity.inc +++ b/program/steps/settings/save_identity.inc @@ -64,25 +64,26 @@ if ($_POST['_iid']) $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, 'record' => $save_data)); $save_data = $plugin['record']; - if (!$plugin['abort']) { - if ($updated = $USER->update_identity($iid, $save_data)) { - $OUTPUT->show_message('successfullysaved', 'confirmation'); - - if (!empty($_POST['_standard'])) - $default_id = get_input_value('_iid', RCUBE_INPUT_POST); - - if ($_POST['_framed']) { - // update the changed col in list - // ... - } - } - else if ($DB->is_error()) { - // show error message - $OUTPUT->show_message('errorsaving', 'error', null, false); - rcmail_overwrite_action('edit-identity'); - return; + if (!$plugin['abort'] && ($updated = $USER->update_identity($iid, $save_data))) + { + $OUTPUT->show_message('successfullysaved', 'confirmation'); + + if (!empty($_POST['_standard'])) + $default_id = get_input_value('_iid', RCUBE_INPUT_POST); + + if ($_POST['_framed']) + { + // update the changed col in list + // ... } } + else if ($plugin['abort'] || $DB->is_error()) + { + // show error message + $OUTPUT->show_message('errorsaving', 'error', null, false); + rcmail_overwrite_action('edit-identity'); + return; + } } // insert a new identity record @@ -94,21 +95,21 @@ else if (IDENTITIES_LEVEL < 2) $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data)); $save_data = $plugin['record']; - if (!$plugin['abort']) { - if ($save_data['email'] && ($insert_id = $USER->insert_identity($save_data))) { - $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); - - $_GET['_iid'] = $insert_id; + if (!$plugin['abort'] && $save_data['email'] && ($insert_id = $USER->insert_identity($save_data))) + { + $OUTPUT->show_message('successfullysaved', 'confirmation', null, false); + + $_GET['_iid'] = $insert_id; - if (!empty($_POST['_standard'])) - $default_id = $insert_id; - } - else { - // show error message - $OUTPUT->show_message('errorsaving', 'error', null, false); - rcmail_overwrite_action('edit-identity'); - return; - } + if (!empty($_POST['_standard'])) + $default_id = $insert_id; + } + else + { + // show error message + $OUTPUT->show_message('errorsaving', 'error', null, false); + rcmail_overwrite_action('edit-identity'); + return; } } else |