Robert Vogel has submitted this change and it was merged.

Change subject: Change from Windows to Linux line endings
......................................................................


Change from Windows to Linux line endings

Change-Id: Id0457d8c0502f7f021223464c254446d2321ca90
---
M WebPlatformAuth.i18n.php
M WebPlatformAuth.php
M includes/WebPlatformAuthHooks.php
M includes/api/ApiWebPlatformAuth.php
M includes/specials/WPA_RenewSession.php
5 files changed, 423 insertions(+), 423 deletions(-)

Approvals:
  Robert Vogel: Verified; Looks good to me, approved



diff --git a/WebPlatformAuth.i18n.php b/WebPlatformAuth.i18n.php
index 38f6fdb..8df8539 100644
--- a/WebPlatformAuth.i18n.php
+++ b/WebPlatformAuth.i18n.php
@@ -1,30 +1,30 @@
-<?php
-/**
- * Internationalization file for the WebPlatformAuth extension.
- *
- * @file
- * @ingroup Extensions
- */
-
-$messages = array();
-
-/** English
- * @author Robert Vogel
- */
-$messages['en'] = array(
-       'webplatformauth-desc' => 'Enables MediaWiki to serve as 
webplatform.org\'s authentication provider.'
-);
-
-/** Message documentation (Message documentation)
- * @author Robert Vogel
- */
-$messages['qqq'] = array(
-       'webplatformauth-desc' => 'The extensions description'
-);
-
-/** German (Deutsch)
- * @author Robert Vogel
- */
-$messages['de'] = array(
-       'webplatformauth-desc' => 'Macht aus MediaWiki einen 
Authentifizierungsanbieter für webplatform.org'
+<?php
+/**
+ * Internationalization file for the WebPlatformAuth extension.
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+$messages = array();
+
+/** English
+ * @author Robert Vogel
+ */
+$messages['en'] = array(
+       'webplatformauth-desc' => 'Enables MediaWiki to serve as 
webplatform.org\'s authentication provider.'
+);
+
+/** Message documentation (Message documentation)
+ * @author Robert Vogel
+ */
+$messages['qqq'] = array(
+       'webplatformauth-desc' => 'The extensions description'
+);
+
+/** German (Deutsch)
+ * @author Robert Vogel
+ */
+$messages['de'] = array(
+       'webplatformauth-desc' => 'Macht aus MediaWiki einen 
Authentifizierungsanbieter für webplatform.org'
 );
\ No newline at end of file
diff --git a/WebPlatformAuth.php b/WebPlatformAuth.php
index 362f5ed..76255ed 100644
--- a/WebPlatformAuth.php
+++ b/WebPlatformAuth.php
@@ -1,52 +1,52 @@
-<?php
-# Alert the user that this is not a valid entry point to MediaWiki if they try 
to access the special pages file directly.
-if (!defined('MEDIAWIKI')) {
-       echo <<<EOT
-To install my extension, put the following line in LocalSettings.php:
-require_once( "$IP/extensions/WebPlatformAuth/WebPlatformAuth.php" );
-EOT;
-       exit( 1 );
-}
- 
-$wgExtensionCredits['other'][] = array(
-       'path'           => __FILE__,
-       'name'           => 'WebPlatformAuth',
-       'author'         => '[http://www.hallowelt.biz Hallo Welt! 
Medienwerkstatt GmbH]; Robert Vogel',
-       'url'            => 'http://www.hallowelt.biz',
-       'descriptionmsg' => 'webplatformauth-desc',
-       'version'        => '1.0.0; $Revision: 6738 $',
-);
-
-$dir = dirname(__FILE__) . '/';
- 
-$wgAutoloadClasses['WebPlatformAuthHooks']   = $dir . 
'includes/WebPlatformAuthHooks.php';
-$wgAutoloadClasses['ApiWebPlatformAuth']     = $dir . 
'includes/api/ApiWebPlatformAuth.php';
-$wgAutoloadClasses['WPARenewSession']        = $dir . 
'includes/specials/WPA_RenewSession.php';
-$wgExtensionMessagesFiles['WebPlatformAuth'] = $dir . 
'WebPlatformAuth.i18n.php';
-
-$wgSpecialPages['RenewSession'] = 'WPARenewSession';
-//$wgWhitelistRead[] = 'Special:RenewSession';
-
-$wgAPIModules['webplatformauth'] = 'ApiWebPlatformAuth';
-
-$wgAjaxExportList[] = 'WebPlatformAuthHooks::ajaxGetUserInfoById';
-$wgAjaxExportList[] = 'WebPlatformAuthHooks::ajaxGetUserInfoByName';
-
-$wgHooks['UserLogoutComplete'][] = 
'WebPlatformAuthHooks::onUserLogoutComplete';
-$wgHooks['UserLoginComplete'][]  = 'WebPlatformAuthHooks::onUserLoginComplete';
-$wgHooks['UserSetCookies'][]     = 'WebPlatformAuthHooks::onUserSetCookies';
-//$wgHooks['UserLoadFromSession'][]          = 
'WebPlatformAuthHooks::onUserLoadFromSession';
-$wgHooks['UserLoadAfterLoadFromSession'][] = 
'WebPlatformAuthHooks::onUserLoadAfterLoadFromSession';
-//$wgHooks['UserLoadFromDatabase'][]         = 
'WebPlatformAuthHooks::onUserLoadFromDatabase';
-
-/**
- * @deprecated Replaced by $wgWebPlatformAuthSecret, because in WPD setup IP 
addresses ain't predictable enough
- */
-$wgWebPlatformAuthAllowedClients = array(
-       'localhost',
-       '127.0.0.1'
-);
-
-$wgWebPlatformAuthSecret = 
'NqzdqcdCRWd1JZ1DXSI2Eq5BbjYra40nEguT8654C7eNrMldXuMDs4laHQIppAoc';
-
+<?php
+# Alert the user that this is not a valid entry point to MediaWiki if they try 
to access the special pages file directly.
+if (!defined('MEDIAWIKI')) {
+       echo <<<EOT
+To install my extension, put the following line in LocalSettings.php:
+require_once( "$IP/extensions/WebPlatformAuth/WebPlatformAuth.php" );
+EOT;
+       exit( 1 );
+}
+ 
+$wgExtensionCredits['other'][] = array(
+       'path'           => __FILE__,
+       'name'           => 'WebPlatformAuth',
+       'author'         => '[http://www.hallowelt.biz Hallo Welt! 
Medienwerkstatt GmbH]; Robert Vogel',
+       'url'            => 'http://www.hallowelt.biz',
+       'descriptionmsg' => 'webplatformauth-desc',
+       'version'        => '1.0.0; $Revision: 6738 $',
+);
+
+$dir = dirname(__FILE__) . '/';
+ 
+$wgAutoloadClasses['WebPlatformAuthHooks']   = $dir . 
'includes/WebPlatformAuthHooks.php';
+$wgAutoloadClasses['ApiWebPlatformAuth']     = $dir . 
'includes/api/ApiWebPlatformAuth.php';
+$wgAutoloadClasses['WPARenewSession']        = $dir . 
'includes/specials/WPA_RenewSession.php';
+$wgExtensionMessagesFiles['WebPlatformAuth'] = $dir . 
'WebPlatformAuth.i18n.php';
+
+$wgSpecialPages['RenewSession'] = 'WPARenewSession';
+//$wgWhitelistRead[] = 'Special:RenewSession';
+
+$wgAPIModules['webplatformauth'] = 'ApiWebPlatformAuth';
+
+$wgAjaxExportList[] = 'WebPlatformAuthHooks::ajaxGetUserInfoById';
+$wgAjaxExportList[] = 'WebPlatformAuthHooks::ajaxGetUserInfoByName';
+
+$wgHooks['UserLogoutComplete'][] = 
'WebPlatformAuthHooks::onUserLogoutComplete';
+$wgHooks['UserLoginComplete'][]  = 'WebPlatformAuthHooks::onUserLoginComplete';
+$wgHooks['UserSetCookies'][]     = 'WebPlatformAuthHooks::onUserSetCookies';
+//$wgHooks['UserLoadFromSession'][]          = 
'WebPlatformAuthHooks::onUserLoadFromSession';
+$wgHooks['UserLoadAfterLoadFromSession'][] = 
'WebPlatformAuthHooks::onUserLoadAfterLoadFromSession';
+//$wgHooks['UserLoadFromDatabase'][]         = 
'WebPlatformAuthHooks::onUserLoadFromDatabase';
+
+/**
+ * @deprecated Replaced by $wgWebPlatformAuthSecret, because in WPD setup IP 
addresses ain't predictable enough
+ */
+$wgWebPlatformAuthAllowedClients = array(
+       'localhost',
+       '127.0.0.1'
+);
+
+$wgWebPlatformAuthSecret = 
'NqzdqcdCRWd1JZ1DXSI2Eq5BbjYra40nEguT8654C7eNrMldXuMDs4laHQIppAoc';
+
 $wgCookieDomain = '.webplatform.org'; // --> LocalSettings.php
