Skip to content

Redirects from uploads in "file" module fail. #222

@nbkhwjm

Description

@nbkhwjm

The URL eventually given to the PHP header Location function contains converted html entities and the browser fails to properly redirect. This may be happening elsewhere, but Ive focused on the redirect from "Files"

Flow (sorry if this seems overly detailed, its kinda the way we document issues where I'm at)

In "files"-> "addedit.php" there is a hidden post value called "redirect"
<input type="hidden" name="redirect" value="<?php echo $referrer; ?>" />

Which is derived from

$referrerArray = parse_url($_SERVER['HTTP_REFERER']);
$referrer = $referrerArray['query'] . $referrerArray['fragment'];

which is passed to the form handler in "do_file_aed.php"
$redirect = dPgetCleanParam($_POST, 'redirect', '');

for cleaning in "main_functions.php" --> dPgetCleanParam which returns "filter_xss($val)"

which is in filter.php --> filter_xss that converts the entity..
$string = str_replace('&', '&amp;', $string);

this is passed to $AppUI->redirect($redirect); in the same file do_file_aed.php.

ui.class.php --> redirect then uses this value in the php header Location:
header('Location: index.php?' . $params);

this still has the html Entity, I'm guessing that the browsers now do not interpret the entities the same way, but to make this work properly I had to convert the &amp; back to & with;

$params = str_replace('&amp;', '&', $params);
$loc = "index.php?" . $params;
header("Location: " . $loc);

I've added this change in mine, but wanted to see if anyone thinks there is a better way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions