X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fsteps%2Fsettings%2Fdelete_identity.inc;h=aa599461364c298b985cc7d2cbd416c472113ae5;hb=6b8bc9fde57e4fddd6860d9fdaff4d7e72a82424;hp=4555a6f110029d44e21ab287dc1d1981893245a4;hpb=8bb10dbda276f4c5f1050a05786ba5a5a6cc787d;p=roundcube.git diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc index 4555a6f..aa59946 100644 --- a/program/steps/settings/delete_identity.inc +++ b/program/steps/settings/delete_identity.inc @@ -4,8 +4,8 @@ +-----------------------------------------------------------------------+ | program/steps/settings/delete_identity.inc | | | - | This file is part of the RoundCube Webmail client | - | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | + | This file is part of the Roundcube Webmail client | + | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -15,34 +15,37 @@ | Author: Thomas Bruederli | +-----------------------------------------------------------------------+ - $Id: delete_identity.inc 543 2007-04-28 18:07:12Z thomasb $ + $Id: delete_identity.inc 4025 2010-09-30 13:24:33Z alec $ */ -if (($ids = get_input_value('_iid', RCUBE_INPUT_GET)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $ids)) +$iid = get_input_value('_iid', RCUBE_INPUT_GPC); + +// check request token +if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(RCUBE_INPUT_GPC)) { + $OUTPUT->show_message('invalidrequest', 'error'); + rcmail_overwrite_action('identities'); + return; +} + +if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) { - $DB->query( - "UPDATE ".get_table_name('identities')." - SET del=1 - WHERE user_id=? - AND identity_id IN (".$ids.")", - $_SESSION['user_id']); + $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid)); + + $deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result']; - $count = $DB->affected_rows(); - if ($count) - $OUTPUT->show_message('deletedsuccessfully', 'confirmation'); + if ($deleted) + $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false); + else + $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nodeletelastidentity', 'error', null, false); // send response if ($OUTPUT->ajax_call) $OUTPUT->send(); } - if ($OUTPUT->ajax_call) exit; - // go to identities page rcmail_overwrite_action('identities'); - -?>