Task #1765 - Removing/changing obsolete code for encoding management (3).

skala
Ivan Tcholakov 15 years ago
parent 8f036917b3
commit fd797078f3
  1. 17
      main/newscorm/scorm.class.php
  2. 8
      main/newscorm/scormOrganization.class.php

@ -292,11 +292,8 @@ class scorm extends learnpath {
$dsp = $row[0] + 1;
}
$myname = $oOrganization->get_name();
//$this->manifest_encoding = 'UTF-8';
global $charset;
if (!empty($charset) && !empty($this->manifest_encoding) && $this->manifest_encoding != $charset) {
$myname = api_convert_encoding($myname, $charset, $this->manifest_encoding);
}
$myname = api_utf8_decode($myname);
$sql = "INSERT INTO $new_lp (lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib,display_order, session_id)" .
"VALUES (2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."', 'scorm_api.php', $dsp, $session_id)";
if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting path: '. $sql, 0); }
@ -353,19 +350,11 @@ class scorm extends learnpath {
$value_add .= "'".$item['maxtimeallowed']."',";
}
$title = Database::escape_string($item['title']);
$title = api_utf8_decode($title);
$max_score = Database::escape_string($item['max_score']);
if ($max_score == 0 || is_null($max_score) || $max_score == '') {
$max_score = 100;
}
// DOM in PHP5 is always recovering data as UTF-8, somehow, no matter what
// 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 = api_convert_encoding($title, $this->manifest_encoding, 'UTF-8');
}
//if ($this->manifest_encoding != $charset) {
// $title = api_convert_encoding($title, $charset, $this->manifest_encoding);
//}
$identifier = Database::escape_string($item['identifier']);
$prereq = Database::escape_string($item['prerequisites']);
$sql_item = "INSERT INTO $new_lp_item " .

@ -24,7 +24,7 @@ class scormOrganization {
* @param mixed Depending on the type given, DB id for the lp_item or reference to the DOM element
*/
public function __construct($type = 'manifest', &$element, $scorm_charset = 'UTF-8') {
if (isset($element)) {
if (isset($element)) {
// Parsing using PHP5 DOMXML methods.
@ -34,8 +34,8 @@ class scormOrganization {
return false;
case 'manifest': // Do the same as the default.
default:
//if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
$children = $element->childNodes;
//if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
$children = $element->childNodes;
foreach ($children as $child) {
switch ($child->nodeType) {
case XML_ELEMENT_NODE:
@ -52,7 +52,7 @@ class scormOrganization {
case 'title':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
$this->title = html_entity_decode(html_entity_decode($child->firstChild->nodeValue, ENT_QUOTES, $scorm_charset)); // TODO: This conversion from html-entities looks strange.
$this->title = api_utf8_decode(api_html_entity_decode($child->firstChild->nodeValue, ENT_QUOTES, 'UTF-8'));
}
break;
}

Loading…
Cancel
Save