Some more documentation

This commit is contained in:
Michael 2018-09-27 03:28:56 +00:00
parent 897929ad40
commit fa868fbaf2

View File

@ -439,10 +439,10 @@ class ActivityPub
} }
/** /**
* @brief * @brief Fetches an array of inboxes for the given item and user
* *
* @param array $item * @param array $item
* @param $uid * @param integer $uid User ID
* *
* @return array with inboxes * @return array with inboxes
*/ */
@ -490,11 +490,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Returns the activity type of a given item
* *
* @param array $item * @param array $item
* *
* @return * @return activity type
*/ */
public static function getTypeOfItem($item) public static function getTypeOfItem($item)
{ {
@ -522,12 +522,12 @@ class ActivityPub
} }
/** /**
* @brief * @brief Creates an activity array for a given item id
* *
* @param $item_id * @param integer $item_id
* @param $object_mode * @param boolean $object_mode Is the activity item is used inside another object?
* *
* @return * @return array of activity
*/ */
public static function createActivityFromItem($item_id, $object_mode = false) public static function createActivityFromItem($item_id, $object_mode = false)
{ {
@ -592,11 +592,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Creates an object array for a given item id
* *
* @param $item_id * @param integer $item_id
* *
* @return * @return object array
*/ */
public static function createObjectFromItemID($item_id) public static function createObjectFromItemID($item_id)
{ {
@ -613,11 +613,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Returns a tag array for a given item array
* *
* @param array $item * @param array $item
* *
* @return * @return array of tags
*/ */
private static function createTagList($item) private static function createTagList($item)
{ {
@ -640,11 +640,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Fetches the "context" value for a givem item array from the "conversation" table
* *
* @param array $item * @param array $item
* *
* @return * @return string with context url
*/ */
private static function fetchContextURLForItem($item) private static function fetchContextURLForItem($item)
{ {
@ -660,11 +660,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Creates a note/article object array
* *
* @param array $item * @param array $item
* *
* @return * @return object array
*/ */
private static function CreateNote($item) private static function CreateNote($item)
{ {
@ -721,13 +721,11 @@ class ActivityPub
} }
/** /**
* @brief * @brief Transmits a given activity to a target
* *
* @param array $activity * @param array $activity
* @param $target * @param string $target Target profile
* @param $uid * @param integer $uid User ID
*
* @return
*/ */
public static function transmitActivity($activity, $target, $uid) public static function transmitActivity($activity, $target, $uid)
{ {
@ -745,17 +743,15 @@ class ActivityPub
logger('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG); logger('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
} }
/** /**
* @brief * @brief Transmit a message that the contact request had been accepted
* *
* @param $target * @param string $target Target profile
* @param $id * @param $id
* @param $uid * @param integer $uid User ID
*
* @return
*/ */
public static function transmitContactAccept($target, $id, $uid) public static function transmitContactAccept($target, $id, $uid)
{ {
@ -774,17 +770,15 @@ class ActivityPub
logger('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); logger('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
} }
/** /**
* @brief * @brief
* *
* @param $target * @param string $target Target profile
* @param $id * @param $id
* @param $uid * @param integer $uid User ID
*
* @return
*/ */
public static function transmitContactReject($target, $id, $uid) public static function transmitContactReject($target, $id, $uid)
{ {
@ -803,16 +797,14 @@ class ActivityPub
logger('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); logger('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
} }
/** /**
* @brief * @brief
* *
* @param $target * @param string $target Target profile
* @param $uid * @param integer $uid User ID
*
* @return
*/ */
public static function transmitContactUndo($target, $uid) public static function transmitContactUndo($target, $uid)
{ {
@ -833,7 +825,7 @@ class ActivityPub
logger('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); logger('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
} }
/** /**
@ -897,7 +889,7 @@ class ActivityPub
* *
* @param $body * @param $body
* @param $header * @param $header
* @param $uid * @param integer $uid User ID
*/ */
public static function processInbox($body, $header, $uid) public static function processInbox($body, $header, $uid)
{ {
@ -952,7 +944,7 @@ class ActivityPub
* @brief * @brief
* *
* @param $url * @param $url
* @param $uid * @param integer $uid User ID
*/ */
public static function fetchOutbox($url, $uid) public static function fetchOutbox($url, $uid)
{ {
@ -981,7 +973,7 @@ class ActivityPub
* @brief * @brief
* *
* @param array $activity * @param array $activity
* @param $uid * @param integer $uid User ID
* @param $trust_source * @param $trust_source
* *
* @return * @return
@ -1052,7 +1044,7 @@ class ActivityPub
* *
* @param array $activity * @param array $activity
* @param $body * @param $body
* @param $uid * @param integer $uid User ID
* @param $trust_source * @param $trust_source
*/ */
private static function processActivity($activity, $body = '', $uid = null, $trust_source = false) private static function processActivity($activity, $body = '', $uid = null, $trust_source = false)
@ -1221,7 +1213,7 @@ class ActivityPub
* @brief * @brief
* *
* @param $cid * @param $cid
* @param $uid * @param integer $uid User ID
* @param $url * @param $url
*/ */
private static function switchContact($cid, $uid, $url) private static function switchContact($cid, $uid, $url)