libzotdir: make sure we have the relevant data before string into updates

This commit is contained in:
Mario Vavti
2021-06-23 17:09:45 +02:00
parent a34bd3b013
commit cf791a1909

View File

@@ -264,6 +264,11 @@ class Libzotdir {
if (is_array($j['transactions']) && count($j['transactions'])) {
foreach ($j['transactions'] as $t) {
if (!($t['hash'] || $t['transaction_id'] || $t['address'])) {
continue;
}
$r = q("select * from updates where ud_guid = '%s' limit 1",
dbesc($t['transaction_id'])
);
@@ -638,8 +643,13 @@ class Libzotdir {
$dirmode = intval(get_config('system', 'directory_mode'));
if($dirmode == DIRECTORY_MODE_NORMAL)
if($dirmode == DIRECTORY_MODE_NORMAL) {
return;
}
if (!($hash || $guid || $addr)) {
return;
}
if($flags) {
q("insert into updates (ud_hash, ud_guid, ud_date, ud_flags, ud_addr ) values ( '%s', '%s', '%s', %d, '%s' )",
@@ -659,9 +669,4 @@ class Libzotdir {
}
}
}