Index: admin_templates/browser/browser_header.tpl =================================================================== --- admin_templates/browser/browser_header.tpl (revision 15437) +++ admin_templates/browser/browser_header.tpl (working copy) @@ -4,7 +4,7 @@ <inp2:m_GetConfig var="Site_Name"/> - <inp2:m_Phrase label="la_AdministrativeConsole"/> - + Index: admin_templates/catalog_tab.tpl =================================================================== --- admin_templates/catalog_tab.tpl (revision 15437) +++ admin_templates/catalog_tab.tpl (working copy) @@ -21,8 +21,7 @@ $Catalog.setItemCount('', ''); - - + Index: admin_templates/categories/permissions_tab.tpl =================================================================== --- admin_templates/categories/permissions_tab.tpl (revision 15437) +++ admin_templates/categories/permissions_tab.tpl (working copy) @@ -3,8 +3,7 @@
_div" prefix="" group_id="-1" class="catalog-tab">
- - + if ($request_visible) { document.getElementById('_div').setAttribute('group_id', ); maximizeElement( jq('#_div') ); Index: admin_templates/incs/close_popup.tpl =================================================================== --- admin_templates/incs/close_popup.tpl (revision 15437) +++ admin_templates/incs/close_popup.tpl (working copy) @@ -1,7 +1,5 @@ - - Index: admin_templates/incs/header.tpl =================================================================== --- admin_templates/incs/header.tpl (revision 15437) +++ admin_templates/incs/header.tpl (working copy) @@ -6,7 +6,7 @@ <inp2:m_GetConfig var="Site_Name"/> - <inp2:m_Phrase label="la_AdministrativeConsole"/> - + Index: admin_templates/index.tpl =================================================================== --- admin_templates/index.tpl (revision 15437) +++ admin_templates/index.tpl (working copy) @@ -6,7 +6,7 @@ - + <inp2:m_GetConfig var="Site_Name"/> - <inp2:m_Phrase label="la_AdministrativeConsole"/> Index: admin_templates/regional/languages_edit.tpl =================================================================== --- admin_templates/regional/languages_edit.tpl (revision 15437) +++ admin_templates/regional/languages_edit.tpl (working copy) @@ -61,7 +61,6 @@ - Index: admin_templates/reviews/reviews_tab.tpl =================================================================== --- admin_templates/reviews/reviews_tab.tpl (revision 15437) +++ admin_templates/reviews/reviews_tab.tpl (working copy) @@ -1,8 +1,7 @@ - - + Index: install/english.lang =================================================================== --- install/english.lang (revision 15437) +++ install/english.lang (working copy) @@ -1,6 +1,6 @@ - + JGJvZHkNCjxici8+PGJyLz4NCg0KU2luY2VyZWx5LDxici8+PGJyLz4NCg0KV2Vic2l0ZSBhZG1pbmlzdHJhdGlvbi4NCg0KPCEtLSMjIDxpbnAyOmVtYWlsLWxvZ19JdGVtTGluayB0ZW1wbGF0ZT0icGxhdGZvcm0vbXlfYWNjb3VudC9lbWFpbCIvPiAjIy0tPg== Index: install/step_templates/sys_config.tpl =================================================================== --- install/step_templates/sys_config.tpl (revision 15437) +++ install/step_templates/sys_config.tpl (working copy) @@ -10,6 +10,7 @@ 'CacheHandler' => Array ('type' => 'select', 'title' => 'Output Caching Engine', 'section' => 'Misc', 'default' => 'Fake'), 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'), 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc', 'default' => ''), + 'WebsiteCharset' => Array ('type' => 'text', 'title' => 'Website Charset', 'section' => 'Misc', 'required' => 1, 'default' => 'utf-8'), ); $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers(); Index: install/steps_db.xml =================================================================== --- install/steps_db.xml (revision 15437) +++ install/steps_db.xml (working copy) @@ -144,6 +144,10 @@ functionality for CSS / Javascript files. The default value is set to PHP-based if no Java is auto-detected on server-side. Available options are: None (empty), YUICompressor (Java) (yui) and PHP-based (php) .

+

