| +-----------------------------------------------------------------------+ */ class rcmail_action_utils_error extends rcmail_action { /** * Request handler. * * @param array $args Arguments from the previous step(s) */ public function run($args = []) { $rcmail = rcmail::get_instance(); $ERROR_CODE = !empty($args['code']) ? $args['code'] : 500; $ERROR_MESSAGE = !empty($args['message']) ? $args['message'] : null; // authorization error if ($ERROR_CODE == 401) { $error_title = $rcmail->gettext('errauthorizationfailed'); $error_text = nl2br($rcmail->gettext('errunauthorizedexplain') . "\n" . $rcmail->gettext('errcontactserveradmin')); } // forbidden due to request check else if ($ERROR_CODE == 403) { if ($_SERVER['REQUEST_METHOD'] == 'GET' && $rcmail->request_status == rcube::REQUEST_ERROR_URL) { $url = $rcmail->url($_GET, true, false, true); $add = html::a($url, $rcmail->gettext('clicktoresumesession')); } else { $add = $rcmail->gettext('errcontactserveradmin'); } $error_title = $rcmail->gettext('errrequestcheckfailed'); $error_text = nl2br($rcmail->gettext('errcsrfprotectionexplain')) . '
' . $add . '
'; } // failed request (wrong step in URL) else if ($ERROR_CODE == 404) { $request_url = htmlentities($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); $error_title = $rcmail->gettext('errnotfound'); $error_text = nl2br($rcmail->gettext('errnotfoundexplain') . "\n" . $rcmail->gettext('errcontactserveradmin')); $error_text .= '' . $rcmail->gettext('errfailedrequest') . ": $request_url
"; } // Gone, e.g. message cached but not in the storage else if ($ERROR_CODE == 410) { $error_title = $rcmail->gettext('servererror'); $error_text = $rcmail->gettext('messageopenerror'); } // invalid compose ID else if ($ERROR_CODE == 450 && $_SERVER['REQUEST_METHOD'] == 'GET' && $rcmail->action == 'compose') { $url = $rcmail->url('compose'); $error_title = $rcmail->gettext('errcomposesession'); $error_text = nl2br($rcmail->gettext('errcomposesessionexplain')) . '' . html::a($url, $rcmail->gettext('clicktocompose')) . '
'; } // database connection error else if ($ERROR_CODE == 601) { $error_title = "Configuration error"; $error_text = nl2br($ERROR_MESSAGE) . "| ' . $page_content . ' |