diff options
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/bc.php | 4 | ||||
-rw-r--r-- | program/include/rcmail.php | 29 |
2 files changed, 22 insertions, 11 deletions
diff --git a/program/include/bc.php b/program/include/bc.php index 3d9d46289..d8356338d 100644 --- a/program/include/bc.php +++ b/program/include/bc.php @@ -205,9 +205,9 @@ function rcmail_quota_content($attrib = null) return rcmail::get_instance()->quota_content($attrib); } -function rcmail_display_server_error($fallback=null, $fallback_args=null) +function rcmail_display_server_error($fallback=null, $fallback_args=null, $suffix='') { - rcmail::get_instance()->display_server_error($fallback, $fallback_args); + rcmail::get_instance()->display_server_error($fallback, $fallback_args, $suffix); } function rcmail_filetype2classname($mimetype, $filename) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 667be14bc..30d1fe84c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1798,39 +1798,50 @@ class rcmail extends rcube * * @param string $fallback Fallback message label * @param array $fallback_args Fallback message label arguments + * @param string $suffix Message label suffix */ - public function display_server_error($fallback = null, $fallback_args = null) + public function display_server_error($fallback = null, $fallback_args = null, $suffix = '') { $err_code = $this->storage->get_error_code(); $res_code = $this->storage->get_response_code(); + $args = array(); if ($res_code == rcube_storage::NOPERM) { - $this->output->show_message('errornoperm', 'error'); + $error = 'errornoperm'; } else if ($res_code == rcube_storage::READONLY) { - $this->output->show_message('errorreadonly', 'error'); + $error = 'errorreadonly'; } else if ($res_code == rcube_storage::OVERQUOTA) { - $this->output->show_message('errorroverquota', 'error'); + $error = 'errorroverquota'; } else if ($err_code && ($err_str = $this->storage->get_error_str())) { // try to detect access rights problem and display appropriate message if (stripos($err_str, 'Permission denied') !== false) { - $this->output->show_message('errornoperm', 'error'); + $error = 'errornoperm'; } // try to detect full mailbox problem and display appropriate message else if (stripos($err_str, 'Quota exceeded') !== false) { - $this->output->show_message('erroroverquota', 'error'); + $error = 'erroroverquota'; } else { - $this->output->show_message('servererrormsg', 'error', array('msg' => $err_str)); + $error = 'servererrormsg'; + $args = array('msg' => $err_str); } } else if ($err_code < 0) { - $this->output->show_message('storageerror', 'error'); + $error = 'storageerror'; } else if ($fallback) { - $this->output->show_message($fallback, 'error', $fallback_args); + $error = $fallback; + $args = $fallback_args; + } + + if ($error) { + if ($suffix && $this->text_exists($error . $suffix)) { + $error .= $suffix; + } + $this->output->show_message($error, 'error', $args); } } |