Changeset 10054

Show
Ignore:
Timestamp:
11/30/08 14:17:49 (1 month ago)
Author:
afz
Message:

Update Pear::Text_Password to 1.1.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.8/jaws/html/libraries/pear/Text/Password.php

    r1706 r10054  
    1919 * @copyright  2004-2005 Martin Jansen, Olivier Vanhoucke 
    2020 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    21  * @version    CVS: $Id: Password.php,v 1.16 2005/08/21 19:47:53 mj Exp $ 
     21 * @version    CVS: $Id: Password.php,v 1.18 2008/11/30 13:38:56 mj Exp $ 
    2222 * @link       http://pear.php.net/package/Text_Password 
    2323 */ 
     
    2626 * Number of possible characters in the password 
    2727 */ 
    28 $_Text_Password_NumberOfPossibleCharacters = 0; 
     28$GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 0; 
    2929 
    3030/** 
     
    4949     * @param  string  Type of password (pronounceable, unpronounceable) 
    5050     * @param  string  Character which could be use in the 
    51      *                 unpronounceable password ex : 'A,B,C,D,E,F,G' 
     51     *                 unpronounceable password ex : 'ABCDEFG' 
    5252     *                 or numeric, alphabetical or alphanumeric. 
    5353     * @return string  Returns the generated password. 
     
    436436    { 
    437437 
    438         global $_Text_Password_NumberOfPossibleCharacters; 
    439438        $retVal = ''; 
    440439 
     
    458457        $c_count = 29; 
    459458 
    460         $_Text_Password_NumberOfPossibleCharacters = $v_count + $c_count; 
     459        $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = $v_count + $c_count; 
    461460 
    462461        for ($i = 0; $i < $length; $i++) { 
     
    481480    function _createUnpronounceable($length, $chars) 
    482481    { 
    483         global $_Text_Password_NumberOfPossibleCharacters; 
    484  
    485482        $password = ''; 
    486483 
     
    492489         case 'alphanumeric': 
    493490             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 
    494              $_Text_Password_NumberOfPossibleCharacters = 62; 
     491             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; 
    495492             break; 
    496493 
    497494         case 'alphabetical': 
    498495             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 
    499              $_Text_Password_NumberOfPossibleCharacters = 52; 
     496             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; 
    500497             break; 
    501498 
    502499         case 'numeric': 
    503500             $chars = '0123456789'; 
    504              $_Text_Password_NumberOfPossibleCharacters = 10; 
     501             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; 
    505502             break; 
    506503 
    507504         case '': 
    508505             $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 
    509              $_Text_Password_NumberOfPossibleCharacters = 67; 
     506             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; 
    510507             break; 
    511508 
     
    517514             $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); 
    518515 
    519              $_Text_Password_NumberOfPossibleCharacters = strlen($chars); 
     516             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); 
    520517         } 
    521518 
     
    524521          */ 
    525522         for ($i = 0; $i < $length; $i++) { 
    526              $num = mt_rand(0, $_Text_Password_NumberOfPossibleCharacters - 1); 
     523             $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1); 
    527524             $password .= $chars{$num}; 
    528525         }