diff --git a/boot.php b/boot.php index 0caf591459..7a54f2d5a0 100644 --- a/boot.php +++ b/boot.php @@ -41,7 +41,7 @@ define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_VERSION', '3.6-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); -define('DB_UPDATE_VERSION', 1245); +define('DB_UPDATE_VERSION', 1246); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** diff --git a/database.sql b/database.sql index 506e252ecb..d6a869b56b 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.6-dev (Asparagus) --- DB_UPDATE_VERSION 1244 +-- DB_UPDATE_VERSION 1246 -- ------------------------------------------ @@ -781,7 +781,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT '', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '', `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT '', - `dob` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '', + `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT '', `address` varchar(255) NOT NULL DEFAULT '' COMMENT '', `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '', `region` varchar(255) NOT NULL DEFAULT '' COMMENT '', @@ -1006,7 +1006,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `guid` varchar(64) NOT NULL DEFAULT '' COMMENT '', `username` varchar(255) NOT NULL DEFAULT '' COMMENT '', `password` varchar(255) NOT NULL DEFAULT '' COMMENT '', - `legacy_password` boolean NOT NULL DEFAULT 0 COMMENT 'Is the password hash double-hashed?', + `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?', `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '', `email` varchar(255) NOT NULL DEFAULT '' COMMENT '', `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '', diff --git a/include/datetime.php b/include/datetime.php index 0faea8c90e..76585f9db3 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -181,13 +181,13 @@ function dob($dob) { list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d'); - if ($dob <= '0001-01-01') { + if ($dob < '0000-01-01') { $value = ''; } else { - $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d')); + $value = (($year > 1000) ? datetime_convert('UTC', 'UTC', $dob, 'Y-m-d') : datetime_convert('UTC', 'UTC', '1000-' . $month . '-'. $day, 'm-d')); } - $age = ((intval($value)) ? age($value, $a->user["timezone"], $a->user["timezone"]) : ""); + $age = (intval($value) ? age($value, $a->user["timezone"], $a->user["timezone"]) : ""); $o = replace_macros(get_markup_template("field_input.tpl"), [ '$field' => [ @@ -200,12 +200,6 @@ function dob($dob) ] ]); - /// @TODO Old-lost code? -// if ($dob && $dob > '0001-01-01') -// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year), 'dob'); -// else -// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob'); - return $o; } diff --git a/mod/profiles.php b/mod/profiles.php index 4cb9533093..79f763bd03 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -201,7 +201,7 @@ 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'; $y = substr($dob, 0, 4); if ((! ctype_digit($y)) || ($y < 1900)) { @@ -217,7 +217,7 @@ function profiles_post(App $a) { $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; } } diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index b3eed0dd1b..95d9116380 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -1472,7 +1472,7 @@ class DBStructure { "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "pdesc" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], - "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01", "comment" => ""], + "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => ""], "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 9d42d32124..cd81e3e8a5 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -4207,10 +4207,14 @@ class Diaspora $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'); if ($searchable === 'true') { - $dob = '1000-00-00'; + $dob = ''; - if (($profile['dob']) && ($profile['dob'] > '0001-01-01')) { - $dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC', 'UTC', $profile['dob'],'m-d'); + if ($profile['dob'] && ($profile['dob'] > '0000-00-00')) { + list($year, $month, $day) = sscanf($profile['dob'], '%4d-%2d-%2d'); + if ($year < 1004) { + $year = 1004; + } + $dob = datetime_convert('UTC', 'UTC', $year . '-' . $month . '-'. $day, 'Y-m-d'); } $about = $profile['about']; @@ -4284,7 +4288,7 @@ class Diaspora foreach ($recips as $recip) { logger("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG); - self::buildAndTransmit($owner, $recip, "profile", $message, false, "", true); + self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false); } }