From 550536c19c9b8edb9d861fe10d8498c5f52008ec Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 10 Mar 2016 20:58:33 +1100 Subject: [PATCH] Remove dead code used to export charts Signed-off-by: Madhura Jayaratne --- file_echo.php | 54 +-------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/file_echo.php b/file_echo.php index d8bb39e98d..1f6d91663b 100644 --- a/file_echo.php +++ b/file_echo.php @@ -9,59 +9,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');