cvs diff -u -F^f -N (in directory C:\cvs\drupal) ? comment.patch ? misc/watchdog-icons.zip cvs diff: Diffing . cvs diff: Diffing database cvs diff: Diffing includes Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.457 diff -u -F^f -r1.457 common.inc --- includes/common.inc 6 Jul 2005 14:20:11 -0000 1.457 +++ includes/common.inc 14 Jul 2005 17:10:51 -0000 @@ -1730,235 +1730,6 @@ function drupal_map_assoc($array, $funct } /** - * Prepare a new XML parser. - * - * This is a wrapper around xml_parser_create() which extracts the encoding from - * the XML data first and sets the output encoding to UTF-8. This function should - * be used instead of xml_parser_create(), because PHP's XML parser doesn't check - * the input encoding itself. - * - * This is also where unsupported encodings will be converted. - * Callers should take this into account: $data might have been changed after - * the call. - * - * @param &$data - * The XML data which will be parsed later. - * @return - * An XML parser object. - */ -function drupal_xml_parser_create(&$data) { - // Default XML encoding is UTF-8 - $encoding = 'utf-8'; - $bom = false; - - // Check for UTF-8 byte order mark (PHP5's XML parser doesn't handle it). - if (!strncmp($data, "\xEF\xBB\xBF", 3)) { - $bom = true; - $data = substr($data, 3); - } - - // Check for an encoding declaration in the XML prolog if no BOM was found. - if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) { - $encoding = $match[1]; - } - - // Unsupported encodings are converted here into UTF-8. - $php_supported = array('utf-8', 'iso-8859-1', 'us-ascii'); - if (!in_array(strtolower($encoding), $php_supported)) { - $out = drupal_convert_to_utf8($data, $encoding); - if ($out !== false) { - $data = $out; - $encoding = 'utf-8'; - } - else { - watchdog('php', t("Could not convert XML encoding '%s' to UTF-8.", array('%s' => $encoding)), WATCHDOG_WARNING); - return 0; - } - } - - $xml_parser = xml_parser_create($encoding); - xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8'); - return $xml_parser; -} - -/** - * Convert data to UTF-8 - * - * Requires the iconv, GNU recode or mbstring PHP extension. - * - * @param $data - * The data to be converted. - * @param $encoding - * The encoding that the data is in - * @return - * Converted data or FALSE. - */ -function drupal_convert_to_utf8($data, $encoding) { - if (function_exists('iconv')) { - $out = @iconv($encoding, 'utf-8', $data); - } - else if (function_exists('mb_convert_encoding')) { - $out = @mb_convert_encoding($data, 'utf-8', $encoding); - } - else if (function_exists('recode_string')) { - $out = @recode_string($encoding .'..utf-8', $data); - } - else { - watchdog('php', t("Unsupported encoding '%s'. Please install iconv, GNU recode or mbstring for PHP.", array('%s' => $encoding)), WATCHDOG_ERROR); - return FALSE; - } - - return $out; -} - -/** - * Truncate a UTF-8-encoded string safely. - * - * If the end position is in the middle of a UTF-8 sequence, it scans backwards - * until the beginning of the byte sequence. - * - * Use this function whenever you want to chop off a string at an unsure - * location. On the other hand, if you're sure that you're splitting on a - * character boundary (e.g. after using strpos() or similar), you can safely use - * substr() instead. - * - * @param $string - * The string to truncate. - * @param $len - * An upper limit on the returned string length. - * @param $wordsafe - * Flag to truncate at nearest space. Defaults to FALSE. - * @return - * The truncated string. - */ -function truncate_utf8($string, $len, $wordsafe = FALSE, $dots = FALSE) { - $slen = strlen($string); - if ($slen <= $len) { - return $string; - } - if ($wordsafe) { - while (($string[--$len] != ' ') && ($len > 0)) {}; - } - if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) { - return substr($string, 0, $len) . ($dots ? ' ...' : ''); - } - while (ord($string[--$len]) < 0xC0) {}; - return substr($string, 0, $len) . ($dots ? ' ...' : ''); -} - -/** - * Encodes MIME/HTTP header values that contain non-ASCII, UTF-8 encoded - * characters. - * - * For example, mime_header_encode('tést.txt') returns "=?UTF-8?B?dMOpc3QudHh0?=". - * - * See http://www.rfc-editor.org/rfc/rfc2047.txt for more information. - * - * Notes: - * - Only encode strings that contain non-ASCII characters. - * - We progressively cut-off a chunk with truncate_utf8(). This is to ensure - * each chunk starts and ends on a character boundary. - * - Using \n as the chunk separator may cause problems on some systems and may - * have to be changed to \r\n or \r. - */ -function mime_header_encode($string) { - if (!preg_match('/^[\x20-\x7E]*$/', $string)) { - $chunk_size = 47; // floor((75 - strlen("=?UTF-8?B??=")) * 0.75); - $len = strlen($string); - $output = ''; - while ($len > 0) { - $chunk = truncate_utf8($string, $chunk_size); - $output .= ' =?UTF-8?B?'. base64_encode($chunk) ."?=\n"; - $c = strlen($chunk); - $string = substr($string, $c); - $len -= $c; - } - return trim($output); - } - return $string; -} - -/** - * Decode all HTML entities (including numerical ones) to regular UTF-8 bytes. - * Double-escaped entities will only be decoded once ("&lt;" becomes "<", not "<"). - * - * @param $text - * The text to decode entities in. - * @param $exclude - * An array of characters which should not be decoded. For example, - * array('<', '&', '"'). This affects both named and numerical entities. - */ -function decode_entities($text, $exclude = array()) { - static $table; - // We store named entities in a table for quick processing. - if (!isset($table)) { - // Get all named HTML entities. - $table = array_flip(get_html_translation_table(HTML_ENTITIES)); - // PHP gives us ISO-8859-1 data, we need UTF-8. - $table = array_map('utf8_encode', $table); - // Add apostrophe (XML) - $table['''] = "'"; - } - $newtable = array_diff($table, $exclude); - - // Use a regexp to select all entities in one pass, to avoid decoding double-escaped entities twice. - return preg_replace('/&(#x?)?([A-Za-z0-9]+);/e', '_decode_entities("$1", "$2", "$0", $newtable, $exclude)', $text); -} - -/** - * Helper function for decode_entities - */ -function _decode_entities($prefix, $codepoint, $original, &$table, &$exclude) { - // Named entity - if (!$prefix) { - if (isset($table[$original])) { - return $table[$original]; - } - else { - return $original; - } - } - // Hexadecimal numerical entity - if ($prefix == '#x') { - $codepoint = base_convert($codepoint, 16, 10); - } - // Encode codepoint as UTF-8 bytes - if ($codepoint < 0x80) { - $str = chr($codepoint); - } - else if ($codepoint < 0x800) { - $str = chr(0xC0 | ($codepoint >> 6)) - . chr(0x80 | ($codepoint & 0x3F)); - } - else if ($codepoint < 0x10000) { - $str = chr(0xE0 | ( $codepoint >> 12)) - . chr(0x80 | (($codepoint >> 6) & 0x3F)) - . chr(0x80 | ( $codepoint & 0x3F)); - } - else if ($codepoint < 0x200000) { - $str = chr(0xF0 | ( $codepoint >> 18)) - . chr(0x80 | (($codepoint >> 12) & 0x3F)) - . chr(0x80 | (($codepoint >> 6) & 0x3F)) - . chr(0x80 | ( $codepoint & 0x3F)); - } - // Check for excluded characters - if (in_array($str, $exclude)) { - return $original; - } - else { - return $str; - } -} - -/** - * Count the amount of characters in a UTF-8 string. This is less than or - * equal to the byte count. - */ -function string_length(&$text) { - return strlen(preg_replace("/[\x80-\xBF]/", '', $text)); -} - -/** * Evaluate a string of PHP code. * * This is a wrapper around PHP's eval(). It uses output buffering to capture both @@ -2063,6 +1834,7 @@ function _drupal_bootstrap_full() { require_once './includes/menu.inc'; require_once './includes/tablesort.inc'; require_once './includes/file.inc'; + require_once './includes/unicode.inc'; require_once './includes/xmlrpc.inc'; require_once './includes/image.inc'; // Set the Drupal custom error handler. Index: includes/tablesort.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/tablesort.inc,v retrieving revision 1.34 diff -u -F^f -r1.34 tablesort.inc --- includes/tablesort.inc 2 Jul 2005 12:32:09 -0000 1.34 +++ includes/tablesort.inc 14 Jul 2005 22:35:50 -0000 @@ -52,7 +52,7 @@ function tablesort_sql($header, $before $ts = tablesort_init($header); if ($ts['sql']) { $sql = db_escape_string($ts['sql']); - $sort = strtoupper(db_escape_string($ts['sort'])); + $sort = drupal_strtoupper(db_escape_string($ts['sort'])); return " ORDER BY $before $sql $sort"; } } Index: includes/unicode.inc =================================================================== RCS file: includes/unicode.inc diff -N includes/unicode.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ includes/unicode.inc 15 Jul 2005 01:38:54 -0000 @@ -0,0 +1,450 @@ +PHP PCRE documentation for more information.', array('%url' => 'http://be.php.net/manual/nl/ref.pcre.php'))); + } + return UNICODE_ERROR; + } + + // Check for mbstring extension + if (!function_exists('mb_strlen')) { + return UNICODE_SINGLEBYTE; + } + + // Check mbstring configuration + if (ini_get('mbstring.func_overload') != 0) { + if ($errors) { + form_set_error('unicode', t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini mbstring.func_overload setting. Please refer to the PHP mbstring documentation for more information.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php'))); + } + return UNICODE_ERROR; + } + if (ini_get('mbstring.encoding_translation') != 0) { + if ($errors) { + form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php'))); + } + return UNICODE_ERROR; + } + if (ini_get('mbstring.http_input') != 'pass') { + if ($errors) { + form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php'))); + } + return UNICODE_ERROR; + } + if (ini_get('mbstring.http_output') != 'pass') { + if ($errors) { + form_set_error('unicode', t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_output setting. Please refer to the PHP mbstring documentation for more information.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php'))); + } + return UNICODE_ERROR; + } + + // Set appropriate configuration + mb_internal_encoding('utf-8'); + mb_language('uni'); + return UNICODE_MULTIBYTE; +} + +/** + * Return the required Unicode status and errors for admin/settings. + */ +function unicode_settings() { + $status = unicode_check(true); + $options = array(UNICODE_SINGLEBYTE => t('Standard PHP: operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php')), + UNICODE_MULTIBYTE => t('Multi-byte: operations on Unicode strings are supported through the PHP mbstring extension.', array('%url' => 'http://www.php.net/manual/nl/ref.mbstring.php')), + UNICODE_ERROR => t('Invalid: the current configuration is incompatible with Drupal.')); + return form_item(t('String handling method'), $options[$status]); +} + +/** + * Prepare a new XML parser. + * + * This is a wrapper around xml_parser_create() which extracts the encoding from + * the XML data first and sets the output encoding to UTF-8. This function should + * be used instead of xml_parser_create(), because PHP's XML parser doesn't check + * the input encoding itself. + * + * This is also where unsupported encodings will be converted. + * Callers should take this into account: $data might have been changed after + * the call. + * + * @param &$data + * The XML data which will be parsed later. + * @return + * An XML parser object. + */ +function drupal_xml_parser_create(&$data) { + // Default XML encoding is UTF-8 + $encoding = 'utf-8'; + $bom = false; + + // Check for UTF-8 byte order mark (PHP5's XML parser doesn't handle it). + if (!strncmp($data, "\xEF\xBB\xBF", 3)) { + $bom = true; + $data = substr($data, 3); + } + + // Check for an encoding declaration in the XML prolog if no BOM was found. + if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) { + $encoding = $match[1]; + } + + // Unsupported encodings are converted here into UTF-8. + $php_supported = array('utf-8', 'iso-8859-1', 'us-ascii'); + if (!in_array(strtolower($encoding), $php_supported)) { + $out = drupal_convert_to_utf8($data, $encoding); + if ($out !== false) { + $data = $out; + $encoding = 'utf-8'; + } + else { + watchdog('php', t("Could not convert XML encoding '%s' to UTF-8.", array('%s' => $encoding)), WATCHDOG_WARNING); + return 0; + } + } + + $xml_parser = xml_parser_create($encoding); + xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8'); + return $xml_parser; +} + +/** + * Convert data to UTF-8 + * + * Requires the iconv, GNU recode or mbstring PHP extension. + * + * @param $data + * The data to be converted. + * @param $encoding + * The encoding that the data is in + * @return + * Converted data or FALSE. + */ +function drupal_convert_to_utf8($data, $encoding) { + if (function_exists('iconv')) { + $out = @iconv($encoding, 'utf-8', $data); + } + else if (function_exists('mb_convert_encoding')) { + $out = @mb_convert_encoding($data, 'utf-8', $encoding); + } + else if (function_exists('recode_string')) { + $out = @recode_string($encoding .'..utf-8', $data); + } + else { + watchdog('php', t("Unsupported encoding '%s'. Please install iconv, GNU recode or mbstring for PHP.", array('%s' => $encoding)), WATCHDOG_ERROR); + return FALSE; + } + + return $out; +} + +/** + * Truncate a UTF-8-encoded string safely to a number of bytes. + * + * If the end position is in the middle of a UTF-8 sequence, it scans backwards + * until the beginning of the byte sequence. + * + * Use this function whenever you want to chop off a string at an unsure + * location. On the other hand, if you're sure that you're splitting on a + * character boundary (e.g. after using strpos() or similar), you can safely use + * substr() instead. + * + * @param $string + * The string to truncate. + * @param $len + * An upper limit on the returned string length. + * @param $wordsafe + * Flag to truncate at nearest space. Defaults to FALSE. + * @return + * The truncated string. + */ +function truncate_utf8($string, $len, $wordsafe = FALSE, $dots = FALSE) { + $slen = strlen($string); + if ($slen <= $len) { + return $string; + } + if ($wordsafe) { + while (($string{--$len} != ' ') && ($len > 0)) {}; + } + if ((ord($string{$len}) < 0x80) || (ord($string{$len}) >= 0xC0)) { + return substr($string, 0, $len) . ($dots ? ' ...' : ''); + } + while (ord($string{--$len}) < 0xC0) {}; + return substr($string, 0, $len) . ($dots ? ' ...' : ''); +} + +/** + * Encodes MIME/HTTP header values that contain non-ASCII, UTF-8 encoded + * characters. + * + * For example, mime_header_encode('tést.txt') returns "=?UTF-8?B?dMOpc3QudHh0?=". + * + * See http://www.rfc-editor.org/rfc/rfc2047.txt for more information. + * + * Notes: + * - Only encode strings that contain non-ASCII characters. + * - We progressively cut-off a chunk with truncate_utf8(). This is to ensure + * each chunk starts and ends on a character boundary. + * - Using \n as the chunk separator may cause problems on some systems and may + * have to be changed to \r\n or \r. + */ +function mime_header_encode($string) { + if (!preg_match('/^[\x20-\x7E]*$/', $string)) { + $chunk_size = 47; // floor((75 - strlen("=?UTF-8?B??=")) * 0.75); + $len = strlen($string); + $output = ''; + while ($len > 0) { + $chunk = truncate_utf8($string, $chunk_size); + $output .= ' =?UTF-8?B?'. base64_encode($chunk) ."?=\n"; + $c = strlen($chunk); + $string = substr($string, $c); + $len -= $c; + } + return trim($output); + } + return $string; +} + +/** + * Decode all HTML entities (including numerical ones) to regular UTF-8 bytes. + * Double-escaped entities will only be decoded once ("&lt;" becomes "<", not "<"). + * + * @param $text + * The text to decode entities in. + * @param $exclude + * An array of characters which should not be decoded. For example, + * array('<', '&', '"'). This affects both named and numerical entities. + */ +function decode_entities($text, $exclude = array()) { + static $table; + // We store named entities in a table for quick processing. + if (!isset($table)) { + // Get all named HTML entities. + $table = array_flip(get_html_translation_table(HTML_ENTITIES)); + // PHP gives us ISO-8859-1 data, we need UTF-8. + $table = array_map('utf8_encode', $table); + // Add apostrophe (XML) + $table['''] = "'"; + } + $newtable = array_diff($table, $exclude); + + // Use a regexp to select all entities in one pass, to avoid decoding double-escaped entities twice. + return preg_replace('/&(#x?)?([A-Za-z0-9]+);/e', '_decode_entities("$1", "$2", "$0", $newtable, $exclude)', $text); +} + +/** + * Helper function for decode_entities + */ +function _decode_entities($prefix, $codepoint, $original, &$table, &$exclude) { + // Named entity + if (!$prefix) { + if (isset($table[$original])) { + return $table[$original]; + } + else { + return $original; + } + } + // Hexadecimal numerical entity + if ($prefix == '#x') { + $codepoint = base_convert($codepoint, 16, 10); + } + // Encode codepoint as UTF-8 bytes + if ($codepoint < 0x80) { + $str = chr($codepoint); + } + else if ($codepoint < 0x800) { + $str = chr(0xC0 | ($codepoint >> 6)) + . chr(0x80 | ($codepoint & 0x3F)); + } + else if ($codepoint < 0x10000) { + $str = chr(0xE0 | ( $codepoint >> 12)) + . chr(0x80 | (($codepoint >> 6) & 0x3F)) + . chr(0x80 | ( $codepoint & 0x3F)); + } + else if ($codepoint < 0x200000) { + $str = chr(0xF0 | ( $codepoint >> 18)) + . chr(0x80 | (($codepoint >> 12) & 0x3F)) + . chr(0x80 | (($codepoint >> 6) & 0x3F)) + . chr(0x80 | ( $codepoint & 0x3F)); + } + // Check for excluded characters + if (in_array($str, $exclude)) { + return $original; + } + else { + return $str; + } +} + +/** + * Count the amount of characters in a UTF-8 string. This is less than or + * equal to the byte count. + */ +function drupal_strlen($text) { + global $multibyte; + if ($multibyte == UNICODE_MULTIBYTE) { + return mb_strlen($text); + } + else { + // Do not count UTF-8 continuation bytes. + return strlen(preg_replace("/[\x80-\xBF]/", '', $text)); + } +} + +/** + * Uppercase a UTF-8 string. + */ +function drupal_strtoupper($text) { + global $multibyte; + if ($multibyte == UNICODE_MULTIBYTE) { + //return mb_convert_case($text, MB_CASE_UPPER, 'utf-8'); + return mb_strtoupper($text); + } + else { + // Use C-locale for ASCII-only uppercase + $text = strtoupper($text); + // Case flip Latin-1 accented letters + $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '_unicode_caseflip', $text); + return $text; + } +} + +/** + * Lowercase a UTF-8 string. + */ +function drupal_strtolower($text) { + global $multibyte; + if ($multibyte == UNICODE_MULTIBYTE) { + //return mb_convert_case($text, MB_CASE_LOWER, 'utf-8'); + return mb_strtolower($text); + } + else { + // Use C-locale for ASCII-only lowercase + $text = strtolower($text); + // Case flip Latin-1 accented letters + $text = preg_replace_callback('/\xC3[\x80-\x96\x98-\x9E]/', '_unicode_caseflip', $text); + return $text; + } +} + +/** + * Helper function for case conversion of Latin-1. + * Used for flipping U+C0-U+DE to U+E0-U+FD and back. + */ +function _unicode_caseflip($matches) { + return $matches[0]{0} . chr(ord($matches[0]{1}) ^ 32); +} + +/** + * Capitalize the first letter of a UTF-8 string. + */ +function drupal_ucfirst($text) { + // Note: no mbstring equivalent! + return drupal_strtoupper(drupal_substr($text, 0, 1)) . drupal_substr($text, 1); +} + +/** + * Cut off a piece of a string based on character indices and counts. Follows + * the same behaviour as PHP's own substr() function. + * + * Note that for cutting off a string at a known character/substring + * location, the usage of PHP's normal strpos/substr is safe and + * much faster. + */ +function drupal_substr($text, $start, $length = NULL) { + global $multibyte; + if ($multibyte == UNICODE_MULTIBYTE) { + return $length === NULL ? mb_substr($text, $start) : mb_substr($text, $start, $length); + } + else { + $strlen = strlen($text); + // Find the starting byte offset + if ($start > 0) { + // Count all the continuation bytes from the start until we have found + // $start characters + $bytes = -1; $chars = -1; + while ($bytes < $strlen && $chars < $start) { + $bytes++; + $c = ord($text{$bytes}); + if ($c < 0x80 || $c >= 0xC0) { + $chars++; + } + } + } + else if ($start < 0) { + // Count all the continuation bytes from the end until we have found + // abs($start) characters + $start = abs($start); + $bytes = $strlen; $chars = 0; + while ($bytes > 0 && $chars < $start) { + $bytes--; + $c = ord($text{$bytes}); + if ($c < 0x80 || $c >= 0xC0) { + $chars++; + } + } + } + $istart = $bytes; + + // Find the ending byte offset + if ($length === NULL) { + $bytes = $strlen - 1; + } + else if ($length > 0) { + // Count all the continuation bytes from the starting index until we have + // found $length + 1 characters. Then backtrack one byte. + $bytes = $istart; $chars = 0; + while ($bytes < $strlen && $chars < $length) { + $bytes++; + $c = ord($text{$bytes}); + if ($c < 0x80 || $c >= 0xC0) { + $chars++; + } + } + $bytes--; + } + else if ($length < 0) { + // Count all the continuation bytes from the end until we have found + // abs($length) characters + $length = abs($length); + $bytes = $strlen - 1; $chars = 0; + while ($bytes >= 0 && $chars < $length) { + $c = ord($text{$bytes}); + if ($c < 0x80 || $c >= 0xC0) { + $chars++; + } + $bytes--; + } + } + $iend = $bytes; + + return substr($text, $istart, max(0, $iend - $istart + 1)); + } +} + +?> \ No newline at end of file cvs diff: Diffing misc cvs diff: Diffing modules Index: modules/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book.module,v retrieving revision 1.304 diff -u -F^f -r1.304 book.module --- modules/book.module 3 Jul 2005 15:56:04 -0000 1.304 +++ modules/book.module 14 Jul 2005 21:59:55 -0000 @@ -666,7 +666,7 @@ function book_render() { */ function book_export($type = 'html', $nid = 0) { global $base_url; - $type = strtolower($type); + $type = drupal_strtolower($type); $depth = _book_get_depth($nid); switch ($type) { case 'docbook': Index: modules/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search.module,v retrieving revision 1.128 diff -u -F^f -r1.128 search.module --- modules/search.module 27 Jun 2005 18:33:32 -0000 1.128 +++ modules/search.module 14 Jul 2005 23:42:36 -0000 @@ -357,7 +357,7 @@ function search_index($sid, $type, $text if ($tag) { // Increase or decrease score per word based on tag list($tagname) = explode(' ', $value, 2); - $tagname = strtolower($tagname); + $tagname = drupal_strtolower($tagname); if ($tagname{0} == '/') { $score -= $tags[substr($tagname, 1)]; if ($score < 1) { // possible due to bad HTML @@ -389,9 +389,8 @@ function search_index($sid, $type, $text $words = search_keywords_split($value); foreach ($words as $word) { // Check wordlength - if (string_length($word) >= $minimum_word_size) { - // Note: strtolower can be used because the value is only used internally. - $word = strtolower($word); + if (drupal_strlen($word) >= $minimum_word_size) { + $word = drupal_strtolower($word); if ($link) { if (!isset($results[$linknid])) { $results[$linknid] = array(); @@ -484,13 +483,12 @@ function do_search($keywords, $type, $jo continue; } if (strpos($word, '�') !== false) { - // Note: strtolower can be used because the value is only used internally. $words[] = "i.word LIKE '%s'"; - $arguments[] = str_replace('�', '%', strtolower($word)); + $arguments[] = str_replace('�', '%', drupal_strtolower($word)); } else { $words[] = "i.word = '%s'"; - $arguments[] = strtolower($word); + $arguments[] = drupal_strtolower($word); } } // Tell the user which words were excluded Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.216 diff -u -F^f -r1.216 system.module --- modules/system.module 27 Jun 2005 18:33:33 -0000 1.216 +++ modules/system.module 14 Jul 2005 22:22:29 -0000 @@ -234,11 +234,11 @@ function system_view_general() { $group = ''; $toolkits_available = image_get_available_toolkits(); if (count($toolkits_available) > 1) { - $group .= form_radios(t('Select an image processing toolkit'), 'image_toolkit', variable_get('image_toolkit', image_get_toolkit()), $toolkits_available); + $group .= form_radios(t('Select an image processing toolkit'), 'image_toolkit', variable_get('image_toolkit', image_get_toolkit()), $toolkits_available); } $group .= image_toolkit_invoke('settings'); if ($group) { - $output .= form_group_collapsible(t('Image handling'), '

'.$group.'

', TRUE); + $output .= form_group_collapsible(t('Image handling'), '

'. $group .'

', TRUE); } // Date settings: @@ -276,6 +276,9 @@ function system_view_general() { $output .= form_group_collapsible(t('Date settings'), $group, TRUE); + // String handling: report status and errors. + $output .= form_group_collapsible(t('String handling'), unicode_settings(), TRUE); + return $output; } @@ -680,7 +683,7 @@ function system_theme_settings($key = '' $rows = array(); // Use $utype field , and strtolower() it to get the type field.. to avoid issues with ucfirst() and unicode. - $type = strtolower($utype); + $type = drupal_strtolower($utype); $value = $settings[$type . '_links']; if (!is_array($value)) { $value = array(); Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.488 diff -u -F^f -r1.488 user.module --- modules/user.module 3 Jul 2005 16:41:42 -0000 1.488 +++ modules/user.module 14 Jul 2005 22:23:00 -0000 @@ -57,8 +57,8 @@ function user_load($array = array()) { $params[] = $value; } else { - $query .= "LOWER(u.$key) = '%s' AND "; - $params[] = strtolower($value); + $query .= "LOWER(u.$key) = LOWER('%s') AND "; + $params[] = $value; } } $result = db_query_range("SELECT u.* FROM {users} u WHERE $query u.status < 3", $params, 0, 1);