(* An RSS feed reader function.
- * $Id: cocanwiki_func_rss.ml,v 1.1 2006/12/07 17:05:47 rich Exp $
+ * $Id: cocanwiki_func_rss.ml,v 1.2 2006/12/07 17:16:17 rich Exp $
*)
open Printf
* description Blog description
* items Items in the feed
* item_title Title of items
+ * item_date Date and time of items
* item_link Link to items
* item_description Description of items
* Default is everything.
exception Error of string
type show = Title | Link | Description
- | Items | Item_title | Item_link | Item_description
+ | Items | Item_title | Item_date | Item_link | Item_description
let default_show = [ Title; Link; Description;
- Items; Item_title; Item_link; Item_description ]
+ Items; Item_title; Item_date;
+ Item_link; Item_description ]
let event_system = Unixqueue.create_unix_event_system ()
let connection =
*)
let rows =
PGSQL(dbh) "select enable_rss_func from hosts where id = $hostid" in
- if rows <> [Some true] then
+ if rows <> [true] then
raise (Error "RSS is disabled on this host. You have to enable it manually by setting enable_rss_func for the relevant row in the hosts table. RSS introduces a potential security hole (cross-site scripting) and should not be used where you have untrusted editors or with untrusted RSS feeds.");
let arg = match arg with
| "description" -> Description
| "items" -> Items
| "item_title" -> Item_title
+ | "item_date" -> Item_date
| "item_link" -> Item_link
| "item_description" -> Item_description
| str ->
template#conditional "show_description" false;
template#conditional "show_items" false;
template#conditional "show_item_title" false;
+ template#conditional "show_item_date" false;
template#conditional "show_item_link" false;
template#conditional "show_item_description" false;
List.iter (
| Description -> template#conditional "show_description" true
| Items -> template#conditional "show_items" true
| Item_title -> template#conditional "show_item_title" true
+ | Item_date -> template#conditional "show_item_date" true
| Item_link -> template#conditional "show_item_link" true
| Item_description -> template#conditional "show_item_description" true
) show;