Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / pmd_display_field.php
blob9e55e095628eb0b0b6c76490d1992c0211b489cd
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @version $Id$
5 * @package phpMyAdmin-Designer
6 */
8 /**
11 include_once 'pmd_common.php';
12 require_once './libraries/relation.lib.php';
15 $table = $T;
16 $display_field = $F;
18 if ($cfgRelation['displaywork']) {
20 $disp = PMA_getDisplayField($db, $table);
21 if ($disp) {
22 if ($display_field != $disp) {
23 $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
24 . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\''
25 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
26 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
27 } else {
28 $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
29 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
30 . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
32 } elseif ($display_field != '') {
33 $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
34 . '(db_name, table_name, display_field) '
35 . ' VALUES('
36 . '\'' . PMA_sqlAddslashes($db) . '\','
37 . '\'' . PMA_sqlAddslashes($table) . '\','
38 . '\'' . PMA_sqlAddslashes($display_field) . '\')';
41 if (isset($upd_query)) {
42 $upd_rs = PMA_query_as_controluser($upd_query);
44 } // end if
46 header("Content-Type: text/xml; charset=utf-8");
47 header("Cache-Control: no-cache");
48 die("<root act='save_pos' return='strModifications'></root>");