Bug #1734 - Fixing an encoding problem in "news" (Chinese characters don't show), see http://www.chamilo.org/en/node/664

skala
Ivan Tcholakov 16 years ago
parent d2f8afc0b7
commit b4293e6bc0
  1. 37
      main/admin/configure_homepage.php

@ -296,14 +296,20 @@ if (!empty($action)) {
// Get the contents of home_menu_en.html (or active menu language
// version) into $home_menu as an array of one entry per line
$home_menu = file($homep.$menuf.'_'.$lang.$ext);
$home_menu = implode("\n", $home_menu);
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu = explode("\n", $home_menu);
$home_menu = array_values(array_filter(array_map('trim', $home_menu), 'strlen'));
// Prepare place to insert the new link into (default is end of file)
if ($insert_where < -1 || $insert_where > (sizeof($home_menu) - 1)) {
$insert_where = sizeof($home_menu) - 1;
}
//
// For each line of the file, remove trailing spaces and special chars
foreach ($home_menu as $key => $enreg) {
$home_menu[$key] = trim($enreg);
}
//foreach ($home_menu as $key => $enreg) {
// $home_menu[$key] = trim($enreg);
//}
//
// If the given link url is empty, then replace the link url by a link to the link file created
if (empty($link_url)) {
$link_url = api_get_path(WEB_PATH).'index.php?include='.urlencode($filename);
@ -474,6 +480,7 @@ if (!empty($action)) {
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu = explode("\n", $home_menu);
}
$home_menu = array_values(array_filter(array_map('trim', $home_menu), 'strlen'));
break;
case 'insert_tabs':
// This request is the preparation for the addition of an item in home_menu
@ -493,6 +500,7 @@ if (!empty($action)) {
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu = explode("\n", $home_menu);
}
$home_menu = array_values(array_filter(array_map('trim', $home_menu), 'strlen'));
break;
case 'edit_tabs':
case 'edit_link':
@ -521,15 +529,18 @@ if (!empty($action)) {
$link_name = '';
$link_url = '';
$home_menu_new = array();
//$home_menu_new = array();
//
//Cleaning array
foreach ($home_menu as $item) {
if(!empty($item)) {
$home_menu_new[] = $item;
}
}
$home_menu = $home_menu_new;
//foreach ($home_menu as $item) {
// if(!empty($item)) {
// $home_menu_new[] = $item;
// }
//}
//$home_menu = $home_menu_new;
// Cleaning the array
$home_menu = array_values(array_filter(array_map('trim', $home_menu), 'strlen'));
// For each line of the home_menu file
foreach ($home_menu as $key => $enreg) {
@ -659,7 +670,9 @@ switch ($action) {
$form->addElement('html', '<td><select name="insert_where"><option value="-1">'.get_lang('FirstPlace').'</option>');
if (is_array($home_menu)){
foreach ($home_menu as $key => $enreg) {
$form->addElement('html', '<option value="'.$key.'" '.($formSent && $insert_where == $key ? 'selected="selected"' : '').' >'.get_lang('After').' &quot;'.trim(strip_tags($enreg)).'&quot;</option>');
if (strlen($enreg = trim(strip_tags($enreg))) > 0) {
$form->addElement('html', '<option value="'.$key.'" '.($formSent && $insert_where == $key ? 'selected="selected"' : '').' >'.get_lang('After').' &quot;'.$enreg.'&quot;</option>');
}
}
}
$form->addElement('html', '</select></td></tr>');

Loading…
Cancel
Save