From 6b0b6830a2e784eee99dcd1b1a3cb8b44e27c765 Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 23 Sep 2004 11:56:47 +0000 Subject: [PATCH] Global replace 'raise CgiExit' -> 'return ()' to match a future version of mod_caml. --- scripts/admin/edit_emails.ml | 4 ++-- scripts/admin/edit_hostnames.ml | 6 +++--- scripts/cocanwiki.ml | 4 +++- scripts/contact.ml | 4 ++-- scripts/create.ml | 8 ++++---- scripts/create_contact.ml | 8 ++++---- scripts/create_form.ml | 6 +++--- scripts/create_user.ml | 8 ++++---- scripts/delete_contact.ml | 6 +++--- scripts/delete_contact_form.ml | 4 ++-- scripts/delete_user.ml | 6 +++--- scripts/delete_user_form.ml | 4 ++-- scripts/edit.ml | 8 ++++---- scripts/edit_contact.ml | 8 ++++---- scripts/edit_host_settings.ml | 4 ++-- scripts/edit_sitemenu.ml | 6 +++--- scripts/edit_user.ml | 8 ++++---- scripts/forgot_password.ml | 4 ++-- scripts/page.ml | 4 ++-- scripts/restore_form.ml | 4 ++-- scripts/send_feedback.ml | 4 ++-- scripts/set_password.ml | 4 ++-- scripts/signup.ml | 8 ++++---- scripts/upload_file.ml | 6 +++--- scripts/upload_image.ml | 12 ++++++------ 25 files changed, 75 insertions(+), 73 deletions(-) diff --git a/scripts/admin/edit_emails.ml b/scripts/admin/edit_emails.ml index 7948c51..a1d0cc6 100644 --- a/scripts/admin/edit_emails.ml +++ b/scripts/admin/edit_emails.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_emails.ml,v 1.5 2004/09/09 12:21:22 rich Exp $ + * $Id: edit_emails.ml,v 1.6 2004/09/23 11:56:47 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 @@ -38,7 +38,7 @@ let run r (q : cgi) (dbh : Dbi.connection) _ host' _ = let { hostname = hostname } = host' in q#redirect ("http://" ^ hostname ^ "/_bin/admin/host.cmo?hostid=" ^ string_of_int hostid); - raise CgiExit + return () ); let emails = try q#param "emails" with Not_found -> "" in diff --git a/scripts/admin/edit_hostnames.ml b/scripts/admin/edit_hostnames.ml index 9123338..a3a874a 100644 --- a/scripts/admin/edit_hostnames.ml +++ b/scripts/admin/edit_hostnames.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_hostnames.ml,v 1.5 2004/09/09 12:21:22 rich Exp $ + * $Id: edit_hostnames.ml,v 1.6 2004/09/23 11:56:47 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 @@ -37,14 +37,14 @@ let run r (q : cgi) (dbh : Dbi.connection) _ host' _ = let { hostname = hostname } = host' in q#redirect ("http://" ^ hostname ^ "/_bin/admin/host.cmo?hostid=" ^ string_of_int hostid); - raise CgiExit + return () ); let canonical_hostname = q#param "canonical_hostname" in let hostnames = try q#param "hostnames" with Not_found -> "" in (* In theory we could verify characters in hostnames, and call - * error / raise CgiExit if the format is incorrect. However + * error / return () if the format is incorrect. However * it's probably best to assume the sysadmin knows what they're up to * here. If this script is allowed to be accessed by untrusted users, * then this has security implications. diff --git a/scripts/cocanwiki.ml b/scripts/cocanwiki.ml index 96cef37..61351d3 100644 --- a/scripts/cocanwiki.ml +++ b/scripts/cocanwiki.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki.ml,v 1.10 2004/09/23 11:51:17 rich Exp $ + * $Id: cocanwiki.ml,v 1.11 2004/09/23 11:56:47 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 @@ -75,6 +75,8 @@ let server_settings_version = *) exception CgiExit +let return () = raise CgiExit + (* Permissions and restrictions. * * Use the optional ~restrict parameter to register_script to restrict diff --git a/scripts/contact.ml b/scripts/contact.ml index a13f60e..ba88f1d 100644 --- a/scripts/contact.ml +++ b/scripts/contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: contact.ml,v 1.2 2004/09/17 15:15:50 rich Exp $ + * $Id: contact.ml,v 1.3 2004/09/23 11:56:47 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,7 +36,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = let fail msg = error ~back_button:true ~title:"Bad form" q (msg ^ " Please contact the owner of the site by email."); - raise CgiExit + return () in (* Get the id field. *) diff --git a/scripts/create.ml b/scripts/create.ml index 9478190..4b4caa6 100644 --- a/scripts/create.ml +++ b/scripts/create.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create.ml,v 1.7 2004/09/21 13:01:15 rich Exp $ + * $Id: create.ml,v 1.8 2004/09/23 11:56:47 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 @@ -40,10 +40,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL -> error ~back_button:true ~title:"Bad page name" q "The page name supplied is too short or invalid."; - raise CgiExit + return () | Wikilib.GenURL_Duplicate url -> q#redirect ("http://" ^ hostname ^ "/" ^ url); - raise CgiExit in + return () in (* Description field must contain something. *) let description = q#param "description" in @@ -51,7 +51,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = error ~back_button:true ~title:"Description field missing" q "You must write a brief description for search engines and directories."; - raise CgiExit + return () ); (* Get the IP address of the user, if available. *) diff --git a/scripts/create_contact.ml b/scripts/create_contact.ml index 85cb4c1..30a531f 100644 --- a/scripts/create_contact.ml +++ b/scripts/create_contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_contact.ml,v 1.1 2004/09/21 15:55:48 rich Exp $ + * $Id: create_contact.ml,v 1.2 2004/09/23 11:56:47 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 @@ -42,20 +42,20 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if name = "" then ( error ~back_button:true ~title:"Name field missing" q "You must name your contact form."; - raise CgiExit + return () ); if subject = "" then ( error ~back_button:true ~title:"Subject line missing" q "You must give a subject line, which appears on contact emails."; - raise CgiExit + return () ); if emails = [] then ( error ~back_button:true ~title:"No email addresses" q ("There are no email addresses listed for this contact form. You " ^ "must list at least one valid email address."); - raise CgiExit + return () ); (* Update the database. *) diff --git a/scripts/create_form.ml b/scripts/create_form.ml index 3205a10..990cfc0 100644 --- a/scripts/create_form.ml +++ b/scripts/create_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_form.ml,v 1.6 2004/09/09 12:21:22 rich Exp $ + * $Id: create_form.ml,v 1.7 2004/09/23 11:56:47 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 @@ -42,10 +42,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL -> error ~back_button:true ~title:"Bad page name" q "The page name supplied is too short or invalid."; - raise CgiExit + return () | Wikilib.GenURL_Duplicate url -> q#redirect ("http://" ^ hostname ^ "/" ^ url); - raise CgiExit in + return () in (* Show the form. *) template#set "title" title; diff --git a/scripts/create_user.ml b/scripts/create_user.ml index 2e08209..5f6be27 100644 --- a/scripts/create_user.ml +++ b/scripts/create_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_user.ml,v 1.2 2004/09/22 10:19:26 rich Exp $ + * $Id: create_user.ml,v 1.3 2004/09/23 11:56:47 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,13 +36,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if username = "" || password1 = "" || password2 = "" then ( error ~back_button:true ~title:"Bad username or password" q "The username or password you gave is empty."; - raise CgiExit + return () ); if password1 <> password2 then ( error ~back_button:true ~title:"Passwords don't match" q "The two passwords you gave aren't identical."; - raise CgiExit + return () ); let password = password1 in @@ -64,7 +64,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#fetch1 (); error ~back_button:true ~title:"Username already taken" q "Someone has already taken that username."; - raise CgiExit + return () with Not_found -> ()); diff --git a/scripts/delete_contact.ml b/scripts/delete_contact.ml index 8f89c14..cfff4a2 100644 --- a/scripts/delete_contact.ml +++ b/scripts/delete_contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_contact.ml,v 1.1 2004/09/21 15:55:49 rich Exp $ + * $Id: delete_contact.ml,v 1.2 2004/09/23 11:56:47 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 @@ -31,7 +31,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = (* Cancel? *) if q#param_true "cancel" then ( q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo"); - raise CgiExit + return () ); (* We can delete multiple contact forms from this script, which is @@ -40,7 +40,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = let ids = List.map int_of_string (q#param_all "delete") in if ids = [] then ( q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo"); - raise CgiExit + return () ); (* Need to check the contact emails all belong to this host. *) diff --git a/scripts/delete_contact_form.ml b/scripts/delete_contact_form.ml index 4692bb9..55a943b 100644 --- a/scripts/delete_contact_form.ml +++ b/scripts/delete_contact_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_contact_form.ml,v 1.1 2004/09/21 15:55:49 rich Exp $ + * $Id: delete_contact_form.ml,v 1.2 2004/09/23 11:56:47 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,7 +36,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = let ids = List.map int_of_string (q#param_all "delete") in if ids = [] then ( q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo"); - raise CgiExit + return () ); let qs = Dbi.placeholders (List.length ids) in diff --git a/scripts/delete_user.ml b/scripts/delete_user.ml index 782c6b0..ab2b8a4 100644 --- a/scripts/delete_user.ml +++ b/scripts/delete_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_user.ml,v 1.1 2004/09/21 13:01:15 rich Exp $ + * $Id: delete_user.ml,v 1.2 2004/09/23 11:56:47 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 @@ -31,7 +31,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} self = if q#param_true "cancel" then ( (* Request cancelled. *) q#redirect ("http://" ^ hostname ^ "/_users"); - raise CgiExit + return () ); let userid = int_of_string (q#param "userid") in @@ -51,7 +51,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} self = | User (id, _, _) when id = userid -> error ~back_button:true ~title:"Delete own account" q "You cannot delete your own user account."; - raise CgiExit + return () | _ -> () in (* Delete the user. *) diff --git a/scripts/delete_user_form.ml b/scripts/delete_user_form.ml index f982f1e..382814a 100644 --- a/scripts/delete_user_form.ml +++ b/scripts/delete_user_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_user_form.ml,v 1.1 2004/09/21 13:01:15 rich Exp $ + * $Id: delete_user_form.ml,v 1.2 2004/09/23 11:56:47 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 @@ -40,7 +40,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = | User (id, _, _) when id = userid -> error ~back_button:true ~title:"Delete own account" q "You cannot delete your own user account."; - raise CgiExit + return () | _ -> () in (* Get this user from the database. *) diff --git a/scripts/edit.ml b/scripts/edit.ml index 00d48ab..5bdf183 100644 --- 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 . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit.ml,v 1.10 2004/09/21 13:01:15 rich Exp $ + * $Id: edit.ml,v 1.11 2004/09/23 11:56:47 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 @@ -382,7 +382,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = template_conflict#set "url" url; q#template template_conflict; - raise CgiExit + return () ); (* Defer the pages_redirect_cn constraint because that would @@ -492,11 +492,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = let id = int_of_string (q#param "id") in if q#param_true "cancel" then ( cancel id; - raise CgiExit + return () ); if q#param_true "save" then ( let ok = try_save () in - if ok then raise CgiExit (* ... else fall through *) + if ok then return () (* ... else fall through *) ); continue_editing () (* Processes the action, if any. *) with diff --git a/scripts/edit_contact.ml b/scripts/edit_contact.ml index 88077e6..18b4a5c 100644 --- a/scripts/edit_contact.ml +++ b/scripts/edit_contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_contact.ml,v 1.1 2004/09/21 18:24:15 rich Exp $ + * $Id: edit_contact.ml,v 1.2 2004/09/23 11:56:47 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 @@ -45,20 +45,20 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if name = "" then ( error ~back_button:true ~title:"Name field missing" q "You must name your contact form."; - raise CgiExit + return () ); if subject = "" then ( error ~back_button:true ~title:"Subject line missing" q "You must give a subject line, which appears on contact emails."; - raise CgiExit + return () ); if emails = [] then ( error ~back_button:true ~title:"No email addresses" q ("There are no email addresses listed for this contact form. You " ^ "must list at least one valid email address."); - raise CgiExit + return () ); (* Need to verify that the contact belongs to the host. *) diff --git a/scripts/edit_host_settings.ml b/scripts/edit_host_settings.ml index d743865..e51f320 100644 --- a/scripts/edit_host_settings.ml +++ b/scripts/edit_host_settings.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_host_settings.ml,v 1.1 2004/09/22 12:04:28 rich Exp $ + * $Id: edit_host_settings.ml,v 1.2 2004/09/23 11:56:47 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 @@ -32,7 +32,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = if q#param_true "cancel" then ( (* Request cancelled. *) q#redirect ("http://" ^ hostname ^ "/_bin/host_menu.cmo"); - raise CgiExit + return () ); (* Get parameters. *) diff --git a/scripts/edit_sitemenu.ml b/scripts/edit_sitemenu.ml index cd1aeb8..38cba43 100644 --- a/scripts/edit_sitemenu.ml +++ b/scripts/edit_sitemenu.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_sitemenu.ml,v 1.4 2004/09/09 12:21:22 rich Exp $ + * $Id: edit_sitemenu.ml,v 1.5 2004/09/23 11:56:47 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 @@ -299,11 +299,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = if q#param_true "inedit" then ( if q#param_true "cancel" then ( cancel (); - raise CgiExit + return () ); if q#param_true "save" then ( let ok = try_save () in - if ok then raise CgiExit (* ... else fall through *) + if ok then return () (* ... else fall through *) ); continue_editing () (* Processes the action, if any. *) ) else diff --git a/scripts/edit_user.ml b/scripts/edit_user.ml index 7f2148e..fb1da46 100644 --- a/scripts/edit_user.ml +++ b/scripts/edit_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_user.ml,v 1.5 2004/09/22 10:19:26 rich Exp $ + * $Id: edit_user.ml,v 1.6 2004/09/23 11:56:47 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 @@ -45,7 +45,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = if name = "" then ( error ~back_button:true ~title:"Bad username" q "The username you gave is empty."; - raise CgiExit + return () ); (* Check it's not a duplicate, then change it. *) @@ -57,7 +57,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = sth#fetch1 (); error ~back_button:true ~title:"Username already taken" q ("That username has already been taken by another user."); - raise CgiExit + return () with Not_found -> ()); @@ -83,7 +83,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ self = q ("You tried to remove 'Manage users' permission from yourself. "^ "You can't do this. You'll have to do it from another "^ "user account."); - raise CgiExit + return () | _ -> ()); let sth = dbh#prepare_cached "update users set email = ?, diff --git a/scripts/forgot_password.ml b/scripts/forgot_password.ml index 0c2ea5f..daa6ebb 100644 --- a/scripts/forgot_password.ml +++ b/scripts/forgot_password.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: forgot_password.ml,v 1.4 2004/09/09 12:21:22 rich Exp $ + * $Id: forgot_password.ml,v 1.5 2004/09/23 11:56:47 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,7 +34,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = if name = "" then ( error ~back_button:true ~title:"No username or email address" q "You didn't give a username or email address"; - raise CgiExit + return () ); (* Look it up in the database. *) diff --git a/scripts/page.ml b/scripts/page.ml index 03c3537..db576c8 100644 --- a/scripts/page.ml +++ b/scripts/page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: page.ml,v 1.17 2004/09/22 10:19:26 rich Exp $ + * $Id: page.ml,v 1.18 2004/09/23 11:56:47 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 @@ -254,7 +254,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {edit_anon=edit_anon} user = error ~title:"Too many redirections" ~back_button:true q ("Too many redirects between pages. This may happen because " ^ "of a cycle of redirections."); - raise CgiExit + return () ) else match fetch_page page' version allow_redirect with | FPOK (pageid, title, description, last_modified_date, has_page_css)-> diff --git a/scripts/restore_form.ml b/scripts/restore_form.ml index 68f47c4..8e18f45 100644 --- a/scripts/restore_form.ml +++ b/scripts/restore_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: restore_form.ml,v 1.7 2004/09/09 12:21:22 rich Exp $ + * $Id: restore_form.ml,v 1.8 2004/09/23 11:56:47 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 @@ -51,7 +51,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if version = old_version then ( error ~back_button:true ~title:"Restoring live version" q "You seem to be trying to restore the live version."; - raise CgiExit + return () ); let diff, _ = get_diff dbh hostid page ~old_version ~version () in diff --git a/scripts/send_feedback.ml b/scripts/send_feedback.ml index 3dc1a1e..6841b71 100644 --- a/scripts/send_feedback.ml +++ b/scripts/send_feedback.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: send_feedback.ml,v 1.1 2004/09/20 17:18:26 rich Exp $ + * $Id: send_feedback.ml,v 1.2 2004/09/23 11:56:47 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,7 +36,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = if q#param_true "cancel" then ( (* Request cancelled. *) q#redirect ("http://" ^ hostname); - raise CgiExit + return () ); (* Get the feedback email for this host. *) diff --git a/scripts/set_password.ml b/scripts/set_password.ml index 5dfbf29..df9c815 100644 --- a/scripts/set_password.ml +++ b/scripts/set_password.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: set_password.ml,v 1.1 2004/09/21 13:01:16 rich Exp $ + * $Id: set_password.ml,v 1.2 2004/09/23 11:56:47 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 @@ -35,7 +35,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if password1 <> password2 then ( error ~back_button:true ~title:"Passwords don't match" q "The two passwords you gave aren't identical."; - raise CgiExit + return () ); let password = password1 in diff --git a/scripts/signup.ml b/scripts/signup.ml index 0c946f5..5e8fc5f 100644 --- a/scripts/signup.ml +++ b/scripts/signup.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: signup.ml,v 1.5 2004/09/09 12:21:22 rich Exp $ + * $Id: signup.ml,v 1.6 2004/09/23 11:56:47 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,13 +48,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if username = "" || password1 = "" || password2 = "" then ( error ~back_button:true ~title:"Bad username or password" q "The username or password you gave is empty."; - raise CgiExit + return () ); if password1 <> password2 then ( error ~back_button:true ~title:"Passwords don't match" q "The two passwords you gave aren't identical."; - raise CgiExit + return () ); let password = password1 in @@ -78,7 +78,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = q ("Someone, possibly you, has already taken that username. " ^ "If you think you have forgotten your password, try going back " ^ "and clicking on the 'Forgotten your password?' link."); - raise CgiExit + return () with Not_found -> ()); diff --git a/scripts/upload_file.ml b/scripts/upload_file.ml index debe893..a6ed439 100644 --- a/scripts/upload_file.ml +++ b/scripts/upload_file.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: upload_file.ml,v 1.6 2004/09/09 12:21:22 rich Exp $ + * $Id: upload_file.ml,v 1.7 2004/09/23 11:56:47 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 @@ -51,14 +51,14 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = Not_found -> error ~title:"No file" ~back_button:true q "No file was uploaded."; - raise CgiExit in + return () in (* Check the name is valid. *) if not (Pcre.pmatch ~rex:file_ok_re name) then ( error ~title:"Bad File Name" ~back_button:true q ("The File Name must contain only lowercase English letters, " ^ "numbers, dots, dashes and underscore."); - raise CgiExit + return () ); (* Identify the MIME type from the extension. *) diff --git a/scripts/upload_image.ml b/scripts/upload_image.ml index 7a0beab..c6d11e2 100644 --- a/scripts/upload_image.ml +++ b/scripts/upload_image.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: upload_image.ml,v 1.6 2004/09/09 12:21:22 rich Exp $ + * $Id: upload_image.ml,v 1.7 2004/09/23 11:56:47 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 @@ -53,7 +53,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = Not_found -> error ~title:"No image" ~back_button:true q "No image was uploaded."; - raise CgiExit in + return () in (* Check the name is valid. *) if not (Pcre.pmatch ~rex:image_ok_re name) then ( @@ -61,7 +61,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = q ("The Image Name must contain only lowercase English letters, " ^ "numbers and underscore. It must end with .jpg, .gif or .png " ^ "depending on the image format."); - raise CgiExit + return () ); (* Check the image is an image, and get the size. *) @@ -72,7 +72,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = error ~title:"Bad image" ~back_button:true q ("Unknown image type. Is the file you uploaded really an " ^ "image?"); - raise CgiExit in + return () in (* Check the image filename extension matches the MIME type. *) let ext_ok = @@ -91,7 +91,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = "For example if the image is in JPEG format, the name must " ^ "be 'something.jpg'. I detected the following image type " ^ "in the file you uploaded: " ^ mime_type); - raise CgiExit + return () ); (* Check some ALT text was supplied. *) @@ -100,7 +100,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = q ("You must supply Alt text describing the image. This is required " ^ "by accessibility laws and to allow search engines to discover the " ^ "content of images."); - raise CgiExit + return () ); let title = if is_whitespace title then `Null else `String title in -- 1.8.3.1