"dob" is not a date field, so the changes are reverted
This commit is contained in:
parent
e301fa0832
commit
a2a171af06
5 changed files with 10 additions and 10 deletions
|
@ -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
|
// 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.
|
// 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'));
|
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
|
||||||
return str_replace('1','0',$d->format($fmt));
|
return str_replace('1','0',$d->format($fmt));
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ function dob($dob) {
|
||||||
$f = get_config('system','birthday_input_format');
|
$f = get_config('system','birthday_input_format');
|
||||||
if(! $f)
|
if(! $f)
|
||||||
$f = 'ymd';
|
$f = 'ymd';
|
||||||
if($dob <= '0001-01-01')
|
if($dob == '0000-00-00')
|
||||||
$value = '';
|
$value = '';
|
||||||
else
|
else
|
||||||
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
|
$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.
|
// This only handles foreign or alien networks where a birthday has been provided.
|
||||||
// In-network birthdays are handled within local_delivery
|
// 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)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
|
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ class dfrn {
|
||||||
return 3;
|
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");
|
logger("dfrn_deliver: $url back from the dead - removing mark for death");
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
unmark_for_death($contact);
|
unmark_for_death($contact);
|
||||||
|
|
|
@ -3574,7 +3574,7 @@ class Diaspora {
|
||||||
if ($searchable === 'true') {
|
if ($searchable === 'true') {
|
||||||
$dob = '1000-00-00';
|
$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');
|
$dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC','UTC',$profile['dob'],'m-d');
|
||||||
|
|
||||||
$about = $profile['about'];
|
$about = $profile['about'];
|
||||||
|
|
|
@ -628,7 +628,7 @@ function advanced_profile(App $a) {
|
||||||
if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
|
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');
|
$year_bd_format = t('j F, Y');
|
||||||
$short_bd_format = t('j F');
|
$short_bd_format = t('j F');
|
||||||
|
|
|
@ -191,21 +191,21 @@ function profiles_post(App $a) {
|
||||||
return;
|
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);
|
$y = substr($dob,0,4);
|
||||||
if((! ctype_digit($y)) || ($y < 1900))
|
if((! ctype_digit($y)) || ($y < 1900))
|
||||||
$ignore_year = true;
|
$ignore_year = true;
|
||||||
else
|
else
|
||||||
$ignore_year = false;
|
$ignore_year = false;
|
||||||
if($dob > '0001-01-01') {
|
if($dob != '0000-00-00') {
|
||||||
if(strpos($dob,'000') === 0) {
|
if(strpos($dob,'0000-') === 0) {
|
||||||
$ignore_year = true;
|
$ignore_year = true;
|
||||||
$dob = substr($dob,5);
|
$dob = substr($dob,5);
|
||||||
}
|
}
|
||||||
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
|
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
|
||||||
if($ignore_year)
|
if($ignore_year)
|
||||||
$dob = '0001-' . $dob;
|
$dob = '0000-' . $dob;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = notags(trim($_POST['name']));
|
$name = notags(trim($_POST['name']));
|
||||||
|
|
Loading…
Reference in a new issue