Translated using Weblate (Turkish)
[phpmyadmin.git] / schema_export.php
blob80d07e54a335a9fbfec6cbb16ae48179f4af01b0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Schema export handler
6 * @package PhpMyAdmin
7 */
9 /**
10 * Gets some core libraries
12 require_once 'libraries/common.inc.php';
13 require 'libraries/StorageEngine.class.php';
15 /**
16 * get all variables needed for exporting relational schema
17 * in $cfgRelation
19 $cfgRelation = PMA_getRelationsParam();
21 require_once 'libraries/Index.class.php';
22 require_once 'libraries/pmd_common.php';
23 require_once 'libraries/plugin_interface.lib.php';
25 /**
26 * get all the export options and verify
27 * call and include the appropriate Schema Class depending on $export_type
28 * default is PDF
31 $post_params = array(
32 'db'
34 foreach ($post_params as $one_post_param) {
35 if (isset($_REQUEST[$one_post_param])) {
36 $GLOBALS[$one_post_param] = $_REQUEST[$one_post_param];
40 if (isset($_REQUEST['offline_export'])) {
41 $_REQUEST['page_number'] = -1;
42 PMA_processExportSchema($_REQUEST['export_type']);
43 } else {
44 $temp_page = PMA_createNewPage("_temp" . rand(), $GLOBALS['db']);
45 try {
46 PMA_saveTablePositions($temp_page);
47 $_REQUEST['page_number'] = $temp_page;
48 PMA_processExportSchema($_REQUEST['export_type']);
49 PMA_deletePage($temp_page);
50 } catch (Exception $e) {
51 PMA_deletePage($temp_page); // delete temp page even if an exception occured
52 throw $e;
56 /**
57 * get all the export options and verify
58 * call and include the appropriate Schema Class depending on $export_type
60 * @param string $export_type format of the export
62 * @return void
64 function PMA_processExportSchema($export_type)
66 /**
67 * default is PDF, otherwise validate it's only letters a-z
69 if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) {
70 $export_type = 'pdf';
73 // sanitize this parameter which will be used below in a file inclusion
74 $export_type = PMA_securePath($export_type);
76 // get the specific plugin
77 $export_plugin = PMA_getPlugin(
78 "schema",
79 $export_type,
80 'libraries/plugins/schema/'
83 // Check schema export type
84 if (! isset($export_plugin)) {
85 PMA_fatalError(__('Bad type!'));
88 $GLOBALS['dbi']->selectDb($GLOBALS['db']);
89 $export_plugin->exportSchema($GLOBALS['db']);