[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare * 4 * http://www.egroupware.org * 5 * Written by Mark Peters <skeeter@phpgroupware.org> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: hook_config.inc.php 20295 2006-02-15 12:31:25Z $ */ 14 15 function encryptalgo($config) 16 { 17 if(@function_exists('mcrypt_list_algorithms')) 18 { 19 $listed = array(); 20 if(!isset($config['mcrypt_algo'])) 21 { 22 $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ 23 } 24 $algos = @mcrypt_list_algorithms(); 25 $found = False; 26 27 while (list ($key, $value) = each ($algos)) 28 { 29 $found = True; 30 /* Only show each once - seems this is a problem in some installs */ 31 if(!in_array($value,$listed)) 32 { 33 if ($config['mcrypt_algo'] == $value) 34 { 35 $selected = ' selected="selected"'; 36 } 37 else 38 { 39 $selected = ''; 40 } 41 $descr = strtoupper($value); 42 43 $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; 44 $listed[] = $value; 45 } 46 } 47 if(!$found) 48 { 49 /* Something is wrong with their mcrypt install or php.ini */ 50 $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";; 51 } 52 } 53 else 54 { 55 $out = '<option value="tripledes">TRIPLEDES</option>' . "\n";; 56 } 57 return $out; 58 } 59 60 function encryptmode($config) 61 { 62 if(@function_exists('mcrypt_list_modes')) 63 { 64 $listed = array(); 65 if(!isset($config['mcrypt_mode'])) 66 { 67 $config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */ 68 } 69 $modes = @mcrypt_list_modes(); 70 $found = False; 71 72 while (list ($key, $value) = each ($modes)) 73 { 74 $found = True; 75 /* Only show each once - seems this is a problem in some installs */ 76 if(!in_array($value,$listed)) 77 { 78 if ($config['mcrypt_mode'] == $value) 79 { 80 $selected = ' selected="selected"'; 81 } 82 else 83 { 84 $selected = ''; 85 } 86 $descr = strtoupper($value); 87 88 $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; 89 $listed[] = $value; 90 } 91 } 92 if(!$found) 93 { 94 /* Something is wrong with their mcrypt install or php.ini */ 95 $out = '<option value="" selected="selected">' . lang('no modes available') . '</option>' . "\n"; 96 } 97 } 98 else 99 { 100 $out = '<option value="cbc" selected="selected">CBC</option>' . "\n"; 101 } 102 return $out; 103 } 104 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |