summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-06-20 11:03:23 +0000
committerfisharebest <fisharebest@gmail.com>2010-06-20 11:03:23 +0000
commite0c6d35d1258ffa85dc7a5892082073e46e4173a (patch)
treefff27f8a5c48f180dd22dfb432b2857ef7a6ed72 /includes
parent772c70240c6c1edf92f2b49d9546dba2c5a22acf (diff)
downloadwebtrees-e0c6d35d1258ffa85dc7a5892082073e46e4173a.tar.gz
webtrees-e0c6d35d1258ffa85dc7a5892082073e46e4173a.tar.bz2
webtrees-e0c6d35d1258ffa85dc7a5892082073e46e4173a.zip
Diffstat (limited to 'includes')
-rw-r--r--includes/classes/class_date.php4
-rw-r--r--includes/classes/class_person.php2
-rw-r--r--includes/classes/class_stats.php2
-rw-r--r--includes/functions/functions_date.php14
-rw-r--r--includes/functions/functions_print_lists.php4
-rw-r--r--includes/functions/functions_privacy.php14
-rw-r--r--includes/session.php9
7 files changed, 17 insertions, 32 deletions
diff --git a/includes/classes/class_date.php b/includes/classes/class_date.php
index 442c8e6c3e..0f5d1aeffc 100644
--- a/includes/classes/class_date.php
+++ b/includes/classes/class_date.php
@@ -1691,7 +1691,7 @@ class GedcomDate {
static function GetAgeYears($d1, $d2=null, $warn_on_negative=true) {
if (!is_object($d1)) return;
if (!is_object($d2))
- return $d1->date1->GetAge(false, client_jd(), $warn_on_negative );
+ return $d1->date1->GetAge(false, WT_CLIENT_JD, $warn_on_negative );
else
return $d1->date1->GetAge(false, $d2->MinJD(), $warn_on_negative);
}
@@ -1700,7 +1700,7 @@ class GedcomDate {
// Return a gedcom style age string: "1y 2m 3d" (for fact details)
static function GetAgeGedcom($d1, $d2=null, $warn_on_negative=true) {
if (is_null($d2)) {
- return $d1->date1->GetAge(true, client_jd(), $warn_on_negative);
+ return $d1->date1->GetAge(true, WT_CLIENT_JD, $warn_on_negative);
} else {
// If dates overlap, then can't calculate age.
if (GedcomDate::Compare($d1, $d2)) {
diff --git a/includes/classes/class_person.php b/includes/classes/class_person.php
index bc6db24149..f404aeabf3 100644
--- a/includes/classes/class_person.php
+++ b/includes/classes/class_person.php
@@ -427,7 +427,7 @@ class Person extends GedcomRecord {
if ($tmp->MinJD()) {
global $MAX_ALIVE_AGE;
$tmp2=$tmp->AddYears($MAX_ALIVE_AGE, 'bef');
- if ($tmp2->MaxJD()<server_jd()) {
+ if ($tmp2->MaxJD()<WT_SERVER_JD) {
$this->_getEstimatedDeathDate=$tmp2;
} else {
$this->_getEstimatedDeathDate=new GedcomDate(''); // always return a date object
diff --git a/includes/classes/class_stats.php b/includes/classes/class_stats.php
index f5d52d1173..a9e2be126b 100644
--- a/includes/classes/class_stats.php
+++ b/includes/classes/class_stats.php
@@ -1558,7 +1558,7 @@ class stats {
$top10 = array();
foreach ($rows as $row) {
$person=Person::getInstance($row['id']);
- $age = (client_jd()-$row['age']);
+ $age = (WT_CLIENT_JD-$row['age']);
if (floor($age/365.25)>0) {
$age = floor($age/365.25).'y';
} else if (floor($age/12)>0) {
diff --git a/includes/functions/functions_date.php b/includes/functions/functions_date.php
index d1584709a0..9bdf507e7f 100644
--- a/includes/functions/functions_date.php
+++ b/includes/functions/functions_date.php
@@ -127,20 +127,6 @@ function format_timestamp($time) {
}
////////////////////////////////////////////////////////////////////////////////
-// Get the current julian day on the server
-////////////////////////////////////////////////////////////////////////////////
-function server_jd() {
- return timestamp_to_jd(time());
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Get the current julian day on the client
-////////////////////////////////////////////////////////////////////////////////
-function client_jd() {
- return timestamp_to_jd(client_time());
-}
-
-////////////////////////////////////////////////////////////////////////////////
// Convert a unix-style timestamp into a julian-day
////////////////////////////////////////////////////////////////////////////////
function timestamp_to_jd($time) {
diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php
index 765ee22282..5bd31df5ee 100644
--- a/includes/functions/functions_print_lists.php
+++ b/includes/functions/functions_print_lists.php
@@ -1548,7 +1548,7 @@ function print_events_table($startjd, $endjd, $events='BIRT MARR DEAT', $only_li
// Print a final summary message about restricted/filtered facts
$summary = "";
- if ($endjd==client_jd()) {
+ if ($endjd==WT_CLIENT_JD) {
// We're dealing with the Today's Events block
if ($output==0) {
if ($filter==0) {
@@ -1656,7 +1656,7 @@ function print_events_list($startjd, $endjd, $events='BIRT MARR DEAT', $only_liv
// Print a final summary message about restricted/filtered facts
$summary = "";
- if ($endjd==client_jd()) {
+ if ($endjd==WT_CLIENT_JD) {
// We're dealing with the Today's Events block
if ($output==0) {
if ($filter==0) {
diff --git a/includes/functions/functions_privacy.php b/includes/functions/functions_privacy.php
index 6753b07176..1ddec215ba 100644
--- a/includes/functions/functions_privacy.php
+++ b/includes/functions/functions_privacy.php
@@ -90,7 +90,7 @@ function is_dead($indirec, $gedcom_id) {
preg_match_all('/\n2 DATE (.+)/', $indirec, $date_matches);
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*$MAX_ALIVE_AGE) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*$MAX_ALIVE_AGE) {
return true;
}
}
@@ -106,7 +106,7 @@ function is_dead($indirec, $gedcom_id) {
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
// Assume fathers are no more than 40 years older than their children
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE+40)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE+40)) {
return true;
}
}
@@ -116,7 +116,7 @@ function is_dead($indirec, $gedcom_id) {
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
// Assume mothers are no more than 40 years older than their children
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE+40)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE+40)) {
return true;
}
}
@@ -132,7 +132,7 @@ function is_dead($indirec, $gedcom_id) {
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
// Assume marriage occurs after age of 10
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE-10)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE-10)) {
return true;
}
}
@@ -148,7 +148,7 @@ function is_dead($indirec, $gedcom_id) {
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
// Assume max age difference between spouses of 40 years
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE+40)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE+40)) {
return true;
}
}
@@ -161,7 +161,7 @@ function is_dead($indirec, $gedcom_id) {
// Assume children born after age of 15
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE-15)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE-15)) {
return true;
}
}
@@ -175,7 +175,7 @@ function is_dead($indirec, $gedcom_id) {
// Assume grandchildren born after age of 30
foreach ($date_matches[1] as $date_match) {
$date=new GedcomDate($date_match);
- if ($date->isOK() && $date->MaxJD() <= WT_TODAY_JD - 365*($MAX_ALIVE_AGE-30)) {
+ if ($date->isOK() && $date->MaxJD() <= WT_SERVER_JD - 365*($MAX_ALIVE_AGE-30)) {
return true;
}
}
diff --git a/includes/session.php b/includes/session.php
index cbb02e5835..6927ad538e 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -333,11 +333,10 @@ if ($MULTI_MEDIA) {
}
require WT_ROOT.'includes/functions/functions_date.php';
-define('WT_TODAY_JD', server_jd()); // Privacy calculations need to know today's date
-
-if (empty($PEDIGREE_GENERATIONS)) {
- $PEDIGREE_GENERATIONS=$DEFAULT_PEDIGREE_GENERATIONS;
-}
+// Use the server date to calculate privacy, etc.
+// Use the client date to show ages, etc.
+define('WT_SERVER_JD', timestamp_to_jd(time()));
+define('WT_CLIENT_JD', timestamp_to_jd(client_time()));
// Who are we?
define('WT_USER_ID', getUserId());