Issue #306 - Elimination of some direct calls of the function mb_convert_encoding(). The goal is we not to depend badly on the mbstring extension.

skala
Ivan Tcholakov 16 years ago
parent c3c4275f33
commit 933b1bebdd
  1. 2
      main/admin/add_by_ajax_sub_language.inc.php
  2. 2
      main/conference/get_translation.lib.php
  3. 2
      main/inc/lib/search/IndexableChunk.class.php
  4. 15
      main/inc/lib/xajax/xajax.inc.php
  5. 8
      main/inc/lib/xajax/xajaxResponse.inc.php
  6. 4
      main/install/update-db-scorm-1.6.x-1.8.0.inc.php
  7. 4
      main/newscorm/scorm.class.php

@ -20,7 +20,7 @@ $all_file_of_directory=SubLanguageManager::get_all_language_variable_in_file($do
SubLanguageManager::add_file_in_language_directory ($dokeos_path_folder);
//update variable language
$all_file_of_directory[$language_variable]="\"".mb_convert_encoding($new_language,$charset,'UTF-8')."\";";
$all_file_of_directory[$language_variable]="\"".api_convert_encoding($new_language,$charset,'UTF-8')."\";";
foreach ($all_file_of_directory as $key_value=>$value_info) {
SubLanguageManager::write_data_in_file ($dokeos_path_folder,$value_info,$key_value);

@ -55,7 +55,7 @@ function get_language_file_as_xml($language='english')
//todo: The following conversion should only happen for old language files (encoded in ISO-8859-1).
if($convert)
{
$string = mb_convert_encoding($items[2],'UTF-8','ISO-8859-1');
$string = api_convert_encoding($items[2],'UTF-8','ISO-8859-1');
}
else
{

@ -61,7 +61,7 @@ abstract class _IndexableChunk
public function addTerm($term, $flag) {
global $charset;
if (strlen($flag) == 1) {
$this->terms[] = array('name' => mb_convert_encoding(stripslashes($term),'UTF-8',$charset), 'flag' => $flag);
$this->terms[] = array('name' => api_convert_encoding(stripslashes($term),'UTF-8',$charset), 'flag' => $flag);
}
}

@ -1162,7 +1162,14 @@ class xajax
{
$sFuncToUse = NULL;
if (function_exists('iconv'))
// An adaptation for the Dokeos LMS, 22-AUG-2009.
if (function_exists('api_convert_encoding'))
{
$sFuncToUse = "api_convert_encoding";
}
//if (function_exists('iconv'))
elseif (function_exists('iconv'))
//
{
$sFuncToUse = "iconv";
}
@ -1191,6 +1198,12 @@ class xajax
{
$sValue = mb_convert_encoding($sValue, $this->sEncoding, "UTF-8");
}
// Added code, an adaptation for the Dokeos LMS, 22-AUG-2009.
else if ($sFuncToUse == "api_convert_encoding")
{
$sValue = api_convert_encoding($sValue, $this->sEncoding, "UTF-8");
}
//
else
{
$sValue = utf8_decode($sValue);

@ -529,7 +529,13 @@ class xajaxResponse
function _cmdXML($aAttributes, $sData)
{
if ($this->bOutputEntities) {
if (function_exists('mb_convert_encoding')) {
// An adaptation for the Dokeos LMS, 22-AUG-2009.
if (function_exists('api_convert_encoding')) {
$sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
}
//if (function_exists('mb_convert_encoding')) {
elseif (function_exists('mb_convert_encoding')) {
//
$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
}
else {

@ -1032,8 +1032,8 @@ foreach($scorms as $my_course_code => $paths_list )
//parse manifest file
$manifest = $oScorm->parse_manifest($scorm_lp_paths[$my_content_id]['ims']);
//the title is already escaped in the method
//$my_lp_title = mb_convert_encoding($oScorm->get_title(),'ISO-8859-1',$oScorm->manifest_encoding);
$my_lp_title = mb_convert_encoding($oScorm->get_title(),'ISO-8859-1','UTF-8');
//$my_lp_title = api_convert_encoding($oScorm->get_title(),'ISO-8859-1',$oScorm->manifest_encoding);
$my_lp_title = api_convert_encoding($oScorm->get_title(),'ISO-8859-1','UTF-8');
if(!empty($my_lp_title)){
$my_new_lp = $db_name.$new_lp;
$my_sql = "UPDATE $my_new_lp " .

@ -448,10 +448,10 @@ class scorm extends learnpath {
//the XML document encoding is. This means that we have to convert
//the data to the declared encoding when it is not UTF-8
if($this->manifest_encoding != 'UTF-8'){
$title = mb_convert_encoding($title,$this->manifest_encoding,'UTF-8');
$title = api_convert_encoding($title,$this->manifest_encoding,'UTF-8');
}
//if($this->manifest_encoding != $charset){
// $title = mb_convert_encoding($title,$charset,$this->manifest_encoding);
// $title = api_convert_encoding($title,$charset,$this->manifest_encoding);
//}
$identifier = Database::escape_string($item['identifier']);
$prereq = Database::escape_string($item['prerequisites']);

Loading…
Cancel
Save