2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides download to a given field defined in parameters.
11 use PhpMyAdmin\Response
;
16 require_once 'libraries/common.inc.php';
18 // we don't want the usual PhpMyAdmin\Response-generated HTML above the column's
20 $response = Response
::getInstance();
23 /* Check parameters */
24 PhpMyAdmin\Util
::checkParameters(
29 if (!$GLOBALS['dbi']->selectDb($db)) {
30 PhpMyAdmin\Util
::mysqlDie(
31 sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
36 /* Check if table exists */
37 if (!$GLOBALS['dbi']->getColumns($db, $table)) {
38 PhpMyAdmin\Util
::mysqlDie(__('Invalid table name'));
42 $sql = 'SELECT ' . PhpMyAdmin\Util
::backquote($_GET['transform_key'])
43 . ' FROM ' . PhpMyAdmin\Util
::backquote($table)
44 . ' WHERE ' . $_GET['where_clause'] . ';';
45 $result = $GLOBALS['dbi']->fetchValue($sql);
47 /* Check return code */
48 if ($result === false) {
49 PhpMyAdmin\Util
::mysqlDie(
50 __('MySQL returned an empty result set (i.e. zero rows).'), $sql
54 /* Avoid corrupting data */
55 ini_set('url_rewriter.tags', '');
58 $table . '-' . $_GET['transform_key'] . '.bin',
59 Mime
::detect($result),