summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-10-16 19:52:57 +0000
committerfisharebest <fisharebest@gmail.com>2011-10-16 19:52:57 +0000
commitf5f0ef232dca99c64e0ccfcca0d86b8ed868025f (patch)
tree5101d3ce1b73f3b714dee42e7dcba0066ef1bc4f
parent1772c7c54da1357b24b2c9ffc768359edf6c055e (diff)
downloadwebtrees-f5f0ef232dca99c64e0ccfcca0d86b8ed868025f.tar.gz
webtrees-f5f0ef232dca99c64e0ccfcca0d86b8ed868025f.tar.bz2
webtrees-f5f0ef232dca99c64e0ccfcca0d86b8ed868025f.zip
#815312 - Clipping Cart Error
-rw-r--r--library/WT/GedcomRecord.php36
1 files changed, 24 insertions, 12 deletions
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php
index e6ec44c749..b400153d3c 100644
--- a/library/WT/GedcomRecord.php
+++ b/library/WT/GedcomRecord.php
@@ -36,7 +36,9 @@ class WT_GedcomRecord {
private $gedrec =null; // Raw gedcom text (privatised)
protected $facts =null;
protected $changeEvent=null;
- private $disp =null; // Can we display details of this object
+ private $disp_public=null; // Can we display details of this record to WT_PRIV_PUBLIC
+ private $disp_user =null; // Can we display details of this record to WT_PRIV_USER
+ private $disp_hidden=null; // Can we display details of this record to WT_PRIV_NONE
private $changed =false; // Is this a new record, pending approval
// Cached results from various functions.
@@ -361,18 +363,28 @@ class WT_GedcomRecord {
// Can the details of this record be shown?
public function canDisplayDetails($access_level=WT_USER_ACCESS_LEVEL) {
- // CACHING: this function can take four different parameters,
- // and therefore needs four different caches for the result.
- // However, when we use a non-default value for $access_level,
- // we use that access level exclusively. This happens in
- // 1) downloading a gedcom with privacy filtering
- // 2) downloading a clipping cart with privacy filtering
- // 3) generating a sitemap
- // As a result, we currently need only the one cached value.
- if ($this->disp===null) {
- $this->disp=$this->_canDisplayDetails($access_level);
+ // CACHING: this function can take three different parameters,
+ // and therefore needs three different caches for the result.
+ switch ($access_level) {
+ case WT_PRIV_PUBLIC: // visitor
+ if ($this->disp_public===null) {
+ $this->disp_public=$this->_canDisplayDetails(WT_PRIV_PUBLIC);
+ }
+ return $this->disp_public;
+ case WT_PRIV_USER: // member
+ if ($this->disp_user===null) {
+ $this->disp_user=$this->_canDisplayDetails(WT_PRIV_USER);
+ }
+ return $this->disp_user;
+ case WT_PRIV_NONE: // admin
+ if ($this->disp_none===null) {
+ $this->disp_none=$this->_canDisplayDetails(WT_PRIV_NONE);
+ }
+ return $this->disp_none;
+ default:
+ // Should never get here.
+ return false;
}
- return $this->disp;
}
// Can the name of this record be shown?