Ejemplo n.º 1
0
 /**
  * Can this individual be shown?
  *
  * @param int $access_level
  *
  * @return bool
  */
 protected function canShowByType($access_level)
 {
     global $WT_TREE;
     // Dead people...
     if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
         $keep_alive = false;
         $KEEP_ALIVE_YEARS_BIRTH = $this->tree->getPreference('KEEP_ALIVE_YEARS_BIRTH');
         if ($KEEP_ALIVE_YEARS_BIRTH) {
             preg_match_all('/\\n1 (?:' . WT_EVENTS_BIRT . ').*(?:\\n[2-9].*)*(?:\\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 $date = new Date($match[1]);
                 if ($date->isOK() && $date->gregorianYear() + $KEEP_ALIVE_YEARS_BIRTH > date('Y')) {
                     $keep_alive = true;
                     break;
                 }
             }
         }
         $KEEP_ALIVE_YEARS_DEATH = $this->tree->getPreference('KEEP_ALIVE_YEARS_DEATH');
         if ($KEEP_ALIVE_YEARS_DEATH) {
             preg_match_all('/\\n1 (?:' . WT_EVENTS_DEAT . ').*(?:\\n[2-9].*)*(?:\\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 $date = new Date($match[1]);
                 if ($date->isOK() && $date->gregorianYear() + $KEEP_ALIVE_YEARS_DEATH > date('Y')) {
                     $keep_alive = true;
                     break;
                 }
             }
         }
         if (!$keep_alive) {
             return true;
         }
     }
     // Consider relationship privacy (unless an admin is applying download restrictions)
     $user_path_length = $this->tree->getUserPreference(Auth::user(), 'RELATIONSHIP_PATH_LENGTH');
     $gedcomid = $this->tree->getUserPreference(Auth::user(), 'gedcomid');
     if ($gedcomid && $user_path_length && $this->tree->getTreeId() == $WT_TREE->getTreeId() && ($access_level = Auth::accessLevel($this->tree))) {
         return self::isRelated($this, $user_path_length);
     }
     // No restriction found - show living people to members only:
     return Auth::PRIV_USER >= $access_level;
 }
Ejemplo n.º 2
0
 /**
  * Check whether the date is compatible with the Google Chart range (between 1550 and 2030).
  * 
  * @param Date $date
  * @return boolean
  */
 public static function isDateWithinChartsRange(Date $date)
 {
     return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030;
 }