[svn r20723] FS#306 - Replacing some occurrences of the function mb_convert_encoding() with api_convert_encoding() which is able to support more encodings if the iconv php-extension has been activated.

skala
Ivan Tcholakov 16 years ago
parent 7b6b0c7f4c
commit 615e32d491
  1. 2
      main/admin/access_url_edit_courses_to_url.php
  2. 2
      main/admin/access_url_edit_sessions_to_url.php
  3. 2
      main/admin/access_url_edit_users_to_url.php
  4. 4
      main/admin/calendar.lib.php
  5. 10
      main/admin/calendar_ical_export.php
  6. 2
      main/admin/course_user_list.php
  7. 8
      main/inc/lib/usermanager.lib.php
  8. 16
      main/newscorm/learnpath.class.php
  9. 2
      main/newscorm/lp_list_search.php
  10. 6
      main/search/search_suggestions.php
  11. 4
      main/social/profile.php
  12. 4
      main/webservices/courses_list.rest.php
  13. 2
      main/webservices/courses_list.soap.php
  14. 6
      main/webservices/user_info.soap.php
  15. 2
      plugin/search/client/searchit.php

@ -79,7 +79,7 @@ function search_courses($needle, $id)
if(!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_setting('platform_charset');
$needle = mb_convert_encoding($needle, $charset, 'utf-8');
$needle = api_convert_encoding($needle, $charset, 'utf-8');
// search courses where username or firstname or lastname begins likes $needle
$sql = 'SELECT code, title FROM '.$tbl_course.' u
WHERE (title LIKE "'.$needle.'%"

@ -78,7 +78,7 @@ function search_sessions($needle, $id)
if(!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_setting('platform_charset');
$needle = mb_convert_encoding($needle, $charset, 'utf-8');
$needle = api_convert_encoding($needle, $charset, 'utf-8');
// search sessiones where username or firstname or lastname begins likes $needle
$sql = 'SELECT id, name FROM '.$tbl_session.' u
WHERE (name LIKE "'.$needle.'%")

@ -78,7 +78,7 @@ function search_users($needle, $id)
if(!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_setting('platform_charset');
$needle = mb_convert_encoding($needle, $charset, 'utf-8');
$needle = api_convert_encoding($needle, $charset, 'utf-8');
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT u.user_id, username, lastname, firstname FROM '.$tbl_user.' u
WHERE (username LIKE "'.$needle.'%"

@ -3079,9 +3079,9 @@ function agenda_import_ical($course_info,$file)
//print_r($ve);
$ttitle = $ve->getProperty('summary');
//print_r($ttitle);
$title = mb_convert_encoding($ttitle,$charset,'UTF-8');
$title = api_convert_encoding($ttitle,$charset,'UTF-8');
$tdesc = $ve->getProperty('description');
$desc = mb_convert_encoding($tdesc,$charset,'UTF-8');
$desc = api_convert_encoding($tdesc,$charset,'UTF-8');
$ts = $ve->getProperty('dtstart');
$start_date = $ts['year'].'-'.$ts['month'].'-'.$ts['day'].' '.$ts['hour'].':'.$ts['min'].':'.$ts['sec'];
$ts = $ve->getProperty('dtend');

@ -87,7 +87,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
case 'personal':
//require_once (api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php');
$ai = get_personal_agenda_item($_GET['id']);
$vevent->setProperty( 'summary', mb_convert_encoding($ai['title'],'UTF-8',$charset));
$vevent->setProperty( 'summary', api_convert_encoding($ai['title'],'UTF-8',$charset));
if(empty($ai['date'])){header('location:'.$_SERVER['REFERER_URI']);}
list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['date']);
$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
@ -102,7 +102,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
}
$vevent->setProperty('dtend',array('year'=>$y2,'month'=>$m2,'day'=>$d2,'hour'=>$h2,'min'=>$M2,'sec'=>$s2));
//$vevent->setProperty( 'LOCATION', get_lang('Unknown') ); // property name - case independent
$vevent->setProperty( 'description', mb_convert_encoding($ai['text'],'UTF-8',$charset));
$vevent->setProperty( 'description', api_convert_encoding($ai['text'],'UTF-8',$charset));
//$vevent->setProperty( 'comment', 'This is a comment' );
$user = api_get_user_info($ai['user']);
$vevent->setProperty('organizer',$user['mail']);
@ -117,7 +117,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
//$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
require_once (api_get_path(SYS_CODE_PATH).'admin/calendar.lib.php');
$ai = get_agenda_item($_GET['id']);
$vevent->setProperty( 'summary', mb_convert_encoding($ai['title'],'UTF-8',$charset));
$vevent->setProperty( 'summary', api_convert_encoding($ai['title'],'UTF-8',$charset));
if(empty($ai['start_date'])){header('location:'.$_SERVER['REFERER_URI']);}
list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['start_date']);
$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
@ -131,7 +131,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
list($y2,$m2,$d2,$h2,$M2,$s2) = preg_split('/[\s:-]/',$ai['end_date']);
}
$vevent->setProperty('dtend',array('year'=>$y2,'month'=>$m2,'day'=>$d2,'hour'=>$h2,'min'=>$M2,'sec'=>$s2));
$vevent->setProperty( 'description', mb_convert_encoding($ai['content'],'UTF-8',$charset));
$vevent->setProperty( 'description', api_convert_encoding($ai['content'],'UTF-8',$charset));
//$vevent->setProperty( 'comment', 'This is a comment' );
$user = api_get_user_info($ai['user']);
$vevent->setProperty('organizer',$user['mail']);
@ -161,4 +161,4 @@ else
header('location:'.$_SERVER['REFERER_URI']);
die();
}
?>
?>

