mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Normalize redirect in item_post()
This commit is contained in:
parent
694d93ded9
commit
c17b2efb7a
1 changed files with 10 additions and 8 deletions
14
mod/item.php
14
mod/item.php
|
@ -119,7 +119,7 @@ function item_post(App $a) {
|
||||||
|
|
||||||
if (!DBA::isResult($toplevel_item)) {
|
if (!DBA::isResult($toplevel_item)) {
|
||||||
notice(DI::l10n()->t('Unable to locate original post.') . EOL);
|
notice(DI::l10n()->t('Unable to locate original post.') . EOL);
|
||||||
if (!empty($_REQUEST['return'])) {
|
if ($return_path) {
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
|
@ -166,8 +166,7 @@ function item_post(App $a) {
|
||||||
// Now check that valid personal details have been provided
|
// Now check that valid personal details have been provided
|
||||||
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
|
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
|
||||||
notice(DI::l10n()->t('Permission denied.') . EOL);
|
notice(DI::l10n()->t('Permission denied.') . EOL);
|
||||||
|
if ($return_path) {
|
||||||
if (!empty($_REQUEST['return'])) {
|
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +320,7 @@ function item_post(App $a) {
|
||||||
System::jsonExit(['preview' => '']);
|
System::jsonExit(['preview' => '']);
|
||||||
}
|
}
|
||||||
info(DI::l10n()->t('Empty post discarded.') . EOL);
|
info(DI::l10n()->t('Empty post discarded.') . EOL);
|
||||||
if (!empty($_REQUEST['return'])) {
|
if ($return_path) {
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
|
@ -705,8 +704,7 @@ function item_post(App $a) {
|
||||||
// update filetags in pconfig
|
// update filetags in pconfig
|
||||||
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
|
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
|
||||||
|
|
||||||
if (!empty($_REQUEST['return']) && strlen($return_path)) {
|
if ($return_path) {
|
||||||
Logger::log('return: ' . $return_path);
|
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
|
@ -727,15 +725,19 @@ function item_post(App $a) {
|
||||||
|
|
||||||
if (!$post_id) {
|
if (!$post_id) {
|
||||||
Logger::log("Item wasn't stored.");
|
Logger::log("Item wasn't stored.");
|
||||||
|
if ($return_path) {
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
|
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
|
||||||
|
|
||||||
if (!DBA::isResult($datarray)) {
|
if (!DBA::isResult($datarray)) {
|
||||||
Logger::log("Item with id ".$post_id." couldn't be fetched.");
|
Logger::log("Item with id ".$post_id." couldn't be fetched.");
|
||||||
|
if ($return_path) {
|
||||||
DI::baseUrl()->redirect($return_path);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update filetags in pconfig
|
// update filetags in pconfig
|
||||||
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
|
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
|
||||||
|
|
Loading…
Reference in a new issue