1
0
Fork 0

Fixed issues by php-cs

This commit is contained in:
Roland Häder 2022-10-25 23:07:49 +02:00
parent ceffd0ef6c
commit 039a4b8c72
Signed by: roland
GPG key ID: C82EDE5DDFA0BA77
2 changed files with 20 additions and 20 deletions

View file

@ -33,7 +33,7 @@ function wall_attach_post(App $a)
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
if (DI::args()->getArgc() > 1) {
$nick = DI::args()->getArgv()[1];
$nick = DI::args()->getArgv()[1];
$owner = User::getOwnerDataByNick($nick);
if (!DBA::isResult($owner)) {
Logger::warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
@ -51,7 +51,7 @@ function wall_attach_post(App $a)
return;
}
$can_post = false;
$can_post = false;
$page_owner_uid = $owner['uid'];
$page_owner_cid = $owner['id'];
@ -61,7 +61,7 @@ function wall_attach_post(App $a)
$can_post = true;
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
}
if (!$can_post) {
@ -92,7 +92,7 @@ function wall_attach_post(App $a)
* Then Filesize gets <= 0.
*/
if ($fileSize <= 0) {
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' .(DI::l10n()->t('Or - did you try to upload an empty file?'));
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' . DI::l10n()->t('Or - did you try to upload an empty file?');
Logger::warning($msg, ['fileSize' => $fileSize]);
@unlink($tempFileName);
if ($isJson) {
@ -120,7 +120,7 @@ function wall_attach_post(App $a)
@unlink($tempFileName);
if ($newid === false) {
$msg = DI::l10n()->t('File upload failed.');
$msg = DI::l10n()->t('File upload failed.');
Logger::warning($msg);
if ($isJson) {
System::jsonExit(['error' => $msg]);

View file

@ -42,7 +42,7 @@ function wall_upload_post(App $a, $desktopmode = true)
Logger::info('wall upload: starting new upload');
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
$album = trim($_GET['album'] ?? '');
if (DI::args()->getArgc() > 1) {
if (empty($_FILES['media'])) {
@ -69,20 +69,20 @@ function wall_upload_post(App $a, $desktopmode = true)
/*
* Setup permissions structures
*/
$can_post = false;
$visitor = 0;
$can_post = false;
$visitor = 0;
$page_owner_uid = $user['uid'];
$default_cid = $user['id'];
$page_owner_nick = $user['nickname'];
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
$page_owner_uid = $user['uid'];
$default_cid = $user['id'];
$page_owner_nick = $user['nickname'];
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
$can_post = true;
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
$visitor = $contact_id;
}
if (!$can_post) {
@ -103,7 +103,7 @@ function wall_upload_post(App $a, $desktopmode = true)
System::exit();
}
$src = '';
$src = '';
$filename = '';
$filesize = 0;
$filetype = '';
@ -160,14 +160,14 @@ function wall_upload_post(App $a, $desktopmode = true)
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
Logger::info('File upload:', [
'src' => $src,
'src' => $src,
'filename' => $filename,
'filesize' => $filesize,
'filetype' => $filetype,
]);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $filetype);
$image = new Image($imagedata, $filetype);
if (!$image->isValid()) {
$msg = DI::l10n()->t('Unable to process image.');
@ -191,7 +191,7 @@ function wall_upload_post(App $a, $desktopmode = true)
Logger::info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
}
$width = $image->getWidth();
$width = $image->getWidth();
$height = $image->getHeight();
$maximagesize = DI::config()->get('system', 'maximagesize');
@ -203,8 +203,8 @@ function wall_upload_post(App $a, $desktopmode = true)
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
$image->scaleDown($pixels);
$filesize = strlen($image->asString());
$width = $image->getWidth();
$height = $image->getHeight();
$width = $image->getWidth();
$height = $image->getHeight();
}
}
if ($filesize > $maximagesize) {