\ No newline at end of file
diff --git a/includes/WebPlatformAuthHooks.php 
b/includes/WebPlatformAuthHooks.php
index 5f46555..e2aca8b 100644
--- a/includes/WebPlatformAuthHooks.php
+++ b/includes/WebPlatformAuthHooks.php
@@ -1,184 +1,184 @@
-<?php
-
-class WebPlatformAuthHooks {
-
-       /**
-        * 
-        * @param User $user
-        * @param string $inject_html
-        * @return boolean
-        */
-       public static function onUserLoginComplete( $user, &$inject_html ) {
-               $_SESSION['wsUserEmail']             = $user->getEmail();
-               //We've got to flatten the effective groups because MWs 
MemchacheD 
-               //session handler does not serialize $_SESSION correctly 
-               // -> inludes/MemcachedClient.php:993
-               $_SESSION['wsUserEffectiveGroups']   = implode( ',', 
$user->getEffectiveGroups() );
-               //$_SESSION['wsUserRealName']        = $user->getRealName();
-               $_SESSION['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
-
-               self::writeDataToMemcache( $user );
-
-               self::checkReturnTo();
-               
-               return true;
-       }
-
-       /**
-        * 
-        * @param User $user
-        * @param string $inject_html
-        * @param string $oldName
-        * @return boolean
-        */
-       public static function onUserLogoutComplete($user, $inject_html, 
$oldName) {
-               //TODO: Maybe
-               session_destroy();
-               self::checkReturnTo();
-
-               return true;
-       }
-       
-       /**
-        * 
-        * @param User $user User object
-        * @param array $session session array, will be added to $_SESSION
-        * @param array $cookies cookies array mapping cookie name to its value
-        * @return boolean
-        */
-       public static function onUserSetCookies( $user, &$session, &$cookies ) {
-               $session['wsUserEmail']             = $user->getEmail();
-               $session['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
-               $session['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
-               
-               self::writeDataToMemcache( $user );
-               return true;
-       }
-
-       /**
-        * 
-        * @param User $user User object
-        * @return boolean
-        */
-       public static function onUserLoadAfterLoadFromSession( $user ) {
-               $_SESSION['wsUserEmail']             = $user->getEmail();
-               $_SESSION['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
-               $_SESSION['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
-
-               self::writeDataToMemcache( $user );
-               return true;
-       }
-       
-       /**
-        * 
-        * @global WebRequest $wgRequest
-        * @global OutputPage $wgOut
-        */
-       public static function checkReturnTo() {
-               global $wgRequest;
-               $returnTo = $wgRequest->getVal('returnto');
-               if (!is_null($returnTo) && in_array( substr($returnTo, 0, 3), 
array( 'qa|', 'wp|' ) ) ) {
-                       //We have to exit() here because otherwise we would be 
redirected to a MW page
-                       header('Location: ' . substr($returnTo, 3));
-                       exit();
-               }
-       }
-
-       /**
-        * 
-        * @param string $userIds Comma seperated list of user ids
-        * @param string $secret A secret key to avoid unauthorized use of the 
ajax interface
-        * @return string JSON encoded list of requested user information
-        */
-       public static function ajaxGetUserInfoById($userIds, $secret ) {
-               global $wgWebPlatformAuthSecret;
-               if( $secret != $wgWebPlatformAuthSecret ) {
-                       return FormatJson::encode( new stdClass() );
-               }
-
-               $userIds = explode(',', $userIds);
-               $users = UserArray::newFromIDs($userIds);
-
-               $response = array();
-               foreach ($users as $user) {
-                       $response[$user->getId()] = array(
-                               'user_name'      => $user->getName(),
-                               'user_real_name' => $user->getRealName(),
-                               'user_email'     => $user->getEmail(),
-                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
-                       );
-               }
-
-               //In MW there is no user "0", but in Q2A
-               if( in_array( 0, $userIds ) ) {
-                       $user = User::newFromId(1); //WikiSysop;
-                       $response[0] = array(
-                               'user_name'      => $user->getName(),
-                               'user_real_name' => $user->getRealName(),
-                               'user_email'     => $user->getEmail(),
-                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
-                       );
-               }
-
-               return FormatJson::encode($response);
-       }
-       
-       /**
-        * 
-        * @param string $userNames Comma seperated list of user names
-        * @param string $secret A secret key to avoid unauthorized use of the 
ajax interface
-        * @return string JSON encoded list of requested user information
-        */
-       public static function ajaxGetUserInfoByName($userNames, $secret) {
-               global $wgWebPlatformAuthSecret;
-               if( $secret != $wgWebPlatformAuthSecret ) {
-                       return FormatJson::encode( new stdClass() );
-               }
-
-               $userNames = explode(',', $userNames);
-               $dbr = wfGetDB( DB_SLAVE );
-               $res = $dbr->select(
-                               'user',
-                               'user_id',
-                               array( 'user_name' => $userNames )
-               );
-
-               $response = array();
-               foreach ( $res as $row ) {
-                       $user = User::newFromId($row->user_id);
-                       $response[$user->getId()] = array(
-                               'user_name'      => $user->getName(),
-                               'user_real_name' => $user->getRealName(),
-                               'user_email'     => $user->getEmail(),
-                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
-                       );
-               }
-
-               return FormatJson::encode($response);
-       }
-       
-       protected static function writeDataToMemcache( $user ) {
-               global $wgMemc;
-
-               if ( !is_object($user) ) return true;
-
-               $sesskey = false;
-               if ( isset( $_COOKIE[ 'wpwiki_session' ] ) ) {
-                       $sesskey = $_COOKIE[ 'wpwiki_session' ];
-               }
-               if ( !$sesskey ) return true;
-
-               $memcAlternateSessionKey = 'wpwiki:altsession:'.$sesskey;
-               #error_log( "Docs Alternate Session Key: ". 
$memcAlternateSessionKey );
-               #error_log( "UserId". $user->getId() );
-
-               $data = array();
-               $data['wsUserID'] = $user->getId();
-               $data['wsUserName'] = $user->getName();
-               $data['wsUserEmail']             = $user->getEmail();
-               $data['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
-               $data['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
-
-               $wgMemc->add( $memcAlternateSessionKey, serialize( $data ) );
-       }
+<?php
+
+class WebPlatformAuthHooks {
+
+       /**
+        * 
+        * @param User $user
+        * @param string $inject_html
+        * @return boolean
+        */
+       public static function onUserLoginComplete( $user, &$inject_html ) {
+               $_SESSION['wsUserEmail']             = $user->getEmail();
+               //We've got to flatten the effective groups because MWs 
MemchacheD 
+               //session handler does not serialize $_SESSION correctly 
+               // -> inludes/MemcachedClient.php:993
+               $_SESSION['wsUserEffectiveGroups']   = implode( ',', 
$user->getEffectiveGroups() );
+               //$_SESSION['wsUserRealName']        = $user->getRealName();
+               $_SESSION['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
+
+               self::writeDataToMemcache( $user );
+
+               self::checkReturnTo();
+               
+               return true;
+       }
+
+       /**
+        * 
+        * @param User $user
+        * @param string $inject_html
+        * @param string $oldName
+        * @return boolean
+        */
+       public static function onUserLogoutComplete($user, $inject_html, 
$oldName) {
+               //TODO: Maybe
+               session_destroy();
+               self::checkReturnTo();
+
+               return true;
+       }
+       
+       /**
+        * 
+        * @param User $user User object
+        * @param array $session session array, will be added to $_SESSION
+        * @param array $cookies cookies array mapping cookie name to its value
+        * @return boolean
+        */
+       public static function onUserSetCookies( $user, &$session, &$cookies ) {
+               $session['wsUserEmail']             = $user->getEmail();
+               $session['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
+               $session['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
+               
+               self::writeDataToMemcache( $user );
+               return true;
+       }
+
+       /**
+        * 
+        * @param User $user User object
+        * @return boolean
+        */
+       public static function onUserLoadAfterLoadFromSession( $user ) {
+               $_SESSION['wsUserEmail']             = $user->getEmail();
+               $_SESSION['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
+               $_SESSION['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
+
+               self::writeDataToMemcache( $user );
+               return true;
+       }
+       
+       /**
+        * 
+        * @global WebRequest $wgRequest
+        * @global OutputPage $wgOut
+        */
+       public static function checkReturnTo() {
+               global $wgRequest;
+               $returnTo = $wgRequest->getVal('returnto');
+               if (!is_null($returnTo) && in_array( substr($returnTo, 0, 3), 
array( 'qa|', 'wp|' ) ) ) {
+                       //We have to exit() here because otherwise we would be 
redirected to a MW page
+                       header('Location: ' . substr($returnTo, 3));
+                       exit();
+               }
+       }
+
+       /**
+        * 
+        * @param string $userIds Comma seperated list of user ids
+        * @param string $secret A secret key to avoid unauthorized use of the 
ajax interface
+        * @return string JSON encoded list of requested user information
+        */
+       public static function ajaxGetUserInfoById($userIds, $secret ) {
+               global $wgWebPlatformAuthSecret;
+               if( $secret != $wgWebPlatformAuthSecret ) {
+                       return FormatJson::encode( new stdClass() );
+               }
+
+               $userIds = explode(',', $userIds);
+               $users = UserArray::newFromIDs($userIds);
+
+               $response = array();
+               foreach ($users as $user) {
+                       $response[$user->getId()] = array(
+                               'user_name'      => $user->getName(),
+                               'user_real_name' => $user->getRealName(),
+                               'user_email'     => $user->getEmail(),
+                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
+                       );
+               }
+
+               //In MW there is no user "0", but in Q2A
+               if( in_array( 0, $userIds ) ) {
+                       $user = User::newFromId(1); //WikiSysop;
+                       $response[0] = array(
+                               'user_name'      => $user->getName(),
+                               'user_real_name' => $user->getRealName(),
+                               'user_email'     => $user->getEmail(),
+                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
+                       );
+               }
+
+               return FormatJson::encode($response);
+       }
+       
+       /**
+        * 
+        * @param string $userNames Comma seperated list of user names
+        * @param string $secret A secret key to avoid unauthorized use of the 
ajax interface
+        * @return string JSON encoded list of requested user information
+        */
+       public static function ajaxGetUserInfoByName($userNames, $secret) {
+               global $wgWebPlatformAuthSecret;
+               if( $secret != $wgWebPlatformAuthSecret ) {
+                       return FormatJson::encode( new stdClass() );
+               }
+
+               $userNames = explode(',', $userNames);
+               $dbr = wfGetDB( DB_SLAVE );
+               $res = $dbr->select(
+                               'user',
+                               'user_id',
+                               array( 'user_name' => $userNames )
+               );
+
+               $response = array();
+               foreach ( $res as $row ) {
+                       $user = User::newFromId($row->user_id);
+                       $response[$user->getId()] = array(
+                               'user_name'      => $user->getName(),
+                               'user_real_name' => $user->getRealName(),
+                               'user_email'     => $user->getEmail(),
+                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
+                       );
+               }
+
+               return FormatJson::encode($response);
+       }
+       
+       protected static function writeDataToMemcache( $user ) {
+               global $wgMemc;
+
+               if ( !is_object($user) ) return true;
+
+               $sesskey = false;
+               if ( isset( $_COOKIE[ 'wpwiki_session' ] ) ) {
+                       $sesskey = $_COOKIE[ 'wpwiki_session' ];
+               }
+               if ( !$sesskey ) return true;
+
+               $memcAlternateSessionKey = 'wpwiki:altsession:'.$sesskey;
+               #error_log( "Docs Alternate Session Key: ". 
$memcAlternateSessionKey );
+               #error_log( "UserId". $user->getId() );
+
+               $data = array();
+               $data['wsUserID'] = $user->getId();
+               $data['wsUserName'] = $user->getName();
+               $data['wsUserEmail']             = $user->getEmail();
+               $data['wsUserEffectiveGroups']   = 
implode(',',$user->getEffectiveGroups());
+               $data['wsUserPageURL']           = 
$user->getUserPage()->getFullURL();
+
+               $wgMemc->add( $memcAlternateSessionKey, serialize( $data ) );
+       }
 }
\ No newline at end of file
diff --git a/includes/api/ApiWebPlatformAuth.php 
b/includes/api/ApiWebPlatformAuth.php
index ff3757c..f67ae33 100644
--- a/includes/api/ApiWebPlatformAuth.php
+++ b/includes/api/ApiWebPlatformAuth.php
@@ -1,142 +1,142 @@
-<?php
-/**
- *
- *
- * Created on Sep 29, 2012
- *
- * API module for MediaWiki's WebPlatformSearchAutocomplete extension
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * @ingroup WebPlatformAuth
- */
-class ApiWebPlatformAuth extends ApiBase {
-
-       public function __construct( $main, $action ) {
-               parent::__construct( $main, $action );
-       }
-
-       public function getCustomPrinter() {
-               return $this->getMain()->createPrinterByName( 'json' );
-       }
-
-       public function execute() {
-               global $wgSearchSuggestCacheExpiry, $wgWebPlatformAuthSecret;
-               $params = $this->extractRequestParams();
-
-               $command  = $params['command'];
-               $users    = $params['users'];
-               $secret   = $params['secret'];
-               
-               $result = $this->getResult();
-               
-               if( $secret != $wgWebPlatformAuthSecret ) {
-                       $result->addValue( null, 'result', new stdClass() );
-                       return;
-               }
-               
-               $users = explode(',', $users);
-               $userlist = array();
-
-               if( $command == 'GetUsersById' ) {
-                       $userlist = UserArray::newFromIDs($users);
-               }
-               else if( $command == 'GetUsersByName' ) {
-                       $res = $this->getDB()->select(
-                               'user',
-                               'user_id',
-                               array( 'user_name' => $users )
-                       );
-                       foreach ( $res as $row ) {
-                               $userlist[] = User::newFromId($row->user_id);
-                       }
-               }
-
-               $response = array();
-               foreach( $userlist as $user ) {
-                       $response[$user->getId()] = array(
-                           'user_id'        => $user->getId(),
-                               'user_name'      => $user->getName(),
-                               'user_real_name' => $user->getRealName(),
-                               'user_email'     => $user->getEmail(),
-                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
-                       );
-               }
-               
-               //In MW there is no user "0", but in Q2A
-               if( in_array( 0, $users ) ) {
-                       $user = User::newFromId(1); //WikiSysop;
-                       $response[0] = array(
-                           'user_id'        => 0,
-                               'user_name'      => $user->getName(),
-                               'user_real_name' => $user->getRealName(),
-                               'user_email'     => $user->getEmail(),
-                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
-                       );
-               }
-
-               // Open search results may be stored for a very long time
-               $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry );
-               $this->getMain()->setCacheMode( 'public' );
-
-               // Set top level elements
-               $result->addValue( null, 'users', $response );
-       }
-       
-       public function isReadMode() { //Needed to be always available, even if 
read-api is not allowed
-               return false;
-       }
-
-       public function getAllowedParams() {
-               return array(
-                       'command' => null,
-                       'users'  => null,
-                       'secret' => null,
-               );
-       }
-
-       public function getParamDescription() {
-               return false;
-               return array(
-                       'command' => 'GetUsersById|GetUsersByName',
-                       'users' => 'Comma seperated list of either user names 
or user ids. Depends on given command.',
-               );
-       }
-
-       public function getDescription() {
-               return false;
-               return 'User information provider for the webplatform.org 
applications';
-       }
-
-       public function getExamples() {
-               return false;
-               return array(
-                       
'api.php?action=webplatformauth&command=GetUsersById&users=45,23,56'
-               );
-       }
-
-       public function getHelpUrls() {
-               return 'https://www.webplatform.org';
-       }
-
-       public function getVersion() {
-               return __CLASS__ . ': $Id: ApiWebPlatformAuth.php 6651 
2012-09-30 22:33:29Z mglaser $';
-       }
-}
+<?php
+/**
+ *
+ *
+ * Created on Sep 29, 2012
+ *
+ * API module for MediaWiki's WebPlatformSearchAutocomplete extension
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup WebPlatformAuth
+ */
+class ApiWebPlatformAuth extends ApiBase {
+
+       public function __construct( $main, $action ) {
+               parent::__construct( $main, $action );
+       }
+
+       public function getCustomPrinter() {
+               return $this->getMain()->createPrinterByName( 'json' );
+       }
+
+       public function execute() {
+               global $wgSearchSuggestCacheExpiry, $wgWebPlatformAuthSecret;
+               $params = $this->extractRequestParams();
+
+               $command  = $params['command'];
+               $users    = $params['users'];
+               $secret   = $params['secret'];
+               
+               $result = $this->getResult();
+               
+               if( $secret != $wgWebPlatformAuthSecret ) {
+                       $result->addValue( null, 'result', new stdClass() );
+                       return;
+               }
+               
+               $users = explode(',', $users);
+               $userlist = array();
+
+               if( $command == 'GetUsersById' ) {
+                       $userlist = UserArray::newFromIDs($users);
+               }
+               else if( $command == 'GetUsersByName' ) {
+                       $res = $this->getDB()->select(
+                               'user',
+                               'user_id',
+                               array( 'user_name' => $users )
+                       );
+                       foreach ( $res as $row ) {
+                               $userlist[] = User::newFromId($row->user_id);
+                       }
+               }
+
+               $response = array();
+               foreach( $userlist as $user ) {
+                       $response[$user->getId()] = array(
+                           'user_id'        => $user->getId(),
+                               'user_name'      => $user->getName(),
+                               'user_real_name' => $user->getRealName(),
+                               'user_email'     => $user->getEmail(),
+                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
+                       );
+               }
+               
+               //In MW there is no user "0", but in Q2A
+               if( in_array( 0, $users ) ) {
+                       $user = User::newFromId(1); //WikiSysop;
+                       $response[0] = array(
+                           'user_id'        => 0,
+                               'user_name'      => $user->getName(),
+                               'user_real_name' => $user->getRealName(),
+                               'user_email'     => $user->getEmail(),
+                               'user_page_url'  => 
$user->getUserPage()->getFullURL()
+                       );
+               }
+
+               // Open search results may be stored for a very long time
+               $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry );
+               $this->getMain()->setCacheMode( 'public' );
+
+               // Set top level elements
+               $result->addValue( null, 'users', $response );
+       }
+       
+       public function isReadMode() { //Needed to be always available, even if 
read-api is not allowed
+               return false;
+       }
+
+       public function getAllowedParams() {
+               return array(
+                       'command' => null,
+                       'users'  => null,
+                       'secret' => null,
+               );
+       }
+
+       public function getParamDescription() {
+               return false;
+               return array(
+                       'command' => 'GetUsersById|GetUsersByName',
+                       'users' => 'Comma seperated list of either user names 
or user ids. Depends on given command.',
+               );
+       }
+
+       public function getDescription() {
+               return false;
+               return 'User information provider for the webplatform.org 
applications';
+       }
+
+       public function getExamples() {
+               return false;
+               return array(
+                       
'api.php?action=webplatformauth&command=GetUsersById&users=45,23,56'
+               );
+       }
+
+       public function getHelpUrls() {
+               return 'https://www.webplatform.org';
+       }
+
+       public function getVersion() {
+               return __CLASS__ . ': $Id: ApiWebPlatformAuth.php 6651 
2012-09-30 22:33:29Z mglaser $';
+       }
+}
diff --git a/includes/specials/WPA_RenewSession.php 
b/includes/specials/WPA_RenewSession.php
index 42d4de4..3f18a80 100644
--- a/includes/specials/WPA_RenewSession.php
+++ b/includes/specials/WPA_RenewSession.php
@@ -1,19 +1,19 @@
-<?php
-class WPARenewSession extends UnlistedSpecialPage {
-
-       /**
-        * Constructor
-        */
-       function __construct() {
-               parent::__construct( 'RenewSession' );
-       }
-       
-       function execute( $par ) {
-               global $wgUser;
-               $_SESSION['wsUserEmail']             = $wgUser->getEmail();
-               $_SESSION['wsUserEffectiveGroups']   = 
implode(',',$wgUser->getEffectiveGroups());
-               $_SESSION['wsUserPageURL']           = 
$wgUser->getUserPage()->getFullURL();
-               
-               $this->getOutput()->redirect( $par );
-       }
+<?php
+class WPARenewSession extends UnlistedSpecialPage {
+
+       /**
+        * Constructor
+        */
+       function __construct() {
+               parent::__construct( 'RenewSession' );
+       }
+       
+       function execute( $par ) {
+               global $wgUser;
+               $_SESSION['wsUserEmail']             = $wgUser->getEmail();
+               $_SESSION['wsUserEffectiveGroups']   = 
implode(',',$wgUser->getEffectiveGroups());
+               $_SESSION['wsUserPageURL']           = 
$wgUser->getUserPage()->getFullURL();
+               
+               $this->getOutput()->redirect( $par );
+       }
 }
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/76550
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id0457d8c0502f7f021223464c254446d2321ca90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WebPlatformAuth
Gerrit-Branch: master
Gerrit-Owner: Raimond Spekking <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to