diff --git a/include/datetime.php b/include/datetime.php index 601b4decf..fd60f5fd9 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -126,7 +126,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d // add 32 days so that we at least get year 00, and then hack around the fact that // months and days always start with 1. - if(substr($s,0,10) <= '0001-01-01') { + if(substr($s,0,10) == '0000-00-00') { $d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC')); return str_replace('1','0',$d->format($fmt)); } @@ -171,7 +171,7 @@ function dob($dob) { $f = get_config('system','birthday_input_format'); if(! $f) $f = 'ymd'; - if($dob <= '0001-01-01') + if($dob == '0000-00-00') $value = ''; else $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d')); @@ -553,7 +553,7 @@ function update_contact_birthdays() { // This only handles foreign or alien networks where a birthday has been provided. // In-network birthdays are handled within local_delivery - $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` >= '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` "); + $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` "); if (dbm::is_result($r)) { foreach ($r as $rr) { diff --git a/include/dfrn.php b/include/dfrn.php index 39372aef1..de64c37d6 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -1094,7 +1094,7 @@ class dfrn { return 3; } - if($contact['term-date'] != '0000-00-00 00:00:00') { + if($contact['term-date'] > NULL_DATE) { logger("dfrn_deliver: $url back from the dead - removing mark for death"); require_once('include/Contact.php'); unmark_for_death($contact); diff --git a/include/diaspora.php b/include/diaspora.php index 302492efe..eca22092d 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -3574,7 +3574,7 @@ class Diaspora { if ($searchable === 'true') { $dob = '1000-00-00'; - if (($profile['dob']) && ($profile['dob'] > '0001-01-01')) + if (($profile['dob']) && ($profile['dob'] != '0000-00-00')) $dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC','UTC',$profile['dob'],'m-d'); $about = $profile['about']; diff --git a/include/identity.php b/include/identity.php index 670337e08..8138e9b04 100644 --- a/include/identity.php +++ b/include/identity.php @@ -628,7 +628,7 @@ function advanced_profile(App $a) { if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); - if(($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) { + if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); diff --git a/mod/profiles.php b/mod/profiles.php index 4ec453838..bf6e828b6 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -191,21 +191,21 @@ function profiles_post(App $a) { return; } - $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0001-01-01'; // FIXME: Needs to be validated? + $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated? $y = substr($dob,0,4); if((! ctype_digit($y)) || ($y < 1900)) $ignore_year = true; else $ignore_year = false; - if($dob > '0001-01-01') { - if(strpos($dob,'000') === 0) { + if($dob != '0000-00-00') { + if(strpos($dob,'0000-') === 0) { $ignore_year = true; $dob = substr($dob,5); } $dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d')); if($ignore_year) - $dob = '0001-' . $dob; + $dob = '0000-' . $dob; } $name = notags(trim($_POST['name']));