Index: branches/RC/core/units/themes/themes_tag_processor.php =================================================================== diff -u -N -r9236 -r10098 --- branches/RC/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 9236) +++ branches/RC/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 10098) @@ -9,13 +9,13 @@ // no stylesheet is associated with current theme return ''; } - + $css_url = $this->Application->BaseURL('/kernel/stylesheets'); $css_path = rtrim( str_replace( $this->Application->BaseURL(), FULL_PATH.'/', $css_url), '/' ); $last_compiled = $object->GetDBField('LastCompiled'); - $style_name = strtolower( $object->GetDBField('StyleName') ); + $style_name = mb_strtolower( $object->GetDBField('StyleName') ); if( file_exists($css_path.'/'.$style_name.'-'.$last_compiled.'.css') ) { @@ -51,11 +51,11 @@ return ''; } - + function SelectedTheme($params) { $object =& $this->getObject($params); return $object->GetDBField('ThemeId') == $this->Application->GetVar('m_theme'); - } + } } ?> \ No newline at end of file Index: branches/RC/core/units/images/image_tag_processor.php =================================================================== diff -u -N -r9760 -r10098 --- branches/RC/core/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 9760) +++ branches/RC/core/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 10098) @@ -250,7 +250,7 @@ } // relative url - return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path; + return FULL_PATH.'/'.mb_substr(THEMES_PATH, 1).'/'.$path; } /** Index: branches/RC/core/kernel/event_handler.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/kernel/event_handler.php (.../event_handler.php) (revision 8929) +++ branches/RC/core/kernel/event_handler.php (.../event_handler.php) (revision 10098) @@ -221,7 +221,7 @@ $ret .= $processed_params[$prefix_special.'_Page'].'/'; } } - + if ($processed_params[$prefix_special.'_id']) { // this allows to fill 3 cache records with one query (see this method for details) @@ -247,7 +247,7 @@ } $event->setEventParam('url_params', $url_params); - $event->setEventParam('env_string', strtolower($ret) ); + $event->setEventParam('env_string', mb_strtolower($ret) ); } /** Index: branches/RC/core/kernel/utility/formatters/password_formatter.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 8929) +++ branches/RC/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 10098) @@ -89,7 +89,7 @@ } $min_length = $this->Application->ConfigValue('Min_Password'); - if (strlen($new_password) >= $min_length) { + if (mb_strlen($new_password) >= $min_length) { if ($new_password != $verify_password) { $object->SetError($password_field, 'passwords_do_not_match', 'lu_passwords_do_not_match'); $object->SetError($verify_field, 'passwords_do_not_match', 'lu_passwords_do_not_match'); Index: branches/RC/core/kernel/languages/phrases_cache.php =================================================================== diff -u -N -r9363 -r10098 --- branches/RC/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 9363) +++ branches/RC/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 10098) @@ -73,15 +73,15 @@ $this->Phrases = $this->Conn->GetCol($query,'Phrase'); /*foreach($phrases as $phrase => $tanslation) { - $this->AddCachedPhrase(strtoupper($phrase), $tanslation); + $this->AddCachedPhrase(mb_strtoupper($phrase), $tanslation); }*/ $this->Ids = $ids; $this->OriginalIds = $ids; } function AddCachedPhrase($label, $value) { - $label = strtoupper($label); + $label = mb_strtoupper($label); $this->Phrases[$label] = $value; } @@ -123,7 +123,7 @@ if( strlen($label) == 0 ) return ''; $original_label = $label; - $label = strtoupper($label); + $label = mb_strtoupper($label); if(isset($this->Phrases[$label])) { $translated_label = $this->Phrases[$label]; // debug mode is checked directly to improve performance @@ -195,8 +195,8 @@ */ function CmpParams($a, $b) { - $a_len = strlen($a); - $b_len = strlen($b); + $a_len = mb_strlen($a); + $b_len = mb_strlen($b); if ($a_len == $b_len) return 0; return $a_len > $b_len ? -1 : 1; } Index: branches/RC/kernel/units/files/file_tp.php =================================================================== diff -u -N -r9649 -r10098 --- branches/RC/kernel/units/files/file_tp.php (.../file_tp.php) (revision 9649) +++ branches/RC/kernel/units/files/file_tp.php (.../file_tp.php) (revision 10098) @@ -15,8 +15,8 @@ $object =& $this->getObject($params); /* @var $object kDBItem */ - $last_dot = strrpos($object->GetDBField('FilePath'), '.'); - $ext = ($last_dot !== false) ? substr($object->GetDBField('FilePath'), $last_dot + 1).'.gif' : ''; + $last_dot = mb_strrpos($object->GetDBField('FilePath'), '.'); + $ext = ($last_dot !== false) ? mb_substr($object->GetDBField('FilePath'), $last_dot + 1).'.gif' : ''; return $ext ? $ext : $params['default']; } Index: branches/RC/core/kernel/parser/template.php =================================================================== diff -u -N -r9286 -r10098 --- branches/RC/core/kernel/parser/template.php (.../template.php) (revision 9286) +++ branches/RC/core/kernel/parser/template.php (.../template.php) (revision 10098) @@ -115,7 +115,7 @@ // !preg_match for backward compatability with full-path plugins if ($this->Application->IsAdmin() && $first_dir == 'plugins' && !preg_match('/admin_templates/', $module_filename)) { if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $module_filename, $regs)) {; - $path = MODULES_PATH.'/'.strtolower($first_dir).'/'.$regs[1].'/admin_templates'; + $path = MODULES_PATH.'/'.mb_strtolower($first_dir).'/'.$regs[1].'/admin_templates'; $module_filename = $regs[2]; } else { @@ -127,7 +127,7 @@ if ($first_dir == 'in-portal') { $first_dir = 'kernel'; } - $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates'; + $path = MODULES_PATH.'/'.mb_strtolower($first_dir).'/admin_templates'; } else { $path = $this->BasePath; Index: branches/RC/kernel/units/stylesheets/stylesheets_item.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/kernel/units/stylesheets/stylesheets_item.php (.../stylesheets_item.php) (revision 8929) +++ branches/RC/kernel/units/stylesheets/stylesheets_item.php (.../stylesheets_item.php) (revision 10098) @@ -23,12 +23,12 @@ $compile_ts = adodb_mktime(); $css_path = FULL_PATH.'/kernel/stylesheets/'; - $css_file = $css_path.strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; + $css_file = $css_path.mb_strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; $fp = fopen($css_file,'w'); if($fp) { - $prev_css = $css_path.strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; + $prev_css = $css_path.mb_strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; if( file_exists($prev_css) ) unlink($prev_css); fwrite($fp, $ret); Index: branches/RC/core/kernel/utility/socket.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/kernel/utility/socket.php (.../socket.php) (revision 8929) +++ branches/RC/core/kernel/utility/socket.php (.../socket.php) (revision 10098) @@ -5,51 +5,51 @@ * */ class kSocket extends kBase { - + /** * Socket file pointer. * @var resource $fp */ var $fp = null; - + /** * Whether the socket is blocking. Defaults to true. * @var boolean $blocking */ var $blocking = true; - + /** * Whether the socket is persistent. Defaults to false. * @var boolean $persistent */ var $persistent = false; - + /** * The IP address to connect to. * @var string $addr */ var $addr = ''; - + /** * The port number to connect to. * @var integer $port */ var $port = 0; - + /** * Number of seconds to wait on socket connections before assuming * there's no more data. Defaults to no timeout. * @var integer $timeout */ var $timeout = false; - + /** * Number of bytes to read at a time in readLine() and * readAll(). Defaults to 2048. * @var integer $lineLength */ var $lineLength = 2048; - + /** * Connect to the specified port. If called when the socket is * already connected, it disconnects and connects again. @@ -71,7 +71,7 @@ @fclose($this->fp); $this->fp = null; } - + // convert hostname to ip address if (!$addr) { return $this->raiseError('host address cannot be empty'); @@ -80,36 +80,36 @@ } else { $this->addr = @gethostbyname($addr); } - + $this->port = $port % 65536; - + if ($persistent !== null) { $this->persistent = $persistent; } - + if ($timeout !== null) { $this->timeout = $timeout; } - + $openfunc = $this->persistent ? 'pfsockopen' : 'fsockopen'; $errno = 0; $errstr = ''; - + if ($this->timeout) { $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $this->timeout); } else { $fp = @$openfunc($this->addr, $this->port, $errno, $errstr); } - + if (!$fp) { return $this->raiseError($errstr, Array($errno)); } - + $this->fp = $fp; - + return $this->setBlocking($this->blocking); } - + /** * Disconnects from the peer, closes the socket. * @@ -121,12 +121,12 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + @fclose($this->fp); $this->fp = null; return true; } - + /** * Find out if the socket is in blocking mode. * @@ -137,7 +137,7 @@ { return $this->blocking; } - + /** * Sets whether the socket connection should be blocking or * not. A read call to a non-blocking socket will return immediately @@ -153,12 +153,12 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + $this->blocking = $mode; socket_set_blocking($this->fp, $this->blocking); return true; } - + /** * Sets the timeout value on socket descriptor, * expressed in the sum of seconds and microseconds @@ -173,10 +173,10 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + return socket_set_timeout($this->fp, $seconds, $microseconds); } - + /** * Returns information about an existing socket resource. * Currently returns four entries in the result array: @@ -196,10 +196,10 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + return socket_get_status($this->fp); } - + /** * Get a specified line of data * @@ -212,10 +212,10 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + return @fgets($this->fp, $size); } - + /** * Read a specified amount of data. This is guaranteed to return, * and has the added benefit of getting everything in one fread() @@ -232,10 +232,10 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + return @fread($this->fp, $size); } - + /** * Write a specified amount of data. * @@ -251,14 +251,14 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + if (is_null($blocksize) && !OS_WINDOWS) { return fwrite($this->fp, $data); } else { if (is_null($blocksize)) { $blocksize = 1024; } - + $pos = 0; $size = strlen($data); while ($pos < $size) { @@ -268,11 +268,11 @@ } $pos += $written; } - + return $pos; } } - + /** * Write a line of data to the socket, followed by a trailing "\r\n". * @@ -284,10 +284,10 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + return fwrite($this->fp, $data . "\r\n"); } - + /** * Tests for end-of-file on a socket descriptor. * @@ -298,7 +298,7 @@ { return (is_resource($this->fp) && feof($this->fp)); } - + /** * Read until either the end of the socket or a newline, whichever * comes first. Strips the trailing newline from the returned data. @@ -313,7 +313,7 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + $line = ''; $timeout = time() + $this->timeout; while (!feof($this->fp) && (!$this->timeout || time() < $timeout)) { @@ -324,7 +324,7 @@ } return $line; } - + /** * Read until the socket closes, or until there is no more data in * the inner PHP buffer. If the inner buffer is empty, in blocking @@ -343,19 +343,19 @@ if (!is_resource($this->fp)) { return $this->raiseError('not connected'); } - + $data = ''; while (!feof($this->fp)) { $data .= @fread($this->fp, $this->lineLength); } return $data; } - + function raiseError($text, $params = Array()) { trigger_error(vsprintf($text, $params), E_USER_WARNING); return false; } } - + ?> \ No newline at end of file Index: branches/RC/core/kernel/globals.php =================================================================== diff -u -N -r9639 -r10098 --- branches/RC/core/kernel/globals.php (.../globals.php) (revision 9639) +++ branches/RC/core/kernel/globals.php (.../globals.php) (revision 10098) @@ -141,7 +141,7 @@ //echo $line . " - "; if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { //echo 'section'; - $section = substr($line,1,(strlen($line)-2)); + $section = mb_substr($line,1,(mb_strlen($line)-2)); if ($parse_section) { $retval[$section] = array(); } @@ -268,17 +268,17 @@ $pass_structure.=${'c'.$strpart}; // shortcutting the loop a bit - $p=$p+strlen(${'c'.$strpart}); + $p=$p+mb_strlen(${'c'.$strpart}); } $previous=$strpart; } // generating the password from the structure defined in $pass_structure - for ($g=0;$gGetDBField('Name')).'-'.$compile_ts.'.css'; + $css_file = $css_path.'admin-'.mb_strtolower($object->GetDBField('Name')).'-'.$compile_ts.'.css'; $fp = fopen($css_file,'w'); if($fp) { - $prev_css = $css_path.'admin-'.strtolower($object->GetDBField('Name')).'-'.$object->GetDBField('LastCompiled').'.css'; + $prev_css = $css_path.'admin-'.mb_strtolower($object->GetDBField('Name')).'-'.$object->GetDBField('LastCompiled').'.css'; if( file_exists($prev_css) ) unlink($prev_css); fwrite($fp, $ret); Index: branches/RC/core/units/help/help_event_handler.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/help/help_event_handler.php (.../help_event_handler.php) (revision 8929) +++ branches/RC/core/units/help/help_event_handler.php (.../help_event_handler.php) (revision 10098) @@ -15,7 +15,7 @@ $module = $this->Application->GetVar('h_module'); $title_preset = $this->Application->GetVar('h_title_preset'); - $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) ); + $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( mb_strtolower($module) ); $module_path = $this->Conn->GetOne($sql); $help_file = FULL_PATH.'/'.$module_path.'module_help/'.$title_preset.'.txt'; Index: branches/RC/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r10031 -r10098 --- branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 10031) +++ branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 10098) @@ -41,10 +41,10 @@ $path = preg_replace('/\/(.*?)\/(.*)/', $module.'/\\2', THEMES_PATH); // remove leading slash + substitute module } else { - $path = substr(THEMES_PATH, 1); + $path = mb_substr(THEMES_PATH, 1); $module = isset($params['module']) ? $params['module'] : 'core'; - if (strtolower($module) == 'in-portal') { + if (mb_strtolower($module) == 'in-portal') { $module_folder = 'platform'; } else { @@ -648,7 +648,7 @@ $current_template = $this->Application->GetVar('t'); $skip_prefixes = isset($params['skip_prefixes']) ? explode(',', $params['skip_prefixes']) : Array(); foreach ($this->Application->ModuleInfo as $module_name => $module_data) { - $module_key = strtolower($module_name); + $module_key = mb_strtolower($module_name); if ($module_name == 'In-Portal') { $module_prefix = $this->Application->IsAdmin() ? 'in-portal/' : $module_data['TemplatePath']; Index: branches/RC/core/kernel/startup.php =================================================================== diff -u -N -r9398 -r10098 --- branches/RC/core/kernel/startup.php (.../startup.php) (revision 9398) +++ branches/RC/core/kernel/startup.php (.../startup.php) (revision 10098) @@ -13,6 +13,7 @@ } $globals_start = getmicrotime(); include_once(KERNEL_PATH.'/globals.php'); // non OOP functions used through kernel, e.g. print_pre + include_once(KERNEL_PATH.'/utility/multibyte.php'); // emulating multi-byte php extension $globals_end = getmicrotime(); define('INPORTAL_ENV', 1); Index: branches/RC/kernel/units/images/image_event_handler.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/kernel/units/images/image_event_handler.php (.../image_event_handler.php) (revision 8929) +++ branches/RC/kernel/units/images/image_event_handler.php (.../image_event_handler.php) (revision 10098) @@ -27,10 +27,10 @@ // ListImages aggregated tag uses this special return ''; } - + return parent::getMainSpecial($event); } - + function customProcessing(&$event, $type) { $object =& $event->GetObject(); @@ -149,7 +149,7 @@ { $parts = pathinfo($name); $ext = '.'.$parts['extension']; - $filename = substr($parts['basename'], 0, -strlen($ext)); + $filename = mb_substr($parts['basename'], 0, -mb_strlen($ext)); $new_name = $filename.$ext; while ( file_exists($path.'/'.$new_name) ) { Index: branches/RC/core/install.php =================================================================== diff -u -N -r9988 -r10098 --- branches/RC/core/install.php (.../install.php) (revision 9988) +++ branches/RC/core/install.php (.../install.php) (revision 10098) @@ -125,7 +125,7 @@ * @var string */ var $baseURL = ''; - + /** * Holds number of last executed query in the SQL * @@ -345,7 +345,7 @@ if ($password != $password_verify) { $this->errorMessage = 'Passwords does not match'; } - elseif (strlen($password) < 4) { + elseif (mb_strlen($password) < 4) { $this->errorMessage = 'Root Password must be at least 4 characters'; } @@ -629,7 +629,7 @@ function GetMaxModuleVersion($module_name) { - $upgrades_file = sprintf(UPGRADES_FILE, strtolower($module_name).'/', 'sql'); + $upgrades_file = sprintf(UPGRADES_FILE, mb_strtolower($module_name).'/', 'sql'); if (!file_exists($upgrades_file)) { // no upgrade file return '4.0.1'; @@ -679,7 +679,7 @@ // 2. user has all types of permissions in database - if (strlen($this->systemConfig['Database']['TablePrefix']) > 7) { + if (mb_strlen($this->systemConfig['Database']['TablePrefix']) > 7) { $this->errorMessage = 'Table prefix should not be longer than 7 characters'; return false; } @@ -1114,7 +1114,7 @@ //echo $line . " - "; if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { //echo 'section'; - $section = substr($line, 1, (strlen($line) - 2)); + $section = mb_substr($line, 1, (mb_strlen($line) - 2)); if ($parse_section) { $retval[$section] = array(); } Index: branches/RC/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r10027 -r10098 --- branches/RC/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 10027) +++ branches/RC/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 10098) @@ -101,7 +101,7 @@ $this->Application->Redirect('', null, '', 'import/step3.php'); } elseif ($is_params['is_type'] == 'csv') { - $module = strtolower($is_params['is_Module']); + $module = mb_strtolower($is_params['is_Module']); $template = $module.'/import'; $module_info = $this->Application->findModule('Name', $module); @@ -816,7 +816,7 @@ $last_compiled = $style['LastCompiled']; - $style_name = strtolower( $style['Name'] ); + $style_name = mb_strtolower( $style['Name'] ); if( file_exists($css_path.'/'.'admin-'.$style_name.'-'.$last_compiled.'.css') ) { Index: branches/RC/core/kernel/db/dbitem.php =================================================================== diff -u -N -r10005 -r10098 --- branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 10005) +++ branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 10098) @@ -653,10 +653,10 @@ return $res; } if ( isset($params['max_len'])) { - $res = $res && strlen($val) <= $params['max_len']; + $res = $res && mb_strlen($val) <= $params['max_len']; } if ( isset($params['min_len'])) { - $res = $res && strlen($val) >= $params['min_len']; + $res = $res && mb_strlen($val) >= $params['min_len']; } if (!$res) { $error_params = Array (getArrayValue($params, 'min_len'), getArrayValue($params, 'max_len')); Index: branches/RC/core/units/general/country_states.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/general/country_states.php (.../country_states.php) (revision 8929) +++ branches/RC/core/units/general/country_states.php (.../country_states.php) (revision 10098) @@ -1,14 +1,14 @@ CountriesWithStates); } - + /** * Prepares states dropdown based on country selected * @@ -40,7 +40,7 @@ $object->Fields[$state_field]['options'] = $states; $object->Fields[$state_field]['options'][''] = ''; } - + /** * Returns valid state code for state name and country code passed * @@ -51,28 +51,28 @@ function CheckState($state_name, $country_code) { if( !$this->CountryHasStates($country_code) ) return $state_name; - + $sql = 'SELECT sdStates.DestAbbr FROM '.TABLE_PREFIX.'StdDestinations AS sdStates LEFT JOIN '.TABLE_PREFIX.'Phrase AS p ON p.Phrase = sdStates.DestName LEFT JOIN '.TABLE_PREFIX.'StdDestinations AS sdCountries ON sdStates.DestParentId = sdCountries.DestId WHERE (sdStates.DestType = 2) AND (sdStates.DestParentId = sdCountries.DestId) AND - (p.LanguageId = %1$s) AND - (sdCountries.DestAbbr = %2$s) AND + (p.LanguageId = %1$s) AND + (sdCountries.DestAbbr = %2$s) AND ( (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.Translation) = %3$s) )'; - - $state_name = trim( strtolower($state_name) ); + + $state_name = trim( mb_strtolower($state_name) ); $sql = sprintf($sql, $this->Application->GetVar('m_lang'), $this->Conn->qstr($country_code), $this->Conn->qstr($state_name) ); - + return $this->Conn->GetOne($sql); } - + function CheckStateField(&$event, $state_field, $country_field) { - + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if($items_info) { Index: branches/RC/core/units/general/helpers/filenames_helper.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/general/helpers/filenames_helper.php (.../filenames_helper.php) (revision 8929) +++ branches/RC/core/units/general/helpers/filenames_helper.php (.../filenames_helper.php) (revision 10098) @@ -77,8 +77,8 @@ ) ) { - if (substr($append, -1) == 'z') $append .= 'a'; - $append = substr($append, 0, strlen($append) - 1) . chr( ord( substr($append, -1) ) + 1 ); + if (mb_substr($append, -1) == 'z') $append .= 'a'; + $append = mb_substr($append, 0, mb_strlen($append) - 1) . chr( ord( mb_substr($append, -1) ) + 1 ); } return $filename.$append; Index: branches/RC/core/kernel/utility/email_send.php =================================================================== diff -u -N -r9247 -r10098 --- branches/RC/core/kernel/utility/email_send.php (.../email_send.php) (revision 9247) +++ branches/RC/core/kernel/utility/email_send.php (.../email_send.php) (revision 10098) @@ -165,8 +165,8 @@ */ function GetFilenameExtension($filename) { - $last_dot = strrpos($filename, '.'); - return $last_dot !== false ? substr($filename, $last_dot + 1) : ''; + $last_dot = mb_strrpos($filename, '.'); + return $last_dot !== false ? mb_substr($filename, $last_dot + 1) : ''; } /** @@ -878,7 +878,7 @@ */ function guessContentType($filename, &$content_type, &$encoding) { - $file_extension = strtolower( $this->GetFilenameExtension($filename) ); + $file_extension = mb_strtolower( $this->GetFilenameExtension($filename) ); $mapping = '(xls:application/excel)(hqx:application/macbinhex40)(doc,dot,wrd:application/msword)(pdf:application/pdf) (pgp:application/pgp)(ps,eps,ai:application/postscript)(ppt:application/powerpoint)(rtf:application/rtf) @@ -1698,8 +1698,8 @@ */ function ExtractRecipientName($text, $email = '') { - $lastspace = strrpos($text, ' '); - $name = trim(substr($text, 0, $lastspace - strlen($text)), " \r\n\t\0\x0b\"'"); + $lastspace = mb_strrpos($text, ' '); + $name = trim(mb_substr($text, 0, $lastspace - mb_strlen($text)), " \r\n\t\0\x0b\"'"); if (empty($name)) { $name = $email; } Index: branches/RC/kernel/units/images/image_tag_processor.php =================================================================== diff -u -N -r9760 -r10098 --- branches/RC/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 9760) +++ branches/RC/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 10098) @@ -250,7 +250,7 @@ } // relative url - return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path; + return FULL_PATH.'/'.mb_substr(THEMES_PATH, 1).'/'.$path; } /** Index: branches/RC/core/units/stylesheets/stylesheets_item.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/stylesheets/stylesheets_item.php (.../stylesheets_item.php) (revision 8929) +++ branches/RC/core/units/stylesheets/stylesheets_item.php (.../stylesheets_item.php) (revision 10098) @@ -23,12 +23,12 @@ $compile_ts = adodb_mktime(); $css_path = FULL_PATH.'/kernel/stylesheets/'; - $css_file = $css_path.strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; + $css_file = $css_path.mb_strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; $fp = fopen($css_file,'w'); if($fp) { - $prev_css = $css_path.strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; + $prev_css = $css_path.mb_strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; if( file_exists($prev_css) ) unlink($prev_css); fwrite($fp, $ret); Index: branches/RC/core/units/general/helpers/csv_helper.php =================================================================== diff -u -N -r9639 -r10098 --- branches/RC/core/units/general/helpers/csv_helper.php (.../csv_helper.php) (revision 9639) +++ branches/RC/core/units/general/helpers/csv_helper.php (.../csv_helper.php) (revision 10098) @@ -125,7 +125,7 @@ { $parts = pathinfo($name); $ext = '.'.$parts['extension']; - $filename = substr($parts['basename'], 0, -strlen($ext)); + $filename = mb_substr($parts['basename'], 0, -mb_strlen($ext)); $new_name = $filename.$ext; while ( file_exists($path.'/'.$new_name) ) { @@ -144,7 +144,7 @@ $export_data = unserialize($this->Application->RecallVar('export_data')); return isset($export_data[$name]) ? $export_data[$name] : false; } - + function GetCSV() { safeDefine('DBG_SKIP_REPORTING', 1); Index: branches/RC/core/units/files/file_tp.php =================================================================== diff -u -N -r9649 -r10098 --- branches/RC/core/units/files/file_tp.php (.../file_tp.php) (revision 9649) +++ branches/RC/core/units/files/file_tp.php (.../file_tp.php) (revision 10098) @@ -15,8 +15,8 @@ $object =& $this->getObject($params); /* @var $object kDBItem */ - $last_dot = strrpos($object->GetDBField('FilePath'), '.'); - $ext = ($last_dot !== false) ? substr($object->GetDBField('FilePath'), $last_dot + 1).'.gif' : ''; + $last_dot = mb_strrpos($object->GetDBField('FilePath'), '.'); + $ext = ($last_dot !== false) ? mb_substr($object->GetDBField('FilePath'), $last_dot + 1).'.gif' : ''; return $ext ? $ext : $params['default']; } Index: branches/RC/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -N -r9652 -r10098 --- branches/RC/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 9652) +++ branches/RC/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 10098) @@ -266,7 +266,7 @@ { $parts = pathinfo($name); $ext = '.'.$parts['extension']; - $filename = substr($parts['basename'], 0, -strlen($ext)); + $filename = mb_substr($parts['basename'], 0, -mb_strlen($ext)); $new_name = $filename.$ext; while ( file_exists($path.'/'.$new_name) || in_array(rtrim($path, '/').'/'.$new_name, $forbidden_names) ) { Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r10080 -r10098 --- branches/RC/core/kernel/application.php (.../application.php) (revision 10080) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 10098) @@ -297,6 +297,7 @@ $language =& $this->recallObject( 'lang.current', null, Array('live_table' => true) ); if (preg_match('/utf-8/', $language->GetDBField('Charset'))) { setlocale(LC_ALL, 'en_US.UTF-8'); + mb_internal_encoding('UTF-8'); } $this->ValidateLogin(); @@ -2123,7 +2124,7 @@ $error_msg = ''.$msg.' ('.$code.')
SQL: '.$this->Debugger->formatSQL($sql); $long_id = $this->Debugger->mapLongError($error_msg); - trigger_error( substr($msg.' ('.$code.') ['.$sql.']',0,1000).' #'.$long_id, $errorLevel); + trigger_error( mb_substr($msg.' ('.$code.') ['.$sql.']',0,1000).' #'.$long_id, $errorLevel); return true; } else Index: branches/RC/core/units/languages/languages_event_handler.php =================================================================== diff -u -N -r9363 -r10098 --- branches/RC/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 9363) +++ branches/RC/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 10098) @@ -16,10 +16,10 @@ 'OnImportProgress' => Array('self' => 'advanced:import'), 'OnExportLanguage' => Array('self' => 'advanced:export'), 'OnExportProgress' => Array('self' => 'advanced:export'), - + 'OnItemBuild' => Array('self' => true), ); - + $this->permMapping = array_merge($this->permMapping, $permissions); } @@ -32,7 +32,7 @@ { $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ - + $this->Application->UnitConfigReader->ReReadConfigs(); foreach ($this->Application->UnitConfigReader->configData as $prefix => $config_data) { $ml_helper->createFields($prefix); Index: branches/RC/core/units/categories/categories_item.php =================================================================== diff -u -N -r9368 -r10098 --- branches/RC/core/units/categories/categories_item.php (.../categories_item.php) (revision 9368) +++ branches/RC/core/units/categories/categories_item.php (.../categories_item.php) (revision 10098) @@ -88,9 +88,9 @@ if(!$filename) return $filename; $item_id = !$this->GetID() ? 0 : $this->GetID(); - + if ($item_id) { - $parent_cat_id = $this->GetDBField("ParentId"); + $parent_cat_id = $this->GetDBField("ParentId"); $check_in_parent_cat_only = ' AND ParentId = '.$parent_cat_id; } @@ -122,8 +122,8 @@ while ( $this->Conn->GetOne( sprintf($sql_temp, $this->Conn->qstr($filename.$append)) ) > 0 || $this->Conn->GetOne( sprintf($sql_live, $this->Conn->qstr($filename.$append)) ) > 0 ) { - if (substr($append, -1) == 'z') $append .= 'a'; - $append = substr($append, 0, strlen($append) - 1) . chr( ord( substr($append, -1) ) + 1 ); + if (mb_substr($append, -1) == 'z') $append .= 'a'; + $append = mb_substr($append, 0, mb_strlen($append) - 1) . chr( ord( mb_substr($append, -1) ) + 1 ); } return $filename.$append; Index: branches/RC/core/kernel/nparser/compiler.php =================================================================== diff -u -N -r10027 -r10098 --- branches/RC/core/kernel/nparser/compiler.php (.../compiler.php) (revision 10027) +++ branches/RC/core/kernel/nparser/compiler.php (.../compiler.php) (revision 10098) @@ -80,7 +80,7 @@ else { $info = pathinfo($full_path); if (isset($info['extension']) && $info['extension'] == 'tpl') { - $this->Templates[] = array('module' => strtolower($options['Name']), 'path' => str_replace(FULL_PATH.'/'.$options['Path'].'admin_templates/', '', preg_replace('/\.tpl$/', '', $full_path))); + $this->Templates[] = array('module' => mb_strtolower($options['Name']), 'path' => str_replace(FULL_PATH.'/'.$options['Path'].'admin_templates/', '', preg_replace('/\.tpl$/', '', $full_path))); } } } Index: branches/RC/core/kernel/utility/filters.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/kernel/utility/filters.php (.../filters.php) (revision 8929) +++ branches/RC/core/kernel/utility/filters.php (.../filters.php) (revision 10098) @@ -68,7 +68,7 @@ { return isset($this->filters[$name]) ? $this->filters[$name] : false; } - + /** * Removes specified filter from filters list * Index: branches/RC/core/units/general/main_event_handler.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 8929) +++ branches/RC/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 10098) @@ -122,7 +122,7 @@ } // remove template from url if it is category index cached template - if ($template == $category_template || strtolower($template) == '__default__') { + if ($template == $category_template || mb_strtolower($template) == '__default__') { $template = ''; } @@ -132,7 +132,7 @@ unset($url_params['t']); $event->setEventParam('url_params', $url_params); - $event->setEventParam('env_string', strtolower($ret) ); + $event->setEventParam('env_string', mb_strtolower($ret) ); } } Index: branches/RC/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r10080 -r10098 --- branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10080) +++ branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10098) @@ -1406,7 +1406,7 @@ case 'text': $keywords[$field] = unhtmlentities( $keywords[$field] ); - if (strlen($keywords[$field]) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) { + if (mb_strlen($keywords[$field]) >= $this->Application->ConfigValue('Search_MinKeyword_Length')) { $highlight_keywords[] = $keywords[$field]; if (in_array($verbs[$field], Array('any', 'contains', 'notcontains'))) { $keywords[$field] = '%'.strtr($keywords[$field], Array('%' => '\\%', '_' => '\\_')).'%'; Index: branches/RC/core/kernel/utility/debugger.php =================================================================== diff -u -N -r9688 -r10098 --- branches/RC/core/kernel/utility/debugger.php (.../debugger.php) (revision 9688) +++ branches/RC/core/kernel/utility/debugger.php (.../debugger.php) (revision 10098) @@ -446,8 +446,8 @@ default: // number or string - if (strlen($array) > 200) { - $array = substr($array, 0, 50).' ...'; + if (mb_strlen($array) > 200) { + $array = mb_substr($array, 0, 50).' ...'; } return $array."\n"; break; @@ -477,8 +477,8 @@ case 'integer': case 'double': case 'string': - if (strlen($array[$key]) > 200) { - $array[$key] = substr($array[$key], 0, 50).' ...'; + if (mb_strlen($array[$key]) > 200) { + $array[$key] = mb_substr($array[$key], 0, 50).' ...'; } $output .= $tabsign.'['.$key.'] = '.$array[$key]."\n"; break; @@ -590,7 +590,7 @@ function isGecko() { // we need isset because we may run scripts from shell with no user_agent at all - return isset($_SERVER['HTTP_USER_AGENT']) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'firefox') !== false; + return isset($_SERVER['HTTP_USER_AGENT']) && mb_strpos(mb_strtolower($_SERVER['HTTP_USER_AGENT']), 'firefox') !== false; } /** @@ -718,7 +718,7 @@ $this->appendHTML('ScriptName: '.$this->getFileLink($script, 1, basename($script)).' ('.dirname($script).')'); if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 'yes') { - $this->appendHTML('RequestURI: '.$_SERVER['REQUEST_URI'].' (QS Length:'.strlen($_SERVER['QUERY_STRING']).')'); + $this->appendHTML('RequestURI: '.$_SERVER['REQUEST_URI'].' (QS Length:'.mb_strlen($_SERVER['QUERY_STRING']).')'); } $this->appendHTML('DomViewer:  '); @@ -1196,13 +1196,13 @@ unset($this->longErrors[$long_id]); } - if (strpos($errfile,'eval()\'d code') !== false) { + if (mb_strpos($errfile,'eval()\'d code') !== false) { $errstr = '[EVAL, line '.$errline.']: '.$errstr; $tmpStr = $errfile; - $pos = strpos($tmpStr,'('); - $errfile = substr($tmpStr, 0, $pos); + $pos = mb_strpos($tmpStr,'('); + $errfile = mb_substr($tmpStr, 0, $pos); $pos++; - $errline = substr($tmpStr,$pos,strpos($tmpStr,')',$pos)-$pos); + $errline = mb_substr($tmpStr,$pos,mb_strpos($tmpStr,')',$pos)-$pos); } $this->Data[] = Array('no' => $errno, 'str' => $errstr, 'file' => $errfile, 'line' => $errline, 'context' => $errcontext, 'debug_type' => 'error'); Index: branches/RC/core/units/images/image_event_handler.php =================================================================== diff -u -N -r8929 -r10098 --- branches/RC/core/units/images/image_event_handler.php (.../image_event_handler.php) (revision 8929) +++ branches/RC/core/units/images/image_event_handler.php (.../image_event_handler.php) (revision 10098) @@ -27,10 +27,10 @@ // ListImages aggregated tag uses this special return ''; } - + return parent::getMainSpecial($event); } - + function customProcessing(&$event, $type) { $object =& $event->GetObject(); @@ -149,7 +149,7 @@ { $parts = pathinfo($name); $ext = '.'.$parts['extension']; - $filename = substr($parts['basename'], 0, -strlen($ext)); + $filename = mb_substr($parts['basename'], 0, -mb_strlen($ext)); $new_name = $filename.$ext; while ( file_exists($path.'/'.$new_name) ) { Index: branches/RC/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r10070 -r10098 --- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 10070) +++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 10098) @@ -673,9 +673,9 @@ $first_chars = $this->SelectParam($params,'first_chars,cut_first'); if($first_chars) { - $needs_cut = strlen($value) > $first_chars; - $value = extension_loaded('mbstring') ? mb_substr($value,0,$first_chars) : substr($value,0,$first_chars); - if($needs_cut) $value .= ' ...'; + $needs_cut = mb_strlen($value) > $first_chars; + $value = mb_substr($value, 0, $first_chars); + if ($needs_cut) $value .= ' ...'; } if( getArrayValue($params,'nl2br' ) ) $value = nl2br($value); @@ -1431,9 +1431,9 @@ } $cut_first = getArrayValue($params, 'cut_first'); - if ($cut_first && strlen($title) > $cut_first) { + if ($cut_first && mb_strlen($title) > $cut_first) { if (!preg_match('/(.*)<\/a>/',$title)) { - $title = substr($title, 0, $cut_first).' ...'; + $title = mb_substr($title, 0, $cut_first).' ...'; } } @@ -1748,7 +1748,7 @@ if (!$force_module) $force_module = 'core'; } else { - $force_module = strtolower($force_module); + $force_module = mb_strtolower($force_module); } if ($force_module == 'core') { @@ -1897,7 +1897,7 @@ $value = $this->Field($params); $name = $this->InputName($params); - $theme_path = $this->Application->BaseURL().substr($this->Application->GetFrontThemePath(), 1); + $theme_path = $this->Application->BaseURL().mb_substr($this->Application->GetFrontThemePath(), 1); $bgcolor = isset($params['bgcolor']) ? $params['bgcolor'] : $this->Application->GetVar('bgcolor'); if (!$bgcolor) $bgcolor = '#ffffff'; Index: branches/RC/core/kernel/session/session.php =================================================================== diff -u -N -r10037 -r10098 --- branches/RC/core/kernel/session/session.php (.../session.php) (revision 10037) +++ branches/RC/core/kernel/session/session.php (.../session.php) (revision 10098) @@ -853,17 +853,17 @@ $wid = $this->Application->GetVar('m_wid'); $last_env = $this->getLastTemplateENV($t, Array('m_opener' => 'u')); - $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); + $last_template = basename($_SERVER['PHP_SELF']).'|'.mb_substr($last_env, mb_strlen(ENV_VAR_NAME) + 1); $this->StoreVar(rtrim('last_template_'.$wid, '_'), $last_template); $last_env = $this->getLastTemplateENV($t, null, false); - $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); + $last_template = basename($_SERVER['PHP_SELF']).'|'.mb_substr($last_env, mb_strlen(ENV_VAR_NAME) + 1); $this->StoreVar(rtrim('last_template_popup_'.$wid, '_'), $last_template); // save other last... variables for mistical purposes (customizations may be) $this->StoreVar('last_url', $_SERVER['REQUEST_URI']); // needed by ord:StoreContinueShoppingLink - $this->StoreVar('last_env', substr($last_env, strlen(ENV_VAR_NAME)+1)); + $this->StoreVar('last_env', mb_substr($last_env, mb_strlen(ENV_VAR_NAME)+1)); // save last_template in persistant session if (!$wid) { Index: branches/RC/core/kernel/utility/multibyte.php =================================================================== diff -u -N --- branches/RC/core/kernel/utility/multibyte.php (revision 0) +++ branches/RC/core/kernel/utility/multibyte.php (revision 10098) @@ -0,0 +1,54 @@ + \ No newline at end of file Index: branches/RC/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r9776 -r10098 --- branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 9776) +++ branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 10098) @@ -790,7 +790,7 @@ { $module_path = '/'.$module_info['Path']; if (preg_match('/^'.preg_quote($module_path, '/').'/', $config_path)) { - // if (substr($config_path, 0, strlen($module_path)) == $module_path) { + // if (mb_substr($config_path, 0, mb_strlen($module_path)) == $module_path) { // config file path starts with module folder path $module_found = true; break;