00-TEMPLATE.cmo: cocanwiki.cmo cocanwiki_template.cmi
00-TEMPLATE.cmx: cocanwiki.cmx cocanwiki_template.cmx
-cgi_expires.cmo: cocanwiki_date.cmo
-cgi_expires.cmx: cocanwiki_date.cmx
change_password.cmo: cocanwiki.cmo cocanwiki_ok.cmo
change_password.cmx: cocanwiki.cmx cocanwiki_ok.cmx
change_password_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
edit_user.cmx: cocanwiki.cmx cocanwiki_ok.cmx cocanwiki_strings.cmx
edit_user_form.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_template.cmi
edit_user_form.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_template.cmx
-file.cmo: cgi_expires.cmo cocanwiki.cmo
-file.cmx: cgi_expires.cmx cocanwiki.cmx
+file.cmo: cocanwiki.cmo
+file.cmx: cocanwiki.cmx
files.cmo: cocanwiki.cmo cocanwiki_template.cmi
files.cmx: cocanwiki.cmx cocanwiki_template.cmx
forgot_password.cmo: cocanwiki.cmo cocanwiki_ok.cmo cocanwiki_strings.cmo
history.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_template.cmx
host_menu.cmo: cocanwiki.cmo cocanwiki_template.cmi
host_menu.cmx: cocanwiki.cmx cocanwiki_template.cmx
-hoststyle.cmo: cgi_expires.cmo cocanwiki.cmo cocanwiki_template.cmi
-hoststyle.cmx: cgi_expires.cmx cocanwiki.cmx cocanwiki_template.cmx
-image.cmo: cgi_expires.cmo cocanwiki.cmo
-image.cmx: cgi_expires.cmx cocanwiki.cmx
+hoststyle.cmo: cocanwiki.cmo cocanwiki_template.cmi
+hoststyle.cmx: cocanwiki.cmx cocanwiki_template.cmx
+image.cmo: cocanwiki.cmo
+image.cmx: cocanwiki.cmx
images.cmo: cocanwiki.cmo cocanwiki_template.cmi
images.cmx: cocanwiki.cmx cocanwiki_template.cmx
largest_pages.cmo: cocanwiki.cmo cocanwiki_template.cmi
cocanwiki_template.cmi
mailing_list_view.cmx: cocanwiki.cmx cocanwiki_date.cmx \
cocanwiki_template.cmx
-page.cmo: cocanwiki.cmo cocanwiki_cgi_args.cmo cocanwiki_date.cmo \
- cocanwiki_ok.cmo cocanwiki_server_settings.cmo cocanwiki_template.cmi \
- wikilib.cmi
-page.cmx: cocanwiki.cmx cocanwiki_cgi_args.cmx cocanwiki_date.cmx \
- cocanwiki_ok.cmx cocanwiki_server_settings.cmx cocanwiki_template.cmx \
- wikilib.cmx
+page.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_ok.cmo \
+ cocanwiki_server_settings.cmo cocanwiki_template.cmi wikilib.cmi
+page.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_ok.cmx \
+ cocanwiki_server_settings.cmx cocanwiki_template.cmx wikilib.cmx
page_email_confirm.cmo: cocanwiki.cmo cocanwiki_ok.cmo
page_email_confirm.cmx: cocanwiki.cmx cocanwiki_ok.cmx
page_email_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
cocanwiki_template.cmx
page_email_unsubscribe.cmo: cocanwiki.cmo cocanwiki_ok.cmo
page_email_unsubscribe.cmx: cocanwiki.cmx cocanwiki_ok.cmx
-pagestyle.cmo: cgi_expires.cmo cocanwiki.cmo
-pagestyle.cmx: cgi_expires.cmx cocanwiki.cmx
+pagestyle.cmo: cocanwiki.cmo
+pagestyle.cmx: cocanwiki.cmx
preview.cmo: cocanwiki.cmo wikilib.cmi
preview.cmx: cocanwiki.cmx wikilib.cmx
recent.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_template.cmi
# Makefile for COCANWIKI.
-# $Id: Makefile,v 1.27 2004/09/25 16:05:03 rich Exp $
+# $Id: Makefile,v 1.28 2004/09/27 12:37:54 rich Exp $
include ../Makefile.config
CPP := cpp
LIB_OBJS := \
- cocanwiki_cgi_args.cmo \
cocanwiki_date.cmo \
cocanwiki_version.cmo \
cocanwiki_files.cmo \
cocanwiki.cmo \
cocanwiki_diff.cmo \
cocanwiki_emailnotify.cmo \
- wikilib.cmo \
- cgi_expires.cmo
+ wikilib.cmo
OBJS := 00-TEMPLATE.cmo \
change_password.cmo \
+++ /dev/null
-(* COCANWIKI - a wiki written in Objective CAML.
- * Written by Richard W.M. Jones <rich@merjis.com>.
- * Copyright (C) 2004 Merjis Ltd.
- * $Id: cgi_expires.ml,v 1.3 2004/09/09 12:21:22 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *)
-
-open Apache
-open Registry
-open Cgi
-
-open Printf
-
-open Cocanwiki_date
-
-(* This library should eventually be integrated with mod_caml. XXX *)
-
-(* Expires headers.
- *
- * All content on wiki sites is dynamic, but we try to make it look static
- * for users and search engines. We have 4 types of 'Expires' headers that
- * we can send:
- *
- * expires_past ()
- * Send an expiry header in the past (theoretically removing content from
- * caches).
- * expires_short ()
- * Send a short expiry header (now + 5 minutes). This should be used for
- * all news pages.
- * expires_medium ()
- * Send a medium-term expiry header (now + 24 hours). This should be used
- * for all "static" content.
- * expires_long ()
- * Send a very long expiry header (now + 2 years). This should be used for
- * content which really never will change.
- *)
-let expires_past, expires_short, expires_medium, expires_long =
- let make offset =
- let t = Unix.time () in
- let tm = Unix.gmtime (t +. float offset) in
- sprintf "%s, %02d %s %04d %02d:%02d:%02d GMT"
- (short_weekday tm.Unix.tm_wday)
- tm.Unix.tm_mday
- (short_month (tm.Unix.tm_mon + 1))
- (tm.Unix.tm_year + 1900)
- tm.Unix.tm_hour
- tm.Unix.tm_min
- tm.Unix.tm_sec
- in
- let mins m = m * 60 in
- let days d = d * 86400 in
- (fun () -> make (mins (-5))),
- (fun () -> make (mins 5)),
- (fun () -> make (days 1)),
- (fun () -> make (days (365*2)))
(* 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.12 2004/09/23 15:16:21 rich Exp $
+ * $Id: cocanwiki.ml,v 1.13 2004/09/27 12:37:54 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 _get_dbh r = Pool.get r "cocanwiki"
-(* The [CgiExit] exception should be folded back into the base
- * mod_caml code at some point. It just causes the 'run' function to
- * return at that point safely. (XXX)
- *)
-exception CgiExit
-
-let return () = raise CgiExit
-
(* Permissions and restrictions.
*
* Use the optional ~restrict parameter to register_script to restrict
if permitted then (
(* Call the actual CGI script. *)
- try
- run r q dbh hostid host user
- with
- CgiExit -> ()
+ run r q dbh hostid host user
) else
error ~back_button:true
~title:"Access denied"
+++ /dev/null
-(* COCANWIKI - a wiki written in Objective CAML.
- * Written by Richard W.M. Jones <rich@merjis.com>.
- * Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_cgi_args.ml,v 1.1 2004/09/24 10:44:55 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * This badly needs to become a standard part of the Cgi library.
- *)
-
-let split1_re = Pcre.regexp "\\?"
-let split2_re = Pcre.regexp "&"
-let split3_re = Pcre.regexp "="
-
-let parse full_url =
- let url, qs = match Pcre.split ~rex:split1_re ~max:2 full_url with
- | [url] | [url;""] -> url, None
- | [url;qs] -> url, Some qs
- | _ -> assert false in
- let args = match qs with
- None -> []
- | Some qs ->
- let args = Pcre.split ~rex:split2_re qs in
- let f arg =
- match Pcre.split ~rex:split3_re ~max:2 arg with
- | [] -> ("", "")
- | [key] -> (key, "")
- | [key;value] -> (key, value)
- | _ -> assert false
- in
- List.map f args in
- url, qs, args
(* 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.4 2004/09/25 12:53:55 rich Exp $
+ * $Id: contact.ml,v 1.5 2004/09/27 12:37:54 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 name =
try q#param "id"
with
- Not_found -> fail "The 'name' field is missing in that form." in
+ Not_found ->
+ fail "The 'name' field is missing in that form." in
(* Get the contacts / emails from the database. *)
let sth = dbh#prepare_cached "select id, subject from contacts
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: file.ml,v 1.5 2004/09/09 12:21:22 rich Exp $
+ * $Id: file.ml,v 1.6 2004/09/27 12:37:54 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 <> None then
(* Set a medium-length expiry time on this resource. *)
- Table.set (Request.headers_out r) "Expires" (Cgi_expires.expires_medium());
+ Table.set (Request.headers_out r) "Expires" (Expires.medium ());
q#header ~content_type:mime_type ();
print_string r data
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: hoststyle.ml,v 1.4 2004/09/09 12:21:22 rich Exp $
+ * $Id: hoststyle.ml,v 1.5 2004/09/27 12:37:54 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
* people will need to hit [Shift]+Reload, I'm going to set a
* medium-length expiry time on this resource.
*)
- Table.set (Request.headers_out r) "Expires" (Cgi_expires.expires_medium ());
+ Table.set (Request.headers_out r) "Expires" (Expires.medium ());
q#header ~content_type:"text/css" ();
print_string r css
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: image.ml,v 1.5 2004/09/09 12:21:22 rich Exp $
+ * $Id: image.ml,v 1.6 2004/09/27 12:37:54 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 <> None then
(* Set a medium-length expiry time on this resource. *)
- Table.set (Request.headers_out r) "Expires" (Cgi_expires.expires_medium());
+ Table.set (Request.headers_out r) "Expires" (Expires.medium ());
q#header ~content_type:mime_type ();
print_string r data
(* 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.21 2004/09/24 16:30:07 rich Exp $
+ * $Id: page.ml,v 1.22 2004/09/27 12:37:54 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 search_terms_from_referer referer =
let _, argnames =
List.find (fun (rex, _) -> Pcre.pmatch ~rex referer) search_engines in
- let _, _, args = Cocanwiki_cgi_args.parse referer in
+ let args = Cgi_args.parse referer in
let argname =
List.find (fun argname -> List.mem_assoc argname args) argnames in
let search_string = List.assoc argname args in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: pagestyle.ml,v 1.4 2004/09/09 12:21:22 rich Exp $
+ * $Id: pagestyle.ml,v 1.5 2004/09/27 12:37:54 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
* people will need to hit [Shift]+Reload, I'm going to set a
* medium-length expiry time on this resource.
*)
- Table.set (Request.headers_out r) "Expires" (Cgi_expires.expires_medium ());
+ Table.set (Request.headers_out r) "Expires" (Expires.medium ());
q#header ~content_type:"text/css" ();
print_string r css