Translated using Weblate (Russian)
[phpmyadmin.git] / schema_export.php
blob040768dd2baa6a7e53777cc86b74ef6354bd008e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Schema export handler
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\Core;
10 use PhpMyAdmin\Plugins\SchemaPlugin;
11 use PhpMyAdmin\Relation;
13 /**
14 * Gets some core libraries
16 require_once 'libraries/common.inc.php';
18 /**
19 * get all variables needed for exporting relational schema
20 * in $cfgRelation
22 $cfgRelation = Relation::getRelationsParam();
24 require_once 'libraries/pmd_common.php';
25 require_once 'libraries/plugin_interface.lib.php';
27 if (! isset($_REQUEST['export_type'])) {
28 PhpMyAdmin\Util::checkParameters(array('export_type'));
31 /**
32 * Include the appropriate Schema Class depending on $export_type
33 * default is PDF
35 PMA_processExportSchema($_REQUEST['export_type']);
37 /**
38 * get all the export options and verify
39 * call and include the appropriate Schema Class depending on $export_type
41 * @param string $export_type format of the export
43 * @return void
45 function PMA_processExportSchema($export_type)
47 /**
48 * default is PDF, otherwise validate it's only letters a-z
50 if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) {
51 $export_type = 'pdf';
54 // sanitize this parameter which will be used below in a file inclusion
55 $export_type = Core::securePath($export_type);
57 // get the specific plugin
58 /* @var $export_plugin SchemaPlugin */
59 $export_plugin = PMA_getPlugin(
60 "schema",
61 $export_type,
62 'libraries/classes/Plugins/Schema/'
65 // Check schema export type
66 if (! isset($export_plugin)) {
67 Core::fatalError(__('Bad type!'));
70 $GLOBALS['dbi']->selectDb($GLOBALS['db']);
71 $export_plugin->exportSchema($GLOBALS['db']);