diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php index 94800feed6..0276d1e684 100644 --- a/libraries/Tracker.class.php +++ b/libraries/Tracker.class.php @@ -258,7 +258,7 @@ class PMA_Tracker static public function createVersion($dbname, $tablename, $version, $tracking_set = '', $is_view = false ) { - global $sql_backquotes; + global $sql_backquotes, $export_type; $common_functions = PMA_CommonFunctions::getInstance(); @@ -267,6 +267,7 @@ class PMA_Tracker } // get Export SQL instance + require_once "libraries/plugin_interface.lib.php"; $export_sql_plugin = PMA_getPlugin( "export", "sql", diff --git a/libraries/transformations.lib.php b/libraries/transformations.lib.php index a69403d02a..a653570d93 100644 --- a/libraries/transformations.lib.php +++ b/libraries/transformations.lib.php @@ -163,7 +163,6 @@ function PMA_getTransformationDescription($file, $html_formatted = true) */ function PMA_getMIME($db, $table, $strict = false) { - $common_functions = PMA_CommonFunctions::getInstance(); $cfgRelation = PMA_getRelationsParam(); @@ -183,9 +182,52 @@ function PMA_getMIME($db, $table, $strict = false) AND ( `mimetype` != \'\'' . (!$strict ? ' OR `transformation` != \'\' OR `transformation_options` != \'\'' : '') . ')'; - return PMA_DBI_fetch_result( + $result = PMA_DBI_fetch_result( $com_qry, 'column_name', null, $GLOBALS['controllink'] ); + + foreach ($result as $column => $values) { + // replacements in mimetype and transformation + $values = str_replace("jpeg", "JPEG", $values); + $values = str_replace("png", "PNG", $values); + $values = str_replace("octet-stream", "Octetstream", $values); + + // convert mimetype to new format (f.e. Text_Plain, etc) + $delimiter_space = '- '; + $delimiter = "_"; + $values['mimetype'] = str_replace( + $delimiter_space, + $delimiter, + ucwords( + str_replace( + $delimiter, + $delimiter_space, + $values['mimetype'] + ) + ) + ); + + // convert transformation to new format (class name) + // f.e. Text_Plain_Substring.class.php + $values = str_replace("__", "_", $values); + $values = str_replace(".inc.php", ".class.php", $values); + + $values['transformation'] = str_replace( + $delimiter_space, + $delimiter, + ucwords( + str_replace( + $delimiter, + $delimiter_space, + $values['transformation'] + ) + ) + ); + + $result[$column] = $values; + } + + return $result; } // end of the 'PMA_getMIME()' function /** @@ -215,7 +257,21 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, return false; } - $test_qry = ' + // convert mimetype to old format (f.e. text_plain) + $mimetype = strtolower($mimetype); + // old format has octet-stream instead of octetstream for mimetype + if (strstr($mimetype, "octetstream")) { + $mimetype = "application_octet-stream"; + } + + // convert transformation to old format (f.e. text_plain__substring.inc.php) + $transformation = strtolower($transformation); + $transformation = str_replace(".class.php", ".inc.php", $transformation); + $last_pos = strrpos($transformation, "_"); + $transformation = substr($transformation , 0, $last_pos) . "_" + . substr($transformation, $last_pos); + + $test_qry = ' SELECT `mimetype`, `comment` FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' diff --git a/transformation_wrapper.php b/transformation_wrapper.php index 1f4831a5d6..457f371c33 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -53,18 +53,18 @@ if (isset($where_clause)) { null, PMA_DBI_QUERY_STORE ); - $row = PMA_DBI_fetch_assoc($result); + $row = PMA_DBI_fetch_assoc($result); } else { $result = PMA_DBI_query( 'SELECT * FROM ' . PMA_CommonFunctions::getInstance()->backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE ); - $row = PMA_DBI_fetch_assoc($result); + $row = PMA_DBI_fetch_assoc($result); } // No row returned -if (!$row) { +if (! $row) { exit; } // end if (no record returned) @@ -89,7 +89,7 @@ $response = PMA_Response::getInstance(); $response->getHeader()->sendHttpHeaders(); // [MIME] -if (isset($ct) && !empty($ct)) { +if (isset($ct) && ! empty($ct)) { $mime_type = $ct; } else { $mime_type = (isset($mime_map[$transform_key]['mimetype'])