/**
  * Search for a phrase
  * 
  * note: you can draw your own search-form and add a path-variable. with the
  * path variable you can limit the search to url paths like www/cars/.. or www/bikes ...
  * 
  * @param string Search Phrase
  * @param integer Number of search results to diplay on one page.
  * @param String OPtion for search. Allowed are "any", "exact" and "start"
  */
 function search($searchPhrase, $limit = 20, $options = "any")
 {
     global $c, $phpdig_words_chars;
     define('SEARCH_PAGE', $_SERVER['PHP_SELF']);
     define('DISPLAY_DROPDOWN', 0);
     $relative_script_path = $c["path"] . "ext/phpdig";
     include_once $c["path"] . "ext/phpdig/includes/config.php";
     include_once $c["path"] . "ext/phpdig/libs/search_function.php";
     extract(phpdigHttpVars(array('query_string' => 'string', 'refine' => 'integer', 'refine_url' => 'string', 'site' => 'string', 'limite' => 'integer', 'option' => 'string', 'lim_start' => 'integer', 'browse' => 'integer', 'path' => 'string')), EXTR_SKIP);
     $results = phpdigSearch($id_connect, $searchPhrase, $options, $refine, $refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path, 'array');
     return $results["results"];
 }
Example #2
0
        $fckwc = fopen($ckwc, 'rb');
        $pkwc = fread($fckwc, filesize($ckwc));
        fclose($fckwc);
        unset($fckwc);
    }
    if ($fckwc = fopen($ckwc, 'wb')) {
        fwrite($fckwc, $query_string);
        fclose($fckwc);
        unset($fckwc);
        $ckwcdt = file_exists($ckwc) ? date('Y/m/d H:i:s', filemtime($ckwc)) : '? Write Error';
    } else {
        $ckwcdt = '? Open Error';
    }
    $phpdigSearchResults = array('result_message' => $ckw . 'c: ' . $ckwcdt, 'pages_bar' => '', 'results' => array());
} else {
    $phpdigSearchResults = phpdigSearch($id_connect, $query_string, $option, $refine, $refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path, $template, $adlog_flag, $rssdf, $template_demo);
}
$result_message = '';
$hits = 11;
if ($result_message = $phpdigSearchResults['result_message']) {
    if (($cspos = strpos($result_message, ', ')) !== FALSE) {
        if (($sppos = strpos($result_message, ' ', $cspos += 2)) !== FALSE) {
            if (is_numeric($total = substr($result_message, $cspos, $sppos - $cspos))) {
                $hits = (int) $total;
            }
        }
    }
}
if (!($pages_bar = $phpdigSearchResults['pages_bar'])) {
    $hits = 0;
}