]> git.mxchange.org Git - friendica.git/commitdiff
Replace remaining occurrences of "0001-01-01" with DBA::NULL_DATE
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 22 Nov 2018 04:53:45 +0000 (23:53 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 22 Nov 2018 04:53:45 +0000 (23:53 -0500)
mod/hovercard.php
mod/profiles.php
src/Model/Contact.php
src/Model/GContact.php
src/Model/Profile.php
src/Protocol/DFRN.php

index f5ad3ef0219ab23d712ea09307e057c6abb5df31..6160642762a4adcbc427d6f21b048fa62df60c19 100644 (file)
@@ -107,7 +107,7 @@ function hovercard_content()
                'about'    => $contact['about'],
                'network'  => Strings::formatNetworkName($contact['network'], $contact['url']),
                'tags'     => $contact['keywords'],
-               'bd'       => $contact['birthday'] <= '0001-01-01' ? '' : $contact['birthday'],
+               'bd'       => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
                'account_type' => Contact::getAccountType($contact),
                'actions'  => $actions,
        ];
index 459a1c5e75a73fc1e0030933fe2d051499b6d0f9..fe3b362317f86e38617e3e53e8cc52a2c8656d68 100644 (file)
@@ -216,7 +216,7 @@ function profiles_post(App $a) {
                } else {
                        $ignore_year = false;
                }
-               if (!in_array($dob, ['0000-00-00', '0001-01-01'])) {
+               if (!in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
                        if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
                                $ignore_year = true;
                                $dob = substr($dob, 5);
index 1c90d0c815e0eedbd7fd048ccd2ead5797630175..f43a14e626cfee35f0fd82588e81c6826f5eb4ba 100644 (file)
@@ -740,7 +740,7 @@ class Contact extends BaseObject
 
                        // "bd" always contains the upcoming birthday of a contact.
                        // "birthday" might contain the birthday including the year of birth.
-                       if ($profile["birthday"] > '0001-01-01') {
+                       if ($profile["birthday"] > DBA::NULL_DATE) {
                                $bd_timestamp = strtotime($profile["birthday"]);
                                $month = date("m", $bd_timestamp);
                                $day = date("d", $bd_timestamp);
@@ -757,7 +757,7 @@ class Contact extends BaseObject
                                        $profile["bd"] = ( ++$current_year) . "-" . $month . "-" . $day;
                                }
                        } else {
-                               $profile["bd"] = '0001-01-01';
+                               $profile["bd"] = DBA::NULL_DATE;
                        }
                } else {
                        $profile = $default;
@@ -794,7 +794,7 @@ class Contact extends BaseObject
                        $profile["location"] = "";
                        $profile["about"] = "";
                        $profile["gender"] = "";
-                       $profile["birthday"] = '0001-01-01';
+                       $profile["birthday"] = DBA::NULL_DATE;
                }
 
                $cache[$url][$uid] = $profile;
index 1fed1fc3ef5b8464f521814dc99b3976b17a9ec9..3acffb059d796f8f1a65efab0fe0854ab0e828fe 100644 (file)
@@ -864,7 +864,7 @@ class GContact
                                                'location' => $contact['location'], 'about' => $contact['about']];
 
                                // Don't update the birthday field if not set or invalid
-                               if (empty($contact['birthday']) || ($contact['birthday'] < '0001-01-01')) {
+                               if (empty($contact['birthday']) || ($contact['birthday'] <= DBA::NULL_DATE)) {
                                        unset($fields['bd']);
                                }
 
index c45bcdb84bd6fa75e6322386724cc5225310d8fa..df4c8d3c6d386f16522caf67815171e1d00f2468 100644 (file)
@@ -749,7 +749,7 @@ class Profile
                                $profile['gender'] = [L10n::t('Gender:'), $a->profile['gender']];
                        }
 
-                       if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
+                       if (!empty($a->profile['dob']) && $a->profile['dob'] > DBA::NULL_DATE) {
                                $year_bd_format = L10n::t('j F, Y');
                                $short_bd_format = L10n::t('j F');
 
@@ -763,7 +763,7 @@ class Profile
                        }
 
                        if (!empty($a->profile['dob'])
-                               && $a->profile['dob'] > '0001-01-01'
+                               && $a->profile['dob'] > DBA::NULL_DATE
                                && $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'], '')
                        ) {
                                $profile['age'] = [L10n::t('Age:'), $age];
index ff50811838e9883b37b1fc3ea5ae9697c02bb2f8..7c03a218394e980e1adab0036f8079bd867c9be4 100644 (file)
@@ -16,7 +16,6 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
@@ -690,7 +689,7 @@ class DFRN
                        XML::addElement($doc, $author, "poco:displayName", $profile["name"]);
                        XML::addElement($doc, $author, "poco:updated", $namdate);
 
-                       if (trim($profile["dob"]) > '0001-01-01') {
+                       if (trim($profile["dob"]) > DBA::NULL_DATE) {
                                XML::addElement($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"])));
                        }
 
@@ -1722,9 +1721,9 @@ class DFRN
                        // "poco:birthday" is the birthday in the format "yyyy-mm-dd"
                        $value = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
 
-                       if (!in_array($value, ["", "0000-00-00", "0001-01-01"])) {
+                       if (!in_array($value, ["", "0000-00-00", DBA::NULL_DATE])) {
                                $bdyear = date("Y");
-                               $value = str_replace("0000", $bdyear, $value);
+                               $value = str_replace(["0000", "0001"], $bdyear, $value);
 
                                if (strtotime($value) < time()) {
                                        $value = str_replace($bdyear, $bdyear + 1, $value);