diff --git a/main/metadata/importdocs.php b/main/metadata/importdocs.php index b3e485c567..86d1ac7f1f 100644 --- a/main/metadata/importdocs.php +++ b/main/metadata/importdocs.php @@ -97,7 +97,7 @@ if (count($idt) && file_exists($phpDigIncCn)) } else { - echo 'No documents with metadata or no PhpDig in this course...
'; + echo 'No documents with metadata or no PhpDig in this course...
'; } if (false && file_exists($phpDigIncCn)) // future: buttons for operations diff --git a/main/metadata/importlinks.php b/main/metadata/importlinks.php index f0d5b3f560..8739a02410 100644 --- a/main/metadata/importlinks.php +++ b/main/metadata/importlinks.php @@ -122,12 +122,12 @@ if (isset($lcn)) // category_title if (in_array($eid, $uceids)) $mceids[] = $eid; } - $hdrInfo = ' ' . get_lang('WorkOn') . ' ' . htmlspecialchars($lcn) . - ', LC-id= ' . htmlspecialchars($lci); + $hdrInfo = ' ' . get_lang('WorkOn') . ' ' . htmlspecialchars($lcn, ENT_QUOTES, $charset) . + ', LC-id= ' . htmlspecialchars($lci, ENT_QUOTES, $charset); } elseif ($lcn) { - $hdrInfo = ' (' . htmlspecialchars($lcn) . + $hdrInfo = ' (' . htmlspecialchars($lcn, ENT_QUOTES, $charset) . ': ' . get_lang('NotInDB') . ')'; } else @@ -142,7 +142,7 @@ if (isset($lcn)) // category_title $interbreadcrumb[]= array( 'url' => api_get_self() . '?lcn=' . urlencode($lcn), - 'name'=> get_lang('Continue') . ' ' . htmlspecialchars($lcn)); + 'name'=> get_lang('Continue') . ' ' . htmlspecialchars($lcn, ENT_QUOTES, $charset)); } $htmlHeadXtra[] = ' @@ -154,7 +154,7 @@ Display::display_header($nameTools); // OPERATIONS -----------------------------------------------------------------> if ($ufos) echo '

', $ufos, ' ', get_lang('RemainingFor'), ' ', - htmlspecialchars($lcn), '

', "\n"; + htmlspecialchars($lcn, ENT_QUOTES, $charset), '', "\n"; if (isset($slo)) echo '

', $slo, '

', "\n"; // selected links op @@ -169,8 +169,8 @@ if ($slo == get_lang('Create') && count($lceids)) $xht->xht_xmldoc = new xmddoc(explode("\n", $mdt)); $mdStore->mds_put($eid, $xht->xht_fill_template('INDEXABLETEXT'), 'indexabletext'); - echo '", htmlspecialchars($eid), ' '; + echo '", htmlspecialchars($eid, ENT_QUOTES, $charset), ' '; } echo '
'; } @@ -180,13 +180,13 @@ elseif ($slo == get_lang('Remove') && count($lceids)) echo $aff, ' MDEs/ ', count($lceids), ' ', get_lang('MdCallingTool'), '

', get_lang('AllRemovedFor'), - ' ', htmlspecialchars($lcn), '
'; + ' ', htmlspecialchars($lcn, ENT_QUOTES, $charset), '
'; } elseif ($slo == get_lang('Remove') && count($mceids)) // obsolete category { $mdStore->mds_delete_many($mceids); - echo get_lang('AllRemovedFor'), ' ', htmlspecialchars($lcn), '
'; + echo get_lang('AllRemovedFor'), ' ', htmlspecialchars($lcn, ENT_QUOTES, $charset), '
'; } elseif ($slo == get_lang('Index') && file_exists($phpDigIncCn) && count($mceids)) { @@ -234,9 +234,9 @@ elseif ($slo == get_lang('Index') && file_exists($phpDigIncCn) && count($mceids) else { echo '', "\n"; - echo ''; + echo ''; echo '
', htmlspecialchars($url), - '', htmlspecialchars($path), - '', htmlspecialchars($file), '
', htmlspecialchars($url, ENT_QUOTES, $charset), + '', htmlspecialchars($path, ENT_QUOTES, $charset), + '', htmlspecialchars($file, ENT_QUOTES, $charset), '
', "\n"; } } @@ -253,9 +253,9 @@ elseif ($slo == get_lang('Index') && file_exists($phpDigIncCn) && count($mceids) else { echo '', "\n"; - echo ''; + echo ''; echo '
', htmlspecialchars($url), - '', htmlspecialchars($path), - '', htmlspecialchars($file), '
', htmlspecialchars($url, ENT_QUOTES, $charset), + '', htmlspecialchars($path, ENT_QUOTES, $charset), + '', htmlspecialchars($file, ENT_QUOTES, $charset), '
', "\n"; } } @@ -290,7 +290,7 @@ if (count($perCat)) echo '', "\n"; foreach ($perCat as $cat => $number) { - echo '', "\n"; } @@ -299,8 +299,8 @@ if (count($perCat)) if (isset($lci)) { - echo '

', htmlspecialchars($lcn), ' ', get_lang('MdCallingTool'), - ': ', count($lceids), '
', "\n"; + echo '

', htmlspecialchars($lcn, ENT_QUOTES, $charset), ' ', get_lang('MdCallingTool'), + ': ', count($lceids), '
', "\n"; } @@ -322,14 +322,14 @@ if ($perCat[$lcn] && file_exists($phpDigIncCn)) echo echo '', "\n"; if (count($perCat)) foreach ($perCat as $cat => $number) - $perCat[$cat] = '(' . htmlspecialchars($cat) . ')'; + $perCat[$cat] = '(' . htmlspecialchars($cat, ENT_QUOTES, $charset) . ')'; $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY); $result = api_sql_query("SELECT category_title FROM $linkcat_table", __FILE__, __LINE__); while ($row = mysql_fetch_array($result)) { - $cat = $row['category_title']; $hcat = htmlspecialchars($cat); + $cat = $row['category_title']; $hcat = htmlspecialchars($cat, ENT_QUOTES, $charset); if ($perCat[$cat] == $hcat) $dups[] = $cat; else $perCat[$cat] = $hcat; } @@ -348,10 +348,10 @@ echo '

', get_lang('OrElse'), $warning, '

', "\n", // select new target '', "\n"; foreach ($perCat as $cat => $text) echo '', "\n"; -echo '', "\n", +echo '', "\n", '', "\n", '
', $cat == $lcn ? '' : '(', htmlspecialchars($cat), + echo '
', $cat == $lcn ? '' : '(', htmlspecialchars($cat, ENT_QUOTES, $charset), $cat == $lcn ? '' : ')', ':', $number, '
', "\n"; Display::display_footer(); diff --git a/main/metadata/importmanifest.php b/main/metadata/importmanifest.php index d2c8174bd0..2310004172 100644 --- a/main/metadata/importmanifest.php +++ b/main/metadata/importmanifest.php @@ -60,7 +60,7 @@ require('md_phpdig.php'); if (isset($workWith)) // explicit in URL, or selected at bottom of screen { $scormdocument = Database::get_course_table('lp'); - $sql = "SELECT id FROM $scormdocument WHERE path='". mysql_real_escape_string(substr($workWith,1)) . "' OR path='". mysql_real_escape_string(substr($workWith,1)) . "/.'"; + $sql = "SELECT id FROM $scormdocument WHERE path='". Database::escape_string(api_substr($workWith,1)) . "' OR path='". Database::escape_string(substr($workWith,1)) . "/.'"; $result = api_sql_query($sql, __FILE__, __LINE__); if (mysql_num_rows($result) == 1) @@ -76,14 +76,14 @@ if (isset($sdi) && is_numeric($sdi) && $sdi > 0 && $sdi == (int) $sdi) { $mdObj = new mdobject($_course, $sdi); $workWith = $mdObj->mdo_path; $hdrInfo = ' ' . get_lang('WorkOn') . ' ' . - ($workWith ? htmlspecialchars($workWith) . ', ' : '') . - 'SD-id= ' . htmlspecialchars($sdi) . - ($sdisub ? ' (' . htmlspecialchars($sdisub) . ')' : ''); + ($workWith ? htmlspecialchars($workWith, ENT_QUOTES, $charset) . ', ' : '') . + 'SD-id= ' . htmlspecialchars($sdi, ENT_QUOTES, $charset) . + ($sdisub ? ' (' . htmlspecialchars($sdisub, ENT_QUOTES, $charset) . ')' : ''); } else { unset($sdi); $mdObj = new mdobject($_course, 0); - if ($workWith) $hdrInfo = ' (' . htmlspecialchars($workWith) . + if ($workWith) $hdrInfo = ' (' . htmlspecialchars($workWith, ENT_QUOTES, $charset) . ': ' . get_lang('NotInDB') . ')'; unset($workWith); } @@ -117,7 +117,7 @@ function slurpmanifest() if (!$xht_doc->error) return ''; // keeping $mfContents and $xht_doc unset($mfContents); - return get_lang('ManifestSyntax') . ' ' . htmlspecialchars($xht_doc->error); + return get_lang('ManifestSyntax') . ' ' . htmlspecialchars($xht_doc->error, ENT_QUOTES, $charset); } else { @@ -311,7 +311,7 @@ elseif ($smo == get_lang('Import')) $mdStore->mds_put(EID_TYPE . '.' . $mfdocId, $ixt, 'indexabletext'); } - echo $level <= 1 ? '
'.$level.'/ ' : ' ', htmlspecialchars($itemId); + echo $level <= 1 ? '
'.$level.'/ ' : ' ', htmlspecialchars($itemId, ENT_QUOTES, $charset); flush(); $loopctr = 0; foreach ($xht_doc->xmd_select_elements(SUBITEM, $treeElem) as $subElem) @@ -381,24 +381,24 @@ elseif ($smo == get_lang('Import')) @fwrite($fileHandler, content_for_index_php($sdi)); @fclose($fileHandler); - echo '
', htmlspecialchars($workWith); + echo '
', htmlspecialchars($workWith, ENT_QUOTES, $charset); if (file_exists($playIt)) echo '/index.php ', - htmlspecialchars(date('Y/m/d H:i:s', filemtime($playIt))); + htmlspecialchars(date('Y/m/d H:i:s', filemtime($playIt)), ENT_QUOTES, $charset); } } elseif ($smo == get_lang('Remove') && $sdisub) { $screm = EID_TYPE . '.' . $sdi . '.' . $sdisub; $mdStore->mds_delete_offspring($screm, '\_'); // SQL LIKE underscore - echo htmlspecialchars($screm . '_*: ' . mysql_affected_rows()), '
'; + echo htmlspecialchars($screm . '_*: ' . mysql_affected_rows(), ENT_QUOTES, $charset), '
'; } elseif ($smo == get_lang('Remove')) // remove all, regardless of $sdiall { $mdStore->mds_delete($screm = EID_TYPE . '.' . $sdi); - echo htmlspecialchars($screm . ': ' . mysql_affected_rows()), '
'; + echo htmlspecialchars($screm . ': ' . mysql_affected_rows(), ENT_QUOTES, $charset), '
'; $mdStore->mds_delete_offspring($screm); - echo htmlspecialchars($screm . '.*: ' . mysql_affected_rows()), '

', - '' . get_lang('AllRemovedFor') . ' ' . $screm . '
'; + echo htmlspecialchars($screm . '.*: ' . mysql_affected_rows(), ENT_QUOTES, $charset), '

', + '' . get_lang('AllRemovedFor') . ' ' . $screm . '
'; } elseif ($smo == get_lang('Index') && file_exists($phpDigIncCn) && ereg('^http://([^/]+)/(.+)/index\.php$', $mdObj->mdo_url, $regs)) @@ -448,7 +448,7 @@ elseif ($smo == get_lang('Index') && file_exists($phpDigIncCn) && elseif ($smo == get_lang('Index')) { echo 'Problem! PhpDig connect.php has gone or else URL "' . - htmlspecialchars($mdObj->mdo_url) . + htmlspecialchars($mdObj->mdo_url, ENT_QUOTES, $charset) . '" is not like "http://xxxx/yyy.../zzz/index.php"'; } @@ -476,7 +476,7 @@ while ($row = mysql_fetch_array($result)) if (isset($sdi)) { $mdo = new mdobject($_course, $sdi); - echo '
', htmlspecialchars($mdo->mdo_path), ', SD-id ', $sdi, ': ', + echo '
', htmlspecialchars($mdo->mdo_path, ENT_QUOTES, $charset), ', SD-id ', $sdi, ': ', ($perId[$sdi] ? $perId[$sdi] : '0'), ' ', ($mdtmain[$sdi] ? '- " . @@ -493,8 +493,8 @@ if (count($perId)) $pth = $mdtmain[$id]; // fetch something simple without parsing if ($ttopen = strpos($pth, '')) if ($ttclose = strpos($pth, '', $ttopen)) - $pth = ' ' . html_entity_decode - (substr($pth, $ttopen+7, $ttclose-$ttopen-7)); + $pth = ' ' . api_html_entity_decode + (substr($pth, $ttopen+7, $ttclose-$ttopen-7), ENT_QUOTES, $charset); else $pth = ' ' . substr($pth, $ttopen+7, 30); else $pth = ' ' . substr($pth, 0, 30); } @@ -509,8 +509,8 @@ if (count($perId)) { $tmfdt = file_exists($tfmff = $baseWorkDir . $pth . '/' . MFFNAME . $sdisub . MFFDEXT) ? date('Y/m/d H:i:s', filemtime($tfmff)) : '-'; - echo '', htmlspecialchars($tmfdt), '', - '', htmlspecialchars($pth), + echo '', htmlspecialchars($tmfdt, ENT_QUOTES, $charset), '', + '', htmlspecialchars($pth, ENT_QUOTES, $charset), '(SD-id ', $id, '):', $perId[$id], '', "\n"; } @@ -520,7 +520,7 @@ if (count($perId)) if ($mfContents) { echo $workWith, '/', MFFNAME . $sdisub . MFFDEXT, ': ', - htmlspecialchars(date('Y/m/d H:i:s', filemtime($fmff))) , ", \n", + htmlspecialchars(date('Y/m/d H:i:s', filemtime($fmff)), ENT_QUOTES, $charset) , ", \n", substr_count($mfContents, "\n") + 1, ' ' . get_lang('Lines') . '.', "\n"; @@ -555,7 +555,7 @@ if (file_exists($baseWorkDir . $workWith . '/index.php')) if (file_exists($fhtf = $baseWorkDir . $workWith . '/' . HTF)) echo '
', $workWith, '/', HTF, ': ', - htmlspecialchars(date('Y/m/d H:i:s', filemtime($fhtf))) , "\n"; + htmlspecialchars(date('Y/m/d H:i:s', filemtime($fhtf)), ENT_QUOTES, $charset) , "\n"; @@ -613,7 +613,7 @@ function showSelectForm($label, $specifics) echo '', "\n", '
', "\n", get_lang($label), ' :', "\n", $specifics, "\n", - '', "\n", + '', "\n", '
', "\n"; } @@ -657,7 +657,7 @@ showSelectForm('SDI', '' . '()' . "\n"); + ($sdiall ? UZYX : htmlspecialchars($sdisub, ENT_QUOTES, $charset)) . '" />)' . "\n"); echo '', "\n"; diff --git a/main/metadata/index.php b/main/metadata/index.php index 9afad9f491..d4f2d8bfde 100644 --- a/main/metadata/index.php +++ b/main/metadata/index.php @@ -22,6 +22,8 @@ // PRELIMS --------------------------------------------------------------------> +require_once '../inc/global.inc.php'; + require("md_funcs.php"); getpar('EID', 'Entry IDentifier'); // e.g. 'Document.12' or 'Scorm.xx' @@ -184,11 +186,11 @@ Display::display_header($nameTools); echo "\n"; $xhtDoc->xht_dbgn = DBG; // for template debug info, set to e.g. 10000 if (($ti = $xhtDoc->xht_param['traceinfo'])) $xhtDoc->xht_param['traceinfo'] = - '
Trace information
' . htmlspecialchars($ti); + '
Trace information
' . htmlspecialchars($ti, ENT_QUOTES, $charset); echo $xhtDoc->xht_fill_template('METADATA'), "\n"; if ($xhtDoc->xht_dbgn) echo $xhtDoc->xht_dbgo; Display::display_footer(); -?> \ No newline at end of file +?> diff --git a/main/metadata/md_document.htt b/main/metadata/md_document.htt index 8a5bbb54d3..86e69d46b1 100644 --- a/main/metadata/md_document.htt +++ b/main/metadata/md_document.htt @@ -6,7 +6,7 @@ -{-D TRUE TRUE-}{-D XML application/xml;iso-8859-1-} +{-D TRUE TRUE-}{-D XML application/xml;utf-8-}
{-H {-E md_indexabletext C METADATA_INDEXABLETEXT-}-} @@ -22,7 +22,7 @@ {-L NoScript-} -
+
{-T dbrecord == empty
-} {-E md_part1 C METADATA_PART1-} {-T dbrecord == empty
-} @@ -33,17 +33,17 @@
- - + + {-T dbrecord != empty - - + + -} -   +   {-D techfmt {-V metadata/lom/technical/format-}-}{-T techfmt == XML - + -}
@@ -54,9 +54,9 @@ {-T keywordscache != empty
- - - + + +  {-L ClickKw-} {-P keywordscache-}
@@ -68,11 +68,11 @@ -} {-T keywordscache == empty - + -}