Example #1
0
$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)) {
                echo '<table>', "\n";
                index_words($site_id, $path, $file, get_first_words($text, $path, $file), get_keywords($text));
                echo '</table>', "\n";
            }
        }
    }
    if (isset($db)) {
        //mysql_select_db($_configuration['main_database'], $db);
        Database::select_db($_configuration['main_database'], $db);
    }
} else {
    echo 'No documents with metadata or no PhpDig in this course...<br />';
}
if (false && file_exists($phpDigIncCn)) {
    echo '<form action="' . api_get_self() . '" method="post">', "\n", '<input type="submit" name="dmo" value="', get_lang('Import', 'noDLTT'), '">', "\n", '<input type="submit" name="dmo" value="', get_lang('Remove', 'noDLTT'), '">', "\n", '</form>', "\n";
         $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';
         }
         $idt[($dotpos = strpos($ri = $row['eid'], '.', TPLEN)) !== false ? 'index.php?sid=' . urlencode(substr($ri, $dotpos + 1)) . $th : 'index.php'] = $indtxt;
     }
     require $phpDigIncCn;
     // switch to PhpDig DB
     if ($site_id = remove_engine_entries('http://' . $regs[1] . '/', $path = $regs[2] . '/', $sdisub ? 'index.php?sid=' . $sdisub . '_' : '')) {
         echo '<table>', "\n";
         foreach ($idt as $url => $text) {
             set_time_limit(30);
             // again 30 seconds from here on...
             index_words($site_id, $path, $url, get_first_words($text, $path, $url), get_keywords($text));
         }
         echo '</table>', "\n";
     }
     // possible enhancement: UPDATE spider record for still existing pages
     if (isset($db)) {
         //mysql_select_db($_configuration['main_database'], $db);
         Database::select_db($_configuration['main_database'], $db);
     }
 } elseif ($smo == get_lang('Index')) {
     echo 'Problem! PhpDig connect.php has gone or else URL "' . htmlspecialchars($mdObj->mdo_url, ENT_QUOTES, $charset) . '" is not like "http://xxxx/yyy.../zzz/index.php"';
Example #3
0
             get_first_words($text, $url . $path, $file),
             get_keywords($text));
         echo '</table>', "\n";
     }
     else
     {
         echo '<table>', "\n";
         echo '<tr><td>', htmlspecialchars($url, ENT_QUOTES, $charset),
             '</td><td>', htmlspecialchars($path, ENT_QUOTES, $charset),
             '</td><td>', htmlspecialchars($file, ENT_QUOTES, $charset), '</td></tr>';
         echo '</table>', "\n";
     }
 }
 elseif (isset($pu['scheme']) && $pu['scheme'] == 'mailto' && isset($pu['path']))
 {
     if ($site_id = remove_engine_entries($url = 'mailto:' . $pu['path'], ''))
     {
         echo '<table>', "\n";
         index_words($site_id, '', '',
             get_first_words($text, $url, ''),
             get_keywords($text));
         echo '</table>', "\n";
     }
     else
     {
         echo '<table>', "\n";
         echo '<tr><td>', htmlspecialchars($url, ENT_QUOTES, $charset),
             '</td><td>', htmlspecialchars($path, ENT_QUOTES, $charset),
             '</td><td>', htmlspecialchars($file, ENT_QUOTES, $charset), '</td></tr>';
         echo '</table>', "\n";
     }