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

skala
Ivan Tcholakov 14 years ago
parent e9a1213bd6
commit 8f036917b3
  1. 32
      main/newscorm/learnpath.class.php
  2. 6
      main/newscorm/lp_controller.php

@ -3683,11 +3683,14 @@ class learnpath {
/**
* Sets the encoding
* @param string New encoding
* TODO (as of Chamilo 1.8.8): Check in the future whether this method is needed.
*/
public function set_encoding($enc = 'ISO-8859-15') {
public function set_encoding($enc = 'UTF-8') {
if ($this->debug > 0) {
error_log('New LP - In learnpath::set_encoding()', 0);
}
/* // Deprecated code (Chamilo 1.8.8).
$enc = strtoupper($enc);
$encodings = array (
'UTF-8',
@ -3712,6 +3715,22 @@ class learnpath {
}
}
return false;
*/
$enc = api_refine_encoding_id($enc);
if (empty($enc)) {
$enc = api_get_system_encoding();
}
if (api_is_encoding_supported($enc)) {
$lp = $this->get_id();
if ($lp != 0) {
$tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
$sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE id = " . $lp;
$res = Database::query($sql);
return $res;
}
}
return false;
}
/**
@ -4327,7 +4346,6 @@ class learnpath {
public function overview() {
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
$platform_charset = api_get_system_encoding();
if ($this->debug > 0) {
error_log('New LP - In learnpath::overview()', 0);
}
@ -4343,8 +4361,8 @@ class learnpath {
$result = Database::query($sql);
$arrLP = array ();
while ($row = Database :: fetch_array($result)) {
$row['title'] = Security :: remove_XSS(api_convert_encoding($row['title'], $platform_charset, $this->encoding));
$row['description'] = Security :: remove_XSS(api_convert_encoding($row['description'], $platform_charset, $this->encoding));
$row['title'] = Security :: remove_XSS($row['title']);
$row['description'] = Security :: remove_XSS($row['description']);
$arrLP[] = array (
'id' => $row['id'],
'item_type' => $row['item_type'],
@ -4537,7 +4555,7 @@ class learnpath {
* @uses dtree.js :: necessary javascript for building this tree
*/
public function build_tree() {
$platform_charset = api_get_system_encoding();
$return = "<script type=\"text/javascript\">\n";
$return .= "\tm = new dTree('m');\n\n";
$return .= "\tm.config.folderLinks = true;\n";
@ -4559,8 +4577,8 @@ class learnpath {
$arrLP = array ();
while ($row = Database :: fetch_array($result)) {
$row['title'] = Security :: remove_XSS(api_convert_encoding($row['title'], $platform_charset, $this->encoding));
$row['description'] = Security :: remove_XSS(api_convert_encoding($row['description'], $platform_charset, $this->encoding));
$row['title'] = Security :: remove_XSS($row['title']);
$row['description'] = Security :: remove_XSS($row['description']);
$arrLP[] = array (
'id' => $row['id'],

@ -562,15 +562,15 @@ switch ($action) {
$auth_end = $auth_init + stripos(substr($author, $auth_init + 6), '</body>') + 7;
$len = $auth_end - $auth_init + 6;
} else {
$auth_end = strripos($author, '</p>');
$auth_end = strripos($author, '</p>');
$len = $auth_end - $auth_init + 4;
}
$author_fixed=substr($author,$auth_init, $len);
$author_fixed = substr($author, $auth_init, $len);
//$author_fixed = $author;
$_SESSION['oLP']->set_author($author_fixed);
$_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']);
$_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']); // TODO (as of Chamilo 1.8.8): Check in the future whether this field is needed.
$_SESSION['oLP']->set_maker($_REQUEST['lp_maker']);
$_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']);
$_SESSION['oLP']->set_theme($_REQUEST['lp_theme']);

Loading…
Cancel
Save