From: X! Date: Thu, 29 Jan 2009 03:23:25 +0000 (+0000) Subject: Per 46512#c1554, moving check to before required params, returns a result rather... X-Git-Tag: 1.31.0-rc.0~43145 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=38299137f71cf5da61ce21d82536e5c04d112d34;p=lhc%2Fweb%2Fwiklou.git Per 46512#c1554, moving check to before required params, returns a result rather than an error, and it must be posted. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e36f354637..fc8fceb49d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -128,6 +128,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 15949) Add undo functionality to action=edit * (bug 16483) Kill filesort in ApiQueryBacklinks caused by missing parentheses. Building query properly now using makeList() +* Add "check" parameter to action=email === Languages updated in 1.15 === diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 6cfbd7bd3e..91e2ad649c 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -50,18 +50,28 @@ class ApiEmailUser extends ApiBase { // Check required parameters if ( !isset( $params['target'] ) ) $this->dieUsageMsg( array( 'missingparam', 'target' ) ); - if ( !isset( $params['text'] ) ) - $this->dieUsageMsg( array( 'missingparam', 'text' ) ); - if ( !isset( $params['token'] ) ) - $this->dieUsageMsg( array( 'missingparam', 'token' ) ); - // Validate target $targetUser = EmailUserForm::validateEmailTarget( $params['target'] ); if( isset( $params['check'] ) ) - ($targetUser instanceof User)? $this->dieUsageMsg( array( 'usermailenabled' ) ) : $this->dieUsageMsg( array( 'usermaildisabled' ) ); + if($targetUser instanceof User) { + $result = array( 'result' => 'Enabled' ); + $this->getResult()->addValue( null, $this->getModuleName(), $result ); + return; + } + else { + $result = array( 'result' => 'Disabled' ); + $this->getResult()->addValue( null, $this->getModuleName(), $result ); + return; + } //$this->dieUsageMsg( array( 'usermailenabled' ) ) : $this->dieUsageMsg( array( 'usermaildisabled' ) ); if ( !( $targetUser instanceof User ) ) $this->dieUsageMsg( array( $targetUser ) ); + //Check more parameters + if ( !isset( $params['text'] ) ) + $this->dieUsageMsg( array( 'missingparam', 'text' ) ); + if ( !isset( $params['token'] ) ) + $this->dieUsageMsg( array( 'missingparam', 'token' ) ); + // Check permissions $error = EmailUserForm::getPermissionsError( $wgUser, $params['token'] ); @@ -80,7 +90,7 @@ class ApiEmailUser extends ApiBase { $this->getResult()->addValue( null, $this->getModuleName(), $result ); } - //public function mustBePosted() { return true; } + public function mustBePosted() { return true; } public function getAllowedParams() { return array (