Gracefully shrug on database errors

release-0.6
thomascube 14 years ago
parent 968754b09e
commit bbb1427caa

@ -266,7 +266,9 @@ class rcube_mdb2
raise_error(array('code' => 500, 'type' => 'db', raise_error(array('code' => 500, 'type' => 'db',
'line' => __LINE__, 'file' => __FILE__, 'line' => __LINE__, 'file' => __FILE__,
'message' => $this->db_error_msg), true, true); 'message' => $this->db_error_msg), true, false);
$result = false;
} }
else { else {
$result = $q->execute($params); $result = $q->execute($params);

@ -288,7 +288,7 @@ class rcube_user
// we'll not delete last identity // we'll not delete last identity
if ($sql_arr['ident_count'] <= 1) if ($sql_arr['ident_count'] <= 1)
return false; return -1;
$this->db->query( $this->db->query(
"UPDATE ".get_table_name('identities'). "UPDATE ".get_table_name('identities').

@ -24,6 +24,7 @@ $messages['sessionerror'] = 'Your session is invalid or expired';
$messages['imaperror'] = 'Connection to IMAP server failed'; $messages['imaperror'] = 'Connection to IMAP server failed';
$messages['servererror'] = 'Server Error!'; $messages['servererror'] = 'Server Error!';
$messages['servererrormsg'] = 'Server Error: $msg'; $messages['servererrormsg'] = 'Server Error: $msg';
$messages['databaserror'] = 'Database Error!';
$messages['errorreadonly'] = 'Unable to perform operation. Folder is read-only'; $messages['errorreadonly'] = 'Unable to perform operation. Folder is read-only';
$messages['errornoperm'] = 'Unable to perform operation. Permission denied'; $messages['errornoperm'] = 'Unable to perform operation. Permission denied';
$messages['invalidrequest'] = 'Invalid request! No data was saved.'; $messages['invalidrequest'] = 'Invalid request! No data was saved.';

@ -34,10 +34,10 @@ if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid))
$deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result']; $deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result'];
if ($deleted) if ($deleted > 0 && $deleted !== false)
$OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false); $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
else else
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nodeletelastidentity', 'error', null, false); $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving'), 'error', null, false);
// send response // send response
if ($OUTPUT->ajax_call) if ($OUTPUT->ajax_call)

@ -28,7 +28,7 @@ if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') {
if (is_array($IDENTITY_RECORD)) if (is_array($IDENTITY_RECORD))
$OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']); $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
else { else {
$OUTPUT->show_message('opnotpermitted', 'error'); $OUTPUT->show_message('databaserror', 'error');
// go to identities page // go to identities page
rcmail_overwrite_action('identities'); rcmail_overwrite_action('identities');
return; return;

Loading…
Cancel
Save