This patch adds the feature of "Hidden sites" to antville 1.1. A "hidden site" is not password protected but should not be easy to locate to the general public. Hidden sites are not linked form the sites main index and are protected from spiders via the robots.txt file. If hidden sites are activated in antville's main preferences administrators of trusted sites can activate the hiding feature in their site's preferences. Untrusted sites can't change their hiding preferences. Hidden sites are useful if you want data to be easily accessible (e.g. for your grandparents) but don't want it to end up somewhere in search engines, Web archives or easily locatable for just everybody (e.g. because you site contains stories of you children which might they consider embarrassing when in 10 years their schoolmates start digging them out). A more hackish variant of this patch was successfully in use for more than a year. To use it you have to change the database structure of your antville database slightly by executing alter table AV_SITE add column SITE_ISHIDDEN tinyint(1) null; at the SQL prompt. See also http://blogs.23.nu/c0re/stories/5340/ --Maximillian Dornseif diff -rbBuN apps/antville-orig/Root/renderFunctions.js apps/antville/Root/renderFunctions.js --- apps/antville-orig/Root/renderFunctions.js Sun Nov 21 20:31:41 2004 +++ apps/antville/Root/renderFunctions.js Mon Nov 22 09:27:09 2004 @@ -32,7 +32,7 @@ res.push(); while (cnt < limit && idx < size) { var s = collection.get(idx++); - if (!s.blocked && s.online) { + if (!s.blocked && !s.hidden && s.online) { s.renderSkin("preview"); cnt++; } diff -rbBuN apps/antville-orig/Root/robots.txt.hac apps/antville/Root/robots.txt.hac --- apps/antville-orig/Root/robots.txt.hac Thu Jan 1 01:00:00 1970 +++ apps/antville/Root/robots.txt.hac Mon Nov 22 11:57:11 2004 @@ -0,0 +1,20 @@ +/* robots.txt support for Helma/Antville + + Based on http://blogs.23.nu/c0re/stories/213/ + --md@hudora.de 2004 +*/ + +res.contentType = "text/plain"; + +var param = new Object(); + +param = new Object(); +res.write("User-agent: *\n"); + +var size = root.size(); +for (var i=0;i<% site.online as="editor" %> + +Public sites can be accessed by everyone, non-public +sites can be accessed only by registered subscribers of this site. + +<% site.hiding %> + Allow comments: <% site.hasdiscussions as="editor" %> diff -rbBuN apps/antville-orig/Site/hiding.skin apps/antville/Site/hiding.skin --- apps/antville-orig/Site/hiding.skin Thu Jan 1 01:00:00 1970 +++ apps/antville/Site/hiding.skin Mon Nov 22 10:18:04 2004 @@ -0,0 +1,8 @@ + +Hide site: +<% site.hide as="editor" %> + + + +Hidden sites do not appear on the global index and are added to the robots.txt files to bar searchengines from accessing it. + diff -rbBuN apps/antville-orig/Site/macros.js apps/antville/Site/macros.js --- apps/antville-orig/Site/macros.js Sun Nov 21 20:31:41 2004 +++ apps/antville/Site/macros.js Mon Nov 22 10:09:30 2004 @@ -569,6 +569,34 @@ /** + * macro rendering hiding + */ +function hide_macro(param) { + if (param.as == "editor") { + var inputParam = this.createCheckBoxParam("hidden", param); + if (req.data.save && !req.data.hidden) + delete inputParam.checked; + Html.checkBox(inputParam); + } else if (this.hidden) + res.write(param.yes ? param.yes : getMessage("generic.yes")); + else + res.write(param.no ? param.no : getMessage("generic.no")); + return; +} + + + +/** + * macro rendering hiding settings if enabled + */ +function hiding_macro(param) { + if (this.isHidingEnabled()) + this.renderSkin("hiding"); + return; +} + + +/** * render generic preference editor or value */ function preferences_macro(param) { diff -rbBuN apps/antville-orig/Site/objectFunctions.js apps/antville/Site/objectFunctions.js --- apps/antville-orig/Site/objectFunctions.js Sun Nov 21 20:31:41 2004 +++ apps/antville/Site/objectFunctions.js Mon Nov 22 09:37:11 2004 @@ -10,10 +10,11 @@ this.creator = creator; this.createtime = this.lastoffline = new Date(); this.email = creator.email; - this.online = 0; + this.online = 1; this.blocked = 0; + this.hidden = 0; this.trusted = creator.trusted; - this.enableping = 0; + this.enableping = 1; // create initial preferences var prefs = new HopObject(); @@ -21,14 +22,14 @@ prefs.discussions = 1; prefs.usercontrib = 0; prefs.archive = 1; - prefs.days = 3; + prefs.days = 5; // retrieve locale-object from root var loc = root.getLocale(); prefs.language = loc.getLanguage(); prefs.country = loc.getCountry(); prefs.timezone = root.getTimeZone().getID(); prefs.longdateformat = "EEEE, dd. MMMM yyyy, h:mm a"; - prefs.shortdateformat = "yyyy.MM.dd, HH:mm"; + prefs.shortdateformat = "yyyy-MM-dd, HH:mm"; this.preferences_xml = Xml.writeToString(prefs); return this; } @@ -211,6 +212,17 @@ */ function isNotificationEnabled() { if (root.sys_allowEmails == 1 || root.sys_allowEmails == 2 && this.trusted) + return true; + return false; +} + +/** + * basic check if hiding is enabled for a site + * @param Obj site object + * @return Boolean true if notification is enabled, false otherwise + */ +function isHidingEnabled() { + if (root.sys_allowHiding == 1 && this.trusted) return true; return false; } diff -rbBuN apps/antville-orig/Site/sysmgr_macros.js apps/antville/Site/sysmgr_macros.js --- apps/antville-orig/Site/sysmgr_macros.js Sun Nov 21 20:31:41 2004 +++ apps/antville/Site/sysmgr_macros.js Mon Nov 22 10:29:17 2004 @@ -31,6 +31,8 @@ return; if (this.trusted) res.write("TRUSTED"); + if (this.hidden) + res.write("HIDDEN"); if (!this.online) res.write("PRIVATE"); else diff -rbBuN apps/antville-orig/Site/type.properties apps/antville/Site/type.properties --- apps/antville-orig/Site/type.properties Sun Nov 21 20:31:41 2004 +++ apps/antville/Site/type.properties Mon Nov 22 09:16:26 2004 @@ -19,6 +19,7 @@ diskusage = SITE_DISKUSAGE blocked = SITE_ISBLOCKED trusted = SITE_ISTRUSTED +hidden = SITE_ISHIDDEN createtime = SITE_CREATETIME modifytime = SITE_MODIFYTIME diff -rbBuN apps/antville-orig/SysMgr/objectFunctions.js apps/antville/SysMgr/objectFunctions.js --- apps/antville-orig/SysMgr/objectFunctions.js Sun Nov 21 20:31:41 2004 +++ apps/antville/SysMgr/objectFunctions.js Mon Nov 22 09:54:58 2004 @@ -228,6 +228,8 @@ root.longdateformat = param.longdateformat ? param.longdateformat : null; // short dateformat root.shortdateformat = param.shortdateformat ? param.shortdateformat : null; + // allow hiding + root.sys_allowHiding = param.sys_allowHiding ? true : false; // allow file root.sys_allowFiles = param.sys_allowFiles ? true : false; // disk quota diff -rbBuN apps/antville-orig/SysMgr/setup.skin apps/antville/SysMgr/setup.skin --- apps/antville-orig/SysMgr/setup.skin Sun Nov 21 20:31:41 2004 +++ apps/antville/SysMgr/setup.skin Mon Nov 22 10:12:16 2004 @@ -44,6 +44,10 @@ <% root.shortdateformat as="chooser" width="20" %> +Allow hidden sites: +<% root.sys_allowHiding as="editor" %>
This allows trusted sites to be set to 'hidden'. Hidden sites don't appear in the list of sites on the startpage and adds them to a robots.txt file. + + Allow files: <% root.sys_allowFiles as="editor" %>
Enabling this means that users can upload files. diff -rbBuN apps/antville-orig/antville_dbpatch-20041122-hiding.sql apps/antville/antville_dbpatch-20041122-hiding.sql --- apps/antville-orig/antville_dbpatch-20041122-hiding.sql Thu Jan 1 01:00:00 1970 +++ apps/antville/antville_dbpatch-20041122-hiding.sql Mon Nov 22 10:18:04 2004 @@ -0,0 +1,3 @@ +use antville; + +alter table AV_SITE add column SITE_ISHIDDEN tinyint(1) null;