mirror of
https://github.com/friendica/friendica
synced 2025-05-09 19:44:10 +02:00
Merge branch 'master' into develop
This commit is contained in:
commit
27d94023ee
70 changed files with 27138 additions and 26508 deletions
|
@ -31,6 +31,7 @@ use Friendica\Util\Crypto;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Util\Map;
|
||||
use dba;
|
||||
use SimpleXMLElement;
|
||||
|
||||
|
@ -222,11 +223,20 @@ class Diaspora
|
|||
|
||||
$signable_data = $msg.".".base64url_encode($type).".".base64url_encode($encoding).".".base64url_encode($alg);
|
||||
|
||||
if ($handle == '') {
|
||||
logger('No author could be decoded. Discarding. Message: ' . $envelope);
|
||||
return false;
|
||||
}
|
||||
|
||||
$key = self::key($handle);
|
||||
if ($key == '') {
|
||||
logger("Couldn't get a key for handle " . $handle . ". Discarding.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$verify = Crypto::rsaVerify($signable_data, $sig, $key);
|
||||
if (!$verify) {
|
||||
logger('Message did not verify. Discarding.');
|
||||
logger('Message from ' . $handle . ' did not verify. Discarding.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -322,7 +332,16 @@ class Diaspora
|
|||
// Get the senders' public key
|
||||
$key_id = $base->sig[0]->attributes()->key_id[0];
|
||||
$author_addr = base64_decode($key_id);
|
||||
if ($author_addr == '') {
|
||||
logger('No author could be decoded. Discarding. Message: ' . $xml);
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
||||
$key = self::key($author_addr);
|
||||
if ($key == '') {
|
||||
logger("Couldn't get a key for handle " . $author_addr . ". Discarding.");
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
||||
$verify = Crypto::rsaVerify($signed_data, $signature, $key);
|
||||
if (!$verify) {
|
||||
|
@ -2212,7 +2231,10 @@ class Diaspora
|
|||
}
|
||||
|
||||
logger('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
|
||||
dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
|
||||
if (!dba::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
|
||||
dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
}
|
||||
|
||||
// Send all existing comments and likes to the requesting server
|
||||
$comments = dba::p("SELECT `item`.`id`, `item`.`verb`, `contact`.`self`
|
||||
|
@ -3197,13 +3219,14 @@ class Diaspora
|
|||
}
|
||||
|
||||
$logid = random_string(4);
|
||||
$dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
|
||||
|
||||
// Fetch the fcontact entry when there is missing data
|
||||
// Will possibly happen when data is transmitted to a DFRN contact
|
||||
if (empty($dest_url) && !empty($contact['addr'])) {
|
||||
// We always try to use the data from the fcontact table.
|
||||
// This is important for transmitting data to Friendica servers.
|
||||
if (!empty($contact['addr'])) {
|
||||
$fcontact = self::personByHandle($contact['addr']);
|
||||
$dest_url = ($public_batch ? $fcontact["batch"] : $fcontact["notify"]);
|
||||
} else {
|
||||
$dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
|
||||
}
|
||||
|
||||
if (!$dest_url) {
|
||||
|
@ -3597,10 +3620,18 @@ class Diaspora
|
|||
$eventdata['description'] = html_entity_decode(BBCode::toMarkdown($event['desc']));
|
||||
}
|
||||
if ($event['location']) {
|
||||
$event['location'] = preg_replace("/\[map\](.*?)\[\/map\]/ism", '$1', $event['location']);
|
||||
$coord = Map::getCoordinates($event['location']);
|
||||
|
||||
$location = [];
|
||||
$location["address"] = html_entity_decode(BBCode::toMarkdown($event['location']));
|
||||
$location["lat"] = 0;
|
||||
$location["lng"] = 0;
|
||||
if (!empty($coord['lat']) && !empty($coord['lon'])) {
|
||||
$location["lat"] = $coord['lat'];
|
||||
$location["lng"] = $coord['lon'];
|
||||
} else {
|
||||
$location["lat"] = 0;
|
||||
$location["lng"] = 0;
|
||||
}
|
||||
$eventdata['location'] = $location;
|
||||
}
|
||||
|
||||
|
@ -3694,7 +3725,13 @@ class Diaspora
|
|||
if (count($event)) {
|
||||
$message['event'] = $event;
|
||||
|
||||
/// @todo Once Diaspora supports it, we will remove the body
|
||||
if (!empty($event['location']['address']) &&
|
||||
!empty($event['location']['lat']) &&
|
||||
!empty($event['location']['lng'])) {
|
||||
$message['location'] = $event['location'];
|
||||
}
|
||||
|
||||
/// @todo Once Diaspora supports it, we will remove the body and the location hack above
|
||||
// $message['text'] = '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue