Merge remote-tracking branch 'origin/master'
[phpmyadmin.git] / pmd_save_pos.php
blobfbf64cdcfa8bcd28adb4aa7579dee685117c0cfb
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Save handler for PMD
6 * @package PhpMyAdmin-Designer
7 */
9 /**
12 require_once './libraries/common.inc.php';
13 require_once 'libraries/pmd_common.php';
15 $cfgRelation = PMA_getRelationsParam();
17 if (! $cfgRelation['designerwork']) {
18 PMD_errorSave();
21 /**
22 * Sets globals from $_POST
24 $post_params = array(
25 'die_save_pos',
28 foreach ($post_params as $one_post_param) {
29 if (isset($_POST[$one_post_param])) {
30 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
34 foreach ($_POST['t_x'] as $key => $value) {
35 // table name decode (post PDF exp/imp)
36 $KEY = empty($_POST['IS_AJAX']) ? urldecode($key) : $key;
37 list($DB,$TAB) = explode(".", $KEY);
38 PMA_queryAsControlUser(
39 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
40 . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords'])
41 . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($DB) . '\''
42 . ' AND `table_name` = \'' . PMA_Util::sqlAddSlashes($TAB) . '\'',
43 true, PMA_DatabaseInterface::QUERY_STORE
46 PMA_queryAsControlUser(
47 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
48 . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords'])
49 . ' (db_name, table_name, x, y, v, h)'
50 . ' VALUES ('
51 . '\'' . PMA_Util::sqlAddSlashes($DB) . '\', '
52 . '\'' . PMA_Util::sqlAddSlashes($TAB) . '\', '
53 . '\'' . PMA_Util::sqlAddSlashes($_POST['t_x'][$key]) . '\', '
54 . '\'' . PMA_Util::sqlAddSlashes($_POST['t_y'][$key]) . '\', '
55 . '\'' . PMA_Util::sqlAddSlashes($_POST['t_v'][$key]) . '\', '
56 . '\'' . PMA_Util::sqlAddSlashes($_POST['t_h'][$key]) . '\')',
57 true, PMA_DatabaseInterface::QUERY_STORE
60 //----------------------------------------------------------------------------
62 /**
63 * Error handler
65 * @return void
67 function PMD_errorSave()
69 global $die_save_pos; // if this file included
70 if (! empty($die_save_pos)) {
71 header("Content-Type: text/xml; charset=utf-8");
72 header("Cache-Control: no-cache");
73 die(
74 '<root act="save_pos" return="'
75 . __('Error saving coordinates for Designer.')
76 . '"></root>'
81 if (! empty($die_save_pos)) {
82 header("Content-Type: text/xml; charset=utf-8");
83 header("Cache-Control: no-cache");
85 <root
86 act='save_pos'
87 return='<?php echo __('Modifications have been saved'); ?>'></root>
88 <?php