xref: /web-php/manual-lookup.php (revision 59c070f5)
1<?php
2
3$_SERVER['BASE_PAGE'] = 'manual-lookup.php';
4include __DIR__ . '/include/prepend.inc';
5include __DIR__ . '/include/manual-lookup.inc';
6
7// BC code, so pattern and function can both be used as
8// parameters to specify the function name
9$function = '';
10if (!empty($_GET['function']) && is_string($_GET['function'])) {
11    $function = htmlspecialchars($_GET['function'], ENT_QUOTES, 'UTF-8');
12} elseif (!empty($_GET['pattern']) && is_string($_GET['pattern'])) {
13    $function = htmlspecialchars($_GET['pattern'], ENT_QUOTES, 'UTF-8');
14}
15
16if (!empty($_GET['scope']) && is_string($_GET['scope'])) {
17    $scope = htmlspecialchars($_GET['scope'], ENT_QUOTES, 'UTF-8');
18} else {
19    $scope = '';
20}
21
22// Prepare data for search
23if ($function) {
24    $function = strtolower($function);
25
26    // Try to find appropriate manual page
27    if ($file = find_manual_page($LANG, $function)) {
28        mirror_redirect($file);
29    }
30}
31
32// Fall back to a quick reference search
33$notfound = $function;
34include __DIR__ . '/quickref.php';
35