Website Charset - character encoding that will be used across the website. By default this should be set to UTF-8, + but can set to other encoding also (see wikipedia.org options). + It's highly recommended to have Website Encoding match the Database Encoding (specified on DB step).

+
]]> Index: kernel/application.php =================================================================== --- kernel/application.php (revision 15437) +++ kernel/application.php (working copy) @@ -286,6 +286,11 @@ return false; } + if ( preg_match('/utf-8/i', CHARSET) ) { + setlocale(LC_ALL, 'en_US.UTF-8'); + mb_internal_encoding('UTF-8'); + } + $this->isAdmin = kUtil::constOn('ADMIN'); if ( !kUtil::constOn('SKIP_OUT_COMPRESSION') ) { @@ -396,14 +401,6 @@ $this->SetVar('visits_id', $visit_id); } - $language = $this->recallObject('lang.current', null, Array ('live_table' => true)); - /* @var $language LanguagesItem */ - - if ( preg_match('/utf-8/', $language->GetDBField('Charset')) ) { - setlocale(LC_ALL, 'en_US.UTF-8'); - mb_internal_encoding('UTF-8'); - } - if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { $this->Debugger->profileFinish('kernel4_startup'); } @@ -3041,12 +3038,9 @@ */ public function XMLHeader($xml_version = false) { - $lang = $this->recallObject('lang.current'); - /* @var $lang LanguagesItem */ - $this->setContentType('text/xml'); - return $xml_version ? 'GetDBField('Charset') . '"?>' : ''; + return $xml_version ? '' : ''; } /** @@ -3183,26 +3177,23 @@ */ public function setContentType($content_type = 'text/html', $include_charset = null) { - static $aleady_set = false; + static $already_set = false; - if ( $aleady_set ) { + if ( $already_set ) { return; } $header = 'Content-type: ' . $content_type; if ( !isset($include_charset) ) { - $include_charset = $content_type = 'text/html' || $content_type = 'text/xml'; + $include_charset = $content_type = 'text/html' || $content_type == 'text/plain' || $content_type = 'text/xml'; } if ( $include_charset ) { - $language = $this->recallObject('lang.current'); - /* @var $language LanguagesItem */ - - $header .= '; charset=' . $language->GetDBField('Charset'); + $header .= '; charset=' . CHARSET; } - $aleady_set = true; + $already_set = true; header($header); } } \ No newline at end of file Index: kernel/managers/rewrite_url_processor.php =================================================================== --- kernel/managers/rewrite_url_processor.php (revision 15437) +++ kernel/managers/rewrite_url_processor.php (working copy) @@ -388,7 +388,7 @@ $string = ''; } - $url_parts = $string ? explode('/', mb_strtolower($string, 'UTF-8')) : Array (); + $url_parts = $string ? explode('/', mb_strtolower($string)) : Array (); $this->_partsToParse = $url_parts; Index: kernel/startup.php =================================================================== --- kernel/startup.php (revision 15437) +++ kernel/startup.php (working copy) @@ -23,6 +23,9 @@ $vars = kUtil::getConfigVars(); + $charset = isset($vars['WebsiteCharset']) ? $vars['WebsiteCharset'] : 'utf-8'; + define('CHARSET', $charset); + $admin_directory = isset($vars['AdminDirectory']) ? $vars['AdminDirectory'] : '/admin'; define('ADMIN_DIRECTORY', $admin_directory); Index: kernel/utility/email_send.php =================================================================== --- kernel/utility/email_send.php (revision 15437) +++ kernel/utility/email_send.php (working copy) @@ -1726,14 +1726,7 @@ */ function SetCharset($charset, $is_system = false) { - if ( $is_system ) { - $language = $this->Application->recallObject('lang.current'); - /* @var $language LanguagesItem */ - - $charset = $language->GetDBField('Charset') ? $language->GetDBField('Charset') : 'ISO-8859-1'; - } - - $this->charset = $charset; + $this->charset = $is_system ? CHARSET : $charset; } /** Index: units/categories/categories_event_handler.php =================================================================== --- units/categories/categories_event_handler.php (revision 15437) +++ units/categories/categories_event_handler.php (working copy) @@ -3009,7 +3009,7 @@ // 1. Set virtual page as template, this will be replaced to physical template later in kApplication::Run. // 2. Don't set CachedTemplate field as template here, because we will loose original page associated with it's cms blocks! - $vars['t'] = mb_strtolower( preg_replace('/^Content\//i', '', $last_category_info['NamedParentPath']), 'UTF-8' ); + $vars['t'] = mb_strtolower( preg_replace('/^Content\//i', '', $last_category_info['NamedParentPath'])); $vars['m_cat_id'] = $last_category_info['CategoryId']; $vars['is_virtual'] = true; // for template from POST, strange code there! Index: units/fck/fck_eh.php =================================================================== --- units/fck/fck_eh.php (revision 15437) +++ units/fck/fck_eh.php (working copy) @@ -86,7 +86,7 @@ $templates[$this->Application->getBaseCategory()] .= '/Index'; // "Content" category will act as "Home Page" - $res = '' . "\n"; + $res = '' . "\n"; $res .= '' . "\n"; foreach ($pages as $id => $title) { @@ -169,7 +169,7 @@ $fck_helper = $this->Application->recallObject('FCKHelper'); /* @var $fck_helper fckFCKHelper */ - $ret = ''."\n" ; + $ret = ''."\n" ; $ret .= ""."\n"; $ret .= $fck_helper->PrintFolders(); $ret .= $fck_helper->PrintFiles(); Index: units/helpers/csv_helper.php =================================================================== --- units/helpers/csv_helper.php (revision 15437) +++ units/helpers/csv_helper.php (working copy) @@ -50,11 +50,7 @@ $export_data['enclosure'] = $this->enclosure_mapping[(int)$this->Application->ConfigValue('CSVExportEnclosure')]; $export_data['record_separator'] = $this->separator_mapping[(int)$this->Application->ConfigValue('CSVExportSeparator')]; $export_data['page'] = 1; - - $lang_object = $this->Application->recallObject('lang.current'); - /* @var $lang_object LanguagesItem */ - - $export_data['source_encoding'] = strtoupper($lang_object->GetDBField('Charset')); + $export_data['source_encoding'] = strtoupper(CHARSET); $export_data['encoding'] = $this->Application->ConfigValue('CSVExportEncoding') ? false : 'UTF-16LE'; $this->Application->StoreVar('export_rand', $get_rand); @@ -185,10 +181,7 @@ if(!file_exists($filename) || !is_file($filename)) return 'cant_open_file'; $import_data = Array(); - - $lang_object = $this->Application->recallObject('lang.current'); - /* @var $lang_object LanguagesItem */ - $import_data['source_encoding'] = strtoupper( $lang_object->GetDBField('Charset') ); + $import_data['source_encoding'] = strtoupper(CHARSET); $import_data['encoding'] = $this->Application->ConfigValue('CSVExportEncoding') ? false : 'UTF-16LE'; $import_data['errors'] = ''; Index: units/helpers/language_import_helper.php =================================================================== --- units/helpers/language_import_helper.php (revision 15437) +++ units/helpers/language_import_helper.php (working copy) @@ -739,8 +739,8 @@ { return Array ( 'PackName', 'LocalName', 'DateFormat', 'ShortDateFormat', 'TimeFormat', 'ShortTimeFormat', - 'InputDateFormat', 'InputTimeFormat', 'DecimalPoint', 'ThousandSep', 'Charset', 'UnitSystem', - 'Locale', 'UserDocsUrl' + 'InputDateFormat', 'InputTimeFormat', 'DecimalPoint', 'ThousandSep', 'UnitSystem', 'Locale', + 'UserDocsUrl' ); } @@ -785,7 +785,6 @@ 'PackName' => (string)$language_node['PackName'], 'LocalName' => (string)$language_node['PackName'], 'Encoding' => (string)$language_node['Encoding'], - 'Charset' => 'utf-8', 'SynchronizationModes' => Language::SYNCHRONIZE_DEFAULT, ); Index: units/helpers/mime_decode_helper.php =================================================================== --- units/helpers/mime_decode_helper.php (revision 15437) +++ units/helpers/mime_decode_helper.php (working copy) @@ -425,27 +425,25 @@ /** * Converts encoding to one, that site uses * - * @param string $from_engoding + * @param string $from_encoding * @param string $text * @return string * @author Alex */ - function convertEncoding($from_engoding, $text) + function convertEncoding($from_encoding, $text) { - if (!function_exists('mb_convert_encoding')) { + if ( !function_exists('mb_convert_encoding') ) { // if mbstring extension not installed return $text; } static $to_encoding = false; - if ($to_encoding === false) { - $language = $this->Application->recallObject('lang.current'); - /* @var $language LanguagesItem */ - $to_encoding = $language->GetDBField('Charset'); + if ( $to_encoding === false ) { + $to_encoding = CHARSET; } - return mb_convert_encoding($text, $to_encoding, $from_engoding); + return mb_convert_encoding($text, $to_encoding, $from_encoding); } Index: units/languages/languages_config.php =================================================================== --- units/languages/languages_config.php (revision 15437) +++ units/languages/languages_config.php (working copy) @@ -192,7 +192,6 @@ 'ShortTimeFormat' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => 'g:i A'), 'DecimalPoint' => Array ('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => '.'), 'ThousandSep' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), - 'Charset' => Array ('type' => 'string', 'not_null' => '1', 'required' => 1, 'default' => 'utf-8'), 'UnitSystem' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Metric', 2 => 'la_US_UK'), 'use_phrases' => 1, @@ -227,6 +226,7 @@ ), 'VirtualFields' => Array ( + 'Charset' => Array ('type' => 'string', 'default' => CHARSET), // for backwards compatibility 'CopyLabels' => Array ('type' => 'int', 'default' => 0), 'CopyFromLanguage' => Array ( 'type' => 'int', @@ -249,7 +249,6 @@ 'PackName' => Array ('filter_block' => 'grid_options_filter', 'width' => 150, ),// 'PrimaryLang' => Array ('title' => 'la_col_IsPrimaryLanguage', 'filter_block' => 'grid_options_filter', 'width' => 150, ), 'AdminInterfaceLang' => Array ('filter_block' => 'grid_options_filter', 'width' => 150, ), - 'Charset' => Array ('filter_block' => 'grid_like_filter', 'width' => 100, ), 'Priority' => Array ('filter_block' => 'grid_like_filter', 'width' => 60, ), 'Enabled' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ), 'SynchronizationModes' => Array ('filter_block' => 'grid_picker_filter', 'width' => 120, 'format' => ', ', 'hidden' => 1), Index: units/languages/languages_tag_processor.php =================================================================== --- units/languages/languages_tag_processor.php (revision 15437) +++ units/languages/languages_tag_processor.php (working copy) @@ -16,32 +16,21 @@ class LanguagesTagProcessor extends kDBTagProcessor { - /** - * Guesses what charset should be used: - * 1. use lang.current_Field field="Charset" by default - * 2. if using temp tables then use lang_Field field="Charset" + * Sets content-type of page * * @param Array $params * @return string + * @access protected */ - function GetCharset($params) + protected function SetContentType($params) { - $edit_direct = $this->Application->GetVar('phrases_label'); + $content_type = isset($params['content_type']) ? $params['content_type'] : 'text/html'; + $include_charset = isset($params['include_charset']) ? $params['include_charset'] : null; - $top_prefix = $this->Application->GetTopmostPrefix($this->Prefix); - if( substr($this->Application->GetVar($top_prefix.'_mode'), 0, 1) == 't' && !$edit_direct ) - { - $object = $this->getObject($params); - /* @var $object kDBItem */ + $this->Application->setContentType($content_type, $include_charset); - return $object->GetDBField('Charset'); - } - - $lang_current = $this->Application->recallObject('lang.current'); - /* @var $lang_current LanguagesItem */ - - return $lang_current->GetDBField('Charset'); + return ''; } /** Index: units/translator/translator_event_handler.php =================================================================== --- units/translator/translator_event_handler.php (revision 15437) +++ units/translator/translator_event_handler.php (working copy) @@ -110,7 +110,7 @@ $cur_lang->Load($current_lang); - $translator->SetDBField('Charset', $cur_lang->GetDBField('Charset')); + $translator->SetDBField('Charset', CHARSET); $event->redirect = false; }