X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiaccountupdatedeliverydevice.php;h=a3cbb418b65d60c899ca865fbbe9a34efcbc69e1;hb=3255e2e1b81ce6d8d867e924eeacff2c9e53d706;hp=57e4fbfa00f3f7ef1ab0f1573988cc83e73a6428;hpb=513c54fa89085fde783a73c298d61576f834b131;p=quix0rs-gnu-social.git diff --git a/actions/apiaccountupdatedeliverydevice.php b/actions/apiaccountupdatedeliverydevice.php index 57e4fbfa00..a3cbb418b6 100644 --- a/actions/apiaccountupdatedeliverydevice.php +++ b/actions/apiaccountupdatedeliverydevice.php @@ -32,8 +32,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Sets which channel (device) StatusNet delivers updates to for * the authenticating user. Sending none as the device parameter @@ -47,6 +45,8 @@ require_once INSTALLDIR . '/lib/apiauth.php'; */ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction { + protected $needPost = true; + /** * Take arguments for running * @@ -77,15 +77,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction { parent::handle($args); - if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->clientError( - // TRANS: Client error message. POST is a HTTP command. It should not be translated. - _('This method requires a POST.'), - 400, $this->format - ); - return; - } - if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( // TRANS: Client error displayed when coming across a non-supported API method. @@ -93,7 +84,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction 404, $this->format ); - return; } // Note: Twitter no longer supports IM @@ -102,13 +92,11 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction // TRANS: Client error displayed when no valid device parameter is provided for a user's delivery device setting. $this->clientError(_( 'You must specify a parameter named ' . '\'device\' with a value of one of: sms, im, none.' )); - return; } if (empty($this->user)) { // TRANS: Client error displayed when no existing user is provided for a user's delivery device setting. - $this->clientError(_('No such user.'), 404, $this->format); - return; + $this->clientError(_('No such user.'), 404); } $original = clone($this->user); @@ -134,7 +122,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction common_log_db_error($this->user, 'UPDATE', __FILE__); // TRANS: Server error displayed when a user's delivery device cannot be updated. $this->serverError(_('Could not update user.')); - return; } $profile = $this->user->getProfile();