[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/setup/inc/ -> hook_config.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare                                                               *
   4    * http://www.egroupware.org                                                *
   5    * Written by Miles Lott <milos@groupwhere.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 18772 2005-07-11 18:02:19Z petere78 $ */
  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              $out = '';
  28              while(list($key,$value) = each($algos))
  29              {
  30                  $found = True;
  31                  /* Only show each once - seems this is a problem in some installs */
  32                  if(!in_array($value,$listed))
  33                  {
  34                      if($config['mcrypt_algo'] == $value)
  35                      {
  36                          $selected = ' selected="selected"';
  37                      }
  38                      else
  39                      {
  40                          $selected = '';
  41                      }
  42                      $descr = strtoupper($value);
  43  
  44                      $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
  45                      $listed[] = $value;
  46                  }
  47              }
  48              if(!$found)
  49              {
  50                  /* Something is wrong with their mcrypt install or php.ini */
  51                  $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";;
  52              }
  53          }
  54          else
  55          {
  56              $out = '<option value="tripledes">TRIPLEDES</option>' . "\n";;
  57          }
  58          return $out;
  59      }
  60  
  61  	function encryptmode($config)
  62      {
  63          if(@function_exists('mcrypt_list_modes'))
  64          {
  65              $listed = array();
  66              if(!isset($config['mcrypt_mode']))
  67              {
  68                  $config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */
  69              }
  70              $modes = @mcrypt_list_modes();
  71              $found = False;
  72  
  73              $out = '';
  74              while(list($key,$value) = each($modes))
  75              {
  76                  $found = True;
  77                  /* Only show each once - seems this is a problem in some installs */
  78                  if(!in_array($value,$listed))
  79                  {
  80                      if($config['mcrypt_mode'] == $value)
  81                      {
  82                          $selected = ' selected="selected"';
  83                      }
  84                      else
  85                      {
  86                          $selected = '';
  87                      }
  88                      $descr = strtoupper($value);
  89  
  90                      $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
  91                      $listed[] = $value;
  92                  }
  93              }
  94              if(!$found)
  95              {
  96                  /* Something is wrong with their mcrypt install or php.ini */
  97                  $out = '<option value="" selected="selected">' . lang('no modes available') . '</option>' . "\n";
  98              }
  99          }
 100          else
 101          {
 102              $out = '<option value="cbc" selected="selected">CBC</option>' . "\n";
 103          }
 104          return $out;
 105      }
 106  
 107  	function passwdhashes($config)
 108      {
 109          $hashes = array(
 110              'des' => 'des',
 111              'md5' => 'md5'
 112          );
 113          if(@function_exists('mhash'))
 114          {
 115              $hashes += array(
 116                  'smd5' => 'smd5',
 117                  'sha'  => 'sha',
 118                  'ssha' => 'ssha'
 119              );
 120          }
 121  
 122          while(list($key, $value) = each($hashes))
 123          {
 124              if($config['ldap_encryption_type'] == $value)
 125              {
 126                  $selected = ' selected="selected"';
 127              }
 128              else
 129              {
 130                  $selected = '';
 131              }
 132              $descr = strtoupper($value);
 133  
 134              $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
 135          }
 136          return $out;
 137      }
 138  
 139  	function sql_passwdhashes($config)
 140      {
 141          $hashes = array(
 142              'md5' => 'md5'
 143          );
 144  
 145          /* Check for available crypt methods based on what is defined by php */ 
 146          if(@defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1)
 147          {
 148              $hashes['blowish_crypt'] = 'blowish_crypt';
 149          }
 150          if(@defined('CRYPT_MD5') && CRYPT_MD5 == 1)
 151          {
 152              $hashes['md5_crypt'] = 'md5_crypt'; 
 153          }
 154          if(@defined('CRYPT_EXT_DES') && CRYPT_EXT_DES == 1)
 155          {
 156              $hashes['ext_crypt'] = 'ext_crypt';
 157          }
 158          if(@defined('CRYPT_STD_DES') && CRYPT_STD_DES == 1)
 159          {
 160              $hashes['crypt'] = 'crypt';
 161          }
 162  
 163          if(@function_exists('mhash'))
 164          {
 165              $hashes += array(
 166                  'smd5' => 'smd5',
 167                  'sha'  => 'sha',
 168                  'ssha' => 'ssha'
 169              );
 170          }
 171  
 172          while(list($key, $value) = each($hashes))
 173          {
 174              if($config['sql_encryption_type'] == $value)
 175              {
 176                  $selected = ' selected="selected"';
 177              }
 178              else
 179              {
 180                  $selected = '';
 181              }
 182              $descr = strtoupper($value);
 183  
 184              $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
 185          }
 186          return $out;
 187      }
 188  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7