From: Michael <heluecht@pirati.ca>
Date: Thu, 4 May 2017 05:11:19 +0000 (+0000)
Subject: Standards and documentation
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=65823fe28f93b61ade6011f29c5e68696b77a6e2;p=friendica.git

Standards and documentation
---

diff --git a/include/diaspora.php b/include/diaspora.php
index 7e82ecc795..39d4353429 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -380,6 +380,7 @@ class Diaspora {
 	 *
 	 * @param array $importer Array of the importer user
 	 * @param array $msg The post that will be dispatched
+	 * @param object $fields SimpleXML object that contains the message
 	 *
 	 * @return int The message id of the generated message, "true" or "false" if there was an error
 	 */
@@ -457,9 +458,8 @@ class Diaspora {
 	 * It also does the conversion between the old and the new diaspora format.
 	 *
 	 * @param array $msg Array with the XML, the sender handle and the sender signature
-	 * @param object $fields SimpleXML object that contains the posting when it is valid
 	 *
-	 * @return bool Is the posting valid?
+	 * @return bool|array If the posting is valid then an array with an SimpleXML object is returned
 	 */
 	private static function valid_posting($msg) {
 
@@ -556,9 +556,9 @@ class Diaspora {
 			}
 
 		// Only some message types have signatures. So we quit here for the other types.
-		if (!in_array($type, array("comment", "message", "like")))
+		if (!in_array($type, array("comment", "message", "like"))) {
 			return array("fields" => $fields, "relayed" => false);
-
+		}
 		// 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);
@@ -583,8 +583,9 @@ class Diaspora {
 		if (!rsa_verify($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);
 			return false;
-		} else
+		} else {
 			return array("fields" => $fields, "relayed" => $relayed);
+		}
 	}
 
 	/**