Translated using Weblate (Slovenian)
[phpmyadmin.git] / schema_export.php
blob9aebd9a24c54a6c8d79b61173821f4d2bfaf01fd
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 if (! isset($_REQUEST['export_type'])) {
25 PMA\libraries\Util::checkParameters(array('export_type'));
28 /**
29 * Include the appropriate Schema Class depending on $export_type
30 * default is PDF
32 PMA_processExportSchema($_REQUEST['export_type']);
34 /**
35 * get all the export options and verify
36 * call and include the appropriate Schema Class depending on $export_type
38 * @param string $export_type format of the export
40 * @return void
42 function PMA_processExportSchema($export_type)
44 /**
45 * default is PDF, otherwise validate it's only letters a-z
47 if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) {
48 $export_type = 'pdf';
51 // sanitize this parameter which will be used below in a file inclusion
52 $export_type = PMA_securePath($export_type);
54 // get the specific plugin
55 /* @var $export_plugin SchemaPlugin */
56 $export_plugin = PMA_getPlugin(
57 "schema",
58 $export_type,
59 'libraries/plugins/schema/'
62 // Check schema export type
63 if (! isset($export_plugin)) {
64 PMA_fatalError(__('Bad type!'));
67 $GLOBALS['dbi']->selectDb($GLOBALS['db']);
68 $export_plugin->exportSchema($GLOBALS['db']);