Remove email-specific functions

This commit is contained in:
Miles Lott 2001-12-28 15:31:06 +00:00
parent b2bbc10e70
commit c257dbcf86

View File

@ -266,85 +266,5 @@
return $data;
}
}
function encrypt_mail_pass($data)
{
// Disable all encryption if the admin didn't set it up
if ($this->enabled)
{
// ONLY manipulate data if we are going to encrypt it
// question: why do we sreialize and add slashes before encrypting?? (ed: Angles)
$data = serialize($data);
$data = addslashes($data);
switch ($this->mcrypt_version)
{
// The old code, only works with mcrypt <= 2.2.x
case 'old':
{
$encrypteddata = mcrypt_cbc(MCRYPT_TripleDES, $this->key, $data, MCRYPT_ENCRYPT);
break;
}
default:
{ // Handle 2.4 and newer API
mcrypt_generic_init ($this->td, $this->key, $this->iv);
$encrypteddata = mcrypt_generic($this->td, $data);
break;
}
}
$encrypteddata = bin2hex($encrypteddata);
return $encrypteddata;
}
else
{
// No mcrypt == insecure !
// Data should be returned *unmolested* if encryption is not enabled
return $data;
}
}
function decrypt_mail_pass($encrypteddata)
{
// Disable all encryption if the admin didn't set it up
if ($this->enabled)
{
$data = $this->hex2bin($encrypteddata);
switch ($this->mcrypt_version)
{
// The old code, only works with mcrypt <= 2.2.x
case 'old':
$data = mcrypt_cbc(MCRYPT_TripleDES, $this->key, $data, MCRYPT_DECRYPT);
break;
// Handle 2.4 and newer API
default:
mcrypt_generic_init ($this->td, $this->key, $this->iv);
$data = mdecrypt_generic($this->td, $data);
break;
}
// hey -- since the encrypt() function calls serialize and then addslashes,
// we should always do the reverse -- correct? (ed: Del)
$data = stripslashes($data);
$data = unserialize($data);
// question: was it necessary to serialize and addslashes *before* encryption in the first place? (ed: Angles)
}
else
{
// Data should be returned *unmolested* if encryption is not enabled
return $data;
}
/*
// this is apparently intended to allow encryption of objects
// at this point Dec 14, 2001, we simply need to handle strings correctly
// which was broken previously (ed: Angles)
if(!strpos(' '.$data,'O:8:"stdClass"'))
{
return unserialize($data);
}
else
{
$data = stripslashes($data);
return $data;
}
*/
}
} // class crypto
?>