[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 // 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: Container.php,v 1.2 2005/09/04 19:10:19 eldy Exp $ 20 // 21 22 define("AUTH_METHOD_NOT_SUPPORTED", -4); 23 24 /** 25 * Storage class for fetching login data 26 * 27 * @author Martin Jansen <mj@php.net> 28 * @package Auth 29 */ 30 class Auth_Container 31 { 32 33 /** 34 * User that is currently selected from the storage container. 35 * 36 * @access public 37 */ 38 var $activeUser = ""; 39 40 // {{{ Constructor 41 42 /** 43 * Constructor 44 * 45 * Has to be overwritten by each storage class 46 * 47 * @access public 48 */ 49 function Auth_Container() 50 { 51 } 52 53 // }}} 54 // {{{ fetchData() 55 56 /** 57 * Fetch data from storage container 58 * 59 * Has to be overwritten by each storage class 60 * 61 * @access public 62 */ 63 function fetchData() 64 { 65 } 66 67 // }}} 68 // {{{ verifyPassword() 69 70 /** 71 * Crypt and verfiy the entered password 72 * 73 * @param string Entered password 74 * @param string Password from the data container (usually this password 75 * is already encrypted. 76 * @param string Type of algorithm with which the password from 77 * the container has been crypted. (md5, crypt etc.) 78 * Defaults to "md5". 79 * @return bool True, if the passwords match 80 */ 81 function verifyPassword($password1, $password2, $cryptType = "md5") 82 { 83 switch ($cryptType) { 84 case "crypt" : 85 return (($password2 == "**" . $password1) || 86 (crypt($password1, $password2) == $password2) 87 ); 88 break; 89 90 case "none" : 91 return ($password1 == $password2); 92 break; 93 94 case "md5" : 95 return (md5($password1) == $password2); 96 break; 97 98 default : 99 if (function_exists($cryptType)) { 100 return ($cryptType($password1) == $password2); 101 } else { 102 return false; 103 } 104 break; 105 } 106 } 107 108 // }}} 109 // {{{ listUsers() 110 111 /** 112 * List all users that are available from the storage container 113 */ 114 function listUsers() 115 { 116 return AUTH_METHOD_NOT_SUPPORTED; 117 } 118 119 // }}} 120 // {{{ addUser() 121 122 /** 123 * Add a new user to the storage container 124 * 125 * @param string Username 126 * @param string Password 127 * @param array Additional information 128 * 129 * @return boolean 130 */ 131 function addUser($username, $password, $additional=null) 132 { 133 return AUTH_METHOD_NOT_SUPPORTED; 134 } 135 136 // }}} 137 // {{{ removeUser() 138 139 /** 140 * Remove user from the storage container 141 * 142 * @param string Username 143 */ 144 function removeUser($username) 145 { 146 return AUTH_METHOD_NOT_SUPPORTED; 147 } 148 149 // }}} 150 151 } 152 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |