[geeklog-cvs] Geeklog-1.x/system lib-mbyte.php,1.19,1.20
Dirk Haun
dhaun at qs1489.pair.com
Sat Feb 16 11:45:05 EST 2008
Update of /cvsroot/geeklog/Geeklog-1.x/system
In directory qs1489.pair.com:/tmp/cvs-serv10288/system
Modified Files:
lib-mbyte.php
Log Message:
Only use the multi-byte string functions with UTF-8 (problem reported by Rick78)
Index: lib-mbyte.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-mbyte.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** lib-mbyte.php 15 Jan 2007 07:13:43 -0000 1.19
--- lib-mbyte.php 16 Feb 2008 16:45:03 -0000 1.20
***************
*** 3,7 ****
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
! // | Geeklog 1.4 |
// +---------------------------------------------------------------------------+
// | lib-mbyte.php |
--- 3,7 ----
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
! // | Geeklog 1.5 |
// +---------------------------------------------------------------------------+
// | lib-mbyte.php |
***************
*** 9,13 ****
// | function collection to handle mutli-byte related issues |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2006 by the following authors: |
// | |
// | Authors: Oliver Spiesshofer - oliver AT spiesshofer DOT com |
--- 9,13 ----
// | function collection to handle mutli-byte related issues |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2008 by the following authors: |
// | |
// | Authors: Oliver Spiesshofer - oliver AT spiesshofer DOT com |
***************
*** 32,37 ****
// $Id$
! if (strpos ($_SERVER['PHP_SELF'], 'lib-mbyte.php') !== false) {
! die ('This file can not be used on its own!');
}
--- 32,37 ----
// $Id$
! if (strpos($_SERVER['PHP_SELF'], 'lib-mbyte.php') !== false) {
! die('This file can not be used on its own!');
}
***************
*** 85,101 ****
// replacement functions for UTF-8 functions
! function MBYTE_checkEnabled() {
static $mb_enabled;
! if (function_exists( 'mb_eregi_replace' )) {
! $mb_enabled = mb_internal_encoding("UTF-8");
! } else {
$mb_enabled = false;
}
return $mb_enabled;
}
! function MBYTE_strlen($str) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 85,111 ----
// replacement functions for UTF-8 functions
! function MBYTE_checkEnabled()
! {
! global $LANG_CHARSET;
!
static $mb_enabled;
!
! if (!isset($mb_enabled)) {
$mb_enabled = false;
+ if (strcasecmp($LANG_CHARSET, 'utf-8') == 0) {
+ if (function_exists('mb_eregi_replace')) {
+ $mb_enabled = mb_internal_encoding('UTF-8');
+ }
+ }
}
+
return $mb_enabled;
}
! function MBYTE_strlen($str)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 106,114 ****
$result = strlen($str);
}
return $result;
}
! function MBYTE_substr($str, $start, $length = NULL) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 116,127 ----
$result = strlen($str);
}
+
return $result;
}
! function MBYTE_substr($str, $start, $length = NULL)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 129,137 ****
}
}
return $result;
}
! function MBYTE_strpos($hay, $needle, $offset = NULL) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 142,153 ----
}
}
+
return $result;
}
! function MBYTE_strpos($hay, $needle, $offset = NULL)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 142,150 ****
$result = strpos($hay, $needle, $offset);
}
return $result;
}
! function MBYTE_strtolower($str) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 158,169 ----
$result = strpos($hay, $needle, $offset);
}
+
return $result;
}
! function MBYTE_strtolower($str)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 155,163 ****
$result = strtolower($str);
}
return $result;
}
! function MBYTE_eregi($pattern, $str, $regs = NULL) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 174,185 ----
$result = strtolower($str);
}
+
return $result;
}
! function MBYTE_eregi($pattern, $str, $regs = NULL)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 168,176 ****
$result = eregi($pattern, $str, $regs);
}
return $result;
}
! function MBYTE_eregi_replace($pattern, $replace, $str) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 190,201 ----
$result = eregi($pattern, $str, $regs);
}
+
return $result;
}
! function MBYTE_eregi_replace($pattern, $replace, $str)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 181,190 ****
$result = eregi_replace($pattern, $replace, $str);
}
return $result;
}
/** those are currently not needed in GL, left here if needed later
! function MBYTE_substr_count($hay, $needle) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 206,219 ----
$result = eregi_replace($pattern, $replace, $str);
}
+
return $result;
}
/** those are currently not needed in GL, left here if needed later
!
! function MBYTE_substr_count($hay, $needle)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 195,203 ****
$result = substr_count($hay, $needle);
}
return $result;
}
! function MBYTE_strtoupper($str) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 224,235 ----
$result = substr_count($hay, $needle);
}
+
return $result;
}
! function MBYTE_strtoupper($str)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 208,216 ****
$result = strtoupper($str);
}
return $result;
}
! function MBYTE_strrpos($hay, $needle, $offset='') {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 240,251 ----
$result = strtoupper($str);
}
+
return $result;
}
! function MBYTE_strrpos($hay, $needle, $offset='')
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 221,229 ****
$result = strrpos($hay, $needle, $offset);
}
return $result;
}
! function MBYTE_mail($to, $subj, $mess, $header = NULL, $param = NULL) {
static $mb_enabled;
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
--- 256,267 ----
$result = strrpos($hay, $needle, $offset);
}
+
return $result;
}
! function MBYTE_mail($to, $subj, $mess, $header = NULL, $param = NULL)
! {
static $mb_enabled;
+
if (!isset($mb_enabled)) {
$mb_enabled = MBYTE_checkEnabled();
***************
*** 266,271 ****
mb_substr_count -- Count the number of substring occurrences
*/
-
-
?>
--- 304,307 ----
More information about the geeklog-cvs
mailing list