Merge remote-tracking branch 'upstream/2023.03-rc' into npf2

This commit is contained in:
Michael 2023-03-27 06:42:24 +00:00
commit c4c80ed3cc
266 changed files with 691 additions and 643 deletions

View file

@ -32,7 +32,7 @@ use Friendica\Util\Mimetype;
use Friendica\Security\Security;
/**
* Class to handle attach dabatase table
* Class to handle attach database table
*/
class Attach
{
@ -107,7 +107,7 @@ class Attach
}
/**
* Retrive a single record given the ID
* Retrieve a single record given the ID
*
* @param int $id Row id of the record
*
@ -122,7 +122,7 @@ class Attach
}
/**
* Retrive a single record given the ID
* Retrieve a single record given the ID
*
* @param int $id Row id of the record
*
@ -192,7 +192,7 @@ class Attach
* @param string $allow_cid Permissions, allowed contacts. optional, default = ''
* @param string $allow_gid Permissions, allowed groups. optional, default = ''
* @param string $deny_cid Permissions, denied contacts.optional, default = ''
* @param string $deny_gid Permissions, denied greoup.optional, default = ''
* @param string $deny_gid Permissions, denied group.optional, default = ''
*
* @return boolean|integer Row id on success, False on errors
* @throws \Friendica\Network\HTTPException\InternalServerErrorException

View file

@ -239,7 +239,7 @@ class Contact
* @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, false = don't update identical fields)
*
* @return boolean was the update successfull?
* @return boolean was the update successful?
* @throws \Exception
* @todo Let's get rid of boolean type of $old_fields
*/
@ -1686,7 +1686,7 @@ class Contact
* Unblocks a contact
*
* @param int $cid Contact id to unblock
* @return bool Whether it was successfull
* @return bool Whether it was successful
*/
public static function unblock(int $cid): bool
{
@ -1733,7 +1733,7 @@ class Contact
*
* @param array $contact contact array
* @param string $size Size of the avatar picture
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @param bool $no_update Don't perform an update if no cached avatar was found
* @return string photo path
*/
private static function getAvatarPath(array $contact, string $size, bool $no_update = false): string
@ -1767,7 +1767,7 @@ class Contact
* Return the photo path for a given contact array
*
* @param array $contact Contact array
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @param bool $no_update Don't perform an update if no cached avatar was found
* @return string photo path
*/
public static function getPhoto(array $contact, bool $no_update = false): string
@ -1779,7 +1779,7 @@ class Contact
* Return the photo path (thumb size) for a given contact array
*
* @param array $contact Contact array
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @param bool $no_update Don't perform an update if no cached avatar was found
* @return string photo path
*/
public static function getThumb(array $contact, bool $no_update = false): string
@ -1791,7 +1791,7 @@ class Contact
* Return the photo path (micro size) for a given contact array
*
* @param array $contact Contact array
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @param bool $no_update Don't perform an update if no cached avatar was found
* @return string photo path
*/
public static function getMicro(array $contact, bool $no_update = false): string
@ -1803,7 +1803,7 @@ class Contact
* Check the given contact array for avatar cache fields
*
* @param array $contact
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @param bool $no_update Don't perform an update if no cached avatar was found
* @return array contact array with avatar cache fields
*/
private static function checkAvatarCacheByArray(array $contact, bool $no_update = false): array

View file

@ -49,7 +49,7 @@ class Conversation
*/
const UNKNOWN = 0;
/**
* The message had been pushed to this sytem
* The message had been pushed to this system
*/
const PUSH = 1;
/**

View file

@ -656,7 +656,7 @@ class Event
}
// Show edit and drop actions only if the user is the owner of the event and the event
// is a real event (no bithdays).
// is a real event (no birthdays).
$edit = null;
$copy = null;
$drop = null;

View file

@ -92,7 +92,7 @@ class GServer
const DETECT_NODEINFO_210 = 103;
/**
* Check for the existance of a server and adds it in the background if not existant
* Check for the existence of a server and adds it in the background if not existant
*
* @param string $url
* @param boolean $only_nodeinfo
@ -327,7 +327,7 @@ class GServer
return DateTimeFormat::utc('now +1 month');
}
// The system hadn't been successul contacted for more than a month, so try again in three months
// The system hadn't been successful contacted for more than a month, so try again in three months
return DateTimeFormat::utc('now +3 month');
}
@ -557,7 +557,7 @@ class GServer
return false;
}
// If the URL missmatches, then we mark the old entry as failure
// If the URL mismatches, then we mark the old entry as failure
if (!Strings::compareLink($url, $original_url)) {
self::setFailureByUrl($original_url);
if (!self::getID($url, true) && !Network::isUrlBlocked($url)) {
@ -675,7 +675,7 @@ class GServer
}
// All following checks are done for systems that always have got a "host-meta" endpoint.
// With this check we don't have to waste time and ressources for dead systems.
// With this check we don't have to waste time and resources for dead systems.
// Also this hopefully prevents us from receiving abuse messages.
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
$validHostMeta = self::validHostMeta($url);
@ -2437,7 +2437,7 @@ class GServer
}
}
// Disvover Mastodon servers
// Discover Mastodon servers
$accesstoken = DI::config()->get('system', 'instances_social_key');
if (!empty($accesstoken)) {

View file

@ -60,7 +60,7 @@ class Group
/**
* Checks whether given group id is found in database
*
* @param int $group_id Groupd it
* @param int $group_id Group id
* @param int $uid Optional user id
* @return bool
* @throws \Exception

View file

@ -233,7 +233,7 @@ class Item
Post\Media::insertFromAttachment($item['uri-id'], $fields['attach']);
}
// We only need to notfiy others when it is an original entry from us.
// We only need to notify others when it is an original entry from us.
// Only call the notifier when the item had been edited and records had been changed.
if ($item['origin'] && !empty($fields['edited']) && ($previous['edited'] != $fields['edited'])) {
$notify_items[] = $item['id'];
@ -875,7 +875,7 @@ class Item
/*
* Do we already have this item?
* We have to check several networks since Friendica posts could be repeated
* via OStatus (maybe Diasporsa as well)
* via OStatus (maybe Diaspora as well)
*/
$duplicate = self::getDuplicateID($item);
if ($duplicate) {
@ -892,6 +892,8 @@ class Item
$item['post-type'] = empty($item['title']) ? self::PT_NOTE : self::PT_ARTICLE;
}
$defined_permissions = isset($item['allow_cid']) && isset($item['allow_gid']) && isset($item['deny_cid']) && isset($item['deny_gid']) && isset($item['private']);
$item['wall'] = intval($item['wall'] ?? 0);
$item['extid'] = trim($item['extid'] ?? '');
$item['author-name'] = trim($item['author-name'] ?? '');
@ -931,7 +933,7 @@ class Item
$item['inform'] = trim($item['inform'] ?? '');
$item['file'] = trim($item['file'] ?? '');
// Communities aren't working with the Diaspora protoccol
// Communities aren't working with the Diaspora protocol
if (($uid != 0) && ($item['network'] == Protocol::DIASPORA)) {
$user = User::getById($uid, ['account-type']);
if ($user['account-type'] == Contact::TYPE_COMMUNITY) {
@ -993,7 +995,7 @@ class Item
$item['wall'] = $toplevel_parent['wall'];
// Reshares have to keep their permissions to allow forums to work
if (!$item['origin'] || ($item['verb'] != Activity::ANNOUNCE)) {
if (!$defined_permissions && (!$item['origin'] || ($item['verb'] != Activity::ANNOUNCE))) {
$item['allow_cid'] = $toplevel_parent['allow_cid'];
$item['allow_gid'] = $toplevel_parent['allow_gid'];
$item['deny_cid'] = $toplevel_parent['deny_cid'];
@ -1016,7 +1018,7 @@ class Item
* This differs from the above settings as it subtly allows comments from
* email correspondents to be private even if the overall thread is not.
*/
if ($toplevel_parent['private']) {
if (!$defined_permissions && $toplevel_parent['private']) {
$item['private'] = $toplevel_parent['private'];
}
@ -1063,7 +1065,7 @@ class Item
}
// ACL settings
if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {
if (!$defined_permissions && !empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {
$item['private'] = self::PRIVATE;
}
@ -1497,7 +1499,7 @@ class Item
$users = [];
/// @todo add a field "pcid" in the contact table that referrs to the public contact id.
/// @todo add a field "pcid" in the contact table that refers to the public contact id.
$owner = DBA::selectFirst('contact', ['url', 'nurl', 'alias'], ['id' => $parent['owner-id']]);
if (!DBA::isResult($owner)) {
return;
@ -2499,12 +2501,12 @@ class Item
*/
public static function enumeratePermissions(array $obj, bool $check_dead = false): array
{
$aclFormater = DI::aclFormatter();
$aclFormatter = DI::aclFormatter();
$allow_people = $aclFormater->expand($obj['allow_cid']);
$allow_groups = Group::expand($obj['uid'], $aclFormater->expand($obj['allow_gid']), $check_dead);
$deny_people = $aclFormater->expand($obj['deny_cid']);
$deny_groups = Group::expand($obj['uid'], $aclFormater->expand($obj['deny_gid']), $check_dead);
$allow_people = $aclFormatter->expand($obj['allow_cid']);
$allow_groups = Group::expand($obj['uid'], $aclFormatter->expand($obj['allow_gid']), $check_dead);
$deny_people = $aclFormatter->expand($obj['deny_cid']);
$deny_groups = Group::expand($obj['uid'], $aclFormatter->expand($obj['deny_gid']), $check_dead);
$recipients = array_unique(array_merge($allow_people, $allow_groups));
$deny = array_unique(array_merge($deny_people, $deny_groups));
$recipients = array_diff($recipients, $deny);
@ -2613,7 +2615,7 @@ class Item
* Activity verb. One of
* like, unlike, dislike, undislike, attendyes, unattendyes,
* attendno, unattendno, attendmaybe, unattendmaybe,
* announce, unannouce
* announce, unannounce
* @param int $uid
* @param string $allow_cid
* @param string $allow_gid

View file

@ -25,7 +25,7 @@ use Friendica\Util\ReversedFileReader;
use Friendica\Object\Log\ParsedLogLine;
/**
* An iterator which returns `\Friendica\Objec\Log\ParsedLogLine` instances
* An iterator which returns `\Friendica\Object\Log\ParsedLogLine` instances
*
* Uses `\Friendica\Util\ReversedFileReader` to fetch log lines
* from newest to oldest.

View file

@ -67,7 +67,7 @@ class Nodeinfo
DI::keyValue()->set('nodeinfo_local_posts', $posts);
DI::keyValue()->set('nodeinfo_local_comments', $comments);
$logger->info('User actitivy', ['posts' => $posts, 'comments' => $comments]);
$logger->info('User activity', ['posts' => $posts, 'comments' => $comments]);
}
/**

View file

@ -58,7 +58,7 @@ class OpenWebAuthToken
* @param int $uid The user ID.
* @param string $token
*
* @return string|boolean The meta enry or false if not found.
* @return string|boolean The meta entry or false if not found.
* @throws \Exception
*/
public static function getMeta(string $type, int $uid, string $token)

View file

@ -41,7 +41,7 @@ use Friendica\Util\Proxy;
use Friendica\Util\Strings;
/**
* Class to handle photo dabatase table
* Class to handle photo database table
*/
class Photo
{
@ -101,7 +101,7 @@ class Photo
* Get photos for user id
*
* @param integer $uid User id
* @param string $resourceid Rescource ID of the photo
* @param string $resourceid Resource ID of the photo
* @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters
*
@ -122,7 +122,7 @@ class Photo
* Get a photo for user id
*
* @param integer $uid User id
* @param string $resourceid Rescource ID of the photo
* @param string $resourceid Resource ID of the photo
* @param integer $scale Scale of the photo. Defaults to 0
* @param array $conditions Array of fields for conditions
* @param array $params Array of several parameters
@ -148,7 +148,7 @@ class Photo
* on success, "no sign" image info, if user has no permission,
* false if photo does not exists
*
* @param string $resourceid Rescource ID of the photo
* @param string $resourceid Resource ID of the photo
* @param integer $scale Scale of the photo. Defaults to 0
* @param integer $visitor_uid UID of the visitor
*
@ -416,7 +416,7 @@ class Photo
* @param string $allow_cid Permissions, allowed contacts. optional, default = ""
* @param string $allow_gid Permissions, allowed groups. optional, default = ""
* @param string $deny_cid Permissions, denied contacts.optional, default = ""
* @param string $deny_gid Permissions, denied greoup.optional, default = ""
* @param string $deny_gid Permissions, denied group.optional, default = ""
* @param string $desc Photo caption. optional, default = ""
*
* @return boolean True on success
@ -536,7 +536,7 @@ class Photo
* @param Image $image Image to update. Optional, default null.
* @param array $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?
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @see \Friendica\Database\DBA::update
@ -881,14 +881,14 @@ class Photo
* Then set the permissions to public.
*/
self::setPermissionForRessource($image_rid, $uid, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
self::setPermissionForResource($image_rid, $uid, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
}
return true;
}
/**
* Add permissions to photo ressource
* Add permissions to photo resource
* @todo mix with previous photo permissions
*
* @param string $image_rid
@ -899,7 +899,7 @@ class Photo
* @param string $str_group_deny
* @return void
*/
public static function setPermissionForRessource(string $image_rid, int $uid, string $str_contact_allow, string $str_group_allow, string $str_contact_deny, string $str_group_deny)
public static function setPermissionForResource(string $image_rid, int $uid, string $str_contact_allow, string $str_group_allow, string $str_contact_deny, string $str_group_deny)
{
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,

View file

@ -58,7 +58,7 @@ class Link
* @param int $uriId
* @param string $url
* @param string $size
* @return string Found link URL + id on success, $url on failture
* @return string Found link URL + id on success, $url on failure
*/
public static function getByLink(int $uriId, string $url, string $size = ''): string
{

View file

@ -455,7 +455,7 @@ class Media
}
/**
* Tests for path patterns that are usef for picture links in Friendica
* Tests for path patterns that are used for picture links in Friendica
*
* @param string $page Link to the image page
* @param string $preview Preview picture
@ -467,7 +467,7 @@ class Media
}
/**
* Tests for path patterns that are usef for picture links in Friendica
* Tests for path patterns that are used for picture links in Friendica
*
* @param string $page Link to the image page
* @param string $preview Preview picture

View file

@ -529,7 +529,7 @@ class User
// Addons can create users, and since this 'catch' branch should only
// execute if getAuthenticationInfo can't find an existing user, that's
// exactly what will happen here. Creating a numeric username would create
// abiguity with user IDs, possibly opening up an attack vector.
// ambiguity with user IDs, possibly opening up an attack vector.
// So let's be very careful about that.
if (empty($username) || is_numeric($username)) {
throw $e;
@ -684,7 +684,7 @@ class User
if ($user['last-activity'] != $current_day) {
User::update(['last-activity' => $current_day], $uid);
// Set the last actitivy for all identities of the user
// Set the last activity for all identities of the user
DBA::update('user', ['last-activity' => $current_day], ['parent-uid' => $uid, 'account_removed' => false]);
}
}
@ -816,14 +816,14 @@ class User
* Empties the password reset token field just in case.
*
* @param int $uid
* @param string $pasword_hashed
* @param string $password_hashed
* @return bool
* @throws Exception
*/
private static function updatePasswordHashed(int $uid, string $pasword_hashed): bool
private static function updatePasswordHashed(int $uid, string $password_hashed): bool
{
$fields = [
'password' => $pasword_hashed,
'password' => $password_hashed,
'pwdreset' => null,
'pwdreset_time' => null,
'legacy_password' => false
@ -851,7 +851,7 @@ class User
* Checks if a nickname is in the list of the forbidden nicknames
*
* Check if a nickname is forbidden from registration on the node by the
* admin. Forbidden nicknames (e.g. role namess) can be configured in the
* admin. Forbidden nicknames (e.g. role names) can be configured in the
* admin panel.
*
* @param string $nickname The nickname that should be checked
@ -1232,7 +1232,7 @@ class User
$resource_id = Photo::newResource();
// Not using Photo::PROFILE_PHOTOS here, so that it is discovered as translateble string
// Not using Photo::PROFILE_PHOTOS here, so that it is discovered as translatable string
$profile_album = DI::l10n()->t('Profile Photos');
$r = Photo::store($image, $uid, 0, $resource_id, $filename, $profile_album, 4);
@ -1377,7 +1377,7 @@ class User
* permanently against re-registration, as the person was not yet
* allowed to have friends on this system
*
* @return bool True, if the deny was successfull
* @return bool True, if the deny was successful
* @throws Exception
*/
public static function deny(string $hash): bool
@ -1792,7 +1792,7 @@ class User
*
* @param int $start Start count (Default is 0)
* @param int $count Count of the items per page (Default is @see Pager::ITEMS_PER_PAGE)
* @param string $type The type of users, which should get (all, bocked, removed)
* @param string $type The type of users, which should get (all, blocked, removed)
* @param string $order Order of the user list (Default is 'contact.name')
* @param bool $descending Order direction (Default is ascending)
* @return array|bool The list of the users