More thorough inclusion of the page bug. This should mean the page bug appears just...
[cocanwiki.git] / scripts / edit.ml
index 2e9ee50..4e9996f 100644 (file)
@@ -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.
- * $Id: edit.ml,v 1.24 2004/11/01 12:57:53 rich Exp $
+ * $Id: edit.ml,v 1.27 2005/11/24 14:54:11 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
@@ -48,7 +48,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
       ignore (String.find ua "MSIE"); (* Throws Invalid_string if not found. *)
       true
     with
-       Not_found | String.Invalid_string -> false in
+       Not_found | Invalid_string -> false in
   template#conditional "msie" msie;
 
   (* Build the internal model from the parameters passed to the script. *)
@@ -272,7 +272,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
                  return ()
              | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
                  error ~back_button:true ~title:"Bad page name"
-                   q "The page name supplied is too short or invalid.";
+                   dbh hostid q
+                   "The page name supplied is too short or invalid.";
                  return () in
 
     let model = match pt with
@@ -352,8 +353,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
        with
            SaveURLError ->
              error ~back_button:true ~title:"Page exists"
-             q ("While you were editing that page, it looks " ^
-                "like another user created the same page.");
+               dbh hostid q ("While you were editing that page, it looks " ^
+                             "like another user created the same page.");
              return ()
 
          | SaveConflict (new_version, old_version, url, css) ->
@@ -407,7 +408,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
                     template_email#set "opt_out" opt_out;
                     let body = template_email#to_string in
                     Sendmail.send_mail ~subject
-                      ~to_addr:[to_addr] ~body ())
+                      ~to_addr:[to_addr] body)
          addrs
       );
 
@@ -459,7 +460,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
     return ()
   in
 
-  (* This codes decides where we are in the current editing cycle.
+  (* This code decides where we are in the current editing cycle.
    *
    * Inputs:
    *   id - if set, then we are in the midst of editing a page.