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 = '';
$photo_return = $_SESSION['photo_return'] ?? '';
if (!local_user()) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($photo_return);
// NOTREACHED
}
if ($a->argc == 3) {
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);
if (!$item_id) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($photo_return);
// NOTREACHED
}
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
if (!DBA::isResult($item)) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($photo_return);
}
$tag_text = Tag::getCSVByURIId($item['uri-id']);
@ -107,7 +109,7 @@ function tagrm_content(App $a)
$arr = explode(',', $tag_text);
if (empty($arr)) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($photo_return);
}
$o .= '<h3>' . DI::l10n()->t('Remove Item Tag') . '</h3>';