Example #1
0
 protected function canShowByType($access_level)
 {
     global $SHOW_DEAD_PEOPLE, $KEEP_ALIVE_YEARS_BIRTH, $KEEP_ALIVE_YEARS_DEATH;
     // Dead people...
     if ($SHOW_DEAD_PEOPLE >= $access_level && $this->isDead()) {
         $keep_alive = false;
         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 WT_Date($match[1]);
                 if ($date->isOK() && $date->gregorianYear() + $KEEP_ALIVE_YEARS_BIRTH > date('Y')) {
                     $keep_alive = true;
                     break;
                 }
             }
         }
         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 WT_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)
     if (WT_USER_GEDCOM_ID && WT_USER_PATH_LENGTH && $this->getGedcomId() == WT_GED_ID && ($access_level = WT_USER_ACCESS_LEVEL)) {
         return self::isRelated($this, WT_USER_PATH_LENGTH);
     }
     // No restriction found - show living people to members only:
     return WT_PRIV_USER >= $access_level;
 }