egroupware_official/admin/inc/hook_config.inc.php

135 lines
3.3 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
function encryptalgo($config)
{
if(@function_exists('mcrypt_list_algorithms'))
{
2001-12-21 23:44:52 +01:00
$listed = array();
if(!isset($config['mcrypt_algo']))
{
$config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */
}
$algos = @mcrypt_list_algorithms();
2002-01-02 19:20:10 +01:00
$found = False;
2002-06-29 17:59:37 +02:00
$out = '';
while(list($key,$value) = each($algos))
{
2002-01-02 19:20:10 +01:00
$found = True;
/* Only show each once - seems this is a problem in some installs */
if(!in_array($value,$listed))
{
if($config['mcrypt_algo'] == $value)
{
2002-01-02 19:20:10 +01:00
$selected = ' selected';
}
2002-01-02 19:20:10 +01:00
else
{
$selected = '';
}
$descr = strtoupper($value);
2002-01-02 19:20:10 +01:00
$out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
$listed[] = $value;
}
}
2002-01-02 19:20:10 +01:00
if(!$found)
{
/* Something is wrong with their mcrypt install or php.ini */
2002-01-02 19:20:10 +01:00
$out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n";;
}
}
else
{
$out = '<option value="tripledes">TRIPLEDES</option>' . "\n";;
}
return $out;
}
function encryptmode($config)
{
if(@function_exists('mcrypt_list_modes'))
{
2001-12-21 23:44:52 +01:00
$listed = array();
if(!isset($config['mcrypt_mode']))
{
$config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */
}
$modes = @mcrypt_list_modes();
2002-01-02 19:20:10 +01:00
$found = False;
2002-06-29 17:59:37 +02:00
$out = '';
while(list($key,$value) = each($modes))
{
2002-01-02 19:20:10 +01:00
$found = True;
/* Only show each once - seems this is a problem in some installs */
if(!in_array($value,$listed))
{
if($config['mcrypt_mode'] == $value)
2002-01-02 19:20:10 +01:00
{
$selected = ' selected';
}
else
{
2002-01-02 19:20:10 +01:00
$selected = '';
}
2002-01-02 19:20:10 +01:00
$descr = strtoupper($value);
2002-01-02 19:20:10 +01:00
$out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
$listed[] = $value;
}
}
2002-01-02 19:20:10 +01:00
if(!$found)
{
/* Something is wrong with their mcrypt install or php.ini */
2002-01-02 19:20:10 +01:00
$out = '<option value="" selected>' . lang('no modes available') . '</option>' . "\n";
}
}
else
{
$out = '<option value="cbc" selected>CBC</option>' . "\n";
}
return $out;
}
function passwdhashes($config)
{
$hashes = array(
'des' => 'des',
'md5' => 'md5'
);
if(@function_exists('mhash'))
{
$hashes += array('sha' => 'sha');
}
while(list($key, $value) = each($hashes))
{
if($config['ldap_encryption_type'] == $value)
{
$selected = ' selected';
}
else
{
$selected = '';
}
$descr = strtoupper($value);
$out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n";
}
return $out;
}
?>