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