}
}
+ if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
+ $row['signed_text'] = $row['interaction'];
+ }
+
if (array_key_exists('ignored', $row) && array_key_exists('internal-user-ignored', $row) && !is_null($row['internal-user-ignored'])) {
$row['ignored'] = $row['internal-user-ignored'];
}
unset($row['internal-iaid']);
unset($row['internal-icid']);
unset($row['internal-user-ignored']);
+ unset($row['interaction']);
return $row;
}
$fields['sign'] = ['signed_text', 'signature', 'signer'];
+ $fields['diaspora-interaction'] = ['interaction'];
+
return $fields;
}
$joins .= " LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`";
}
+ if (strpos($sql_commands, "`diaspora-interaction`.") !== false) {
+ $joins .= " LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `item`.`uri-id`";
+ }
+
if (strpos($sql_commands, "`item-activity`.") !== false) {
$joins .= " LEFT JOIN `item-activity` ON `item-activity`.`id` = `item`.`iaid`";
}
$selected[] = 'internal-user-ignored';
}
+ if (in_array('signed_text', $selected)) {
+ $selected[] = 'interaction';
+ }
+
$selection = [];
foreach ($fields as $table => $table_fields) {
foreach ($table_fields as $field => $select) {
if ($notify) {
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
// We add the hash of our own host because our host is the original creator of the post.
- $prefix_host = get_app()->get_hostname();
+ $prefix_host = get_app()->getHostName();
} else {
$prefix_host = '';
*/
$dsprsig = null;
- if (x($item, 'dsprsig')) {
+ if (isset($item['dsprsig'])) {
$encoded_signature = $item['dsprsig'];
$dsprsig = json_decode(base64_decode($item['dsprsig']));
unset($item['dsprsig']);
}
- if (!empty($item['diaspora_signed_text'])) {
+ $diaspora_signed_text = '';
+ if (isset($item['diaspora_signed_text'])) {
$diaspora_signed_text = $item['diaspora_signed_text'];
unset($item['diaspora_signed_text']);
- } else {
- $diaspora_signed_text = '';
}
// Converting the plink
logger("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
}
- DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
- 'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
+ if (!empty($dsprsig->signed_text) && empty($dsprsig->signature) && empty($dsprsig->signer)) {
+ DBA::insert('diaspora-interaction', ['uri-id' => $item['uri-id'], 'interaction' => $dsprsig->signed_text], true);
+ } else {
+ // The other fields are used by very old Friendica servers, so we currently store them differently
+ DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $dsprsig->signed_text,
+ 'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
+ }
}
if (!empty($diaspora_signed_text)) {
- // Formerly we stored the signed text, the signature and the author in different fields.
- // We now store the raw data so that we are more flexible.
- DBA::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
+ DBA::insert('diaspora-interaction', ['uri-id' => $item['uri-id'], 'interaction' => $diaspora_signed_text], true);
}
$deleted = self::tagDeliver($item['uid'], $current_post);
$guid = System::createUUID();
}
- return self::getApp()->get_baseurl() . '/object/' . $guid;
+ return self::getApp()->getBaseURL() . '/objects/' . $guid;
}
/**
}
// Prevent to forward already forwarded posts
- if ($datarray["app"] == $a->get_hostname()) {
+ if ($datarray["app"] == $a->getHostName()) {
logger('Already forwarded (second test)', LOGGER_DEBUG);
return false;
}
return true;
}
- $objtype = $item['resource-id'] ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ;
+ $objtype = $item['resource-id'] ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE;
$new_item = [
'guid' => System::createUUID(),
'parent' => $item['id'],
'parent-uri' => $item['uri'],
'thr-parent' => $item['uri'],
- 'owner-id' => $item['owner-id'],
+ 'owner-id' => $author_id,
'author-id' => $author_id,
'body' => $activity,
'verb' => $activity,