Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / pmd_display_field.php
blobaffece4f4ac699990a2614a30bd968bebf8fac96
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 $post_params = array(
17 'T',
18 'F'
21 foreach ($post_params as $one_post_param) {
22 if (isset($_POST[$one_post_param])) {
23 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
27 $table = $T;
28 $display_field = $F;
30 if ($cfgRelation['displaywork']) {
32 $disp = PMA_getDisplayField($db, $table);
33 if ($disp) {
34 if ($display_field != $disp) {
35 $upd_query = 'UPDATE ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info'])
36 . ' SET display_field = \'' . PMA_Util::sqlAddSlashes($display_field) . '\''
37 . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
38 . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
39 } else {
40 $upd_query = 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info'])
41 . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
42 . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
44 } elseif ($display_field != '') {
45 $upd_query = 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info'])
46 . '(db_name, table_name, display_field) '
47 . ' VALUES('
48 . '\'' . PMA_Util::sqlAddSlashes($db) . '\','
49 . '\'' . PMA_Util::sqlAddSlashes($table) . '\','
50 . '\'' . PMA_Util::sqlAddSlashes($display_field) . '\')';
53 if (isset($upd_query)) {
54 $upd_rs = PMA_queryAsControlUser($upd_query);
56 } // end if
58 header("Content-Type: text/xml; charset=utf-8");
59 header("Cache-Control: no-cache");
60 die("<root act='save_pos' return='" . __('Modifications have been saved') . "'></root>");