2020-05-25 20:20:16 -06:00
|
|
|
fn conf_enable_duckduckgo {
|
|
|
|
enable_duckduckgo=yes
|
|
|
|
conf_enable_app duckduckgo
|
2020-05-25 18:13:01 -06:00
|
|
|
pageTitle='Site Search'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-25 20:20:16 -06:00
|
|
|
fn duckduckgo_init {
|
2020-05-25 18:13:01 -06:00
|
|
|
get_post_args q
|
|
|
|
if (! ~ $#q 0) {
|
|
|
|
redirect_string = 'https://duckduckgo.com/?q=site:'$SERVER_NAME^'+'^$"q
|
|
|
|
http_redirect $redirect_string '302 Found'
|
|
|
|
}
|
|
|
|
if not {
|
2020-05-25 20:20:16 -06:00
|
|
|
handler_body_main='duckduckgo_body'
|
2020-05-25 18:13:01 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-25 20:20:16 -06:00
|
|
|
fn duckduckgo_body {
|
2020-05-25 18:13:01 -06:00
|
|
|
echo '
|
|
|
|
<h1>Site search</h1>
|
2020-05-26 22:39:54 -06:00
|
|
|
<h2>using DuckDuckGo</h2>
|
2020-05-25 18:13:01 -06:00
|
|
|
<form action="/_search/" method="POST">
|
2020-05-26 22:39:54 -06:00
|
|
|
<label for="searchtext">Site search:</label>
|
|
|
|
<input type="text" id="searchtext" name="q" placeholder="Search text...">
|
2020-05-25 18:13:01 -06:00
|
|
|
<input type="submit" value="Search">
|
|
|
|
</form>'
|
|
|
|
|
|
|
|
}
|
|
|
|
|