[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/classes/authentication/ -> LiveJournal.auth.class.php (source)

   1  <?php
   2  
   3  /* Reminder: always indent with 4 spaces (no tabs). */
   4  // +---------------------------------------------------------------------------+
   5  // | Geeklog 1.3                                                               |
   6  // +---------------------------------------------------------------------------+
   7  // | LiveJournal.auth.class.php                                               |
   8  // |                                                                           |
   9  // | Geeklog Distributed Authentication Module.                                |
  10  // +---------------------------------------------------------------------------+
  11  // | Copyright (C) 2000-2004 by the following authors:                         |
  12  // |                                                                           |
  13  // | Authors: Michael Jervis   - mike@fuckingbrit.com                          |
  14  // +---------------------------------------------------------------------------+
  15  // |                                                                           |
  16  // | This program is free software; you can redistribute it and/or             |
  17  // | modify it under the terms of the GNU General Public License               |
  18  // | as published by the Free Software Foundation; either version 2            |
  19  // | of the License, or (at your option) any later version.                    |
  20  // |                                                                           |
  21  // | This program is distributed in the hope that it will be useful,           |
  22  // | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
  23  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
  24  // | GNU General Public License for more details.                              |
  25  // |                                                                           |
  26  // | You should have received a copy of the GNU General Public License         |
  27  // | along with this program; if not, write to the Free Software Foundation,   |
  28  // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
  29  // |                                                                           |
  30  // +---------------------------------------------------------------------------+
  31  //
  32  // $Id: LiveJournal.auth.class.php,v 1.2 2005/06/12 09:31:19 mjervis Exp $
  33  
  34  // PEAR class to handle XML-RPC
  35  require_once ('XML/RPC.php');
  36  
  37  class LiveJournal
  38  {
  39      var $email;
  40      
  41      function authenticate($username, $password)
  42      {
  43          /* check it's livejournal.com */
  44          $email = '';
  45          $struct = new XML_RPC_Value(
  46                  array('username' => new XML_RPC_Value($username, 'string'),
  47                            'hpassword' => new XML_RPC_Value(md5($password), 'string')
  48                    ), 'struct'
  49                  );
  50  
  51          $message = new XML_RPC_Message('LJ.XMLRPC.login');
  52          $message->addparam($struct);
  53          $client = new XML_RPC_Client('/interface/xmlrpc', 'www.livejournal.com', 80);
  54          $result = $client->send($message, 5);
  55          if ($result && !$result->faultCode()) {
  56              /* Carefuly noting that no LJ API returns the email address, */
  57              /* because they suck.                                        */
  58              return true;
  59          }
  60          else {
  61              return false;
  62          }
  63      }
  64  }


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics