X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Flinks.ml;h=da3a153fbb7937f10b598f8e6e7cf00dba124e83;hb=bfa88724ee152ba00c2b2fca881dd78a6599820a;hp=b9e2aec36f10b01d06ae2663442af8fdd624a79f;hpb=d303f75eed3a09bbe2516d9a2a9a4aa9b862ceb3;p=cocanwiki.git diff --git a/scripts/links.ml b/scripts/links.ml index b9e2aec..da3a153 100644 --- a/scripts/links.ml +++ b/scripts/links.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: links.ml,v 1.2 2004/11/02 18:47:54 rich Exp $ + * $Id: links.ml,v 1.3 2006/03/27 18:09:46 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 @@ open Cocanwiki_links * can show inbound or outbound links only. The format in all cases is a * simple machine-parsable text file. *) -let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = +let run r (q : cgi) dbh hostid _ _ = let template = get_template dbh hostid "links.txt" in if q#param_exists "page" then ( @@ -61,11 +61,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = dbh#prepare_cached "select to_url from links where hostid = ? and from_url = ?" in - sth#execute [`Int hostid; `String page]; + sth#execute [Some hostid; Some page]; q#header ~content_type:"text/plain" (); - sth#iter (function [`String url] -> ignore (print_endline r url) + sth#iter (function [Some url] -> ignore (print_endline r url) | _ -> assert false) ) else @@ -77,10 +77,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = *) let sth = dbh#prepare_cached "select to_url from links where hostid = ? and from_url = ?" in - sth#execute [`Int hostid; `String page]; + sth#execute [Some hostid; Some page]; let table = - sth#map (function [`String to_url] -> + sth#map (function [Some to_url] -> [ "to", Template.VarString to_url ] | _ -> assert false) in let table = @@ -105,9 +105,9 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let sth = dbh#prepare_cached "select from_url, to_url from links where hostid = ?" in - sth#execute [`Int hostid]; + sth#execute [Some hostid]; - sth#iter (function [`String from_url; `String to_url] -> + sth#iter (function [Some from_url; Some to_url] -> add_link from_url to_url | _ -> assert false); @@ -115,9 +115,9 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let sth = dbh#prepare_cached "select url, redirect from pages where hostid = ? and url is not null and redirect is not null" in - sth#execute [`Int hostid]; + sth#execute [Some hostid]; - sth#iter (function [`String url; `String redirect] -> + sth#iter (function [Some url; Some redirect] -> add_link url redirect | _ -> assert false);