public function isOldEnough()
{
global $session;
if ($GLOBALS['registry']->getAuth() && $this->get('owner') == $GLOBALS['registry']->getAuth() || empty($GLOBALS['conf']['ages']['limits']) || !$this->get('age')) {
return true;
}
// Do we have the user age already cheked?
if (!$session->exists('ansel', 'user_age')) {
$session->set('ansel', 'user_age', 0);
$user_age = 0;
} else {
$user_age = $session->get('ansel', 'user_age');
if ($user_age >= $this->get('age')) {
return true;
}
}
// Can we hook user's age?
if ($GLOBALS['conf']['ages']['hook'] && $GLOBALS['registry']->isAuthenticated()) {
try {
$result = Horde::callHook('user_age', array(), 'ansel');
} catch (Horde_Exception_HookNotSet $e) {
}
if (is_int($result)) {
$session->set('ansel', 'user_age', $result);
$user_age = $result;
}
}
return $user_age >= $this->get('age');
}