X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fformaction.php;h=5cf05d4a324fede134e48eb9f0024a979f80b6f8;hb=b24d711f552854d88f2df2120672bdaf173335fc;hp=60d9b3ce130a843ab458fbd3f995ae21d7704ac2;hpb=23c288c699d557ab3f1b67b0ccd60a51bf209f38;p=quix0rs-gnu-social.git diff --git a/lib/formaction.php b/lib/formaction.php index 60d9b3ce13..5cf05d4a32 100644 --- a/lib/formaction.php +++ b/lib/formaction.php @@ -27,9 +27,7 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Form action extendable class @@ -44,6 +42,7 @@ if (!defined('STATUSNET')) { class FormAction extends ManagedAction { protected $form = null; + protected $formOpts = array(); protected $type = null; protected $needLogin = true; protected $canPost = true; @@ -93,30 +92,28 @@ class FormAction extends ManagedAction /** * @return string with instructions to pass into common_markup_to_html() */ - public function getInstructions() + protected function getInstructions() { return null; } - /** - * Gets called from handle() if isPost() is true; - * @return void - */ - protected function handlePost() + public function showForm($msg=null, $success=false) { - parent::handlePost(); + $this->msg = $msg; + $this->success = $success; + $this->showPage(); + } - // check for this before token since all POST and FILES data - // is losts when size is exceeded - if (empty($_POST) && $_SERVER['CONTENT_LENGTH']>0) { - // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit. - // TRANS: %s is the number of bytes of the CONTENT_LENGTH. - $msg = _m('The server was unable to handle that much POST data (%s MiB) due to its current configuration.', - '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); - } + protected function showContent() + { + $form = $this->getForm(); + $form->show(); + } - $this->checkSessionToken(); + protected function getForm() + { + $class = $this->form.'Form'; + $form = new $class($this, $this->formOpts); + return $form; } }