Ignore:
Timestamp:
Apr 5, 2007 1:48:45 AM (17 years ago)
Author:
quinn
Message:

Converted all string functions to multi-byte (mb_*) functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Auth_SQL.inc.php

    r229 r247  
    621621
    622622        if ($this->getParam('blocking')) {
    623             if (strlen($db->escapeString($reason)) > 255) {
     623            if (mb_strlen($db->escapeString($reason)) > 255) {
    624624                // blocked_reason field is varchar(255).
    625625                $app->logMsg(sprintf('Blocked reason provided is greater than 255 characters: %s', $reason), LOG_WARNING, __FILE__, __LINE__);
     
    726726        }
    727727        $str = '';
    728         for ($i=0; $i<strlen($pattern); $i++) {
    729             $x = substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789', (mt_rand() % 60), 1);
    730             $c = substr('bcdfghjklmnprstvwxz', (mt_rand() % 19), 1);
    731             $C = substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZ', (mt_rand() % 38), 1);
    732             $v = substr('aeiouy', (mt_rand() % 6), 1);
    733             $V = substr('aeiouyAEIOUY', (mt_rand() % 12), 1);
    734             $d = substr('0123456789', (mt_rand() % 10), 1);
     728        for ($i=0; $i<mb_strlen($pattern); $i++) {
     729            $x = mb_substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789', (mt_rand() % 60), 1);
     730            $c = mb_substr('bcdfghjklmnprstvwxz', (mt_rand() % 19), 1);
     731            $C = mb_substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZ', (mt_rand() % 38), 1);
     732            $v = mb_substr('aeiouy', (mt_rand() % 6), 1);
     733            $V = mb_substr('aeiouyAEIOUY', (mt_rand() % 12), 1);
     734            $d = mb_substr('0123456789', (mt_rand() % 10), 1);
    735735            $str .= $$pattern{$i};
    736736        }
     
    756756        case AUTH_ENCRYPT_CRYPT :
    757757            // If comparing plaintext password with a hash, provide first two chars of the hash as the salt.
    758             return isset($salt) ? crypt($password, substr($salt, 0, 2)) : crypt($password);
     758            return isset($salt) ? crypt($password, mb_substr($salt, 0, 2)) : crypt($password);
    759759            break;
    760760
Note: See TracChangeset for help on using the changeset viewer.