(* COCANWIKI scripts. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. * $Id: login_form.ml,v 1.1 2004/09/07 16:19:43 rich Exp $ *) open Apache open Registry open Cgi open Printf open Cocanwiki open Cocanwiki_template open Cocanwiki_strings let template = get_template "login_form.html" let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ = let redirect = try q#param "redirect" with Not_found -> "" in if string_is_whitespace redirect then template#conditional "has_redirect" false else ( template#conditional "has_redirect" true; template#set "redirect" redirect ); let sth = dbh#prepare_cached "select create_account_anon from hosts where id = ?" in sth#execute [`Int hostid]; let create_account_anon = match sth#fetch1 () with [ `Bool b ] -> b | _ -> assert false in template#conditional "create_account_anon" create_account_anon; q#template template let () = register_script run