12Mar/070
Spot the WTF !!
This is from eZ Publish 3.9, which also is called "production code"...
Tryu to spot the small, cute WTF...
function createHash( $user, $password, $site, $type )
{
$str = '';
// eZDebugSetting::writeDebug( 'kernel-user', "'$user' '$password' '$site'", "ezuser($type)" );
if( $type == EZ_USER_PASSWORD_HASH_MD5_USER )
{
$str = md5( "$user\n$password" );
}
else if ( $type == EZ_USER_PASSWORD_HASH_MD5_SITE )
{
$str = md5( "$user\n$password\n$site" );
}
else if ( $type == EZ_USER_PASSWORD_HASH_MYSQL )
{
// Do some MySQL stuff here
}
else if ( $type == EZ_USER_PASSWORD_HASH_PLAINTEXT )
{
$str = $password;
}
else // EZ_USER_PASSWORD_HASH_MD5_PASSWORD
{
$str = md5( $password );
}
eZDebugSetting::writeDebug( 'kernel-user', $str, "ezuser($type)" );
return $str;
}