(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: user_prefs_form.ml,v 1.3 2004/11/01 12:57:53 rich Exp $
+ * $Id: user_prefs_form.ml,v 1.6 2006/12/06 09:46:57 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
open Cocanwiki_template
open Cocanwiki_date
-let run r (q : cgi) (dbh : Dbi.connection) hostid host user =
- let template = get_template dbh hostid "user_prefs_form.html" in
+let run r (q : cgi) dbh hostid host user =
+ let template = get_template r dbh hostid "user_prefs_form.html" in
let userid, name, prefs =
match user with
let can_edit = can_edit host user in
(* Pull out the registration date - not stored in the user object. *)
- let sth =
- dbh#prepare_cached
- "select registration_date from users where hostid = ? and id = ?" in
- sth#execute [`Int hostid; `Int userid];
-
- let registration_date =
- match sth#fetch1 () with
- [ `Date registration_date ] -> registration_date
- | _ -> assert false in
+ let registration_date = List.hd (
+ PGSQL(dbh)
+ "select registration_date from users
+ where hostid = $hostid and id = $userid"
+ ) in
let email, has_email =
match prefs.email with