* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET')) {
- exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Form action extendable class
class FormAction extends ManagedAction
{
protected $form = null;
+ protected $formOpts = array();
protected $type = null;
protected $needLogin = true;
protected $canPost = true;
protected function prepare(array $args=array()) {
parent::prepare($args);
- $this->form = $this->form ?: $this->action;
+ $this->form = $this->form ?: ucfirst($this->action);
$this->args['form'] = $this->form;
$this->type = !is_null($this->type) ? $this->type : $this->trimmed('type');
/**
* @return string with instructions to pass into common_markup_to_html()
*/
- public function getInstructions()
+ protected function getInstructions()
{
return null;
}
$this->showPage();
}
- public function showContent()
+ protected function showContent()
{
$form = $this->getForm();
$form->show();
protected function getForm()
{
$class = $this->form.'Form';
- $form = new $class($this);
+ $form = new $class($this, $this->formOpts);
return $form;
}
-
- /**
- * Gets called from handle() if isPost() is true;
- * @return void
- */
- protected function handlePost()
- {
- parent::handlePost();
-
- // 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);
- }
-
- $this->checkSessionToken();
- }
}