move remaining old-format messages to the script that uses them, when possible
[phpmyadmin/crack.git] / pmd_pdf.php
blob3c921f59c0c2e9666eea1266ba62f5eb63444bd8
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin-Designer
7 */
9 include_once 'pmd_common.php';
11 /**
12 * If called directly from the designer, first save the positions
14 if (! isset($scale)) {
15 $no_die_save_pos = 1;
16 include_once 'pmd_save_pos.php';
19 require_once './libraries/relation.lib.php';
21 if (isset($scale) && ! isset($createpage)) {
22 if (empty($pdf_page_number)) {
23 die("<script>alert('Pages not found!');history.go(-2);</script>");
26 $pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
27 $pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
28 $scale_q = PMA_sqlAddslashes($scale);
29 $pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
31 if (isset($exp)) {
33 $sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddslashes($db) . "'";
35 PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
38 if (isset($imp)) {
39 PMA_query_as_controluser(
40 'UPDATE ' . $pma_table . ',' . $pmd_table .
41 ' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
42 ' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
43 WHERE
44 ' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
45 AND
46 ' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
47 AND
48 ' . $pmd_table . '.`db_name`=\''. PMA_sqlAddslashes($db) .'\'
49 AND pdf_page_number = ' . $pdf_page_number_q . ';', TRUE, PMA_DBI_QUERY_STORE);
52 die("<script>alert('__('Modifications have been saved')');history.go(-2);</script>");
55 if (isset($createpage)) {
57 * @see pdf_pages.php
59 $query_default_option = PMA_DBI_QUERY_STORE;
61 $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
62 if ($pdf_page_number > 0) {
63 $message = PMA_Message::success(__('Page has been created'));
64 } else {
65 $message = PMA_Message::error(__('Page creation failed'));
69 // no need to use pmd/styles
70 require_once './libraries/header_meta_style.inc.php';
72 </head>
73 <body>
74 <br>
75 <div>
76 <?php
77 if (!empty($message)) {
78 $message->display();
81 <form name="form1" method="post" action="pmd_pdf.php">
82 <?php echo PMA_generate_common_hidden_inputs($db); ?>
83 <div>
84 <fieldset><legend><?php echo __('Export') . '/' . __('Import'); ?></legend>
85 <p><?php echo __('Export/Import to scale'); ?>:
86 <select name="scale">
87 <option value="1">1:1</option>
88 <option value="2">1:2</option>
89 <option value="3" selected>1:3 (<?php echo __('recommended'); ?>)</option>
90 <option value="4">1:4</option>
91 <option value="5">1:5</option>
92 </select>
93 </p>
94 <p><?php echo __('to/from page'); ?>:
96 <select name="pdf_page_number">
97 <?php
98 $table_info_result = PMA_query_as_controluser('SELECT * FROM '
99 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
100 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
101 while($page = PMA_DBI_fetch_assoc($table_info_result))
104 <option value="<?php echo $page['page_nr'] ?>"><?php echo htmlspecialchars($page['page_descr']) ?></option>
105 <?php
108 </select>
109 <input type="submit" name="exp" value="<?php echo __('Export'); ?>">
110 <input type="submit" name="imp" value="<?php echo __('Import'); ?>">
111 </fieldset>
112 </div>
113 <div>
114 <fieldset><legend><?php echo __('Create a page'); ?></legend>
115 <input type="text" name="newpage" />
116 <input type="submit" name="createpage" value="<?php echo __('Go'); ?>">
117 </fieldset>
118 </div>
119 </form>
120 </div>
121 </body>
122 </html>