Merge pull request #5031 from annando/fix-sql
Avoid SQL error with empty "bd" field
This commit is contained in:
commit
ee143e32d1
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue