1
0
Fork 0

Fix PHPDoc comments project-wide

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

View file

@ -121,6 +121,7 @@ class App
* @see initHead() * @see initHead()
* *
* @param string $path * @param string $path
* @throws InternalServerErrorException
*/ */
public function registerStylesheet($path) public function registerStylesheet($path)
{ {
@ -137,6 +138,7 @@ class App
* @see initFooter() * @see initFooter()
* *
* @param string $path * @param string $path
* @throws InternalServerErrorException
*/ */
public function registerFooterScript($path) public function registerFooterScript($path)
{ {
@ -617,6 +619,7 @@ class App
* finally for PWD * finally for PWD
* *
* @return string * @return string
* @throws InternalServerErrorException
*/ */
public function getBasePath() public function getBasePath()
{ {
@ -676,6 +679,7 @@ class App
* *
* @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
* @return string Friendica server base URL * @return string Friendica server base URL
* @throws InternalServerErrorException
*/ */
public function getBaseURL($ssl = false) public function getBaseURL($ssl = false)
{ {
@ -709,6 +713,7 @@ class App
* Clears the baseurl cache to prevent inconsistencies * Clears the baseurl cache to prevent inconsistencies
* *
* @param string $url * @param string $url
* @throws InternalServerErrorException
*/ */
public function setBaseURL($url) public function setBaseURL($url)
{ {
@ -882,6 +887,7 @@ class App
* @param string $origURL * @param string $origURL
* *
* @return string The cleaned url * @return string The cleaned url
* @throws InternalServerErrorException
*/ */
public function removeBaseURL($origURL) public function removeBaseURL($origURL)
{ {
@ -935,6 +941,7 @@ class App
* Returns the current UserAgent as a String * Returns the current UserAgent as a String
* *
* @return string the UserAgent as a String * @return string the UserAgent as a String
* @throws InternalServerErrorException
*/ */
public function getUserAgent() public function getUserAgent()
{ {
@ -1058,6 +1065,7 @@ class App
* @brief Checks if the minimal memory is reached * @brief Checks if the minimal memory is reached
* *
* @return bool Is the memory limit reached? * @return bool Is the memory limit reached?
* @throws InternalServerErrorException
*/ */
public function isMinMemoryReached() public function isMinMemoryReached()
{ {
@ -1102,6 +1110,7 @@ class App
* @brief Checks if the maximum load is reached * @brief Checks if the maximum load is reached
* *
* @return bool Is the load reached? * @return bool Is the load reached?
* @throws InternalServerErrorException
*/ */
public function isMaxLoadReached() public function isMaxLoadReached()
{ {
@ -1134,6 +1143,7 @@ class App
* *
* @param string $command The command to execute * @param string $command The command to execute
* @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ] * @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
* @throws InternalServerErrorException
*/ */
public function proc_run($command, $args) public function proc_run($command, $args)
{ {
@ -1190,7 +1200,10 @@ class App
/** /**
* @brief Checks if a given directory is usable for the system * @brief Checks if a given directory is usable for the system
* *
* @param $directory
* @param bool $check_writable
* @return boolean the directory is usable * @return boolean the directory is usable
* @throws Exception
*/ */
public static function isDirectoryUsable($directory, $check_writable = true) public static function isDirectoryUsable($directory, $check_writable = true)
{ {
@ -1368,6 +1381,7 @@ class App
* Generates the site's default sender email address * Generates the site's default sender email address
* *
* @return string * @return string
* @throws InternalServerErrorException
*/ */
public function getSenderEmailAddress() public function getSenderEmailAddress()
{ {
@ -1388,6 +1402,7 @@ class App
* Returns the current theme name. * Returns the current theme name.
* *
* @return string the name of the current theme * @return string the name of the current theme
* @throws InternalServerErrorException
*/ */
public function getCurrentTheme() public function getCurrentTheme()
{ {
@ -1469,6 +1484,7 @@ class App
* Provide a sane default if nothing is chosen or the specified theme does not exist. * Provide a sane default if nothing is chosen or the specified theme does not exist.
* *
* @return string * @return string
* @throws InternalServerErrorException
*/ */
public function getCurrentThemeStylesheetPath() public function getCurrentThemeStylesheetPath()
{ {
@ -1930,7 +1946,7 @@ class App
* Should only be used if it isn't clear if the URL is either internal or external * Should only be used if it isn't clear if the URL is either internal or external
* *
* @param string $toUrl The target URL * @param string $toUrl The target URL
* * @throws InternalServerErrorException
*/ */
public function redirect($toUrl) public function redirect($toUrl)
{ {

View file

@ -42,7 +42,7 @@ class Mode
* - App::MODE_NORMAL : Normal run with all features enabled * - App::MODE_NORMAL : Normal run with all features enabled
* *
* @param string $basepath the Basepath of the Application * @param string $basepath the Basepath of the Application
* * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function determine($basepath = null) public function determine($basepath = null)
{ {

View file

@ -23,6 +23,7 @@ class BaseObject
* Same as get_app from boot.php * Same as get_app from boot.php
* *
* @return App * @return App
* @throws \Exception
*/ */
public static function getApp() public static function getApp()
{ {

View file

@ -19,6 +19,8 @@ class ContactSelector
/** /**
* @param string $current current * @param string $current current
* @param string $foreign_net network * @param string $foreign_net network
* @return string
* @throws \Exception
*/ */
public static function profileAssign($current, $foreign_net) public static function profileAssign($current, $foreign_net)
{ {
@ -73,6 +75,7 @@ class ContactSelector
* @param string $network network * @param string $network network
* @param string $profile optional, default empty * @param string $profile optional, default empty
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function networkToName($network, $profile = "") public static function networkToName($network, $profile = "")
{ {
@ -141,6 +144,7 @@ class ContactSelector
* @param string $current optional, default empty * @param string $current optional, default empty
* @param string $suffix optionsl, default empty * @param string $suffix optionsl, default empty
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function gender($current = "", $suffix = "") public static function gender($current = "", $suffix = "")
{ {
@ -180,6 +184,7 @@ class ContactSelector
* @param string $current optional, default empty * @param string $current optional, default empty
* @param string $suffix optionsl, default empty * @param string $suffix optionsl, default empty
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function sexualPreference($current = "", $suffix = "") public static function sexualPreference($current = "", $suffix = "")
{ {
@ -217,6 +222,7 @@ class ContactSelector
/** /**
* @param string $current optional, default empty * @param string $current optional, default empty
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function maritalStatus($current = "") public static function maritalStatus($current = "")
{ {

View file

@ -18,6 +18,7 @@ class Feature
* @param integer $uid user id * @param integer $uid user id
* @param string $feature feature * @param string $feature feature
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isEnabled($uid, $feature) public static function isEnabled($uid, $feature)
{ {
@ -45,6 +46,7 @@ class Feature
* *
* @param string $feature feature * @param string $feature feature
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function getDefault($feature) private static function getDefault($feature)
{ {
@ -69,6 +71,7 @@ class Feature
* @param bool $filtered True removes any locked features * @param bool $filtered True removes any locked features
* *
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function get($filtered = true) public static function get($filtered = true)
{ {

View file

@ -29,11 +29,12 @@ class ForumManager
* @param boolean $showprivate Show private groups * @param boolean $showprivate Show private groups
* *
* @return array * @return array
* 'url' => forum url * 'url' => forum url
* 'name' => forum name * 'name' => forum name
* 'id' => number of the key from the array * 'id' => number of the key from the array
* 'micro' => contact photo in format micro * 'micro' => contact photo in format micro
* 'thumb' => contact photo in format thumb * 'thumb' => contact photo in format thumb
* @throws \Exception
*/ */
public static function getList($uid, $lastitem, $showhidden = true, $showprivate = false) public static function getList($uid, $lastitem, $showhidden = true, $showprivate = false)
{ {
@ -88,6 +89,8 @@ class ForumManager
* @param int $uid The ID of the User * @param int $uid The ID of the User
* @param int $cid The contact id which is used to mark a forum as "selected" * @param int $cid The contact id which is used to mark a forum as "selected"
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function widget($uid, $cid = 0) public static function widget($uid, $cid = 0)
{ {
@ -143,6 +146,8 @@ class ForumManager
* *
* @param int $uid The ID of the User * @param int $uid The ID of the User
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function profileAdvanced($uid) public static function profileAdvanced($uid)
{ {

View file

@ -42,6 +42,8 @@ class Nav
/** /**
* Set a menu item in navbar as selected * Set a menu item in navbar as selected
*
* @param string $item
*/ */
public static function setSelected($item) public static function setSelected($item)
{ {
@ -50,6 +52,10 @@ class Nav
/** /**
* Build page header and site navigation bars * Build page header and site navigation bars
*
* @param App $a
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function build(App $a) public static function build(App $a)
{ {
@ -114,12 +120,13 @@ class Nav
* Prepares a list of navigation links * Prepares a list of navigation links
* *
* @brief Prepares a list of navigation links * @brief Prepares a list of navigation links
* @param App $a * @param App $a
* @return array Navigation links * @return array Navigation links
* string 'sitelocation' => The webbie (username@site.com) * string 'sitelocation' => The webbie (username@site.com)
* array 'nav' => Array of links used in the nav menu * array 'nav' => Array of links used in the nav menu
* string 'banner' => Formatted html link with banner image * string 'banner' => Formatted html link with banner image
* array 'userinfo' => Array of user information (name, icon) * array 'userinfo' => Array of user information (name, icon)
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function getInfo(App $a) private static function getInfo(App $a)
{ {

View file

@ -51,6 +51,7 @@ class OEmbed
* @param bool $no_rich_type If set to true rich type content won't be fetched. * @param bool $no_rich_type If set to true rich type content won't be fetched.
* *
* @return \Friendica\Object\OEmbed * @return \Friendica\Object\OEmbed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fetchURL($embedurl, $no_rich_type = false) public static function fetchURL($embedurl, $no_rich_type = false)
{ {
@ -260,6 +261,9 @@ class OEmbed
/** /**
* Find <span class='oembed'>..<a href='url' rel='oembed'>..</a></span> * Find <span class='oembed'>..<a href='url' rel='oembed'>..</a></span>
* and replace it with [embed]url[/embed] * and replace it with [embed]url[/embed]
*
* @param $text
* @return string
*/ */
public static function HTML2BBCode($text) public static function HTML2BBCode($text)
{ {
@ -298,6 +302,7 @@ class OEmbed
* @brief Determines if rich content OEmbed is allowed for the provided URL * @brief Determines if rich content OEmbed is allowed for the provided URL
* @param string $url * @param string $url
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isAllowedURL($url) public static function isAllowedURL($url)
{ {
@ -353,14 +358,15 @@ class OEmbed
* Since the iframe is automatically resized on load, there are no need for ugly * Since the iframe is automatically resized on load, there are no need for ugly
* and impractical scrollbars. * and impractical scrollbars.
* *
* @todo This function is currently unused until someone™ adds support for a separate OEmbed domain * @todo This function is currently unused until someone™ adds support for a separate OEmbed domain
* *
* @param string $src Original remote URL to embed * @param string $src Original remote URL to embed
* @param string $width * @param string $width
* @param string $height * @param string $height
* @return string formatted HTML * @return string formatted HTML
* *
* @see oembed_format_object() * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @see oembed_format_object()
*/ */
private static function iframe($src, $width, $height) private static function iframe($src, $width, $height)
{ {

View file

@ -65,7 +65,7 @@ class Pager
/** /**
* Returns the current page number * Returns the current page number
* *
* @return type * @return int
*/ */
public function getPage() public function getPage()
{ {
@ -140,6 +140,7 @@ class Pager
* *
* @param integer $itemCount The number of displayed items on the page * @param integer $itemCount The number of displayed items on the page
* @return string HTML string of the pager * @return string HTML string of the pager
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function renderMinimal($itemCount) public function renderMinimal($itemCount)
{ {
@ -182,6 +183,7 @@ class Pager
* *
* @param integer $itemCount The total number of items including those note displayed on the page * @param integer $itemCount The total number of items including those note displayed on the page
* @return string HTML string of the pager * @return string HTML string of the pager
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function renderFull($itemCount) public function renderFull($itemCount)
{ {

View file

@ -55,10 +55,11 @@ class Smilies
* Get an array of all smilies, both internal and from addons. * Get an array of all smilies, both internal and from addons.
* *
* @return array * @return array
* 'texts' => smilie shortcut * 'texts' => smilie shortcut
* 'icons' => icon in html * 'icons' => icon in html
* *
* @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array) * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array)
*/ */
public static function getList() public static function getList()
{ {
@ -182,6 +183,7 @@ class Smilies
* @param boolean $no_images Only replace emoticons without images * @param boolean $no_images Only replace emoticons without images
* *
* @return string HTML Output of the Smilie * @return string HTML Output of the Smilie
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function replace($s, $no_images = false) public static function replace($s, $no_images = false)
{ {
@ -201,6 +203,7 @@ class Smilies
* @param array $smilies An string replacement array with the following structure: ['texts' => [], 'icons' => []] * @param array $smilies An string replacement array with the following structure: ['texts' => [], 'icons' => []]
* @param bool $no_images Only replace shortcodes without image replacement (e.g. Unicode characters) * @param bool $no_images Only replace shortcodes without image replacement (e.g. Unicode characters)
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function replaceFromArray($text, array $smilies, $no_images = false) public static function replaceFromArray($text, array $smilies, $no_images = false)
{ {
@ -248,6 +251,7 @@ class Smilies
* @param string $m string * @param string $m string
* *
* @return string base64 decoded string * @return string base64 decoded string
* @throws \Exception
*/ */
private static function decode($m) private static function decode($m)
{ {
@ -262,7 +266,8 @@ class Smilies
* *
* @return string HTML Output * @return string HTML Output
* *
* @todo: Rework because it doesn't work correctly * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo : Rework because it doesn't work correctly
*/ */
private static function pregHeart($x) private static function pregHeart($x)
{ {

View file

@ -37,13 +37,14 @@ class BBCode extends BaseObject
* *
* @param string $body Message body * @param string $body Message body
* @return array * @return array
* 'type' -> Message type ("link", "video", "photo") * 'type' -> Message type ("link", "video", "photo")
* 'text' -> Text before the shared message * 'text' -> Text before the shared message
* 'after' -> Text after the shared message * 'after' -> Text after the shared message
* 'image' -> Preview image of the message * 'image' -> Preview image of the message
* 'url' -> Url to the attached message * 'url' -> Url to the attached message
* 'title' -> Title of the attachment * 'title' -> Title of the attachment
* 'description' -> Description of the attachment * 'description' -> Description of the attachment
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function getOldAttachmentData($body) private static function getOldAttachmentData($body)
{ {
@ -108,13 +109,14 @@ class BBCode extends BaseObject
* *
* @param string $body Message body * @param string $body Message body
* @return array * @return array
* 'type' -> Message type ("link", "video", "photo") * 'type' -> Message type ("link", "video", "photo")
* 'text' -> Text before the shared message * 'text' -> Text before the shared message
* 'after' -> Text after the shared message * 'after' -> Text after the shared message
* 'image' -> Preview image of the message * 'image' -> Preview image of the message
* 'url' -> Url to the attached message * 'url' -> Url to the attached message
* 'title' -> Title of the attachment * 'title' -> Title of the attachment
* 'description' -> Description of the attachment * 'description' -> Description of the attachment
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getAttachmentData($body) public static function getAttachmentData($body)
{ {
@ -345,6 +347,7 @@ class BBCode extends BaseObject
/** /**
* @brief Converts a BBCode text into plaintext * @brief Converts a BBCode text into plaintext
* *
* @param $text
* @param bool $keep_urls Whether to keep URLs in the resulting plaintext * @param bool $keep_urls Whether to keep URLs in the resulting plaintext
* *
* @return string * @return string
@ -446,6 +449,7 @@ class BBCode extends BaseObject
* @brief Truncates imported message body string length to max_import_size * @brief Truncates imported message body string length to max_import_size
* @param string $body * @param string $body
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function limitBodySize($body) public static function limitBodySize($body)
{ {
@ -532,10 +536,11 @@ class BBCode extends BaseObject
* Note: Can produce a [bookmark] tag in the returned string * Note: Can produce a [bookmark] tag in the returned string
* *
* @brief Processes [attachment] tags * @brief Processes [attachment] tags
* @param string $return * @param string $return
* @param bool|int $simplehtml * @param bool|int $simplehtml
* @param bool $tryoembed * @param bool $tryoembed
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function convertAttachment($return, $simplehtml = false, $tryoembed = true) private static function convertAttachment($return, $simplehtml = false, $tryoembed = true)
{ {
@ -777,10 +782,10 @@ class BBCode extends BaseObject
/** /**
* Performs a preg_replace within the boundaries of all named BBCode tags in a text * Performs a preg_replace within the boundaries of all named BBCode tags in a text
* *
* @param type $pattern Preg pattern string * @param string $pattern Preg pattern string
* @param type $replace Preg replace string * @param string $replace Preg replace string
* @param type $name BBCode tag name * @param string $name BBCode tag name
* @param type $text Text to search * @param string $text Text to search
* @return string * @return string
*/ */
public static function pregReplaceInTag($pattern, $replace, $name, $text) public static function pregReplaceInTag($pattern, $replace, $name, $text)
@ -930,6 +935,7 @@ class BBCode extends BaseObject
* @param boolean $is_quote_share Whether there is content before the [share] block * @param boolean $is_quote_share Whether there is content before the [share] block
* @param integer $simplehtml Mysterious integer value depending on the target network/formatting style * @param integer $simplehtml Mysterious integer value depending on the target network/formatting style
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function convertShareCallback(array $attributes, array $author_contact, $content, $is_quote_share, $simplehtml) private static function convertShareCallback(array $attributes, array $author_contact, $content, $is_quote_share, $simplehtml)
{ {
@ -1142,6 +1148,7 @@ class BBCode extends BaseObject
* @param int $simple_html * @param int $simple_html
* @param bool $for_plaintext * @param bool $for_plaintext
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function convert($text, $try_oembed = true, $simple_html = false, $for_plaintext = false) public static function convert($text, $try_oembed = true, $simple_html = false, $for_plaintext = false)
{ {
@ -1813,6 +1820,8 @@ class BBCode extends BaseObject
* [2] = Name * [2] = Name
* [3] = Address * [3] = Address
* @return string Replaced mention * @return string Replaced mention
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function bbCodeMention2DiasporaCallback($match) private static function bbCodeMention2DiasporaCallback($match)
{ {
@ -1839,6 +1848,7 @@ class BBCode extends BaseObject
* @param string $text * @param string $text
* @param bool $for_diaspora Diaspora requires more changes than Libertree * @param bool $for_diaspora Diaspora requires more changes than Libertree
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function toMarkdown($text, $for_diaspora = true) public static function toMarkdown($text, $for_diaspora = true)
{ {

View file

@ -117,12 +117,13 @@ class HTML
/** /**
* Made by: ike@piratenpartei.de * Made by: ike@piratenpartei.de
* Originally made for the syncom project: http://wiki.piratenpartei.de/Syncom * Originally made for the syncom project: http://wiki.piratenpartei.de/Syncom
* https://github.com/annando/Syncom * https://github.com/annando/Syncom
* *
* @brief Converter for HTML to BBCode * @brief Converter for HTML to BBCode
* @param string $message * @param string $message
* @param string $basepath * @param string $basepath
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function toBBCode($message, $basepath = '') public static function toBBCode($message, $basepath = '')
{ {
@ -713,6 +714,7 @@ class HTML
* @brief Convert video HTML to BBCode tags * @brief Convert video HTML to BBCode tags
* *
* @param string $s * @param string $s
* @return string
*/ */
public static function toBBCodeVideo($s) public static function toBBCodeVideo($s)
{ {
@ -789,7 +791,9 @@ class HTML
/** /**
* Loader for infinite scrolling * Loader for infinite scrolling
*
* @return string html for loader * @return string html for loader
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function scrollLoader() public static function scrollLoader()
{ {
@ -804,8 +808,10 @@ class HTML
* Get html for contact block. * Get html for contact block.
* *
* @template contact_block.tpl * @template contact_block.tpl
* @hook contact_block_end (contacts=>array, output=>string) * @hook contact_block_end (contacts=>array, output=>string)
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function contactBlock() public static function contactBlock()
{ {
@ -890,22 +896,23 @@ class HTML
/** /**
* @brief Format contacts as picture links or as text links * @brief Format contacts as picture links or as text links
* *
* @param array $contact Array with contacts which contains an array with * @param array $contact Array with contacts which contains an array with
* int 'id' => The ID of the contact * int 'id' => The ID of the contact
* int 'uid' => The user ID of the user who owns this data * int 'uid' => The user ID of the user who owns this data
* string 'name' => The name of the contact * string 'name' => The name of the contact
* string 'url' => The url to the profile page of the contact * string 'url' => The url to the profile page of the contact
* string 'addr' => The webbie of the contact (e.g.) username@friendica.com * string 'addr' => The webbie of the contact (e.g.) username@friendica.com
* string 'network' => The network to which the contact belongs to * string 'network' => The network to which the contact belongs to
* string 'thumb' => The contact picture * string 'thumb' => The contact picture
* string 'click' => js code which is performed when clicking on the contact * string 'click' => js code which is performed when clicking on the contact
* @param boolean $redirect If true try to use the redir url if it's possible * @param boolean $redirect If true try to use the redir url if it's possible
* @param string $class CSS class for the * @param string $class CSS class for the
* @param boolean $textmode If true display the contacts as text links * @param boolean $textmode If true display the contacts as text links
* if false display the contacts as picture links * if false display the contacts as picture links
* @return string Formatted html
* @return string Formatted html * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ * @throws \ImagickException
*/
public static function micropro($contact, $redirect = false, $class = '', $textmode = false) public static function micropro($contact, $redirect = false, $class = '', $textmode = false)
{ {
// Use the contact URL if no address is available // Use the contact URL if no address is available
@ -947,10 +954,10 @@ class HTML
* @param string $s Search query. * @param string $s Search query.
* @param string $id HTML id * @param string $id HTML id
* @param string $url Search url. * @param string $url Search url.
* @param bool $save Show save search button.
* @param bool $aside Display the search widgit aside. * @param bool $aside Display the search widgit aside.
* *
* @return string Formatted HTML. * @return string Formatted HTML.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function search($s, $id = 'search-box', $url = 'search', $aside = true) public static function search($s, $id = 'search-box', $url = 'search', $aside = true)
{ {
@ -990,6 +997,7 @@ class HTML
* Replace naked text hyperlink with HTML formatted hyperlink * Replace naked text hyperlink with HTML formatted hyperlink
* *
* @param string $s * @param string $s
* @return string
*/ */
public static function toLink($s) public static function toLink($s)
{ {
@ -1006,6 +1014,7 @@ class HTML
* @param string $html * @param string $html
* @param array $reasons * @param array $reasons
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function applyContentFilter($html, array $reasons) public static function applyContentFilter($html, array $reasons)
{ {

View file

@ -26,6 +26,7 @@ class Markdown extends BaseObject
* @param string $text * @param string $text
* @param bool $hardwrap * @param bool $hardwrap
* @return string * @return string
* @throws \Exception
*/ */
public static function convert($text, $hardwrap = true) { public static function convert($text, $hardwrap = true) {
$stamp1 = microtime(true); $stamp1 = microtime(true);
@ -48,6 +49,8 @@ class Markdown extends BaseObject
* [2] = name (optional) * [2] = name (optional)
* [3] = address * [3] = address
* @return string Replaced mention * @return string Replaced mention
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function diasporaMention2BBCodeCallback($match) private static function diasporaMention2BBCodeCallback($match)
{ {

View file

@ -9,9 +9,9 @@ class Plaintext
/** /**
* Shortens message * Shortens message
* *
* @param type $msg * @param string $msg
* @param type $limit * @param int $limit
* @return type * @return string
* *
* @todo For Twitter URLs aren't shortened, but they have to be calculated as if. * @todo For Twitter URLs aren't shortened, but they have to be calculated as if.
*/ */

View file

@ -28,6 +28,8 @@ class Widget
* Return the follow widget * Return the follow widget
* *
* @param string $value optional, default empty * @param string $value optional, default empty
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function follow($value = "") public static function follow($value = "")
{ {
@ -125,6 +127,8 @@ class Widget
* *
* @param string $baseurl baseurl * @param string $baseurl baseurl
* @param string $selected optional, default empty * @param string $selected optional, default empty
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function networks($baseurl, $selected = '') public static function networks($baseurl, $selected = '')
{ {
@ -167,6 +171,8 @@ class Widget
* *
* @param string $baseurl baseurl * @param string $baseurl baseurl
* @param string $selected optional, default empty * @param string $selected optional, default empty
* @return string|void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fileAs($baseurl, $selected = '') public static function fileAs($baseurl, $selected = '')
{ {
@ -205,6 +211,8 @@ class Widget
* *
* @param string $baseurl baseurl * @param string $baseurl baseurl
* @param string $selected optional, default empty * @param string $selected optional, default empty
* @return string|void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function categories($baseurl, $selected = '') public static function categories($baseurl, $selected = '')
{ {
@ -244,6 +252,8 @@ class Widget
* Return common friends visitor widget * Return common friends visitor widget
* *
* @param string $profile_uid uid * @param string $profile_uid uid
* @return string|void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function commonFriendsVisitor($profile_uid) public static function commonFriendsVisitor($profile_uid)
{ {
@ -327,8 +337,10 @@ class Widget
* Insert a tag cloud widget for the present profile. * Insert a tag cloud widget for the present profile.
* *
* @brief Insert a tag cloud widget for the present profile. * @brief Insert a tag cloud widget for the present profile.
* @param int $limit Max number of displayed tags. * @param int $limit Max number of displayed tags.
* @return string HTML formatted output. * @return string HTML formatted output.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function tagCloud($limit = 50) public static function tagCloud($limit = 50)
{ {

View file

@ -21,6 +21,7 @@ class CalendarExport
* @brief Get the events widget. * @brief Get the events widget.
* *
* @return string Formated HTML of the calendar widget. * @return string Formated HTML of the calendar widget.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getHTML() { public static function getHTML() {
$a = \get_app(); $a = \get_app();

View file

@ -24,13 +24,14 @@ class TagCloud
* Construct a tag/term cloud block for an user. * Construct a tag/term cloud block for an user.
* *
* @brief Construct a tag/term cloud block for an user. * @brief Construct a tag/term cloud block for an user.
* @param int $uid The user ID. * @param int $uid The user ID.
* @param int $count Max number of displayed tags/terms. * @param int $count Max number of displayed tags/terms.
* @param int $owner_id The contact ID of the owner of the tagged items. * @param int $owner_id The contact ID of the owner of the tagged items.
* @param string $flags Special item flags. * @param string $flags Special item flags.
* @param int $type The tag/term type. * @param int $type The tag/term type.
* *
* @return string HTML formatted output. * @return string HTML formatted output.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getHTML($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) public static function getHTML($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG)
{ {
@ -63,13 +64,14 @@ class TagCloud
* *
* @brief Get alphabetical sorted array of used tags/terms of an user including * @brief Get alphabetical sorted array of used tags/terms of an user including
* a weighting by frequency of use. * a weighting by frequency of use.
* @param int $uid The user ID. * @param int $uid The user ID.
* @param int $count Max number of displayed tags/terms. * @param int $count Max number of displayed tags/terms.
* @param int $owner_id The contact id of the owner of the tagged items. * @param int $owner_id The contact id of the owner of the tagged items.
* @param string $flags Special item flags. * @param string $flags Special item flags.
* @param int $type The tag/term type. * @param int $type The tag/term type.
* *
* @return arr Alphabetical sorted array of used tags of an user. * @return array Alphabetical sorted array of used tags of an user.
* @throws \Exception
*/ */
private static function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) private static function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG)
{ {
@ -146,8 +148,8 @@ class TagCloud
* Compare function to sort tags/terms alphabetically. * Compare function to sort tags/terms alphabetically.
* *
* @brief Compare function to sort tags/terms alphabetically. * @brief Compare function to sort tags/terms alphabetically.
* @param type $a * @param string $a
* @param type $b * @param string $b
* *
* @return int * @return int
*/ */

View file

@ -23,15 +23,16 @@ class ACL extends BaseObject
/** /**
* Returns a select input tag with all the contact of the local user * Returns a select input tag with all the contact of the local user
* *
* @param string $selname Name attribute of the select input tag * @param string $selname Name attribute of the select input tag
* @param string $selclass Class attribute of the select input tag * @param string $selclass Class attribute of the select input tag
* @param array $options Available options: * @param array $options Available options:
* - size: length of the select box * - size: length of the select box
* - mutual_friends: Only used for the hook * - mutual_friends: Only used for the hook
* - single: Only used for the hook * - single: Only used for the hook
* - exclude: Only used for the hook * - exclude: Only used for the hook
* @param array $preselected Contact ID that should be already selected * @param array $preselected Contact ID that should be already selected
* @return string * @return string
* @throws \Exception
*/ */
public static function getSuggestContactSelectHTML($selname, $selclass, array $options = [], array $preselected = []) public static function getSuggestContactSelectHTML($selname, $selclass, array $options = [], array $preselected = [])
{ {
@ -141,6 +142,7 @@ class ACL extends BaseObject
* @param int $size Length of the select box * @param int $size Length of the select box
* @param int $tabindex Select input tag tabindex attribute * @param int $tabindex Select input tag tabindex attribute
* @return string * @return string
* @throws \Exception
*/ */
public static function getMessageContactSelectHTML($selname, $selclass, array $preselected = [], $size = 4, $tabindex = null) public static function getMessageContactSelectHTML($selname, $selclass, array $preselected = [], $size = 4, $tabindex = null)
{ {
@ -215,6 +217,7 @@ class ACL extends BaseObject
* *
* @param array $user * @param array $user
* @return array Hash of contact id lists * @return array Hash of contact id lists
* @throws \Exception
*/ */
public static function getDefaultUserPermissions(array $user = null) public static function getDefaultUserPermissions(array $user = null)
{ {
@ -251,9 +254,10 @@ class ACL extends BaseObject
* Return the full jot ACL selector HTML * Return the full jot ACL selector HTML
* *
* @param array $user User array * @param array $user User array
* @param array $default_permissions Static defaults permission array: ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']
* @param bool $show_jotnets * @param bool $show_jotnets
* @param array $default_permissions Static defaults permission array: ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getFullSelectorHTML(array $user, $show_jotnets = false, array $default_permissions = []) public static function getFullSelectorHTML(array $user, $show_jotnets = false, array $default_permissions = [])
{ {
@ -320,6 +324,7 @@ class ACL extends BaseObject
* @param string $search Name or part of a name or nick * @param string $search Name or part of a name or nick
* @param string $mode Search mode (e.g. "community") * @param string $mode Search mode (e.g. "community")
* @return array with the search results * @return array with the search results
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function contactAutocomplete($search, $mode) public static function contactAutocomplete($search, $mode)
{ {

View file

@ -70,7 +70,8 @@ class Addon extends BaseObject
* @brief uninstalls an addon. * @brief uninstalls an addon.
* *
* @param string $addon name of the addon * @param string $addon name of the addon
* @return boolean * @return void
* @throws \Exception
*/ */
public static function uninstall($addon) public static function uninstall($addon)
{ {
@ -91,6 +92,7 @@ class Addon extends BaseObject
* *
* @param string $addon name of the addon * @param string $addon name of the addon
* @return bool * @return bool
* @throws \Exception
*/ */
public static function install($addon) public static function install($addon)
{ {
@ -190,6 +192,7 @@ class Addon extends BaseObject
* *\endcode * *\endcode
* @param string $addon the name of the addon * @param string $addon the name of the addon
* @return array with the addon information * @return array with the addon information
* @throws \Exception
*/ */
public static function getInfo($addon) public static function getInfo($addon)
{ {
@ -269,6 +272,7 @@ class Addon extends BaseObject
* Saves the current enabled addon list in the system.addon config key * Saves the current enabled addon list in the system.addon config key
* *
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function saveEnabledList() public static function saveEnabledList()
{ {
@ -279,6 +283,7 @@ class Addon extends BaseObject
* Returns the list of non-hidden enabled addon names * Returns the list of non-hidden enabled addon names
* *
* @return array * @return array
* @throws \Exception
*/ */
public static function getVisibleList() public static function getVisibleList()
{ {
@ -296,13 +301,14 @@ class Addon extends BaseObject
/** /**
* Shim of Hook::register left for backward compatibility purpose. * Shim of Hook::register left for backward compatibility purpose.
* *
* @see Hook::register * @see Hook::register
* @deprecated since version 2018.12 * @deprecated since version 2018.12
* @param string $hook the name of the hook * @param string $hook the name of the hook
* @param string $file the name of the file that hooks into * @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook will call * @param string $function the name of the function that the hook will call
* @param int $priority A priority (defaults to 0) * @param int $priority A priority (defaults to 0)
* @return mixed|bool * @return mixed|bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function registerHook($hook, $file, $function, $priority = 0) public static function registerHook($hook, $file, $function, $priority = 0)
{ {
@ -312,12 +318,13 @@ class Addon extends BaseObject
/** /**
* Shim of Hook::unregister left for backward compatibility purpose. * Shim of Hook::unregister left for backward compatibility purpose.
* *
* @see Hook::unregister * @see Hook::unregister
* @deprecated since version 2018.12 * @deprecated since version 2018.12
* @param string $hook the name of the hook * @param string $hook the name of the hook
* @param string $file the name of the file that hooks into * @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called * @param string $function the name of the function that the hook called
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function unregisterHook($hook, $file, $function) public static function unregisterHook($hook, $file, $function)
{ {
@ -327,10 +334,11 @@ class Addon extends BaseObject
/** /**
* Shim of Hook::callAll left for backward-compatibility purpose. * Shim of Hook::callAll left for backward-compatibility purpose.
* *
* @see Hook::callAll * @see Hook::callAll
* @deprecated since version 2018.12 * @deprecated since version 2018.12
* @param string $name of the hook to call * @param string $name of the hook to call
* @param string|array &$data to transmit to the callback handler * @param string|array &$data to transmit to the callback handler
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function callHooks($name, &$data = null) public static function callHooks($name, &$data = null)
{ {

View file

@ -21,6 +21,7 @@ class Authentication extends BaseObject
* @param array $user Record from "user" table * @param array $user Record from "user" table
* *
* @return string Hashed data * @return string Hashed data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getCookieHashForUser($user) public static function getCookieHashForUser($user)
{ {
@ -32,8 +33,9 @@ class Authentication extends BaseObject
/** /**
* @brief Set the "Friendica" cookie * @brief Set the "Friendica" cookie
* *
* @param int $time * @param int $time
* @param array $user Record from "user" table * @param array $user Record from "user" table
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function setCookie($time, $user = []) public static function setCookie($time, $user = [])
{ {
@ -55,12 +57,13 @@ class Authentication extends BaseObject
/** /**
* @brief Sets the provided user's authenticated session * @brief Sets the provided user's authenticated session
* *
* @todo Should be moved to Friendica\Core\Session once it's created * @todo Should be moved to Friendica\Core\Session once it's created
* *
* @param type $user_record * @param array $user_record
* @param type $login_initial * @param bool $login_initial
* @param type $interactive * @param bool $interactive
* @param type $login_refresh * @param bool $login_refresh
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function setAuthenticatedSessionForUser($user_record, $login_initial = false, $interactive = false, $login_refresh = false) public static function setAuthenticatedSessionForUser($user_record, $login_initial = false, $interactive = false, $login_refresh = false)
{ {

View file

@ -55,6 +55,7 @@ class Cache extends \Friendica\BaseObject
* @param string $prefix Prefix of the keys (optional) * @param string $prefix Prefix of the keys (optional)
* *
* @return array Empty if the driver doesn't support this feature * @return array Empty if the driver doesn't support this feature
* @throws \Exception
*/ */
public static function getAllKeys($prefix = null) public static function getAllKeys($prefix = null)
{ {
@ -73,6 +74,7 @@ class Cache extends \Friendica\BaseObject
* @param string $key The key to the cached data * @param string $key The key to the cached data
* *
* @return mixed Cached $value or "null" if not found * @return mixed Cached $value or "null" if not found
* @throws \Exception
*/ */
public static function get($key) public static function get($key)
{ {
@ -95,6 +97,7 @@ class Cache extends \Friendica\BaseObject
* @param integer $duration The cache lifespan * @param integer $duration The cache lifespan
* *
* @return bool * @return bool
* @throws \Exception
*/ */
public static function set($key, $value, $duration = self::MONTH) public static function set($key, $value, $duration = self::MONTH)
{ {
@ -113,6 +116,7 @@ class Cache extends \Friendica\BaseObject
* @param string $key The key to the cached data * @param string $key The key to the cached data
* *
* @return bool * @return bool
* @throws \Exception
*/ */
public static function delete($key) public static function delete($key)
{ {
@ -130,7 +134,7 @@ class Cache extends \Friendica\BaseObject
* *
* @param boolean $outdated just remove outdated values * @param boolean $outdated just remove outdated values
* *
* @return void * @return bool
*/ */
public static function clear($outdated = true) public static function clear($outdated = true)
{ {

View file

@ -14,8 +14,9 @@ use Friendica\BaseObject;
abstract class AbstractCacheDriver extends BaseObject abstract class AbstractCacheDriver extends BaseObject
{ {
/** /**
* @param string $key The original key * @param string $key The original key
* @return string The cache key used for the cache * @return string The cache key used for the cache
* @throws \Exception
*/ */
protected function getCacheKey($key) protected function getCacheKey($key)
{ {

View file

@ -22,7 +22,7 @@ use Friendica\Core\Config;
class Config extends BaseObject class Config extends BaseObject
{ {
/** /**
* @var Friendica\Core\Config\IConfigAdapter * @var \Friendica\Core\Config\IConfigAdapter
*/ */
private static $adapter = null; private static $adapter = null;
@ -49,6 +49,7 @@ class Config extends BaseObject
* @param string $family The category of the configuration value * @param string $family The category of the configuration value
* *
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function load($family = "config") public static function load($family = "config")
{ {
@ -82,6 +83,7 @@ class Config extends BaseObject
* @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
* *
* @return mixed Stored value or null if it does not exist * @return mixed Stored value or null if it does not exist
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function get($family, $key, $default_value = null, $refresh = false) public static function get($family, $key, $default_value = null, $refresh = false)
{ {
@ -110,6 +112,7 @@ class Config extends BaseObject
* @param mixed $value The value to store * @param mixed $value The value to store
* *
* @return bool Operation success * @return bool Operation success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function set($family, $key, $value) public static function set($family, $key, $value)
{ {
@ -135,6 +138,7 @@ class Config extends BaseObject
* @param string $key The configuration key to delete * @param string $key The configuration key to delete
* *
* @return mixed * @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function delete($family, $key) public static function delete($family, $key)
{ {

View file

@ -49,9 +49,9 @@ interface IConfigAdapter
* *
* Note: Please do not store booleans - convert to 0/1 integer values! * Note: Please do not store booleans - convert to 0/1 integer values!
* *
* @param string $family The category of the configuration value * @param string $cat The category of the configuration value
* @param string $key The configuration key to set * @param string $k The configuration key to set
* @param mixed $value The value to store * @param mixed $value The value to store
* *
* @return bool Operation success * @return bool Operation success
*/ */

View file

@ -185,6 +185,7 @@ HELP;
* @param Installer $installer the Installer instance * @param Installer $installer the Installer instance
* *
* @return bool true if checks were successfully, otherwise false * @return bool true if checks were successfully, otherwise false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function runBasicChecks(Installer $installer) private function runBasicChecks(Installer $installer)
{ {

View file

@ -206,6 +206,9 @@ HELP;
* - replace " with \" * - replace " with \"
* - replace tab char with \t * - replace tab char with \t
* - manage multiline strings * - manage multiline strings
*
* @param string $str
* @return string
*/ */
private function massageString($str) private function massageString($str)
{ {

View file

@ -48,9 +48,9 @@ class Hook extends BaseObject
* *
* This function is meant to be called by modules on each page load as it works after loadHooks has been called. * This function is meant to be called by modules on each page load as it works after loadHooks has been called.
* *
* @param type $hook * @param string $hook
* @param type $file * @param string $file
* @param type $function * @param string $function
*/ */
public static function add($hook, $file, $function) public static function add($hook, $file, $function)
{ {
@ -70,6 +70,7 @@ class Hook extends BaseObject
* @param string $function the name of the function that the hook will call * @param string $function the name of the function that the hook will call
* @param int $priority A priority (defaults to 0) * @param int $priority A priority (defaults to 0)
* @return mixed|bool * @return mixed|bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function register($hook, $file, $function, $priority = 0) public static function register($hook, $file, $function, $priority = 0)
{ {
@ -92,6 +93,7 @@ class Hook extends BaseObject
* @param string $file the name of the file that hooks into * @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called * @param string $function the name of the function that the hook called
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function unregister($hook, $file, $function) public static function unregister($hook, $file, $function)
{ {
@ -131,6 +133,7 @@ class Hook extends BaseObject
* @param integer $priority of the hook * @param integer $priority of the hook
* @param string $name of the hook to call * @param string $name of the hook to call
* @param mixed $data to transmit to the callback handler * @param mixed $data to transmit to the callback handler
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fork($priority, $name, $data = null) public static function fork($priority, $name, $data = null)
{ {
@ -163,8 +166,9 @@ class Hook extends BaseObject
* Use this function when you want to be able to allow a hook to manipulate * Use this function when you want to be able to allow a hook to manipulate
* the provided data. * the provided data.
* *
* @param string $name of the hook to call * @param string $name of the hook to call
* @param string|array &$data to transmit to the callback handler * @param string|array &$data to transmit to the callback handler
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function callAll($name, &$data = null) public static function callAll($name, &$data = null)
{ {
@ -178,10 +182,11 @@ class Hook extends BaseObject
/** /**
* @brief Calls a single hook. * @brief Calls a single hook.
* *
* @param App $a * @param App $a
* @param string $name of the hook to call * @param string $name of the hook to call
* @param array $hook Hook data * @param array $hook Hook data
* @param string|array &$data to transmit to the callback handler * @param string|array &$data to transmit to the callback handler
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function callSingle(App $a, $name, $hook, &$data = null) public static function callSingle(App $a, $name, $hook, &$data = null)
{ {

View file

@ -47,6 +47,7 @@ class Installer
* Returns the PHP path * Returns the PHP path
* *
* @return string the PHP Path * @return string the PHP Path
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function getPHPPath() public function getPHPPath()
{ {
@ -79,10 +80,11 @@ class Installer
/** /**
* Checks the current installation environment. There are optional and mandatory checks. * Checks the current installation environment. There are optional and mandatory checks.
* *
* @param string $baseurl The baseurl of Friendica * @param string $baseurl The baseurl of Friendica
* @param string $phpath Optional path to the PHP binary * @param string $phpath Optional path to the PHP binary
* *
* @return bool if the check succeed * @return bool if the check succeed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function checkEnvironment($baseurl, $phpath = null) public function checkEnvironment($baseurl, $phpath = null)
{ {
@ -126,18 +128,19 @@ class Installer
* - Creates `config/local.config.php` * - Creates `config/local.config.php`
* - Installs Database Structure * - Installs Database Structure
* *
* @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php') * @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php')
* @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica') * @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica')
* @param string $dbhost Hostname/IP of the Friendica Database * @param string $dbhost Hostname/IP of the Friendica Database
* @param string $dbuser Username of the Database connection credentials * @param string $dbuser Username of the Database connection credentials
* @param string $dbpass Password of the Database connection credentials * @param string $dbpass Password of the Database connection credentials
* @param string $dbdata Name of the Database * @param string $dbdata Name of the Database
* @param string $timezone Timezone of the Friendica Installaton (e.g. 'Europe/Berlin') * @param string $timezone Timezone of the Friendica Installaton (e.g. 'Europe/Berlin')
* @param string $language 2-letter ISO 639-1 code (eg. 'en') * @param string $language 2-letter ISO 639-1 code (eg. 'en')
* @param string $adminmail Mail-Adress of the administrator * @param string $adminmail Mail-Adress of the administrator
* @param string $basepath The basepath of Friendica * @param string $basepath The basepath of Friendica
* *
* @return bool true if the config was created, otherwise false * @return bool true if the config was created, otherwise false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath) public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath)
{ {
@ -167,6 +170,7 @@ class Installer
* Installs the DB-Scheme for Friendica * Installs the DB-Scheme for Friendica
* *
* @return bool true if the installation was successful, otherwise false * @return bool true if the installation was successful, otherwise false
* @throws Exception
*/ */
public function installDatabase() public function installDatabase()
{ {
@ -212,11 +216,12 @@ class Installer
* - Checks if a PHP binary is available * - Checks if a PHP binary is available
* - Checks if it is the CLI version * - Checks if it is the CLI version
* - Checks if "register_argc_argv" is enabled * - Checks if "register_argc_argv" is enabled
* *
* @param string $phppath Optional. The Path to the PHP-Binary * @param string $phppath Optional. The Path to the PHP-Binary
* @param bool $required Optional. If set to true, the PHP-Binary has to exist (Default false) * @param bool $required Optional. If set to true, the PHP-Binary has to exist (Default false)
* *
* @return bool false if something required failed * @return bool false if something required failed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function checkPHP($phppath = null, $required = false) public function checkPHP($phppath = null, $required = false)
{ {
@ -507,8 +512,9 @@ class Installer
* *
* Checks, if "url_rewrite" is enabled in the ".htaccess" file * Checks, if "url_rewrite" is enabled in the ".htaccess" file
* *
* @param string $baseurl The baseurl of the app * @param string $baseurl The baseurl of the app
* @return bool false if something required failed * @return bool false if something required failed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function checkHtAccess($baseurl) public function checkHtAccess($baseurl)
{ {
@ -576,12 +582,13 @@ class Installer
/** /**
* Checking the Database connection and if it is available for the current installation * Checking the Database connection and if it is available for the current installation
* *
* @param string $dbhost Hostname/IP of the Friendica Database * @param string $dbhost Hostname/IP of the Friendica Database
* @param string $dbuser Username of the Database connection credentials * @param string $dbuser Username of the Database connection credentials
* @param string $dbpass Password of the Database connection credentials * @param string $dbpass Password of the Database connection credentials
* @param string $dbdata Name of the Database * @param string $dbdata Name of the Database
* *
* @return bool true if the check was successful, otherwise false * @return bool true if the check was successful, otherwise false
* @throws Exception
*/ */
public function checkDB($dbhost, $dbuser, $dbpass, $dbdata) public function checkDB($dbhost, $dbuser, $dbpass, $dbdata)
{ {

View file

@ -90,6 +90,7 @@ class L10n extends BaseObject
/** /**
* @brief Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header * @brief Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header
* @return string The two-letter language code * @return string The two-letter language code
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function detectLanguage() public static function detectLanguage()
{ {
@ -141,9 +142,10 @@ class L10n extends BaseObject
* *
* If called repeatedly, it won't save the translation strings again, just load the new ones. * If called repeatedly, it won't save the translation strings again, just load the new ones.
* *
* @see popLang() * @see popLang()
* @brief Stores the current language strings and load a different language. * @brief Stores the current language strings and load a different language.
* @param string $lang Language code * @param string $lang Language code
* @throws \Exception
*/ */
public static function pushLang($lang) public static function pushLang($lang)
{ {
@ -187,6 +189,7 @@ class L10n extends BaseObject
* Uses an App object shim since all the strings files refer to $a->strings * Uses an App object shim since all the strings files refer to $a->strings
* *
* @param string $lang language code to load * @param string $lang language code to load
* @throws \Exception
*/ */
private static function loadTranslationTable($lang) private static function loadTranslationTable($lang)
{ {
@ -269,8 +272,9 @@ class L10n extends BaseObject
* *
* @param string $singular * @param string $singular
* @param string $plural * @param string $plural
* @param int $count * @param int $count
* @return string * @return string
* @throws \Exception
*/ */
public static function tt($singular, $plural, $count) public static function tt($singular, $plural, $count)
{ {
@ -314,6 +318,9 @@ class L10n extends BaseObject
/** /**
* Provide a fallback which will not collide with a function defined in any language file * Provide a fallback which will not collide with a function defined in any language file
*
* @param int $n
* @return bool
*/ */
private static function stringPluralSelectDefault($n) private static function stringPluralSelectDefault($n)
{ {
@ -391,7 +398,8 @@ class L10n extends BaseObject
* Load poke verbs * Load poke verbs
* *
* @return array index is present tense verb * @return array index is present tense verb
* value is array containing past tense verb, translation of present, translation of past * value is array containing past tense verb, translation of present, translation of past
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @hook poke_verbs pokes array * @hook poke_verbs pokes array
*/ */
public static function getPokeVerbs() public static function getPokeVerbs()

View file

@ -140,13 +140,14 @@ class Logger extends BaseObject
/** /**
* System is unusable. * System is unusable.
*
* @see LoggerInterface::emergency() * @see LoggerInterface::emergency()
* *
* @param string $message * @param string $message
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function emergency($message, $context = []) public static function emergency($message, $context = [])
{ {
@ -170,7 +171,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function alert($message, $context = []) public static function alert($message, $context = [])
{ {
@ -193,7 +194,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function critical($message, $context = []) public static function critical($message, $context = [])
{ {
@ -215,7 +216,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function error($message, $context = []) public static function error($message, $context = [])
{ {
@ -240,7 +241,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function warning($message, $context = []) public static function warning($message, $context = [])
{ {
@ -261,7 +262,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function notice($message, $context = []) public static function notice($message, $context = [])
{ {
@ -284,7 +285,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* * @throws \Exception
*/ */
public static function info($message, $context = []) public static function info($message, $context = [])
{ {
@ -305,6 +306,7 @@ class Logger extends BaseObject
* @param array $context * @param array $context
* *
* @return void * @return void
* @throws \Exception
*/ */
public static function debug($message, $context = []) public static function debug($message, $context = [])
{ {
@ -317,14 +319,15 @@ class Logger extends BaseObject
self::getApp()->saveTimestamp($stamp1, 'file'); self::getApp()->saveTimestamp($stamp1, 'file');
} }
/** /**
* @brief Logs the given message at the given log level * @brief Logs the given message at the given log level
*
* @param string $msg
* @param int $level
* *
* @param string $msg
* @param string $level
*
* @throws \Exception
* @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead * @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead
*/ */
public static function log($msg, $level = LogLevel::NOTICE) public static function log($msg, $level = LogLevel::NOTICE)
{ {
if (!isset(self::$logger)) { if (!isset(self::$logger)) {
@ -336,15 +339,16 @@ class Logger extends BaseObject
self::getApp()->saveTimestamp($stamp1, "file"); self::getApp()->saveTimestamp($stamp1, "file");
} }
/** /**
* @brief An alternative logger for development. * @brief An alternative logger for development.
* Works largely as log() but allows developers * Works largely as log() but allows developers
* to isolate particular elements they are targetting * to isolate particular elements they are targetting
* personally without background noise * personally without background noise
* *
* @param string $msg * @param string $msg
* @param string $level * @param string $level
*/ * @throws \Exception
*/
public static function devLog($msg, $level = LogLevel::DEBUG) public static function devLog($msg, $level = LogLevel::DEBUG)
{ {
if (!isset(self::$logger)) { if (!isset(self::$logger)) {

View file

@ -36,6 +36,7 @@ class NotificationsManager extends BaseObject
* - date_rel : relative date string * - date_rel : relative date string
* - msg_html: message as html string * - msg_html: message as html string
* - msg_plain: message as plain text string * - msg_plain: message as plain text string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function _set_extra($notes) private function _set_extra($notes)
{ {
@ -61,6 +62,7 @@ class NotificationsManager extends BaseObject
* @param string $limit optional Query limits * @param string $limit optional Query limits
* *
* @return array of results or false on errors * @return array of results or false on errors
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function getAll($filter = [], $order = "-date", $limit = "") public function getAll($filter = [], $order = "-date", $limit = "")
{ {
@ -109,6 +111,7 @@ class NotificationsManager extends BaseObject
* *
* @param int $id identity * @param int $id identity
* @return array note values or null if not found * @return array note values or null if not found
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function getByID($id) public function getByID($id)
{ {
@ -161,6 +164,7 @@ class NotificationsManager extends BaseObject
* @brief List of pages for the Notifications TabBar * @brief List of pages for the Notifications TabBar
* *
* @return array with with notifications TabBar data * @return array with with notifications TabBar data
* @throws \Exception
*/ */
public function getTabs() public function getTabs()
{ {
@ -213,14 +217,15 @@ class NotificationsManager extends BaseObject
* @param array $notifs The array from the db query * @param array $notifs The array from the db query
* @param string $ident The notifications identifier (e.g. network) * @param string $ident The notifications identifier (e.g. network)
* @return array * @return array
* string 'label' => The type of the notification * string 'label' => The type of the notification
* string 'link' => URL to the source * string 'link' => URL to the source
* string 'image' => The avatar image * string 'image' => The avatar image
* string 'url' => The profile url of the contact * string 'url' => The profile url of the contact
* string 'text' => The notification text * string 'text' => The notification text
* string 'when' => The date of the notification * string 'when' => The date of the notification
* string 'ago' => T relative date of the notification * string 'ago' => T relative date of the notification
* bool 'seen' => Is the notification marked as "seen" * bool 'seen' => Is the notification marked as "seen"
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function formatNotifs(array $notifs, $ident = "") private function formatNotifs(array $notifs, $ident = "")
{ {
@ -398,14 +403,15 @@ class NotificationsManager extends BaseObject
/** /**
* @brief Get network notifications * @brief Get network notifications
* *
* @param int|string $seen If 0 only include notifications into the query * @param int|string $seen If 0 only include notifications into the query
* which aren't marked as "seen" * which aren't marked as "seen"
* @param int $start Start the query at this point * @param int $start Start the query at this point
* @param int $limit Maximum number of query results * @param int $limit Maximum number of query results
* *
* @return array with * @return array with
* string 'ident' => Notification identifier * string 'ident' => Notification identifier
* array 'notifications' => Network notifications * array 'notifications' => Network notifications
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function networkNotifs($seen = 0, $start = 0, $limit = 80) public function networkNotifs($seen = 0, $start = 0, $limit = 80)
{ {
@ -439,14 +445,15 @@ class NotificationsManager extends BaseObject
/** /**
* @brief Get system notifications * @brief Get system notifications
* *
* @param int|string $seen If 0 only include notifications into the query * @param int|string $seen If 0 only include notifications into the query
* which aren't marked as "seen" * which aren't marked as "seen"
* @param int $start Start the query at this point * @param int $start Start the query at this point
* @param int $limit Maximum number of query results * @param int $limit Maximum number of query results
* *
* @return array with * @return array with
* string 'ident' => Notification identifier * string 'ident' => Notification identifier
* array 'notifications' => System notifications * array 'notifications' => System notifications
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function systemNotifs($seen = 0, $start = 0, $limit = 80) public function systemNotifs($seen = 0, $start = 0, $limit = 80)
{ {
@ -481,14 +488,15 @@ class NotificationsManager extends BaseObject
/** /**
* @brief Get personal notifications * @brief Get personal notifications
* *
* @param int|string $seen If 0 only include notifications into the query * @param int|string $seen If 0 only include notifications into the query
* which aren't marked as "seen" * which aren't marked as "seen"
* @param int $start Start the query at this point * @param int $start Start the query at this point
* @param int $limit Maximum number of query results * @param int $limit Maximum number of query results
* *
* @return array with * @return array with
* string 'ident' => Notification identifier * string 'ident' => Notification identifier
* array 'notifications' => Personal notifications * array 'notifications' => Personal notifications
* @throws \Exception
*/ */
public function personalNotifs($seen = 0, $start = 0, $limit = 80) public function personalNotifs($seen = 0, $start = 0, $limit = 80)
{ {
@ -526,14 +534,15 @@ class NotificationsManager extends BaseObject
/** /**
* @brief Get home notifications * @brief Get home notifications
* *
* @param int|string $seen If 0 only include notifications into the query * @param int|string $seen If 0 only include notifications into the query
* which aren't marked as "seen" * which aren't marked as "seen"
* @param int $start Start the query at this point * @param int $start Start the query at this point
* @param int $limit Maximum number of query results * @param int $limit Maximum number of query results
* *
* @return array with * @return array with
* string 'ident' => Notification identifier * string 'ident' => Notification identifier
* array 'notifications' => Home notifications * array 'notifications' => Home notifications
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function homeNotifs($seen = 0, $start = 0, $limit = 80) public function homeNotifs($seen = 0, $start = 0, $limit = 80)
{ {
@ -566,14 +575,16 @@ class NotificationsManager extends BaseObject
/** /**
* @brief Get introductions * @brief Get introductions
* *
* @param bool $all If false only include introductions into the query * @param bool $all If false only include introductions into the query
* which aren't marked as ignored * which aren't marked as ignored
* @param int $start Start the query at this point * @param int $start Start the query at this point
* @param int $limit Maximum number of query results * @param int $limit Maximum number of query results
* *
* @return array with * @return array with
* string 'ident' => Notification identifier * string 'ident' => Notification identifier
* array 'notifications' => Introductions * array 'notifications' => Introductions
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public function introNotifs($all = false, $start = 0, $limit = 80) public function introNotifs($all = false, $start = 0, $limit = 80)
{ {
@ -620,6 +631,8 @@ class NotificationsManager extends BaseObject
* *
* @param array $intros The array from the db query * @param array $intros The array from the db query
* @return array with the introductions * @return array with the introductions
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private function formatIntros($intros) private function formatIntros($intros)
{ {
@ -703,6 +716,7 @@ class NotificationsManager extends BaseObject
* @param array $arr The input array with the intro data * @param array $arr The input array with the intro data
* *
* @return array The array with the intro data * @return array The array with the intro data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function getMissingIntroData($arr) private function getMissingIntroData($arr)
{ {

View file

@ -21,7 +21,7 @@ use Friendica\BaseObject;
class PConfig extends BaseObject class PConfig extends BaseObject
{ {
/** /**
* @var Friendica\Core\Config\IPConfigAdapter * @var \Friendica\Core\Config\IPConfigAdapter
*/ */
private static $adapter = null; private static $adapter = null;
@ -51,6 +51,7 @@ class PConfig extends BaseObject
* @param string $family The category of the configuration value * @param string $family The category of the configuration value
* *
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function load($uid, $family) public static function load($uid, $family)
{ {
@ -80,6 +81,7 @@ class PConfig extends BaseObject
* @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
* *
* @return mixed Stored value or null if it does not exist * @return mixed Stored value or null if it does not exist
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function get($uid, $family, $key, $default_value = null, $refresh = false) public static function get($uid, $family, $key, $default_value = null, $refresh = false)
{ {
@ -101,7 +103,7 @@ class PConfig extends BaseObject
* Stores a config value ($value) in the category ($family) under the key ($key) * Stores a config value ($value) in the category ($family) under the key ($key)
* for the user_id $uid. * for the user_id $uid.
* *
* @note Please do not store booleans - convert to 0/1 integer values! * @note Please do not store booleans - convert to 0/1 integer values!
* *
* @param string $uid The user_id * @param string $uid The user_id
* @param string $family The category of the configuration value * @param string $family The category of the configuration value
@ -109,6 +111,7 @@ class PConfig extends BaseObject
* @param string $value The value to store * @param string $value The value to store
* *
* @return bool Operation success * @return bool Operation success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function set($uid, $family, $key, $value) public static function set($uid, $family, $key, $value)
{ {
@ -135,6 +138,7 @@ class PConfig extends BaseObject
* @param string $key The configuration key to delete * @param string $key The configuration key to delete
* *
* @return mixed * @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function delete($uid, $family, $key) public static function delete($uid, $family, $key)
{ {

View file

@ -50,7 +50,7 @@ class Protocol
* *
* @param string $profile_url * @param string $profile_url
* @return string * @return string
* @throws Exception * @throws \Exception
*/ */
public static function getAddrFromProfileUrl($profile_url) public static function getAddrFromProfileUrl($profile_url)
{ {
@ -69,8 +69,9 @@ class Protocol
* Guesses the network from a profile URL * Guesses the network from a profile URL
* *
* @param string $profile_url * @param string $profile_url
* @param array $matches preg_match return array: [0] => Full match [1] => hostname [2] => username * @param array $matches preg_match return array: [0] => Full match [1] => hostname [2] => username
* @return type * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function matchByProfileUrl($profile_url, &$matches = []) public static function matchByProfileUrl($profile_url, &$matches = [])
{ {
@ -131,6 +132,7 @@ class Protocol
* @param string $profile_url * @param string $profile_url
* @param string $display_name * @param string $display_name
* @return string * @return string
* @throws \Exception
*/ */
public static function formatMention($profile_url, $display_name) public static function formatMention($profile_url, $display_name)
{ {

View file

@ -56,6 +56,7 @@ class Renderer extends BaseObject
* @param array $vars key value pairs (search => replace) * @param array $vars key value pairs (search => replace)
* *
* @return string substituted string * @return string substituted string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function replaceMacros($s, $vars) public static function replaceMacros($s, $vars)
{ {
@ -78,14 +79,15 @@ class Renderer extends BaseObject
return $output; return $output;
} }
/** /**
* @brief Load a given template $s * @brief Load a given template $s
* *
* @param string $s Template to load. * @param string $s Template to load.
* @param string $root Optional. * @param string $root Optional.
* *
* @return string template. * @return string template.
*/ * @throws Exception
*/
public static function getMarkupTemplate($s, $root = '') public static function getMarkupTemplate($s, $root = '')
{ {
$stamp1 = microtime(true); $stamp1 = microtime(true);

View file

@ -45,6 +45,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
* @param string $session_id Session ID with format: [a-z0-9]{26} * @param string $session_id Session ID with format: [a-z0-9]{26}
* @param string $session_data Serialized session data * @param string $session_data Serialized session data
* @return boolean Returns false if parameters are missing, true otherwise * @return boolean Returns false if parameters are missing, true otherwise
* @throws \Exception
*/ */
public function write($session_id, $session_data) public function write($session_id, $session_data)
{ {

View file

@ -46,6 +46,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
* @param string $session_id Session ID with format: [a-z0-9]{26} * @param string $session_id Session ID with format: [a-z0-9]{26}
* @param string $session_data Serialized session data * @param string $session_data Serialized session data
* @return boolean Returns false if parameters are missing, true otherwise * @return boolean Returns false if parameters are missing, true otherwise
* @throws \Exception
*/ */
public function write($session_id, $session_data) public function write($session_id, $session_data)
{ {

View file

@ -33,6 +33,7 @@ class StorageManager
/** /**
* @brief Return current storage backend class * @brief Return current storage backend class
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getBackend() public static function getBackend()
{ {
@ -54,7 +55,8 @@ class StorageManager
/** /**
* @brief Set current storage backend class * @brief Set current storage backend class
* *
* @param string $class Backend class name * @param string $class Backend class name
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function setBackend($class) public static function setBackend($class)
{ {
@ -74,12 +76,12 @@ class StorageManager
} }
/** /**
* @brief Register a storage backend class * @brief Register a storage backend class
* *
* @param string $name User readable backend name * @param string $name User readable backend name
* @param string $class Backend class name * @param string $class Backend class name
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function register($name, $class) public static function register($name, $class)
{ {
@ -93,7 +95,8 @@ class StorageManager
/** /**
* @brief Unregister a storage backend class * @brief Unregister a storage backend class
* *
* @param string $name User readable backend name * @param string $name User readable backend name
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function unregister($name) public static function unregister($name)
{ {
@ -112,7 +115,8 @@ class StorageManager
* @param string $dest Destination storage class name * @param string $dest Destination storage class name
* @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach'] * @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach']
* *
* @retur int Number of moved resources * @throws \Exception
* @return int Number of moved resources
*/ */
public static function move($dest, $tables = null) public static function move($dest, $tables = null)
{ {

View file

@ -27,6 +27,7 @@ class System extends BaseObject
* *
* @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
* @return string Friendica server base URL * @return string Friendica server base URL
* @throws InternalServerErrorException
*/ */
public static function baseUrl($ssl = false) public static function baseUrl($ssl = false)
{ {
@ -39,6 +40,7 @@ class System extends BaseObject
* @param string $orig_url The url to be cleaned * @param string $orig_url The url to be cleaned
* *
* @return string The cleaned url * @return string The cleaned url
* @throws \Exception
*/ */
public static function removedBaseUrl($orig_url) public static function removedBaseUrl($orig_url)
{ {
@ -92,6 +94,10 @@ class System extends BaseObject
* Generic XML return * Generic XML return
* Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable * Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
* of $st and an optional text <message> of $message and terminates the current process. * of $st and an optional text <message> of $message and terminates the current process.
*
* @param $st
* @param string $message
* @throws \Exception
*/ */
public static function xmlExit($st, $message = '') public static function xmlExit($st, $message = '')
{ {
@ -121,6 +127,7 @@ class System extends BaseObject
* @param array $description optional message * @param array $description optional message
* 'title' => header title * 'title' => header title
* 'description' => optional message * 'description' => optional message
* @throws InternalServerErrorException
*/ */
public static function httpExit($val, $description = []) public static function httpExit($val, $description = [])
{ {
@ -191,8 +198,9 @@ class System extends BaseObject
/** /**
* Generates a random string in the UUID format * Generates a random string in the UUID format
* *
* @param bool|string $prefix A given prefix (default is empty) * @param bool|string $prefix A given prefix (default is empty)
* @return string a generated UUID * @return string a generated UUID
* @throws \Exception
*/ */
public static function createUUID($prefix = '') public static function createUUID($prefix = '')
{ {
@ -203,9 +211,10 @@ class System extends BaseObject
/** /**
* Generates a GUID with the given parameters * Generates a GUID with the given parameters
* *
* @param int $size The size of the GUID (default is 16) * @param int $size The size of the GUID (default is 16)
* @param bool|string $prefix A given prefix (default is empty) * @param bool|string $prefix A given prefix (default is empty)
* @return string a generated GUID * @return string a generated GUID
* @throws \Exception
*/ */
public static function createGUID($size = 16, $prefix = '') public static function createGUID($size = 16, $prefix = '')
{ {

View file

@ -90,8 +90,9 @@ class Theme
* *
* The screenshot is expected as view/theme/$theme/screenshot.[png|jpg]. * The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].
* *
* @param sring $theme The name of the theme * @param string $theme The name of the theme
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getScreenshot($theme) public static function getScreenshot($theme)
{ {
@ -148,6 +149,7 @@ class Theme
* @param string $file Filename * @param string $file Filename
* @param string $root Full root path * @param string $root Full root path
* @return string Path to the file or empty string if the file isn't found * @return string Path to the file or empty string if the file isn't found
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getPathForFile($file, $root = '') public static function getPathForFile($file, $root = '')
{ {

View file

@ -15,6 +15,7 @@ class Update
* @brief Function to check if the Database structure needs an update. * @brief Function to check if the Database structure needs an update.
* *
* @param boolean $via_worker boolean Is the check run via the worker? * @param boolean $via_worker boolean Is the check run via the worker?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function check($via_worker) public static function check($via_worker)
{ {
@ -45,11 +46,12 @@ class Update
/** /**
* Automatic database updates * Automatic database updates
* *
* @param bool $force Force the Update-Check even if the lock is set * @param bool $force Force the Update-Check even if the lock is set
* @param bool $verbose Run the Update-Check verbose * @param bool $verbose Run the Update-Check verbose
* @param bool $sendMail Sends a Mail to the administrator in case of success/failure * @param bool $sendMail Sends a Mail to the administrator in case of success/failure
* *
* @return string Empty string if the update is successful, error messages otherwise * @return string Empty string if the update is successful, error messages otherwise
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function run($force = false, $verbose = false, $sendMail = true) public static function run($force = false, $verbose = false, $sendMail = true)
{ {
@ -132,10 +134,11 @@ class Update
/** /**
* Executes a specific update function * Executes a specific update function
* *
* @param int $x the DB version number of the function * @param int $x the DB version number of the function
* @param string $prefix the prefix of the function (update, pre_update) * @param string $prefix the prefix of the function (update, pre_update)
* *
* @return bool true, if the update function worked * @return bool true, if the update function worked
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function runUpdateFunction($x, $prefix) public static function runUpdateFunction($x, $prefix)
{ {
@ -195,8 +198,9 @@ class Update
/** /**
* send the email and do what is needed to do on update fails * send the email and do what is needed to do on update fails
* *
* @param int $update_id number of failed update * @param int $update_id number of failed update
* @param string $error_message error message * @param string $error_message error message
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function updateFailed($update_id, $error_message) { private static function updateFailed($update_id, $error_message) {
//send the administrators an e-mail //send the administrators an e-mail

View file

@ -33,7 +33,8 @@ class UserImport
* Remove columns from array $arr that aren't in table $table * Remove columns from array $arr that aren't in table $table
* *
* @param string $table Table name * @param string $table Table name
* @param array &$arr Column=>Value array from json (by ref) * @param array &$arr Column=>Value array from json (by ref)
* @throws \Exception
*/ */
private static function checkCols($table, &$arr) private static function checkCols($table, &$arr)
{ {
@ -57,7 +58,9 @@ class UserImport
* Import data into table $table * Import data into table $table
* *
* @param string $table Table name * @param string $table Table name
* @param array $arr Column=>Value array from json * @param array $arr Column=>Value array from json
* @return array|bool
* @throws \Exception
*/ */
private static function dbImportAssoc($table, $arr) private static function dbImportAssoc($table, $arr)
{ {
@ -81,8 +84,10 @@ class UserImport
/** /**
* @brief Import account file exported from mod/uexport * @brief Import account file exported from mod/uexport
* *
* @param App $a Friendica App Class * @param App $a Friendica App Class
* @param array $file array from $_FILES * @param array $file array from $_FILES
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function importAccount(App $a, $file) public static function importAccount(App $a, $file)
{ {

View file

@ -31,6 +31,7 @@ class Worker
* *
* @param boolean $run_cron Should the cron processes be executed? * @param boolean $run_cron Should the cron processes be executed?
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function processQueue($run_cron = true) public static function processQueue($run_cron = true)
{ {
@ -148,6 +149,7 @@ class Worker
* @brief Returns the number of deferred entries in the worker queue * @brief Returns the number of deferred entries in the worker queue
* *
* @return integer Number of deferred entries in the worker queue * @return integer Number of deferred entries in the worker queue
* @throws \Exception
*/ */
private static function deferredEntries() private static function deferredEntries()
{ {
@ -159,6 +161,7 @@ class Worker
* @brief Returns the number of non executed entries in the worker queue * @brief Returns the number of non executed entries in the worker queue
* *
* @return integer Number of non executed entries in the worker queue * @return integer Number of non executed entries in the worker queue
* @throws \Exception
*/ */
private static function totalEntries() private static function totalEntries()
{ {
@ -170,6 +173,7 @@ class Worker
* @brief Returns the highest priority in the worker queue that isn't executed * @brief Returns the highest priority in the worker queue that isn't executed
* *
* @return integer Number of active worker processes * @return integer Number of active worker processes
* @throws \Exception
*/ */
private static function highestPriority() private static function highestPriority()
{ {
@ -188,6 +192,7 @@ class Worker
* @param integer $priority The priority that should be checked * @param integer $priority The priority that should be checked
* *
* @return integer Is there a process running with that priority? * @return integer Is there a process running with that priority?
* @throws \Exception
*/ */
private static function processWithPriorityActive($priority) private static function processWithPriorityActive($priority)
{ {
@ -202,6 +207,7 @@ class Worker
* @param array $queue Workerqueue entry * @param array $queue Workerqueue entry
* *
* @return boolean "true" if further processing should be stopped * @return boolean "true" if further processing should be stopped
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function execute($queue) public static function execute($queue)
{ {
@ -315,6 +321,7 @@ class Worker
* @param array $argv Array of values to be passed to the function * @param array $argv Array of values to be passed to the function
* @param boolean $method_call boolean * @param boolean $method_call boolean
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function execFunction($queue, $funcname, $argv, $method_call) private static function execFunction($queue, $funcname, $argv, $method_call)
{ {
@ -481,6 +488,7 @@ class Worker
* @brief Checks if the number of database connections has reached a critical limit. * @brief Checks if the number of database connections has reached a critical limit.
* *
* @return bool Are more than 3/4 of the maximum connections used? * @return bool Are more than 3/4 of the maximum connections used?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function maxConnectionsReached() private static function maxConnectionsReached()
{ {
@ -558,6 +566,7 @@ class Worker
/** /**
* @brief fix the queue entry if the worker process died * @brief fix the queue entry if the worker process died
* @return void * @return void
* @throws \Exception
*/ */
private static function killStaleWorkers() private static function killStaleWorkers()
{ {
@ -622,6 +631,7 @@ class Worker
* @brief Checks if the number of active workers exceeds the given limits * @brief Checks if the number of active workers exceeds the given limits
* *
* @return bool Are there too much workers running? * @return bool Are there too much workers running?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function tooMuchWorkers() public static function tooMuchWorkers()
{ {
@ -726,6 +736,7 @@ class Worker
* @brief Returns the number of active worker processes * @brief Returns the number of active worker processes
* *
* @return integer Number of active worker processes * @return integer Number of active worker processes
* @throws \Exception
*/ */
private static function activeWorkers() private static function activeWorkers()
{ {
@ -740,6 +751,7 @@ class Worker
* *
* @param string $highest_priority Returns the currently highest priority * @param string $highest_priority Returns the currently highest priority
* @return bool We let pass a slower process than $highest_priority * @return bool We let pass a slower process than $highest_priority
* @throws \Exception
*/ */
private static function passingSlow(&$highest_priority) private static function passingSlow(&$highest_priority)
{ {
@ -792,6 +804,7 @@ class Worker
* *
* @param boolean $passing_slow Returns if we had passed low priority processes * @param boolean $passing_slow Returns if we had passed low priority processes
* @return boolean Have we found something? * @return boolean Have we found something?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function findWorkerProcesses(&$passing_slow) private static function findWorkerProcesses(&$passing_slow)
{ {
@ -886,6 +899,7 @@ class Worker
* *
* @param boolean $passing_slow Returns if we had passed low priority processes * @param boolean $passing_slow Returns if we had passed low priority processes
* @return string SQL statement * @return string SQL statement
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function workerProcess(&$passing_slow) public static function workerProcess(&$passing_slow)
{ {
@ -921,6 +935,7 @@ class Worker
/** /**
* @brief Removes a workerqueue entry from the current process * @brief Removes a workerqueue entry from the current process
* @return void * @return void
* @throws \Exception
*/ */
public static function unclaimProcess() public static function unclaimProcess()
{ {
@ -932,6 +947,7 @@ class Worker
/** /**
* @brief Call the front end worker * @brief Call the front end worker
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function callWorker() public static function callWorker()
{ {
@ -946,6 +962,7 @@ class Worker
/** /**
* @brief Call the front end worker if there aren't any active * @brief Call the front end worker if there aren't any active
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function executeIfIdle() public static function executeIfIdle()
{ {
@ -996,6 +1013,7 @@ class Worker
/** /**
* @brief Removes long running worker processes * @brief Removes long running worker processes
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function clearProcesses() public static function clearProcesses()
{ {
@ -1010,6 +1028,7 @@ class Worker
/** /**
* @brief Runs the cron processes * @brief Runs the cron processes
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function runCron() private static function runCron()
{ {
@ -1027,7 +1046,9 @@ class Worker
/** /**
* @brief Spawns a new worker * @brief Spawns a new worker
* @param bool $do_cron
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function spawnWorker($do_cron = false) public static function spawnWorker($do_cron = false)
{ {
@ -1052,12 +1073,13 @@ class Worker
* or: Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); * or: Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id);
* or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id); * or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id);
* *
* @return boolean "false" if proc_run couldn't be executed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @note $cmd and string args are surrounded with "" * @note $cmd and string args are surrounded with ""
* *
* @hooks 'proc_run' * @hooks 'proc_run'
* array $arr * array $arr
* *
* @return boolean "false" if proc_run couldn't be executed
*/ */
public static function add($cmd) public static function add($cmd)
{ {
@ -1186,6 +1208,7 @@ class Worker
* *
* @brief Remove the active process from the "process" table * @brief Remove the active process from the "process" table
* @return bool * @return bool
* @throws \Exception
*/ */
public static function endProcess() public static function endProcess()
{ {
@ -1197,6 +1220,7 @@ class Worker
* *
* @brief Set the flag if some job is waiting * @brief Set the flag if some job is waiting
* @param boolean $jobs Is there a waiting job? * @param boolean $jobs Is there a waiting job?
* @throws \Exception
*/ */
public static function IPCSetJobState($jobs) public static function IPCSetJobState($jobs)
{ {
@ -1208,6 +1232,7 @@ class Worker
* *
* @brief Checks if some worker job waits to be executed * @brief Checks if some worker job waits to be executed
* @return bool * @return bool
* @throws \Exception
*/ */
public static function IPCJobsExists() public static function IPCJobsExists()
{ {

View file

@ -195,6 +195,7 @@ class DBA
* @brief Returns the selected database name * @brief Returns the selected database name
* *
* @return string * @return string
* @throws \Exception
*/ */
public static function databaseName() { public static function databaseName() {
$ret = self::p("SELECT DATABASE() AS `db`"); $ret = self::p("SELECT DATABASE() AS `db`");
@ -206,6 +207,7 @@ class DBA
* @brief Analyze a database query and log this if some conditions are met. * @brief Analyze a database query and log this if some conditions are met.
* *
* @param string $query The database query that will be analyzed * @param string $query The database query that will be analyzed
* @throws \Exception
*/ */
private static function logIndex($query) { private static function logIndex($query) {
$a = \get_app(); $a = \get_app();
@ -386,6 +388,7 @@ class DBA
* *
* @param string $sql SQL statement * @param string $sql SQL statement
* @return bool|object statement object or result object * @return bool|object statement object or result object
* @throws \Exception
*/ */
public static function p($sql) { public static function p($sql) {
$a = \get_app(); $a = \get_app();
@ -604,6 +607,7 @@ class DBA
* *
* @param string $sql SQL statement * @param string $sql SQL statement
* @return boolean Was the query successfull? False is returned only if an error occurred * @return boolean Was the query successfull? False is returned only if an error occurred
* @throws \Exception
*/ */
public static function e($sql) { public static function e($sql) {
$a = \get_app(); $a = \get_app();
@ -657,10 +661,11 @@ class DBA
/** /**
* @brief Check if data exists * @brief Check if data exists
* *
* @param string $table Table name * @param string $table Table name
* @param array $condition array of fields for condition * @param array $condition array of fields for condition
* *
* @return boolean Are there rows for that condition? * @return boolean Are there rows for that condition?
* @throws \Exception
*/ */
public static function exists($table, $condition) { public static function exists($table, $condition) {
if (empty($table)) { if (empty($table)) {
@ -700,6 +705,7 @@ class DBA
* @brief Fetches the first row * @brief Fetches the first row
* @param string $sql SQL statement * @param string $sql SQL statement
* @return array first row of query * @return array first row of query
* @throws \Exception
*/ */
public static function fetchFirst($sql) { public static function fetchFirst($sql) {
$params = self::getParam(func_get_args()); $params = self::getParam(func_get_args());
@ -825,11 +831,12 @@ class DBA
/** /**
* @brief Insert a row into a table * @brief Insert a row into a table
* *
* @param string $table Table name * @param string $table Table name
* @param array $param parameter array * @param array $param parameter array
* @param bool $on_duplicate_update Do an update on a duplicate entry * @param bool $on_duplicate_update Do an update on a duplicate entry
* *
* @return boolean was the insert successful? * @return boolean was the insert successful?
* @throws \Exception
*/ */
public static function insert($table, $param, $on_duplicate_update = false) { public static function insert($table, $param, $on_duplicate_update = false) {
@ -876,6 +883,7 @@ class DBA
* @param string $table Table name * @param string $table Table name
* *
* @return boolean was the lock successful? * @return boolean was the lock successful?
* @throws \Exception
*/ */
public static function lock($table) { public static function lock($table) {
// See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html
@ -908,6 +916,7 @@ class DBA
* @brief Unlocks all locked tables * @brief Unlocks all locked tables
* *
* @return boolean was the unlock successful? * @return boolean was the unlock successful?
* @throws \Exception
*/ */
public static function unlock() { public static function unlock() {
// See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html
@ -1037,14 +1046,15 @@ class DBA
/** /**
* @brief Delete a row from a table * @brief Delete a row from a table
* *
* @param string $table Table name * @param string $table Table name
* @param array $conditions Field condition(s) * @param array $conditions Field condition(s)
* @param array $options * @param array $options
* - cascade: If true we delete records in other tables that depend on the one we're deleting through * - cascade: If true we delete records in other tables that depend on the one we're deleting through
* relations (default: true) * relations (default: true)
* @param array $callstack Internal use: prevent endless loops * @param array $callstack Internal use: prevent endless loops
* *
* @return boolean was the delete successful? * @return boolean was the delete successful?
* @throws \Exception
*/ */
public static function delete($table, array $conditions, array $options = [], array &$callstack = []) public static function delete($table, array $conditions, array $options = [], array &$callstack = [])
{ {
@ -1203,12 +1213,13 @@ class DBA
* Only set $old_fields to a boolean value when you are sure that you will update a single row. * Only set $old_fields to a boolean value when you are sure that you will update a single row.
* When you set $old_fields to "true" then $fields must contain all relevant fields! * When you set $old_fields to "true" then $fields must contain all relevant fields!
* *
* @param string $table Table name * @param string $table Table name
* @param array $fields contains the fields that are updated * @param array $fields contains the fields that are updated
* @param array $condition condition array with the key values * @param array $condition condition array with the key values
* @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate) * @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate)
* *
* @return boolean was the update successfull? * @return boolean was the update successfull?
* @throws \Exception
*/ */
public static function update($table, $fields, $condition, $old_fields = []) { public static function update($table, $fields, $condition, $old_fields = []) {
@ -1270,7 +1281,8 @@ class DBA
* @param array $condition * @param array $condition
* @param array $params * @param array $params
* @return bool|array * @return bool|array
* @see self::select * @throws \Exception
* @see self::select
*/ */
public static function selectFirst($table, array $fields = [], array $condition = [], $params = []) public static function selectFirst($table, array $fields = [], array $condition = [], $params = [])
{ {
@ -1307,6 +1319,7 @@ class DBA
* $params = array("order" => array("id", "received" => true), "limit" => 10); * $params = array("order" => array("id", "received" => true), "limit" => 10);
* *
* $data = DBA::select($table, $fields, $condition, $params); * $data = DBA::select($table, $fields, $condition, $params);
* @throws \Exception
*/ */
public static function select($table, array $fields = [], array $condition = [], array $params = []) public static function select($table, array $fields = [], array $condition = [], array $params = [])
{ {
@ -1336,8 +1349,8 @@ class DBA
/** /**
* @brief Counts the rows from a table satisfying the provided condition * @brief Counts the rows from a table satisfying the provided condition
* *
* @param string $table Table name * @param string $table Table name
* @param array $condition array of fields for condition * @param array $condition array of fields for condition
* *
* @return int * @return int
* *
@ -1349,6 +1362,7 @@ class DBA
* $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr']; * $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'];
* *
* $count = DBA::count($table, $condition); * $count = DBA::count($table, $condition);
* @throws \Exception
*/ */
public static function count($table, array $condition = []) public static function count($table, array $condition = [])
{ {
@ -1476,6 +1490,7 @@ class DBA
* @brief Fills an array with data from a query * @brief Fills an array with data from a query
* *
* @param object $stmt statement object * @param object $stmt statement object
* @param bool $do_close
* @return array Data array * @return array Data array
*/ */
public static function toArray($stmt, $do_close = true) { public static function toArray($stmt, $do_close = true) {
@ -1557,6 +1572,7 @@ class DBA
* @return array * @return array
* 'list' => List of processes, separated in their different states * 'list' => List of processes, separated in their different states
* 'amount' => Number of concurrent database processes * 'amount' => Number of concurrent database processes
* @throws \Exception
*/ */
public static function processlist() public static function processlist()
{ {

View file

@ -251,6 +251,7 @@ class DBStructure
* @param array $tables An array of the database tables * @param array $tables An array of the database tables
* @param array $definition An array of the definition tables * @param array $definition An array of the definition tables
* @return string Empty string if the update is successful, error messages otherwise * @return string Empty string if the update is successful, error messages otherwise
* @throws Exception
*/ */
public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null)
{ {
@ -715,7 +716,7 @@ class DBStructure
* @param int $type The type of renaming (Default is Column) * @param int $type The type of renaming (Default is Column)
* *
* @return boolean Was the renaming successful? * @return boolean Was the renaming successful?
* * @throws Exception
*/ */
public static function rename($table, $columns, $type = self::RENAME_COLUMN) public static function rename($table, $columns, $type = self::RENAME_COLUMN)
{ {
@ -775,6 +776,7 @@ class DBStructure
* @param array $columns Columns to check ( Syntax: [ $col1, $col2, .. ] ) * @param array $columns Columns to check ( Syntax: [ $col1, $col2, .. ] )
* *
* @return boolean Does the table exist? * @return boolean Does the table exist?
* @throws Exception
*/ */
public static function existsColumn($table, $columns = []) public static function existsColumn($table, $columns = [])
{ {
@ -815,6 +817,7 @@ class DBStructure
* @param string $table Table name * @param string $table Table name
* *
* @return boolean Does the table exist? * @return boolean Does the table exist?
* @throws Exception
*/ */
public static function existsTable($table) public static function existsTable($table)
{ {

View file

@ -43,6 +43,7 @@ class PostUpdate
* @brief Updates the "global" field in the item table * @brief Updates the "global" field in the item table
* *
* @return bool "true" when the job is done * @return bool "true" when the job is done
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function update1194() private static function update1194()
{ {
@ -113,6 +114,7 @@ class PostUpdate
* This field avoids cost intensive calls in the admin panel and in "nodeinfo" * This field avoids cost intensive calls in the admin panel and in "nodeinfo"
* *
* @return bool "true" when the job is done * @return bool "true" when the job is done
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function update1206() private static function update1206()
{ {
@ -145,6 +147,8 @@ class PostUpdate
* @brief update the item related tables * @brief update the item related tables
* *
* @return bool "true" when the job is done * @return bool "true" when the job is done
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function update1279() private static function update1279()
{ {
@ -295,6 +299,7 @@ class PostUpdate
* @brief update item-uri data. Prerequisite for the next item structure update. * @brief update item-uri data. Prerequisite for the next item structure update.
* *
* @return bool "true" when the job is done * @return bool "true" when the job is done
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function update1281() private static function update1281()
{ {

View file

@ -22,6 +22,7 @@ class LegacyModule extends BaseModule
* The only method that needs to be called, with the module/addon file name. * The only method that needs to be called, with the module/addon file name.
* *
* @param string $file_path * @param string $file_path
* @throws \Exception
*/ */
public static function setModuleFile($file_path) public static function setModuleFile($file_path)
{ {
@ -59,6 +60,7 @@ class LegacyModule extends BaseModule
* *
* @param string $function_suffix * @param string $function_suffix
* @return string * @return string
* @throws \Exception
*/ */
private static function runModuleFunction($function_suffix) private static function runModuleFunction($function_suffix)
{ {

View file

@ -23,6 +23,7 @@ class APContact extends BaseObject
* *
* @param string $addr profile address (user@domain.tld) * @param string $addr profile address (user@domain.tld)
* @return string url * @return string url
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function addrToUrl($addr) private static function addrToUrl($addr)
{ {
@ -63,6 +64,8 @@ class APContact extends BaseObject
* @param string $url profile url * @param string $url profile url
* @param boolean $update true = always update, false = never update, null = update when not found or outdated * @param boolean $update true = always update, false = never update, null = update when not found or outdated
* @return array profile array * @return array profile array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getByURL($url, $update = null) public static function getByURL($url, $update = null)
{ {

View file

@ -25,6 +25,7 @@ class Attach extends BaseObject
* @brief Return a list of fields that are associated with the attach table * @brief Return a list of fields that are associated with the attach table
* *
* @return array field list * @return array field list
* @throws \Exception
*/ */
private static function getFields() private static function getFields()
{ {
@ -37,13 +38,14 @@ class Attach extends BaseObject
/** /**
* @brief Select rows from the attach table * @brief Select rows from the attach table
* *
* @param array $fields Array of selected fields, empty for all * @param array $fields Array of selected fields, empty for all
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|array * @return boolean|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function select(array $fields = [], array $conditions = [], array $params = []) public static function select(array $fields = [], array $conditions = [], array $params = [])
{ {
@ -58,13 +60,14 @@ class Attach extends BaseObject
/** /**
* @brief Retrieve a single record from the attach table * @brief Retrieve a single record from the attach table
* *
* @param array $fields Array of selected fields, empty for all * @param array $fields Array of selected fields, empty for all
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function selectFirst(array $fields = [], array $conditions = [], array $params = []) public static function selectFirst(array $fields = [], array $conditions = [], array $params = [])
{ {
@ -78,9 +81,10 @@ class Attach extends BaseObject
/** /**
* @brief Check if attachment with given conditions exists * @brief Check if attachment with given conditions exists
* *
* @param array $conditions Array of extra conditions * @param array $conditions Array of extra conditions
* *
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function exists(array $conditions) public static function exists(array $conditions)
{ {
@ -89,12 +93,13 @@ class Attach extends BaseObject
/** /**
* @brief Retrive a single record given the ID * @brief Retrive a single record given the ID
* *
* @param int $id Row id of the record * @param int $id Row id of the record
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function getById($id) public static function getById($id)
{ {
@ -102,13 +107,14 @@ class Attach extends BaseObject
} }
/** /**
* @brief Retrive a single record given the ID * @brief Retrive a single record given the ID
* *
* @param int $id Row id of the record * @param int $id Row id of the record
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function getByIdWithPermission($id) public static function getByIdWithPermission($id)
{ {
@ -131,10 +137,11 @@ class Attach extends BaseObject
/** /**
* @brief Get file data for given row id. null if row id does not exist * @brief Get file data for given row id. null if row id does not exist
* *
* @param array $item Attachment data. Needs at least 'id', 'backend-class', 'backend-ref' * @param array $item Attachment data. Needs at least 'id', 'backend-class', 'backend-ref'
* *
* @return string file data * @return string file data
* @throws \Exception
*/ */
public static function getData($item) public static function getData($item)
{ {
@ -155,7 +162,7 @@ class Attach extends BaseObject
/** /**
* @brief Store new file metadata in db and binary in default backend * @brief Store new file metadata in db and binary in default backend
* *
* @param string $data Binary data * @param string $data Binary data
* @param integer $uid User ID * @param integer $uid User ID
* @param string $filename Filename * @param string $filename Filename
* @param string $filetype Mimetype. optional, default = '' * @param string $filetype Mimetype. optional, default = ''
@ -166,6 +173,7 @@ class Attach extends BaseObject
* @param string $deny_gid Permissions, denied greoup.optional, default = '' * @param string $deny_gid Permissions, denied greoup.optional, default = ''
* *
* @return boolean/integer Row id on success, False on errors * @return boolean/integer Row id on success, False on errors
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function store($data, $uid, $filename, $filetype = '' , $filesize = null, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') public function store($data, $uid, $filename, $filetype = '' , $filesize = null, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '')
{ {
@ -214,7 +222,15 @@ class Attach extends BaseObject
/** /**
* @brief Store new file metadata in db and binary in default backend from existing file * @brief Store new file metadata in db and binary in default backend from existing file
* *
* @param $src
* @param $uid
* @param string $filename
* @param string $allow_cid
* @param string $allow_gid
* @param string $deny_cid
* @param string $deny_gid
* @return boolean True on success * @return boolean True on success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function storeFile($src, $uid, $filename = '', $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') public function storeFile($src, $uid, $filename = '', $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '')
{ {
@ -233,12 +249,13 @@ class Attach extends BaseObject
* *
* @param array $fields Contains the fields that are updated * @param array $fields Contains the fields that are updated
* @param array $conditions Condition array with the key values * @param array $conditions Condition array with the key values
* @param string $data File data to update. Optional, default null. * @param Image $img Image data to update. Optional, default null.
* @param array|boolean $old_fields Array with the old field values that are about to be replaced (true = update on duplicate) * @param array|boolean $old_fields Array with the old field values that are about to be replaced (true = update on duplicate)
* *
* @return boolean Was the update successfull? * @return boolean Was the update successful?
* *
* @see \Friendica\Database\DBA::update * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @see \Friendica\Database\DBA::update
*/ */
public static function update($fields, $conditions, $img = null, array $old_fields = []) public static function update($fields, $conditions, $img = null, array $old_fields = [])
{ {
@ -265,12 +282,13 @@ class Attach extends BaseObject
/** /**
* @brief Delete info from table and data from storage * @brief Delete info from table and data from storage
* *
* @param array $conditions Field condition(s) * @param array $conditions Field condition(s)
* @param array $options Options array, Optional * @param array $options Options array, Optional
* *
* @return boolean * @return boolean
* *
* @see \Friendica\Database\DBA::delete * @throws \Exception
* @see \Friendica\Database\DBA::delete
*/ */
public static function delete(array $conditions, array $options = []) public static function delete(array $conditions, array $options = [])
{ {

View file

@ -32,7 +32,7 @@ use Friendica\Util\Strings;
class Contact extends BaseObject class Contact extends BaseObject
{ {
/** /**
* @name page/profile types * Page/profile types
* *
* PAGE_NORMAL is a typical personal profile account * PAGE_NORMAL is a typical personal profile account
* PAGE_SOAPBOX automatically approves all friend requests as Contact::SHARING, (readonly) * PAGE_SOAPBOX automatically approves all friend requests as Contact::SHARING, (readonly)
@ -81,7 +81,7 @@ class Contact extends BaseObject
*/ */
/** /**
* @name Contact_is * Contact_is
* *
* Relationship types * Relationship types
* @{ * @{
@ -100,6 +100,8 @@ class Contact extends BaseObject
* @param int $uid User ID * @param int $uid User ID
* *
* @return boolean is the contact id a follower? * @return boolean is the contact id a follower?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function isFollower($cid, $uid) public static function isFollower($cid, $uid)
{ {
@ -118,11 +120,13 @@ class Contact extends BaseObject
/** /**
* @brief Get the basepath for a given contact link * @brief Get the basepath for a given contact link
* @todo Add functionality to store this value in the contact table * @todo Add functionality to store this value in the contact table
* *
* @param string $url The contact link * @param string $url The contact link
* *
* @return string basepath * @return string basepath
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getBasepath($url) public static function getBasepath($url)
{ {
@ -142,6 +146,8 @@ class Contact extends BaseObject
* @param int $uid User ID * @param int $uid User ID
* *
* @return array with public and user's contact id * @return array with public and user's contact id
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getPublicAndUserContacID($cid, $uid) public static function getPublicAndUserContacID($cid, $uid)
{ {
@ -179,6 +185,7 @@ class Contact extends BaseObject
* @param int $cid Either public contact id or user's contact id * @param int $cid Either public contact id or user's contact id
* @param int $uid User ID * @param int $uid User ID
* @param boolean $blocked Is the contact blocked or unblocked? * @param boolean $blocked Is the contact blocked or unblocked?
* @throws \Exception
*/ */
public static function setBlockedForUser($cid, $uid, $blocked) public static function setBlockedForUser($cid, $uid, $blocked)
{ {
@ -201,6 +208,7 @@ class Contact extends BaseObject
* @param int $uid User ID * @param int $uid User ID
* *
* @return boolean is the contact id blocked for the given user? * @return boolean is the contact id blocked for the given user?
* @throws \Exception
*/ */
public static function isBlockedByUser($cid, $uid) public static function isBlockedByUser($cid, $uid)
{ {
@ -240,6 +248,7 @@ class Contact extends BaseObject
* @param int $cid Either public contact id or user's contact id * @param int $cid Either public contact id or user's contact id
* @param int $uid User ID * @param int $uid User ID
* @param boolean $ignored Is the contact ignored or unignored? * @param boolean $ignored Is the contact ignored or unignored?
* @throws \Exception
*/ */
public static function setIgnoredForUser($cid, $uid, $ignored) public static function setIgnoredForUser($cid, $uid, $ignored)
{ {
@ -262,6 +271,7 @@ class Contact extends BaseObject
* @param int $uid User ID * @param int $uid User ID
* *
* @return boolean is the contact id ignored for the given user? * @return boolean is the contact id ignored for the given user?
* @throws \Exception
*/ */
public static function isIgnoredByUser($cid, $uid) public static function isIgnoredByUser($cid, $uid)
{ {
@ -301,6 +311,7 @@ class Contact extends BaseObject
* @param int $cid Either public contact id or user's contact id * @param int $cid Either public contact id or user's contact id
* @param int $uid User ID * @param int $uid User ID
* @param boolean $collapsed are the contact's posts collapsed or uncollapsed? * @param boolean $collapsed are the contact's posts collapsed or uncollapsed?
* @throws \Exception
*/ */
public static function setCollapsedForUser($cid, $uid, $collapsed) public static function setCollapsedForUser($cid, $uid, $collapsed)
{ {
@ -319,6 +330,8 @@ class Contact extends BaseObject
* @param int $uid User ID * @param int $uid User ID
* *
* @return boolean is the contact id blocked for the given user? * @return boolean is the contact id blocked for the given user?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function isCollapsedByUser($cid, $uid) public static function isCollapsedByUser($cid, $uid)
{ {
@ -344,6 +357,7 @@ class Contact extends BaseObject
* *
* @param int $gid * @param int $gid
* @return array * @return array
* @throws \Exception
*/ */
public static function getByGroupId($gid) public static function getByGroupId($gid)
{ {
@ -378,6 +392,7 @@ class Contact extends BaseObject
* *
* @param int $gid * @param int $gid
* @return int * @return int
* @throws \Exception
*/ */
public static function getOStatusCountByGroupId($gid) public static function getOStatusCountByGroupId($gid)
{ {
@ -406,6 +421,7 @@ class Contact extends BaseObject
* *
* @param int $uid * @param int $uid
* @return bool Operation success * @return bool Operation success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function createSelfFromUserId($uid) public static function createSelfFromUserId($uid)
{ {
@ -450,8 +466,9 @@ class Contact extends BaseObject
/** /**
* Updates the self-contact for the provided user id * Updates the self-contact for the provided user id
* *
* @param int $uid * @param int $uid
* @param boolean $update_avatar Force the avatar update * @param boolean $update_avatar Force the avatar update
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function updateSelfFromUserID($uid, $update_avatar = false) public static function updateSelfFromUserID($uid, $update_avatar = false)
{ {
@ -552,6 +569,7 @@ class Contact extends BaseObject
* *
* @param int $id contact id * @param int $id contact id
* @return null * @return null
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function remove($id) public static function remove($id)
{ {
@ -575,6 +593,8 @@ class Contact extends BaseObject
* @param array $contact Contact unfriended * @param array $contact Contact unfriended
* @param boolean $dissolve Remove the contact on the remote side * @param boolean $dissolve Remove the contact on the remote side
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function terminateFriendship(array $user, array $contact, $dissolve = false) public static function terminateFriendship(array $user, array $contact, $dissolve = false)
{ {
@ -620,6 +640,7 @@ class Contact extends BaseObject
* *
* @param array $contact contact to mark for archival * @param array $contact contact to mark for archival
* @return null * @return null
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function markForArchival(array $contact) public static function markForArchival(array $contact)
{ {
@ -668,10 +689,11 @@ class Contact extends BaseObject
/** /**
* @brief Cancels the archival countdown * @brief Cancels the archival countdown
* *
* @see Contact::markForArchival() * @see Contact::markForArchival()
* *
* @param array $contact contact to be unmarked for archival * @param array $contact contact to be unmarked for archival
* @return null * @return null
* @throws \Exception
*/ */
public static function unmarkForArchival(array $contact) public static function unmarkForArchival(array $contact)
{ {
@ -715,6 +737,7 @@ class Contact extends BaseObject
* @param array $default If not data was found take this data as default value * @param array $default If not data was found take this data as default value
* *
* @return array Contact data * @return array Contact data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getDetailsByURL($url, $uid = -1, array $default = []) public static function getDetailsByURL($url, $uid = -1, array $default = [])
{ {
@ -857,6 +880,8 @@ class Contact extends BaseObject
* @param int $uid User id * @param int $uid User id
* *
* @return array Contact data * @return array Contact data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getDetailsByAddr($addr, $uid = -1) public static function getDetailsByAddr($addr, $uid = -1)
{ {
@ -912,6 +937,8 @@ class Contact extends BaseObject
* @param array $contact contact * @param array $contact contact
* @param int $uid optional, default 0 * @param int $uid optional, default 0
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function photoMenu(array $contact, $uid = 0) public static function photoMenu(array $contact, $uid = 0)
{ {
@ -1025,10 +1052,7 @@ class Contact extends BaseObject
* Returns either the total number of ungrouped contacts for the given user * Returns either the total number of ungrouped contacts for the given user
* id or a paginated list of ungrouped contacts. * id or a paginated list of ungrouped contacts.
* *
* @param int $uid uid * @param int $uid uid
* @param int $start optional, default 0
* @param int $count optional, default 0
*
* @return array * @return array
*/ */
public static function getUngroupedList($uid) public static function getUngroupedList($uid)
@ -1073,6 +1097,8 @@ class Contact extends BaseObject
* @param boolean $in_loop Internally used variable to prevent an endless loop * @param boolean $in_loop Internally used variable to prevent an endless loop
* *
* @return integer Contact ID * @return integer Contact ID
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false) public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false)
{ {
@ -1330,6 +1356,7 @@ class Contact extends BaseObject
* @param int $cid contact id * @param int $cid contact id
* *
* @return boolean Is the contact blocked? * @return boolean Is the contact blocked?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isBlocked($cid) public static function isBlocked($cid)
{ {
@ -1355,6 +1382,7 @@ class Contact extends BaseObject
* @param int $cid contact id * @param int $cid contact id
* *
* @return boolean Is the contact hidden? * @return boolean Is the contact hidden?
* @throws \Exception
*/ */
public static function isHidden($cid) public static function isHidden($cid)
{ {
@ -1374,7 +1402,10 @@ class Contact extends BaseObject
* *
* @param string $contact_url Contact URL * @param string $contact_url Contact URL
* *
* @param bool $thread_mode
* @param int $update
* @return string posts in HTML * @return string posts in HTML
* @throws \Exception
*/ */
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0) public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0)
{ {
@ -1489,6 +1520,7 @@ class Contact extends BaseObject
* *
* @param int $uid * @param int $uid
* @return bool * @return bool
* @throws \Exception
*/ */
public static function block($uid) public static function block($uid)
{ {
@ -1502,6 +1534,7 @@ class Contact extends BaseObject
* *
* @param int $uid * @param int $uid
* @return bool * @return bool
* @throws \Exception
*/ */
public static function unblock($uid) public static function unblock($uid)
{ {
@ -1519,6 +1552,8 @@ class Contact extends BaseObject
* @param bool $force force picture update * @param bool $force force picture update
* *
* @return array Returns array of the different avatar sizes * @return array Returns array of the different avatar sizes
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function updateAvatar($avatar, $uid, $cid, $force = false) public static function updateAvatar($avatar, $uid, $cid, $force = false)
{ {
@ -1558,6 +1593,8 @@ class Contact extends BaseObject
* @param integer $id contact id * @param integer $id contact id
* @param string $network Optional network we are probing for * @param string $network Optional network we are probing for
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function updateFromProbe($id, $network = '') public static function updateFromProbe($id, $network = '')
{ {
@ -1633,7 +1670,9 @@ class Contact extends BaseObject
* @param string $url * @param string $url
* @param bool $interactive * @param bool $interactive
* @param string $network * @param string $network
* @return boolean|string * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function createFromProbe($uid, $url, $interactive = false, $network = '') public static function createFromProbe($uid, $url, $interactive = false, $network = '')
{ {
@ -1848,10 +1887,11 @@ class Contact extends BaseObject
/** /**
* @brief Updated contact's SSL policy * @brief Updated contact's SSL policy
* *
* @param array $contact Contact array * @param array $contact Contact array
* @param string $new_policy New policy, valid: self,full * @param string $new_policy New policy, valid: self,full
* *
* @return array Contact array with updated values * @return array Contact array with updated values
* @throws \Exception
*/ */
public static function updateSslPolicy(array $contact, $new_policy) public static function updateSslPolicy(array $contact, $new_policy)
{ {
@ -2055,6 +2095,7 @@ class Contact extends BaseObject
* Remove the unavailable contact ids from the provided list * Remove the unavailable contact ids from the provided list
* *
* @param array $contact_ids Contact id list * @param array $contact_ids Contact id list
* @throws \Exception
*/ */
public static function pruneUnavailable(array &$contact_ids) public static function pruneUnavailable(array &$contact_ids)
{ {
@ -2079,12 +2120,14 @@ class Contact extends BaseObject
/** /**
* @brief Returns a magic link to authenticate remote visitors * @brief Returns a magic link to authenticate remote visitors
* *
* @todo check if the return is either a fully qualified URL or a relative path to Friendica basedir * @todo check if the return is either a fully qualified URL or a relative path to Friendica basedir
* *
* @param string $contact_url The address of the target contact profile * @param string $contact_url The address of the target contact profile
* @param string $url An url that we will be redirected to after the authentication * @param string $url An url that we will be redirected to after the authentication
* *
* @return string with "redir" link * @return string with "redir" link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function magicLink($contact_url, $url = '') public static function magicLink($contact_url, $url = '')
{ {
@ -2104,9 +2147,11 @@ class Contact extends BaseObject
* @brief Returns a magic link to authenticate remote visitors * @brief Returns a magic link to authenticate remote visitors
* *
* @param integer $cid The contact id of the target contact profile * @param integer $cid The contact id of the target contact profile
* @param integer $url An url that we will be redirected to after the authentication * @param string $url An url that we will be redirected to after the authentication
* *
* @return string with "redir" link * @return string with "redir" link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function magicLinkbyId($cid, $url = '') public static function magicLinkbyId($cid, $url = '')
{ {
@ -2118,10 +2163,12 @@ class Contact extends BaseObject
/** /**
* @brief Returns a magic link to authenticate remote visitors * @brief Returns a magic link to authenticate remote visitors
* *
* @param array $contact The contact array with "uid", "network" and "url" * @param array $contact The contact array with "uid", "network" and "url"
* @param string $url An url that we will be redirected to after the authentication * @param string $url An url that we will be redirected to after the authentication
* *
* @return string with "redir" link * @return string with "redir" link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function magicLinkbyContact($contact, $url = '') public static function magicLinkbyContact($contact, $url = '')
{ {

View file

@ -35,6 +35,7 @@ class Conversation
* *
* @param array $arr Item array with conversation data * @param array $arr Item array with conversation data
* @return array Item array with removed conversation data * @return array Item array with removed conversation data
* @throws \Exception
*/ */
public static function insert(array $arr) public static function insert(array $arr)
{ {

View file

@ -148,6 +148,7 @@ class Event extends BaseObject
* @brief Extract bbcode formatted event data from a string. * @brief Extract bbcode formatted event data from a string.
* *
* @params: string $s The string which should be parsed for event data. * @params: string $s The string which should be parsed for event data.
* @param $text
* @return array The array with the event information. * @return array The array with the event information.
*/ */
public static function fromBBCode($text) public static function fromBBCode($text)
@ -215,6 +216,7 @@ class Event extends BaseObject
* *
* @param int $event_id Event ID. * @param int $event_id Event ID.
* @return void * @return void
* @throws \Exception
*/ */
public static function delete($event_id) public static function delete($event_id)
{ {
@ -233,6 +235,7 @@ class Event extends BaseObject
* *
* @param array $arr Array with event data. * @param array $arr Array with event data.
* @return int The new event id. * @return int The new event id.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function store($arr) public static function store($arr)
{ {
@ -371,6 +374,7 @@ class Event extends BaseObject
* @brief Create an array with translation strings used for events. * @brief Create an array with translation strings used for events.
* *
* @return array Array with translations strings. * @return array Array with translations strings.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getStrings() public static function getStrings()
{ {
@ -546,6 +550,8 @@ class Event extends BaseObject
* *
* @param array $event_result Event query array. * @param array $event_result Event query array.
* @return array Event array for the template. * @return array Event array for the template.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function prepareListForTemplate(array $event_result) public static function prepareListForTemplate(array $event_result)
{ {
@ -629,7 +635,6 @@ class Event extends BaseObject
* *
* @param array $events Query result for events. * @param array $events Query result for events.
* @param string $format The output format (ical/csv). * @param string $format The output format (ical/csv).
* @param string $timezone The timezone of the user (not implemented yet).
* *
* @return string Content according to selected export format. * @return string Content according to selected export format.
* *
@ -741,6 +746,7 @@ class Event extends BaseObject
* @param int $uid The user ID. * @param int $uid The user ID.
* *
* @return array Query results. * @return array Query results.
* @throws \Exception
*/ */
private static function getListByUserId($uid = 0) private static function getListByUserId($uid = 0)
{ {
@ -771,14 +777,15 @@ class Event extends BaseObject
/** /**
* *
* @param int $uid The user ID. * @param int $uid The user ID.
* @param string $format Output format (ical/csv). * @param string $format Output format (ical/csv).
* @return array With the results: * @return array With the results:
* bool 'success' => True if the processing was successful,<br> * bool 'success' => True if the processing was successful,<br>
* string 'format' => The output format,<br> * string 'format' => The output format,<br>
* string 'extension' => The file extension of the output format,<br> * string 'extension' => The file extension of the output format,<br>
* string 'content' => The formatted output content.<br> * string 'content' => The formatted output content.<br>
* *
* @throws \Exception
* @todo Respect authenticated users with events_by_uid(). * @todo Respect authenticated users with events_by_uid().
*/ */
public static function exportListByUserId($uid, $format = 'ical') public static function exportListByUserId($uid, $format = 'ical')
@ -831,6 +838,8 @@ class Event extends BaseObject
* *
* @param array $item Array with item and event data. * @param array $item Array with item and event data.
* @return string HTML output. * @return string HTML output.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getItemHTML(array $item) { public static function getItemHTML(array $item) {
$same_date = false; $same_date = false;
@ -989,6 +998,7 @@ class Event extends BaseObject
* @param array $contact Contact array, expects: id, uid, url, name * @param array $contact Contact array, expects: id, uid, url, name
* @param string $birthday Birthday of the contact * @param string $birthday Birthday of the contact
* @return bool * @return bool
* @throws \Exception
*/ */
public static function createBirthday($contact, $birthday) public static function createBirthday($contact, $birthday)
{ {

View file

@ -134,16 +134,17 @@ class FileTag
return $list; return $list;
} }
/** /**
* @brief Update file tags in PConfig * @brief Update file tags in PConfig
* *
* @param int $uid Unique Identity. * @param int $uid Unique Identity.
* @param string $file_old Categories previously associated with an item * @param string $file_old Categories previously associated with an item
* @param string $file_new New list of categories for an item * @param string $file_new New list of categories for an item
* @param string $type Optional file type. * @param string $type Optional file type.
* *
* @return boolean A value indicating success or failure. * @return boolean A value indicating success or failure.
*/ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function updatePconfig($uid, $file_old, $file_new, $type = 'file') public static function updatePconfig($uid, $file_old, $file_new, $type = 'file')
{ {
if (!intval($uid)) { if (!intval($uid)) {
@ -220,15 +221,16 @@ class FileTag
return true; return true;
} }
/** /**
* @brief Add tag to file * @brief Add tag to file
* *
* @param int $uid Unique identity. * @param int $uid Unique identity.
* @param int $item_id Item identity. * @param int $item_id Item identity.
* @param string $file File tag. * @param string $file File tag.
* *
* @return boolean A value indicating success or failure. * @return boolean A value indicating success or failure.
*/ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function saveFile($uid, $item_id, $file) public static function saveFile($uid, $item_id, $file)
{ {
if (!intval($uid)) if (!intval($uid))
@ -258,16 +260,17 @@ class FileTag
return true; return true;
} }
/** /**
* @brief Remove tag from file * @brief Remove tag from file
* *
* @param int $uid Unique identity. * @param int $uid Unique identity.
* @param int $item_id Item identity. * @param int $item_id Item identity.
* @param string $file File tag. * @param string $file File tag.
* @param boolean $cat Optional value indicating the term type (i.e. Category or File) * @param boolean $cat Optional value indicating the term type (i.e. Category or File)
* *
* @return boolean A value indicating success or failure. * @return boolean A value indicating success or failure.
*/ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function unsaveFile($uid, $item_id, $file, $cat = false) public static function unsaveFile($uid, $item_id, $file, $cat = false)
{ {
if (!intval($uid)) if (!intval($uid))

View file

@ -31,6 +31,7 @@ class GContact
* @param string $mode Search mode (e.g. "community") * @param string $mode Search mode (e.g. "community")
* *
* @return array with search results * @return array with search results
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function searchByName($search, $mode = '') public static function searchByName($search, $mode = '')
{ {
@ -91,6 +92,7 @@ class GContact
* @param integer $cid Contact ID * @param integer $cid Contact ID
* @param integer $zcid Global Contact ID * @param integer $zcid Global Contact ID
* @return void * @return void
* @throws Exception
*/ */
public static function link($gcid, $uid = 0, $cid = 0, $zcid = 0) public static function link($gcid, $uid = 0, $cid = 0, $zcid = 0)
{ {
@ -105,16 +107,16 @@ class GContact
/** /**
* @brief Sanitize the given gcontact data * @brief Sanitize the given gcontact data
* *
* @param array $gcontact array with gcontact data
* @throw Exception
*
* Generation: * Generation:
* 0: No definition * 0: No definition
* 1: Profiles on this server * 1: Profiles on this server
* 2: Contacts of profiles on this server * 2: Contacts of profiles on this server
* 3: Contacts of contacts of profiles on this server * 3: Contacts of contacts of profiles on this server
* 4: ... * 4: ...
*
* @param array $gcontact array with gcontact data
* @return array $gcontact * @return array $gcontact
* @throws Exception
*/ */
public static function sanitize($gcontact) public static function sanitize($gcontact)
{ {
@ -412,6 +414,7 @@ class GContact
* @param integer $start optional, default 0 * @param integer $start optional, default 0
* @param integer $limit optional, default 80 * @param integer $limit optional, default 80
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function suggestionQuery($uid, $start = 0, $limit = 80) public static function suggestionQuery($uid, $start = 0, $limit = 80)
{ {
@ -515,6 +518,7 @@ class GContact
/** /**
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function updateSuggestions() public static function updateSuggestions()
{ {
@ -568,6 +572,7 @@ class GContact
* @param string $url Contact url * @param string $url Contact url
* *
* @return string Contact url with the wanted parts * @return string Contact url with the wanted parts
* @throws Exception
*/ */
public static function cleanContactUrl($url) public static function cleanContactUrl($url)
{ {
@ -599,6 +604,8 @@ class GContact
* *
* @param array $contact contact array (called by reference) * @param array $contact contact array (called by reference)
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function fixAlternateContactAddress(&$contact) public static function fixAlternateContactAddress(&$contact)
{ {
@ -620,6 +627,8 @@ class GContact
* @param array $contact contact array * @param array $contact contact array
* *
* @return bool|int Returns false if not found, integer if contact was found * @return bool|int Returns false if not found, integer if contact was found
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getId($contact) public static function getId($contact)
{ {
@ -715,6 +724,8 @@ class GContact
* @param array $contact contact array * @param array $contact contact array
* *
* @return bool|int Returns false if not found, integer if contact was found * @return bool|int Returns false if not found, integer if contact was found
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function update($contact) public static function update($contact)
{ {
@ -879,6 +890,8 @@ class GContact
* *
* @param string $url profile link * @param string $url profile link
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function updateFromProbe($url) public static function updateFromProbe($url)
{ {
@ -898,7 +911,9 @@ class GContact
* @brief Update the gcontact entry for a given user id * @brief Update the gcontact entry for a given user id
* *
* @param int $uid User ID * @param int $uid User ID
* @return void * @return bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function updateForUser($uid) public static function updateForUser($uid)
{ {
@ -949,7 +964,9 @@ class GContact
* If the "Statistics" addon is enabled (See http://gstools.org/ for details) we query user data with this. * If the "Statistics" addon is enabled (See http://gstools.org/ for details) we query user data with this.
* *
* @param string $server Server address * @param string $server Server address
* @return void * @return bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function fetchGsUsers($server) public static function fetchGsUsers($server)
{ {
@ -1009,6 +1026,8 @@ class GContact
/** /**
* @brief Asking GNU Social server on a regular base for their user data * @brief Asking GNU Social server on a regular base for their user data
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function discoverGsUsers() public static function discoverGsUsers()
{ {

View file

@ -22,9 +22,10 @@ class Group extends BaseObject
* *
* Note: If we found a deleted group with the same name, we restore it * Note: If we found a deleted group with the same name, we restore it
* *
* @param int $uid * @param int $uid
* @param string $name * @param string $name
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function create($uid, $name) public static function create($uid, $name)
{ {
@ -56,10 +57,11 @@ class Group extends BaseObject
/** /**
* Update group information. * Update group information.
* *
* @param int $id Group ID * @param int $id Group ID
* @param string $name Group name * @param string $name Group name
* *
* @return bool Was the update successful? * @return bool Was the update successful?
* @throws \Exception
*/ */
public static function update($id, $name) public static function update($id, $name)
{ {
@ -71,6 +73,7 @@ class Group extends BaseObject
* *
* @param int $cid * @param int $cid
* @return array * @return array
* @throws \Exception
*/ */
public static function getIdsByContactId($cid) public static function getIdsByContactId($cid)
{ {
@ -92,9 +95,10 @@ class Group extends BaseObject
* Count unread items of each groups of the local user * Count unread items of each groups of the local user
* *
* @return array * @return array
* 'id' => group id * 'id' => group id
* 'name' => group name * 'name' => group name
* 'count' => counted unseen group items * 'count' => counted unseen group items
* @throws \Exception
*/ */
public static function countUnseen() public static function countUnseen()
{ {
@ -121,9 +125,10 @@ class Group extends BaseObject
* *
* Returns false if no group has been found. * Returns false if no group has been found.
* *
* @param int $uid * @param int $uid
* @param string $name * @param string $name
* @return int|boolean * @return int|boolean
* @throws \Exception
*/ */
public static function getIdByName($uid, $name) public static function getIdByName($uid, $name)
{ {
@ -144,6 +149,7 @@ class Group extends BaseObject
* *
* @param int $gid * @param int $gid
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function remove($gid) { public static function remove($gid) {
if (! $gid) { if (! $gid) {
@ -188,13 +194,14 @@ class Group extends BaseObject
} }
/** /**
* @brief Mark a group as deleted based on its name * @brief Mark a group as deleted based on its name
* *
* @deprecated Use Group::remove instead * @deprecated Use Group::remove instead
* *
* @param int $uid * @param int $uid
* @param string $name * @param string $name
* @return bool * @return bool
* @throws \Exception
*/ */
public static function removeByName($uid, $name) { public static function removeByName($uid, $name) {
$return = false; $return = false;
@ -213,6 +220,7 @@ class Group extends BaseObject
* @param int $gid * @param int $gid
* @param int $cid * @param int $cid
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function addMember($gid, $cid) public static function addMember($gid, $cid)
{ {
@ -237,6 +245,7 @@ class Group extends BaseObject
* @param int $gid * @param int $gid
* @param int $cid * @param int $cid
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function removeMember($gid, $cid) public static function removeMember($gid, $cid)
{ {
@ -250,14 +259,15 @@ class Group extends BaseObject
} }
/** /**
* @brief Removes a contact from a group based on its name * @brief Removes a contact from a group based on its name
* *
* @deprecated Use Group::removeMember instead * @deprecated Use Group::removeMember instead
* *
* @param int $uid * @param int $uid
* @param string $name * @param string $name
* @param int $cid * @param int $cid
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function removeMemberByName($uid, $name, $cid) public static function removeMemberByName($uid, $name, $cid)
{ {
@ -271,9 +281,10 @@ class Group extends BaseObject
/** /**
* @brief Returns the combined list of contact ids from a group id list * @brief Returns the combined list of contact ids from a group id list
* *
* @param array $group_ids * @param array $group_ids
* @param boolean $check_dead * @param boolean $check_dead
* @return array * @return array
* @throws \Exception
*/ */
public static function expand($group_ids, $check_dead = false) public static function expand($group_ids, $check_dead = false)
{ {
@ -298,10 +309,11 @@ class Group extends BaseObject
/** /**
* @brief Returns a templated group selection list * @brief Returns a templated group selection list
* *
* @param int $uid * @param int $uid
* @param int $gid An optional pre-selected group * @param int $gid An optional pre-selected group
* @param string $label An optional label of the list * @param string $label An optional label of the list
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function displayGroupSelection($uid, $gid = 0, $label = '') public static function displayGroupSelection($uid, $gid = 0, $label = '')
{ {
@ -342,12 +354,13 @@ class Group extends BaseObject
* @param string $every * @param string $every
* @param string $each * @param string $each
* @param string $editmode * @param string $editmode
* 'standard' => include link 'Edit groups' * 'standard' => include link 'Edit groups'
* 'extended' => include link 'Create new group' * 'extended' => include link 'Create new group'
* 'full' => include link 'Create new group' and provide for each group a link to edit this group * 'full' => include link 'Create new group' and provide for each group a link to edit this group
* @param int $group_id * @param string $group_id
* @param int $cid * @param int $cid
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function sidebarWidget($every = 'contact', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0) public static function sidebarWidget($every = 'contact', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0)
{ {

View file

@ -263,6 +263,7 @@ class Item extends BaseObject
* @brief Fills an array with data from an item query * @brief Fills an array with data from an item query
* *
* @param object $stmt statement object * @param object $stmt statement object
* @param bool $do_close
* @return array Data array * @return array Data array
*/ */
public static function inArray($stmt, $do_close = true) { public static function inArray($stmt, $do_close = true) {
@ -286,6 +287,7 @@ class Item extends BaseObject
* @param array $condition array of fields for condition * @param array $condition array of fields for condition
* *
* @return boolean Are there rows for that condition? * @return boolean Are there rows for that condition?
* @throws \Exception
*/ */
public static function exists($condition) { public static function exists($condition) {
$stmt = self::select(['id'], $condition, ['limit' => 1]); $stmt = self::select(['id'], $condition, ['limit' => 1]);
@ -306,11 +308,12 @@ class Item extends BaseObject
* *
* @brief Retrieve a single record from a table * @brief Retrieve a single record from a table
* @param integer $uid User ID * @param integer $uid User ID
* @param array $fields * @param array $selected
* @param array $condition * @param array $condition
* @param array $params * @param array $params
* @return bool|array * @return bool|array
* @see DBA::select * @throws \Exception
* @see DBA::select
*/ */
public static function selectFirstForUser($uid, array $selected = [], array $condition = [], $params = []) public static function selectFirstForUser($uid, array $selected = [], array $condition = [], $params = [])
{ {
@ -326,12 +329,13 @@ class Item extends BaseObject
/** /**
* @brief Select rows from the item table for a given user * @brief Select rows from the item table for a given user
* *
* @param integer $uid User ID * @param integer $uid User ID
* @param array $selected Array of selected fields, empty for all * @param array $selected Array of selected fields, empty for all
* @param array $condition Array of fields for condition * @param array $condition Array of fields for condition
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|object * @return boolean|object
* @throws \Exception
*/ */
public static function selectForUser($uid, array $selected = [], array $condition = [], $params = []) public static function selectForUser($uid, array $selected = [], array $condition = [], $params = [])
{ {
@ -348,11 +352,12 @@ class Item extends BaseObject
* Retrieve a single record from the item table and returns it in an associative array * Retrieve a single record from the item table and returns it in an associative array
* *
* @brief Retrieve a single record from a table * @brief Retrieve a single record from a table
* @param array $fields * @param array $fields
* @param array $condition * @param array $condition
* @param array $params * @param array $params
* @return bool|array * @return bool|array
* @see DBA::select * @throws \Exception
* @see DBA::select
*/ */
public static function selectFirst(array $fields = [], array $condition = [], $params = []) public static function selectFirst(array $fields = [], array $condition = [], $params = [])
{ {
@ -372,11 +377,12 @@ class Item extends BaseObject
/** /**
* @brief Select rows from the item table * @brief Select rows from the item table
* *
* @param array $selected Array of selected fields, empty for all * @param array $selected Array of selected fields, empty for all
* @param array $condition Array of fields for condition * @param array $condition Array of fields for condition
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|object * @return boolean|object
* @throws \Exception
*/ */
public static function select(array $selected = [], array $condition = [], $params = []) public static function select(array $selected = [], array $condition = [], $params = [])
{ {
@ -412,12 +418,13 @@ class Item extends BaseObject
/** /**
* @brief Select rows from the starting post in the item table * @brief Select rows from the starting post in the item table
* *
* @param integer $uid User ID * @param integer $uid User ID
* @param array $fields Array of selected fields, empty for all * @param array $selected
* @param array $condition Array of fields for condition * @param array $condition Array of fields for condition
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|object * @return boolean|object
* @throws \Exception
*/ */
public static function selectThreadForUser($uid, array $selected = [], array $condition = [], $params = []) public static function selectThreadForUser($uid, array $selected = [], array $condition = [], $params = [])
{ {
@ -435,11 +442,12 @@ class Item extends BaseObject
* *
* @brief Retrieve a single record from a table * @brief Retrieve a single record from a table
* @param integer $uid User ID * @param integer $uid User ID
* @param array $selected * @param array $selected
* @param array $condition * @param array $condition
* @param array $params * @param array $params
* @return bool|array * @return bool|array
* @see DBA::select * @throws \Exception
* @see DBA::select
*/ */
public static function selectFirstThreadForUser($uid, array $selected = [], array $condition = [], $params = []) public static function selectFirstThreadForUser($uid, array $selected = [], array $condition = [], $params = [])
{ {
@ -456,11 +464,12 @@ class Item extends BaseObject
* Retrieve a single record from the starting post in the item table and returns it in an associative array * Retrieve a single record from the starting post in the item table and returns it in an associative array
* *
* @brief Retrieve a single record from a table * @brief Retrieve a single record from a table
* @param array $fields * @param array $fields
* @param array $condition * @param array $condition
* @param array $params * @param array $params
* @return bool|array * @return bool|array
* @see DBA::select * @throws \Exception
* @see DBA::select
*/ */
public static function selectFirstThread(array $fields = [], array $condition = [], $params = []) public static function selectFirstThread(array $fields = [], array $condition = [], $params = [])
{ {
@ -479,11 +488,12 @@ class Item extends BaseObject
/** /**
* @brief Select rows from the starting post in the item table * @brief Select rows from the starting post in the item table
* *
* @param array $selected Array of selected fields, empty for all * @param array $selected Array of selected fields, empty for all
* @param array $condition Array of fields for condition * @param array $condition Array of fields for condition
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|object * @return boolean|object
* @throws \Exception
*/ */
public static function selectThread(array $selected = [], array $condition = [], $params = []) public static function selectThread(array $selected = [], array $condition = [], $params = [])
{ {
@ -529,6 +539,7 @@ class Item extends BaseObject
/** /**
* @brief Returns a list of fields that are associated with the item table * @brief Returns a list of fields that are associated with the item table
* *
* @param $usermode
* @return array field list * @return array field list
*/ */
private static function fieldlist($usermode) private static function fieldlist($usermode)
@ -611,10 +622,11 @@ class Item extends BaseObject
/** /**
* @brief Returns all needed "JOIN" commands for the "select" functions * @brief Returns all needed "JOIN" commands for the "select" functions
* *
* @param integer $uid User ID * @param integer $uid User ID
* @param string $sql_commands The parts of the built SQL commands in the "select" functions * @param string $sql_commands The parts of the built SQL commands in the "select" functions
* @param boolean $thread_mode Called for the items (false) or for the threads (true) * @param boolean $thread_mode Called for the items (false) or for the threads (true)
* *
* @param $user_mode
* @return string The SQL joins for the "select" functions * @return string The SQL joins for the "select" functions
*/ */
private static function constructJoins($uid, $sql_commands, $thread_mode, $user_mode) private static function constructJoins($uid, $sql_commands, $thread_mode, $user_mode)
@ -777,7 +789,7 @@ class Item extends BaseObject
/** /**
* @brief Update existing item entries * @brief Update existing item entries
* *
* @param array $fields The fields that are to be changed * @param array $fields The fields that are to be changed
* @param array $condition The condition for finding the item entries * @param array $condition The condition for finding the item entries
* *
* In the future we may have to change permissions as well. * In the future we may have to change permissions as well.
@ -786,6 +798,7 @@ class Item extends BaseObject
* A return value of "0" doesn't mean an error - but that 0 rows had been changed. * A return value of "0" doesn't mean an error - but that 0 rows had been changed.
* *
* @return integer|boolean number of affected rows - or "false" if there was an error * @return integer|boolean number of affected rows - or "false" if there was an error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function update(array $fields, array $condition) public static function update(array $fields, array $condition)
{ {
@ -932,8 +945,9 @@ class Item extends BaseObject
/** /**
* @brief Delete an item and notify others about it - if it was ours * @brief Delete an item and notify others about it - if it was ours
* *
* @param array $condition The condition for finding the item entries * @param array $condition The condition for finding the item entries
* @param integer $priority Priority for the notification * @param integer $priority Priority for the notification
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function delete($condition, $priority = PRIORITY_HIGH) public static function delete($condition, $priority = PRIORITY_HIGH)
{ {
@ -947,8 +961,9 @@ class Item extends BaseObject
/** /**
* @brief Delete an item for an user and notify others about it - if it was ours * @brief Delete an item for an user and notify others about it - if it was ours
* *
* @param array $condition The condition for finding the item entries * @param array $condition The condition for finding the item entries
* @param integer $uid User who wants to delete this item * @param integer $uid User who wants to delete this item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function deleteForUser($condition, $uid) public static function deleteForUser($condition, $uid)
{ {
@ -973,10 +988,11 @@ class Item extends BaseObject
/** /**
* @brief Delete an item and notify others about it - if it was ours * @brief Delete an item and notify others about it - if it was ours
* *
* @param integer $item_id Item ID that should be delete * @param integer $item_id Item ID that should be delete
* @param integer $priority Priority for the notification * @param integer $priority Priority for the notification
* *
* @return boolean success * @return boolean success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function deleteById($item_id, $priority = PRIORITY_HIGH) public static function deleteById($item_id, $priority = PRIORITY_HIGH)
{ {
@ -1850,6 +1866,7 @@ class Item extends BaseObject
* *
* @param array $item The item fields that are to be inserted * @param array $item The item fields that are to be inserted
* @return bool * @return bool
* @throws \Exception
*/ */
private static function insertActivity(&$item) private static function insertActivity(&$item)
{ {
@ -1896,6 +1913,7 @@ class Item extends BaseObject
* @brief Insert a new item content entry * @brief Insert a new item content entry
* *
* @param array $item The item fields that are to be inserted * @param array $item The item fields that are to be inserted
* @throws \Exception
*/ */
private static function insertContent(&$item) private static function insertContent(&$item)
{ {
@ -1934,8 +1952,10 @@ class Item extends BaseObject
/** /**
* @brief Update existing item content entries * @brief Update existing item content entries
* *
* @param array $item The item fields that are to be changed * @param array $item The item fields that are to be changed
* @param array $condition The condition for finding the item content entries * @param array $condition The condition for finding the item content entries
* @return bool
* @throws \Exception
*/ */
private static function updateActivity($item, $condition) private static function updateActivity($item, $condition)
{ {
@ -1960,8 +1980,9 @@ class Item extends BaseObject
/** /**
* @brief Update existing item content entries * @brief Update existing item content entries
* *
* @param array $item The item fields that are to be changed * @param array $item The item fields that are to be changed
* @param array $condition The condition for finding the item content entries * @param array $condition The condition for finding the item content entries
* @throws \Exception
*/ */
private static function updateContent($item, $condition) private static function updateContent($item, $condition)
{ {
@ -1989,6 +2010,7 @@ class Item extends BaseObject
* *
* @param integer $itemid Item ID that should be added * @param integer $itemid Item ID that should be added
* @param string $signed_text Original text (for Diaspora signatures), JSON encoded. * @param string $signed_text Original text (for Diaspora signatures), JSON encoded.
* @throws \Exception
*/ */
public static function distribute($itemid, $signed_text = '') public static function distribute($itemid, $signed_text = '')
{ {
@ -2085,6 +2107,7 @@ class Item extends BaseObject
* @param integer $itemid Item ID that should be added * @param integer $itemid Item ID that should be added
* @param array $item The item entry that will be stored * @param array $item The item entry that will be stored
* @param integer $uid The user that will receive the item entry * @param integer $uid The user that will receive the item entry
* @throws \Exception
*/ */
private static function storeForUser($itemid, $item, $uid) private static function storeForUser($itemid, $item, $uid)
{ {
@ -2132,6 +2155,7 @@ class Item extends BaseObject
* It is planned that in the future we will store public item entries only once. * It is planned that in the future we will store public item entries only once.
* *
* @param integer $itemid Item ID that should be added * @param integer $itemid Item ID that should be added
* @throws \Exception
*/ */
public static function addShadow($itemid) public static function addShadow($itemid)
{ {
@ -2193,6 +2217,7 @@ class Item extends BaseObject
* This function does the same like the function above - but for comments * This function does the same like the function above - but for comments
* *
* @param integer $itemid Item ID that should be added * @param integer $itemid Item ID that should be added
* @throws \Exception
*/ */
public static function addShadowPost($itemid) public static function addShadowPost($itemid)
{ {
@ -2249,9 +2274,12 @@ class Item extends BaseObject
} }
} }
/** /**
* Adds a language specification in a "language" element of given $arr. * Adds a language specification in a "language" element of given $arr.
* Expects "body" element to exist in $arr. * Expects "body" element to exist in $arr.
*
* @param $item
* @throws \Text_LanguageDetect_Exception
*/ */
private static function addLanguageToItemArray(&$item) private static function addLanguageToItemArray(&$item)
{ {
@ -2297,10 +2325,11 @@ class Item extends BaseObject
/** /**
* generate an unique URI * generate an unique URI
* *
* @param integer $uid User id * @param integer $uid User id
* @param string $guid An existing GUID (Otherwise it will be generated) * @param string $guid An existing GUID (Otherwise it will be generated)
* *
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function newURI($uid, $guid = "") public static function newURI($uid, $guid = "")
{ {
@ -2319,6 +2348,7 @@ class Item extends BaseObject
* Don't set this value if it isn't from the owner (could be an author that we don't know) * Don't set this value if it isn't from the owner (could be an author that we don't know)
* *
* @param array $arr Contains the just posted item record * @param array $arr Contains the just posted item record
* @throws \Exception
*/ */
private static function updateContact($arr) private static function updateContact($arr)
{ {
@ -2439,9 +2469,11 @@ class Item extends BaseObject
/** /**
* This function is only used for the old Friendica app on Android that doesn't like paths with guid * This function is only used for the old Friendica app on Android that doesn't like paths with guid
*
* @param string $guid item guid * @param string $guid item guid
* @param int $uid user id * @param int $uid user id
* @return array with id and nick of the item with the given guid * @return array with id and nick of the item with the given guid
* @throws \Exception
*/ */
public static function getIdAndNickByGuid($guid, $uid = 0) public static function getIdAndNickByGuid($guid, $uid = 0)
{ {
@ -2483,9 +2515,12 @@ class Item extends BaseObject
/** /**
* look for mention tags and setup a second delivery chain for forum/community posts if appropriate * look for mention tags and setup a second delivery chain for forum/community posts if appropriate
*
* @param int $uid * @param int $uid
* @param int $item_id * @param int $item_id
* @return bool true if item was deleted, else false * @return void true if item was deleted, else false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function tagDeliver($uid, $item_id) private static function tagDeliver($uid, $item_id)
{ {
@ -2671,6 +2706,8 @@ class Item extends BaseObject
* @param array $item * @param array $item
* @param int $cid * @param int $cid
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function fixPrivatePhotos($s, $uid, $item = null, $cid = 0) public static function fixPrivatePhotos($s, $uid, $item = null, $cid = 0)
{ {
@ -2928,12 +2965,15 @@ class Item extends BaseObject
* *
* @param string $item_id * @param string $item_id
* @param string $verb * @param string $verb
* Activity verb. One of * Activity verb. One of
* like, unlike, dislike, undislike, attendyes, unattendyes, * like, unlike, dislike, undislike, attendyes, unattendyes,
* attendno, unattendno, attendmaybe, unattendmaybe * attendno, unattendno, attendmaybe, unattendmaybe
* @hook 'post_local_end' * @return bool
* array $arr * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* 'post_id' => ID of posted item * @throws \ImagickException
* @hook 'post_local_end'
* array $arr
* 'post_id' => ID of posted item
*/ */
public static function performLike($item_id, $verb) public static function performLike($item_id, $verb)
{ {
@ -3212,7 +3252,7 @@ class Item extends BaseObject
/** /**
* get translated item type * get translated item type
* *
* @param array $itme * @param $item
* @return string * @return string
*/ */
public static function postType($item) public static function postType($item)
@ -3238,6 +3278,7 @@ class Item extends BaseObject
* @param array $item * @param array $item
* @param bool $update * @param bool $update
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Remove reference, simply return "rendered-html" and "rendered-hash" * @todo Remove reference, simply return "rendered-html" and "rendered-hash"
*/ */
public static function putInCache(&$item, $update = false) public static function putInCache(&$item, $update = false)
@ -3296,10 +3337,12 @@ class Item extends BaseObject
* @param boolean $attach * @param boolean $attach
* @param boolean $is_preview * @param boolean $is_preview
* @return string item body html * @return string item body html
* @hook prepare_body_init item array before any work * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html * @throws \ImagickException
* @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html * @hook prepare_body_init item array before any work
* @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) * @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html
* @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html
* @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author)
*/ */
public static function prepareBody(array &$item, $attach = false, $is_preview = false) public static function prepareBody(array &$item, $attach = false, $is_preview = false)
{ {
@ -3467,8 +3510,10 @@ class Item extends BaseObject
/** /**
* get private link for item * get private link for item
*
* @param array $item * @param array $item
* @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title) * @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title)
* @throws \Exception
*/ */
public static function getPlink($item) public static function getPlink($item)
{ {

View file

@ -22,9 +22,10 @@ class ItemContent extends BaseObject
* @param int $htmlmode This controls the behavior of the BBCode conversion * @param int $htmlmode This controls the behavior of the BBCode conversion
* @param string $target_network Name of the network where the post should go to. * @param string $target_network Name of the network where the post should go to.
* *
* @see \Friendica\Content\Text\BBCode::getAttachedData
*
* @return array Same array structure than \Friendica\Content\Text\BBCode::getAttachedData * @return array Same array structure than \Friendica\Content\Text\BBCode::getAttachedData
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @see \Friendica\Content\Text\BBCode::getAttachedData
*
*/ */
public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = '') public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = '')
{ {

View file

@ -53,6 +53,7 @@ class ItemDeliveryData
* *
* @param integer $item_id * @param integer $item_id
* @return bool * @return bool
* @throws \Exception
*/ */
public static function incrementQueueDone($item_id) public static function incrementQueueDone($item_id)
{ {
@ -65,6 +66,7 @@ class ItemDeliveryData
* @param integer $item_id * @param integer $item_id
* @param array $fields * @param array $fields
* @return bool * @return bool
* @throws \Exception
*/ */
public static function insert($item_id, array $fields) public static function insert($item_id, array $fields)
{ {
@ -85,6 +87,7 @@ class ItemDeliveryData
* @param integer $item_id * @param integer $item_id
* @param array $fields * @param array $fields
* @return bool * @return bool
* @throws \Exception
*/ */
public static function update($item_id, array $fields) public static function update($item_id, array $fields)
{ {
@ -105,6 +108,7 @@ class ItemDeliveryData
* *
* @param integer $item_id * @param integer $item_id
* @return bool * @return bool
* @throws \Exception
*/ */
public static function delete($item_id) public static function delete($item_id)
{ {

View file

@ -17,6 +17,7 @@ class ItemURI extends BaseObject
* @param array $fields Item-uri fields * @param array $fields Item-uri fields
* *
* @return integer item-uri id * @return integer item-uri id
* @throws \Exception
*/ */
public static function insert($fields) public static function insert($fields)
{ {
@ -43,6 +44,7 @@ class ItemURI extends BaseObject
* @param string $uri * @param string $uri
* *
* @return integer item-uri id * @return integer item-uri id
* @throws \Exception
*/ */
public static function getIdByURI($uri) public static function getIdByURI($uri)
{ {

View file

@ -26,6 +26,8 @@ class Mail
* @param string $body message body, default empty * @param string $body message body, default empty
* @param string $subject message subject, default empty * @param string $subject message subject, default empty
* @param string $replyto reply to * @param string $replyto reply to
* @return int
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function send($recipient = 0, $body = '', $subject = '', $replyto = '') public static function send($recipient = 0, $body = '', $subject = '', $replyto = '')
{ {
@ -160,6 +162,9 @@ class Mail
* @param string $body message body, default empty * @param string $body message body, default empty
* @param string $subject message subject, default empty * @param string $subject message subject, default empty
* @param string $replyto reply to, default empty * @param string $replyto reply to, default empty
* @return int
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function sendWall($recipient = '', $body = '', $subject = '', $replyto = '') public static function sendWall($recipient = '', $body = '', $subject = '', $replyto = '')
{ {

View file

@ -16,12 +16,13 @@ class OpenWebAuthToken
/** /**
* Create an entry in the 'openwebauth-token' table. * Create an entry in the 'openwebauth-token' table.
* *
* @param string $type Verify type. * @param string $type Verify type.
* @param int $uid The user ID. * @param int $uid The user ID.
* @param string $token * @param string $token
* @param string $meta * @param string $meta
* *
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function create($type, $uid, $token, $meta) public static function create($type, $uid, $token, $meta)
{ {
@ -38,11 +39,12 @@ class OpenWebAuthToken
/** /**
* Get the "meta" field of an entry in the openwebauth-token table. * Get the "meta" field of an entry in the openwebauth-token table.
* *
* @param string $type Verify type. * @param string $type Verify type.
* @param int $uid The user ID. * @param int $uid The user ID.
* @param string $token * @param string $token
* *
* @return string|boolean The meta enry or false if not found. * @return string|boolean The meta enry or false if not found.
* @throws \Exception
*/ */
public static function getMeta($type, $uid, $token) public static function getMeta($type, $uid, $token)
{ {
@ -62,6 +64,7 @@ class OpenWebAuthToken
* *
* @param string $type Verify type. * @param string $type Verify type.
* @param string $interval SQL compatible time interval * @param string $interval SQL compatible time interval
* @throws \Exception
*/ */
public static function purge($type, $interval) public static function purge($type, $interval)
{ {

View file

@ -16,7 +16,8 @@ class PermissionSet extends BaseObject
* Fetch the id of a given permission set. Generate a new one when needed * Fetch the id of a given permission set. Generate a new one when needed
* *
* @param array $postarray The array from an item, picture or event post * @param array $postarray The array from an item, picture or event post
* @return id * @return int id
* @throws \Exception
*/ */
public static function fetchIDForPost(&$postarray) public static function fetchIDForPost(&$postarray)
{ {
@ -69,6 +70,7 @@ class PermissionSet extends BaseObject
* @param array $groups Possibly previously fetched group ids for that contact * @param array $groups Possibly previously fetched group ids for that contact
* *
* @return array of permission set ids. * @return array of permission set ids.
* @throws \Exception
*/ */
static public function get($uid, $contact_id, $groups = null) static public function get($uid, $contact_id, $groups = null)

View file

@ -29,13 +29,14 @@ class Photo extends BaseObject
/** /**
* @brief Select rows from the photo table * @brief Select rows from the photo table
* *
* @param array $fields Array of selected fields, empty for all * @param array $fields Array of selected fields, empty for all
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return boolean|array * @return boolean|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function select(array $fields = [], array $conditions = [], array $params = []) public static function select(array $fields = [], array $conditions = [], array $params = [])
{ {
@ -50,13 +51,14 @@ class Photo extends BaseObject
/** /**
* @brief Retrieve a single record from the photo table * @brief Retrieve a single record from the photo table
* *
* @param array $fields Array of selected fields, empty for all * @param array $fields Array of selected fields, empty for all
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function selectFirst(array $fields = [], array $conditions = [], array $params = []) public static function selectFirst(array $fields = [], array $conditions = [], array $params = [])
{ {
@ -70,14 +72,15 @@ class Photo extends BaseObject
/** /**
* @brief Get photos for user id * @brief Get photos for user id
* *
* @param integer $uid User id * @param integer $uid User id
* @param string $resourceid Rescource ID of the photo * @param string $resourceid Rescource ID of the photo
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function getPhotosForUser($uid, $resourceid, array $conditions = [], array $params = []) public static function getPhotosForUser($uid, $resourceid, array $conditions = [], array $params = [])
{ {
@ -90,15 +93,16 @@ class Photo extends BaseObject
/** /**
* @brief Get a photo for user id * @brief Get a photo for user id
* *
* @param integer $uid User id * @param integer $uid User id
* @param string $resourceid Rescource ID of the photo * @param string $resourceid Rescource ID of the photo
* @param integer $scale Scale of the photo. Defaults to 0 * @param integer $scale Scale of the photo. Defaults to 0
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters * @param array $params Array of several parameters
* *
* @return bool|array * @return bool|array
* *
* @see \Friendica\Database\DBA::select * @throws \Exception
* @see \Friendica\Database\DBA::select
*/ */
public static function getPhotoForUser($uid, $resourceid, $scale = 0, array $conditions = [], array $params = []) public static function getPhotoForUser($uid, $resourceid, $scale = 0, array $conditions = [], array $params = [])
{ {
@ -116,10 +120,11 @@ class Photo extends BaseObject
* on success, "no sign" image info, if user has no permission, * on success, "no sign" image info, if user has no permission,
* false if photo does not exists * false if photo does not exists
* *
* @param string $resourceid Rescource ID of the photo * @param string $resourceid Rescource ID of the photo
* @param integer $scale Scale of the photo. Defaults to 0 * @param integer $scale Scale of the photo. Defaults to 0
* *
* @return boolean|array * @return boolean|array
* @throws \Exception
*/ */
public static function getPhoto($resourceid, $scale = 0) public static function getPhoto($resourceid, $scale = 0)
{ {
@ -145,9 +150,10 @@ class Photo extends BaseObject
/** /**
* @brief Check if photo with given conditions exists * @brief Check if photo with given conditions exists
* *
* @param array $conditions Array of extra conditions * @param array $conditions Array of extra conditions
* *
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function exists(array $conditions) public static function exists(array $conditions)
{ {
@ -158,9 +164,11 @@ class Photo extends BaseObject
/** /**
* @brief Get Image object for given row id. null if row id does not exist * @brief Get Image object for given row id. null if row id does not exist
* *
* @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref' * @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref'
* *
* @return \Friendica\Object\Image * @return \Friendica\Object\Image
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function getImageForPhoto(array $photo) public static function getImageForPhoto(array $photo)
{ {
@ -188,6 +196,7 @@ class Photo extends BaseObject
* @brief Return a list of fields that are associated with the photo table * @brief Return a list of fields that are associated with the photo table
* *
* @return array field list * @return array field list
* @throws \Exception
*/ */
private static function getFields() private static function getFields()
{ {
@ -200,10 +209,11 @@ class Photo extends BaseObject
/** /**
* @brief Construct a photo array for a system resource image * @brief Construct a photo array for a system resource image
* *
* @param string $filename Image file name relative to code root * @param string $filename Image file name relative to code root
* @param string $mimetype Image mime type. Defaults to "image/jpeg" * @param string $mimetype Image mime type. Defaults to "image/jpeg"
* *
* @return array * @return array
* @throws \Exception
*/ */
public static function createPhotoForSystemResource($filename, $mimetype = "image/jpeg") public static function createPhotoForSystemResource($filename, $mimetype = "image/jpeg")
{ {
@ -236,6 +246,7 @@ class Photo extends BaseObject
* @param string $desc Photo caption. optional, default = "" * @param string $desc Photo caption. optional, default = ""
* *
* @return boolean True on success * @return boolean True on success
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = "", $allow_gid = "", $deny_cid = "", $deny_gid = "", $desc = "") public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = "", $allow_gid = "", $deny_cid = "", $deny_gid = "", $desc = "")
{ {
@ -310,12 +321,13 @@ class Photo extends BaseObject
/** /**
* @brief Delete info from table and data from storage * @brief Delete info from table and data from storage
* *
* @param array $conditions Field condition(s) * @param array $conditions Field condition(s)
* @param array $options Options array, Optional * @param array $options Options array, Optional
* *
* @return boolean * @return boolean
* *
* @see \Friendica\Database\DBA::delete * @throws \Exception
* @see \Friendica\Database\DBA::delete
*/ */
public static function delete(array $conditions, array $options = []) public static function delete(array $conditions, array $options = [])
{ {
@ -342,7 +354,8 @@ class Photo extends BaseObject
* *
* @return boolean Was the update successfull? * @return boolean Was the update successfull?
* *
* @see \Friendica\Database\DBA::update * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @see \Friendica\Database\DBA::update
*/ */
public static function update($fields, $conditions, Image $img = null, array $old_fields = []) public static function update($fields, $conditions, Image $img = null, array $old_fields = [])
{ {
@ -372,6 +385,8 @@ class Photo extends BaseObject
* @param integer $cid contact id * @param integer $cid contact id
* @param boolean $quit_on_error optional, default false * @param boolean $quit_on_error optional, default false
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function importProfilePhoto($image_url, $uid, $cid, $quit_on_error = false) public static function importProfilePhoto($image_url, $uid, $cid, $quit_on_error = false)
{ {
@ -508,6 +523,7 @@ class Photo extends BaseObject
* @param bool $update Update the cache * @param bool $update Update the cache
* *
* @return array Returns array of the photo albums * @return array Returns array of the photo albums
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getAlbums($uid, $update = false) public static function getAlbums($uid, $update = false)
{ {
@ -545,6 +561,7 @@ class Photo extends BaseObject
/** /**
* @param int $uid User id of the photos * @param int $uid User id of the photos
* @return void * @return void
* @throws \Exception
*/ */
public static function clearAlbumCache($uid) public static function clearAlbumCache($uid)
{ {
@ -556,6 +573,7 @@ class Photo extends BaseObject
* Generate a unique photo ID. * Generate a unique photo ID.
* *
* @return string * @return string
* @throws \Exception
*/ */
public static function newResource() public static function newResource()
{ {

View file

@ -19,6 +19,7 @@ class Process extends BaseObject
* @param string $command * @param string $command
* @param string $pid * @param string $pid
* @return bool * @return bool
* @throws \Exception
*/ */
public static function insert($command, $pid = null) public static function insert($command, $pid = null)
{ {
@ -44,6 +45,7 @@ class Process extends BaseObject
* *
* @param string $pid * @param string $pid
* @return bool * @return bool
* @throws \Exception
*/ */
public static function deleteByPid($pid = null) public static function deleteByPid($pid = null)
{ {

View file

@ -36,6 +36,7 @@ class Profile
* @param integer User ID * @param integer User ID
* *
* @return array Profile data * @return array Profile data
* @throws \Exception
*/ */
public static function getByUID($uid) public static function getByUID($uid)
{ {
@ -102,6 +103,8 @@ class Profile
* @param int $profile int * @param int $profile int
* @param array $profiledata array * @param array $profiledata array
* @param boolean $show_connect Show connect link * @param boolean $show_connect Show connect link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true) public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true)
{ {
@ -206,10 +209,11 @@ class Profile
* Includes all available profile data * Includes all available profile data
* *
* @brief Get all profile data of a local user * @brief Get all profile data of a local user
* @param string $nickname nick * @param string $nickname nick
* @param int $uid uid * @param int $uid uid
* @param int $profile_id ID of the profile * @param int $profile_id ID of the profile
* @return array * @return array
* @throws \Exception
*/ */
public static function getByNickname($nickname, $uid = 0, $profile_id = 0) public static function getByNickname($nickname, $uid = 0, $profile_id = 0)
{ {
@ -265,13 +269,15 @@ class Profile
* because of all the conditional logic. * because of all the conditional logic.
* *
* @brief Formats a profile for display in the sidebar. * @brief Formats a profile for display in the sidebar.
* @param array $profile * @param array $profile
* @param int $block * @param int $block
* @param boolean $show_connect Show connect link * @param boolean $show_connect Show connect link
* *
* @return string HTML sidebar module * @return string HTML sidebar module
* *
* @note Returns empty string if passed $profile is wrong type or not populated * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @note Returns empty string if passed $profile is wrong type or not populated
* *
* @hooks 'profile_sidebar_enter' * @hooks 'profile_sidebar_enter'
* array $profile - profile data * array $profile - profile data
@ -1022,6 +1028,8 @@ class Profile
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/channel.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/channel.php
* *
* @param App $a Application instance. * @param App $a Application instance.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function zrlInit(App $a) public static function zrlInit(App $a)
{ {
@ -1091,6 +1099,8 @@ class Profile
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/zid.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/zid.php
* *
* @param string $token * @param string $token
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function openWebAuthInit($token) public static function openWebAuthInit($token)
{ {
@ -1184,6 +1194,7 @@ class Profile
* @brief Get the user ID of the page owner * @brief Get the user ID of the page owner
* @return int user ID * @return int user ID
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @note Returns local_user instead of user ID if "always_my_theme" is set to true * @note Returns local_user instead of user ID if "always_my_theme" is set to true
*/ */
public static function getThemeUid(App $a) public static function getThemeUid(App $a)
@ -1208,11 +1219,12 @@ class Profile
} }
/** /**
* Stip query parameter from a string. * Strip query parameter from a string.
* *
* @param string $s The input string. * @param string $s The input string.
* @return string The query parameter. * @param $param
*/ * @return string The query parameter.
*/
public static function stripQueryParam($s, $param) public static function stripQueryParam($s, $param)
{ {
return preg_replace('/[\?&]' . $param . '=(.*?)(&|$)/ism', '$2', $s); return preg_replace('/[\?&]' . $param . '=(.*?)(&|$)/ism', '$2', $s);

View file

@ -14,8 +14,9 @@ class PushSubscriber
/** /**
* @brief Send subscription notifications for the given user * @brief Send subscription notifications for the given user
* *
* @param integer $uid User ID * @param integer $uid User ID
* @param string $priority Priority for push workers * @param int $default_priority
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function publishFeed($uid, $default_priority = PRIORITY_HIGH) public static function publishFeed($uid, $default_priority = PRIORITY_HIGH)
{ {
@ -28,7 +29,8 @@ class PushSubscriber
/** /**
* @brief start workers to transmit the feed data * @brief start workers to transmit the feed data
* *
* @param string $priority Priority for push workers * @param int $default_priority
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function requeue($default_priority = PRIORITY_HIGH) public static function requeue($default_priority = PRIORITY_HIGH)
{ {
@ -60,6 +62,7 @@ class PushSubscriber
* @param string $hub_callback Callback address * @param string $hub_callback Callback address
* @param string $hub_topic Feed topic * @param string $hub_topic Feed topic
* @param string $hub_secret Subscription secret * @param string $hub_secret Subscription secret
* @throws \Exception
*/ */
public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret) public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret)
{ {
@ -98,6 +101,7 @@ class PushSubscriber
* @brief Delay the push subscriber * @brief Delay the push subscriber
* *
* @param integer $id Subscriber ID * @param integer $id Subscriber ID
* @throws \Exception
*/ */
public static function delay($id) public static function delay($id)
{ {
@ -135,7 +139,8 @@ class PushSubscriber
* @brief Reset the push subscriber * @brief Reset the push subscriber
* *
* @param integer $id Subscriber ID * @param integer $id Subscriber ID
* @param date $last_update Date of last transmitted item * @param string $last_update Date of last transmitted item
* @throws \Exception
*/ */
public static function reset($id, $last_update) public static function reset($id, $last_update)
{ {

View file

@ -13,6 +13,7 @@ class Queue
{ {
/** /**
* @param string $id id * @param string $id id
* @throws \Exception
*/ */
public static function updateTime($id) public static function updateTime($id)
{ {
@ -37,6 +38,7 @@ class Queue
/** /**
* @param string $id id * @param string $id id
* @throws \Exception
*/ */
public static function removeItem($id) public static function removeItem($id)
{ {
@ -78,6 +80,8 @@ class Queue
* @param string $network network * @param string $network network
* @param string $msg message * @param string $msg message
* @param boolean $batch batch, default false * @param boolean $batch batch, default false
* @param string $guid
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function add($cid, $network, $msg, $batch = false, $guid = '') public static function add($cid, $network, $msg, $batch = false, $guid = '')
{ {

View file

@ -20,6 +20,7 @@ class Register
* Return the list of pending registrations * Return the list of pending registrations
* *
* @return array * @return array
* @throws \Exception
*/ */
public static function getPending() public static function getPending()
{ {
@ -37,6 +38,7 @@ class Register
* Returns the pending registration count * Returns the pending registration count
* *
* @return int * @return int
* @throws \Exception
*/ */
public static function getPendingCount() public static function getPendingCount()
{ {
@ -54,6 +56,7 @@ class Register
* *
* @param string $hash * @param string $hash
* @return array * @return array
* @throws \Exception
*/ */
public static function getByHash($hash) public static function getByHash($hash)
{ {
@ -63,8 +66,9 @@ class Register
/** /**
* Returns true if a register record exists with the provided hash * Returns true if a register record exists with the provided hash
* *
* @param string $hash * @param string $hash
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function existsByHash($hash) public static function existsByHash($hash)
{ {
@ -75,6 +79,7 @@ class Register
* Creates a register record for an invitation and returns the auto-generated code for it * Creates a register record for an invitation and returns the auto-generated code for it
* *
* @return string * @return string
* @throws \Exception
*/ */
public static function createForInvitation() public static function createForInvitation()
{ {
@ -98,6 +103,7 @@ class Register
* @param string $language The registration language * @param string $language The registration language
* @param string $note An additional message from the user * @param string $note An additional message from the user
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function createForApproval($uid, $language, $note = '') public static function createForApproval($uid, $language, $note = '')
{ {
@ -122,8 +128,9 @@ class Register
/** /**
* Deletes a register record by the provided hash and returns the success of the database deletion * Deletes a register record by the provided hash and returns the success of the database deletion
* *
* @param string $hash * @param string $hash
* @return boolean * @return boolean
* @throws \Exception
*/ */
public static function deleteByHash($hash) public static function deleteByHash($hash)
{ {

View file

@ -49,7 +49,8 @@ class Filesystem implements IStorage
/** /**
* @brief Create dirctory tree to store file, with .htaccess and index.html files * @brief Create dirctory tree to store file, with .htaccess and index.html files
* @param string $file Path and filename * @param string $file Path and filename
* @throws StorageException
*/ */
private static function createFoldersForFile($file) private static function createFoldersForFile($file)
{ {

View file

@ -192,7 +192,9 @@ class Term
/** /**
* @param integer $itemid item id * @param integer $itemid item id
* @param $files
* @return void * @return void
* @throws \Exception
*/ */
public static function insertFromFileFieldByItemId($itemid, $files) public static function insertFromFileFieldByItemId($itemid, $files)
{ {
@ -241,6 +243,8 @@ class Term
* *
* @param array $item * @param array $item
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function populateTagsFromItem(&$item) public static function populateTagsFromItem(&$item)
{ {
@ -291,8 +295,10 @@ class Term
/** /**
* Delete all tags from an item * Delete all tags from an item
*
* @param int itemid - choose from which item the tags will be removed * @param int itemid - choose from which item the tags will be removed
* @param array type - items type. default is [TERM_HASHTAG, TERM_MENTION] * @param array $type
* @throws \Exception
*/ */
public static function deleteByItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION]) public static function deleteByItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION])
{ {

View file

@ -34,6 +34,7 @@ class User
* *
* @param integer $uid * @param integer $uid
* @return boolean * @return boolean
* @throws Exception
*/ */
public static function exists($uid) public static function exists($uid)
{ {
@ -43,6 +44,7 @@ class User
/** /**
* @param integer $uid * @param integer $uid
* @return array|boolean User record if it exists, false otherwise * @return array|boolean User record if it exists, false otherwise
* @throws Exception
*/ */
public static function getById($uid) public static function getById($uid)
{ {
@ -55,6 +57,7 @@ class User
* @param string $url * @param string $url
* *
* @return integer user id * @return integer user id
* @throws Exception
*/ */
public static function getIdForURL($url) public static function getIdForURL($url)
{ {
@ -71,6 +74,7 @@ class User
* *
* @param int $uid * @param int $uid
* @return boolean|array * @return boolean|array
* @throws Exception
*/ */
public static function getOwnerDataById($uid) { public static function getOwnerDataById($uid) {
$r = DBA::fetchFirst("SELECT $r = DBA::fetchFirst("SELECT
@ -115,6 +119,7 @@ class User
* *
* @param int $nick * @param int $nick
* @return boolean|array * @return boolean|array
* @throws Exception
*/ */
public static function getOwnerDataByNick($nick) public static function getOwnerDataByNick($nick)
{ {
@ -134,6 +139,7 @@ class User
* @param string $network network name * @param string $network network name
* *
* @return int group id * @return int group id
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getDefaultGroup($uid, $network = '') public static function getDefaultGroup($uid, $network = '')
{ {
@ -364,6 +370,7 @@ class User
* @param int $uid * @param int $uid
* @param string $pasword_hashed * @param string $pasword_hashed
* @return bool * @return bool
* @throws Exception
*/ */
private static function updatePasswordHashed($uid, $pasword_hashed) private static function updatePasswordHashed($uid, $pasword_hashed)
{ {
@ -385,6 +392,7 @@ class User
* *
* @param string $nickname The nickname that should be checked * @param string $nickname The nickname that should be checked
* @return boolean True is the nickname is blocked on the node * @return boolean True is the nickname is blocked on the node
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isNicknameBlocked($nickname) public static function isNicknameBlocked($nickname)
{ {
@ -422,6 +430,7 @@ class User
* @return array * @return array
* @throws \ErrorException * @throws \ErrorException
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @throws Exception * @throws Exception
*/ */
public static function create(array $data) public static function create(array $data)
@ -807,7 +816,8 @@ class User
/** /**
* @param object $uid user to remove * @param object $uid user to remove
* @return void * @return bool
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function remove($uid) public static function remove($uid)
{ {
@ -848,18 +858,19 @@ class User
* @return array All identities for this user * @return array All identities for this user
* *
* Example for a return: * Example for a return:
* [ * [
* [ * [
* 'uid' => 1, * 'uid' => 1,
* 'username' => 'maxmuster', * 'username' => 'maxmuster',
* 'nickname' => 'Max Mustermann' * 'nickname' => 'Max Mustermann'
* ], * ],
* [ * [
* 'uid' => 2, * 'uid' => 2,
* 'username' => 'johndoe', * 'username' => 'johndoe',
* 'nickname' => 'John Doe' * 'nickname' => 'John Doe'
* ] * ]
* ] * ]
* @throws Exception
*/ */
public static function identities($uid) public static function identities($uid)
{ {

View file

@ -841,12 +841,12 @@ class Contact extends BaseModule
* *
* Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends' * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
* *
* @param App $a * @param App $a
* @param array $contact The contact array * @param array $contact The contact array
* @param int $active_tab 1 if tab should be marked as active * @param int $active_tab 1 if tab should be marked as active
* *
* @return string | HTML string of the contact page tabs buttons. * @return string HTML string of the contact page tabs buttons.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getTabsHTML($a, $contact, $active_tab) public static function getTabsHTML($a, $contact, $active_tab)
{ {

View file

@ -254,6 +254,7 @@ class Install extends BaseModule
* @param App $a The global App * @param App $a The global App
* *
* @return string The text for the next steps * @return string The text for the next steps
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function whatNext($a) private static function whatNext($a)
{ {

View file

@ -79,6 +79,7 @@ class Login extends BaseModule
* *
* @param string $openid_url OpenID URL string * @param string $openid_url OpenID URL string
* @param bool $remember Whether to set the session remember flag * @param bool $remember Whether to set the session remember flag
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function openIdAuthentication($openid_url, $remember) private static function openIdAuthentication($openid_url, $remember)
{ {
@ -112,6 +113,7 @@ class Login extends BaseModule
* @param string $username User name * @param string $username User name
* @param string $password Clear password * @param string $password Clear password
* @param bool $remember Whether to set the session remember flag * @param bool $remember Whether to set the session remember flag
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function passwordAuthentication($username, $password, $remember) private static function passwordAuthentication($username, $password, $remember)
{ {
@ -269,14 +271,15 @@ class Login extends BaseModule
/** /**
* @brief Wrapper for adding a login box. * @brief Wrapper for adding a login box.
* *
* @param string $return_path The path relative to the base the user should be sent * @param string $return_path The path relative to the base the user should be sent
* back to after login completes * back to after login completes
* @param bool $register If $register == true provide a registration link. * @param bool $register If $register == true provide a registration link.
* This will most always depend on the value of config.register_policy. * This will most always depend on the value of config.register_policy.
* @param array $hiddens optional * @param array $hiddens optional
* *
* @return string Returns the complete html for inserting into the page * @return string Returns the complete html for inserting into the page
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @hooks 'login_hook' string $o * @hooks 'login_hook' string $o
*/ */
public static function form($return_path = null, $register = false, $hiddens = []) public static function form($return_path = null, $register = false, $hiddens = [])

View file

@ -32,7 +32,6 @@ class Proxy extends BaseModule
* *
* Sets application instance and checks if /proxy/ path is writable. * Sets application instance and checks if /proxy/ path is writable.
* *
* @param \Friendica\App $app Application instance
*/ */
public static function init() public static function init()
{ {
@ -157,6 +156,7 @@ class Proxy extends BaseModule
* 'size' => requested image size (int) * 'size' => requested image size (int)
* 'sizetype' => requested image size (string): ':micro', ':thumb', ':small', ':medium', ':large' * 'sizetype' => requested image size (string): ':micro', ':thumb', ':small', ':medium', ':large'
* ] * ]
* @throws \Exception
*/ */
private static function getRequestInfo() private static function getRequestInfo()
{ {
@ -224,12 +224,13 @@ class Proxy extends BaseModule
'sizetype' => $sizetype, 'sizetype' => $sizetype,
]; ];
} }
/** /**
* @brief setup ./proxy folder for direct cache * @brief setup ./proxy folder for direct cache
* *
* @return bool False if direct cache can't be used. * @return bool False if direct cache can't be used.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function setupDirectCache() private static function setupDirectCache()
{ {
@ -248,16 +249,18 @@ class Proxy extends BaseModule
return $direct_cache; return $direct_cache;
} }
/** /**
* @brief Try to reply with image in cachefile * @brief Try to reply with image in cachefile
* *
* @param array $request Array from getRequestInfo * @param array $request Array from getRequestInfo
* *
* @return string Cache file name, empty string if cache is not enabled. * @return string Cache file name, empty string if cache is not enabled.
* *
* If cachefile exists, script ends here and this function will never returns * If cachefile exists, script ends here and this function will never returns
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function responseFromCache(&$request) private static function responseFromCache(&$request)
{ {
@ -269,13 +272,15 @@ class Proxy extends BaseModule
} }
return $cachefile; return $cachefile;
} }
/** /**
* @brief Try to reply with image in database * @brief Try to reply with image in database
* *
* @param array $request Array from getRequestInfo * @param array $request Array from getRequestInfo
* *
* If the image exists in database, then script ends here and this function will never returns * If the image exists in database, then script ends here and this function will never returns
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function responseFromDB(&$request) { private static function responseFromDB(&$request) {
@ -297,11 +302,12 @@ class Proxy extends BaseModule
echo file_get_contents('images/blank.png'); echo file_get_contents('images/blank.png');
exit(); exit();
} }
/** /**
* @brief Output the image with cache headers * @brief Output the image with cache headers
* *
* @param Image $image * @param Image $img
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function responseImageHttpCache(Image $img) private static function responseImageHttpCache(Image $img)
{ {

View file

@ -53,6 +53,7 @@ class Tos extends BaseModule
self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser')); self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser'));
} }
} }
/** /**
* @brief generate the content of the /tos page * @brief generate the content of the /tos page
* *
@ -63,7 +64,8 @@ class Tos extends BaseModule
* This privacy statement has fixed text, so it can be translated easily. * This privacy statement has fixed text, so it can be translated easily.
* *
* @return string * @return string
**/ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function content() { public static function content() {
$tpl = Renderer::getMarkupTemplate('tos.tpl'); $tpl = Renderer::getMarkupTemplate('tos.tpl');
if (Config::get('system', 'tosdisplay')) { if (Config::get('system', 'tosdisplay')) {

View file

@ -77,6 +77,7 @@ class CurlResult
* @param string $url optional URL * @param string $url optional URL
* *
* @return CurlResult a CURL with error response * @return CurlResult a CURL with error response
* @throws InternalServerErrorException
*/ */
public static function createErrorCurl($url = '') public static function createErrorCurl($url = '')
{ {

View file

@ -32,6 +32,7 @@ class FKOAuth1 extends OAuthServer
/** /**
* @param string $uid user id * @param string $uid user id
* @return void * @return void
* @throws HTTPException\InternalServerErrorException
*/ */
public function loginUser($uid) public function loginUser($uid)
{ {

View file

@ -35,6 +35,7 @@ class FKOAuthDataStore extends OAuthDataStore
/** /**
* @param string $consumer_key key * @param string $consumer_key key
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function lookup_consumer($consumer_key) public function lookup_consumer($consumer_key)
{ {
@ -55,6 +56,7 @@ class FKOAuthDataStore extends OAuthDataStore
* @param string $token_type type * @param string $token_type type
* @param string $token token * @param string $token token
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function lookup_token($consumer, $token_type, $token) public function lookup_token($consumer, $token_type, $token)
{ {
@ -80,6 +82,7 @@ class FKOAuthDataStore extends OAuthDataStore
* @param string $nonce nonce * @param string $nonce nonce
* @param string $timestamp timestamp * @param string $timestamp timestamp
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function lookup_nonce($consumer, $token, $nonce, $timestamp) public function lookup_nonce($consumer, $token, $nonce, $timestamp)
{ {
@ -95,6 +98,7 @@ class FKOAuthDataStore extends OAuthDataStore
* @param string $consumer consumer * @param string $consumer consumer
* @param string $callback optional, default null * @param string $callback optional, default null
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function new_request_token($consumer, $callback = null) public function new_request_token($consumer, $callback = null)
{ {
@ -130,6 +134,7 @@ class FKOAuthDataStore extends OAuthDataStore
* @param string $consumer consumer * @param string $consumer consumer
* @param string $verifier optional, defult null * @param string $verifier optional, defult null
* @return object * @return object
* @throws HTTPException\InternalServerErrorException
*/ */
public function new_access_token($token, $consumer, $verifier = null) public function new_access_token($token, $consumer, $verifier = null)
{ {

View file

@ -97,6 +97,7 @@ class Probe
* @param string $host The host part of an url * @param string $host The host part of an url
* *
* @return array with template and type of the webfinger template for JSON or XML * @return array with template and type of the webfinger template for JSON or XML
* @throws HTTPException\InternalServerErrorException
*/ */
private static function hostMeta($host) private static function hostMeta($host)
{ {
@ -188,6 +189,7 @@ class Probe
* @param string $hcard_url Link to the hcard - is returned by reference * @param string $hcard_url Link to the hcard - is returned by reference
* *
* @return string profile link * @return string profile link
* @throws HTTPException\InternalServerErrorException
*/ */
public static function webfingerDfrn($webbie, &$hcard_url) public static function webfingerDfrn($webbie, &$hcard_url)
{ {
@ -221,6 +223,7 @@ class Probe
* @param string $uri Address that should be probed * @param string $uri Address that should be probed
* *
* @return array uri data * @return array uri data
* @throws HTTPException\InternalServerErrorException
*/ */
public static function lrdd($uri) public static function lrdd($uri)
{ {
@ -315,6 +318,8 @@ class Probe
* @param boolean $cache Use cached values? * @param boolean $cache Use cached values?
* *
* @return array uri data * @return array uri data
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function uri($uri, $network = '', $uid = -1, $cache = true) public static function uri($uri, $network = '', $uid = -1, $cache = true)
{ {
@ -527,6 +532,7 @@ class Probe
* @param string $type type * @param string $type type
* *
* @return array fixed webfinger data * @return array fixed webfinger data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function fixOStatus($webfinger, $lrdd, $type) private static function fixOStatus($webfinger, $lrdd, $type)
{ {
@ -572,6 +578,7 @@ class Probe
* @param integer $uid User ID for the probe (only used for mails) * @param integer $uid User ID for the probe (only used for mails)
* *
* @return array uri data * @return array uri data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function detect($uri, $network, $uid) private static function detect($uri, $network, $uid)
{ {
@ -740,6 +747,7 @@ class Probe
* @param string $type type * @param string $type type
* *
* @return array webfinger data * @return array webfinger data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function webfinger($url, $type) private static function webfinger($url, $type)
{ {
@ -810,6 +818,7 @@ class Probe
* @param array $data The already fetched data * @param array $data The already fetched data
* *
* @return array noscrape data * @return array noscrape data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function pollNoscrape($noscrape_url, $data) private static function pollNoscrape($noscrape_url, $data)
{ {
@ -926,6 +935,8 @@ class Probe
* @param string $profile_link Link to the profile page * @param string $profile_link Link to the profile page
* *
* @return array profile data * @return array profile data
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function profile($profile_link) public static function profile($profile_link)
{ {
@ -976,6 +987,7 @@ class Probe
* @param array $webfinger Webfinger data * @param array $webfinger Webfinger data
* *
* @return array DFRN data * @return array DFRN data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function dfrn($webfinger) private static function dfrn($webfinger)
{ {
@ -1057,6 +1069,7 @@ class Probe
* @param boolean $dfrn Poll DFRN specific data * @param boolean $dfrn Poll DFRN specific data
* *
* @return array hcard data * @return array hcard data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function pollHcard($hcard_url, $data, $dfrn = false) private static function pollHcard($hcard_url, $data, $dfrn = false)
{ {
@ -1181,6 +1194,7 @@ class Probe
* @param array $webfinger Webfinger data * @param array $webfinger Webfinger data
* *
* @return array Diaspora data * @return array Diaspora data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function diaspora($webfinger) private static function diaspora($webfinger)
{ {
@ -1268,6 +1282,7 @@ class Probe
* @param bool $short Short detection mode * @param bool $short Short detection mode
* *
* @return array|bool OStatus data or "false" on error or "true" on short mode * @return array|bool OStatus data or "false" on error or "true" on short mode
* @throws HTTPException\InternalServerErrorException
*/ */
private static function ostatus($webfinger, $short = false) private static function ostatus($webfinger, $short = false)
{ {
@ -1450,6 +1465,7 @@ class Probe
* *
* @param array $webfinger Webfinger data * @param array $webfinger Webfinger data
* *
* @param $addr
* @return array pump.io data * @return array pump.io data
*/ */
private static function pumpio($webfinger, $addr) private static function pumpio($webfinger, $addr)
@ -1552,6 +1568,7 @@ class Probe
* @param boolean $probe Do a probe if the page contains a feed link * @param boolean $probe Do a probe if the page contains a feed link
* *
* @return array feed data * @return array feed data
* @throws HTTPException\InternalServerErrorException
*/ */
private static function feed($url, $probe = true) private static function feed($url, $probe = true)
{ {
@ -1614,6 +1631,7 @@ class Probe
* @param integer $uid User ID * @param integer $uid User ID
* *
* @return array mail data * @return array mail data
* @throws \Exception
*/ */
private static function mail($uri, $uid) private static function mail($uri, $uid)
{ {
@ -1701,6 +1719,7 @@ class Probe
* @param string $base Another path that is hopefully complete * @param string $base Another path that is hopefully complete
* *
* @return string fixed avatar path * @return string fixed avatar path
* @throws \Exception
*/ */
public static function fixAvatar($avatar, $base) public static function fixAvatar($avatar, $base)
{ {

View file

@ -65,7 +65,8 @@ class Image
* @brief Constructor * @brief Constructor
* @param object $data data * @param object $data data
* @param boolean $type optional, default null * @param boolean $type optional, default null
* @return object * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public function __construct($data, $type = null) public function __construct($data, $type = null)
{ {
@ -128,6 +129,8 @@ class Image
/** /**
* @param object $data data * @param object $data data
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private function loadData($data) private function loadData($data)
{ {
@ -643,6 +646,7 @@ class Image
/** /**
* @param string $path file path * @param string $path file path
* @return mixed * @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function saveToFilePath($path) public function saveToFilePath($path)
{ {
@ -667,6 +671,7 @@ class Image
* $data = (string) $Image; * $data = (string) $Image;
* *
* @return string * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function __toString() { public function __toString() {
return $this->asString(); return $this->asString();
@ -674,6 +679,7 @@ class Image
/** /**
* @return mixed * @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function asString() public function asString()
{ {
@ -721,9 +727,10 @@ class Image
* *
* @param string $filename Image filename * @param string $filename Image filename
* @param boolean $fromcurl Check Content-Type header from curl request * @param boolean $fromcurl Check Content-Type header from curl request
* @param string $header passed headers to take into account * @param string $header passed headers to take into account
* *
* @return object * @return object
* @throws \ImagickException
*/ */
public static function guessType($filename, $fromcurl = false, $header = '') public static function guessType($filename, $fromcurl = false, $header = '')
{ {
@ -772,6 +779,7 @@ class Image
/** /**
* @param string $url url * @param string $url url
* @return object * @return object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getInfoFromURL($url) public static function getInfoFromURL($url)
{ {
@ -876,11 +884,13 @@ class Image
/** /**
* @brief This function is used by the fromgplus addon * @brief This function is used by the fromgplus addon
* @param object $a App * @param App $a App
* @param integer $uid user id * @param integer $uid user id
* @param string $imagedata optional, default empty * @param string $imagedata optional, default empty
* @param string $url optional, default empty * @param string $url optional, default empty
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function storePhoto(App $a, $uid, $imagedata = "", $url = "") public static function storePhoto(App $a, $uid, $imagedata = "", $url = "")
{ {

View file

@ -61,6 +61,7 @@ class Post extends BaseObject
* Constructor * Constructor
* *
* @param array $data data array * @param array $data data array
* @throws \Exception
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {
@ -116,6 +117,8 @@ class Post extends BaseObject
* *
* @return mixed The data requested on success * @return mixed The data requested on success
* false on failure * false on failure
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public function getTemplateData(array $conv_responses, $thread_level = 1) public function getTemplateData(array $conv_responses, $thread_level = 1)
{ {
@ -501,6 +504,7 @@ class Post extends BaseObject
* @param Post $item The child item to add * @param Post $item The child item to add
* *
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function addChild(Post $item) public function addChild(Post $item)
{ {
@ -590,6 +594,7 @@ class Post extends BaseObject
* @param Post $item The child to be removed * @param Post $item The child to be removed
* *
* @return boolean Success or failure * @return boolean Success or failure
* @throws \Exception
*/ */
public function removeChild(Post $item) public function removeChild(Post $item)
{ {
@ -679,6 +684,7 @@ class Post extends BaseObject
* *
* @param string $name template name * @param string $name template name
* @return bool * @return bool
* @throws \Exception
*/ */
private function setTemplate($name) private function setTemplate($name)
{ {
@ -770,6 +776,7 @@ class Post extends BaseObject
* *
* @return mixed The comment box string (empty if no comment box) * @return mixed The comment box string (empty if no comment box)
* false on failure * false on failure
* @throws \Exception
*/ */
private function getCommentBox($indent) private function getCommentBox($indent)
{ {
@ -849,6 +856,7 @@ class Post extends BaseObject
* Check if we are a wall to wall item and set the relevant properties * Check if we are a wall to wall item and set the relevant properties
* *
* @return void * @return void
* @throws \Exception
*/ */
protected function checkWallToWall() protected function checkWallToWall()
{ {

View file

@ -26,9 +26,10 @@ class Thread extends BaseObject
/** /**
* Constructor * Constructor
* *
* @param string $mode The mode * @param string $mode The mode
* @param boolean $preview Are we in the preview mode? * @param boolean $preview Are we in the preview mode?
* @param boolean $writable Override the writable check * @param boolean $writable Override the writable check
* @throws \Exception
*/ */
public function __construct($mode, $preview, $writable = false) public function __construct($mode, $preview, $writable = false)
{ {
@ -39,10 +40,11 @@ class Thread extends BaseObject
/** /**
* Set the mode we'll be displayed on * Set the mode we'll be displayed on
* *
* @param string $mode The mode to set * @param string $mode The mode to set
* @param boolean $writable Override the writable check * @param boolean $writable Override the writable check
* *
* @return void * @return void
* @throws \Exception
*/ */
private function setMode($mode, $writable) private function setMode($mode, $writable)
{ {
@ -125,10 +127,11 @@ class Thread extends BaseObject
/** /**
* Add a thread to the conversation * Add a thread to the conversation
* *
* @param object $item The item to insert * @param Post $item The item to insert
* *
* @return mixed The inserted item on success * @return mixed The inserted item on success
* false on failure * false on failure
* @throws \Exception
*/ */
public function addParent(Post $item) public function addParent(Post $item)
{ {
@ -172,6 +175,7 @@ class Thread extends BaseObject
* *
* @return mixed The data requested on success * @return mixed The data requested on success
* false on failure * false on failure
* @throws \Exception
*/ */
public function getTemplateData($conv_responses) public function getTemplateData($conv_responses)
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,6 +19,7 @@ class Email
* @param string $username The username * @param string $username The username
* @param string $password The password * @param string $password The password
* @return object * @return object
* @throws \Exception
*/ */
public static function connect($mailbox, $username, $password) public static function connect($mailbox, $username, $password)
{ {
@ -45,6 +46,7 @@ class Email
* @param object $mbox mailbox * @param object $mbox mailbox
* @param string $email_addr email * @param string $email_addr email
* @return array * @return array
* @throws \Exception
*/ */
public static function poll($mbox, $email_addr) public static function poll($mbox, $email_addr)
{ {
@ -106,6 +108,7 @@ class Email
* @param integer $uid user id * @param integer $uid user id
* @param string $reply reply * @param string $reply reply
* @return array * @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getMessage($mbox, $uid, $reply) public static function getMessage($mbox, $uid, $reply)
{ {
@ -321,6 +324,8 @@ class Email
* *
* @return void * @return void
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo This could be changed to use the Emailer class * @todo This could be changed to use the Emailer class
*/ */
public static function send($addr, $subject, $headers, $item) 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 * @brief Read a RSS/RDF/Atom feed and create an item entry for it
* *
* @param string $xml The feed data * @param string $xml The feed data
* @param array $importer The user record of the importer * @param array $importer The user record of the importer
* @param array $contact The contact record of the feed * @param array $contact The contact record of the feed
* @param string $hub Unused dummy value for compatibility reasons * @param string $hub Unused dummy value for compatibility reasons
* @param bool $simulate If enabled, no data is imported * @param bool $simulate If enabled, no data is imported
* *
* @return array In simulation mode it returns the header and the first item * @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) { public static function import($xml, $importer, &$contact, &$hub, $simulate = false) {

View file

@ -43,13 +43,15 @@ class OStatus
/** /**
* @brief Fetches author data * @brief Fetches author data
* *
* @param object $xpath The xpath object * @param DOMXPath $xpath The xpath object
* @param object $context The xml context of the author details * @param object $context The xml context of the author details
* @param array $importer user record of the importing user * @param array $importer user record of the importing user
* @param array $contact Called by reference, will contain the fetched contact * @param array $contact Called by reference, will contain the fetched contact
* @param bool $onlyfetch Only fetch the header without updating the contact entries * @param bool $onlyfetch Only fetch the header without updating the contact entries
* *
* @return array Array of author related entries for the item * @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) 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 * @param array $importer user record of the importing user
* *
* @return array Array of author related entries for the item * @return array Array of author related entries for the item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function salmonAuthor($xml, array $importer) public static function salmonAuthor($xml, array $importer)
{ {
@ -296,6 +300,8 @@ class OStatus
* @param array $contact contact * @param array $contact contact
* @param string $hub Called by reference, returns the fetched hub data * @param string $hub Called by reference, returns the fetched hub data
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function import($xml, array $importer, array &$contact = null, &$hub) 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? * @param boolean $initialize Is it the leading post so that data has to be initialized?
* *
* @return boolean Could the XML be processed? * @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) 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 * Removes notice item from database
*
* @param array $item item * @param array $item item
* @return void * @return void
* @throws \Exception
*/ */
private static function deleteNotice(array $item) private static function deleteNotice(array $item)
{ {
@ -575,11 +585,13 @@ class OStatus
/** /**
* @brief Processes the XML for a post * @brief Processes the XML for a post
* *
* @param object $xpath The xpath object * @param DOMXPath $xpath The xpath object
* @param object $entry The xml entry that is processed * @param object $entry The xml entry that is processed
* @param array $item The item array * @param array $item The item array
* @param array $importer user record of the importing user * @param array $importer user record of the importing user
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function processPost(DOMXPath $xpath, $entry, array &$item, array $importer) 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 The link to the conversation
* @param string $conversation_uri The conversation in "uri" format * @param string $conversation_uri The conversation in "uri" format
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function fetchConversation($conversation, $conversation_uri) private static function fetchConversation($conversation, $conversation_uri)
{ {
@ -787,6 +800,7 @@ class OStatus
* @param string $conversation conversation * @param string $conversation conversation
* @param string $conversation_uri conversation uri * @param string $conversation_uri conversation uri
* @return void * @return void
* @throws \Exception
*/ */
private static function storeConversation($xml, $conversation = '', $conversation_uri = '') private static function storeConversation($xml, $conversation = '', $conversation_uri = '')
{ {
@ -870,6 +884,7 @@ class OStatus
* @param string $self The link to the self item * @param string $self The link to the self item
* @param array $item The item array * @param array $item The item array
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function fetchSelf($self, array &$item) private static function fetchSelf($self, array &$item)
{ {
@ -905,6 +920,8 @@ class OStatus
* @param string $related_uri The related item in "uri" format * @param string $related_uri The related item in "uri" format
* @param array $importer user record of the importing user * @param array $importer user record of the importing user
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function fetchRelated($related, $related_uri, $importer) private static function fetchRelated($related, $related_uri, $importer)
{ {
@ -1008,12 +1025,14 @@ class OStatus
/** /**
* @brief Processes the XML for a repeated post * @brief Processes the XML for a repeated post
* *
* @param object $xpath The xpath object * @param DOMXPath $xpath The xpath object
* @param object $entry The xml entry that is processed * @param object $entry The xml entry that is processed
* @param array $item The item array * @param array $item The item array
* @param array $importer user record of the importing user * @param array $importer user record of the importing user
* *
* @return array with data from links * @return array with data from links
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function processRepeatedItem(DOMXPath $xpath, $entry, array &$item, array $importer) private static function processRepeatedItem(DOMXPath $xpath, $entry, array &$item, array $importer)
{ {
@ -1223,6 +1242,7 @@ class OStatus
* @param string $body The body * @param string $body The body
* *
* @return string The cleaned body * @return string The cleaned body
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function formatPicturePost($body) private static function formatPicturePost($body)
{ {
@ -1257,12 +1277,13 @@ class OStatus
/** /**
* @brief Adds the header elements to the XML document * @brief Adds the header elements to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param string $filter The related feed filter (activity, posts or comments) * @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 bool $feed_mode Behave like a regular feed for users if true
* *
* @return object header root element * @return object header root element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false) 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 * @brief Add the link to the push hubs to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param object $root XML root element where the hub links are added * @param object $root XML root element where the hub links are added
* @param object $nick nick * @param object $nick nick
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function hublinks(DOMDocument $doc, $root, $nick) public static function hublinks(DOMDocument $doc, $root, $nick)
{ {
@ -1361,14 +1383,14 @@ class OStatus
/** /**
* @brief Adds attachment data to the XML document * @brief Adds attachment data to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param object $root XML root element where the hub links are added * @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 array $item Data of the item that is to be posted
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function getAttachment(DOMDocument $doc, $root, $item) private static function getAttachment(DOMDocument $doc, $root, $item)
{ {
$o = "";
$siteinfo = BBCode::getAttachedData($item["body"]); $siteinfo = BBCode::getAttachedData($item["body"]);
switch ($siteinfo["type"]) { switch ($siteinfo["type"]) {
@ -1433,11 +1455,12 @@ class OStatus
/** /**
* @brief Adds the author element to the XML document * @brief Adds the author element to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param bool $show_profile Whether to show profile * @param bool $show_profile Whether to show profile
* *
* @return object author element * @return object author element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function addAuthor(DOMDocument $doc, array $owner, $show_profile = true) 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 * @brief Adds an entry element to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param bool $toplevel optional default false * @param bool $toplevel optional default false
* @param bool $feed_mode Behave like a regular feed for users if true * @param bool $feed_mode Behave like a regular feed for users if true
* *
* @return object Entry element * @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) 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 * @brief Adds a source entry to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $contact Array of the contact that is added * @param array $contact Array of the contact that is added
* *
* @return object Source element * @return object Source element
* @throws \Exception
*/ */
private static function sourceEntry(DOMDocument $doc, array $contact) private static function sourceEntry(DOMDocument $doc, array $contact)
{ {
@ -1608,6 +1634,8 @@ class OStatus
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* *
* @return array Contact array * @return array Contact array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function contactEntry($url, array $owner) private static function contactEntry($url, array $owner)
{ {
@ -1655,13 +1683,15 @@ class OStatus
/** /**
* @brief Adds an entry element with reshared content * @brief Adds an entry element with reshared content
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param string $repeated_guid guid * @param string $repeated_guid guid
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * @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) 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" * @brief Adds an entry element with a "like"
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @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 $toplevel Is it for en entry element (false) or a feed entry (true)?
* *
* @return object Entry element with "like" * @return object Entry element with "like"
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel) 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 * @brief Adds the person object element to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param array $contact Contact data of the target * @param array $contact Contact data of the target
* *
* @return object author element * @return object author element
*/ */
@ -1804,12 +1836,14 @@ class OStatus
/** /**
* @brief Adds a follow/unfollow entry element * @brief Adds a follow/unfollow entry element
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $item Data of the follow/unfollow message * @param array $item Data of the follow/unfollow message
* @param array $owner Contact data of the poster * @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 $toplevel Is it for en entry element (false) or a feed entry (true)?
* *
* @return object Entry element * @return object Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function followEntry(DOMDocument $doc, array $item, array $owner, $toplevel) private static function followEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
{ {
@ -1866,13 +1900,15 @@ class OStatus
/** /**
* @brief Adds a regular entry element * @brief Adds a regular entry element
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @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 $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 bool $feed_mode Behave like a regular feed for users if true
* *
* @return object Entry element * @return object Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel, $feed_mode) 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 * @brief Adds a header element to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param object $entry The entry element where the elements are added * @param object $entry The entry element where the elements are added
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * @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 * @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) 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 * @brief Adds elements to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param object $entry Entry element where the content is added * @param object $entry Entry element where the content is added
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param string $title Title for the post * @param string $title Title for the post
* @param string $verb The activity verb * @param string $verb The activity verb
* @param bool $complete Add the "status_net" element? * @param bool $complete Add the "status_net" element?
* @param bool $feed_mode Behave like a regular feed for users if true * @param bool $feed_mode Behave like a regular feed for users if true
* @return void * @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) 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 * @brief Adds the elements at the foot of an entry to the XML document
* *
* @param object $doc XML document * @param DOMDocument $doc XML document
* @param object $entry The entry element where the elements are added * @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 $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param bool $complete default true * @param bool $complete default true
* @param bool $feed_mode Behave like a regular feed for users if true * @param bool $feed_mode Behave like a regular feed for users if true
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function entryFooter(DOMDocument $doc, $entry, array $item, array $owner, $complete = true, $feed_mode = false) 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 * @param boolean $feed_mode Behave like a regular feed for users if true
* *
* @return string XML feed * @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) 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 * @param array $owner Contact data of the poster
* *
* @return string XML for the salmon * @return string XML for the salmon
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/ */
public static function salmon(array $item, array $owner) 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 * 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 * the given uid, cid to the global contact entry. There can be many uid/cid combinations
* pointing to the same global contact id. * pointing to the same global contact id.
* * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function loadWorker($cid, $uid = 0, $zcid = 0, $url = null) public static function loadWorker($cid, $uid = 0, $zcid = 0, $url = null)
{ {
@ -59,7 +59,7 @@ class PortableContact
* @param integer $uid User ID * @param integer $uid User ID
* @param integer $zcid Global Contact ID * @param integer $zcid Global Contact ID
* @param integer $url POCO address that should be polled * @param integer $url POCO address that should be polled
* * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function load($cid, $uid, $zcid, $url) public static function load($cid, $uid, $zcid, $url)
{ {
@ -643,6 +643,7 @@ class PortableContact
* *
* @param string $server_url address of the server * @param string $server_url address of the server
* @return array Server data * @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function fetchNodeinfo($server_url) private static function fetchNodeinfo($server_url)
{ {
@ -696,6 +697,7 @@ class PortableContact
* *
* @param string $nodeinfo_url address of the nodeinfo path * @param string $nodeinfo_url address of the nodeinfo path
* @return array Server data * @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function parseNodeinfo1($nodeinfo_url) private static function parseNodeinfo1($nodeinfo_url)
{ {
@ -780,6 +782,7 @@ class PortableContact
* *
* @param string $nodeinfo_url address of the nodeinfo path * @param string $nodeinfo_url address of the nodeinfo path
* @return array Server data * @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function parseNodeinfo2($nodeinfo_url) private static function parseNodeinfo2($nodeinfo_url)
{ {
@ -1444,6 +1447,7 @@ class PortableContact
* @brief Fetch relay data from a given server url * @brief Fetch relay data from a given server url
* *
* @param string $server_url address of the server * @param string $server_url address of the server
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function discoverRelay($server_url) 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. * @brief Fetch server list from remote servers and adds them when they are new.
* *
* @param string $poco URL to the POCO endpoint * @param string $poco URL to the POCO endpoint
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function fetchServerlist($poco) private static function fetchServerlist($poco)
{ {

View file

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

View file

@ -42,7 +42,7 @@ class Crypto
/** /**
* @param string $Der der formatted string * @param string $Der der formatted string
* @param string $Private key type optional, default false * @param bool $Private key type optional, default false
* @return string * @return string
*/ */
private static function DerToPem($Der, $Private = false) private static function DerToPem($Der, $Private = false)
@ -149,6 +149,7 @@ class Crypto
* @param string $m modulo reference * @param string $m modulo reference
* @param object $e exponent reference * @param object $e exponent reference
* @return void * @return void
* @throws \Exception
*/ */
private static function pubRsaToMe($key, &$m, &$e) private static function pubRsaToMe($key, &$m, &$e)
{ {
@ -166,6 +167,7 @@ class Crypto
/** /**
* @param string $key key * @param string $key key
* @return string * @return string
* @throws \Exception
*/ */
public static function rsaToPem($key) public static function rsaToPem($key)
{ {
@ -176,6 +178,7 @@ class Crypto
/** /**
* @param string $key key * @param string $key key
* @return string * @return string
* @throws \Exception
*/ */
private static function pemToRsa($key) private static function pemToRsa($key)
{ {
@ -188,6 +191,7 @@ class Crypto
* @param string $m modulo reference * @param string $m modulo reference
* @param string $e exponent reference * @param string $e exponent reference
* @return void * @return void
* @throws \Exception
*/ */
public static function pemToMe($key, &$m, &$e) public static function pemToMe($key, &$m, &$e)
{ {
@ -217,6 +221,7 @@ class Crypto
/** /**
* @param integer $bits number of bits * @param integer $bits number of bits
* @return mixed * @return mixed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function newKeypair($bits) public static function newKeypair($bits)
{ {
@ -318,14 +323,15 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param string $data * @param string $data
* @param string $pubkey The public key. * @param string $pubkey The public key.
* @param string $alg The algorithm used for encryption. * @param string $alg The algorithm used for encryption.
* *
* @return array * @return array
* @throws \Exception
*/ */
public static function encapsulate($data, $pubkey, $alg = 'aes256cbc') public static function encapsulate($data, $pubkey, $alg = 'aes256cbc')
{ {
@ -336,14 +342,15 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param type $data * @param string $data
* @param type $pubkey The public key. * @param string $pubkey The public key.
* @param type $alg The algorithm used for encryption. * @param string $alg The algorithm used for encryption.
* *
* @return array * @return array
* @throws \Exception
*/ */
private static function encapsulateOther($data, $pubkey, $alg) private static function encapsulateOther($data, $pubkey, $alg)
{ {
@ -378,13 +385,14 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param string $data * @param string $data
* @param string $pubkey * @param string $pubkey
* *
* @return array * @return array
* @throws \Exception
*/ */
private static function encapsulateAes($data, $pubkey) private static function encapsulateAes($data, $pubkey)
{ {
@ -412,13 +420,14 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param string $data * @param string $data
* @param string $prvkey The private key used for decryption. * @param string $prvkey The private key used for decryption.
* *
* @return string|boolean The decrypted string or false on failure. * @return string|boolean The decrypted string or false on failure.
* @throws \Exception
*/ */
public static function unencapsulate($data, $prvkey) public static function unencapsulate($data, $prvkey)
{ {
@ -434,14 +443,15 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param string $data * @param string $data
* @param string $prvkey The private key used for decryption. * @param string $prvkey The private key used for decryption.
* @param string $alg * @param string $alg
* *
* @return string|boolean The decrypted string or false on failure. * @return string|boolean The decrypted string or false on failure.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function unencapsulateOther($data, $prvkey, $alg) private static function unencapsulateOther($data, $prvkey, $alg)
{ {
@ -461,13 +471,14 @@ class Crypto
} }
/** /**
* *
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
* *
* @param array $data * @param array $data
* @param string $prvkey The private key used for decryption. * @param string $prvkey The private key used for decryption.
* *
* @return string|boolean The decrypted string or false on failure. * @return string|boolean The decrypted string or false on failure.
* @throws \Exception
*/ */
private static function unencapsulateAes($data, $prvkey) private static function unencapsulateAes($data, $prvkey)
{ {

View file

@ -26,6 +26,7 @@ class DateTimeFormat
* @param string $time A date/time string * @param string $time A date/time string
* @param string $format DateTime format string or Temporal constant * @param string $format DateTime format string or Temporal constant
* @return string * @return string
* @throws Exception
*/ */
public static function utc($time, $format = self::MYSQL) public static function utc($time, $format = self::MYSQL)
{ {
@ -38,6 +39,7 @@ class DateTimeFormat
* @param string $time A date/time string * @param string $time A date/time string
* @param string $format DateTime format string or Temporal constant * @param string $format DateTime format string or Temporal constant
* @return string * @return string
* @throws Exception
*/ */
public static function local($time, $format = self::MYSQL) public static function local($time, $format = self::MYSQL)
{ {
@ -47,8 +49,10 @@ class DateTimeFormat
/** /**
* convert() shorthand for timezoned now. * convert() shorthand for timezoned now.
* *
* @param $timezone
* @param string $format DateTime format string or Temporal constant * @param string $format DateTime format string or Temporal constant
* @return string * @return string
* @throws Exception
*/ */
public static function timezoneNow($timezone, $format = self::MYSQL) public static function timezoneNow($timezone, $format = self::MYSQL)
{ {
@ -60,6 +64,7 @@ class DateTimeFormat
* *
* @param string $format DateTime format string or Temporal constant * @param string $format DateTime format string or Temporal constant
* @return string * @return string
* @throws Exception
*/ */
public static function localNow($format = self::MYSQL) public static function localNow($format = self::MYSQL)
{ {
@ -71,6 +76,7 @@ class DateTimeFormat
* *
* @param string $format DateTime format string or Temporal constant * @param string $format DateTime format string or Temporal constant
* @return string * @return string
* @throws Exception
*/ */
public static function utcNow($format = self::MYSQL) public static function utcNow($format = self::MYSQL)
{ {
@ -84,9 +90,10 @@ class DateTimeFormat
* @param string $tz_to Destination timezone * @param string $tz_to Destination timezone
* @param string $tz_from Source timezone * @param string $tz_from Source timezone
* @param string $format Output format recognised from php's DateTime class * @param string $format Output format recognised from php's DateTime class
* http://www.php.net/manual/en/datetime.format.php * http://www.php.net/manual/en/datetime.format.php
* *
* @return string Formatted date according to given format * @return string Formatted date according to given format
* @throws Exception
*/ */
public static function convert($s = 'now', $tz_to = 'UTC', $tz_from = 'UTC', $format = self::MYSQL) public static function convert($s = 'now', $tz_to = 'UTC', $tz_from = 'UTC', $format = self::MYSQL)
{ {

View file

@ -19,17 +19,18 @@ class Emailer
* Send a multipart/alternative message with Text and HTML versions * Send a multipart/alternative message with Text and HTML versions
* *
* @param array $params parameters * @param array $params parameters
* fromName name of the sender * fromName name of the sender
* fromEmail email fo the sender * fromEmail email of the sender
* replyTo replyTo address to direct responses * replyTo address to direct responses
* toEmail destination email address * toEmail destination email address
* messageSubject subject of the message * messageSubject subject of the message
* htmlVersion html version of the message * htmlVersion html version of the message
* textVersion text only version of the message * textVersion text only version of the message
* additionalMailHeader additions to the smtp mail header * additionalMailHeader additions to the SMTP mail header
* optional uid user id of the destination user * optional uid user id of the destination user
* *
* @return object * @return object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function send($params) public static function send($params)
{ {

View file

@ -47,7 +47,6 @@ class ExAuth
/** /**
* @brief Create the class * @brief Create the class
* *
* @param boolean $bDebug Debug mode
*/ */
public function __construct() public function __construct()
{ {
@ -63,6 +62,7 @@ class ExAuth
* parameters * parameters
* *
* @return null * @return null
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function readStdin() public function readStdin()
{ {
@ -119,6 +119,7 @@ class ExAuth
* @brief Check if the given username exists * @brief Check if the given username exists
* *
* @param array $aCommand The command array * @param array $aCommand The command array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function isUser(array $aCommand) private function isUser(array $aCommand)
{ {
@ -165,11 +166,12 @@ class ExAuth
/** /**
* @brief Check remote user existance via HTTP(S) * @brief Check remote user existance via HTTP(S)
* *
* @param string $host The hostname * @param string $host The hostname
* @param string $user Username * @param string $user Username
* @param boolean $ssl Should the check be done via SSL? * @param boolean $ssl Should the check be done via SSL?
* *
* @return boolean Was the user found? * @return boolean Was the user found?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function checkUser($host, $user, $ssl) private function checkUser($host, $user, $ssl)
{ {
@ -199,6 +201,7 @@ class ExAuth
* @brief Authenticate the given user and password * @brief Authenticate the given user and password
* *
* @param array $aCommand The command array * @param array $aCommand The command array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function auth(array $aCommand) private function auth(array $aCommand)
{ {
@ -294,6 +297,7 @@ class ExAuth
* @brief Set the hostname for this process * @brief Set the hostname for this process
* *
* @param string $host The hostname * @param string $host The hostname
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private function setHost($host) private function setHost($host)
{ {

View file

@ -34,6 +34,7 @@ class HTTPSignature
* @param $key * @param $key
* *
* @return array with verification data * @return array with verification data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function verifyMagic($key) public static function verifyMagic($key)
{ {
@ -188,6 +189,7 @@ class HTTPSignature
* - \e string \b algorithm * - \e string \b algorithm
* - \e array \b headers * - \e array \b headers
* - \e string \b signature * - \e string \b signature
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function parseSigheader($header) public static function parseSigheader($header)
{ {
@ -235,6 +237,7 @@ class HTTPSignature
* - \e string \b key * - \e string \b key
* - \e string \b alg * - \e string \b alg
* - \e string \b data * - \e string \b data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function decryptSigheader($header, $prvkey = null) private static function decryptSigheader($header, $prvkey = null)
{ {
@ -276,11 +279,12 @@ class HTTPSignature
/** /**
* @brief Transmit given data to a target for a user * @brief Transmit given data to a target for a user
* *
* @param array $data Data that is about to be send * @param array $data Data that is about to be send
* @param string $target The URL of the inbox * @param string $target The URL of the inbox
* @param integer $uid User id of the sender * @param integer $uid User id of the sender
* *
* @return boolean Was the transmission successful? * @return boolean Was the transmission successful?
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function transmit($data, $target, $uid) public static function transmit($data, $target, $uid)
{ {
@ -320,10 +324,11 @@ class HTTPSignature
/** /**
* @brief Fetches JSON data for a user * @brief Fetches JSON data for a user
* *
* @param string $request request url * @param string $request request url
* @param integer $uid User id of the requester * @param integer $uid User id of the requester
* *
* @return array JSON array * @return array JSON array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fetch($request, $uid) public static function fetch($request, $uid)
{ {
@ -372,7 +377,8 @@ class HTTPSignature
* @param $content * @param $content
* @param $http_headers * @param $http_headers
* *
* @return signer string * @return string Signer
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function getSigner($content, $http_headers) public static function getSigner($content, $http_headers)
{ {
@ -493,6 +499,7 @@ class HTTPSignature
* @param $actor * @param $actor
* *
* @return array with actor url and public key * @return array with actor url and public key
* @throws \Exception
*/ */
private static function fetchKey($id, $actor) private static function fetchKey($id, $actor)
{ {

View file

@ -18,7 +18,8 @@ class JsonLD
* *
* @param $url * @param $url
* *
* @return the loaded data * @return mixed the loaded data
* @throws \JsonLdException
*/ */
public static function documentLoader($url) public static function documentLoader($url)
{ {
@ -53,7 +54,8 @@ class JsonLD
* *
* @param array $json * @param array $json
* *
* @return normalized JSON string * @return mixed|bool normalized JSON string
* @throws Exception
*/ */
public static function normalize($json) public static function normalize($json)
{ {
@ -77,7 +79,8 @@ class JsonLD
* *
* @param array $json * @param array $json
* *
* @return comacted JSON array * @return array Compacted JSON array
* @throws Exception
*/ */
public static function compact($json) public static function compact($json)
{ {
@ -131,7 +134,7 @@ class JsonLD
* @param $element * @param $element
* @param $key * @param $key
* *
* @return fetched element array * @return array fetched element
*/ */
public static function fetchElementArray($array, $element, $key = '@id') public static function fetchElementArray($array, $element, $key = '@id')
{ {
@ -172,7 +175,7 @@ class JsonLD
* @param $type * @param $type
* @param $type_value * @param $type_value
* *
* @return fetched element * @return string fetched element
*/ */
public static function fetchElement($array, $element, $key = '@id', $type = null, $type_value = null) public static function fetchElement($array, $element, $key = '@id', $type = null, $type_value = null)
{ {

View file

@ -31,6 +31,7 @@ class Network
* @param string $cookiejar Path to cookie jar file * @param string $cookiejar Path to cookie jar file
* *
* @return string The fetched content * @return string The fetched content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '') public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
{ {
@ -55,6 +56,7 @@ class Network
* @param string $cookiejar Path to cookie jar file * @param string $cookiejar Path to cookie jar file
* *
* @return CurlResult With all relevant information, 'body' contains the actual fetched content. * @return CurlResult With all relevant information, 'body' contains the actual fetched content.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '') public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
{ {
@ -86,6 +88,7 @@ class Network
* 'header' => header array * 'header' => header array
* *
* @return CurlResult * @return CurlResult
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function curl($url, $binary = false, &$redirects = 0, $opts = []) public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
{ {
@ -245,6 +248,7 @@ class Network
* @param integer $timeout The timeout in seconds, default system config value or 60 seconds * @param integer $timeout The timeout in seconds, default system config value or 60 seconds
* *
* @return CurlResult The content * @return CurlResult The content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function post($url, $params, $headers = null, &$redirects = 0, $timeout = 0) public static function post($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
{ {
@ -347,6 +351,7 @@ class Network
* *
* @param string $url The URL to be validated * @param string $url The URL to be validated
* @return string|boolean The actual working URL, false else * @return string|boolean The actual working URL, false else
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isUrlValid($url) public static function isUrlValid($url)
{ {
@ -378,6 +383,7 @@ class Network
* *
* @param string $addr The email address * @param string $addr The email address
* @return boolean True if it's a valid email address, false if it's not * @return boolean True if it's a valid email address, false if it's not
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isEmailDomainValid($addr) public static function isEmailDomainValid($addr)
{ {
@ -409,6 +415,7 @@ class Network
* *
* @param string $url URL which get tested * @param string $url URL which get tested
* @return boolean True if url is allowed otherwise return false * @return boolean True if url is allowed otherwise return false
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isUrlAllowed($url) public static function isUrlAllowed($url)
{ {
@ -454,6 +461,7 @@ class Network
* @param string $url The url to check the domain from * @param string $url The url to check the domain from
* *
* @return boolean * @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isUrlBlocked($url) public static function isUrlBlocked($url)
{ {
@ -483,7 +491,8 @@ class Network
* *
* @param string $email email address * @param string $email email address
* @return boolean False if not allowed, true if allowed * @return boolean False if not allowed, true if allowed
* or if allowed list is not configured * or if allowed list is not configured
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function isEmailDomainAllowed($email) public static function isEmailDomainAllowed($email)
{ {
@ -597,14 +606,15 @@ class Network
* This function strips tracking query params and follows redirections, either * This function strips tracking query params and follows redirections, either
* through HTTP code or meta refresh tags. Stops after 10 redirections. * through HTTP code or meta refresh tags. Stops after 10 redirections.
* *
* @todo Remove the $fetchbody parameter that generates an extraneous HEAD request * @todo Remove the $fetchbody parameter that generates an extraneous HEAD request
* *
* @see ParseUrl::getSiteinfo * @see ParseUrl::getSiteinfo
* *
* @param string $url A user-submitted URL * @param string $url A user-submitted URL
* @param int $depth The current redirection recursion level (internal) * @param int $depth The current redirection recursion level (internal)
* @param bool $fetchbody Wether to fetch the body or not after the HEAD requests * @param bool $fetchbody Wether to fetch the body or not after the HEAD requests
* @return string A canonical URL * @return string A canonical URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function finalUrl($url, $depth = 1, $fetchbody = false) public static function finalUrl($url, $depth = 1, $fetchbody = false)
{ {

Some files were not shown because too many files have changed in this diff Show more