summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php
index 72f6fde12..251fbcdc3 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -119,18 +119,29 @@ function breadcrumbs(){
$crumbs = array();
}
//we only save on show and existing wiki documents
- if($ACT != 'show' || !@file_exists(wikiFN($ID))){
+ $file = wikiFN($ID);
+ if($ACT != 'show' || !@file_exists($file)){
$_SESSION[$conf['title']]['bc'] = $crumbs;
return $crumbs;
}
+
+ // page names
+ $name = noNS($ID);
+ if ($conf['useheading']) {
+ // get page title
+ $title = getFirstHeading(io_readFile($file));
+ if ($title) {
+ $name = $title;
+ }
+ }
+
//remove ID from array
- $pos = array_search($ID,$crumbs);
- if($pos !== false && $pos !== null){
- array_splice($crumbs,$pos,1);
+ if (isset($crumbs[$ID])) {
+ unset($crumbs[$ID]);
}
//add to array
- $crumbs[] =$ID;
+ $crumbs[$ID] = $name;
//reduce size
while(count($crumbs) > $conf['breadcrumbs']){
array_shift($crumbs);