Merge pull request #431 from xmujay/0609_monitor
[phpmyadmin/aamir.git] / pmd_save_pos.php
blob420720697eee9ae9db5a678ad84f9d2e6beee408
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin-Designer
6 */
8 /**
11 require_once './libraries/common.inc.php';
12 require_once 'libraries/pmd_common.php';
14 $cfgRelation = PMA_getRelationsParam();
16 if (! $cfgRelation['designerwork']) {
17 PMD_err_sav();
20 /**
21 * Sets globals from $_POST
23 $post_params = array(
24 'die_save_pos',
25 'server',
26 't_h',
27 't_v',
28 't_x',
29 't_y'
32 foreach ($post_params as $one_post_param) {
33 if (isset($_POST[$one_post_param])) {
34 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
38 foreach ($t_x as $key => $value) {
39 // table name decode (post PDF exp/imp)
40 $KEY = empty($_POST['IS_AJAX']) ? urldecode($key) : $key;
41 list($DB,$TAB) = explode(".", $KEY);
42 PMA_queryAsControlUser(
43 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
44 . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords'])
45 . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($DB) . '\''
46 . ' AND `table_name` = \'' . PMA_Util::sqlAddSlashes($TAB) . '\'',
47 true, PMA_DatabaseInterface::QUERY_STORE
50 PMA_queryAsControlUser(
51 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
52 . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords'])
53 . ' (db_name, table_name, x, y, v, h)'
54 . ' VALUES ('
55 . '\'' . PMA_Util::sqlAddSlashes($DB) . '\', '
56 . '\'' . PMA_Util::sqlAddSlashes($TAB) . '\', '
57 . '\'' . PMA_Util::sqlAddSlashes($t_x[$key]) . '\', '
58 . '\'' . PMA_Util::sqlAddSlashes($t_y[$key]) . '\', '
59 . '\'' . PMA_Util::sqlAddSlashes($t_v[$key]) . '\', '
60 . '\'' . PMA_Util::sqlAddSlashes($t_h[$key]) . '\')',
61 true, PMA_DatabaseInterface::QUERY_STORE
64 //----------------------------------------------------------------------------
66 function PMD_err_sav()
68 global $die_save_pos; // if this file included
69 if (! empty($die_save_pos)) {
70 header("Content-Type: text/xml; charset=utf-8");
71 header("Cache-Control: no-cache");
72 die('<root act="save_pos" return="' . __('Error saving coordinates for Designer.') . '"></root>');
76 if (! empty($die_save_pos)) {
77 header("Content-Type: text/xml; charset=utf-8");
78 header("Cache-Control: no-cache");
80 <root act='save_pos' return='<?php echo __('Modifications have been saved'); ?>'></root>
81 <?php