| [ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /* Reminder: always indent with 4 spaces (no tabs). */ 4 // +---------------------------------------------------------------------------+ 5 // | Geeklog 1.3 | 6 // +---------------------------------------------------------------------------+ 7 // | Blogger.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: Blogger.auth.class.php,v 1.5 2006/09/06 05:31:01 ospiess Exp $ 33 34 // PEAR class to handle XML-RPC 35 require_once ('XML/RPC.php'); 36 37 class Blogger 38 { 39 var $email; 40 41 function authenticate($username, $password) 42 { 43 $email = ''; 44 $message = new XML_RPC_Message('blogger.getUserInfo', 45 array( 46 new XML_RPC_Value('XXXXXXXXXXXX', 'string'), 47 new XML_RPC_Value($username, 'string'), 48 new XML_RPC_Value($password, 'string') 49 ) 50 ); 51 $client = new XML_RPC_Client('/api/', 'www.blogger.com', 80); 52 $result = $client->send($message, 5, 'http'); 53 if ($result && ($result->faultString() == '')) { 54 // Get the email address: 55 $value = $result->value(); 56 // Blogger return faultcode = 0 for a login fail. 57 // which the lib doesn't handle. Hence horrible stuff. 58 $f = $value->structmem('faultString'); 59 if ($f) 60 { 61 return false; 62 } else { 63 $value = $value->structmem('email'); 64 $this->email = $value->scalarVal(); 65 return true; 66 } 67 } 68 else { 69 return false; 70 } 71 } 72 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
|