);
if (!dbm::is_result($r)) {
- logger("Query failed to execute, no result returned in " . __FUNCTION__);
+ /// @TODO Some logging?
killme();
}
// The signed text contains the content in Markdown, the sender handle and the signatur for the content
// It is needed for relayed comments to Diaspora.
- if ($item['signed_text']) {
+ if($item['signed_text']) {
$sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
xml::add_element($doc, $entry, "dfrn:diaspora_signature", $sign);
}
$rino = intval($rino);
// use RINO1 if mcrypt isn't installed and RINO2 was selected
- if ($rino == 2 and !function_exists('mcrypt_create_iv')) {
- $rino = 1;
+ if ($rino==2 and !function_exists('mcrypt_create_iv')) {
+ $rino=1;
}
logger("Local rino version: ". $rino, LOGGER_DEBUG);
}
- if ($rino > 0 && $rino_remote_version > 0 && (! $dissolve)) {
+ if ($rino>0 && $rino_remote_version>0 && (! $dissolve)) {
logger('rino version: '. $rino_remote_version);
switch($rino_remote_version) {
if ($dfrn_version >= 2.1) {
- if (($contact['duplex'] && strlen($contact['pubkey']))
+ if (($contact['duplex'] && strlen($contact['pubkey'])) {
|| ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))
- || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) {
+ || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey'])))
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
} else {
return 3;
}
- if ($contact['term-date'] != '0000-00-00 00:00:00') {
+ if ($contact['term-date'] > NULL_DATE) {
logger("dfrn_deliver: $url back from the dead - removing mark for death");
require_once('include/Contact.php');
unmark_for_death($contact);
$href = "";
$width = 0;
foreach ($avatar->attributes AS $attributes) {
- /// @TODO Rewrite these similar if () to one switch
+ /// @TODO Rewrite these similar if() to one switch
if ($attributes->name == "href") {
$href = $attributes->textContent;
}
dbesc(normalise_link($suggest["url"])),
intval($suggest["uid"])
);
-
+ /// @TODO Really abort on valid result??? Maybe missed ! here?
if (dbm::is_result($r)) {
- // Has already friend matching description
return false;
}
intval($importer["importer_uid"]));
if (!dbm::is_result($r)) {
- /// @todo Don't die quietly
killme();
}
$n, dbesc($f[1]),
$n, dbesc($f[0]),
intval($importer["importer_uid"]));
-
- if ($x === false) {
- return false;
- }
+ if ($x === false)
+ return false;
}
}
if (edited_timestamp_is_newer($current, $item)) {
// do not accept (ignore) an earlier edit than one we currently have.
- if (datetime_convert("UTC","UTC",$item["edited"]) < $current["edited"])
+ if(datetime_convert("UTC","UTC",$item["edited"]) < $current["edited"])
return(false);
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
if ($item["parent-uri"] != $item["uri"]) {
$community = false;
- if ($importer["page-flags"] == PAGE_COMMUNITY || $importer["page-flags"] == PAGE_PRVGROUP) {
+ if($importer["page-flags"] == PAGE_COMMUNITY || $importer["page-flags"] == PAGE_PRVGROUP) {
$sql_extra = "";
$community = true;
logger("possible community action");
}
}
- if ($Blink && link_compare($Blink,App::get_baseurl()."/profile/".$importer["nickname"])) {
+ if($Blink && link_compare($Blink,App::get_baseurl()."/profile/".$importer["nickname"])) {
// send a notification
notification(array(
return false;
}
} else {
- if (($item["verb"] == ACTIVITY_LIKE)
+ if(($item["verb"] == ACTIVITY_LIKE)
|| ($item["verb"] == ACTIVITY_DISLIKE)
|| ($item["verb"] == ACTIVITY_ATTEND)
|| ($item["verb"] == ACTIVITY_ATTENDNO)
$title = "";
foreach ($links AS $link) {
foreach ($link->attributes AS $attributes) {
- /// @TODO Rewrite these repeated (same) if () statements to a switch()
+ /// @TODO Rewrite these repeated (same) if() statements to a switch()
if ($attributes->name == "href") {
$href = $attributes->textContent;
}
// When activated, forums don't work.
// And: Why should we disallow commenting by followers?
// the behaviour is now similar to the Diaspora part.
- //if ($importer["rel"] == CONTACT_IS_FOLLOWER) {
+ //if($importer["rel"] == CONTACT_IS_FOLLOWER) {
// logger("Contact ".$importer["id"]." is only follower. Quitting", LOGGER_DEBUG);
// return;
//}
// Update content if 'updated' changes
if (dbm::is_result($current)) {
- if (self::update_content($r[0], $item, $importer, $entrytype))
+ if (self::update_content($r[0], $item, $importer, $entrytype)) {
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
} else {
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
logger("Item was stored with id ".$posted_id, LOGGER_DEBUG);
- if (stristr($item["verb"],ACTIVITY_POKE))
+ if(stristr($item["verb"],ACTIVITY_POKE))
self::do_poke($item, $importer, $posted_id);
}
}
}
}
- if ($entrytype == DFRN_TOP_LEVEL) {
+ if($entrytype == DFRN_TOP_LEVEL) {
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
`body` = '', `title` = ''
WHERE `parent-uri` = '%s' AND `uid` = %d",
create_tags_from_itemuri($uri, $importer["uid"]);
create_files_from_itemuri($uri, $importer["uid"]);
update_thread_uri($uri, $importer["importer_uid"]);
- if ($item["last-child"]) {
+ if($item["last-child"]) {
// ensure that last-child is set in case the comment that had it just got wiped.
q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
dbesc(datetime_convert()),
}
// if this is a relayed delete, propagate it to other recipients
- if ($entrytype == DFRN_REPLY_RC) {
+ if($entrytype == DFRN_REPLY_RC) {
logger("Notifying followers about deletion of post ".$item["id"], LOGGER_DEBUG);
proc_run(PRIORITY_HIGH, "include/notifier.php","drop", $item["id"]);
}
if ($xml == "")
return;
- if ($importer["readonly"]) {
+ if($importer["readonly"]) {
// We aren't receiving stuff from this person. But we will quietly ignore them
// rather than a blatant "go away" message.
logger('ignoring contact '.$importer["id"]);
// Update the contact table if the data has changed
// The "atom:author" is only present in feeds
- if ($xpath->query("/atom:feed/atom:author")->length > 0) {
+ if ($xpath->query("/atom:feed/atom:author")->length > 0)
self::fetchauthor($xpath, $doc->firstChild, $importer, "atom:author", false, $xml);
- }
// Only the "dfrn:owner" in the head section contains all data
- if ($xpath->query("/atom:feed/dfrn:owner")->length > 0) {
+ if ($xpath->query("/atom:feed/dfrn:owner")->length > 0)
self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
- }
logger("Import DFRN message for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG);
if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
$accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue);
- if ($accounttype != $importer["contact-type"]) {
+ if ($accounttype != $importer["contact-type"])
q("UPDATE `contact` SET `contact-type` = %d WHERE `id` = %d",
intval($accounttype),
intval($importer["id"])
);
- }
}
// is it a public forum? Private forums aren't supported with this method
// This is deprecated since 3.5.1
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()", $context)->item(0)->nodeValue);
- if ($forum != $importer["forum"]) {
+ if ($forum != $importer["forum"])
q("UPDATE `contact` SET `forum` = %d WHERE `forum` != %d AND `id` = %d",
intval($forum), intval($forum),
intval($importer["id"])
);
- }
$mails = $xpath->query("/atom:feed/dfrn:mail");
foreach ($mails AS $mail) {