if (file_exists($playIt)) {
             echo '/index.php ', 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 . '_*: ' . Database::affected_rows(), ENT_QUOTES, $charset), '<br />';
 } elseif ($smo == get_lang('Remove')) {
     $mdStore->mds_delete($screm = EID_TYPE . '.' . $sdi);
     echo htmlspecialchars($screm . ': ' . Database::affected_rows(), ENT_QUOTES, $charset), '<br />';
     $mdStore->mds_delete_offspring($screm);
     echo htmlspecialchars($screm . '.*: ' . Database::affected_rows(), ENT_QUOTES, $charset), '<br /><br />', '<b>' . get_lang('AllRemovedFor') . ' ' . $screm . '</b><br />';
 } elseif ($smo == get_lang('Index') && file_exists($phpDigIncCn) && ereg('^http://([^/]+)/(.+)/index\\.php$', $mdObj->mdo_url, $regs)) {
     $result = $mdStore->mds_get_many('eid,mdxmltext,indexabletext', "eid LIKE '" . EID_TYPE . "." . $sdi . ($sdisub ? "." . $sdisub . "\\_%'" : ".%'") . ($sdiall ? "" : " AND NOT INSTR(eid,'_')"));
     // SQL LIKE underscore
     while ($row = Database::fetch_array($result)) {
         // URL: index.php[?sid=xxx[&thumb=yyy]] (file[1]/@href: pptslnnn_t.jpg)
         $th = '';
         $indtxt = $row['indexabletext'];
         if (($fh = strpos($rx = $row['mdxmltext'], 'file href="')) !== false) {
             if (($cq = strpos($rx, '"', $fh += 11)) !== false) {
                 if (ereg('^pptsl[0-9]+_t\\.jpg$', $thwf = substr($rx, $fh, $cq - $fh))) {
                     $th = '&thumb=' . urlencode($thwf);
                 }
             }
         }
         if ($th == '' && ($sclvl = strpos($indtxt, 'scorm-level-')) !== false) {
             $th = '&thumb=scorm-level-' . $indtxt[$sclvl + 12] . '.jpg';
         }
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
require 'md_phpdig.php';
$mdObj->mdo_add_breadcrump_nav();
// see 'md_' . EID_TYPE . '.php'
$htmlHeadXtra[] = '
<link rel="stylesheet" type="text/css" href="md_styles.css">
<script type="text/javascript" src="md_script.js"></script>
';
Display::display_header($nameTools);
if (isset($dmo)) {
    echo '<h3>', $dmo, '</h3>', "\n";
    // document metadata op
    // if ($dmo == get_lang('Index')) $dmo = $dmo;
}
$result = $mdStore->mds_get_many('eid,indexabletext', OF_EID_TYPE);
echo get_lang('Tool'), ': ', Database::num_rows($result), "<br><br>\n";
$idt = array();
$cidpar = '?cidReq=' . $_course['sysCode'];
while ($row = Database::fetch_array($result)) {
    $mdObj = new mdobject($_course, substr($row['eid'], AFTER_DOT));
    $idt[$mdObj->mdo_url . $cidpar] = $row['indexabletext'];
}
if (count($idt) && file_exists($phpDigIncCn)) {
    require $phpDigIncCn;
    // switch to PhpDig DB
    foreach ($idt as $url => $text) {
        if (ereg('^http://([^/]+)/(.+)/([^/]+)\\?cidReq=(.+)$', $url, $regs)) {
            $path = $regs[2] . '/';
            $file = $regs[3] . '?cidReq=' . $regs[4];
            if ($site_id = remove_engine_entries('http://' . $regs[1] . '/', $path, $file)) {
    return FALSE;
}


// SET CURRENT LINKS CATEGORY - HEADER ---------------------------------------->

unset($lci);  // category-id

if (isset($lcn))  // category_title
{
    $lcn = substr(ereg_replace("[^\x20-\x7E\xA1-\xFF]", "", $lcn), 0, 255);

    $uceids = array(); $mceids = array();

    $result = $mdStore->mds_get_many('eid,mdxmltext', OF_EID_TYPE);

    while ($row = Database::fetch_array($result))
        if (check_andor_get($row, '', $mdCat, $lcn)) $uceids[] = $row['eid'];

    if (($lci = get_cat($lcn)) !== FALSE)
    {
        $link_table = Database::get_course_table(TABLE_LINK);
        $result = Database::query("SELECT id FROM $link_table WHERE category_id=" . $lci);

        while ($row = Database::fetch_array($result))
        {
            $lceids[$id = (int) $row['id']] = ($eid = EID_TYPE . '.' . $id);

            if (in_array($eid, $uceids)) $mceids[] = $eid;
        }
$_course = api_get_course_info();
isset($_course) or give_up(get_lang('Sorry'));
$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    give_up(get_lang('Denied'));
}
$mdStore = new mdstore($is_allowed_to_edit);
// create table if needed
$mdObj = new mdobject($_course, 0);
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
$xhtDoc = $mdObj->mdo_define_htt();
$mdObj->mdo_add_breadcrump_nav();
// see 'md_' . EID_TYPE . '.php'
Display::display_header($nameTools);
// OPERATIONS ----------------------------------------------------------------->
echo '<h3>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h3>', "\n";
$result = $mdStore->mds_get_many('eid,mdxmltext', "eid LIKE '" . EID_TYPE . ".%'");
echo get_lang('TotalMDEs'), $total = Database::num_rows($result), "<br><br>\n";
if ($total > 100) {
    set_time_limit((int) ($total / 10));
}
while ($row = Database::fetch_array($result)) {
    $eid = $row['eid'];
    $xmltext = $row['mdxmltext'];
    $xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $xmltext));
    $mdStore->mds_put($eid, $xhtDoc->xht_fill_template('INDEXABLETEXT'), 'indexabletext');
    echo htmlspecialchars($eid, ENT_QUOTES, $charset), ' ';
}
echo '<h5>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h5>', "\n";
Display::display_footer();
    exit;
}
$kwds = array();
$kwcnt = array();
$kwrefs = array();
while ($kwline = fgets($myFile)) {
    if (ereg('�>(.+)<�', $kwline, $regs) || ereg('">(.+)<�', $kwline, $regs)) {
        foreach (explode(',', $regs[1]) as $kw) {
            if (!in_array($kw = strtr(trim($kw), $htmldecode), $kwds)) {
                $kwds[] = $kw;
            }
        }
    }
}
fclose($myFile);
$result = $mdStore->mds_get_many('eid,mdxmltext', '1 = 1');
echo get_lang('TotalMDEs'), Database::num_rows($result), "<br>\n";
echo count($kwds), ' ', get_lang('CourseKwds'), '<br>', "\n";
while ($row = Database::fetch_array($result)) {
    $eid = $row['eid'];
    $curr = '';
    $xmltext = $row['mdxmltext'];
    $offset = 0;
    if (substr($eid, 0, 6) == 'Scorm.') {
        if (($dotpos = strpos($eid, '.', 6)) && $dotpos + 1 < strlen($eid)) {
            $curr = substr($eid, 0, $dotpos);
        }
    }
    while ($start = strpos($xmltext, '<keyword>', $offset)) {
        if ($start = strpos($xmltext, '">', $start + 9)) {
            if (($stop = strpos($xmltext, '</', $start += 2)) && $stop > $start) {
Beispiel #6
0
    give_up($xmlDoc->error);
}
if (isset($_POST['mdsc'])) {
    $mdsc = str_replace("\r", "\n", str_replace("\r\n", "\n", get_magic_quotes_gpc() ? stripslashes($_POST['mdsc']) : $_POST['mdsc']));
    foreach (explode("\n", $mdsc) as $word) {
        if ($word = trim($word)) {
            $words .= ", " . $word;
            $where .= " AND indexabletext " . ($word[0] != '-' ? "LIKE '%" . addslashes($word) . "%'" : "NOT LIKE '%" . addslashes(substr($word, 1)) . "%'");
        }
    }
    if ($where) {
        $whereclause = substr($where, 5);
        // remove first " AND "
        $xhtDoc->xht_xmldoc->xmd_add_text_element('query', $whereclause);
        $xhtDoc->xht_param['traceinfo'] = substr($words, 2);
        $result = $mdStore->mds_get_many('eid,mdxmltext', $whereclause);
        while ($myrow = @Database::fetch_array($result)) {
            // not quite a real manifest, but very much like one...
            $eid = $myrow['eid'];
            $xmlDoc = new xmddoc($myrow['mdxmltext']);
            if ($xmlDoc->error) {
                give_up('Entry ' . $eid . ': ' . $xmlDoc->error);
            }
            $mdObj = new mdobject($_course, $eid);
            // md_mix.php
            $xhtDoc->xht_xmldoc->xmd_copy_foreign_child($xmlDoc);
            $newItem = $xhtDoc->xht_xmldoc->xmd_select_single_element('item[-1]');
            $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'eid', $eid);
            $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'url', $mdObj->mdo_url);
            if ($mdObj->mdo_type == 'Scorm') {
                $xhtDoc->xht_xmldoc->xmd_set_attribute($newItem, 'brl', $mdObj->mdo_base_url);