Exemplo n.º 1
0
function primary_content($notfound_dec)
{
    global $LANG;
    // Could probably use search.php here (add another case to the switch)
    // but for now...
    $l = $LANG;
    $q = $notfound_dec;
    echo '<h1>Search results</h1>';
    google_cse($q, $l);
}
Exemplo n.º 2
0
<?php

// $Id$
$_SERVER['BASE_PAGE'] = 'results.php';
include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include $_SERVER['DOCUMENT_ROOT'] . '/include/results.inc';
if (!isset($_GET['l']) || !is_string($_GET['l'])) {
    $_GET['l'] = null;
}
$lang = isset($_GET["l"]) ? (string) $_GET["l"] : "en";
$query = isset($_GET["q"]) ? (string) $_GET["q"] : '';
if (!isset($LANGUAGES[$lang])) {
    $lang = "en";
}
// HTTP status line is passed on, signifies an error
site_header('Search results', array('noindex', 'current' => 'help', 'layout_span' => 12));
echo '<h1>Search results</h1>';
google_cse($query, $lang);
site_footer();
Exemplo n.º 3
0
    $head_options = array();
}
site_header("Manual Quick Reference", $head_options + array("current" => "docs"));
// Note: $notfound is defined (with htmlspecialchars) inside manual-lookup.php
$notfound_enc = urlencode($notfound);
if ($snippet = is_known_snippet($notfound)) {
    echo "<h1>Related snippet found for '{$notfound}'</h1>";
    echo "<p>{$snippet}</p>";
}
?>

<h1>Perform an alternative search here</h1>
<?php 
// TODO Fix encoding issues. We encode this earlier. Using _decode for now.
// We allow users to search for tags like <foo>
google_cse(htmlspecialchars_decode($notfound, ENT_QUOTES));
?>

<h1>PHP Function List</h1>

<?php 
if (!empty($notfound) && count($maybe) > 0) {
    ?>

<p>
 <b><?php 
    echo $notfound;
    ?>
</b> doesn't exist. Closest matches:
</p>
Exemplo n.º 4
0
    if (empty($_FORM['show'])) {
        $_FORM['show'] = 'all';
    }
    // Never allow a comma in the show string, that would confuse our JS
    $_FORM['show'] = str_replace(",", "", $_FORM['show']);
    $ucp = urlencode($_FORM['pattern']);
    // Do redirections for external search engines
    switch ($_FORM['show']) {
        case "quickref":
        case "404quickref":
            $langparam = isset($EXPL_LANG) ? "&lang={$EXPL_LANG}" : "";
            mirror_redirect("/manual-lookup.php?pattern={$ucp}{$langparam}&scope={$_FORM['show']}");
            break;
        case "manual":
        case "404manual":
            mirror_redirect($MYSITE . "results.php?q={$ucp}&p={$_FORM['show']}&l={$LANG}");
            break;
            // Covers the rest
        // Covers the rest
        default:
            $p = urlencode($_FORM['show']);
            mirror_redirect($MYSITE . "results.php?q={$ucp}&l={$LANG}&p={$p}");
            break;
    }
} else {
    // Print out common header
    $link = array("rel" => "search", "type" => "application/opensearchdescription+xml", "href" => $MYSITE . "phpnetimprovedsearch.src", "title" => "Add PHP.net search");
    site_header("Search", array("link" => array($link), "current" => "help"));
    google_cse();
    site_footer();
}
Exemplo n.º 5
0
$ul = urlencode($l);
$s = isset($_GET['start']) && is_numeric($_GET['start']) ? (int) $_GET['start'] : 0;
$profile = isset($_GET['p']) && is_string($_GET['p']) ? $_GET['p'] : 'all';
$per_page = 10;
$valid_profiles = array('all', 'local', 'manual', 'news', 'bugs', 'pear', 'pecl', 'talks');
$scope = in_array($profile, $valid_profiles) ? $profile : 'all';
$srch_host = "www.php.net";
$srch_rqst = "/ws.php?profile={$scope}&q={$uq}&lang={$ul}&results={$per_page}&start={$s}&mirror=" . trim(substr($MYSITE, 7), '/');
$url = "http://" . $srch_host . $srch_rqst;
$data = fetch_contents($url);
if (is_array($data)) {
    // FIXME: if (is_authenticated()) ...
    $comment = '<!-- ' . print_r($data, true) . '-->';
    exit_with_pretty_error("Search error", "Internal error", "This mirror does not support searches, please report this error to <a href='/contact'>our webmasters</a>" . $comment);
}
$res = unserialize($data);
// HTTP status line is passed on, signifies an error
site_header('Search results', array("noindex", "current" => "FIXME"));
if (!is_array($res)) {
    exit_with_pretty_error(null, 'Internal error', 'Please try again later');
}
// No results for query
if ($res['ResultSet']['totalResultsAvailable'] == 0) {
    echo '<h1>Perform an alternative search instead</h1>';
    // TODO Research possible encoding issues
    google_cse($q);
    exit_with_pretty_error(null, 'No matches', 'No pages matched your query');
    exit;
}
search_results($res, $q, $scope, $per_page, $s, $l);
site_footer();