本文整理汇总了PHP中api_convert_encoding函数的典型用法代码示例。如果您正苦于以下问题:PHP api_convert_encoding函数的具体用法?PHP api_convert_encoding怎么用?PHP api_convert_encoding使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_convert_encoding函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_users
/**
* Search users by username, firstname or lastname, based on the given
* search string
* @param string Search string
* @param int Deprecated param
* @return string Xajax response block
* @assert () === false
*/
public static function search_users($needle, $id)
{
global $tbl_user, $tbl_access_url_rel_user;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search users where username or firstname or lastname begins likes $needle
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$sql = 'SELECT u.user_id, username, lastname, firstname FROM ' . $tbl_user . ' u ' . ' WHERE (username LIKE "' . $needle . '%" ' . ' OR firstname LIKE "' . $needle . '%" ' . ' OR lastname LIKE "' . $needle . '%") ' . $order_clause . ' LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($user = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($user['user_id']) . '\',\'' . api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])) . ' (' . addslashes($user['username']) . ')' . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
} else {
$return .= '...<br />';
}
}
}
$xajax_response->addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例2: addTerm
/**
* Add a term (like xapian definition)
* @param string Term
* @param string Flag (one character)
*/
public function addTerm($term, $flag)
{
global $charset;
if (strlen($flag) == 1) {
$this->terms[] = array('name' => api_convert_encoding(stripslashes($term), 'UTF-8', $charset), 'flag' => $flag);
}
}
示例3: search_sessions
/**
* Search sessions by name, based on a search string
* @param string Search string
* @param int Deprecated param
* @return string Xajax response block
* @assert () === false
*/
function search_sessions($needle, $id)
{
global $tbl_session;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search sessiones where username or firstname or lastname begins likes $needle
$sql = 'SELECT id, name FROM ' . $tbl_session . ' u
WHERE (name LIKE "' . $needle . '%")
ORDER BY name, id
LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($session = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="#" onclick="add_user_to_url(\'' . addslashes($session['id']) . '\',\'' . addslashes($session['name']) . ' (' . addslashes($session['id']) . ')' . '\')">' . $session['name'] . ' </a><br />';
} else {
$return .= '...<br />';
}
}
}
$xajax_response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例4: search_sessions
function search_sessions($needle, $type)
{
global $_configuration, $tbl_session_rel_access_url, $tbl_session, $user_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
$without_assigned_sessions = '';
if (count($assigned_sessions_id) > 0) {
$without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
}
if ($_configuration['multiple_access_urls']) {
$sql = " SELECT s.id, s.name FROM {$tbl_session} s LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n\t\t\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT s.id, s.name FROM {$tbl_session} s\n\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} ";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20" style="width:340px;">';
while ($session = Database::fetch_array($rs)) {
$return .= '<option value="' . $session['id'] . '" title="' . htmlspecialchars($session['name'], ENT_QUOTES) . '">' . $session['name'] . '</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_sessions_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例5: search_users
function search_users($needle, $type)
{
global $_configuration, $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
$assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = '';
if (count($assigned_users_id) > 0) {
$without_assigned_users = " AND user.user_id NOT IN(" . implode(',', $assigned_users_id) . ")";
}
if ($_configuration['multiple_access_urls']) {
$sql = "SELECT user.user_id, username, lastname, firstname FROM {$tbl_user} user LEFT JOIN {$tbl_access_url_rel_user} au ON (au.user_id = user.user_id)\n\t\t\tWHERE " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user.user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users} AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT user_id, username, lastname, firstname FROM {$tbl_user} user\n\t\t\tWHERE " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users}";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
while ($user = Database::fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="' . $user['user_id'] . '" title="' . htmlspecialchars($person_name, ENT_QUOTES) . '">' . $person_name . ' (' . $user['username'] . ')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例6: search_courses
function search_courses($needle, $type)
{
global $_configuration, $tbl_course, $tbl_course_rel_access_url, $user_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) {
$value = "'" . $value . "'";
}
$without_assigned_courses = '';
if (count($assigned_courses_code) > 0) {
$without_assigned_courses = " AND c.code NOT IN(" . implode(',', $assigned_courses_code) . ")";
}
if ($_configuration['multiple_access_urls']) {
$sql = "SELECT c.code, c.title FROM {$tbl_course} c LEFT JOIN {$tbl_course_rel_access_url} a ON (a.course_code = c.code)\n WHERE c.code LIKE '{$needle}%' {$without_assigned_courses} AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT c.code, c.title FROM {$tbl_course} c\n WHERE c.code LIKE '{$needle}%' {$without_assigned_courses} ";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database::fetch_array($rs)) {
$return .= '<option value="' . $course['code'] . '" title="' . htmlspecialchars($course['title'], ENT_QUOTES) . '">' . $course['title'] . ' (' . $course['code'] . ')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例7: search_courses
/**
* Search for a list of available courses by title or code, based on
* a given string
* @param string String to search for
* @param int Deprecated param
* @return string A formatted, xajax answer block
* @assert () === false
*/
function search_courses($needle, $id)
{
global $tbl_course;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search courses where username or firstname or lastname begins likes $needle
$sql = 'SELECT code, title FROM ' . $tbl_course . ' u ' . ' WHERE (title LIKE "' . $needle . '%" ' . ' OR code LIKE "' . $needle . '%" ' . ' ) ' . ' ORDER BY title, code ' . ' LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($course = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($course['code']) . '\',\'' . addslashes($course['title']) . ' (' . addslashes($course['code']) . ')' . '\')">' . $course['title'] . ' (' . $course['code'] . ')</a><br />';
} else {
$return .= '...<br />';
}
}
}
$xajax_response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例8: convert
function convert($string)
{
$from = $this->from_encoding;
$to = $this->to_encoding;
if ($from == $to) {
return $string;
}
return api_convert_encoding($string, $to, $from);
}
示例9: make_lp
/**
* Gets html pages and compose them into a learning path
* @param array The files that will compose the generated learning path. Unused so far.
* @return boolean False if file does not exit. Nothing otherwise.
*/
function make_lp($files = array()) {
global $_course;
// We get a content where ||page_break|| indicates where the page is broken.
if (!file_exists($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html')) { return false; }
$content = file_get_contents($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html');
unlink($this->base_work_dir.'/'.$this->file_path);
unlink($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html');
// The file is utf8 encoded and it seems to make problems with special quotes.
// Then we htmlentities that, we replace these quotes and html_entity_decode that in good charset.
$charset = api_get_system_encoding();
$content = api_htmlentities($content, ENT_COMPAT, $this->original_charset);
$content = str_replace('’', '\'', $content);
$content = api_convert_encoding($content, $charset, $this->original_charset);
$content = str_replace($this->original_charset, $charset, $content);
$content = api_html_entity_decode($content, ENT_COMPAT, $charset);
// Set the path to pictures to absolute (so that it can be modified in fckeditor).
$content = preg_replace("|src=\"([^\"]*)|i", "src=\"".api_get_path(REL_COURSE_PATH).$_course['path'].'/document'.$this->created_dir."/\\1", $content);
list($header, $body) = explode('<BODY', $content);
$body = '<BODY'.$body;
// Remove font-family styles.
$header = preg_replace("|font\-family[^;]*;|i", '', $header);
// Chamilo styles.
$my_style = api_get_setting('stylesheets');
if (empty($my_style)) { $my_style = 'chamilo'; }
$style_to_import = "<style type=\"text/css\">\r\n";
$style_to_import .= '@import "'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/default.css";'."\n";
$style_to_import .= "</style>\r\n";
$header = preg_replace("|</head>|i", "\r\n$style_to_import\r\n\\0", $header);
// Line break before and after picture.
$header = str_replace('p {', 'p {clear:both;', $header);
$header = str_replace('absolute', 'relative', $header);
switch ($this->split_steps) {
case 'per_page': $this -> dealPerPage($header, $body); break;
case 'per_chapter': $this -> dealPerChapter($header, $body); break;
}
}
示例10: get_block
/**
* This method return content html containing information about sessions and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<div class="panel panel-default" id="intro">
<div class="panel-heading">
' . get_lang('EvaluationsGraph') . '
<div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">
<em class="fa fa-times"></em>
</a></div>
</div>
<div class="panel-body">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>' . $session_name . ':' . get_lang('Evaluations') . '</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</div>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
}
示例11: get_block
/**
* This method return content html containing information about sessions and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<li class="widget color-orange" id="intro">
<div class="widget-head">
<h3>' . get_lang('EvaluationsGraph') . '</h3>
<div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon('close.gif', get_lang('Close')) . '</a></div>
</div>
<div class="widget-content" align="center">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>' . $session_name . ':' . get_lang('Evaluations') . '</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</li>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
}
示例12: search_coachs
function search_coachs($needle)
{
global $tbl_user;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT username, lastname, firstname FROM ' . $tbl_user . ' user
WHERE (username LIKE "' . $needle . '%"
OR firstname LIKE "' . $needle . '%"
OR lastname LIKE "' . $needle . '%")
AND status=1' . $order_clause . ' LIMIT 10';
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = 'SELECT username, lastname, firstname FROM ' . $tbl_user . ' user
INNER JOIN ' . $tbl_user_rel_access_url . ' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = ' . $access_url_id . ' AND (username LIKE "' . $needle . '%"
OR firstname LIKE "' . $needle . '%"
OR lastname LIKE "' . $needle . '%")
AND status=1' . $order_clause . ' LIMIT 10';
}
}
$rs = Database::query($sql);
while ($user = Database::fetch_array($rs)) {
$return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\'' . $user['username'] . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
}
}
$xajax_response->addAssign('ajax_list_coachs', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例13: search_courses
/**
* Search for a session based on a given search string
* @param string A search string
* @param string A search box type (single or anything else)
* @return string XajaxResponse
* @assert ('abc','single') !== ''
*/
function search_courses($needle, $type)
{
global $tbl_session;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
$sql = 'SELECT * FROM ' . $tbl_session . ' WHERE name LIKE "' . $needle . '%" ORDER BY id';
$rs = Database::query($sql);
$course_list = array();
$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database::fetch_array($rs)) {
$course_list[] = $course['id'];
$return .= '<option value="' . $course['id'] . '" title="' . htmlspecialchars($course['name'], ENT_QUOTES) . '">' . $course['name'] . '</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
}
$_SESSION['course_list'] = $course_list;
return $xajax_response;
}
示例14: search
function search($needle, $type)
{
global $tbl_user, $elements_in;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
/* $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'" AND user.status<>'.DRH.''.
$order_clause.
' LIMIT 11';*/
} else {
$list = CourseManager::get_courses_list(0, 0, 2, 'ASC', -1, $needle);
}
$i = 0;
if ($type == 'single') {
/*
while ($user = Database :: fetch_array($rs)) {
$i++;
if ($i<=10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
$return .= '...<br />';
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));*/
} else {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($list as $row) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="' . $row['id'] . '">' . $row['title'] . ' (' . $row['visual_code'] . ')</option>';
}
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
}
}
return $xajax_response;
}
示例15: parse_ini_file_quotes_safe
/**
* Static function to parse AICC ini files.
* Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file())
* @param string File path
* @return array Structured array
*/
function parse_ini_file_quotes_safe($f)
{
$null = "";
$r = $null;
$sec = $null;
$f = @file($f);
for ($i = 0; $i < @count($f); $i++) {
$newsec = 0;
$w = @trim($f[$i]);
if ($w) {
if ($w[0] == ';') {
continue;
}
if (!$r or $sec) {
if (@substr($w, 0, 1) == "[" and @substr($w, -1, 1) == "]") {
$sec = @substr($w, 1, @strlen($w) - 2);
$newsec = 1;
}
}
if (!$newsec) {
$w = @explode("=", $w);
$k = @trim($w[0]);
unset($w[0]);
$v = @trim(@implode("=", $w));
$v = api_convert_encoding($v, api_get_system_encoding(), mb_detect_encoding($v));
if (@substr($v, 0, 1) == "\"" and @substr($v, -1, 1) == "\"") {
$v = @substr($v, 1, @strlen($v) - 2);
}
if ($sec) {
if (strtolower($sec) == 'course_description') {
//special case
$r[strtolower($sec)] = $k;
} else {
$r[strtolower($sec)][strtolower($k)] = $v;
}
} else {
$r[strtolower($k)] = $v;
}
}
}
}
return $r;
}