[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The Auth_ftp class provides an FTP implementation of the Horde 4 * authentication system. 5 * 6 * Optional parameters:<pre> 7 * 'hostspec' The hostname or IP address of the FTP server. 8 * DEFAULT: 'localhost' 9 * 'port' The server port to connect to. 10 * DEFAULT: 21</pre> 11 * 12 * 13 * $Horde: framework/Auth/Auth/ftp.php,v 1.23.12.8 2006/01/01 21:28:07 jan Exp $ 14 * 15 * Copyright 1999-2006 Chuck Hagenbuch <chuck@horde.org> 16 * Copyright 1999-2006 Max Kalika <max@horde.org> 17 * 18 * See the enclosed file COPYING for license information (LGPL). If you 19 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 20 * 21 * @author Chuck Hagenbuch <chuck@horde.org> 22 * @author Max Kalika <max@horde.org> 23 * @since Horde 1.3 24 * @package Horde_Auth 25 */ 26 class Auth_ftp extends Auth { 27 28 /** 29 * Constructs a new FTP authentication object. 30 * 31 * @param array $params A hash containing connection parameters. 32 */ 33 function Auth_ftp($params = array()) 34 { 35 if (!Util::extensionExists('ftp')) { 36 Horde::fatal(_("Auth_ftp: Required FTP extension not found. Compile PHP with the --enable-ftp switch."), __FILE__, __LINE__); 37 } 38 39 $default_params = array( 40 'hostspec' => 'localhost', 41 'port' => 21 42 ); 43 $this->_params = array_merge($default_params, $params); 44 } 45 46 /** 47 * Find out if a set of login credentials are valid. 48 * 49 * @access private 50 * 51 * @param string $userId The userId to check. 52 * @param array $credentials An array of login credentials. For FTP, 53 * this must contain a password entry. 54 * 55 * @return boolean Whether or not the credentials are valid. 56 */ 57 function _authenticate($userId, $credentials) 58 { 59 $ftp = @ftp_connect($this->_params['hostspec'], $this->_params['port']); 60 61 if ($ftp && @ftp_login($ftp, $userId, $credentials['password'])) { 62 @ftp_quit($ftp); 63 return true; 64 } else { 65 @ftp_quit($ftp); 66 $this->_setAuthError(AUTH_REASON_BADLOGIN); 67 return false; 68 } 69 } 70 71 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |