Translated using Weblate (Polish)
[phpmyadmin.git] / pmd_display_field.php
blob8a44d313d53dcdbf1b66531081ae080c17bdfdf3
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package PhpMyAdmin-Designer
5 */
7 /**
9 */
10 require_once './libraries/common.inc.php';
12 PMA_Response::getInstance()->disable();
14 require_once 'libraries/pmd_common.php';
16 $table = $_POST['T'];
17 $display_field = $_POST['F'];
19 if ($cfgRelation['displaywork']) {
21 $disp = PMA_getDisplayField($db, $table);
22 if ($disp) {
23 if ($display_field != $disp) {
24 $upd_query = 'UPDATE '
25 . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
26 . '.'
27 . PMA_Util::backquote($cfgRelation['table_info'])
28 . ' SET display_field = \''
29 . PMA_Util::sqlAddSlashes($display_field) . '\''
30 . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
31 . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
32 } else {
33 $upd_query = 'DELETE FROM '
34 . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
35 . '.'
36 . PMA_Util::backquote($cfgRelation['table_info'])
37 . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
38 . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
40 } elseif ($display_field != '') {
41 $upd_query = 'INSERT INTO '
42 . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
43 . '.'
44 . PMA_Util::backquote($cfgRelation['table_info'])
45 . '(db_name, table_name, display_field) '
46 . ' VALUES('
47 . '\'' . PMA_Util::sqlAddSlashes($db) . '\','
48 . '\'' . PMA_Util::sqlAddSlashes($table) . '\','
49 . '\'' . PMA_Util::sqlAddSlashes($display_field) . '\')';
52 if (isset($upd_query)) {
53 $upd_rs = PMA_queryAsControlUser($upd_query);
55 } // end if
57 header("Content-Type: text/xml; charset=utf-8");
58 header("Cache-Control: no-cache");
59 die("<root act='save_pos' return='"
60 . __('Modifications have been saved') . "'></root>");