summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorMartin Doucha <next_ghost@quick.cz>2012-07-06 14:02:10 +0200
committerMartin Doucha <next_ghost@quick.cz>2012-07-06 14:02:10 +0200
commit27849ebfc6b61fbb42ec6deb9c99ff548c40b4ac (patch)
tree5c231dfd7978a65522f56fd3be29bfe9679a64a7 /inc/pageutils.php
parent3fb0e07d018fc6c8d173bd4a8a58c77ba00290fb (diff)
parent4ba05e11e88dd654689b0f6333b1427e03d1b0fe (diff)
downloadrpg-27849ebfc6b61fbb42ec6deb9c99ff548c40b4ac.tar.gz
rpg-27849ebfc6b61fbb42ec6deb9c99ff548c40b4ac.tar.bz2
Merge branch 'master' of git://github.com/splitbrain/dokuwiki
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index c94d14624..5e741c491 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -19,9 +19,10 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
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){
@@ -622,3 +623,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;
+}