Fix PHPDoc comments project-wide

This commit is contained in:
Hypolite Petovan 2019-01-06 16:06:53 -05:00
commit 3282ce5389
113 changed files with 1703 additions and 795 deletions

View file

@ -49,7 +49,7 @@ class ActivityPub
/**
* Checks if the web request is done for the AP protocol
*
* @return is it AP?
* @return bool is it AP?
*/
public static function isRequest()
{
@ -63,6 +63,7 @@ class ActivityPub
* @param string $url content url
* @param integer $uid User ID for the signature
* @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function fetchContent($url, $uid = 0)
{
@ -89,6 +90,8 @@ class ActivityPub
*
* @param string $url profile url
* @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function probeProfile($url)
{
@ -128,8 +131,9 @@ class ActivityPub
/**
* Fetches activities from the outbox of a given profile and processes it
*
* @param string $url
* @param string $url
* @param integer $uid User ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function fetchOutbox($url, $uid)
{

View file

@ -30,7 +30,7 @@ class Processor
*
* @param string $body
*
* @return converted body
* @return string converted body
*/
private static function convertMentions($body)
{
@ -93,7 +93,7 @@ class Processor
* @param array $attachments
* @param array $item
*
* @return item array
* @return array array
*/
private static function constructAttachList($attachments, $item)
{
@ -124,7 +124,8 @@ class Processor
/**
* Updates a message
*
* @param array $activity Activity array
* @param array $activity Activity array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function updateItem($activity)
{
@ -143,7 +144,9 @@ class Processor
/**
* Prepares data for a message
*
* @param array $activity Activity array
* @param array $activity Activity array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createItem($activity)
{
@ -173,6 +176,8 @@ class Processor
* Delete items
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function deleteItem($activity)
{
@ -187,6 +192,8 @@ class Processor
*
* @param array $activity Activity array
* @param string $verb Activity verb
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createActivity($activity, $verb)
{
@ -206,6 +213,7 @@ class Processor
*
* @param array $activity Activity array
* @param array $item
* @throws \Exception
*/
public static function createEvent($activity, $item)
{
@ -237,8 +245,10 @@ class Processor
/**
* Creates an item post
*
* @param array $activity Activity data
* @param array $item item array
* @param array $activity Activity data
* @param array $item item array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function postItem($activity, $item)
{
@ -327,6 +337,7 @@ class Processor
*
* @param $url
* @param $child
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchMissingActivity($url, $child)
{
@ -370,6 +381,8 @@ class Processor
* perform a "follow" request
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function followUser($activity)
{
@ -412,6 +425,7 @@ class Processor
* Update the given profile
*
* @param array $activity
* @throws \Exception
*/
public static function updatePerson($activity)
{
@ -427,6 +441,7 @@ class Processor
* Delete the given profile
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function deletePerson($activity)
{
@ -453,6 +468,8 @@ class Processor
* Accept a follow request
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function acceptFollowUser($activity)
{
@ -487,6 +504,8 @@ class Processor
* Reject a follow request
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function rejectFollowUser($activity)
{
@ -517,6 +536,8 @@ class Processor
* Undo activity like "like" or "dislike"
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function undoActivity($activity)
{
@ -540,6 +561,8 @@ class Processor
* Activity to remove a follower
*
* @param array $activity
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function undoFollowUser($activity)
{
@ -571,6 +594,7 @@ class Processor
* Switches a contact to AP if needed
*
* @param integer $cid Contact ID
* @throws \Exception
*/
private static function switchContact($cid)
{

View file

@ -42,7 +42,7 @@ class Receiver
/**
* Checks if the web request is done for the AP protocol
*
* @return is it AP?
* @return bool is it AP?
*/
public static function isRequest()
{
@ -53,9 +53,10 @@ class Receiver
/**
* Checks incoming message from the inbox
*
* @param $body
* @param $header
* @param $body
* @param $header
* @param integer $uid User ID
* @throws \Exception
*/
public static function processInbox($body, $header, $uid)
{
@ -114,9 +115,11 @@ class Receiver
*
* @param array $activity
* @param string $object_id Object ID of the the provided object
* @param integer $uid User ID
* @param integer $uid User ID
*
* @return string with object type
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchObjectType($activity, $object_id, $uid = 0)
{
@ -152,11 +155,13 @@ class Receiver
/**
* Prepare the object array
*
* @param array $activity
* @param array $activity
* @param integer $uid User ID
* @param $trust_source
* @param $trust_source
*
* @return array with object data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function prepareObjectData($activity, $uid, &$trust_source)
{
@ -264,6 +269,7 @@ class Receiver
*
* @param array $activity Array with activity data
* @param string $body The raw message
* @throws \Exception
*/
private static function storeConversation($activity, $body)
{
@ -290,6 +296,7 @@ class Receiver
* @param string $body
* @param integer $uid User ID
* @param boolean $trust_source Do we trust the source?
* @throws \Exception
*/
public static function processActivity($activity, $body = '', $uid = null, $trust_source = false)
{
@ -428,11 +435,12 @@ class Receiver
/**
* Fetch the receiver list from an activity array
*
* @param array $activity
* @param array $activity
* @param string $actor
* @param array $tags
* @param array $tags
*
* @return array with receivers (user id)
* @throws \Exception
*/
private static function getReceivers($activity, $actor, $tags = [])
{
@ -523,9 +531,10 @@ class Receiver
* Fetch the receiver list of a given actor
*
* @param string $actor
* @param array $tags
* @param array $tags
*
* @return array with receivers (user id)
* @throws \Exception
*/
public static function getReceiverForActor($actor, $tags)
{
@ -546,11 +555,12 @@ class Receiver
/**
* Tests if the contact is a valid receiver for this actor
*
* @param array $contact
* @param array $contact
* @param string $actor
* @param array $tags
* @param array $tags
*
* @return array with receivers (user id)
* @return bool with receivers (user id)
* @throws \Exception
*/
private static function isValidReceiverForActor($contact, $actor, $tags)
{
@ -589,7 +599,9 @@ class Receiver
*
* @param integer $cid Contact ID
* @param integer $uid User ID
* @param string $url Profile URL
* @param string $url Profile URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function switchContact($cid, $uid, $url)
{
@ -622,6 +634,8 @@ class Receiver
*
* @param $receivers
* @param $actor
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function switchContacts($receivers, $actor)
{
@ -645,10 +659,10 @@ class Receiver
/**
*
*
* @param $object_data
* @param $object_data
* @param array $activity
*
* @return
* @return mixed
*/
private static function addActivityFields($object_data, $activity)
{
@ -674,6 +688,8 @@ class Receiver
* @param integer $uid User ID for the signature that we use to fetch data
*
* @return array with trusted and valid object data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchObject($object_id, $object = [], $trust_source = false, $uid = 0)
{
@ -759,8 +775,7 @@ class Receiver
/**
* Convert emojis from JSON-LD format into a simplified format
*
* @param array $tags Tags in JSON-LD format
*
* @param $emojis
* @return array with emojis in a simplified format
*/
private static function processEmojis($emojis)
@ -819,6 +834,7 @@ class Receiver
* @param array $object
*
* @return array
* @throws \Exception
*/
private static function processObject($object)
{

View file

@ -42,10 +42,11 @@ class Transmitter
/**
* collects the lost of followers of the given owner
*
* @param array $owner Owner array
* @param integer $page Page number
* @param array $owner Owner array
* @param integer $page Page number
*
* @return array of owners
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getFollowers($owner, $page = null)
{
@ -89,10 +90,11 @@ class Transmitter
/**
* Create list of following contacts
*
* @param array $owner Owner array
* @param integer $page Page numbe
* @param array $owner Owner array
* @param integer $page Page numbe
*
* @return array of following contacts
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getFollowing($owner, $page = null)
{
@ -136,10 +138,12 @@ class Transmitter
/**
* Public posts for the given owner
*
* @param array $owner Owner array
* @param integer $page Page numbe
* @param array $owner Owner array
* @param integer $page Page numbe
*
* @return array of posts
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function getOutbox($owner, $page = null)
{
@ -186,6 +190,7 @@ class Transmitter
*
* @param integer $uid User ID
* @return array with profile data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getProfile($uid)
{
@ -246,6 +251,8 @@ class Transmitter
* @param array $item
*
* @return array with permissions
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchPermissionBlockFromConversation($item)
{
@ -295,11 +302,13 @@ class Transmitter
/**
* Creates an array of permissions from an item thread
*
* @param array $item
* @param array $item
* @param boolean $blindcopy
* @param boolean $last_id
*
* @return array with permission data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0)
{
@ -441,10 +450,12 @@ class Transmitter
/**
* Fetches a list of inboxes of followers of a given user
*
* @param integer $uid User ID
* @param integer $uid User ID
* @param boolean $personal fetch personal inboxes
*
* @return array of follower inboxes
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function fetchTargetInboxesforUser($uid, $personal = false)
{
@ -486,12 +497,14 @@ class Transmitter
/**
* Fetches an array of inboxes for the given item and user
*
* @param array $item
* @param integer $uid User ID
* @param array $item
* @param integer $uid User ID
* @param boolean $personal fetch personal inboxes
* @param integer $last_id Last item id for adding receivers
*
* @return array with inboxes
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0)
{
@ -545,6 +558,8 @@ class Transmitter
* @param array $item
*
* @return string with activity type
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function getTypeOfItem($item)
{
@ -585,9 +600,10 @@ class Transmitter
* Creates the activity or fetches it from the cache
*
* @param integer $item_id
* @param boolean $force Force new cache entry
* @param boolean $force Force new cache entry
*
* @return array with the activity
* @throws \Exception
*/
public static function createCachedActivityFromItem($item_id, $force = false)
{
@ -613,6 +629,7 @@ class Transmitter
* @param boolean $object_mode Is the activity item is used inside another object?
*
* @return array of activity
* @throws \Exception
*/
public static function createActivityFromItem($item_id, $object_mode = false)
{
@ -692,6 +709,8 @@ class Transmitter
* @param integer $item_id
*
* @return array with the object data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createObjectFromItemID($item_id)
{
@ -747,6 +766,7 @@ class Transmitter
* @param array $item
*
* @return array of tags
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function createTagList($item)
{
@ -774,10 +794,11 @@ class Transmitter
/**
* Adds attachment data to the JSON document
*
* @param array $item Data of the item that is to be posted
* @param text $type Object type
* @param array $item Data of the item that is to be posted
* @param string $type Object type
*
* @return array with attachment data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function createAttachmentList($item, $type)
{
@ -826,11 +847,12 @@ class Transmitter
return $attachments;
}
/**
/**
* @brief Callback function to replace a Friendica style mention in a mention that is used on AP
*
* @param array $match Matching values for the callback
* @return string Replaced mention
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function mentionCallback($match)
{
@ -870,6 +892,7 @@ class Transmitter
* @param array $item
*
* @return string with context url
* @throws \Exception
*/
private static function fetchContextURLForItem($item)
{
@ -890,6 +913,7 @@ class Transmitter
* @param integer $item_id
*
* @return boolean
* @throws \Exception
*/
private static function isSensitive($item_id)
{
@ -903,6 +927,7 @@ class Transmitter
* @param array $item
*
* @return array with the event data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function createEvent($item)
{
@ -929,6 +954,8 @@ class Transmitter
* @param array $item
*
* @return array with the object data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createNote($item)
{
@ -1019,6 +1046,8 @@ class Transmitter
* @param array $item
*
* @return string with announced object url
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createAnnounce($item)
{
@ -1062,11 +1091,12 @@ class Transmitter
/**
* Transmits a contact suggestion to a given inbox
*
* @param integer $uid User ID
* @param string $inbox Target inbox
* @param integer $uid User ID
* @param string $inbox Target inbox
* @param integer $suggestion_id Suggestion ID
*
* @return boolean was the transmission successful?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function sendContactSuggestion($uid, $inbox, $suggestion_id)
{
@ -1093,10 +1123,11 @@ class Transmitter
/**
* Transmits a profile relocation to a given inbox
*
* @param integer $uid User ID
* @param string $inbox Target inbox
* @param integer $uid User ID
* @param string $inbox Target inbox
*
* @return boolean was the transmission successful?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function sendProfileRelocation($uid, $inbox)
{
@ -1121,10 +1152,11 @@ class Transmitter
/**
* Transmits a profile deletion to a given inbox
*
* @param integer $uid User ID
* @param string $inbox Target inbox
* @param integer $uid User ID
* @param string $inbox Target inbox
*
* @return boolean was the transmission successful?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function sendProfileDeletion($uid, $inbox)
{
@ -1149,10 +1181,12 @@ class Transmitter
/**
* Transmits a profile change to a given inbox
*
* @param integer $uid User ID
* @param string $inbox Target inbox
* @param integer $uid User ID
* @param string $inbox Target inbox
*
* @return boolean was the transmission successful?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendProfileUpdate($uid, $inbox)
{
@ -1178,10 +1212,12 @@ class Transmitter
/**
* Transmits a given activity to a target
*
* @param array $activity
* @param string $target Target profile
* @param integer $uid User ID
* @param string $id activity id
* @param array $activity
* @param string $target Target profile
* @param integer $uid User ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @throws \Exception
*/
public static function sendActivity($activity, $target, $uid, $id = '')
{
@ -1210,9 +1246,11 @@ class Transmitter
/**
* Transmit a message that the contact request had been accepted
*
* @param string $target Target profile
* @param $id
* @param integer $uid User ID
* @param string $target Target profile
* @param $id
* @param integer $uid User ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendContactAccept($target, $id, $uid)
{
@ -1238,9 +1276,11 @@ class Transmitter
/**
* Reject a contact request or terminates the contact relation
*
* @param string $target Target profile
* @param $id
* @param integer $uid User ID
* @param string $target Target profile
* @param $id
* @param integer $uid User ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendContactReject($target, $id, $uid)
{
@ -1266,9 +1306,11 @@ class Transmitter
/**
* Transmits a message that we don't want to follow this contact anymore
*
* @param string $target Target profile
* @param integer $cid Contact ID of target
* @param integer $uid User ID
* @param string $target Target profile
* @param integer $uid User ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @throws \Exception
*/
public static function sendContactUndo($target, $cid, $uid)
{

View file

@ -56,6 +56,7 @@ class DFRN
* @param integer $uid User id
*
* @return array importer
* @throws \Exception
*/
public static function getImporter($cid, $uid = 0)
{
@ -96,7 +97,9 @@ class DFRN
* @param array $owner Owner record
*
* @return string DFRN entries
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find proper type-hints
*/
public static function entries($items, $owner)
{
@ -134,6 +137,8 @@ class DFRN
* @param boolean $onlyheader Output only the header without content? (Default is "no")
*
* @return string DFRN feed entries
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function feed($dfrn_id, $owner_nick, $last_update, $direction = 0, $onlyheader = false)
{
@ -341,6 +346,8 @@ class DFRN
* @param boolean $conversation Show the conversation. If false show the single post.
*
* @return string DFRN feed entry
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function itemFeed($item_id, $conversation = false)
{
@ -406,7 +413,8 @@ class DFRN
* @param array $owner Owner record
*
* @return string DFRN mail
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
public static function mail($item, $owner)
{
@ -442,7 +450,8 @@ class DFRN
* @param array $owner Owner record
*
* @return string DFRN suggestions
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
public static function fsuggest($item, $owner)
{
@ -471,7 +480,8 @@ class DFRN
* @param int $uid User ID
*
* @return string DFRN relocations
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
public static function relocate($owner, $uid)
{
@ -532,7 +542,8 @@ class DFRN
* @param bool $public Is it a header for public posts?
*
* @return object XML root object
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addHeader($doc, $owner, $authorelement, $alternatelink = "", $public = false)
{
@ -608,7 +619,8 @@ class DFRN
* @param boolean $public boolean
*
* @return object XML author object
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addAuthor($doc, $owner, $authorelement, $public)
{
@ -752,7 +764,8 @@ class DFRN
* @param array $item Item elements
*
* @return object XML author object
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addEntryAuthor($doc, $element, $contact_url, $item)
{
@ -793,7 +806,8 @@ class DFRN
* @param string $activity activity value
*
* @return object XML activity object
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function createActivity($doc, $element, $activity)
{
@ -858,8 +872,8 @@ class DFRN
* @param object $root XML root
* @param array $item Item element
*
* @return object XML attachment object
* @todo Find proper type-hints
* @return void XML attachment object
* @todo Find proper type-hints
*/
private static function getAttachment($doc, $root, $item)
{
@ -899,7 +913,9 @@ class DFRN
* @param bool $single If set, the entry is created as an XML document with a single "entry" element
*
* @return object XML entry object
* @todo Find proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find proper type-hints
*/
private static function entry($doc, $type, array $item, array $owner, $comment = false, $cid = 0, $single = false)
{
@ -1155,8 +1171,11 @@ class DFRN
* @param string $atom Content that will be transmitted
* @param bool $dissolve (to be documented)
*
* @param bool $legacy_transport
* @return int Deliver status. Negative values mean an error.
* @todo Add array type-hint for $owner, $contact
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Add array type-hint for $owner, $contact
*/
public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
{
@ -1412,11 +1431,14 @@ class DFRN
/**
* @brief Transmits atom content to the contacts via the Diaspora transport layer
*
* @param array $owner Owner record
* @param array $contact Contact record of the receiver
* @param string $atom Content that will be transmitted
* @param array $owner Owner record
* @param array $contact Contact record of the receiver
* @param string $atom Content that will be transmitted
*
* @param bool $public_batch
* @return int Deliver status. Negative values mean an error.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function transmit($owner, $contact, $atom, $public_batch = false)
{
@ -1514,7 +1536,9 @@ class DFRN
* @param string $xml optional, default empty
*
* @return array Relevant data of the author
* @todo Find good type-hints for all parameter
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find good type-hints for all parameter
*/
private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "")
{
@ -1835,7 +1859,8 @@ class DFRN
* @param object $mail mail elements
* @param array $importer Record of the importer user mixed with contact of the content
* @return void
* @todo Find good type-hints for all parameter
* @throws \Exception
* @todo Find good type-hints for all parameter
*/
private static function processMail($xpath, $mail, $importer)
{
@ -1890,7 +1915,8 @@ class DFRN
* @param object $suggestion suggestion elements
* @param array $importer Record of the importer user mixed with contact of the content
* @return boolean
* @todo Find good type-hints for all parameter
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find good type-hints for all parameter
*/
private static function processSuggestion($xpath, $suggestion, $importer)
{
@ -2008,7 +2034,9 @@ class DFRN
* @param object $relocation relocation elements
* @param array $importer Record of the importer user mixed with contact of the content
* @return boolean
* @todo Find good type-hints for all parameter
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find good type-hints for all parameter
*/
private static function processRelocation($xpath, $relocation, $importer)
{
@ -2092,7 +2120,8 @@ class DFRN
* @param array $importer Record of the importer user mixed with contact of the content
* @param int $entrytype Is it a toplevel entry, a comment or a relayed comment?
* @return mixed
* @todo set proper type-hints (array?)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo set proper type-hints (array?)
*/
private static function updateContent($current, $item, $importer, $entrytype)
{
@ -2123,7 +2152,8 @@ class DFRN
* @param array $item the new item record
*
* @return int Is it a toplevel entry, a comment or a relayed comment?
* @todo set proper type-hints (array?)
* @throws \Exception
* @todo set proper type-hints (array?)
*/
private static function getEntryType($importer, $item)
{
@ -2190,7 +2220,8 @@ class DFRN
* @param array $importer Record of the importer user mixed with contact of the content
* @param int $posted_id The record number of item record that was just posted
* @return void
* @todo set proper type-hints (array?)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo set proper type-hints (array?)
*/
private static function doPoke($item, $importer, $posted_id)
{
@ -2253,7 +2284,8 @@ class DFRN
* @param bool $is_like Is the verb a "like"?
*
* @return bool Should the processing of the entries be continued?
* @todo set proper type-hints (array?)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo set proper type-hints (array?)
*/
private static function processVerbs($entrytype, $importer, &$item, &$is_like)
{
@ -2400,7 +2432,9 @@ class DFRN
* @param array $importer Record of the importer user mixed with contact of the content
* @param object $xml xml
* @return void
* @todo Add type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Add type-hints
*/
private static function processEntry($header, $xpath, $entry, $importer, $xml)
{
@ -2741,7 +2775,8 @@ class DFRN
* @param object $deletion deletion elements
* @param array $importer Record of the importer user mixed with contact of the content
* @return void
* @todo set proper type-hints
* @throws \Exception
* @todo set proper type-hints
*/
private static function processDeletion($xpath, $deletion, $importer)
{
@ -2801,7 +2836,9 @@ class DFRN
* @param array $importer Record of the importer user mixed with contact of the content
* @param bool $sort_by_date Is used when feeds are polled
* @return integer Import status
* @todo set proper type-hints
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo set proper type-hints
*/
public static function import($xml, $importer, $sort_by_date = false)
{
@ -2938,6 +2975,7 @@ class DFRN
/**
* @param App $a App
* @param string $contact_nick contact nickname
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function autoRedir(App $a, $contact_nick)
{
@ -3091,6 +3129,10 @@ class DFRN
* item is assumed to be up-to-date. If the timestamps are equal it
* assumes the update has been seen before and should be ignored.
*
* @param $existing
* @param $update
* @return bool
* @throws \Exception
*/
private static function isEditedTimestampNewer($existing, $update)
{

View file

@ -53,6 +53,7 @@ class Diaspora
* @param array $contacts The previously fetched contacts
*
* @return array of relay servers
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function relayList($item_id, array $contacts = [])
{
@ -138,6 +139,7 @@ class Diaspora
*
* @param string $server_url The url of the server
* @return array with the contact
* @throws \Exception
*/
private static function getRelayContact($server_url)
{
@ -169,8 +171,9 @@ class Diaspora
/**
* @brief Update or insert a relay contact
*
* @param string $server_url The url of the server
* @param array $network_fields Optional network specific fields
* @param string $server_url The url of the server
* @param array $network_fields Optional network specific fields
* @throws \Exception
*/
public static function setRelayContact($server_url, array $network_fields = [])
{
@ -204,6 +207,7 @@ class Diaspora
* @param array $contacts The previously fetched contacts
*
* @return array of relay servers
* @throws \Exception
*/
public static function participantsForThread($thread, array $contacts)
{
@ -250,6 +254,7 @@ class Diaspora
* @param integer $level This value is only set inside this function to avoid endless loops
*
* @return string the repaired signature
* @throws \Exception
*/
private static function repairSignature($signature, $handle = "", $level = 1)
{
@ -276,6 +281,8 @@ class Diaspora
* @param string $envelope The magic envelope
*
* @return string verified data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function verifyMagicEnvelope($envelope)
{
@ -372,6 +379,8 @@ class Diaspora
* 'message' -> decoded Diaspora XML message
* 'author' -> author diaspora handle
* 'key' -> author public key (converted to pkcs#8)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function decodeRaw(array $importer, $raw, $no_exit = false)
{
@ -475,6 +484,8 @@ class Diaspora
* 'message' -> decoded Diaspora XML message
* 'author' -> author diaspora handle
* 'key' -> author public key (converted to pkcs#8)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function decode(array $importer, $xml)
{
@ -612,6 +623,8 @@ class Diaspora
* @param array $msg The post that will be dispatched
*
* @return int The message id of the generated message, "true" or "false" if there was an error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function dispatchPublic($msg)
{
@ -640,6 +653,8 @@ class Diaspora
* @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
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function dispatch(array $importer, $msg, $fields = null)
{
@ -746,6 +761,8 @@ class Diaspora
* @param array $msg Array with the XML, the sender handle and the sender signature
*
* @return bool|array If the posting is valid then an array with an SimpleXML object is returned
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function validPosting($msg)
{
@ -894,6 +911,8 @@ class Diaspora
* @param string $handle The handle
*
* @return string The public key
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function key($handle)
{
@ -915,6 +934,8 @@ class Diaspora
* @param string $handle The handle
*
* @return array the queried data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function personByHandle($handle)
{
@ -960,6 +981,7 @@ class Diaspora
* @brief Updates the fcontact table
*
* @param array $arr The fcontact data
* @throws \Exception
*/
private static function updateFContact($arr)
{
@ -983,6 +1005,7 @@ class Diaspora
* @param int $pcontact_id The id in the contact table (Used for the public contact)
*
* @return string the handle
* @throws \Exception
*/
private static function handleFromContact($contact_id, $pcontact_id = 0)
{
@ -1029,6 +1052,7 @@ class Diaspora
* @param mixed $fcontact_guid Hexadecimal string guid
*
* @return string the contact url or null
* @throws \Exception
*/
public static function urlFromContactGuid($fcontact_guid)
{
@ -1050,12 +1074,14 @@ class Diaspora
/**
* @brief Get a contact id for a given handle
*
* @todo Move to Friendica\Model\Contact
* @todo Move to Friendica\Model\Contact
*
* @param int $uid The user id
* @param string $handle The handle in the format user@domain.tld
*
* @return int Contact id
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function contactByHandle($uid, $handle)
{
@ -1139,6 +1165,7 @@ class Diaspora
* @param bool $is_comment Is the check for a comment?
*
* @return array The contact data
* @throws \Exception
*/
private static function allowedContactByHandle(array $importer, $handle, $is_comment = false)
{
@ -1169,6 +1196,7 @@ class Diaspora
* @param string $guid The guid of the message
*
* @return int|bool message id if the message already was stored into the system - or false.
* @throws \Exception
*/
private static function messageExists($uid, $guid)
{
@ -1249,6 +1277,8 @@ class Diaspora
* @param array $match array containing a link that has to be checked for a message link
* @param array $item The item array
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchGuidSub($match, $item)
{
@ -1265,6 +1295,8 @@ class Diaspora
* @param int $uid The user id of the user
*
* @return int the message id of the stored message or false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function storeByGuid($guid, $server, $uid = 0)
{
@ -1301,6 +1333,7 @@ class Diaspora
* 'message' => The message XML
* 'author' => The author handle
* 'key' => The public key of the author
* @throws \Exception
*/
private static function message($guid, $server, $level = 0)
{
@ -1377,6 +1410,7 @@ class Diaspora
* @param array $contact The contact of the item owner
*
* @return array the item record
* @throws \Exception
*/
private static function parentItem($uid, $guid, $author, array $contact)
{
@ -1421,6 +1455,7 @@ class Diaspora
* @return array
* 'cid' => contact id
* 'network' => network type
* @throws \Exception
*/
private static function authorContactByUrl($def_contact, $person, $uid)
{
@ -1457,6 +1492,8 @@ class Diaspora
* @param string $parent_guid optional parent guid
*
* @return string the post link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function plink($addr, $guid, $parent_guid = '')
{
@ -1493,6 +1530,8 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveAccountMigration(array $importer, $data)
{
@ -1550,9 +1589,10 @@ class Diaspora
/**
* @brief Processes an account deletion
*
* @param object $data The message object
* @param object $data The message object
*
* @return bool Success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function receiveAccountDeletion($data)
{
@ -1578,6 +1618,8 @@ class Diaspora
* @param boolean $onlyfound Only return uri when found in the database
*
* @return string The constructed uri or the one from our database
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function getUriFromGuid($author, $guid, $onlyfound = false)
{
@ -1604,6 +1646,7 @@ class Diaspora
* @param string $uid Author handle
*
* @return string The post guid
* @throws \Exception
*/
private static function getGuidFromUri($uri, $uid)
{
@ -1621,6 +1664,7 @@ class Diaspora
* @param string $guid The guid of the item
*
* @return array|boolean the origin owner of that post - or false
* @throws \Exception
*/
private static function importerForGuid($guid)
{
@ -1644,6 +1688,8 @@ class Diaspora
* @param string $xml The original XML of the message
*
* @return int The message id of the generated comment or "false" if there was an error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveComment(array $importer, $sender, $data, $xml)
{
@ -1761,6 +1807,7 @@ class Diaspora
* @param array $conversation The conversation record to which this message belongs
*
* @return bool "true" if it was successful
* @throws \Exception
*/
private static function receiveConversationMessage(array $importer, array $contact, $data, $msg, $mesg, $conversation)
{
@ -1850,6 +1897,7 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success
* @throws \Exception
*/
private static function receiveConversation(array $importer, $msg, $data)
{
@ -1908,6 +1956,8 @@ class Diaspora
* @param object $data The message object
*
* @return int The message id of the generated like or "false" if there was an error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveLike(array $importer, $sender, $data)
{
@ -2017,6 +2067,7 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success?
* @throws \Exception
*/
private static function receiveMessage(array $importer, $data)
{
@ -2109,6 +2160,8 @@ class Diaspora
* @param object $data The message object
*
* @return bool always true
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveParticipation(array $importer, $data)
{
@ -2202,6 +2255,8 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveProfile(array $importer, $data)
{
@ -2295,6 +2350,7 @@ class Diaspora
* @param array $importer Array of the importer user
* @param array $contact The contact that send the request
* @return void
* @throws \Exception
*/
private static function receiveRequestMakeFriend(array $importer, array $contact)
{
@ -2316,6 +2372,7 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success
* @throws \Exception
*/
private static function receiveContactRequest(array $importer, $data)
{
@ -2496,9 +2553,9 @@ class Diaspora
*
* @param string $guid message guid
* @param string $orig_author handle of the original post
* @param string $author handle of the sharer
*
* @return array The fetched item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function originalItem($guid, $orig_author)
{
@ -2579,6 +2636,8 @@ class Diaspora
* @param string $xml The original XML of the message
*
* @return int the message id
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveReshare(array $importer, $data, $xml)
{
@ -2671,6 +2730,7 @@ class Diaspora
* @param object $data The message object
*
* @return bool success
* @throws \Exception
*/
private static function itemRetraction(array $importer, array $contact, $data)
{
@ -2735,6 +2795,7 @@ class Diaspora
* @param object $data The message object
*
* @return bool Success
* @throws \Exception
*/
private static function receiveRetraction(array $importer, $sender, $data)
{
@ -2775,11 +2836,13 @@ class Diaspora
/**
* @brief Receives status messages
*
* @param array $importer Array of the importer user
* @param object $data The message object
* @param string $xml The original XML of the message
* @param array $importer Array of the importer user
* @param SimpleXMLElement $data The message object
* @param string $xml The original XML of the message
*
* @return int The message id of the newly created item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function receiveStatusMessage(array $importer, SimpleXMLElement $data, $xml)
{
@ -2900,6 +2963,7 @@ class Diaspora
* @param array $contact contact array
*
* @return string the handle in the format user@domain.tld
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function myHandle(array $contact)
{
@ -2929,6 +2993,7 @@ class Diaspora
* @param string $pubkey The public key of the receiver
*
* @return string The encrypted data
* @throws \Exception
*/
public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey)
{
@ -2967,6 +3032,7 @@ class Diaspora
* @param array $user The record of the sender
*
* @return string The envelope
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function buildMagicEnvelope($msg, array $user)
{
@ -3010,6 +3076,7 @@ class Diaspora
* @param bool $public Is the message public?
*
* @return string The message that will be transmitted to other servers
* @throws \Exception
*/
public static function buildMessage($msg, array $user, array $contact, $prvkey, $pubkey, $public = false)
{
@ -3053,7 +3120,10 @@ class Diaspora
* @param bool $queue_run Is the transmission called from the queue?
* @param string $guid message guid
*
* @param bool $no_queue
* @return int Result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false)
{
@ -3145,6 +3215,8 @@ class Diaspora
* @param bool $spool Should the transmission be spooled or transmitted?
*
* @return int Result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function buildAndTransmit(array $owner, array $contact, $type, $message, $public_batch = false, $guid = "", $spool = false)
{
@ -3176,9 +3248,10 @@ class Diaspora
* @brief sends a participation (Used to get all further updates)
*
* @param array $contact Target of the communication
* @param array $item Item array
* @param array $item Item array
*
* @return int The result of the transmission
* @throws \Exception
*/
private static function sendParticipation(array $contact, array $item)
{
@ -3225,9 +3298,11 @@ class Diaspora
*
* @param array $owner the array of the item owner
* @param array $contact Target of the communication
* @param int $uid User ID
* @param int $uid User ID
*
* @return int The result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendAccountMigration(array $owner, array $contact, $uid)
{
@ -3253,6 +3328,7 @@ class Diaspora
* @param array $contact Target of the communication
*
* @return int The result of the transmission
* @throws \Exception
*/
public static function sendShare(array $owner, array $contact)
{
@ -3296,6 +3372,7 @@ class Diaspora
* @param array $contact Target of the communication
*
* @return int The result of the transmission
* @throws \Exception
*/
public static function sendUnshare(array $owner, array $contact)
{
@ -3316,6 +3393,8 @@ class Diaspora
* @param bool $complete Should it be a complete check or a simple check?
*
* @return array|bool Reshare details or "false" if no reshare
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function isReshare($body, $complete = true)
{
@ -3403,6 +3482,7 @@ class Diaspora
* @param integer $event_id The id of the event
*
* @return array with event data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function buildEvent($event_id)
{
@ -3485,6 +3565,8 @@ class Diaspora
* @return array
* 'type' -> Message type ("status_message" or "reshare")
* 'message' -> Array of XML elements of the status
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function buildStatus(array $item, array $owner)
{
@ -3599,6 +3681,8 @@ class Diaspora
* @param bool $public_batch Is it a public post?
*
* @return int The result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendStatus(array $item, array $owner, array $contact, $public_batch = false)
{
@ -3614,6 +3698,7 @@ class Diaspora
* @param array $owner the array of the item owner
*
* @return array The data for a "like"
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function constructLike(array $item, array $owner)
{
@ -3645,6 +3730,7 @@ class Diaspora
* @param array $owner the array of the item owner
*
* @return array The data for an "EventParticipation"
* @throws \Exception
*/
private static function constructAttend(array $item, array $owner)
{
@ -3682,6 +3768,7 @@ class Diaspora
* @param array $owner the array of the item owner
*
* @return array The data for a comment
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function constructComment(array $item, array $owner)
{
@ -3726,6 +3813,8 @@ class Diaspora
* @param bool $public_batch Is it a public post?
*
* @return int The result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendFollowup(array $item, array $owner, array $contact, $public_batch = false)
{
@ -3752,10 +3841,8 @@ class Diaspora
/**
* @brief Creates a message from a signature record entry
*
* @param array $item The item that will be exported
* @param array $signature The entry of the "sign" record
*
* @return string The message
* @param array $item The item that will be exported
* @return array The message
*/
private static function messageFromSignature(array $item)
{
@ -3806,6 +3893,7 @@ class Diaspora
* @param bool $public_batch Is it a public post?
*
* @return int The result of the transmission
* @throws \Exception
*/
public static function sendRelay(array $item, array $owner, array $contact, $public_batch = false)
{
@ -3862,6 +3950,7 @@ class Diaspora
* @param bool $relay Is the retraction transmitted from a relay?
*
* @return int The result of the transmission
* @throws \Exception
*/
public static function sendRetraction(array $item, array $owner, array $contact, $public_batch = false, $relay = false)
{
@ -3894,6 +3983,8 @@ class Diaspora
* @param array $contact Target of the communication
*
* @return int The result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendMail(array $item, array $owner, array $contact)
{
@ -4004,6 +4095,7 @@ class Diaspora
* @param int $uid The user id
*
* @return array The profile data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function createProfileData($uid)
{
@ -4088,6 +4180,7 @@ class Diaspora
* @param int $uid The user id
* @param bool $recips optional, default false
* @return void
* @throws \Exception
*/
public static function sendProfile($uid, $recips = false)
{
@ -4129,6 +4222,7 @@ class Diaspora
* @param array $item Item array
*
* @return array Signed content
* @throws \Exception
*/
public static function createLikeSignature($uid, array $item)
{
@ -4159,6 +4253,7 @@ class Diaspora
* @param array $item Item array
*
* @return array Signed content
* @throws \Exception
*/
public static function createCommentSignature($uid, array $item)
{

View file

@ -19,6 +19,7 @@ class Email
* @param string $username The username
* @param string $password The password
* @return object
* @throws \Exception
*/
public static function connect($mailbox, $username, $password)
{
@ -45,6 +46,7 @@ class Email
* @param object $mbox mailbox
* @param string $email_addr email
* @return array
* @throws \Exception
*/
public static function poll($mbox, $email_addr)
{
@ -106,6 +108,7 @@ class Email
* @param integer $uid user id
* @param string $reply reply
* @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getMessage($mbox, $uid, $reply)
{
@ -321,6 +324,8 @@ class Email
*
* @return void
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo This could be changed to use the Emailer class
*/
public static function send($addr, $subject, $headers, $item)

View file

@ -25,13 +25,14 @@ class Feed {
/**
* @brief Read a RSS/RDF/Atom feed and create an item entry for it
*
* @param string $xml The feed data
* @param array $importer The user record of the importer
* @param array $contact The contact record of the feed
* @param string $hub Unused dummy value for compatibility reasons
* @param bool $simulate If enabled, no data is imported
* @param string $xml The feed data
* @param array $importer The user record of the importer
* @param array $contact The contact record of the feed
* @param string $hub Unused dummy value for compatibility reasons
* @param bool $simulate If enabled, no data is imported
*
* @return array In simulation mode it returns the header and the first item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function import($xml, $importer, &$contact, &$hub, $simulate = false) {

View file

@ -43,13 +43,15 @@ class OStatus
/**
* @brief Fetches author data
*
* @param object $xpath The xpath object
* @param object $context The xml context of the author details
* @param array $importer user record of the importing user
* @param array $contact Called by reference, will contain the fetched contact
* @param bool $onlyfetch Only fetch the header without updating the contact entries
* @param DOMXPath $xpath The xpath object
* @param object $context The xml context of the author details
* @param array $importer user record of the importing user
* @param array $contact Called by reference, will contain the fetched contact
* @param bool $onlyfetch Only fetch the header without updating the contact entries
*
* @return array Array of author related entries for the item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact = null, $onlyfetch)
{
@ -242,6 +244,8 @@ class OStatus
* @param array $importer user record of the importing user
*
* @return array Array of author related entries for the item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function salmonAuthor($xml, array $importer)
{
@ -296,6 +300,8 @@ class OStatus
* @param array $contact contact
* @param string $hub Called by reference, returns the fetched hub data
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function import($xml, array $importer, array &$contact = null, &$hub)
{
@ -313,6 +319,8 @@ class OStatus
* @param boolean $initialize Is it the leading post so that data has to be initialized?
*
* @return boolean Could the XML be processed?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true)
{
@ -556,8 +564,10 @@ class OStatus
/**
* Removes notice item from database
*
* @param array $item item
* @return void
* @throws \Exception
*/
private static function deleteNotice(array $item)
{
@ -575,11 +585,13 @@ class OStatus
/**
* @brief Processes the XML for a post
*
* @param object $xpath The xpath object
* @param object $entry The xml entry that is processed
* @param array $item The item array
* @param array $importer user record of the importing user
* @param DOMXPath $xpath The xpath object
* @param object $entry The xml entry that is processed
* @param array $item The item array
* @param array $importer user record of the importing user
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function processPost(DOMXPath $xpath, $entry, array &$item, array $importer)
{
@ -725,6 +737,7 @@ class OStatus
* @param string $conversation The link to the conversation
* @param string $conversation_uri The conversation in "uri" format
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchConversation($conversation, $conversation_uri)
{
@ -787,6 +800,7 @@ class OStatus
* @param string $conversation conversation
* @param string $conversation_uri conversation uri
* @return void
* @throws \Exception
*/
private static function storeConversation($xml, $conversation = '', $conversation_uri = '')
{
@ -870,6 +884,7 @@ class OStatus
* @param string $self The link to the self item
* @param array $item The item array
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchSelf($self, array &$item)
{
@ -905,6 +920,8 @@ class OStatus
* @param string $related_uri The related item in "uri" format
* @param array $importer user record of the importing user
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchRelated($related, $related_uri, $importer)
{
@ -1008,12 +1025,14 @@ class OStatus
/**
* @brief Processes the XML for a repeated post
*
* @param object $xpath The xpath object
* @param object $entry The xml entry that is processed
* @param array $item The item array
* @param array $importer user record of the importing user
* @param DOMXPath $xpath The xpath object
* @param object $entry The xml entry that is processed
* @param array $item The item array
* @param array $importer user record of the importing user
*
* @return array with data from links
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function processRepeatedItem(DOMXPath $xpath, $entry, array &$item, array $importer)
{
@ -1223,6 +1242,7 @@ class OStatus
* @param string $body The body
*
* @return string The cleaned body
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function formatPicturePost($body)
{
@ -1257,12 +1277,13 @@ class OStatus
/**
* @brief Adds the header elements to the XML document
*
* @param object $doc XML document
* @param array $owner Contact data of the poster
* @param string $filter The related feed filter (activity, posts or comments)
* @param bool $feed_mode Behave like a regular feed for users if true
* @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster
* @param string $filter The related feed filter (activity, posts or comments)
* @param bool $feed_mode Behave like a regular feed for users if true
*
* @return object header root element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
{
@ -1347,10 +1368,11 @@ class OStatus
/**
* @brief Add the link to the push hubs to the XML document
*
* @param object $doc XML document
* @param object $root XML root element where the hub links are added
* @param object $nick nick
* @param DOMDocument $doc XML document
* @param object $root XML root element where the hub links are added
* @param object $nick nick
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function hublinks(DOMDocument $doc, $root, $nick)
{
@ -1361,14 +1383,14 @@ class OStatus
/**
* @brief Adds attachment data to the XML document
*
* @param object $doc XML document
* @param object $root XML root element where the hub links are added
* @param array $item Data of the item that is to be posted
* @param DOMDocument $doc XML document
* @param object $root XML root element where the hub links are added
* @param array $item Data of the item that is to be posted
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function getAttachment(DOMDocument $doc, $root, $item)
{
$o = "";
$siteinfo = BBCode::getAttachedData($item["body"]);
switch ($siteinfo["type"]) {
@ -1433,11 +1455,12 @@ class OStatus
/**
* @brief Adds the author element to the XML document
*
* @param object $doc XML document
* @param array $owner Contact data of the poster
* @param bool $show_profile Whether to show profile
* @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster
* @param bool $show_profile Whether to show profile
*
* @return object author element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function addAuthor(DOMDocument $doc, array $owner, $show_profile = true)
{
@ -1550,13 +1573,15 @@ class OStatus
/**
* @brief Adds an entry element to the XML document
*
* @param object $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel optional default false
* @param bool $feed_mode Behave like a regular feed for users if true
* @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel optional default false
* @param bool $feed_mode Behave like a regular feed for users if true
*
* @return object Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function entry(DOMDocument $doc, array $item, array $owner, $toplevel = false, $feed_mode = false)
{
@ -1583,10 +1608,11 @@ class OStatus
/**
* @brief Adds a source entry to the XML document
*
* @param object $doc XML document
* @param array $contact Array of the contact that is added
* @param DOMDocument $doc XML document
* @param array $contact Array of the contact that is added
*
* @return object Source element
* @throws \Exception
*/
private static function sourceEntry(DOMDocument $doc, array $contact)
{
@ -1608,6 +1634,8 @@ class OStatus
* @param array $owner Contact data of the poster
*
* @return array Contact array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function contactEntry($url, array $owner)
{
@ -1655,13 +1683,15 @@ class OStatus
/**
* @brief Adds an entry element with reshared content
*
* @param object $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param string $repeated_guid guid
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param string $repeated_guid guid
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return object Entry element
* @return bool Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel)
{
@ -1719,12 +1749,14 @@ class OStatus
/**
* @brief Adds an entry element with a "like"
*
* @param object $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return object Entry element with "like"
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
{
@ -1759,9 +1791,9 @@ class OStatus
/**
* @brief Adds the person object element to the XML document
*
* @param object $doc XML document
* @param array $owner Contact data of the poster
* @param array $contact Contact data of the target
* @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster
* @param array $contact Contact data of the target
*
* @return object author element
*/
@ -1804,12 +1836,14 @@ class OStatus
/**
* @brief Adds a follow/unfollow entry element
*
* @param object $doc XML document
* @param array $item Data of the follow/unfollow message
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param DOMDocument $doc XML document
* @param array $item Data of the follow/unfollow message
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return object Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function followEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
{
@ -1866,13 +1900,15 @@ class OStatus
/**
* @brief Adds a regular entry element
*
* @param object $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param bool $feed_mode Behave like a regular feed for users if true
* @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param bool $feed_mode Behave like a regular feed for users if true
*
* @return object Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel, $feed_mode)
{
@ -1894,12 +1930,15 @@ class OStatus
/**
* @brief Adds a header element to the XML document
*
* @param object $doc XML document
* @param object $entry The entry element where the elements are added
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param DOMDocument $doc XML document
* @param object $entry The entry element where the elements are added
* @param array $owner Contact data of the poster
* @param array $item
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return string The title for the element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function entryHeader(DOMDocument $doc, &$entry, array $owner, array $item, $toplevel)
{
@ -1940,15 +1979,16 @@ class OStatus
/**
* @brief Adds elements to the XML document
*
* @param object $doc XML document
* @param object $entry Entry element where the content is added
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param string $title Title for the post
* @param string $verb The activity verb
* @param bool $complete Add the "status_net" element?
* @param bool $feed_mode Behave like a regular feed for users if true
* @param DOMDocument $doc XML document
* @param object $entry Entry element where the content is added
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param string $title Title for the post
* @param string $verb The activity verb
* @param bool $complete Add the "status_net" element?
* @param bool $feed_mode Behave like a regular feed for users if true
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function entryContent(DOMDocument $doc, $entry, array $item, array $owner, $title, $verb = "", $complete = true, $feed_mode = false)
{
@ -1988,13 +2028,14 @@ class OStatus
/**
* @brief Adds the elements at the foot of an entry to the XML document
*
* @param object $doc XML document
* @param object $entry The entry element where the elements are added
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $complete default true
* @param bool $feed_mode Behave like a regular feed for users if true
* @param DOMDocument $doc XML document
* @param object $entry The entry element where the elements are added
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param bool $complete default true
* @param bool $feed_mode Behave like a regular feed for users if true
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function entryFooter(DOMDocument $doc, $entry, array $item, array $owner, $complete = true, $feed_mode = false)
{
@ -2159,6 +2200,8 @@ class OStatus
* @param boolean $feed_mode Behave like a regular feed for users if true
*
* @return string XML feed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function feed($owner_nick, &$last_update, $max_items = 300, $filter = 'activity', $nocache = false, $feed_mode = false)
{
@ -2250,6 +2293,8 @@ class OStatus
* @param array $owner Contact data of the poster
*
* @return string XML for the salmon
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function salmon(array $item, array $owner)
{

View file

@ -44,7 +44,7 @@ class PortableContact
* Once the global contact is stored add (if necessary) the contact linkage which associates
* the given uid, cid to the global contact entry. There can be many uid/cid combinations
* pointing to the same global contact id.
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function loadWorker($cid, $uid = 0, $zcid = 0, $url = null)
{
@ -59,7 +59,7 @@ class PortableContact
* @param integer $uid User ID
* @param integer $zcid Global Contact ID
* @param integer $url POCO address that should be polled
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function load($cid, $uid, $zcid, $url)
{
@ -643,6 +643,7 @@ class PortableContact
*
* @param string $server_url address of the server
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchNodeinfo($server_url)
{
@ -696,6 +697,7 @@ class PortableContact
*
* @param string $nodeinfo_url address of the nodeinfo path
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function parseNodeinfo1($nodeinfo_url)
{
@ -780,6 +782,7 @@ class PortableContact
*
* @param string $nodeinfo_url address of the nodeinfo path
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function parseNodeinfo2($nodeinfo_url)
{
@ -1444,6 +1447,7 @@ class PortableContact
* @brief Fetch relay data from a given server url
*
* @param string $server_url address of the server
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function discoverRelay($server_url)
{
@ -1542,6 +1546,7 @@ class PortableContact
* @brief Fetch server list from remote servers and adds them when they are new.
*
* @param string $poco URL to the POCO endpoint
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function fetchServerlist($poco)
{

View file

@ -22,6 +22,7 @@ class Salmon
* @param string $uri Uniform Resource Identifier
* @param string $keyhash encoded key
* @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getKey($uri, $keyhash)
{
@ -86,6 +87,7 @@ class Salmon
* @param string $url url
* @param string $slap slap
* @return integer
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function slapper($owner, $url, $slap)
{
@ -205,6 +207,7 @@ class Salmon
/**
* @param string $pubkey public key
* @return string
* @throws \Exception
*/
public static function salmonKey($pubkey)
{