Merge pull request #7192 from nupplaphil/bug/edit_images

Make edits of images possible again
This commit is contained in:
Hypolite Petovan 2019-05-26 15:21:10 -04:00 committed by GitHub
commit 1610848e65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,8 +29,8 @@ use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map; use Friendica\Util\Map;
use Friendica\Util\Security; use Friendica\Util\Security;
use Friendica\Util\Temporal;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use Friendica\Util\XML; use Friendica\Util\XML;
function photos_init(App $a) { function photos_init(App $a) {
@ -315,7 +315,7 @@ function photos_post(App $a)
$str_group_deny = !empty($_POST['group_deny']) ? perms2str($_POST['group_deny']) : ''; $str_group_deny = !empty($_POST['group_deny']) ? perms2str($_POST['group_deny']) : '';
$str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : ''; $str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
$resource_id = $a->argv[2]; $resource_id = $a->argv[3];
if (!strlen($albname)) { if (!strlen($albname)) {
$albname = DateTimeFormat::localNow('Y'); $albname = DateTimeFormat::localNow('Y');
@ -418,10 +418,11 @@ function photos_post(App $a)
if ($item_id) { if ($item_id) {
$item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]); $item = Item::selectFirst(['tag', 'inform'], ['id' => $item_id, 'uid' => $page_owner_uid]);
}
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
$old_tag = $item['tag']; $old_tag = $item['tag'];
$old_inform = $item['inform']; $old_inform = $item['inform'];
}
} }
if (strlen($rawtags)) { if (strlen($rawtags)) {
@ -524,13 +525,13 @@ function photos_post(App $a)
} }
} }
$newtag = $old_tag; $newtag = $old_tag ?? '';
if (strlen($newtag) && strlen($str_tags)) { if (strlen($newtag) && strlen($str_tags)) {
$newtag .= ','; $newtag .= ',';
} }
$newtag .= $str_tags; $newtag .= $str_tags;
$newinform = $old_inform; $newinform = $old_inform ?? '';
if (strlen($newinform) && strlen($inform)) { if (strlen($newinform) && strlen($inform)) {
$newinform .= ','; $newinform .= ',';
} }
@ -735,7 +736,7 @@ function photos_post(App $a)
@unlink($src); @unlink($src);
$foo = 0; $foo = 0;
Hook::callAll('photo_post_end',$foo); Hook::callAll('photo_post_end',$foo);
exit(); return;
} }
$exif = $image->orient($src); $exif = $image->orient($src);
@ -761,7 +762,7 @@ function photos_post(App $a)
if (!$r) { if (!$r) {
Logger::log('mod/photos.php: photos_post(): image store failed', Logger::DEBUG); Logger::log('mod/photos.php: photos_post(): image store failed', Logger::DEBUG);
notice(L10n::t('Image upload failed.') . EOL); notice(L10n::t('Image upload failed.') . EOL);
exit(); return;
} }
if ($width > 640 || $height > 640) { if ($width > 640 || $height > 640) {