Changeset 44155cd in github


Ignore:
Timestamp:
Apr 1, 2010 11:40:35 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
7fdb9da
Parents:
cd96fd6
Message:
  • load des.inc file only when needed
Location:
program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/main.inc

    r895d4e3 r44155cd  
    3131 
    3232// fallback if not PHP modules are available 
    33 @include_once('lib/des.inc'); 
    3433@include_once('lib/utf8.class.php'); 
    3534 
  • program/include/rcmail.php

    r600981d r44155cd  
    10651065      mcrypt_module_close($td); 
    10661066    } 
    1067     else if (function_exists('des')) 
    1068     { 
    1069       define('DES_IV_SIZE', 8); 
    1070       $iv = ''; 
    1071       for ($i = 0; $i < constant('DES_IV_SIZE'); $i++) 
    1072         $iv .= sprintf("%c", mt_rand(0, 255)); 
    1073       $cipher = $iv . des($this->config->get_crypto_key($key), $clear, 1, 1, $iv); 
    1074     } 
    1075     else 
    1076     { 
    1077       raise_error(array( 
    1078         'code' => 500, 'type' => 'php', 
    1079         'file' => __FILE__, 'line' => __LINE__, 
    1080         'message' => "Could not perform encryption; make sure Mcrypt is installed or lib/des.inc is available" 
    1081       ), true, true); 
    1082     } 
    1083    
     1067    else { 
     1068      @include_once('lib/des.inc'); 
     1069 
     1070      if (function_exists('des')) { 
     1071        $des_iv_size = 8; 
     1072        $iv = ''; 
     1073        for ($i = 0; $i < $des_iv_size; $i++) 
     1074          $iv .= sprintf("%c", mt_rand(0, 255)); 
     1075        $cipher = $iv . des($this->config->get_crypto_key($key), $clear, 1, 1, $iv); 
     1076      } 
     1077      else { 
     1078        raise_error(array( 
     1079          'code' => 500, 'type' => 'php', 
     1080          'file' => __FILE__, 'line' => __LINE__, 
     1081          'message' => "Could not perform encryption; make sure Mcrypt is installed or lib/des.inc is available" 
     1082        ), true, true); 
     1083      } 
     1084    } 
     1085 
    10841086    return $base64 ? base64_encode($cipher) : $cipher; 
    10851087  } 
     
    11111113      mcrypt_module_close($td); 
    11121114    } 
    1113     else if (function_exists('des')) 
    1114     { 
    1115       define('DES_IV_SIZE', 8); 
    1116       $iv = substr($cipher, 0, constant('DES_IV_SIZE')); 
    1117       $cipher = substr($cipher, constant('DES_IV_SIZE')); 
    1118       $clear = des($this->config->get_crypto_key($key), $cipher, 0, 1, $iv); 
    1119     } 
    1120     else 
    1121     { 
    1122       raise_error(array( 
    1123         'code' => 500, 'type' => 'php', 
    1124         'file' => __FILE__, 'line' => __LINE__, 
    1125         'message' => "Could not perform decryption; make sure Mcrypt is installed or lib/des.inc is available" 
    1126       ), true, true); 
    1127     } 
    1128    
     1115    else { 
     1116      @include_once('lib/des.inc'); 
     1117     
     1118      if (function_exists('des')) { 
     1119        $des_iv_size = 8; 
     1120        $iv = substr($cipher, 0, $des_iv_size); 
     1121        $cipher = substr($cipher, $des_iv_size); 
     1122        $clear = des($this->config->get_crypto_key($key), $cipher, 0, 1, $iv); 
     1123      } 
     1124      else { 
     1125        raise_error(array( 
     1126          'code' => 500, 'type' => 'php', 
     1127          'file' => __FILE__, 'line' => __LINE__, 
     1128          'message' => "Could not perform decryption; make sure Mcrypt is installed or lib/des.inc is available" 
     1129        ), true, true); 
     1130      } 
     1131    } 
     1132 
    11291133    /*- 
    11301134     * Trim PHP's padding and the canary byte; see note in 
Note: See TracChangeset for help on using the changeset viewer.