Added a Duplicate page function.
[cocanwiki.git] / scripts / orphans.ml
index cddc0fe..efaca52 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: orphans.ml,v 1.4 2006/03/28 13:20:00 rich Exp $
+ * $Id: orphans.ml,v 1.6 2006/12/06 09:46:57 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,7 +28,7 @@ open Cocanwiki
 open Cocanwiki_template
 
 let run r (q : cgi) dbh hostid _ _ =
-  let template = get_template dbh hostid "orphans.html" in
+  let template = get_template dbh hostid "orphans.html" in
 
   (* Start with the front page, the contents of the site menu and the
    * special "copyright" page.
@@ -56,7 +56,7 @@ let run r (q : cgi) dbh hostid _ _ =
     let border' =
       PGSQL(dbh) "select distinct to_url from links
                    where hostid = $hostid and from_url in $@border
-                              and to_url not in $@pages')" in
+                     and to_url not in $@pages'" in
     if border' = [] then pages'
     else loop pages' border'
   in
@@ -72,8 +72,9 @@ let run r (q : cgi) dbh hostid _ _ =
 
   let table =
     List.map (fun (page, title) ->
-              [ "page", Template.VarString page;
-                "title", Template.VarString title ]) rows in
+               let page = Option.get page in
+               [ "page", Template.VarString page;
+                 "title", Template.VarString title ]) rows in
 
   template#table "pages" table;