]> git.mxchange.org Git - friendica.git/commitdiff
"dob" is not a date field, so the changes are reverted
authorMichael <heluecht@pirati.ca>
Sat, 18 Mar 2017 08:50:27 +0000 (08:50 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 18 Mar 2017 08:50:27 +0000 (08:50 +0000)
include/datetime.php
include/dfrn.php
include/diaspora.php
include/identity.php
mod/profiles.php

index 601b4decf41efd751e1c34ac908ddc9fc41a1129..fd60f5fd96f242c6ba799c697f56942edc33f192 100644 (file)
@@ -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) {
 
index 39372aef14e603d3d3486c9d8d15a83a9d2f14a4..de64c37d67e37f45d6ffa6586bf76a514d81c2b5 100644 (file)
@@ -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);
index 302492efea5011d1db5fa9945ae4cff687d6db5f..eca22092d81352987a2a8a0e6981c8c7aa3fb206 100644 (file)
@@ -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'];
index 670337e0871b9c567d7e04fd301e3a505b124729..8138e9b046871ac8f757082db961201f968c805a 100644 (file)
@@ -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');
index 4ec45383895155e09a2ef98e3079f99dd8e55473..bf6e828b61d62946d0d9f55ced38282ac1435ba0 100644 (file)
@@ -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']));