schema_export.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @package PhpMyAdmin
  6. */
  7. /**
  8. * Gets some core libraries
  9. */
  10. require_once 'libraries/common.inc.php';
  11. require 'libraries/StorageEngine.class.php';
  12. /**
  13. * Validate vulnerable POST parameters
  14. */
  15. if (! PMA_isValid($_POST['pdf_page_number'], 'numeric')) {
  16. die('Attack stopped');
  17. }
  18. /**
  19. * get all variables needed for exporting relational schema
  20. * in $cfgRelation
  21. */
  22. $cfgRelation = PMA_getRelationsParam();
  23. require_once 'libraries/transformations.lib.php';
  24. require_once 'libraries/Index.class.php';
  25. require_once 'libraries/schema/Export_Relation_Schema.class.php';
  26. /**
  27. * get all the export options and verify
  28. * call and include the appropriate Schema Class depending on $export_type
  29. * default is PDF
  30. */
  31. $post_params = array(
  32. 'all_tables_same_width',
  33. 'chpage',
  34. 'db',
  35. 'do',
  36. 'export_type',
  37. 'orientation',
  38. 'paper',
  39. 'names',
  40. 'pdf_page_number',
  41. 'show_color',
  42. 'show_grid',
  43. 'show_keys',
  44. 'show_table_dimension',
  45. 'with_doc'
  46. );
  47. foreach ($post_params as $one_post_param) {
  48. if (isset($_POST[$one_post_param])) {
  49. $GLOBALS[$one_post_param] = $_POST[$one_post_param];
  50. }
  51. }
  52. if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) {
  53. $export_type = 'pdf';
  54. }
  55. PMA_DBI_select_db($db);
  56. $path = PMA_securePath(ucfirst($export_type));
  57. if (!file_exists('libraries/schema/' . $path . '_Relation_Schema.class.php')) {
  58. PMA_Export_Relation_Schema::dieSchema(
  59. $_POST['chpage'],
  60. $export_type,
  61. __('File doesn\'t exist')
  62. );
  63. }
  64. require "libraries/schema/".$path.'_Relation_Schema.class.php';
  65. $obj_schema = eval("new PMA_".$path."_Relation_Schema();");