git.annexia.org
/
cocanwiki.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Completed all user scripts.
[cocanwiki.git]
/
scripts
/
edit.ml
diff --git
a/scripts/edit.ml
b/scripts/edit.ml
index
bf7b482
..
00d48ab
100644
(file)
--- a/
scripts/edit.ml
+++ b/
scripts/edit.ml
@@
-1,7
+1,7
@@
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit.ml,v 1.
9 2004/09/20 10:56:47
rich Exp $
+ * $Id: edit.ml,v 1.
10 2004/09/21 13:01:15
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
*
* 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
@@
-45,7
+45,7
@@
type model_t = {
* for each section. *)
}
* for each section. *)
}
-let run r (q : cgi) (dbh : Dbi.connection) hostid {
hostname = hostname } _
=
+let run r (q : cgi) (dbh : Dbi.connection) hostid {
hostname = hostname} user
=
let template = get_template dbh hostid "edit.html" in
let template_conflict = get_template dbh hostid "edit_conflict.html" in
let template = get_template dbh hostid "edit.html" in
let template_conflict = get_template dbh hostid "edit_conflict.html" in
@@
-409,6
+409,11
@@
let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
try `String (Connection.remote_ip (Request.connection r))
with Not_found -> `Null in
try `String (Connection.remote_ip (Request.connection r))
with Not_found -> `Null in
+ let logged_user =
+ match user with
+ | User (id, _, _) -> `Int id
+ | _ -> `Null in
+
(* Get redirect. *)
let redirect = if model.redirect = "" then `Null
else `String model.redirect in
(* Get redirect. *)
let redirect = if model.redirect = "" then `Null
else `String model.redirect in
@@
-416,11
+421,11
@@
let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
(* Create the new page. *)
let sth = dbh#prepare_cached "insert into pages (hostid, url, title,
description, creation_date, logged_ip,
(* Create the new page. *)
let sth = dbh#prepare_cached "insert into pages (hostid, url, title,
description, creation_date, logged_ip,
- redirect, css)
- values (?, ?, ?, ?, ?, ?, ?, ?)" in
+
logged_user,
redirect, css)
+ values (?, ?, ?, ?, ?, ?, ?, ?
, ?
)" in
sth#execute [`Int hostid; `String url; `String title;
`String model.description; creation_date; logged_ip;
sth#execute [`Int hostid; `String url; `String title;
`String model.description; creation_date; logged_ip;
- redirect; css];
+
logged_user;
redirect; css];
(* New page ID <> old page ID model.id. *)
let pageid = sth#serial "pages_id_seq" in
(* New page ID <> old page ID model.id. *)
let pageid = sth#serial "pages_id_seq" in