summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2010-11-26 16:54:51 +0100
committerMichael Hamann <michael@content-space.de>2010-11-26 17:02:33 +0100
commit4871414204799044c31aa2764c4b4ca020e2331d (patch)
tree45f1da8ce8c6a99678a395c576e0f0d6cb9ded11
parentd1d99bb9528b5a7ca62b74e60314288602cbd5a0 (diff)
downloadrpg-4871414204799044c31aa2764c4b4ca020e2331d.tar.gz
rpg-4871414204799044c31aa2764c4b4ca020e2331d.tar.bz2
Fix for $conf['breadcrumbs'] < 0, FS#2107
This fixes an infinite loop in breadcrumbs() and makes the behaviors in all places where breadcrumbs are used consistent so that non-numeric values, values < 0 and 0 are treated the same way.
-rw-r--r--doku.php2
-rw-r--r--inc/common.php3
-rw-r--r--inc/template.php2
-rw-r--r--lib/tpl/default/main.php2
4 files changed, 6 insertions, 3 deletions
diff --git a/doku.php b/doku.php
index 1303f1ade..ccab843ee 100644
--- a/doku.php
+++ b/doku.php
@@ -69,7 +69,7 @@ if(!$INFO['exists'] &&
}
//prepare breadcrumbs (initialize a static var)
-if ($conf['breadcrumbs']) breadcrumbs();
+if ($conf['breadcrumbs'] > 0) breadcrumbs();
// check upstream
checkUpdateMessages();
diff --git a/inc/common.php b/inc/common.php
index 18f782788..667846804 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -268,6 +268,9 @@ function breadcrumbs(){
global $ACT;
global $conf;
+ // Prevent infinite loop later in this function
+ if (!is_numeric($conf['breadcrumbs']) || $conf['breadcrumbs'] <= 0) return array();
+
//first visit?
$crumbs = isset($_SESSION[DOKU_COOKIE]['bc']) ? $_SESSION[DOKU_COOKIE]['bc'] : array();
//we only save on show and existing wiki documents
diff --git a/inc/template.php b/inc/template.php
index e2ea6e386..b89f7abbc 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -690,7 +690,7 @@ function tpl_breadcrumbs($sep='&raquo;'){
global $conf;
//check if enabled
- if(!$conf['breadcrumbs']) return false;
+ if(!is_numeric($conf['breadcrumbs']) || $conf['breadcrumbs'] <= 0) return false;
$crumbs = breadcrumbs(); //setup crumb trace
diff --git a/lib/tpl/default/main.php b/lib/tpl/default/main.php
index 754a6e482..c1b62f12e 100644
--- a/lib/tpl/default/main.php
+++ b/lib/tpl/default/main.php
@@ -68,7 +68,7 @@ if (!defined('DOKU_INC')) die();
<div class="clearer"></div>
</div>
- <?php if($conf['breadcrumbs']){?>
+ <?php if($conf['breadcrumbs'] > 0){?>
<div class="breadcrumbs">
<?php tpl_breadcrumbs()?>
<?php //tpl_youarehere() //(some people prefer this)?>