calculate form return_url for post and message instead of using SESSION var

This commit is contained in:
Jonny Tischbein
2018-09-19 23:55:29 +02:00
parent 68c6895e1a
commit 807ad14521
3 changed files with 9 additions and 3 deletions

View File

@@ -21,12 +21,18 @@ function editpost_content(App $a)
}
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
$return_url = (($a->argc > 1) ? base64_decode($a->argv[2]) : '');
if (!$post_id) {
notice(L10n::t('Item not found') . EOL);
return;
}
// Fallback to SESSION return_path
if (empty($return_url)) {
$return_url = $_SESSION['return_path'];
}
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'type', 'body', 'title', 'file', 'wall', 'post-type'];
@@ -95,7 +101,7 @@ function editpost_content(App $a)
$o .= replace_macros($tpl, [
'$is_edit' => true,
'$return_path' => $_SESSION['return_url'],
'$return_path' => $return_url,
'$action' => 'item',
'$share' => L10n::t('Save'),
'$upload' => L10n::t('Upload photo'),