sforkowany z mirror/friendica
"dob" is not a date field, so the changes are reverted
rodzic
e301fa0832
commit
a2a171af06
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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']));
|
||||
|
|
Ładowanie…
Reference in New Issue