Example #1
0
    //run the query against the index
    $sq = new SearchQuery($query_string, $page_number, 10, false);
}
if (!($site = get_site())) {
    redirect("index.php");
}
$strsearch = get_string('search', 'search');
$strquery = get_string('enteryoursearchquery', 'search');
$navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strquery, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$site = get_site();
print_header("{$strsearch}", "{$site->fullname}", $navigation, "", "", true, "&nbsp;", user_login_string($course) . '<hr style="width:95%">' . navmenu($site));
//keep things pretty, even if php5 isn't available
if (!$check) {
    print_heading(search_check_php5(true));
    print_footer();
    exit(0);
}
print_box_start();
print_heading($strquery);
print_box_start();
$vars = get_object_vars($adv);
if (isset($vars)) {
    foreach ($vars as $key => $value) {
        // htmlentities breaks non-ascii chars
        $adv->key = stripslashes($value);
        //$adv->$key = stripslashes(htmlentities($value));
    }
}
?>
Example #2
0
*/
/**
* includes and requires
*/
require_once '../config.php';
require_once "{$CFG->dirroot}/search/lib.php";
/// checks global search activation
require_login();
if (empty($CFG->enableglobalsearch)) {
    error(get_string('globalsearchdisabled', 'search'));
}
if (!isadmin()) {
    error(get_string('beadmin', 'search'), "{$CFG->wwwroot}/login/index.php");
}
/// check for php5 (lib.php)
if (!search_check_php5()) {
    $phpversion = phpversion();
    mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version " . phpversion() . ")");
    exit(0);
}
require_once "{$CFG->dirroot}/search/indexlib.php";
$index = new Zend_Search_Lucene(SEARCH_INDEX_PATH);
$dbcontrol = new IndexDBControl();
$update_count = 0;
$indexdate = $CFG->search_indexer_update_date;
$startupdatedate = time();
/// indexing changed resources
mtrace("Starting index update (updates)...\n");
if ($mods = get_records_select('modules')) {
    $mods = array_merge($mods, search_get_additional_modules());
    foreach ($mods as $mod) {