Code cleanup in Protocol\DFRN

- Remove commented out code
- Fix mixed quote style
This commit is contained in:
Hypolite Petovan 2018-01-19 11:50:43 -05:00
parent 035394cbf2
commit dd07c47ab2

View File

@ -1310,8 +1310,6 @@ class DFRN
$postvars['rino'] = $rino_remote_version; $postvars['rino'] = $rino_remote_version;
$postvars['data'] = bin2hex($data); $postvars['data'] = bin2hex($data);
//logger('rino: sent key = ' . $key, LOGGER_DEBUG);
if ($dfrn_version >= 2.1) { 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'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))
@ -2162,8 +2160,6 @@ class DFRN
* valid community action. Also forum_mode makes it valid for sure. * valid community action. Also forum_mode makes it valid for sure.
* If neither, it's not. * If neither, it's not.
*/ */
/// @TODO Maybe merge these if() blocks into one?
if ($is_a_remote_action && $community && (!$r[0]["forum_mode"]) && (!$r[0]["wall"])) { if ($is_a_remote_action && $community && (!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
$is_a_remote_action = false; $is_a_remote_action = false;
logger("not a community action"); logger("not a community action");
@ -2365,21 +2361,12 @@ class DFRN
$title = ""; $title = "";
foreach ($links as $link) { foreach ($links as $link) {
foreach ($link->attributes as $attributes) { foreach ($link->attributes as $attributes) {
/// @TODO Rewrite these repeated (same) if () statements to a switch() switch ($attributes->name) {
if ($attributes->name == "href") { case "href" : $href = $attributes->textContent; break;
$href = $attributes->textContent; case "rel" : $rel = $attributes->textContent; break;
} case "type" : $type = $attributes->textContent; break;
if ($attributes->name == "rel") { case "length": $length = $attributes->textContent; break;
$rel = $attributes->textContent; case "title" : $title = $attributes->textContent; break;
}
if ($attributes->name == "type") {
$type = $attributes->textContent;
}
if ($attributes->name == "length") {
$length = $attributes->textContent;
}
if ($attributes->name == "title") {
$title = $attributes->textContent;
} }
} }
if (($rel != "") && ($href != "")) { if (($rel != "") && ($href != "")) {
@ -2630,16 +2617,6 @@ class DFRN
if (($item["network"] != $author["network"]) && ($author["network"] != "")) { if (($item["network"] != $author["network"]) && ($author["network"] != "")) {
$item["network"] = $author["network"]; $item["network"] = $author["network"];
} }
/// @TODO maybe remove this old-lost code then?
// This code was taken from the old DFRN code
// 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) {
// logger("Contact ".$importer["id"]." is only follower. Quitting", LOGGER_DEBUG);
// return;
//}
} }
if ($entrytype == DFRN_REPLY_RC) { if ($entrytype == DFRN_REPLY_RC) {
@ -2656,13 +2633,12 @@ class DFRN
$ev = bbtoevent($item["body"]); $ev = bbtoevent($item["body"]);
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) { if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) {
logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG); logger("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
/// @TODO Mixure of "/' ahead ... $ev["cid"] = $importer["id"];
$ev["cid"] = $importer["id"]; $ev["uid"] = $importer["uid"];
$ev["uid"] = $importer["uid"]; $ev["uri"] = $item["uri"];
$ev["uri"] = $item["uri"]; $ev["edited"] = $item["edited"];
$ev["edited"] = $item["edited"]; $ev["private"] = $item["private"];
$ev['private'] = $item['private']; $ev["guid"] = $item["guid"];
$ev["guid"] = $item["guid"];
$r = q( $r = q(
"SELECT `id` FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", "SELECT `id` FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",