diff options
author | Steve Clay <steve@mrclay.org> | 2012-05-16 11:27:25 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-05-16 11:27:25 -0400 |
commit | 7c0215018897bfb578e6116ef9d36e5edc1fe5cf (patch) | |
tree | 79902b31740608a091045f31d32d368ac6b2b70e /engine/lib | |
parent | 40d35166d3f2211ab76943834a983330413ab761 (diff) | |
download | elgg-7c0215018897bfb578e6116ef9d36e5edc1fe5cf.tar.gz elgg-7c0215018897bfb578e6116ef9d36e5edc1fe5cf.tar.bz2 |
Fixes #2411: Show message when upload exceeds PHP limits, and show limits in Server Info
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; |