}
                }
            }
            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"';
    }
}
// STATISTICS ----------------------------------------------------------------->
echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
$result = $mdStore->mds_get_many('eid', "eid LIKE '" . EID_TYPE . ".%'");
$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";
}
Display::display_footer();
        $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"';
            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";
            }
        }
    }

    if(isset($db))