Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.api.php |
— | — | @@ -17,30 +17,28 @@ |
18 | 18 | |
19 | 19 | public function execute() { |
20 | 20 | $params = $this->extractRequestParams(); |
21 | | - if (is_string ( $params['user'] )) { |
22 | | - $result = OnlineStatusBar::getUserInfoFromString( $params['user'] ); |
23 | | - // if user is IP and we track them |
24 | | - if ( User::isIP( $params['user'] ) && $result === false ) { |
25 | | - $result = OnlineStatusBar::getAnonFromString( $params['user'] ); |
26 | | - } |
27 | | - if ( $result === false ) { |
28 | | - $ret = 'unknown'; |
29 | | - } else { |
30 | | - $ret = $result[0]; |
31 | | - } |
32 | | - |
33 | | - $this->getResult()->addValue( |
34 | | - null, $this->getModuleName(), array( 'result' => $ret ) ); |
35 | | - } else |
36 | | - { |
37 | | - $this->dieUsage( "You provided an invalid user." ); |
| 21 | + $result = OnlineStatusBar::getUserInfoFromString( $params['user'] ); |
| 22 | + // if user is IP and we track them |
| 23 | + if ( User::isIP( $params['user'] ) && $result === false ) { |
| 24 | + $result = OnlineStatusBar::getAnonFromString( $params['user'] ); |
38 | 25 | } |
| 26 | + if ( $result === false ) { |
| 27 | + $ret = 'unknown'; |
| 28 | + } else { |
| 29 | + $ret = $result[0]; |
| 30 | + } |
| 31 | + |
| 32 | + $this->getResult()->addValue( |
| 33 | + null, $this->getModuleName(), array( 'result' => $ret ) ); |
39 | 34 | } |
40 | 35 | |
41 | 36 | public function getAllowedParams() { |
42 | 37 | // params |
43 | 38 | return array( |
44 | | - 'user' => null, |
| 39 | + 'user' => array ( |
| 40 | + ApiBase::PARAM_TYPE => 'string', |
| 41 | + ApiBase::PARAM_REQUIRED => true |
| 42 | + ), |
45 | 43 | ); |
46 | 44 | } |
47 | 45 | |