Auth
[ class tree: Auth ] [ index: Auth ] [ all elements ]

Source for file PEAR.php

Documentation is available at PEAR.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Martin Jansen <mj@php.net>                                  |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: PEAR.php,v 1.4 2006/02/28 02:19:22 aashley Exp $
  20. //
  21.  
  22. /** Include PEAR XML_RPC */
  23. require_once('XML/RPC.php');
  24.  
  25. /**
  26.  * Storage driver for authenticating against PEAR website
  27.  *
  28.  * This driver provides a method for authenticating against the pear.php.net
  29.  * authentication system.
  30.  *
  31.  * @author   Yavor Shahpasov <yavo@netsmart.com.cy>
  32.  * @author   Adam Ashley <aashley@php.net>
  33.  * @package  Auth
  34.  * @version  $Revision: 1.4 $
  35.  */
  36. {
  37.  
  38.     // {{{ Auth_Container_Pear() [constructor]
  39.  
  40.     /**
  41.      * Constructor
  42.      *
  43.      * Currently does nothing
  44.      * 
  45.      * @return void 
  46.      */
  47.     function Auth_Container_Pear()
  48.     {
  49.     
  50.     }
  51.  
  52.     // }}}
  53.     // {{{ fetchData()
  54.     
  55.     /**
  56.      * Get user information from pear.php.net
  57.      *
  58.      * This function uses the given username and password to authenticate
  59.      * against the pear.php.net website
  60.      *
  61.      * @param string    Username
  62.      * @param string    Password
  63.      * @return mixed    Error object or boolean
  64.      */
  65.     function fetchData($username$password)
  66.     {
  67.         $rpc = new XML_RPC_Client('/xmlrpc.php''pear.php.net');
  68.         $rpc_message = new XML_RPC_Message("user.info"array(new XML_RPC_Value($username"string")) );
  69.         
  70.         // Error Checking howto ???
  71.         $result $rpc->send($rpc_message);
  72.         $value $result->value();
  73.         $userinfo = xml_rpc_decode($value);
  74.         if ($userinfo['password'== md5($password)) {
  75.             $this->activeUser $userinfo['handle'];
  76.             foreach ($userinfo as $uk=>$uv{
  77.                 $this->_auth_obj->setAuthData($uk$uv);
  78.             }
  79.             return true;
  80.         }
  81.         return false;
  82.     }
  83.  
  84.     // }}}
  85.     
  86. }
  87. ?>

Documentation generated on Mon, 11 Mar 2019 14:37:17 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.