Log function
implement log() function.
This commit is contained in:
parent
d6d593d724
commit
14fde5dc9b
122 changed files with 1280 additions and 1161 deletions
|
|
@ -15,6 +15,7 @@ use Friendica\Content\Text\Markdown;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
|
|
@ -260,7 +261,7 @@ class Diaspora
|
|||
|
||||
if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) {
|
||||
$signature = base64_decode($signature);
|
||||
logger("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, LOGGER_DEBUG);
|
||||
Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, LOGGER_DEBUG);
|
||||
|
||||
// Do a recursive call to be able to fix even multiple levels
|
||||
if ($level < 10) {
|
||||
|
|
@ -283,14 +284,14 @@ class Diaspora
|
|||
$basedom = XML::parseString($envelope);
|
||||
|
||||
if (!is_object($basedom)) {
|
||||
logger("Envelope is no XML file");
|
||||
Logger::log("Envelope is no XML file");
|
||||
return false;
|
||||
}
|
||||
|
||||
$children = $basedom->children('http://salmon-protocol.org/ns/magic-env');
|
||||
|
||||
if (sizeof($children) == 0) {
|
||||
logger("XML has no children");
|
||||
Logger::log("XML has no children");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -315,19 +316,19 @@ 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);
|
||||
Logger::log('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.");
|
||||
Logger::log("Couldn't get a key for handle " . $handle . ". Discarding.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$verify = Crypto::rsaVerify($signable_data, $sig, $key);
|
||||
if (!$verify) {
|
||||
logger('Message from ' . $handle . ' did not verify. Discarding.');
|
||||
Logger::log('Message from ' . $handle . ' did not verify. Discarding.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +389,7 @@ class Diaspora
|
|||
$j_outer_key_bundle = json_decode($outer_key_bundle);
|
||||
|
||||
if (!is_object($j_outer_key_bundle)) {
|
||||
logger('Outer Salmon did not verify. Discarding.');
|
||||
Logger::log('Outer Salmon did not verify. Discarding.');
|
||||
if ($no_exit) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -407,7 +408,7 @@ class Diaspora
|
|||
$basedom = XML::parseString($xml);
|
||||
|
||||
if (!is_object($basedom)) {
|
||||
logger('Received data does not seem to be an XML. Discarding. '.$xml);
|
||||
Logger::log('Received data does not seem to be an XML. Discarding. '.$xml);
|
||||
if ($no_exit) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -433,7 +434,7 @@ class Diaspora
|
|||
$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);
|
||||
Logger::log('No author could be decoded. Discarding. Message: ' . $xml);
|
||||
if ($no_exit) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -443,7 +444,7 @@ class Diaspora
|
|||
|
||||
$key = self::key($author_addr);
|
||||
if ($key == '') {
|
||||
logger("Couldn't get a key for handle " . $author_addr . ". Discarding.");
|
||||
Logger::log("Couldn't get a key for handle " . $author_addr . ". Discarding.");
|
||||
if ($no_exit) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -453,7 +454,7 @@ class Diaspora
|
|||
|
||||
$verify = Crypto::rsaVerify($signed_data, $signature, $key);
|
||||
if (!$verify) {
|
||||
logger('Message did not verify. Discarding.');
|
||||
Logger::log('Message did not verify. Discarding.');
|
||||
if ($no_exit) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -483,7 +484,7 @@ class Diaspora
|
|||
$basedom = XML::parseString($xml);
|
||||
|
||||
if (!is_object($basedom)) {
|
||||
logger("XML is not parseable.");
|
||||
Logger::log("XML is not parseable.");
|
||||
return false;
|
||||
}
|
||||
$children = $basedom->children('https://joindiaspora.com/protocol');
|
||||
|
|
@ -497,7 +498,7 @@ class Diaspora
|
|||
} else {
|
||||
// This happens with posts from a relais
|
||||
if (!$importer) {
|
||||
logger("This is no private post in the old format", LOGGER_DEBUG);
|
||||
Logger::log("This is no private post in the old format", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -516,7 +517,7 @@ class Diaspora
|
|||
|
||||
$decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
|
||||
|
||||
logger('decrypted: '.$decrypted, LOGGER_DEBUG);
|
||||
Logger::log('decrypted: '.$decrypted, LOGGER_DEBUG);
|
||||
$idom = XML::parseString($decrypted);
|
||||
|
||||
$inner_iv = base64_decode($idom->iv);
|
||||
|
|
@ -539,7 +540,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!$base) {
|
||||
logger('unable to locate salmon data in xml');
|
||||
Logger::log('unable to locate salmon data in xml');
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
||||
|
|
@ -577,29 +578,29 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!$author_link) {
|
||||
logger('Could not retrieve author URI.');
|
||||
Logger::log('Could not retrieve author URI.');
|
||||
System::httpExit(400);
|
||||
}
|
||||
// Once we have the author URI, go to the web and try to find their public key
|
||||
// (first this will look it up locally if it is in the fcontact cache)
|
||||
// This will also convert diaspora public key from pkcs#1 to pkcs#8
|
||||
|
||||
logger('Fetching key for '.$author_link);
|
||||
Logger::log('Fetching key for '.$author_link);
|
||||
$key = self::key($author_link);
|
||||
|
||||
if (!$key) {
|
||||
logger('Could not retrieve author key.');
|
||||
Logger::log('Could not retrieve author key.');
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
||||
$verify = Crypto::rsaVerify($signed_data, $signature, $key);
|
||||
|
||||
if (!$verify) {
|
||||
logger('Message did not verify. Discarding.');
|
||||
Logger::log('Message did not verify. Discarding.');
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
||||
logger('Message verified.');
|
||||
Logger::log('Message verified.');
|
||||
|
||||
return ['message' => (string)$inner_decrypted,
|
||||
'author' => unxmlify($author_link),
|
||||
|
|
@ -618,12 +619,12 @@ class Diaspora
|
|||
{
|
||||
$enabled = intval(Config::get("system", "diaspora_enabled"));
|
||||
if (!$enabled) {
|
||||
logger("diaspora is disabled");
|
||||
Logger::log("diaspora is disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!($fields = self::validPosting($msg))) {
|
||||
logger("Invalid posting");
|
||||
Logger::log("Invalid posting");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -652,7 +653,7 @@ class Diaspora
|
|||
if (is_null($fields)) {
|
||||
$private = true;
|
||||
if (!($fields = self::validPosting($msg))) {
|
||||
logger("Invalid posting");
|
||||
Logger::log("Invalid posting");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -661,12 +662,12 @@ class Diaspora
|
|||
|
||||
$type = $fields->getName();
|
||||
|
||||
logger("Received message type ".$type." from ".$sender." for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
|
||||
switch ($type) {
|
||||
case "account_migration":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveAccountMigration($importer, $fields);
|
||||
|
|
@ -679,14 +680,14 @@ class Diaspora
|
|||
|
||||
case "contact":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveContactRequest($importer, $fields);
|
||||
|
||||
case "conversation":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveConversation($importer, $msg, $fields);
|
||||
|
|
@ -696,14 +697,14 @@ class Diaspora
|
|||
|
||||
case "message":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveMessage($importer, $fields);
|
||||
|
||||
case "participation":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveParticipation($importer, $fields);
|
||||
|
|
@ -716,7 +717,7 @@ class Diaspora
|
|||
|
||||
case "profile":
|
||||
if (!$private) {
|
||||
logger('Message with type ' . $type . ' is not private, quitting.');
|
||||
Logger::log('Message with type ' . $type . ' is not private, quitting.');
|
||||
return false;
|
||||
}
|
||||
return self::receiveProfile($importer, $fields);
|
||||
|
|
@ -731,7 +732,7 @@ class Diaspora
|
|||
return self::receiveStatusMessage($importer, $fields, $msg["message"]);
|
||||
|
||||
default:
|
||||
logger("Unknown message type ".$type);
|
||||
Logger::log("Unknown message type ".$type);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -753,7 +754,7 @@ class Diaspora
|
|||
$data = XML::parseString($msg["message"]);
|
||||
|
||||
if (!is_object($data)) {
|
||||
logger("No valid XML ".$msg["message"], LOGGER_DEBUG);
|
||||
Logger::log("No valid XML ".$msg["message"], LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -771,7 +772,7 @@ class Diaspora
|
|||
$type = $element->getName();
|
||||
$orig_type = $type;
|
||||
|
||||
logger("Got message type ".$type.": ".$msg["message"], LOGGER_DATA);
|
||||
Logger::log("Got message type ".$type.": ".$msg["message"], LOGGER_DATA);
|
||||
|
||||
// All retractions are handled identically from now on.
|
||||
// In the new version there will only be "retraction".
|
||||
|
|
@ -847,7 +848,7 @@ class Diaspora
|
|||
// This is something that shouldn't happen at all.
|
||||
if (in_array($type, ["status_message", "reshare", "profile"])) {
|
||||
if ($msg["author"] != $fields->author) {
|
||||
logger("Message handle is not the same as envelope sender. Quitting this message.");
|
||||
Logger::log("Message handle is not the same as envelope sender. Quitting this message.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -858,31 +859,31 @@ class Diaspora
|
|||
}
|
||||
// No author_signature? This is a must, so we quit.
|
||||
if (!isset($author_signature)) {
|
||||
logger("No author signature for type ".$type." - Message: ".$msg["message"], LOGGER_DEBUG);
|
||||
Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($parent_author_signature)) {
|
||||
$key = self::key($msg["author"]);
|
||||
if (empty($key)) {
|
||||
logger("No key found for parent author ".$msg["author"], LOGGER_DEBUG);
|
||||
Logger::log("No key found for parent author ".$msg["author"], LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, "sha256")) {
|
||||
logger("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
|
||||
Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$key = self::key($fields->author);
|
||||
if (empty($key)) {
|
||||
logger("No key found for author ".$fields->author, LOGGER_DEBUG);
|
||||
Logger::log("No key found for author ".$fields->author, LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Crypto::rsaVerify($signed_data, $author_signature, $key, "sha256")) {
|
||||
logger("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
|
||||
Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
|
||||
return false;
|
||||
} else {
|
||||
return $fields;
|
||||
|
|
@ -900,7 +901,7 @@ class Diaspora
|
|||
{
|
||||
$handle = strval($handle);
|
||||
|
||||
logger("Fetching diaspora key for: ".$handle);
|
||||
Logger::log("Fetching diaspora key for: ".$handle);
|
||||
|
||||
$r = self::personByHandle($handle);
|
||||
if ($r) {
|
||||
|
|
@ -923,7 +924,7 @@ class Diaspora
|
|||
|
||||
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
|
||||
if (DBA::isResult($person)) {
|
||||
logger("In cache " . print_r($person, true), LOGGER_DEBUG);
|
||||
Logger::log("In cache " . print_r($person, true), LOGGER_DEBUG);
|
||||
|
||||
// update record occasionally so it doesn't get stale
|
||||
$d = strtotime($person["updated"]." +00:00");
|
||||
|
|
@ -937,7 +938,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!DBA::isResult($person) || $update) {
|
||||
logger("create or refresh", LOGGER_DEBUG);
|
||||
Logger::log("create or refresh", LOGGER_DEBUG);
|
||||
$r = Probe::uri($handle, Protocol::DIASPORA);
|
||||
|
||||
// Note that Friendica contacts will return a "Diaspora person"
|
||||
|
|
@ -989,7 +990,7 @@ class Diaspora
|
|||
{
|
||||
$handle = false;
|
||||
|
||||
logger("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, LOGGER_DEBUG);
|
||||
Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, LOGGER_DEBUG);
|
||||
|
||||
if ($pcontact_id != 0) {
|
||||
$contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]);
|
||||
|
|
@ -1007,7 +1008,7 @@ class Diaspora
|
|||
if (DBA::isResult($r)) {
|
||||
$contact = $r[0];
|
||||
|
||||
logger("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
|
||||
Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
|
||||
|
||||
if ($contact['addr'] != "") {
|
||||
$handle = $contact['addr'];
|
||||
|
|
@ -1033,7 +1034,7 @@ class Diaspora
|
|||
*/
|
||||
public static function urlFromContactGuid($fcontact_guid)
|
||||
{
|
||||
logger("fcontact guid is ".$fcontact_guid, LOGGER_DEBUG);
|
||||
Logger::log("fcontact guid is ".$fcontact_guid, LOGGER_DEBUG);
|
||||
|
||||
$r = q(
|
||||
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
|
||||
|
|
@ -1068,14 +1069,14 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!$cid) {
|
||||
logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $cid]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
// This here shouldn't happen at all
|
||||
logger("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1108,7 +1109,7 @@ class Diaspora
|
|||
// );
|
||||
//
|
||||
// $contact["rel"] = Contact::FRIEND;
|
||||
// logger("defining user ".$contact["nick"]." as friend");
|
||||
// Logger::log("defining user ".$contact["nick"]." as friend");
|
||||
//}
|
||||
|
||||
// We don't seem to like that person
|
||||
|
|
@ -1145,7 +1146,7 @@ class Diaspora
|
|||
{
|
||||
$contact = self::contactByHandle($importer["uid"], $handle);
|
||||
if (!$contact) {
|
||||
logger("A Contact for handle ".$handle." and user ".$importer["uid"]." was not found");
|
||||
Logger::log("A Contact for handle ".$handle." and user ".$importer["uid"]." was not found");
|
||||
// If a contact isn't found, we accept it anyway if it is a comment
|
||||
if ($is_comment && ($importer["uid"] != 0)) {
|
||||
return self::contactByHandle(0, $handle);
|
||||
|
|
@ -1157,7 +1158,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!self::postAllow($importer, $contact, $is_comment)) {
|
||||
logger("The handle: ".$handle." is not allowed to post to user ".$importer["uid"]);
|
||||
Logger::log("The handle: ".$handle." is not allowed to post to user ".$importer["uid"]);
|
||||
return false;
|
||||
}
|
||||
return $contact;
|
||||
|
|
@ -1175,7 +1176,7 @@ class Diaspora
|
|||
{
|
||||
$item = Item::selectFirst(['id'], ['uid' => $uid, 'guid' => $guid]);
|
||||
if (DBA::isResult($item)) {
|
||||
logger("message ".$guid." already exists for user ".$uid);
|
||||
Logger::log("message ".$guid." already exists for user ".$uid);
|
||||
return $item["id"];
|
||||
}
|
||||
|
||||
|
|
@ -1277,7 +1278,7 @@ class Diaspora
|
|||
|
||||
$server = $serverparts["scheme"]."://".$serverparts["host"];
|
||||
|
||||
logger("Trying to fetch item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
Logger::log("Trying to fetch item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
|
||||
$msg = self::message($guid, $server);
|
||||
|
||||
|
|
@ -1285,7 +1286,7 @@ class Diaspora
|
|||
return false;
|
||||
}
|
||||
|
||||
logger("Successfully fetched item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
Logger::log("Successfully fetched item ".$guid." from ".$server, LOGGER_DEBUG);
|
||||
|
||||
// Now call the dispatcher
|
||||
return self::dispatchPublic($msg);
|
||||
|
|
@ -1312,16 +1313,16 @@ class Diaspora
|
|||
// This will work for new Diaspora servers and Friendica servers from 3.5
|
||||
$source_url = $server."/fetch/post/".urlencode($guid);
|
||||
|
||||
logger("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
|
||||
$envelope = Network::fetchUrl($source_url);
|
||||
if ($envelope) {
|
||||
logger("Envelope was fetched.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope was fetched.", LOGGER_DEBUG);
|
||||
$x = self::verifyMagicEnvelope($envelope);
|
||||
if (!$x) {
|
||||
logger("Envelope could not be verified.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope could not be verified.", LOGGER_DEBUG);
|
||||
} else {
|
||||
logger("Envelope was verified.", LOGGER_DEBUG);
|
||||
Logger::log("Envelope was verified.", LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
$x = false;
|
||||
|
|
@ -1330,7 +1331,7 @@ class Diaspora
|
|||
// This will work for older Diaspora and Friendica servers
|
||||
if (!$x) {
|
||||
$source_url = $server."/p/".urlencode($guid).".xml";
|
||||
logger("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
|
||||
|
||||
$x = Network::fetchUrl($source_url);
|
||||
if (!$x) {
|
||||
|
|
@ -1346,11 +1347,11 @@ class Diaspora
|
|||
|
||||
if ($source_xml->post->reshare) {
|
||||
// Reshare of a reshare - old Diaspora version
|
||||
logger("Message is a reshare", LOGGER_DEBUG);
|
||||
Logger::log("Message is a reshare", LOGGER_DEBUG);
|
||||
return self::message($source_xml->post->reshare->root_guid, $server, ++$level);
|
||||
} elseif ($source_xml->getName() == "reshare") {
|
||||
// Reshare of a reshare - new Diaspora version
|
||||
logger("Message is a new reshare", LOGGER_DEBUG);
|
||||
Logger::log("Message is a new reshare", LOGGER_DEBUG);
|
||||
return self::message($source_xml->root_guid, $server, ++$level);
|
||||
}
|
||||
|
||||
|
|
@ -1365,7 +1366,7 @@ class Diaspora
|
|||
|
||||
// If this isn't a "status_message" then quit
|
||||
if (!$author) {
|
||||
logger("Message doesn't seem to be a status message", LOGGER_DEBUG);
|
||||
Logger::log("Message doesn't seem to be a status message", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1404,17 +1405,17 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($result) {
|
||||
logger("Fetched missing item ".$guid." - result: ".$result, LOGGER_DEBUG);
|
||||
Logger::log("Fetched missing item ".$guid." - result: ".$result, LOGGER_DEBUG);
|
||||
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
logger("parent item not found: parent: ".$guid." - user: ".$uid);
|
||||
Logger::log("parent item not found: parent: ".$guid." - user: ".$uid);
|
||||
return false;
|
||||
} else {
|
||||
logger("parent item found: parent: ".$guid." - user: ".$uid);
|
||||
Logger::log("parent item found: parent: ".$guid." - user: ".$uid);
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
|
@ -1510,17 +1511,17 @@ class Diaspora
|
|||
|
||||
$contact = self::contactByHandle($importer["uid"], $old_handle);
|
||||
if (!$contact) {
|
||||
logger("cannot find contact for sender: ".$old_handle." and user ".$importer["uid"]);
|
||||
Logger::log("cannot find contact for sender: ".$old_handle." and user ".$importer["uid"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger("Got migration for ".$old_handle.", to ".$new_handle." with user ".$importer["uid"]);
|
||||
Logger::log("Got migration for ".$old_handle.", to ".$new_handle." with user ".$importer["uid"]);
|
||||
|
||||
// Check signature
|
||||
$signed_text = 'AccountMigration:'.$old_handle.':'.$new_handle;
|
||||
$key = self::key($old_handle);
|
||||
if (!Crypto::rsaVerify($signed_text, $signature, $key, "sha256")) {
|
||||
logger('No valid signature for migration.');
|
||||
Logger::log('No valid signature for migration.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1530,7 +1531,7 @@ class Diaspora
|
|||
// change the technical stuff in contact and gcontact
|
||||
$data = Probe::uri($new_handle);
|
||||
if ($data['network'] == Protocol::PHANTOM) {
|
||||
logger('Account for '.$new_handle." couldn't be probed.");
|
||||
Logger::log('Account for '.$new_handle." couldn't be probed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1550,7 +1551,7 @@ class Diaspora
|
|||
|
||||
DBA::update('gcontact', $fields, ['addr' => $old_handle]);
|
||||
|
||||
logger('Contacts are updated.');
|
||||
Logger::log('Contacts are updated.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1573,7 +1574,7 @@ class Diaspora
|
|||
|
||||
DBA::delete('gcontact', ['addr' => $author]);
|
||||
|
||||
logger('Removed contacts for ' . $author);
|
||||
Logger::log('Removed contacts for ' . $author);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1634,7 +1635,7 @@ class Diaspora
|
|||
{
|
||||
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
|
||||
if (DBA::isResult($item)) {
|
||||
logger("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
|
||||
Logger::log("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
|
||||
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
|
||||
if (DBA::isResult($contact)) {
|
||||
return $contact;
|
||||
|
|
@ -1690,7 +1691,7 @@ class Diaspora
|
|||
|
||||
$person = self::personByHandle($author);
|
||||
if (!is_array($person)) {
|
||||
logger("unable to find author details");
|
||||
Logger::log("unable to find author details");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1749,7 +1750,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($message_id) {
|
||||
logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
|
|
@ -1792,7 +1793,7 @@ class Diaspora
|
|||
$msg_created_at = DateTimeFormat::utc(notags(unxmlify($mesg->created_at)));
|
||||
|
||||
if ($msg_conversation_guid != $guid) {
|
||||
logger("message conversation guid does not belong to the current conversation.");
|
||||
Logger::log("message conversation guid does not belong to the current conversation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1804,7 +1805,7 @@ class Diaspora
|
|||
DBA::lock('mail');
|
||||
|
||||
if (DBA::exists('mail', ['guid' => $msg_guid, 'uid' => $importer["uid"]])) {
|
||||
logger("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1869,7 +1870,7 @@ class Diaspora
|
|||
$messages = $data->message;
|
||||
|
||||
if (!count($messages)) {
|
||||
logger("empty conversation");
|
||||
Logger::log("empty conversation");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1896,7 +1897,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
if (!$conversation) {
|
||||
logger("unable to create conversation.");
|
||||
Logger::log("unable to create conversation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1947,7 +1948,7 @@ class Diaspora
|
|||
|
||||
$person = self::personByHandle($author);
|
||||
if (!is_array($person)) {
|
||||
logger("unable to find author details");
|
||||
Logger::log("unable to find author details");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2008,7 +2009,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
if ($message_id) {
|
||||
logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
|
|
@ -2044,7 +2045,7 @@ class Diaspora
|
|||
$conversation = DBA::selectFirst('conv', [], $condition);
|
||||
|
||||
if (!DBA::isResult($conversation)) {
|
||||
logger("conversation not available.");
|
||||
Logger::log("conversation not available.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2052,7 +2053,7 @@ class Diaspora
|
|||
|
||||
$person = self::personByHandle($author);
|
||||
if (!$person) {
|
||||
logger("unable to find author details");
|
||||
Logger::log("unable to find author details");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2063,7 +2064,7 @@ class Diaspora
|
|||
DBA::lock('mail');
|
||||
|
||||
if (DBA::exists('mail', ['guid' => $guid, 'uid' => $importer["uid"]])) {
|
||||
logger("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2107,19 +2108,19 @@ class Diaspora
|
|||
|
||||
$contact_id = Contact::getIdForURL($author);
|
||||
if (!$contact_id) {
|
||||
logger('Contact not found: '.$author);
|
||||
Logger::log('Contact not found: '.$author);
|
||||
return false;
|
||||
}
|
||||
|
||||
$person = self::personByHandle($author);
|
||||
if (!is_array($person)) {
|
||||
logger("Person not found: ".$author);
|
||||
Logger::log("Person not found: ".$author);
|
||||
return false;
|
||||
}
|
||||
|
||||
$item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]);
|
||||
if (!DBA::isResult($item)) {
|
||||
logger('Item not found, no origin or private: '.$parent_guid);
|
||||
Logger::log('Item not found, no origin or private: '.$parent_guid);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2131,7 +2132,7 @@ class Diaspora
|
|||
$server = $author;
|
||||
}
|
||||
|
||||
logger('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
|
||||
Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
|
||||
|
||||
if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
|
||||
DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
|
||||
|
|
@ -2148,7 +2149,7 @@ class Diaspora
|
|||
} else {
|
||||
$cmd = $comment['self'] ? 'like' : 'comment-import';
|
||||
}
|
||||
logger("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
|
||||
Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
|
||||
}
|
||||
DBA::close($comments);
|
||||
|
|
@ -2274,7 +2275,7 @@ class Diaspora
|
|||
|
||||
GContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||
|
||||
logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2336,7 +2337,7 @@ class Diaspora
|
|||
// That makes us friends.
|
||||
if ($contact) {
|
||||
if ($following) {
|
||||
logger("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", LOGGER_DEBUG);
|
||||
self::receiveRequestMakeFriend($importer, $contact);
|
||||
|
||||
// refetch the contact array
|
||||
|
|
@ -2347,36 +2348,36 @@ class Diaspora
|
|||
if (in_array($contact["rel"], [Contact::FRIEND])) {
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||
if (DBA::isResult($user)) {
|
||||
logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
$ret = self::sendShare($user, $contact);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
logger("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
||||
Contact::removeFollower($importer, $contact);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) {
|
||||
logger("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
|
||||
return false;
|
||||
} elseif (!$following && !$sharing) {
|
||||
logger("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
|
||||
return false;
|
||||
} elseif (!$following && $sharing) {
|
||||
logger("Author ".$author." wants to share with us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to share with us.", LOGGER_DEBUG);
|
||||
} elseif ($following && $sharing) {
|
||||
logger("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
|
||||
} elseif ($following && !$sharing) {
|
||||
logger("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$ret = self::personByHandle($author);
|
||||
|
||||
if (!$ret || ($ret["network"] != Protocol::DIASPORA)) {
|
||||
logger("Cannot resolve diaspora handle ".$author." for ".$recipient);
|
||||
Logger::log("Cannot resolve diaspora handle ".$author." for ".$recipient);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2407,18 +2408,18 @@ class Diaspora
|
|||
$contact_record = self::contactByHandle($importer["uid"], $author);
|
||||
|
||||
if (!$contact_record) {
|
||||
logger("unable to locate newly created contact record.");
|
||||
Logger::log("unable to locate newly created contact record.");
|
||||
return;
|
||||
}
|
||||
|
||||
logger("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
|
||||
Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
|
||||
|
||||
Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
|
||||
|
||||
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
|
||||
|
||||
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
|
||||
logger("Sending intra message for author ".$author.".", LOGGER_DEBUG);
|
||||
Logger::log("Sending intra message for author ".$author.".", LOGGER_DEBUG);
|
||||
|
||||
$hash = random_string().(string)time(); // Generate a confirm_key
|
||||
|
||||
|
|
@ -2436,7 +2437,7 @@ class Diaspora
|
|||
} else {
|
||||
// automatic friend approval
|
||||
|
||||
logger("Does an automatic friend approval for author ".$author.".", LOGGER_DEBUG);
|
||||
Logger::log("Does an automatic friend approval for author ".$author.".", LOGGER_DEBUG);
|
||||
|
||||
Contact::updateAvatar($contact_record["photo"], $importer["uid"], $contact_record["id"]);
|
||||
|
||||
|
|
@ -2470,7 +2471,7 @@ class Diaspora
|
|||
|
||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||
if (DBA::isResult($user)) {
|
||||
logger("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
|
||||
$ret = self::sendShare($user, $contact_record);
|
||||
|
||||
// Send the profile data, maybe it weren't transmitted before
|
||||
|
|
@ -2493,7 +2494,7 @@ class Diaspora
|
|||
public static function originalItem($guid, $orig_author)
|
||||
{
|
||||
if (empty($guid)) {
|
||||
logger('Empty guid. Quitting.');
|
||||
Logger::log('Empty guid. Quitting.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2504,7 +2505,7 @@ class Diaspora
|
|||
$item = Item::selectFirst($fields, $condition);
|
||||
|
||||
if (DBA::isResult($item)) {
|
||||
logger("reshared message ".$guid." already exists on system.");
|
||||
Logger::log("reshared message ".$guid." already exists on system.");
|
||||
|
||||
// Maybe it is already a reshared item?
|
||||
// Then refetch the content, if it is a reshare from a reshare.
|
||||
|
|
@ -2527,17 +2528,17 @@ class Diaspora
|
|||
|
||||
if (!DBA::isResult($item)) {
|
||||
if (empty($orig_author)) {
|
||||
logger('Empty author for guid ' . $guid . '. Quitting.');
|
||||
Logger::log('Empty author for guid ' . $guid . '. Quitting.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$server = "https://".substr($orig_author, strpos($orig_author, "@") + 1);
|
||||
logger("1st try: reshared message ".$guid." will be fetched via SSL from the server ".$server);
|
||||
Logger::log("1st try: reshared message ".$guid." will be fetched via SSL from the server ".$server);
|
||||
$stored = self::storeByGuid($guid, $server);
|
||||
|
||||
if (!$stored) {
|
||||
$server = "http://".substr($orig_author, strpos($orig_author, "@") + 1);
|
||||
logger("2nd try: reshared message ".$guid." will be fetched without SSL from the server ".$server);
|
||||
Logger::log("2nd try: reshared message ".$guid." will be fetched without SSL from the server ".$server);
|
||||
$stored = self::storeByGuid($guid, $server);
|
||||
}
|
||||
|
||||
|
|
@ -2643,7 +2644,7 @@ class Diaspora
|
|||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
if ($message_id) {
|
||||
logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
}
|
||||
|
|
@ -2670,7 +2671,7 @@ class Diaspora
|
|||
|
||||
$person = self::personByHandle($author);
|
||||
if (!is_array($person)) {
|
||||
logger("unable to find author detail for ".$author);
|
||||
Logger::log("unable to find author detail for ".$author);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2690,13 +2691,13 @@ class Diaspora
|
|||
|
||||
$r = Item::select($fields, $condition);
|
||||
if (!DBA::isResult($r)) {
|
||||
logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");
|
||||
Logger::log("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($item = Item::fetch($r)) {
|
||||
if (strstr($item['file'], '[')) {
|
||||
logger("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
|
||||
Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2705,13 +2706,13 @@ class Diaspora
|
|||
|
||||
// Only delete it if the parent author really fits
|
||||
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
|
||||
logger("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
|
||||
Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
Item::delete(['id' => $item['id']]);
|
||||
|
||||
logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
|
||||
Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2732,7 +2733,7 @@ class Diaspora
|
|||
|
||||
$contact = self::contactByHandle($importer["uid"], $sender);
|
||||
if (!$contact && (in_array($target_type, ["Contact", "Person"]))) {
|
||||
logger("cannot find contact for sender: ".$sender." and user ".$importer["uid"]);
|
||||
Logger::log("cannot find contact for sender: ".$sender." and user ".$importer["uid"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2740,7 +2741,7 @@ class Diaspora
|
|||
$contact = [];
|
||||
}
|
||||
|
||||
logger("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
|
||||
Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
|
||||
|
||||
switch ($target_type) {
|
||||
case "Comment":
|
||||
|
|
@ -2756,7 +2757,7 @@ class Diaspora
|
|||
break;
|
||||
|
||||
default:
|
||||
logger("Unknown target type ".$target_type);
|
||||
Logger::log("Unknown target type ".$target_type);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -2870,7 +2871,7 @@ class Diaspora
|
|||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
if ($message_id) {
|
||||
logger("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
}
|
||||
|
|
@ -2922,11 +2923,11 @@ class Diaspora
|
|||
*/
|
||||
public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey)
|
||||
{
|
||||
logger("Message: ".$msg, LOGGER_DATA);
|
||||
Logger::log("Message: ".$msg, LOGGER_DATA);
|
||||
|
||||
// without a public key nothing will work
|
||||
if (!$pubkey) {
|
||||
logger("pubkey missing: contact id: ".$contact["id"]);
|
||||
Logger::log("pubkey missing: contact id: ".$contact["id"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3068,11 +3069,11 @@ class Diaspora
|
|||
}
|
||||
|
||||
if (!$dest_url) {
|
||||
logger("no url for contact: ".$contact["id"]." batch mode =".$public_batch);
|
||||
Logger::log("no url for contact: ".$contact["id"]." batch mode =".$public_batch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
logger("transmit: ".$logid."-".$guid." ".$dest_url);
|
||||
Logger::log("transmit: ".$logid."-".$guid." ".$dest_url);
|
||||
|
||||
if (!$queue_run && Queue::wasDelayed($contact["id"])) {
|
||||
$return_code = 0;
|
||||
|
|
@ -3083,16 +3084,16 @@ class Diaspora
|
|||
$postResult = Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
|
||||
$return_code = $postResult->getReturnCode();
|
||||
} else {
|
||||
logger("test_mode");
|
||||
Logger::log("test_mode");
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
logger("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
|
||||
Logger::log("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
|
||||
|
||||
if (!$return_code || (($return_code == 503) && (stristr($postResult->getHeader(), "retry-after")))) {
|
||||
if (!$no_queue && !empty($contact['contact-type']) && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
|
||||
logger("queue message");
|
||||
Logger::log("queue message");
|
||||
// queue message for redelivery
|
||||
Queue::add($contact["id"], Protocol::DIASPORA, $envelope, $public_batch, $guid);
|
||||
}
|
||||
|
|
@ -3140,8 +3141,8 @@ class Diaspora
|
|||
{
|
||||
$msg = self::buildPostXml($type, $message);
|
||||
|
||||
logger('message: '.$msg, LOGGER_DATA);
|
||||
logger('send guid '.$guid, LOGGER_DEBUG);
|
||||
Logger::log('message: '.$msg, LOGGER_DATA);
|
||||
Logger::log('send guid '.$guid, LOGGER_DEBUG);
|
||||
|
||||
// Fallback if the private key wasn't transmitted in the expected field
|
||||
if (empty($owner['uprvkey'])) {
|
||||
|
|
@ -3157,7 +3158,7 @@ class Diaspora
|
|||
$return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid);
|
||||
}
|
||||
|
||||
logger("guid: ".$guid." result ".$return_code, LOGGER_DEBUG);
|
||||
Logger::log("guid: ".$guid." result ".$return_code, LOGGER_DEBUG);
|
||||
|
||||
return $return_code;
|
||||
}
|
||||
|
|
@ -3202,7 +3203,7 @@ class Diaspora
|
|||
"parent_type" => "Post",
|
||||
"parent_guid" => $item["guid"]];
|
||||
|
||||
logger("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG);
|
||||
Logger::log("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG);
|
||||
|
||||
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
|
||||
Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
|
||||
|
|
@ -3231,7 +3232,7 @@ class Diaspora
|
|||
"profile" => $profile,
|
||||
"signature" => $signature];
|
||||
|
||||
logger("Send account migration ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send account migration ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "account_migration", $message);
|
||||
}
|
||||
|
|
@ -3274,7 +3275,7 @@ class Diaspora
|
|||
"following" => "true",
|
||||
"sharing" => "true"];
|
||||
|
||||
logger("Send share ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send share ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "contact", $message);
|
||||
}
|
||||
|
|
@ -3294,7 +3295,7 @@ class Diaspora
|
|||
"following" => "false",
|
||||
"sharing" => "false"];
|
||||
|
||||
logger("Send unshare ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Send unshare ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, "contact", $message);
|
||||
}
|
||||
|
|
@ -3654,7 +3655,7 @@ class Diaspora
|
|||
$attend_answer = 'tentative';
|
||||
break;
|
||||
default:
|
||||
logger('Unknown verb '.$item['verb'].' in item '.$item['guid']);
|
||||
Logger::log('Unknown verb '.$item['verb'].' in item '.$item['guid']);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3807,7 +3808,7 @@ class Diaspora
|
|||
$type = "comment";
|
||||
}
|
||||
|
||||
logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
|
||||
Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
|
||||
|
||||
// Old way - is used by the internal Friendica functions
|
||||
/// @todo Change all signatur storing functions to the new format
|
||||
|
|
@ -3831,13 +3832,13 @@ class Diaspora
|
|||
$message[$field] = $data;
|
||||
}
|
||||
} else {
|
||||
logger("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
|
||||
Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
$message["parent_author_signature"] = self::signature($owner, $message);
|
||||
|
||||
logger("Relayed data ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Relayed data ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]);
|
||||
}
|
||||
|
|
@ -3871,7 +3872,7 @@ class Diaspora
|
|||
"target_guid" => $item['guid'],
|
||||
"target_type" => $target_type];
|
||||
|
||||
logger("Got message ".print_r($message, true), LOGGER_DEBUG);
|
||||
Logger::log("Got message ".print_r($message, true), LOGGER_DEBUG);
|
||||
|
||||
return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item["guid"]);
|
||||
}
|
||||
|
|
@ -3891,7 +3892,7 @@ class Diaspora
|
|||
|
||||
$cnv = DBA::selectFirst('conv', [], ['id' => $item["convid"], 'uid' => $item["uid"]]);
|
||||
if (!DBA::isResult($cnv)) {
|
||||
logger("conversation not found.");
|
||||
Logger::log("conversation not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4107,7 +4108,7 @@ class Diaspora
|
|||
$message = self::createProfileData($uid);
|
||||
|
||||
foreach ($recips as $recip) {
|
||||
logger("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG);
|
||||
Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG);
|
||||
self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -4124,6 +4125,7 @@ class Diaspora
|
|||
{
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -4153,6 +4155,7 @@ class Diaspora
|
|||
{
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue