mirror of
https://github.com/friendica/friendica
synced 2025-04-27 12:30:11 +00:00
Merge remote-tracking branch 'upstream/develop' into no-api-post
This commit is contained in:
commit
25992b063a
71 changed files with 5016 additions and 4336 deletions
|
@ -383,7 +383,7 @@ class APContact
|
|||
// kroeg:blocks, updated
|
||||
|
||||
// When the photo is too large, try to shorten it by removing parts
|
||||
if (strlen($apcontact['photo']) > 255) {
|
||||
if (strlen($apcontact['photo'] ?? '') > 255) {
|
||||
$parts = parse_url($apcontact['photo']);
|
||||
unset($parts['fragment']);
|
||||
$apcontact['photo'] = (string)Uri::fromParts($parts);
|
||||
|
@ -574,7 +574,7 @@ class APContact
|
|||
*
|
||||
* @param array $apcontact
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRelay(array $apcontact): bool
|
||||
{
|
||||
|
|
|
@ -1158,7 +1158,7 @@ class Contact
|
|||
|
||||
if ($sparkle) {
|
||||
$status_link = $profile_link . '/status';
|
||||
$photos_link = str_replace('/profile/', '/photos/', $profile_link);
|
||||
$photos_link = $profile_link . '/photos';
|
||||
$profile_link = $profile_link . '/profile';
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ class Item
|
|||
$fields['raw-body'] = BBCode::removeSharedData($fields['raw-body']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Post\Media::insertFromAttachmentData($item['uri-id'], $fields['body']);
|
||||
|
||||
$content_fields = ['raw-body' => trim($fields['raw-body'] ?? $fields['body'])];
|
||||
|
@ -337,7 +337,7 @@ class Item
|
|||
* generate a resource-id and therefore aren't intimately linked to the item.
|
||||
*/
|
||||
/// @TODO: this should first check if photo is used elsewhere
|
||||
if (strlen($item['resource-id'])) {
|
||||
if ($item['resource-id']) {
|
||||
Photo::delete(['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
|
||||
}
|
||||
|
||||
|
@ -2714,7 +2714,7 @@ class Item
|
|||
}
|
||||
|
||||
$condition = ['vid' => $vids, 'deleted' => false, 'gravity' => self::GRAVITY_ACTIVITY,
|
||||
'author-id' => $author_id, 'uid' => $item['uid'], 'thr-parent-id' => $uri_id];
|
||||
'author-id' => $author_id, 'uid' => $uid, 'thr-parent-id' => $uri_id];
|
||||
$like_item = Post::selectFirst(['id', 'guid', 'verb'], $condition);
|
||||
|
||||
if (DBA::isResult($like_item)) {
|
||||
|
|
|
@ -160,7 +160,7 @@ class ParsedLogIterator implements \Iterator
|
|||
* @see Iterator::next()
|
||||
* @return void
|
||||
*/
|
||||
public function next()
|
||||
public function next(): void
|
||||
{
|
||||
$parsed = $this->read();
|
||||
|
||||
|
@ -177,7 +177,7 @@ class ParsedLogIterator implements \Iterator
|
|||
* @see Iterator::rewind()
|
||||
* @return void
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->value = null;
|
||||
$this->reader->rewind();
|
||||
|
@ -200,9 +200,9 @@ class ParsedLogIterator implements \Iterator
|
|||
* Return current iterator value
|
||||
*
|
||||
* @see Iterator::current()
|
||||
* @return ?ParsedLogLing
|
||||
* @return ?ParsedLogLine
|
||||
*/
|
||||
public function current()
|
||||
public function current(): ?ParsedLogLine
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
|
|
@ -80,19 +80,17 @@ class Nodeinfo
|
|||
$config = DI::config();
|
||||
|
||||
$usage = new stdClass();
|
||||
$usage->users = [];
|
||||
$usage->users = new \stdClass;
|
||||
|
||||
if (!empty($config->get('system', 'nodeinfo'))) {
|
||||
$usage->users = [
|
||||
'total' => intval($config->get('nodeinfo', 'total_users')),
|
||||
'activeHalfyear' => intval($config->get('nodeinfo', 'active_users_halfyear')),
|
||||
'activeMonth' => intval($config->get('nodeinfo', 'active_users_monthly'))
|
||||
];
|
||||
$usage->users->total = intval($config->get('nodeinfo', 'total_users'));
|
||||
$usage->users->activeHalfyear = intval($config->get('nodeinfo', 'active_users_halfyear'));
|
||||
$usage->users->activeMonth = intval($config->get('nodeinfo', 'active_users_monthly'));
|
||||
$usage->localPosts = intval($config->get('nodeinfo', 'local_posts'));
|
||||
$usage->localComments = intval($config->get('nodeinfo', 'local_comments'));
|
||||
|
||||
if ($version2) {
|
||||
$usage->users['activeWeek'] = intval($config->get('nodeinfo', 'active_users_weekly'));
|
||||
$usage->users->activeWeek = intval($config->get('nodeinfo', 'active_users_weekly'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1130,8 +1130,8 @@ class Photo
|
|||
$picture['height'] = $photo['height'];
|
||||
$picture['type'] = $photo['type'];
|
||||
$picture['albumpage'] = DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $resource_id;
|
||||
$picture['picture'] = DI::baseUrl() . '/photo/{$resource_id}-0.' . $image->getExt();
|
||||
$picture['preview'] = DI::baseUrl() . '/photo/{$resource_id}-{$smallest}.' . $image->getExt();
|
||||
$picture['picture'] = DI::baseUrl() . '/photo/' . $resource_id . '-0.' . $image->getExt();
|
||||
$picture['preview'] = DI::baseUrl() . '/photo/' . $resource_id . '-' . $smallest . '.' . $image->getExt();
|
||||
|
||||
Logger::info('upload done', ['picture' => $picture]);
|
||||
return $picture;
|
||||
|
@ -1272,4 +1272,3 @@ class Photo
|
|||
return $resource_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ class Media
|
|||
if (!empty($contact['gsid'])) {
|
||||
$gserver = DBA::selectFirst('gserver', ['url', 'site_name'], ['id' => $contact['gsid']]);
|
||||
}
|
||||
|
||||
|
||||
$media['type'] = self::ACTIVITY;
|
||||
$media['media-uri-id'] = $item['uri-id'];
|
||||
$media['height'] = null;
|
||||
|
@ -687,7 +687,7 @@ class Media
|
|||
$previews[] = $medium['preview'];
|
||||
}
|
||||
|
||||
$type = explode('/', current(explode(';', $medium['mimetype'])));
|
||||
$type = explode('/', explode(';', $medium['mimetype'])[0]);
|
||||
if (count($type) < 2) {
|
||||
Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]);
|
||||
$filetype = 'unkn';
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -113,21 +114,27 @@ class Register
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a register record for approval and returns the success of the database insert
|
||||
* Creates a register record for approval
|
||||
* Checks for the existence of the provided user id
|
||||
*
|
||||
* @param integer $uid The ID of the user needing approval
|
||||
* @param string $language The registration language
|
||||
* @param string $note An additional message from the user
|
||||
* @return boolean
|
||||
* @throws \Exception
|
||||
* @param integer $uid The ID of the user needing approval
|
||||
* @param string $language The registration language
|
||||
* @param string $note An additional message from the user
|
||||
* @return void
|
||||
* @throws \OutOfBoundsException
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws HTTPException\NotFoundException
|
||||
*/
|
||||
public static function createForApproval(int $uid, string $language, string $note = ''): bool
|
||||
public static function createForApproval(int $uid, string $language, string $note = ''): void
|
||||
{
|
||||
$hash = Strings::getRandomHex();
|
||||
|
||||
if (!$uid) {
|
||||
throw new \OutOfBoundsException("User ID can't be empty");
|
||||
}
|
||||
|
||||
if (!User::exists($uid)) {
|
||||
return false;
|
||||
throw new HTTPException\NotFoundException("User ID doesn't exist");
|
||||
}
|
||||
|
||||
$fields = [
|
||||
|
@ -139,7 +146,9 @@ class Register
|
|||
'note' => $note
|
||||
];
|
||||
|
||||
return DBA::insert('register', $fields);
|
||||
if (!DBA::insert('register', $fields)) {
|
||||
throw new HTTPException\InternalServerErrorException('Unable to insert a `register` record');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue