rendered paste bodyfunction smarty_function_age($params, &$smarty)
{
if (!pnSecAuthAction(0, 'advProfile::', 'Plugin::age.php', ACCESS_READ)) {
return false;
}
extract($params);
unset($params);
if (!isset($uid) || !is_numeric($uid)) {
return false;
}
//
// Inputs
//
$BIRTHDAY = pnUserGetVar('_BIRTHDAY', $uid);
$BIRTHMONTH = pnUserGetVar('_BIRTHMONTH', $uid);
$BIRTHYEAR = pnUserGetVar('_BIRTHYEAR', $uid);
// -----------------
// Begin Code
// -----------------
$Now = mktime( 0, 0, 0, date("n"), date("j"), date("Y") );
$Then = mktime( 0, 0, 0, $BIRTHMONTH, $BIRTHDAY, $BIRTHYEAR );
$age = floor((((($Now - $Then) / 60) / 60) / 24) / 365.25);
//
// Output
//
@include_once('modules/advProfile/pnlang/'.pnVarPrepForOS(pnUserGetLang()).'/age.php');
if (isset($assign)) {
$smarty->assign($assign, $age);
} else {
return $age;
}
}