Fixed some bitrot and some unused variables.
authorrich <rich>
Wed, 26 Jul 2006 13:12:10 +0000 (13:12 +0000)
committerrich <rich>
Wed, 26 Jul 2006 13:12:10 +0000 (13:12 +0000)
12 files changed:
scripts/admin/edit_hostnames.ml
scripts/delete_contact.ml
scripts/delete_contact_form.ml
scripts/delete_user.ml
scripts/edit.ml
scripts/edit_host_settings.ml
scripts/edit_sitemenu.ml
scripts/invite_user.ml
scripts/lib/cocanwiki_ext_calendar.ml
scripts/mailing_list_confirm.ml
scripts/rename_page.ml
scripts/send_feedback.ml

index 1fe9e62..7b3978f 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_hostnames.ml,v 1.10 2006/03/28 16:24:08 rich Exp $
+ * $Id: edit_hostnames.ml,v 1.11 2006/07/26 13:12: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
@@ -36,8 +36,7 @@ let run r (q : cgi) dbh _ host' _ =
   if q#param_true "cancel" then (
     let { hostname = hostname } = host' in
     q#redirect ("http://" ^ hostname ^ "/_bin/admin/host.cmo?hostid=" ^
-                 Int32.to_string hostid);
-    return ()
+                 Int32.to_string hostid)
   );
 
   let canonical_hostname = q#param "canonical_hostname" in
index 07758f1..12bada0 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: delete_contact.ml,v 1.5 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_contact.ml,v 1.6 2006/07/26 13:12:10 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
@@ -29,19 +29,15 @@ open Cocanwiki_ok
 
 let run r (q : cgi) dbh hostid { hostname = hostname } _ =
   (* Cancel? *)
-  if q#param_true "cancel" then (
+  if q#param_true "cancel" then
     q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
-    return ()
-  );
 
   (* We can delete multiple contact forms from this script, which is
    * quite unusual.
    *)
   let ids = List.map Int32.of_string (q#param_all "delete") in
-  if ids = [] then (
+  if ids = [] then
     q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
-    return ()
-  );
 
   (* Need to check the contact emails all belong to this host. *)
   let rows = PGSQL(dbh)
index 1dd0bfd..91b7f3b 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: delete_contact_form.ml,v 1.3 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_contact_form.ml,v 1.4 2006/07/26 13:12:10 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
@@ -34,10 +34,8 @@ let run r (q : cgi) dbh hostid { hostname = hostname } _ =
    * quite unusual.
    *)
   let ids = List.map Int32.of_string (q#param_all "delete") in
-  if ids = [] then (
+  if ids = [] then
     q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
-    return ()
-  );
 
   let rows = PGSQL(dbh)
     "select id, name, subject from contacts
index 9e4cffd..ecdc44a 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: delete_user.ml,v 1.6 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_user.ml,v 1.7 2006/07/26 13:12:10 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
@@ -28,11 +28,9 @@ open Cocanwiki
 open Cocanwiki_ok
 
 let run r (q : cgi) dbh hostid {hostname = hostname} self =
-  if q#param_true "cancel" then (
+  if q#param_true "cancel" then
     (* Request cancelled. *)
     q#redirect ("http://" ^ hostname ^ "/_users");
-    return ()
-  );
 
   let userid = Int32.of_string (q#param "userid") in
 
index db31b59..c9aa1df 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.28 2006/03/27 18:09:46 rich Exp $
+ * $Id: edit.ml,v 1.29 2006/07/26 13:12:10 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
@@ -275,23 +275,23 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
 
   (* Begin editing with a blank page, typically a template. *)
   let begin_editing_new pt =
-    let url, title =
-      match pt with
-         Page url -> url, url
-       | Title title ->
-           match Wikilib.generate_url_of_title dbh hostid title with
-               Wikilib.GenURL_OK url -> url, title
-             | Wikilib.GenURL_Duplicate url ->
-                 q#redirect ("http://" ^ hostname ^ "/" ^ url);
-                 return ()
-             | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
-                 error ~back_button:true ~title:"Bad page name"
-                   dbh hostid q
-                   "The page name supplied is too short or invalid.";
-                 return () in
+    (* Just check the title. *)
+    (match pt with
+     | Page url -> ()
+     | Title title ->
+        match Wikilib.generate_url_of_title dbh hostid title with
+        | Wikilib.GenURL_OK url -> ()
+        | Wikilib.GenURL_Duplicate url ->
+            q#redirect ("http://" ^ hostname ^ "/" ^ url)
+        | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
+            error ~back_button:true ~title:"Bad page name"
+              dbh hostid q
+              "The page name supplied is too short or invalid.";
+            return ()
+    );
 
     let model = match pt with
-       Page url -> new_page pt
+      | Page url -> new_page pt
       | Title title -> new_page_with_title title in
 
     model_to_template model template
@@ -454,8 +454,7 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
       email_notify ~body ~subject ~user dbh hostid;
 
       (* Redirect back to the URL. *)
-      q#redirect ("http://" ^ hostname ^ "/" ^ url);
-      return ()
+      q#redirect ("http://" ^ hostname ^ "/" ^ url)
     );
   in
 
@@ -476,8 +475,7 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
         *)
        "" in
 
