Check user age limtation
public isOldEnough ( ) : boolean | ||
Résultat | boolean |
/** * @param boolean $retry * * @return Ansel_Gallery */ private function _getGallery($retry = false) { // Make sure we haven't already selected a gallery. if ($this->_gallery instanceof Ansel_Gallery) { return $this->_gallery; } // Get the gallery object and cache it. if (isset($this->_params['gallery']) && $this->_params['gallery'] != '__random') { $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->_params['gallery']); } else { $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getRandomGallery(); } // Protect at least a little bit against getting an empty gallery. We // can't just loop until we get one with images since it's possible we // actually don't *have* any with images yet. if ($this->_params['gallery'] == '__random' && !empty($this->_gallery) && !$this->_gallery->countImages() && $this->_gallery->hasSubGalleries() && !$retry) { $this->_gallery = null; $this->_gallery = $this->_getGallery(true); } if (empty($this->_gallery)) { throw new Horde_Exception_NotFound(_("Gallery does not exist.")); } elseif (!$this->_gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW) || !$this->_gallery->isOldEnough() || $this->_gallery->hasPasswd()) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this gallery.")); } // Return the gallery. return $this->_gallery; }