All new templates. Site menu displays basically everywhere.
[cocanwiki.git] / scripts / search.ml
1 (* COCANWIKI scripts.
2  * Written by Richard W.M. Jones <rich@merjis.com>.
3  * Copyright (C) 2004 Merjis Ltd.
4  * $Id: search.ml,v 1.3 2004/09/09 09:35:34 rich Exp $
5  *)
6
7 open Apache
8 open Registry
9 open Cgi
10 open Cgi_escape
11 open Printf
12
13 open Cocanwiki
14
15 let search : ('a -> 'b -> 'c, unit, string, string) format4 =
16   "http://www.google.com/search?q=site:%s+%s"
17
18 let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
19   let query = q#param "q" in
20
21   let query = sprintf search (escape_url hostname) (escape_url query) in
22
23   q#redirect query
24
25 let () =
26   register_script run