-    q#redirect ("http://" ^ hostname ^ "/" ^ url);
-    return ()
+    q#redirect ("http://" ^ hostname ^ "/" ^ url)
   in
 
   (* This code decides where we are in the current editing cycle.
index b7dc999..ff4c231 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_host_settings.ml,v 1.10 2006/03/27 18:09:46 rich Exp $
+ * $Id: edit_host_settings.ml,v 1.11 2006/07/26 13:12:10 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
@@ -30,11 +30,9 @@ open Cocanwiki_strings
 
 let run r (q : cgi) dbh hostid { hostname = hostname } _ =
   (* Cancel? *)
-  if q#param_true "cancel" then (
+  if q#param_true "cancel" then
     (* Request cancelled. *)
     q#redirect ("http://" ^ hostname ^ "/_bin/host_menu.cmo");
-    return ()
-  );
 
   (* Get parameters. *)
   let edit_anon = q#param_true "edit_anon" in
index 6680e52..6c7aebb 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_sitemenu.ml,v 1.11 2006/03/27 19:10:29 rich Exp $
+ * $Id: edit_sitemenu.ml,v 1.12 2006/07/26 13:12:10 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
@@ -78,7 +78,7 @@ let run r (q : cgi) dbh hostid { hostname = hostname } user=
   (* Check for errors in the model. *)
   let check_for_errors model =
     let errors = ref [] in
-    let add_error msg = errors := msg :: !errors in
+(*    let add_error msg = errors := msg :: !errors in *)
     let get_errors () = List.rev !errors in
 
     (* XXX Not implemented yet. *)
@@ -290,10 +290,8 @@ let run r (q : cgi) dbh hostid { hostname = hostname } user=
    *   page - the page URL opened newly for editing.
    *)
   if q#param_true "inedit" then (
-    if q#param_true "cancel" then (
+    if q#param_true "cancel" then
       cancel ();
-      return ()
-    );
     if q#param_true "save" then (
       let ok = try_save () in
       if ok then return ()             (* ... else fall through *)
index 19bd170..8f3a09a 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: invite_user.ml,v 1.7 2006/03/28 13:20:00 rich Exp $
+ * $Id: invite_user.ml,v 1.8 2006/07/26 13:12:10 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
@@ -39,10 +39,8 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
   let emails = Pcre.split ~rex:split_re emails in
 
   (* This guy's got no friends ... *)
-  if emails = [] then (
+  if emails = [] then
     q#redirect ("http://" ^ hostname ^ "/");
-    return ()
-  );
 
   let userid, username, email = match user with
       User (userid, username, _, prefs) -> userid, username, prefs.email
index 1d54ca7..bbd5506 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: cocanwiki_ext_calendar.ml,v 1.3 2006/03/27 16:43:44 rich Exp $
+ * $Id: cocanwiki_ext_calendar.ml,v 1.4 2006/07/26 13:12: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
@@ -248,7 +248,7 @@ let extension dbh hostid url =
 
        template#to_string
 
-    | Some ((yyyy, mm, dd) as date) -> (* Single day view. *)
+    | Some (yyyy, mm, dd) ->           (* Single day view. *)
        let template = day_template in
 
        (* XXX This will change once we start doing date and time events.
index d7b7316..e35c32b 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: mailing_list_confirm.ml,v 1.6 2006/03/28 13:20:00 rich Exp $
+ * $Id: mailing_list_confirm.ml,v 1.7 2006/07/26 13:12:10 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
@@ -34,15 +34,15 @@ let run r (q : cgi) dbh hostid _ _ =
   let rows = PGSQL(dbh) "select email from mailing_lists
                           where hostid = $hostid and pending = $pending" in
 
-  let email =
-    match rows with
-    | [email] -> email
-    | [] ->
-       error ~close_button:true ~title:"Email already confirmed"
-         dbh hostid q
-         "It looks like that email address has already been confirmed.";
-       return ()
-    | _ -> assert false in
+  (* Already confirmed? *)
+  (match rows with
+   | [_] -> ()
+   | [] ->
+       error ~close_button:true ~title:"Email already confirmed"
+        dbh hostid q
+        "It looks like that email address has already been confirmed.";
+       return ()
+   | _ -> assert false);
 
   (* Update the database. *)
   PGSQL(dbh) "update mailing_lists set pending = null
index a1d287c..3e257dc 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: rename_page.ml,v 1.5 2006/03/28 16:24:08 rich Exp $
+ * $Id: rename_page.ml,v 1.6 2006/07/26 13:12:10 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
@@ -34,10 +34,8 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
   let page = q#param "page" in
 
   (* Cancelled? *)
-  if q#param_true "cancel" then (
+  if q#param_true "cancel" then
     q#redirect ("http://" ^ hostname ^ "/" ^ page);
-    return ()
-  );
 
   let new_title = trim (q#param "new_title") in
 
index 1de626e..ffe7c7c 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: send_feedback.ml,v 1.8 2006/03/28 16:24:08 rich Exp $
+ * $Id: send_feedback.ml,v 1.9 2006/07/26 13:12:10 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
@@ -33,11 +33,9 @@ open Cocanwiki_ok
 let run r (q : cgi) dbh hostid {hostname = hostname} user =
   let template = get_template dbh hostid "send_feedback.txt" in
 
-  if q#param_true "cancel" then (
+  if q#param_true "cancel" then
     (* Request cancelled. *)
     q#redirect ("http://" ^ hostname);
-    return ()
-  );
 
   (* Get the feedback email for this host. *)
   let to_addr = List.hd (