- Timestamp:
- Apr 5, 2007 1:48:45 AM (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/ACL.inc.php
r218 r247 595 595 596 596 $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) { 598 598 // Null on all three tables will delete ALL entries including the root -> root -> root = deny. 599 599 $app->logMsg(sprintf('Cannot allow deletion of ALL acl entries.', null), LOG_NOTICE, __FILE__, __LINE__); -
trunk/lib/App.inc.php
r242 r247 533 533 'date' => date('Y-m-d H:i:s'), 534 534 'remote ip' => getRemoteAddr(), 535 'pid' => ( substr(PHP_OS, 0, 3) != 'WIN' ? posix_getpid() : ''),535 'pid' => (mb_substr(PHP_OS, 0, 3) != 'WIN' ? posix_getpid() : ''), 536 536 'type' => $this->logPriorityToString($priority), 537 537 '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), 539 539 'message' => $message 540 540 ); … … 543 543 if ($this->getParam('log_file_priority') && $priority <= $this->getParam('log_file_priority')) { 544 544 $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')); 546 546 } 547 547 … … 554 554 $email_msg .= sprintf("%-11s%s\n", $k, $v); 555 555 } 556 m ail($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'); 557 557 } 558 558 … … 560 560 if ($this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority')) { 561 561 $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); 563 563 $headers = "From: codebase@strangecode.com"; 564 m ail($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'); 565 565 } 566 566 … … 669 669 670 670 // 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') : '?'; 672 672 673 673 $q = ''; -
trunk/lib/Auth_File.inc.php
r209 r247 200 200 function login($username, $password) 201 201 { 202 $username = strtolower(trim($username));202 $username = mb_strtolower(trim($username)); 203 203 204 204 $this->clear(); -
trunk/lib/Auth_SQL.inc.php
r229 r247 621 621 622 622 if ($this->getParam('blocking')) { 623 if ( strlen($db->escapeString($reason)) > 255) {623 if (mb_strlen($db->escapeString($reason)) > 255) { 624 624 // blocked_reason field is varchar(255). 625 625 $app->logMsg(sprintf('Blocked reason provided is greater than 255 characters: %s', $reason), LOG_WARNING, __FILE__, __LINE__); … … 726 726 } 727 727 $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); 735 735 $str .= $$pattern{$i}; 736 736 } … … 756 756 case AUTH_ENCRYPT_CRYPT : 757 757 // 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); 759 759 break; 760 760 -
trunk/lib/AuthorizeNet.inc.php
r146 r247 238 238 { 239 239 return ( 240 strtolower($this->getResult('x_md5_hash')) ==strtolower(md5(240 mb_strtolower($this->getResult('x_md5_hash')) == mb_strtolower(md5( 241 241 $this->md5_hash_value . 242 242 $this->getParam('x_login') . -
trunk/lib/Cache.inc.php
r238 r247 138 138 139 139 $var = serialize($var); 140 $var_len = strlen($var);140 $var_len = mb_strlen($var); 141 141 142 142 if ($var_len >= $this->getParam('item_size_limit')) { … … 154 154 155 155 // 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')) { 157 157 array_shift($_SESSION['_cache'][$this->_ns]); 158 158 } -
trunk/lib/Captcha.inc.php
r176 r247 222 222 function _getRandomNumber() 223 223 { 224 return substr(strval(rand(10000, 99999)), 0, rand(3, 5));224 return mb_substr(strval(rand(10000, 99999)), 0, rand(3, 5)); 225 225 } 226 226 -
trunk/lib/DB.inc.php
r231 r247 149 149 150 150 // 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'))] . "' */"); 153 153 } else { 154 154 $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 211 211 // Apply regex pattern to search elements. 212 212 $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) . "}";')); 214 214 215 215 // Replacement values. … … 310 310 311 311 // Ensure message was successfully accepted for delivery. 312 if (m ail($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)) { 313 313 $app->logMsg(sprintf('Email successfully sent to %s', $final_to), LOG_INFO, __FILE__, __LINE__); 314 314 return true; … … 348 348 } else { 349 349 // 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) { 351 351 return true; 352 352 } else { -
trunk/lib/ImageThumb.inc.php
r235 r247 248 248 while ($dir_handle && ($file = readdir($dir_handle)) !== false) { 249 249 // 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'))) { 251 251 $files[] = $file; 252 252 } … … 349 349 if ('/' == $spec['dest_dir']{0}) { 350 350 // 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']); 352 352 } else { 353 353 // 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']); 355 355 } 356 356 … … 639 639 if ('/' == $spec['dest_dir']{0}) { 640 640 // 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'])); 642 642 } else { 643 643 // 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'])); 645 645 } 646 646 if (file_exists($dest_file)) { … … 719 719 { 720 720 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')); 722 722 } 723 723 -
trunk/lib/PEdit.inc.php
r185 r247 237 237 ?> 238 238 <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) ?>" /> 241 241 </div> 242 242 <?php … … 318 318 ?> 319 319 <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) ?>" /> 322 322 </div> 323 323 </form> … … 327 327 ?> 328 328 <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) ?>" /> 330 330 </div> 331 331 </form> … … 335 335 ?> 336 336 <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) ?>" /> 340 340 </div> 341 341 </form> … … 345 345 ?> 346 346 <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) ?>" /> 349 349 </div> 350 350 </form> … … 525 525 526 526 // 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) { 528 528 $app->logMsg(sprintf('Failed writing file outside pedit _data_dir: %s', $filename), LOG_ERR, __FILE__, __LINE__); 529 529 return false; … … 547 547 if ($fp = fopen($filename, 'w')) { 548 548 if (flock($fp, LOCK_EX)) { 549 fwrite($fp, $content, strlen($content));549 fwrite($fp, $content, mb_strlen($content)); 550 550 flock($fp, LOCK_UN); 551 551 } else { -
trunk/lib/PayPal.inc.php
r146 r247 308 308 fputs($fp, "Host: {$url['host']}\r\n"); 309 309 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"); 311 311 fputs($fp, "Connection: close\r\n\r\n"); 312 312 fputs($fp, $return_data . "\r\n\r\n"); -
trunk/lib/SortOrder.inc.php
r154 r247 134 134 $db =& DB::getInstance(); 135 135 136 if (!isset($this->_columns[ strtolower($this->sort_by)])) {136 if (!isset($this->_columns[mb_strtolower($this->sort_by)])) { 137 137 $this->sort_by = $this->default_sort; 138 138 $this->order = $this->default_order; 139 139 } 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)])) { 141 141 $this->order = 'ASC'; 142 142 } 143 143 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)])); 146 146 } else { 147 147 $app->logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__); … … 164 164 165 165 if ($this->sort_by == $col) { 166 if ( strtolower($this->order) == 'desc') {166 if (mb_strtolower($this->order) == 'desc') { 167 167 ?><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 168 168 } else { -
trunk/lib/Upload.inc.php
r203 r247 247 247 248 248 // 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'))) { 250 250 $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__); 251 251 $app->logMsg(sprintf('The uploaded file %s has an unrecognized file name extension.', $file_name), LOG_WARNING, __FILE__, __LINE__); … … 273 273 274 274 // 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); 277 277 $file_path_name = sprintf('%s/%s', $this->getParam('upload_path'), $file_name); 278 278 … … 451 451 $file_name = strtr($file_name, $bad, $good); 452 452 $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); 454 454 return $file_name; 455 455 } -
trunk/lib/Utilities.inc.php
r241 r247 50 50 if (is_array($var)) { 51 51 foreach ($var as $k=>$v) { 52 $k = ucfirst( strtolower(str_replace(array('_', ' '), ' ', $k)));52 $k = ucfirst(mb_strtolower(str_replace(array('_', ' '), ' ', $k))); 53 53 if (is_array($v)) { 54 54 $output .= sprintf("\n%s%s: %s\n", $indent, $k, fancyDump($v, $indent . $indent)); … … 152 152 $hash = md5($text); 153 153 $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), 160 160 ); 161 161 … … 189 189 { 190 190 $ouput = ''; 191 $num = strlen($text);191 $num = mb_strlen($text); 192 192 for ($i=0; $i<$num; $i++) { 193 193 $output .= sprintf('&#%03s', ord($text{$i})); … … 225 225 function truncate($str, $len, $where='middle') 226 226 { 227 if ($len <= 3 || strlen($str) <= 3) {227 if ($len <= 3 || mb_strlen($str) <= 3) { 228 228 return ''; 229 229 } … … 458 458 { 459 459 do { 460 if (! ereg($pattern, $string, $temp)) {460 if (!mb_ereg($pattern, $string, $temp)) { 461 461 continue; 462 462 } 463 463 $string = str_replace($temp[0], '', $string); 464 464 $results[] = $temp; 465 } while ( ereg($pattern, $string, $temp));465 } while (mb_ereg($pattern, $string, $temp)); 466 466 return $results; 467 467 } … … 554 554 { 555 555 // 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) { 557 557 // Return a string of zero time, formatted the same as $format. 558 558 return strtr($format, array( … … 673 673 } 674 674 675 return $val . '-' . substr(md5($salt . md5($val . $salt)), 0, 18);675 return $val . '-' . mb_substr(md5($salt . md5($val . $salt)), 0, 18); 676 676 } 677 677 … … 685 685 function removeSignature($signed_val) 686 686 { 687 return substr($signed_val, 0,strrpos($signed_val, '-'));687 return mb_substr($signed_val, 0, mb_strrpos($signed_val, '-')); 688 688 } 689 689 … … 822 822 if (preg_match('![\d\.]{7,15}/\d{1,2}!', $network)) { 823 823 // IP is in CIDR notation. 824 list($cidr_ip, $cidr_bitmask) = split('/', $network);824 list($cidr_ip, $cidr_bitmask) = explode('/', $network); 825 825 $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)) { 827 827 // IP address is within the specified IP range. 828 828 return $network; -
trunk/lib/Validator.inc.php
r200 r247 134 134 function stringLength($val, $min, $max) 135 135 { 136 return strlen(trim((string)$val)) >= $min &&strlen($val) <= $max;136 return mb_strlen(trim((string)$val)) >= $min && mb_strlen($val) <= $max; 137 137 } 138 138 … … 180 180 // The part after the @. 181 181 // 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]; 183 183 184 184 // Test length. 185 if ( strlen($local) > 64 ||strlen($domain) > 191) {185 if (mb_strlen($local) > 64 || mb_strlen($domain) > 191) { 186 186 return VALIDATE_EMAIL_LENGTH_FAIL; 187 187 } … … 264 264 $luhn_total = 0; 265 265 266 $num = strlen($cc_num);266 $num = mb_strlen($cc_num); 267 267 for ($i=0; $i<$num; $i++) { 268 268 // Get each digit. 269 $digit = substr($cc_num, $i, 1);269 $digit = mb_substr($cc_num, $i, 1); 270 270 271 271 // If it's an odd digit, double it. … … 275 275 276 276 // 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); 279 279 } 280 280
Note: See TracChangeset
for help on using the changeset viewer.