diff options
| -rw-r--r-- | calendar.php | 2 | ||||
| -rw-r--r-- | client.php | 2 | ||||
| -rw-r--r-- | includes/classes/class_date.php | 4 | ||||
| -rw-r--r-- | includes/classes/class_person.php | 2 | ||||
| -rw-r--r-- | includes/classes/class_stats.php | 2 | ||||
| -rw-r--r-- | includes/functions/functions_date.php | 14 | ||||
| -rw-r--r-- | includes/functions/functions_print_lists.php | 4 | ||||
| -rw-r--r-- | includes/functions/functions_privacy.php | 14 | ||||
| -rw-r--r-- | includes/session.php | 9 | ||||
| -rw-r--r-- | modules/recent_changes/module.php | 2 | ||||
| -rw-r--r-- | modules/todays_events/module.php | 2 | ||||
| -rw-r--r-- | modules/todo/module.php | 2 | ||||
| -rw-r--r-- | modules/upcoming_events/module.php | 4 | ||||
| -rw-r--r-- | modules/yahrzeit/module.php | 4 |
14 files changed, 26 insertions, 41 deletions
diff --git a/calendar.php b/calendar.php index 2d614625db..5ea6ab7cc6 100644 --- a/calendar.php +++ b/calendar.php @@ -543,7 +543,7 @@ print_footer(); ///////////////////////////////////////////////////////////////////////////////// function apply_filter($facts, $filterof, $filtersx) { $filtered=array(); - $hundred_years=server_jd()-36525; + $hundred_years=WT_SERVER_JD-36525; foreach ($facts as $fact) { $tmp=GedcomRecord::GetInstance($fact['id']); // Filter on sex diff --git a/client.php b/client.php index c3738949cb..34edfb77a5 100644 --- a/client.php +++ b/client.php @@ -425,7 +425,7 @@ case 'uploadmedia': case 'getchanges': $lastdate = new GedcomDate(safe_REQUEST($_REQUEST,'date', '\d\d \w\w\w \d\d\d\d')); if ($lastdate->isOK()) { - if ($lastdate->MinJD()<server_jd()-180) { + if ($lastdate->MinJD()<WT_SERVER_JD-180) { addToLog($action." ERROR 24: You cannot retrieve updates for more than 180 days.", 'debug'); print "ERROR 24: You cannot retrieve updates for more than 180 days.\n"; } else { 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()); diff --git a/modules/recent_changes/module.php b/modules/recent_changes/module.php index 92763fa2b3..8b3de3a56b 100644 --- a/modules/recent_changes/module.php +++ b/modules/recent_changes/module.php @@ -50,7 +50,7 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block { $days =get_block_setting($block_id, 'days', 30); $hide_empty=get_block_setting($block_id, 'hide_empty', false); - $found_facts=get_recent_changes(client_jd()-$days); + $found_facts=get_recent_changes(WT_CLIENT_JD-$days); if (empty($found_facts) && $hide_empty) { return; diff --git a/modules/todays_events/module.php b/modules/todays_events/module.php index c82abf4329..6659e1c458 100644 --- a/modules/todays_events/module.php +++ b/modules/todays_events/module.php @@ -52,7 +52,7 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block { $infoStyle =get_block_setting($block_id, 'infoStyle', 'table'); $sortStyle =get_block_setting($block_id, 'sortStyle', 'alpha'); - $todayjd=client_jd(); + $todayjd=WT_CLIENT_JD; $id=$this->getName().$block_id; $title=''; diff --git a/modules/todo/module.php b/modules/todo/module.php index a4d91a75b2..d6218da2e2 100644 --- a/modules/todo/module.php +++ b/modules/todo/module.php @@ -80,7 +80,7 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block { $content .= '</tr>'; $found=false; - $end_jd=$show_future ? 99999999 : client_jd(); + $end_jd=$show_future ? 99999999 : WT_CLIENT_JD; foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $todo) { $record=GedcomRecord::getInstance($todo['id']); if ($record && $record->canDisplayDetails()) { diff --git a/modules/upcoming_events/module.php b/modules/upcoming_events/module.php index e201bfa511..fb7d39afe4 100644 --- a/modules/upcoming_events/module.php +++ b/modules/upcoming_events/module.php @@ -54,8 +54,8 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block { $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha'); - $startjd=client_jd()+1; - $endjd=client_jd()+$days; + $startjd=WT_CLIENT_JD+1; + $endjd =WT_CLIENT_JD+$days; // Output starts here $id=$this->getName().$block_id; diff --git a/modules/yahrzeit/module.php b/modules/yahrzeit/module.php index da97ac68c9..9bc6c6b53b 100644 --- a/modules/yahrzeit/module.php +++ b/modules/yahrzeit/module.php @@ -51,8 +51,8 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); $block=get_block_setting($block_id, 'block', true); - $startjd=server_jd(); - $endjd=$startjd+$days-1; + $startjd=WT_CLIENT_JD; + $endjd =WT_CLIENT_JD+$days-1; $id=$this->getName().$block_id; if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) { |
