2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Schema support library
6 * @package PhpMyAdmin-schema
8 if (! defined('PHPMYADMIN')) {
13 * This Class interacts with the user to gather the information
14 * about their tables for which they want to export the relational schema
15 * export options are shown to user from they can choose
17 * @package PhpMyAdmin-schema
24 public $autoLayoutForeign;
25 public $autoLayoutInternal;
31 * Sets action to be performed with schema.
33 * @param string $value action name
37 public function setAction($value)
39 $this->action
= $value;
43 * This function will process the user defined pages
44 * and tables which will be exported as Relational schema
45 * you can set the table positions on the paper via scratchboard
46 * for table positions, put the x,y co-ordinates
48 * $this->action tells what the Schema is supposed to do
49 * create and select a page, generate schema etc
54 public function processUserChoice()
56 global $db, $cfgRelation;
58 if (isset($this->action
)) {
59 switch ($this->action
) {
61 $this->chosenPage
= $_REQUEST['chpage'];
62 if ('1' == $_REQUEST['action_choose']) {
63 $this->deleteCoordinates(
73 $this->chosenPage
= 0;
77 $this->pageNumber
= PMA_REL_createPage(
82 $this->autoLayoutForeign
= isset($_POST['auto_layout_foreign'])
85 $this->autoLayoutInternal
= isset($_POST['auto_layout_internal'])
88 $this->processRelations(
95 $this->chosenPage
= $_POST['chpage'];
96 $this->c_table_rows
= $_POST['c_table_rows'];
97 $this->_editCoordinates($db, $cfgRelation);
99 case 'delete_old_references':
100 $this->_deleteTableRows(
107 case 'process_export':
108 $this->_processExportSchema();
112 } // end if (isset($do))
117 * shows/displays the HTML FORM to create the page
119 * @param string $db name of the selected database
124 public function showCreatePageDialog($db)
127 <form method
="post" action
="schema_edit.php" name
="frm_create_page">
130 <?php
echo __('Create a page') . "\n"; ?
>
132 <?php
echo PMA_generate_common_hidden_inputs($db); ?
>
133 <input type
="hidden" name
="do" value
="createpage" />
136 <td
><label
for="id_newpage"><?php
echo __('Page name'); ?
></label
></td
>
138 <input type
="text" name
="newpage" id
="id_newpage" size
="20" maxlength
="50" />
142 <td
><?php
echo __('Automatic layout based on'); ?
></td
>
144 <input type
="checkbox" name
="auto_layout_internal" id
="id_auto_layout_internal" /><label
for="id_auto_layout_internal">
145 <?php
echo __('Internal relations'); ?
></label
><br
/>
148 * Check to see whether INNODB and PBXT storage engines
149 * are Available in MYSQL PACKAGE
150 * If available, then provide AutoLayout for Foreign Keys in Schema View
153 if (PMA_StorageEngine
::isValid('InnoDB') || PMA_StorageEngine
::isValid('PBXT')) {
155 <input type
="checkbox" name
="auto_layout_foreign" id
="id_auto_layout_foreign" /><label
for="id_auto_layout_foreign">
156 <?php
echo __('FOREIGN KEY'); ?
></label
><br
/>
163 <fieldset
class="tblFooters">
164 <input type
="submit" value
="<?php echo __('Go'); ?>" />
171 * shows/displays the created page names in a drop down list
172 * User can select any page number and edit it using dashboard etc
177 public function selectPage()
179 global $db,$table,$cfgRelation;
180 $page_query = 'SELECT * FROM '
181 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
182 . PMA_Util
::backquote($cfgRelation['pdf_pages'])
183 . ' WHERE db_name = \'' . PMA_Util
::sqlAddSlashes($db) . '\'';
184 $page_rs = PMA_queryAsControlUser(
185 $page_query, false, PMA_DBI_QUERY_STORE
188 if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
190 <form method
="get" action
="schema_edit.php" name
="frm_select_page">
193 <?php
echo __('Please choose a page to edit') . "\n"; ?
>
195 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
196 <input type
="hidden" name
="do" value
="selectpage" />
197 <select name
="chpage" id
="chpage" class="autosubmit">
198 <option value
="0"><?php
echo __('Select page'); ?
></option
>
200 while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
202 . '<option value="' . $curr_page['page_nr'] . '"';
203 if (isset($this->chosenPage
)
204 && $this->chosenPage
== $curr_page['page_nr']
206 echo ' selected="selected"';
208 echo '>' . $curr_page['page_nr'] . ': '
209 . htmlspecialchars($curr_page['page_descr']) . '</option>';
219 echo PMA_Util
::getRadioFields(
220 'action_choose', $choices, '0', false
225 <fieldset
class="tblFooters">
226 <input type
="submit" value
="<?php echo __('Go'); ?>" /><br
/>
235 * A dashboard is displayed to AutoLayout the position of tables
236 * users can drag n drop the tables and change their positions
241 public function showTableDashBoard()
243 global $db, $cfgRelation, $table, $with_field_names;
245 * We will need an array of all tables in this db
247 $selectboxall = array('--');
248 $alltab_rs = PMA_DBI_query(
249 'SHOW TABLES FROM ' . PMA_Util
::backquote($db) . ';',
253 while ($val = @PMA_DBI_fetch_row
($alltab_rs)) {
254 $selectboxall[] = $val[0];
260 * Now if we already have chosen a page number then we should
261 * show the tables involved
263 if (isset($this->chosenPage
) && $this->chosenPage
> 0) {
265 echo "<h2>" . __('Select Tables') . "</h2>";
266 $page_query = 'SELECT * FROM '
267 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db'])
268 . '.' . PMA_Util
::backquote($cfgRelation['table_coords'])
269 . ' WHERE db_name = \'' . PMA_Util
::sqlAddSlashes($db) . '\''
270 . ' AND pdf_page_number = \''
271 . PMA_Util
::sqlAddSlashes($this->chosenPage
) . '\'';
272 $page_rs = PMA_queryAsControlUser($page_query, false);
273 $array_sh_page = array();
274 while ($temp_sh_page = @PMA_DBI_fetch_assoc
($page_rs)) {
275 $array_sh_page[] = $temp_sh_page;
278 * Display WYSIWYG parts
281 if (! isset($_POST['with_field_names'])
282 && ! isset($_POST['showwysiwyg'])
284 $with_field_names = true;
285 } elseif (isset($_POST['with_field_names'])) {
286 $with_field_names = true;
288 $this->_displayScratchboardTables($array_sh_page);
290 echo '<form method="post" action="schema_edit.php" name="edcoord">';
292 echo PMA_generate_common_hidden_inputs($db, $table);
293 echo '<input type="hidden" name="chpage" '
294 . 'value="' . htmlspecialchars($this->chosenPage
) . '" />';
295 echo '<input type="hidden" name="do" value="edcoord" />';
298 echo '<th>' . __('Table') . '</th>';
299 echo '<th>' . __('Delete') . '</th>';
304 if (isset($ctable)) {
309 * Add one more empty row
311 $array_sh_page[] = array(
319 foreach ($array_sh_page as $sh_page) {
320 $_mtab = $sh_page['table_name'];
321 if (! empty($_mtab)) {
322 $tabExist[$_mtab] = false;
325 echo '<tr class="noclick ';
332 $odd_row = !$odd_row;
335 echo '<select name="c_table_' . $i . '[name]">';
337 foreach ($selectboxall as $value) {
338 echo '<option value="' . htmlspecialchars($value) . '"';
339 if (! empty($_mtab) && $value == $_mtab) {
340 echo ' selected="selected"';
341 $tabExist[$_mtab] = true;
343 echo '>' . htmlspecialchars($value) . '</option>';
349 echo '<input type="checkbox" id="id_c_table_' . $i .'" '
350 . 'name="c_table_' . $i . '[delete]" value="y" />';
351 echo '<label for="id_c_table_' . $i .'">'
352 . __('Delete') . '</label>';
356 echo '<input type="text" class="position-change" data-axis="left" '
357 . 'data-number="' . $i . '" id="c_table_' . $i . '_x" '
358 . 'name="c_table_' . $i . '[x]" value="'
359 . $sh_page['x'] . '" />';
363 echo '<input type="text" class="position-change" data-axis="top" '
364 . 'data-number="' . $i . '" id="c_table_' . $i . '_y" '
365 . 'name="c_table_' . $i . '[y]" value="'
366 . $sh_page['y'] . '" />';
374 echo '<input type="hidden" name="c_table_rows" value="' . $i . '" />';
375 echo '<input type="hidden" id="showwysiwyg" name="showwysiwyg" value="'
376 . ((isset($showwysiwyg) && $showwysiwyg == '1') ?
'1' : '0')
378 echo '<input type="checkbox" id="id_with_field_names" '
379 . 'name="with_field_names" '
380 . (isset($with_field_names) ?
'checked="checked"' : ''). ' />';
381 echo '<label for="id_with_field_names">'
382 . __('Column names') . '</label><br />';
383 echo '<input type="submit" value="' . __('Save') . '" />';
384 echo '</form>' . "\n\n";
387 if (isset($tabExist)) {
388 $this->_deleteTables($db, $this->chosenPage
, $tabExist);
393 * show Export relational schema generation options
394 * user can select export type of his own choice
395 * and the attributes related to it
401 public function displaySchemaGenerationOptions()
403 global $cfg,$db,$test_rs,$chpage;
405 <form method
="post" action
="schema_export.php" class="disableAjax">
409 echo PMA_generate_common_hidden_inputs($db);
410 if ($cfg['PropertiesIconic']) {
411 echo PMA_Util
::getImage('b_views.png');
413 echo __('Display relational schema');
416 <select name
="export_type" id
="export_type">
417 <option value
="pdf" selected
="selected">PDF
</option
>
418 <option value
="svg">SVG
</option
>
419 <option value
="dia">DIA
</option
>
420 <option value
="eps">EPS
</option
>
422 <label
><?php
echo __('Select Export Relational Type');?
></label
><br
/>
424 if (isset($test_rs)) {
426 <label
for="pdf_page_number_opt"><?php
echo __('Page number:'); ?
></label
>
427 <select name
="pdf_page_number" id
="pdf_page_number_opt">
429 while ($pages = @PMA_DBI_fetch_assoc
($test_rs)) {
430 echo ' <option value="' . $pages['page_nr'] . '">'
431 . $pages['page_nr'] . ': ' . htmlspecialchars($pages['page_descr']) . '</option>' . "\n";
433 PMA_DBI_free_result($test_rs);
440 <input type
="hidden" name
="pdf_page_number" value
="<?php echo htmlspecialchars($this->chosenPage); ?>" />
444 <input type
="hidden" name
="do" value
="process_export" />
445 <input type
="hidden" name
="chpage" value
="<?php echo $chpage; ?>" />
446 <input type
="checkbox" name
="show_grid" id
="show_grid_opt" />
447 <label
for="show_grid_opt"><?php
echo __('Show grid'); ?
></label
><br
/>
448 <input type
="checkbox" name
="show_color" id
="show_color_opt" checked
="checked" />
449 <label
for="show_color_opt"><?php
echo __('Show color'); ?
></label
>
451 <input type
="checkbox" name
="show_table_dimension" id
="show_table_dim_opt" />
452 <label
for="show_table_dim_opt">
453 <?php
echo __('Show dimension of tables'); ?
>
455 <input type
="checkbox" name
="all_tables_same_width" id
="all_tables_same_width" />
456 <label
for="all_tables_same_width">
457 <?php
echo __('Display all tables with the same width'); ?
>
459 <input type
="checkbox" name
="with_doc" id
="with_doc" checked
="checked" />
460 <label
for="with_doc"><?php
echo __('Data Dictionary'); ?
></label
><br
/>
461 <input type
="checkbox" name
="show_keys" id
="show_keys" />
462 <label
for="show_keys"><?php
echo __('Only show keys'); ?
></label
><br
/>
463 <select name
="orientation" id
="orientation_opt" class="paper-change">
464 <option value
="L"><?php
echo __('Landscape');?
></option
>
465 <option value
="P"><?php
echo __('Portrait');?
></option
>
467 <label
for="orientation_opt"><?php
echo __('Orientation'); ?
></label
>
469 <select name
="paper" id
="paper_opt" class="paper-change">
471 foreach ($cfg['PDFPageSizes'] as $val) {
472 echo '<option value="' . $val . '"';
473 if ($val == $cfg['PDFDefaultPageSize']) {
474 echo ' selected="selected"';
476 echo ' >' . $val . '</option>' . "\n";
480 <label
for="paper_opt"><?php
echo __('Paper size'); ?
></label
>
482 <fieldset
class="tblFooters">
483 <input type
="submit" value
="<?php echo __('Go'); ?>" />
490 * Check if there are tables that need to be deleted in dashboard,
491 * if there are, ask the user for allowance
493 * @param string $db name of database selected
494 * @param integer $chpage selected page
495 * @param array $tabExist array of booleans
500 private function _deleteTables($db, $chpage, $tabExist)
505 if (empty($tabExist) ||
! is_array($tabExist)) {
508 foreach ($tabExist as $key => $value) {
510 $_strtrans .= '<input type="hidden" name="delrow[]" value="'
511 . htmlspecialchars($key) . '" />' . "\n";
512 $_strname .= '<li>' . htmlspecialchars($key) . '</li>' . "\n";
519 echo '<br /><form action="schema_edit.php" method="post">' . "\n"
520 . PMA_generate_common_hidden_inputs($db)
521 . '<input type="hidden" name="do" value="delete_old_references" />'
523 . '<input type="hidden" name="chpage" value="'
524 . htmlspecialchars($chpage) . '" />' . "\n"
526 'The current page has references to tables that no longer exist.'
527 . ' Would you like to delete those references?'
533 . '<input type="submit" value="' . __('Go') . '" />' . "\n"
538 * Check if there are tables that need to be deleted in dashboard,
539 * if there are, ask the user for allowance
541 * @param array $array_sh_page array of tables on page
546 private function _displayScratchboardTables($array_sh_page)
548 global $with_field_names, $db;
550 echo '<form method="post" action="schema_edit.php" name="dragdrop">';
551 echo '<input type="button" name="dragdrop" id="toggle-dragdrop" '
552 . 'value="' . __('Toggle scratchboard') . '" />';
553 echo '<input type="button" name="dragdropreset" id="reset-dragdrop" '
554 . 'value="' . __('Reset') . '" />';
556 echo '<div id="pdflayout" class="pdflayout" style="visibility: hidden;">';
560 foreach ($array_sh_page as $temp_sh_page) {
561 $drag_x = $temp_sh_page['x'];
562 $drag_y = $temp_sh_page['y'];
564 echo '<div id="table_' . $i . '" '
565 . 'data-number="' . $i .'" '
566 . 'data-x="' . $drag_x . '" '
567 . 'data-y="' . $drag_y . '" '
568 . 'class="pdflayout_table"'
571 . htmlspecialchars($temp_sh_page['table_name'])
574 if (isset($with_field_names)) {
575 $fields = PMA_DBI_get_columns($db, $temp_sh_page['table_name']);
576 // if the table has been dropped from outside phpMyAdmin,
577 // we can no longer obtain its columns list
579 foreach ($fields as $row) {
580 echo '<br />' . htmlspecialchars($row['Field']) . "\n";
584 echo '</div>' . "\n";
592 * delete the table rows with table co-ordinates
594 * @param int $delrow delete selected table from list of tables
595 * @param array $cfgRelation relation settings
596 * @param string $db database name
597 * @param integer $chpage selected page for adding relations etc
602 private function _deleteTableRows($delrow,$cfgRelation,$db,$chpage)
604 foreach ($delrow as $current_row) {
605 $del_query = 'DELETE FROM '
606 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
607 . PMA_Util
::backquote($cfgRelation['table_coords']) . ' ' . "\n"
608 . ' WHERE db_name = \''
609 . PMA_Util
::sqlAddSlashes($db) . '\'' . "\n"
610 . ' AND table_name = \''
611 . PMA_Util
::sqlAddSlashes($current_row) . '\'' . "\n"
612 . ' AND pdf_page_number = \''
613 . PMA_Util
::sqlAddSlashes($chpage) . '\'';
614 PMA_queryAsControlUser($del_query, false);
619 * get all the export options and verify
620 * call and include the appropriate Schema Class depending on $export_type
625 private function _processExportSchema()
628 * Settings for relation stuff
630 include_once './libraries/transformations.lib.php';
631 include_once './libraries/Index.class.php';
633 * default is PDF, otherwise validate it's only letters a-z
635 global $db,$export_type;
636 if (!isset($export_type) ||
!preg_match('/^[a-zA-Z]+$/', $export_type)) {
637 $export_type = 'pdf';
640 PMA_DBI_select_db($db);
642 include "libraries/schema/" . ucfirst($export_type)
643 . "_Relation_Schema.class.php";
644 eval("new PMA_" . ucfirst($export_type) . "_Relation_Schema();");
648 * delete X and Y coordinates
650 * @param string $db The database name
651 * @param array $cfgRelation relation settings
652 * @param integer $choosePage selected page for adding relations etc
657 public function deleteCoordinates($db, $cfgRelation, $choosePage)
659 $query = 'DELETE FROM '
660 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
661 . PMA_Util
::backquote($cfgRelation['table_coords'])
662 . ' WHERE db_name = \'' . PMA_Util
::sqlAddSlashes($db) . '\''
663 . ' AND pdf_page_number = \''
664 . PMA_Util
::sqlAddSlashes($choosePage) . '\'';
665 PMA_queryAsControlUser($query, false);
671 * @param string $db The database name
672 * @param array $cfgRelation relation settings
673 * @param integer $choosePage selected page for adding relations etc
678 public function deletePages($db, $cfgRelation, $choosePage)
680 $query = 'DELETE FROM '
681 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
682 . PMA_Util
::backquote($cfgRelation['pdf_pages'])
683 . ' WHERE db_name = \'' . PMA_Util
::sqlAddSlashes($db) . '\''
684 . ' AND page_nr = \'' . PMA_Util
::sqlAddSlashes($choosePage) . '\'';
685 PMA_queryAsControlUser($query, false);
689 * process internal and foreign key relations
691 * @param string $db The database name
692 * @param integer $pageNumber document number/Id
693 * @param array $cfgRelation relation settings
698 public function processRelations($db, $pageNumber, $cfgRelation)
701 * A u t o m a t i c l a y o u t
703 * There are 2 kinds of relations in PMA
704 * 1) Internal Relations 2) Foreign Key Relations
706 if (isset($this->autoLayoutInternal
) ||
isset($this->autoLayoutForeign
)) {
707 $all_tables = array();
710 if (isset($this->autoLayoutForeign
)) {
712 * get the tables list
713 * who support FOREIGN KEY, it's not
714 * important that we group together InnoDB tables
715 * and PBXT tables, as this logic is just to put
716 * the tables on the layout, not to determine relations
718 $tables = PMA_DBI_get_tables_full($db);
719 $foreignkey_tables = array();
720 foreach ($tables as $table_name => $table_properties) {
721 if (PMA_Util
::isForeignKeySupported($table_properties['ENGINE'])) {
722 $foreignkey_tables[] = $table_name;
725 $all_tables = $foreignkey_tables;
727 * could be improved by finding the tables which have the
728 * most references keys and placing them at the beginning
729 * of the array (so that they are all center of schema)
731 unset($tables, $foreignkey_tables);
734 if (isset($this->autoLayoutInternal
)) {
736 * get the tables list who support Internal Relations;
737 * This type of relations will be created when
738 * you setup the PMA tables correctly
740 $master_tables = 'SELECT COUNT(master_table), master_table'
741 . ' FROM ' . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
742 . PMA_Util
::backquote($cfgRelation['relation'])
743 . ' WHERE master_db = \'' . PMA_Util
::sqlAddSlashes($db) . '\''
744 . ' GROUP BY master_table'
745 . ' ORDER BY COUNT(master_table) DESC';
746 $master_tables_rs = PMA_queryAsControlUser(
747 $master_tables, false, PMA_DBI_QUERY_STORE
749 if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
750 /* first put all the master tables at beginning
751 * of the list, so they are near the center of
754 while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
755 $all_tables[] = $master_table;
758 /* Now for each master, add its foreigns into an array
759 * of foreign tables, if not already there
760 * (a foreign might be foreign for more than
761 * one table, and might be a master itself)
764 $foreign_tables = array();
765 foreach ($all_tables as $master_table) {
766 $foreigners = PMA_getForeigners($db, $master_table);
767 foreach ($foreigners as $foreigner) {
768 if (! in_array($foreigner['foreign_table'], $foreign_tables)) {
769 $foreign_tables[] = $foreigner['foreign_table'];
775 * Now merge the master and foreign arrays/tables
777 foreach ($foreign_tables as $foreign_table) {
778 if (! in_array($foreign_table, $all_tables)) {
779 $all_tables[] = $foreign_table;
785 if (isset($this->autoLayoutInternal
) ||
isset($this->autoLayoutForeign
)) {
786 $this->addRelationCoordinates(
787 $all_tables, $pageNumber, $db, $cfgRelation
791 $this->chosenPage
= $pageNumber;
795 * Add X and Y coordinates for a table
797 * @param array $all_tables A list of all tables involved
798 * @param integer $pageNumber document number/Id
799 * @param string $db The database name
800 * @param array $cfgRelation relation settings
805 public function addRelationCoordinates(
806 $all_tables, $pageNumber, $db, $cfgRelation
809 * Now generate the coordinates for the schema
810 * in a clockwise spiral and add to co-ordinates table
816 $direction = "right";
817 foreach ($all_tables as $current_table) {
819 * save current table's coordinates
821 $insert_query = 'INSERT INTO '
822 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
823 . PMA_Util
::backquote($cfgRelation['table_coords']) . ' '
824 . '(db_name, table_name, pdf_page_number, x, y) '
825 . 'VALUES (\'' . PMA_Util
::sqlAddSlashes($db) . '\', \''
826 . PMA_Util
::sqlAddSlashes($current_table) . '\',' . $pageNumber
827 . ',' . $pos_x . ',' . $pos_y . ')';
828 PMA_queryAsControlUser($insert_query, false);
831 * compute for the next table
833 switch ($direction) {
837 $delta *= $delta_mult;
842 $delta *= $delta_mult;
847 $delta *= $delta_mult;
851 $direction = "right";
852 $delta *= $delta_mult;
859 * update X and Y coordinates for a table
861 * @param string $db The database name
862 * @param array $cfgRelation relation settings
867 private function _editCoordinates($db, $cfgRelation)
869 for ($i = 0; $i < $this->c_table_rows
; $i++
) {
870 $arrvalue = $_POST['c_table_' . $i];
872 if (! isset($arrvalue['x']) ||
$arrvalue['x'] == '') {
875 if (! isset($arrvalue['y']) ||
$arrvalue['y'] == '') {
878 if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
879 $test_query = 'SELECT * FROM '
880 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db']) . '.'
881 . PMA_Util
::backquote($cfgRelation['table_coords'])
882 . ' WHERE db_name = \'' . PMA_Util
::sqlAddSlashes($db) . '\''
883 . ' AND table_name = \''
884 . PMA_Util
::sqlAddSlashes($arrvalue['name']) . '\''
885 . ' AND pdf_page_number = \''
886 . PMA_Util
::sqlAddSlashes($this->chosenPage
) . '\'';
887 $test_rs = PMA_queryAsControlUser(
888 $test_query, false, PMA_DBI_QUERY_STORE
891 if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
892 if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
893 $ch_query = 'DELETE FROM '
894 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db'])
896 . PMA_Util
::backquote($cfgRelation['table_coords'])
897 . ' WHERE db_name = \''
898 . PMA_Util
::sqlAddSlashes($db) . '\''
899 . ' AND table_name = \''
900 . PMA_Util
::sqlAddSlashes($arrvalue['name']) . '\''
901 . ' AND pdf_page_number = \''
902 . PMA_Util
::sqlAddSlashes($this->chosenPage
) . '\'';
904 $ch_query = 'UPDATE '
905 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db'])
906 . '.' . PMA_Util
::backquote($cfgRelation['table_coords'])
908 . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
909 . ' WHERE db_name = \''
910 . PMA_Util
::sqlAddSlashes($db) . '\''
911 . ' AND table_name = \''
912 . PMA_Util
::sqlAddSlashes($arrvalue['name']) . '\''
913 . ' AND pdf_page_number = \''
914 . PMA_Util
::sqlAddSlashes($this->chosenPage
) . '\'';
917 $ch_query = 'INSERT INTO '
918 . PMA_Util
::backquote($GLOBALS['cfgRelation']['db'])
919 . '.' . PMA_Util
::backquote($cfgRelation['table_coords'])
921 . '(db_name, table_name, pdf_page_number, x, y) '
922 . 'VALUES (\'' . PMA_Util
::sqlAddSlashes($db) . '\', \''
923 . PMA_Util
::sqlAddSlashes($arrvalue['name']) . '\', \''
924 . PMA_Util
::sqlAddSlashes($this->chosenPage
) . '\','
925 . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
928 PMA_queryAsControlUser($ch_query, false);