Avoid SQL error with empty "bd" field

This commit is contained in:
Michael 2018-05-11 15:27:19 +00:00
parent 79a343a69a
commit 926c9719e0

View file

@ -2349,21 +2349,17 @@ class Diaspora
$birthday = $contact["bd"]; $birthday = $contact["bd"];
} }
$r = q( $fields = ['name' => $name, 'location' => $location,
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `bd` = '%s', 'name-date' => DateTimeFormat::utcNow(),
`location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d", 'about' => $about, 'gender' => $gender,
dbesc($name), 'addr' => $author, 'nick' => $nick,
dbesc($nick), 'keywords' => $keywords];
dbesc($author),
dbesc(DateTimeFormat::utcNow()), if (!empty($birthday)) {
dbesc($birthday), $fields['bd'] = $birthday;
dbesc($location), }
dbesc($about),
dbesc($keywords), dba::update('contact', $fields, ['id' => $contact['id']]);
dbesc($gender),
intval($contact["id"]),
intval($importer["uid"])
);
$gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2, $gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
"photo" => $image_url, "name" => $name, "location" => $location, "photo" => $image_url, "name" => $name, "location" => $location,