Changeset 247


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

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

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/list_template.cli.php

    r185 r247  
    7878            'longblob' == $type
    7979        ) {
    80             $listrows[] = "<\x3fphp echo strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>";
     80            $listrows[] = "<\x3fphp echo mb_strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(mb_substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>";
    8181        } else if (preg_match('/.*(begin|start).*date.*/i', $field)) {
    8282            $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";
  • trunk/bin/module_maker/module.cli.php

    r238 r247  
    6969$module_title = ucwords(str_replace('_', ' ', $module_name_plural));
    7070$item_title = ucwords(str_replace('_', ' ', $module_name_singular));
    71 $module_name_upper = strtoupper(str_replace('_', ' ', $module_name_plural));
     71$module_name_upper = mb_strtoupper(str_replace('_', ' ', $module_name_plural));
    7272
    7373// Admin files
  • trunk/bin/module_maker/skel/public_list.ihtml

    r154 r247  
    44    for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) {
    55        ?>
    6         <?php if (strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?>
     6        <?php if (mb_strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?>
    77            <h4><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['title'])); ?></a></h4>
    88        <?php } else { ?>
     
    1212        <em><?php echo date($app->getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i]['__///__'])); ?></em> &mdash; <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?>
    1313
    14         <?php if (strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?>
     14        <?php if (mb_strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?>
    1515            <br /><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo _("Read more"); ?></a>
    1616        <?php } ?>
  • trunk/docs/coding_standards.txt

    r214 r247  
    232232        } else {
    233233            // To be valid email address must match regex and fit within the lenth constraints.
    234             if (preg_match($this->getParam('regex'), $email, $e_parts) && strlen($e_parts[2]) < 64 && strlen($e_parts[3]) < 255) {
     234            if (preg_match($this->getParam('regex'), $email, $e_parts) && mb_strlen($e_parts[2]) < 64 && mb_strlen($e_parts[3]) < 255) {
    235235                return true;
    236236            } else {
  • trunk/lib/ACL.inc.php

    r218 r247  
    595595
    596596        $final_where = join(' AND ', $where);
    597         if (substr_count($final_where, 'IS NOT NULL') == 3) {
     597        if (mb_substr_count($final_where, 'IS NOT NULL') == 3) {
    598598            // Null on all three tables will delete ALL entries including the root -> root -> root = deny.
    599599            $app->logMsg(sprintf('Cannot allow deletion of ALL acl entries.', null), LOG_NOTICE, __FILE__, __LINE__);
  • trunk/lib/App.inc.php

    r242 r247  
    533533            'date'      => date('Y-m-d H:i:s'),
    534534            'remote ip' => getRemoteAddr(),
    535             'pid'       => (substr(PHP_OS, 0, 3) != 'WIN' ? posix_getpid() : ''),
     535            'pid'       => (mb_substr(PHP_OS, 0, 3) != 'WIN' ? posix_getpid() : ''),
    536536            'type'      => $this->logPriorityToString($priority),
    537537            'file:line' => "$file : $line",
    538             'url'       => substr(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '', 0, 128),
     538            'url'       => mb_substr(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '', 0, 128),
    539539            'message'   => $message
    540540        );
     
    543543        if ($this->getParam('log_file_priority') && $priority <= $this->getParam('log_file_priority')) {
    544544            $event_str = '[' . join('] [', $event) . ']';
    545             error_log(substr($event_str, 0, 1024) . "\n", 3, $this->getParam('log_directory') . '/' . $this->getParam('log_filename'));
     545            error_log(mb_substr($event_str, 0, 1024) . "\n", 3, $this->getParam('log_directory') . '/' . $this->getParam('log_filename'));
    546546        }
    547547
     
    554554                $email_msg .= sprintf("%-11s%s\n", $k, $v);
    555555            }
    556             mail($this->getParam('log_to_email_address'), $subject, $email_msg, $headers, '-f codebase@strangecode.com');
     556            mb_send_mail($this->getParam('log_to_email_address'), $subject, $email_msg, $headers, '-f codebase@strangecode.com');
    557557        }
    558558
     
    560560        if ($this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority')) {
    561561            $subject = sprintf('[%s %s]', getenv('HTTP_HOST'), $priority);
    562             $sms_msg = sprintf('%s [%s:%s]', substr($event['message'], 0, 64), basename($file), $line);
     562            $sms_msg = sprintf('%s [%s:%s]', mb_substr($event['message'], 0, 64), basename($file), $line);
    563563            $headers = "From: codebase@strangecode.com";
    564             mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers, '-f codebase@strangecode.com');
     564            mb_send_mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers, '-f codebase@strangecode.com');
    565565        }
    566566
     
    669669
    670670        // Get the first delimiter that is needed in the url.
    671         $delim = strpos($url, '?') !== false ? ini_get('arg_separator.output') : '?';
     671        $delim = mb_strpos($url, '?') !== false ? ini_get('arg_separator.output') : '?';
    672672
    673673        $q = '';
  • trunk/lib/Auth_File.inc.php

    r209 r247  
    200200    function login($username, $password)
    201201    {
    202         $username = strtolower(trim($username));
     202        $username = mb_strtolower(trim($username));
    203203
    204204        $this->clear();
  • 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
  • trunk/lib/AuthorizeNet.inc.php

    r146 r247  
    238238    {
    239239        return (
    240             strtolower($this->getResult('x_md5_hash')) == strtolower(md5(
     240            mb_strtolower($this->getResult('x_md5_hash')) == mb_strtolower(md5(
    241241                $this->md5_hash_value .
    242242                $this->getParam('x_login') .
  • trunk/lib/Cache.inc.php

    r238 r247  
    138138
    139139        $var = serialize($var);
    140         $var_len = strlen($var);
     140        $var_len = mb_strlen($var);
    141141
    142142        if ($var_len >= $this->getParam('item_size_limit')) {
     
    154154
    155155        // Continue to prune the cache if its size is greater than stack_size_limit, but keep at least min_items.
    156         while (strlen(serialize($_SESSION['_cache'][$this->_ns])) + $var_len >= $this->getParam('stack_size_limit') && sizeof($_SESSION['_cache'][$this->_ns]) >= $this->getParam('min_items')) {
     156        while (mb_strlen(serialize($_SESSION['_cache'][$this->_ns])) + $var_len >= $this->getParam('stack_size_limit') && sizeof($_SESSION['_cache'][$this->_ns]) >= $this->getParam('min_items')) {
    157157            array_shift($_SESSION['_cache'][$this->_ns]);
    158158        }
  • trunk/lib/Captcha.inc.php

    r176 r247  
    222222    function _getRandomNumber()
    223223    {
    224         return substr(strval(rand(10000, 99999)), 0, rand(3, 5));
     224        return mb_substr(strval(rand(10000, 99999)), 0, rand(3, 5));
    225225    }
    226226
  • trunk/lib/DB.inc.php

    r231 r247  
    149149
    150150        // Tell MySQL what character set we're useing. Available only on MySQL verions > 4.01.01.
    151         if ('' != $app->getParam('character_set') && isset($this->mysql_character_sets[strtolower($app->getParam('character_set'))])) {
    152             $this->query("/*!40101 SET NAMES '" . $this->mysql_character_sets[strtolower($app->getParam('character_set'))] . "' */");
     151        if ('' != $app->getParam('character_set') && isset($this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])) {
     152            $this->query("/*!40101 SET NAMES '" . $this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))] . "' */");
    153153        } else {
    154154            $app->logMsg(sprintf('%s is not a known character_set.', $app->getParam('character_set')), LOG_ERR, __FILE__, __LINE__);
  • trunk/lib/Email.inc.php

    r216 r247  
    211211        // Apply regex pattern to search elements.
    212212        $search = array_keys($replacements);
    213         array_walk($search, create_function('&$v', '$v = "{" . strtoupper($v) . "}";'));
     213        array_walk($search, create_function('&$v', '$v = "{" . mb_strtoupper($v) . "}";'));
    214214
    215215        // Replacement values.
     
    310310
    311311        // Ensure message was successfully accepted for delivery.
    312         if (mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header)) {
     312        if (mb_send_mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header)) {
    313313            $app->logMsg(sprintf('Email successfully sent to %s', $final_to), LOG_INFO, __FILE__, __LINE__);
    314314            return true;
     
    348348        } else {
    349349            // To be valid email address must match regex and fit within the lenth constraints.
    350             if (preg_match($this->getParam('regex'), $email, $e_parts) && strlen($e_parts[2]) < 64 && strlen($e_parts[3]) < 255) {
     350            if (preg_match($this->getParam('regex'), $email, $e_parts) && mb_strlen($e_parts[2]) < 64 && mb_strlen($e_parts[3]) < 255) {
    351351                return true;
    352352            } else {
  • trunk/lib/ImageThumb.inc.php

    r235 r247  
    248248        while ($dir_handle && ($file = readdir($dir_handle)) !== false) {
    249249            // If the file name does not start with a dot (. or .. or .htaccess).
    250             if (!preg_match('/^\./', $file) && in_array(strtolower(substr($file, strrpos($file, '.') + 1)), $this->getParam('valid_file_extensions'))) {
     250            if (!preg_match('/^\./', $file) && in_array(mb_strtolower(mb_substr($file, mb_strrpos($file, '.') + 1)), $this->getParam('valid_file_extensions'))) {
    251251                $files[] = $file;
    252252            }
     
    349349            if ('/' == $spec['dest_dir']{0}) {
    350350                // Absolute path.
    351                 $dest_file = sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']);
     351                $dest_file = sprintf('%s/%s.%s', $spec['dest_dir'], mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']);
    352352            } else {
    353353                // Relative path.
    354                 $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']);
     354                $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']);
    355355            }
    356356                 
     
    639639            if ('/' == $spec['dest_dir']{0}) {
    640640                // Absolute path.
    641                 $dest_file = realpath(sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']));               
     641                $dest_file = realpath(sprintf('%s/%s.%s', $spec['dest_dir'], mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']));               
    642642            } else {
    643643                // Relative path.
    644                 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']));
     644                $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $spec['dest_file_extension']));
    645645            }
    646646            if (file_exists($dest_file)) {
     
    719719    {
    720720        preg_match('/.*?\.(\w+)$/i', $file_name, $ext);
    721         return !empty($ext) && in_array(strtolower($ext[1]), $this->getParam('valid_file_extensions'));       
     721        return !empty($ext) && in_array(mb_strtolower($ext[1]), $this->getParam('valid_file_extensions'));       
    722722    }
    723723
  • trunk/lib/PEdit.inc.php

    r185 r247  
    237237            ?>
    238238            <div class="sc-pedit-buttons">
    239                 <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
    240                 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     239                <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo mb_substr(_("Save"), 0, 1) ?>" />
     240                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo mb_substr(_("Cancel"), 0, 1) ?>" />
    241241            </div>
    242242            <?php
     
    318318            ?>
    319319            <div class="sc-pedit-buttons">
    320                 <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
    321                 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     320                <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo mb_substr(_("Save"), 0, 1) ?>" />
     321                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo mb_substr(_("Cancel"), 0, 1) ?>" />
    322322            </div>
    323323            </form>
     
    327327            ?>
    328328            <div class="sc-pedit-buttons">
    329                 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     329                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo mb_substr(_("Cancel"), 0, 1) ?>" />
    330330            </div>
    331331            </form>
     
    335335            ?>
    336336            <div class="sc-pedit-buttons">
    337                 <input type="submit" name="op" value="<?php echo _("Restore"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Restore"))?>" accesskey="<?php echo substr(_("Restore"), 0, 1) ?>" />
    338                 <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
    339                 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     337                <input type="submit" name="op" value="<?php echo _("Restore"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Restore"))?>" accesskey="<?php echo mb_substr(_("Restore"), 0, 1) ?>" />
     338                <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo mb_substr(_("Versions"), 0, 1) ?>" />
     339                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo mb_substr(_("Cancel"), 0, 1) ?>" />
    340340            </div>
    341341            </form>
     
    345345            ?>
    346346            <div class="sc-pedit-buttons">
    347                 <input type="submit" name="op" value="<?php echo _("Edit"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Edit"))?>" accesskey="<?php echo substr(_("Edit"), 0, 1) ?>" />
    348                 <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
     347                <input type="submit" name="op" value="<?php echo _("Edit"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Edit"))?>" accesskey="<?php echo mb_substr(_("Edit"), 0, 1) ?>" />
     348                <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo mb_substr(_("Versions"), 0, 1) ?>" />
    349349            </div>
    350350            </form>
     
    525525
    526526        // Ensure requested filename is within the pedit data dir.
    527         if (strpos($filename, $this->getParam('data_dir')) === false) {
     527        if (mb_strpos($filename, $this->getParam('data_dir')) === false) {
    528528            $app->logMsg(sprintf('Failed writing file outside pedit _data_dir: %s', $filename), LOG_ERR, __FILE__, __LINE__);
    529529            return false;
     
    547547        if ($fp = fopen($filename, 'w')) {
    548548            if (flock($fp, LOCK_EX)) {
    549                 fwrite($fp, $content, strlen($content));
     549                fwrite($fp, $content, mb_strlen($content));
    550550                flock($fp, LOCK_UN);
    551551            } else {
  • trunk/lib/PayPal.inc.php

    r146 r247  
    308308            fputs($fp, "Host: {$url['host']}\r\n");
    309309            fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
    310             fputs($fp, "Content-length: " . strlen($return_data) . "\r\n");
     310            fputs($fp, "Content-length: " . mb_strlen($return_data) . "\r\n");
    311311            fputs($fp, "Connection: close\r\n\r\n");
    312312            fputs($fp, $return_data . "\r\n\r\n");
  • trunk/lib/SortOrder.inc.php

    r154 r247  
    134134        $db =& DB::getInstance();
    135135
    136         if (!isset($this->_columns[strtolower($this->sort_by)])) {
     136        if (!isset($this->_columns[mb_strtolower($this->sort_by)])) {
    137137            $this->sort_by = $this->default_sort;
    138138            $this->order = $this->default_order;
    139139        }
    140         if (!isset($this->_columns[strtolower($this->sort_by)][strtolower($this->order)])) {
     140        if (!isset($this->_columns[mb_strtolower($this->sort_by)][mb_strtolower($this->order)])) {
    141141            $this->order = 'ASC';
    142142        }
    143143
    144         if (!empty($this->_columns[strtolower($this->sort_by)][strtolower($this->order)])) {
    145             return sprintf(' ORDER BY %s ', $db->escapeString($this->_columns[strtolower($this->sort_by)][strtolower($this->order)]));
     144        if (!empty($this->_columns[mb_strtolower($this->sort_by)][mb_strtolower($this->order)])) {
     145            return sprintf(' ORDER BY %s ', $db->escapeString($this->_columns[mb_strtolower($this->sort_by)][mb_strtolower($this->order)]));
    146146        } else {
    147147            $app->logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__);
     
    164164
    165165        if ($this->sort_by == $col) {
    166             if (strtolower($this->order) == 'desc') {
     166            if (mb_strtolower($this->order) == 'desc') {
    167167                ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
    168168            } else {
  • trunk/lib/Upload.inc.php

    r203 r247  
    247247
    248248            // Check to be sure the file has a valid file name extension.
    249             if (!in_array(strtolower($this->getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) {
     249            if (!in_array(mb_strtolower($this->getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) {
    250250                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it is an unrecognized type. Files must have one of the following file name extensions: %s."), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);
    251251                $app->logMsg(sprintf('The uploaded file %s has an unrecognized file name extension.', $file_name), LOG_WARNING, __FILE__, __LINE__);
     
    273273
    274274            // FINAL path and file name, lowercase extension.
    275             $file_extension = strtolower($this->getFilenameExtension($file_name));
    276             $file_name = sprintf('%s.%s', substr($file_name, 0, strrpos($file_name, '.')), $file_extension);
     275            $file_extension = mb_strtolower($this->getFilenameExtension($file_name));
     276            $file_name = sprintf('%s.%s', mb_substr($file_name, 0, mb_strrpos($file_name, '.')), $file_extension);
    277277            $file_path_name = sprintf('%s/%s', $this->getParam('upload_path'), $file_name);
    278278
     
    451451        $file_name = strtr($file_name, $bad, $good);
    452452        $file_name = preg_replace('/[^-\w.,~_=+()]/i', '_', $file_name);
    453         $file_name = substr($file_name, 0, 250);
     453        $file_name = mb_substr($file_name, 0, 250);
    454454        return $file_name;
    455455    }
  • trunk/lib/Utilities.inc.php

    r241 r247  
    5050    if (is_array($var)) {
    5151        foreach ($var as $k=>$v) {
    52             $k = ucfirst(strtolower(str_replace(array('_', '  '), ' ', $k)));
     52            $k = ucfirst(mb_strtolower(str_replace(array('_', '  '), ' ', $k)));
    5353            if (is_array($v)) {
    5454                $output .= sprintf("\n%s%s: %s\n", $indent, $k, fancyDump($v, $indent . $indent));
     
    152152    $hash = md5($text);
    153153    $rgb = array(
    154         substr($hash, 0, 1),
    155         substr($hash, 1, 1),
    156         substr($hash, 2, 1),
    157         substr($hash, 3, 1),
    158         substr($hash, 4, 1),
    159         substr($hash, 5, 1),
     154        mb_substr($hash, 0, 1),
     155        mb_substr($hash, 1, 1),
     156        mb_substr($hash, 2, 1),
     157        mb_substr($hash, 3, 1),
     158        mb_substr($hash, 4, 1),
     159        mb_substr($hash, 5, 1),
    160160    );
    161161
     
    189189{
    190190    $ouput = '';
    191     $num = strlen($text);
     191    $num = mb_strlen($text);
    192192    for ($i=0; $i<$num; $i++) {
    193193        $output .= sprintf('&#%03s', ord($text{$i}));
     
    225225function truncate($str, $len, $where='middle')
    226226{
    227     if ($len <= 3 || strlen($str) <= 3) {
     227    if ($len <= 3 || mb_strlen($str) <= 3) {
    228228        return '';
    229229    }
     
    458458{
    459459    do {
    460         if (!ereg($pattern, $string, $temp)) {
     460        if (!mb_ereg($pattern, $string, $temp)) {
    461461             continue;
    462462        }
    463463        $string = str_replace($temp[0], '', $string);
    464464        $results[] = $temp;
    465     } while (ereg($pattern, $string, $temp));
     465    } while (mb_ereg($pattern, $string, $temp));
    466466    return $results;
    467467}
     
    554554{
    555555    // Translate the human string date into SQL-safe date format.
    556     if (empty($date) || strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false) {
     556    if (empty($date) || mb_strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false) {
    557557        // Return a string of zero time, formatted the same as $format.
    558558        return strtr($format, array(
     
    673673    }
    674674
    675     return $val . '-' . substr(md5($salt . md5($val . $salt)), 0, 18);
     675    return $val . '-' . mb_substr(md5($salt . md5($val . $salt)), 0, 18);
    676676}
    677677
     
    685685function removeSignature($signed_val)
    686686{
    687     return substr($signed_val, 0, strrpos($signed_val, '-'));
     687    return mb_substr($signed_val, 0, mb_strrpos($signed_val, '-'));
    688688}
    689689
     
    822822        if (preg_match('![\d\.]{7,15}/\d{1,2}!', $network)) {
    823823            // IP is in CIDR notation.
    824             list($cidr_ip, $cidr_bitmask) = split('/', $network);
     824            list($cidr_ip, $cidr_bitmask) = explode('/', $network);
    825825            $cidr_ip_binary = sprintf('%032b', ip2long($cidr_ip));
    826             if (substr($ip_binary, 0, $cidr_bitmask) === substr($cidr_ip_binary, 0, $cidr_bitmask)) {
     826            if (mb_substr($ip_binary, 0, $cidr_bitmask) === mb_substr($cidr_ip_binary, 0, $cidr_bitmask)) {
    827827               // IP address is within the specified IP range.
    828828               return $network;
  • trunk/lib/Validator.inc.php

    r200 r247  
    134134    function stringLength($val, $min, $max)
    135135    {
    136         return strlen(trim((string)$val)) >= $min && strlen($val) <= $max;
     136        return mb_strlen(trim((string)$val)) >= $min && mb_strlen($val) <= $max;
    137137    }
    138138
     
    180180        // The part after the @.
    181181        // If domain is an IP [XXX.XXX.XXX.XXX] strip off the brackets.
    182         $domain = $e_parts[3]{0} == '[' ? substr($e_parts[3], 1, -1) : $e_parts[3];
     182        $domain = $e_parts[3]{0} == '[' ? mb_substr($e_parts[3], 1, -1) : $e_parts[3];
    183183
    184184        // Test length.
    185         if (strlen($local) > 64 || strlen($domain) > 191) {
     185        if (mb_strlen($local) > 64 || mb_strlen($domain) > 191) {
    186186            return VALIDATE_EMAIL_LENGTH_FAIL;
    187187        }
     
    264264         $luhn_total = 0;
    265265
    266          $num = strlen($cc_num);
     266         $num = mb_strlen($cc_num);
    267267         for ($i=0; $i<$num; $i++) {
    268268             // Get each digit.
    269              $digit = substr($cc_num, $i, 1);
     269             $digit = mb_substr($cc_num, $i, 1);
    270270
    271271             //  If it's an odd digit, double it.
     
    275275
    276276             //  If the result is two digits, add them.
    277              if (strlen($digit) == 2) {
    278                  $digit = substr($digit, 0, 1) + substr($digit, 1, 1);
     277             if (mb_strlen($digit) == 2) {
     278                 $digit = mb_substr($digit, 0, 1) + mb_substr($digit, 1, 1);
    279279             }
    280280
  • trunk/services/lock.php

    r202 r247  
    1313if (getFormData('boomerang', false)) {
    1414    // We remember which page we came from so we can go back there.
    15     $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER'];
     15    $boom_url = mb_strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER'];
    1616    $app->setBoomerangURL($boom_url, 'lock');
    1717    if (isset($_SERVER['HTTP_REFERER'])) {
  • trunk/services/logs.php

    r202 r247  
    256256    $list = array();
    257257    while ($dir_handle && ($file = readdir($dir_handle)) !== false) {
    258         if (!preg_match('/^\./', $file) && is_file($app->getParam('log_directory') . '/' . $file) && in_array(strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) {
     258        if (!preg_match('/^\./', $file) && is_file($app->getParam('log_directory') . '/' . $file) && in_array(mb_strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) {
    259259            $list[] = array(
    260260                'filename' => $file,
Note: See TracChangeset for help on using the changeset viewer.