From 0dc92c6f78995331021c3b8c6a889913cf3f7de3 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 3 Nov 2005 11:17:26 +0100 Subject: hidepages configoption This new option accepts a RegExp to filter certain pages from all automatic listings (RSS, recent changes, search results, index). This is useful to exclude certain pages like the ones used in the sitebar templates. The regexp is matched against the full page ID with a leading colon. If it matches the page is assumed to be a hidden one. IMPORTANT: this is not related to ACL. A hidden page is still visible to all users (if not restricted by ACL) when linked or called directly. darcs-hash:20051103101726-6e07b-8d45912a1b4f6cfc9e3fce147c15f84a58ea7ca2.gz --- inc/pageutils.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 1dc66981d..0f9b47e47 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -301,4 +301,28 @@ function getCacheName($data,$ext=''){ return $file; } +/** + * Checks a pageid against $conf['hidepages'] + * + * @author Andreas Gohr + */ +function isHiddenPage($id){ + global $conf; + if(empty($conf['hidepages'])) return false; + + if(preg_match('/'.$conf['hidepages'].'/ui',':'.$id)){ + return true; + } + return false; +} + +/** + * Reverse of isHiddenPage + * + * @author Andreas Gohr + */ +function isVisiblePage($id){ + return !isHiddenPage($id); +} + //Setup VIM: ex: et ts=2 enc=utf-8 : -- cgit v1.2.3