- let sth = dbh#prepare_cached "select url from pages
- where hostid = ? and id = ?" in
- sth#execute [`Int hostid; `Int id];
- let url = sth#fetch1string () in
+ let url =
+ if id <> 0 then (
+ let sth = dbh#prepare_cached "select url from pages
+ where hostid = ? and id = ?" in
+ sth#execute [`Int hostid; `Int id];
+ sth#fetch1string ()
+ ) else if q#param "pt_type" = "page" then
+ q#param "pt_value"
+ else
+ (* Create a new page, but the user hits the cancel button. Because
+ * we didn't save where they came from, we now have nowhere to
+ * go. So we redirect to the home page. XXX
+ *)
+ "" in