Merge pull request #5031 from annando/fix-sql

Avoid SQL error with empty "bd" field
pull/5035/head
Hypolite Petovan 2018-05-11 15:43:23 -04:00 zatwierdzone przez GitHub
commit ee143e32d1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 15 usunięć

Wyświetl plik

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