From 7d01a0eac854c623a74ff7936d5eba9413aefe79 Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Wed, 27 Jun 2012 02:48:49 -0400 Subject: more INPUT wrapper uses: cache purge, sectok, getID --- inc/pageutils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index c94d14624..95f791364 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -19,9 +19,10 @@ * @author Andreas Gohr */ function getID($param='id',$clean=true){ + global $INPUT; global $conf; - $id = isset($_REQUEST[$param]) ? $_REQUEST[$param] : null; + $id = $INPUT->str($param); //construct page id from request URI if(empty($id) && $conf['userewrite'] == 2){ -- cgit v1.2.3 From e66d3e6dfa7ba6f0cf55b58f0b00b66b52c98321 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 1 Jul 2012 11:41:22 +0200 Subject: Improved sidebar inclusion Template authors now can use tpl_sidebar() to include the sidebar. Sidebars can be defined in subnamespaces as well --- 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 c94d14624..f525c44d0 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -622,3 +622,27 @@ function utf8_decodeFN($file){ return urldecode($file); } +/** + * Find a page in the current namespace (determined from $ID) or any + * higher namespace + * + * Used for sidebars, but can be used other stuff as well + * + * @todo add event hook + * @param string $page the pagename you're looking for + * @return string|false the full page id of the found page, false if any + */ +function page_findnearest($page){ + global $ID; + + $ns = $ID; + do { + $ns = getNS($ns); + $pageid = ltrim("$ns:$page",':'); + if(page_exists($pageid)){ + return $pageid; + } + } while($ns); + + return false; +} -- cgit v1.2.3