From 591dad4597f28e469a054a900cb3d52e7cc0b56f Mon Sep 17 00:00:00 2001 From: rich Date: Sun, 10 Oct 2004 16:29:23 +0000 Subject: [PATCH] Couple of critical bug fixes. Bumped version for release. --- debian/changelog | 2 +- scripts/page.ml | 30 +++++++++++++++++------------- templates/page.html | 4 ++++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1769f76..9f83c52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.2.1-4) unstable; urgency=low +cocanwiki (1.2.1-5) unstable; urgency=low * Initial Release. diff --git a/scripts/page.ml b/scripts/page.ml index 9a4e8da..e301cae 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.28 2004/10/10 16:14:43 rich Exp $ + * $Id: page.ml,v 1.29 2004/10/10 16:29:23 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 @@ -279,18 +279,20 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid t#set "username" username); (* If logged in, we want to update the recently_visited table. *) - (match user with - | User (userid, _, _) -> - let sth = dbh#prepare_cached "delete from recently_visited - where hostid = ? and userid = ? - and url = ?" in - sth#execute [`Int hostid; `Int userid; `String page']; - let sth = dbh#prepare_cached - "insert into recently_visited (hostid, userid, url) - values (?, ?, ?)" in - sth#execute [`Int hostid; `Int userid; `String page']; - dbh#commit () - | _ -> ()); + if pageid <> None then ( + match user with + | User (userid, _, _) -> + let sth = dbh#prepare_cached "delete from recently_visited + where hostid = ? and userid = ? + and url = ?" in + sth#execute [`Int hostid; `Int userid; `String page']; + let sth = dbh#prepare_cached + "insert into recently_visited (hostid, userid, url) + values (?, ?, ?)" in + sth#execute [`Int hostid; `Int userid; `String page']; + dbh#commit () + | _ -> () + ); (* Navigation links. *) if navigation then ( @@ -331,9 +333,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid "title", Template.VarString title ] in let table = List.map f wlh in t#table "what_links_here" table; + t#conditional "has_what_links_here" (wlh <> []); let table = List.map f rv in t#table "recently_visited" table; + t#conditional "has_recently_visited" (rv <> []); ); (* If we are coming from a search engine then we want to highlight diff --git a/templates/page.html b/templates/page.html index 9ab6f77..1fcea3f 100644 --- a/templates/page.html +++ b/templates/page.html @@ -112,16 +112,20 @@ ::if(navigation):: ::end:: -- 1.8.3.1