2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides download to a given field defined in parameters.
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/mime.lib.php';
16 * Sets globals from $_GET
23 foreach ($get_params as $one_get_param) {
24 if (isset($_GET[$one_get_param])) {
25 $GLOBALS[$one_get_param] = $_GET[$one_get_param];
29 /* Check parameters */
30 PMA_Util
::checkParameters(
31 array('db', 'table', 'where_clause', 'transform_key')
35 if (!PMA_DBI_select_db($db)) {
37 sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
42 /* Check if table exists */
43 if (!PMA_DBI_get_columns($db, $table)) {
44 PMA_Util
::mysqlDie(__('Invalid table name'));
48 $sql = 'SELECT ' . PMA_Util
::backquote($transform_key)
49 . ' FROM ' . PMA_Util
::backquote($table)
50 . ' WHERE ' . $where_clause . ';';
51 $result = PMA_DBI_fetch_value($sql);
53 /* Check return code */
54 if ($result === false) {
55 PMA_Util
::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
58 /* Avoid corrupting data */
59 @ini_set
('url_rewriter.tags', '');
62 $table . '-' . $transform_key . '.bin',
63 PMA_detectMIME($result),