Fixed issues by php-cs
This commit is contained in:
parent
ceffd0ef6c
commit
039a4b8c72
2 changed files with 20 additions and 20 deletions
|
@ -33,7 +33,7 @@ function wall_attach_post(App $a)
|
||||||
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
||||||
|
|
||||||
if (DI::args()->getArgc() > 1) {
|
if (DI::args()->getArgc() > 1) {
|
||||||
$nick = DI::args()->getArgv()[1];
|
$nick = DI::args()->getArgv()[1];
|
||||||
$owner = User::getOwnerDataByNick($nick);
|
$owner = User::getOwnerDataByNick($nick);
|
||||||
if (!DBA::isResult($owner)) {
|
if (!DBA::isResult($owner)) {
|
||||||
Logger::warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
|
Logger::warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
|
||||||
|
@ -51,7 +51,7 @@ function wall_attach_post(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$can_post = false;
|
$can_post = false;
|
||||||
|
|
||||||
$page_owner_uid = $owner['uid'];
|
$page_owner_uid = $owner['uid'];
|
||||||
$page_owner_cid = $owner['id'];
|
$page_owner_cid = $owner['id'];
|
||||||
|
@ -61,7 +61,7 @@ function wall_attach_post(App $a)
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
||||||
$contact_id = 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) {
|
if (!$can_post) {
|
||||||
|
@ -92,7 +92,7 @@ function wall_attach_post(App $a)
|
||||||
* Then Filesize gets <= 0.
|
* Then Filesize gets <= 0.
|
||||||
*/
|
*/
|
||||||
if ($fileSize <= 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]);
|
Logger::warning($msg, ['fileSize' => $fileSize]);
|
||||||
@unlink($tempFileName);
|
@unlink($tempFileName);
|
||||||
if ($isJson) {
|
if ($isJson) {
|
||||||
|
@ -120,7 +120,7 @@ function wall_attach_post(App $a)
|
||||||
@unlink($tempFileName);
|
@unlink($tempFileName);
|
||||||
|
|
||||||
if ($newid === false) {
|
if ($newid === false) {
|
||||||
$msg = DI::l10n()->t('File upload failed.');
|
$msg = DI::l10n()->t('File upload failed.');
|
||||||
Logger::warning($msg);
|
Logger::warning($msg);
|
||||||
if ($isJson) {
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
|
|
|
@ -42,7 +42,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
Logger::info('wall upload: starting new upload');
|
Logger::info('wall upload: starting new upload');
|
||||||
|
|
||||||
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
||||||
$album = trim($_GET['album'] ?? '');
|
$album = trim($_GET['album'] ?? '');
|
||||||
|
|
||||||
if (DI::args()->getArgc() > 1) {
|
if (DI::args()->getArgc() > 1) {
|
||||||
if (empty($_FILES['media'])) {
|
if (empty($_FILES['media'])) {
|
||||||
|
@ -69,20 +69,20 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
/*
|
/*
|
||||||
* Setup permissions structures
|
* Setup permissions structures
|
||||||
*/
|
*/
|
||||||
$can_post = false;
|
$can_post = false;
|
||||||
$visitor = 0;
|
$visitor = 0;
|
||||||
|
|
||||||
$page_owner_uid = $user['uid'];
|
$page_owner_uid = $user['uid'];
|
||||||
$default_cid = $user['id'];
|
$default_cid = $user['id'];
|
||||||
$page_owner_nick = $user['nickname'];
|
$page_owner_nick = $user['nickname'];
|
||||||
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
|
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
|
||||||
|
|
||||||
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
|
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
||||||
$contact_id = 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]);
|
||||||
$visitor = $contact_id;
|
$visitor = $contact_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$can_post) {
|
if (!$can_post) {
|
||||||
|
@ -103,7 +103,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$src = '';
|
$src = '';
|
||||||
$filename = '';
|
$filename = '';
|
||||||
$filesize = 0;
|
$filesize = 0;
|
||||||
$filetype = '';
|
$filetype = '';
|
||||||
|
@ -160,14 +160,14 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
||||||
|
|
||||||
Logger::info('File upload:', [
|
Logger::info('File upload:', [
|
||||||
'src' => $src,
|
'src' => $src,
|
||||||
'filename' => $filename,
|
'filename' => $filename,
|
||||||
'filesize' => $filesize,
|
'filesize' => $filesize,
|
||||||
'filetype' => $filetype,
|
'filetype' => $filetype,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$image = new Image($imagedata, $filetype);
|
$image = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (!$image->isValid()) {
|
if (!$image->isValid()) {
|
||||||
$msg = DI::l10n()->t('Unable to process image.');
|
$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]);
|
Logger::info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
|
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
$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]);
|
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
|
||||||
$image->scaleDown($pixels);
|
$image->scaleDown($pixels);
|
||||||
$filesize = strlen($image->asString());
|
$filesize = strlen($image->asString());
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($filesize > $maximagesize) {
|
if ($filesize > $maximagesize) {
|
||||||
|
|
Loading…
Reference in a new issue