@ -22,7 +22,7 @@ if (count($list_course)==0) {
?>
<?php for($k=0;$k<count($list_course);$k++) { ?>
<tr>
<td><?php echo mb_convert_encoding($list_course[$k],'UTF-8',$charset);?></td>
<td><?php echo api_convert_encoding($list_course[$k],'UTF-8',$charset);?></td>
</tr>
<?php }?>
</table>

@ -1,4 +1,4 @@
<?php // $Id: usermanager.lib.php 20641 2009-05-14 16:13:21Z iflorespaz $
<?php // $Id: usermanager.lib.php 20723 2009-05-16 13:45:06Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
@ -1939,8 +1939,8 @@ class UserManager
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$title = mb_convert_encoding($title,$charset,'UTF-8');
$content = mb_convert_encoding($content,$charset,'UTF-8');
$title = api_convert_encoding($title,$charset,'UTF-8');
$content = api_convert_encoding($content,$charset,'UTF-8');
//message in inbox
$sql_message_outbox='SELECT user_id from '.$table_user.' WHERE email="'.$email_administrator.'" ';
//$num_row_query=Database::num_rows($sql_message_outbox);
@ -1959,4 +1959,4 @@ class UserManager
}
}
}
}

@ -5341,7 +5341,7 @@ class learnpath {
$s_selected_position=$arrLP[$i]['id'];
elseif($action == 'add')
$s_selected_position=0;
$arrHide[$arrLP[$i]['id']]['value']=mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding);
$arrHide[$arrLP[$i]['id']]['value']=api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding);
}
}
/*//comented the prerequisites, only visible in edit (exercise)
@ -5526,7 +5526,7 @@ class learnpath {
{
if(($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide))
{
$return .= "\t\t\t\t\t" . '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '</option>';
$return .= "\t\t\t\t\t" . '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '</option>';
}
else
{
@ -5536,7 +5536,7 @@ class learnpath {
else
{
if($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
$return .= "\t\t\t\t\t" . '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '</option>';
$return .= "\t\t\t\t\t" . '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '</option>';
}
}
@ -5569,7 +5569,7 @@ class learnpath {
else
$selected = '';
$return .= "\t\t\t\t\t" . '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">'.get_lang("After").' "' . mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '"</option>';
$return .= "\t\t\t\t\t" . '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">'.get_lang("After").' "' . api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '"</option>';
}
}
@ -5607,7 +5607,7 @@ class learnpath {
$s_selected_position=$arrLP[$i]['id'];
elseif($action == 'add')
$s_selected_position=0;
$arrHide[$arrLP[$i]['id']]['value']=mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding);
$arrHide[$arrLP[$i]['id']]['value']=api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding);
}
}
@ -5713,8 +5713,8 @@ class learnpath {
$item_description = '';
}
$item_title=mb_convert_encoding($item_title,$charset,$this->encoding);
$item_description=mb_convert_encoding($item_description,$charset,$this->encoding);
$item_title=api_convert_encoding($item_title,$charset,$this->encoding);
$item_description=api_convert_encoding($item_description,$charset,$this->encoding);
$return = '<div class="sectiontitle">';
@ -6086,7 +6086,7 @@ class learnpath {
else
$selected = '';
$return .= "\t\t\t\t\t" . '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">'.get_lang("After").' "' . mb_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '"</option>';
$return .= "\t\t\t\t\t" . '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">'.get_lang("After").' "' . api_convert_encoding($arrLP[$i]['title'],$charset,$this->encoding) . '"</option>';
}
}

@ -94,7 +94,7 @@ if (count($term_array)) {
}
}
list($count, $results) = dokeos_query_query(mb_convert_encoding($query,'UTF-8',$charset), 0, 1000, $fixed_queries);
list($count, $results) = dokeos_query_query(api_convert_encoding($query,'UTF-8',$charset), 0, 1000, $fixed_queries);
// prepare blocks to show
$blocks = array();

@ -19,7 +19,7 @@ function get_suggestions_from_search_engine($q) {
$data = array();
$i = 0;
while ($row = Database::fetch_array($sql_result)) {
echo mb_convert_encoding($row['value'],'UTF-8',$charset)."| value\n";
echo api_convert_encoding($row['value'],'UTF-8',$charset)."| value\n";
if ($i<20) {
$data[ $row['course_code'] ] [ $row['tool_id'] ] [ $row['ref_id'] ] = 1;
}
@ -81,8 +81,8 @@ function get_suggestions_from_search_engine($q) {
}
}
foreach ($output as $i=>$out) {
if (stristr($out,$q) === false) {continue;}
$s = mb_convert_encoding(substr($out,0,-3),'UTF-8',$charset) . "| value\n";
if (api_stristr($out,$q) === false) {continue;}
$s = api_convert_encoding(substr($out,0,-3),'UTF-8',$charset) . "| value\n";
if (!in_array($s,$more_sugg)) {
$more_sugg[] = $s;
}

@ -413,7 +413,7 @@ echo $s="<script>$(document).ready( function(){
});</script>";
//echo '<div id="actions">';
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.mb_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
//echo '</div>';
//Setting some course info
@ -823,4 +823,4 @@ echo '</div>';
echo '</div>'; //from the main
echo '<form id="id_reload" action="#"></form>';
Display :: display_footer();
?>
?>

@ -46,7 +46,7 @@ function courses_list($security_key,$visibilities='public') {
foreach ( $courses_list_tmp as $index => $course )
{
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[$course['code']] = array('title'=>mb_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>mb_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
$courses_list[$course['code']] = array('title'=>api_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>api_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
}
}
return $courses_list;
@ -73,4 +73,4 @@ else
echo '</course>';
}
}
echo '</courseslist>';
echo '</courseslist>';

@ -112,7 +112,7 @@ function DokeosWSCourseList($username, $signature, $visibilities='public') {
$courses_list_tmp = CourseManager::get_courses_list(null,null,null,null,$vis[$visibility]);
foreach ( $courses_list_tmp as $index => $course ) {
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[] = array('code'=>$course['code'],'title'=>mb_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>mb_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
$courses_list[] = array('code'=>$course['code'],'title'=>api_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>api_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
}
}
return $courses_list;

@ -102,7 +102,7 @@ function DokeosWSCourseListOfUser($username, $signature) {
foreach ( $courses_list_tmp as $index => $course )
{
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[] = array('code'=>$course['code'],'title'=>mb_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>mb_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
$courses_list[] = array('code'=>$course['code'],'title'=>api_convert_encoding($course_info['title'],'UTF-8',$charset),'url'=>api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/','teacher'=>api_convert_encoding($course_info['tutor_name'],'UTF-8',$charset),'language'=>$course_info['course_language']);
}
return $courses_list;
}
@ -196,8 +196,8 @@ function DokeosWSEventsList($username,$signature,$datestart=0,$dateend=0) {
foreach ( $events_list as $i => $event ) {
$events_list[] = array(
'date'=>$i,
'title' => mb_convert_encoding($event['title'],'UTF-8',$charset),
'coursetitle' => mb_convert_encoding($event['coursetitle'],'UTF-8',$charset)
'title' => api_convert_encoding($event['title'],'UTF-8',$charset),
'coursetitle' => api_convert_encoding($event['coursetitle'],'UTF-8',$charset)
);
}
return $events_list;

@ -81,7 +81,7 @@ $i = 1;
$to_print = '';
foreach($results->result as $res){
if(access_check($res->result_du)){
$to_print .= result_output($i,mb_convert_encoding(urldecode($res->result_dt),$charset,'utf-8'),$res->result_du,html_entity_decode(urldecode($res->result_de)),htmlentities(urldecode($res->result_dm)),$res->result_dr);
$to_print .= result_output($i,api_convert_encoding(urldecode($res->result_dt),$charset,'utf-8'),$res->result_du,api_html_entity_decode(urldecode($res->result_de)),api_htmlentities(urldecode($res->result_dm)),$res->result_dr);
$i++;
}
}

Loading…
Cancel
Save