Merge pull request #5774 from JonnyTischbein/form_return_path
Calculate form return_url for post and message instead of using SESSION Variable
This commit is contained in:
commit
d039d95106
3 changed files with 9 additions and 3 deletions
|
@ -21,12 +21,18 @@ function editpost_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||||
|
$return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : '');
|
||||||
|
|
||||||
if (!$post_id) {
|
if (!$post_id) {
|
||||||
notice(L10n::t('Item not found') . EOL);
|
notice(L10n::t('Item not found') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to SESSION return_path
|
||||||
|
if (empty($return_url)) {
|
||||||
|
$return_url = $_SESSION['return_path'];
|
||||||
|
}
|
||||||
|
|
||||||
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||||
'type', 'body', 'title', 'file', 'wall', 'post-type'];
|
'type', 'body', 'title', 'file', 'wall', 'post-type'];
|
||||||
|
|
||||||
|
@ -95,7 +101,7 @@ function editpost_content(App $a)
|
||||||
|
|
||||||
$o .= replace_macros($tpl, [
|
$o .= replace_macros($tpl, [
|
||||||
'$is_edit' => true,
|
'$is_edit' => true,
|
||||||
'$return_path' => $_SESSION['return_url'],
|
'$return_path' => $return_url,
|
||||||
'$action' => 'item',
|
'$action' => 'item',
|
||||||
'$share' => L10n::t('Save'),
|
'$share' => L10n::t('Save'),
|
||||||
'$upload' => L10n::t('Upload photo'),
|
'$upload' => L10n::t('Upload photo'),
|
||||||
|
|
|
@ -92,7 +92,7 @@ function message_post(App $a)
|
||||||
$a->argc = 2;
|
$a->argc = 2;
|
||||||
$a->argv[1] = 'new';
|
$a->argv[1] = 'new';
|
||||||
} else {
|
} else {
|
||||||
goaway($_SESSION['return_url']);
|
goaway($a->cmd . '/' . $ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Post extends BaseObject
|
||||||
if ($item["event-id"] != 0) {
|
if ($item["event-id"] != 0) {
|
||||||
$edpost = ["events/event/" . $item['event-id'], L10n::t("Edit")];
|
$edpost = ["events/event/" . $item['event-id'], L10n::t("Edit")];
|
||||||
} else {
|
} else {
|
||||||
$edpost = ["editpost/" . $item['id'], L10n::t("Edit")];
|
$edpost = ["editpost/" . $item['id'] . "/" . base64_encode($a->cmd), L10n::t("Edit")];
|
||||||
}
|
}
|
||||||
$dropping = in_array($item['uid'], [0, local_user()]);
|
$dropping = in_array($item['uid'], [0, local_user()]);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue