fixed tripcode algorithm

This commit is contained in:
Savetheinternet 2011-06-06 21:40:04 +10:00
parent d15abb8497
commit c3db67c17b

View File

@ -1426,14 +1426,15 @@
function generate_tripcode($name, $length = 10){
global $config;
$name = stripslashes ( $name );
$t = explode('#', $name);
$nameo = $t[0];
if ( isset ( $t[1] ) || isset ( $t[2] ) ) {
$trip = ( ( strlen ( $t[1] ) > 0 ) ? $t[1] : $t[2] );
if ( ( function_exists ( 'mb_convert_encoding' ) ) ) {
# mb_substitute_character('none');
$recoded_cap = mb_convert_encoding ( $trip, 'Shift_JIS', 'UTF-8' );
// multi-byte encoding is necessary to produce standard tripcode output, but only use it if available
mb_substitute_character('none');
// $trip is now properly encoded
$trip = mb_convert_encoding ( $trip, 'Shift_JIS', 'UTF-8' );
}
$trip = ( ( ! empty ( $recoded_cap ) ) ? $recoded_cap : $trip );
$salt = substr ( $trip.'H.', 1, 2 );