Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Figueroa <amenadiel@gmail.com>2018-06-06 03:47:15 +0300
committerFelipe Figueroa <amenadiel@gmail.com>2018-06-06 03:47:15 +0300
commit2312134f79f27ee707ca6e40dbc89001cebba8a9 (patch)
tree54356280564bde1ea026d30c43cdbb4665ff29af /src/controllers/DataexportController.php
parent2fcb4c9f58f2869d3dfa693aa068c2757c01108e (diff)
extract method from mimicdump
Diffstat (limited to 'src/controllers/DataexportController.php')
-rw-r--r--src/controllers/DataexportController.php43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/controllers/DataexportController.php b/src/controllers/DataexportController.php
index 16bf035f..786fb89e 100644
--- a/src/controllers/DataexportController.php
+++ b/src/controllers/DataexportController.php
@@ -140,9 +140,9 @@ class DataexportController extends BaseController
->withHeader('Content-type', 'text/plain');
}
- if (isset($_REQUEST['query'])) {
- $_REQUEST['query'] = trim(urldecode($_REQUEST['query']));
- }
+ $this->coalesceArr($_REQUEST, 'query', '');
+
+ $_REQUEST['query'] = trim(urldecode($_REQUEST['query']));
// Set the schema search path
if (isset($_REQUEST['search_path'])) {
@@ -185,21 +185,7 @@ class DataexportController extends BaseController
$this->prtrace('$_REQUEST[query]', $_REQUEST['query']);
}
- if ('copy' == $format) {
- $this->_mimicCopy($data, $object, $oids, $rs);
- } elseif ('html' == $format) {
- $response = $response
- ->withHeader('Content-type', 'text/html');
- $this->_mimicHtml($data, $object, $oids, $rs);
- } elseif ('xml' == $format) {
- $response = $response
- ->withHeader('Content-type', 'application/xml');
- $this->_mimicXml($data, $object, $oids, $rs);
- } elseif ('sql' == $format) {
- $this->_mimicSQL($data, $object, $oids, $rs);
- } else {
- $this->_csvOrTab($data, $object, $oids, $rs, $format);
- }
+ $response = $this->pickFormat($data, $object, $oids, $rs, $format, $response);
}
if ('dataonly' != $_REQUEST['what']) {
$data->conn->setFetchMode(\ADODB_FETCH_ASSOC);
@@ -214,6 +200,27 @@ class DataexportController extends BaseController
return $response;
}
+ public function pickFormat($data, $object, $oids, $rs, $format, $response)
+ {
+ if ('copy' == $format) {
+ $this->_mimicCopy($data, $object, $oids, $rs);
+ } elseif ('html' == $format) {
+ $response = $response
+ ->withHeader('Content-type', 'text/html');
+ $this->_mimicHtml($data, $object, $oids, $rs);
+ } elseif ('xml' == $format) {
+ $response = $response
+ ->withHeader('Content-type', 'application/xml');
+ $this->_mimicXml($data, $object, $oids, $rs);
+ } elseif ('sql' == $format) {
+ $this->_mimicSQL($data, $object, $oids, $rs);
+ } else {
+ $this->_csvOrTab($data, $object, $oids, $rs, $format);
+ }
+
+ return $response;
+ }
+
public function doDefault($msg = '')
{
if (!isset($_REQUEST['query']) || empty($_REQUEST['query'])) {