Skip to content
Permalink
Browse files

Remove no longer used code

It was used by old charts code to download charts.

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information...
nijel committed Jul 22, 2016
1 parent ff1016e commit 623f5b46213b8b4fda16f52017dbaec3e44e1ce3
Showing with 1 addition and 53 deletions.
  1. +1 −53 file_echo.php
@@ -10,59 +10,7 @@
define('PMA_MINIMUM_COMMON', true);
require_once 'libraries/common.inc.php';
/* For chart exporting */
if (isset($_REQUEST['filename']) && isset($_REQUEST['image'])) {
$allowed = array(
'image/png' => 'png',
'image/svg+xml' => 'svg',
);
/* Check whether MIME type is allowed */
if (! isset($allowed[$_REQUEST['type']])) {
PMA_fatalError(__('Invalid export type'));
}
/*
* Check file name to match mime type and not contain new lines
* to prevent response splitting.
*/
$extension = $allowed[$_REQUEST['type']];
$valid_match = '/^[^\n\r]*\.' . $extension . '$/';
if (! preg_match($valid_match, $_REQUEST['filename'])) {
if (! preg_match('/^[^\n\r]*$/', $_REQUEST['filename'])) {
/* Filename is unsafe, discard it */
$filename = 'download.' . $extension;
} else {
/* Add extension */
$filename = $_REQUEST['filename'] . '.' . $extension;
}
} else {
/* Filename from request should be safe here */
$filename = $_REQUEST['filename'];
}
/* Decode data */
if ($extension != 'svg') {
$data = mb_substr(
$_REQUEST['image'],
mb_strpos($_REQUEST['image'], ',') + 1
);
$data = base64_decode($data);
} else {
$data = $_REQUEST['image'];
}
/* Send download header */
PMA_downloadHeader(
$filename,
$_REQUEST['type'],
mb_strlen($data)
);
/* Send data */
echo $data;
} else if (isset($_REQUEST['monitorconfig'])) {
if (isset($_REQUEST['monitorconfig'])) {
/* For monitor chart config export */
PMA_downloadHeader('monitor.cfg', 'application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');

0 comments on commit 623f5b4

Please sign in to comment.
You can’t perform that action at this time.