diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-06-02 07:14:18 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-06-02 07:14:18 -0700 |
commit | 4abe9e6727108efd1f834a80a7942ed92cae2a52 (patch) | |
tree | 14cb4712274f343ecc1dffb277b7521b19e9db3e /engine/lib | |
parent | b546494ea20aad1514f4127341a303c435e0d8f4 (diff) | |
parent | 7c0215018897bfb578e6116ef9d36e5edc1fe5cf (diff) | |
download | elgg-4abe9e6727108efd1f834a80a7942ed92cae2a52.tar.gz elgg-4abe9e6727108efd1f834a80a7942ed92cae2a52.tar.bz2 |
Merge pull request #222 from mrclay/issue2411
Fixes #2411: Show message when upload exceeds PHP limits
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/actions.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/engine/lib/actions.php b/engine/lib/actions.php index c6613e6d6..3a7c02488 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -273,8 +273,19 @@ function validate_action_token($visibleerrors = TRUE, $token = NULL, $ts = NULL) } else if ($visibleerrors) { register_error(elgg_echo('actiongatekeeper:tokeninvalid')); } - } else if ($visibleerrors) { - register_error(elgg_echo('actiongatekeeper:missingfields')); + } else { + if (! empty($_SERVER['CONTENT_LENGTH']) && empty($_POST)) { + // The size of $_POST or uploaded file has exceed the size limit + $error_msg = elgg_trigger_plugin_hook('action_gatekeeper:upload_exceeded_msg', 'all', array( + 'post_size' => $_SERVER['CONTENT_LENGTH'], + 'visible_errors' => $visibleerrors, + ), elgg_echo('actiongatekeeper:uploadexceeded')); + } else { + $error_msg = elgg_echo('actiongatekeeper:missingfields'); + } + if ($visibleerrors) { + register_error($error_msg); + } } return FALSE; |