- return true;
- }
-
- /**
- * Handle the request
- *
- * On GET, show the form. On POST, try to save the app.
- *
- * @param array $args unused
- *
- * @return void
- */
-
- function handle($args)
- {
- parent::handle($args);
-
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $this->handlePost($args);
- } else {
- $this->showForm();
- }
- }
-
- function handlePost($args)
- {
- // Workaround for PHP returning empty $_POST and $_FILES when POST
- // length > post_max_size in php.ini
-
- if (empty($_FILES)
- && empty($_POST)
- && ($_SERVER['CONTENT_LENGTH'] > 0)
- ) {
- $msg = _('The server was unable to handle that much POST ' .
- 'data (%s bytes) due to its current configuration.');
- $this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
- return;
- }
-
- // CSRF protection
- $token = $this->trimmed('token');
- if (!$token || $token != common_session_token()) {
- $this->clientError(_('There was a problem with your session token.'));
- return;
- }
-
- $cur = common_current_user();
-
- if ($this->arg('cancel')) {
- common_redirect(common_local_url('oauthappssettings'), 303);
- } elseif ($this->arg('save')) {
- $this->trySave();
- } else {