123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ManagedAction extends Action
- {
- protected function prepare(array $args = [])
- {
- if (!parent::prepare($args)) {
- return false;
- }
- $this->doPreparation();
- return true;
- }
- protected function doPreparation()
- {
-
- }
-
- protected function handle()
- {
- parent::handle();
- if ($this->canPost && $this->isPost()) {
- try {
- $this->msg = $this->handlePost();
- } catch (Exception $e) {
- $this->error = $e->getMessage();
- }
- }
- $this->showPage();
- }
-
- protected function handlePost()
- {
-
- assert($this->canPost);
-
-
- if (empty($_POST) && $_SERVER['CONTENT_LENGTH']>0) {
-
-
- $msg = sprintf(_m('The server was unable to handle that much POST data (%s MiB) due to its current configuration.'),
- round($_SERVER['CONTENT_LENGTH']/1024/1024,2));
- throw new ClientException($msg);
- }
- $this->checkSessionToken();
- return $this->doPost();
- }
-
- protected function doPost() {
- return false;
- }
- }
|