@@ -901,6 +901,9 @@ function filterField($field_name, $field_value, $filters, $filter_event) {
901901 case 'IDNTOUTF8 ' :
902902 $ returnval = $ app ->functions ->idn_decode ($ returnval );
903903 break ;
904+ case 'TOLATIN1 ' :
905+ $ returnval = mb_convert_encoding ($ returnval , 'ISO-8859-1 ' , 'UTF-8 ' );
906+ break ;
904907 case 'TRIM ' :
905908 $ returnval = trim ($ returnval );
906909 break ;
@@ -1263,6 +1266,10 @@ protected function _getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $
12631266 } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'CRYPT ' ) {
12641267 $ record [$ key ] = $ app ->auth ->crypt_password (stripslashes ($ record [$ key ]));
12651268 $ sql_insert_val .= "' " .$ app ->db ->quote ($ record [$ key ])."', " ;
1269+ } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'CRYPTMAIL ' ) {
1270+ // The password for the mail system needs to be converted to latin1 before it is hashed.
1271+ $ record [$ key ] = $ app ->auth ->crypt_password (stripslashes ($ record [$ key ]),'ISO-8859-1 ' );
1272+ $ sql_insert_val .= "' " .$ app ->db ->quote ($ record [$ key ])."', " ;
12661273 } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'MYSQL ' ) {
12671274 $ tmp = $ app ->db ->queryOneRecord ("SELECT PASSWORD(?) as `crypted` " , stripslashes ($ record [$ key ]));
12681275 $ record [$ key ] = $ tmp ['crypted ' ];
@@ -1291,6 +1298,10 @@ protected function _getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $
12911298 } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'CRYPT ' ) {
12921299 $ record [$ key ] = $ app ->auth ->crypt_password (stripslashes ($ record [$ key ]));
12931300 $ sql_update .= "` $ key` = ' " .$ app ->db ->quote ($ record [$ key ])."', " ;
1301+ } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'CRYPTMAIL ' ) {
1302+ // The password for the mail system needs to be converted to latin1 before it is hashed.
1303+ $ record [$ key ] = $ app ->auth ->crypt_password (stripslashes ($ record [$ key ]),'ISO-8859-1 ' );
1304+ $ sql_update .= "` $ key` = ' " .$ app ->db ->quote ($ record [$ key ])."', " ;
12941305 } elseif (isset ($ field ['encryption ' ]) && $ field ['encryption ' ] == 'MYSQL ' ) {
12951306 $ tmp = $ app ->db ->queryOneRecord ("SELECT PASSWORD(?) as `crypted` " , stripslashes ($ record [$ key ]));
12961307 $ record [$ key ] = $ tmp ['crypted ' ];
0 commit comments