/** * @param Block $b */ public function setPermissionObject($b) { $this->permissionObject = $b; // if the area overrides the collection permissions explicitly (with a one on the override column) we check if ($b->overrideAreaPermissions()) { $this->permissionObjectToCheck = $b; } else { $a = $b->getBlockAreaObject(); if ($a instanceof SubArea && !$a->overrideCollectionPermissions()) { $a = $a->getSubAreaParentPermissionsObject(); } if (is_object($a)) { if ($a->overrideCollectionPermissions()) { $this->permissionObjectToCheck = $a; } elseif ($a->getAreaCollectionInheritID()) { $mcID = $a->getAreaCollectionInheritID(); $mc = Page::getByID($mcID, 'RECENT'); $ma = Area::get($mc, $a->getAreaHandle()); if ($ma->overrideCollectionPermissions()) { $this->permissionObjectToCheck = $ma; } else { $this->permissionObjectToCheck = $ma->getAreaCollectionObject(); } } else { $this->permissionObjectToCheck = $a->getAreaCollectionObject(); } } else { $this->permissionObjectToCheck = Page::getCurrentPage(); } } }
public function getBlockAreaObject() { return parent::getBlockAreaObject(); }
public static function get(Block $b) { $o = null; if ($b->overrideBlockTypeCacheSettings()) { $c = $b->getBlockCollectionObject(); $cID = $c->getCollectionID(); $cvID = $c->getVersionID(); $a = $b->getBlockAreaObject(); $arHandle = $a->getAreaHandle(); if ($a->isGlobalArea()) { // then we need to check against the global area name. We currently have the wrong area handle passed in $arHandle = STACKS_AREA_NAME; } $bID = $b->getBlockID(); $db = Database::get(); $r = $db->GetRow('select * from CollectionVersionBlocksCacheSettings where cID = ? and cvID = ? and arHandle = ? and bID = ?', array($cID, $cvID, $arHandle, $bID)); if ($r['bID']) { $o = new static(); $o->btCacheBlockOutput = (bool) $r['btCacheBlockOutput']; $o->btCacheBlockOutputOnPost = (bool) $r['btCacheBlockOutputOnPost']; $o->btCacheBlockOutputForRegisteredUsers = (bool) $r['btCacheBlockOutputForRegisteredUsers']; $o->btCacheBlockOutputLifetime = $r['btCacheBlockOutputLifetime']; } } if (!isset($o)) { if ($controller = $b->getController()) { $o = new static(); $o->btCacheBlockOutput = $controller->cacheBlockOutput(); $o->btCacheBlockOutputOnPost = $controller->cacheBlockOutputOnPost(); $o->btCacheBlockOutputForRegisteredUsers = $controller->cacheBlockOutputForRegisteredUsers(); $o->btCacheBlockOutputLifetime = $controller->getBlockTypeCacheOutputLifetime(); } else { $o = new static(); $o->btCacheBlockOutput = false; $o->btCacheBlockOutputOnPost = false; $o->btCacheBlockOutputForRegisteredUsers = false; $o->btCacheBlockOutputLifetime = false; } } return $o; }