phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] admin/inc/hook_config.inc.php, 1.9


From: nomail
Subject: [Phpgroupware-cvs] admin/inc/hook_config.inc.php, 1.9
Date: Thu, 30 Dec 2004 08:38:14 +0100

Update of /admin/inc
Added Files:
        Branch: 
          hook_config.inc.php

date: 2004/12/30 07:38:14;  author: skwashd;  state: Exp;  lines: +80 -15

Log Message:
new HEAD admin - sans GIFs
=====================================================================
<?php
  /**************************************************************************\
  * phpGroupWare                                                             *
  * http://www.phpgroupware.org                                              *
  * Written by Mark Peters <address@hidden>                        *
  * --------------------------------------------                             *
  *  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: hook_config.inc.php,v 1.9 2004/12/30 07:38:14 skwashd Exp $ */

        function encryptalgo($config)
        {
                if(@function_exists('mcrypt_list_algorithms'))
                {
                        $listed = array();
                        if(!isset($config['mcrypt_algo']))
                        {
                                $config['mcrypt_algo'] = 'tripledes';  /* 
MCRYPT_TRIPLEDES */
                        }
                        $algos = @mcrypt_list_algorithms();
                        $found = False;

                        while (list ($key, $value) = each ($algos))
                        {
                                $found = True;
                                /* Only show each once - seems this is a 
problem in some installs */
                                if(!in_array($value,$listed))
                                {
                                        if ($config['mcrypt_algo'] == $value)
                                        {
                                                $selected = ' selected';
                                        }
                                        else
                                        {
                                                $selected = '';
                                        }
                                        $descr = strtoupper($value);
        
                                        $out .= '<option value="' . $value . 
'"' . $selected . '>' . $descr . '</option>' . "\n";
                                        $listed[] = $value;
                                }
                        }
                        if(!$found)
                        {
                                /* Something is wrong with their mcrypt install 
or php.ini */
                                $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'))
                {
                        $listed = array();
                        if(!isset($config['mcrypt_mode']))
                        {
                                $config['mcrypt_mode'] = 'cbc'; /* 
MCRYPT_MODE_CBC */
                        }
                        $modes = @mcrypt_list_modes();
                        $found = False;

                        while (list ($key, $value) = each ($modes))
                        {
                                $found = True;
                                /* Only show each once - seems this is a 
problem in some installs */
                                if(!in_array($value,$listed))
                                {
                                        if ($config['mcrypt_mode'] == $value)
                                        {
                                                $selected = ' selected';
                                        }
                                        else
                                        {
                                                $selected = '';
                                        }
                                        $descr = strtoupper($value);
        
                                        $out .= '<option value="' . $value . 
'"' . $selected . '>' . $descr . '</option>' . "\n";
                                        $listed[] = $value;
                                }
                        }
                        if(!$found)
                        {
                                /* Something is wrong with their mcrypt install 
or php.ini */
                                $out = '<option value="" selected>' . lang('no 
modes available') . '</option>' . "\n";
                        }
                }
                else
                {
                        $out = '<option value="cbc" selected>CBC</option>' . 
"\n";
                }
                return $out;
        }
?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]