Merge pull request #5031 from annando/fix-sql

Avoid SQL error with empty "bd" field
This commit is contained in:
Hypolite Petovan 2018-05-11 15:43:23 -04:00 committed by GitHub
commit ee143e32d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,