(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
(* 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.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
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.
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
*)
exception CgiExit
+let return () = raise CgiExit
+
(* Permissions and restrictions.
*
* Use the optional ~restrict parameter to register_script to restrict
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
| 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
| 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;
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
sth#fetch1 ();
error ~back_button:true ~title:"Username already taken"
q "Someone has already taken that username.";
- raise CgiExit
+ return ()
with
Not_found -> ());
(* 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.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
(* 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
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. *)
(* 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.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
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
(* 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.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
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
| 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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
| 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. *)
(* 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.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
template_conflict#set "url" url;
q#template template_conflict;
- raise CgiExit
+ return ()
);
(* Defer the pages_redirect_cn constraint because that would
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
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
(* 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.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
if q#param_true "cancel" then (
(* Request cancelled. *)
q#redirect ("http://" ^ hostname ^ "/_bin/host_menu.cmo");
- raise CgiExit
+ return ()
);
(* Get parameters. *)
(* 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.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
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
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
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 -> ());
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 = ?,
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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)->
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
(* 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.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
if q#param_true "cancel" then (
(* Request cancelled. *)
q#redirect ("http://" ^ hostname);
- raise CgiExit
+ return ()
);
(* Get the feedback email for this host. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
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 -> ());
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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 (
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. *)
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 =
"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. *)
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