API: Add wfDeprecated() to deprecated ApiResult methods
[lhc/web/wiklou.git] / includes / api / ApiCreateAccount.php
index a7ba48a..455540b 100644 (file)
  */
 class ApiCreateAccount extends ApiBase {
        public function execute() {
-               // If we're in JSON callback mode, no tokens can be obtained
-               if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
-                       $this->dieUsage( 'Cannot create account when using a callback', 'aborted' );
+               // If we're in a mode that breaks the same-origin policy, no tokens can
+               // be obtained
+               if ( $this->lacksSameOriginSecurity() ) {
+                       $this->dieUsage(
+                               'Cannot create account when the same-origin policy is not applied', 'aborted'
+                       );
                }
 
                // $loginForm->addNewaccountInternal will throw exceptions
@@ -149,9 +152,9 @@ class ApiCreateAccount extends ApiBase {
                        $warnings = $status->getErrorsByType( 'warning' );
                        if ( $warnings ) {
                                foreach ( $warnings as &$warning ) {
-                                       $apiResult->setIndexedTagName( $warning['params'], 'param' );
+                                       ApiResult::setIndexedTagName( $warning['params'], 'param' );
                                }
-                               $apiResult->setIndexedTagName( $warnings, 'warning' );
+                               ApiResult::setIndexedTagName( $warnings, 'warning' );
                                $result['warnings'] = $warnings;
                        }
                } else {