Ensure photo_return string is set in tagrm_content

- Address https://github.com/friendica/friendica/issues/10169#issuecomment-835546485
This commit is contained in:
Hypolite Petovan 2021-05-31 01:22:07 -04:00
parent 57d5a47042
commit e42a9254c0

View file

@ -81,25 +81,27 @@ function tagrm_content(App $a)
{ {
$o = ''; $o = '';
$photo_return = $_SESSION['photo_return'] ?? '';
if (!local_user()) { if (!local_user()) {
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($photo_return);
// NOTREACHED // NOTREACHED
} }
if ($a->argc == 3) { if ($a->argc == 3) {
update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]); update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]);
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($photo_return);
} }
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if (!$item_id) { if (!$item_id) {
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($photo_return);
// NOTREACHED // NOTREACHED
} }
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]); $item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($photo_return);
} }
$tag_text = Tag::getCSVByURIId($item['uri-id']); $tag_text = Tag::getCSVByURIId($item['uri-id']);
@ -107,7 +109,7 @@ function tagrm_content(App $a)
$arr = explode(',', $tag_text); $arr = explode(',', $tag_text);
if (empty($arr)) { if (empty($arr)) {
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($photo_return);
} }
$o .= '<h3>' . DI::l10n()->t('Remove Item Tag') . '</h3>'; $o .= '<h3>' . DI::l10n()->t('Remove Item Tag') . '</h3>';