$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]);
return;
}
- $can_post = false;
+ $can_post = false;
$page_owner_uid = $owner['uid'];
$page_owner_cid = $owner['id'];
$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) {
* 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) {
@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]);
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'])) {
/*
* 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) {
System::exit();
}
- $src = '';
+ $src = '';
$filename = '';
$filesize = 0;
$filetype = '';
$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.');
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');
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) {