Merge remote-tracking branch 'origin/master'
[phpmyadmin.git] / schema_export.php
blob0ea0c845eb5c9c889ea13de33cc8d3f3b69596b1
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Schema export handler
6 * @package PhpMyAdmin
7 */
8 use PMA\libraries\plugins\SchemaPlugin;
10 /**
11 * Gets some core libraries
13 require_once 'libraries/common.inc.php';
15 /**
16 * get all variables needed for exporting relational schema
17 * in $cfgRelation
19 $cfgRelation = PMA_getRelationsParam();
21 require_once 'libraries/pmd_common.php';
22 require_once 'libraries/plugin_interface.lib.php';
24 /**
25 * Include the appropriate Schema Class depending on $export_type
26 * default is PDF
28 PMA_processExportSchema($_REQUEST['export_type']);
30 /**
31 * get all the export options and verify
32 * call and include the appropriate Schema Class depending on $export_type
34 * @param string $export_type format of the export
36 * @return void
38 function PMA_processExportSchema($export_type)
40 /**
41 * default is PDF, otherwise validate it's only letters a-z
43 if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) {
44 $export_type = 'pdf';
47 // sanitize this parameter which will be used below in a file inclusion
48 $export_type = PMA_securePath($export_type);
50 // get the specific plugin
51 /* @var $export_plugin SchemaPlugin */
52 $export_plugin = PMA_getPlugin(
53 "schema",
54 $export_type,
55 'libraries/plugins/schema/'
58 // Check schema export type
59 if (! isset($export_plugin)) {
60 PMA_fatalError(__('Bad type!'));
63 $GLOBALS['dbi']->selectDb($GLOBALS['db']);
64 $export_plugin->exportSchema($GLOBALS['db']);