update .po files
[phpmyadmin/crack.git] / pmd_relation_upd.php
blobf05ffbd92e61c66e7638b3e4ba9fcb3c2e751dd4
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin-Designer
6 */
8 /**
11 include_once 'pmd_common.php';
12 extract($_POST, EXTR_SKIP);
13 extract($_GET, EXTR_SKIP);
14 $die_save_pos = 0;
15 include_once 'pmd_save_pos.php';
16 list($DB1,$T1) = explode(".",$T1);
17 list($DB2,$T2) = explode(".",$T2);
19 $tables = PMA_DBI_get_tables_full($db, $T1);
20 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
21 $tables = PMA_DBI_get_tables_full($db, $T2);
22 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
24 if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) && $type_T1 == $type_T2) {
25 // InnoDB
26 $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
28 if (isset($existrel_foreign[$F2]['constraint'])) {
29 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
30 . ' DROP FOREIGN KEY '
31 . PMA_backquote($existrel_foreign[$F2]['constraint']);
32 $upd_rs = PMA_DBI_query($upd_query);
34 } else {
35 // internal relations
36 PMA_query_as_controluser('DELETE FROM '
37 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
38 . $cfg['Server']['relation'].' WHERE '
39 . 'master_db = \'' . PMA_sqlAddslashes($DB2) . '\''
40 . ' AND master_table = \'' . PMA_sqlAddslashes($T2) . '\''
41 . ' AND master_field = \'' . PMA_sqlAddslashes($F2) . '\''
42 . ' AND foreign_db = \'' . PMA_sqlAddslashes($DB1) . '\''
43 . ' AND foreign_table = \'' . PMA_sqlAddslashes($T1) . '\''
44 . ' AND foreign_field = \'' . PMA_sqlAddslashes($F1) . '\''
45 , FALSE, PMA_DBI_QUERY_STORE);
47 PMD_return_upd(1, __('Relation deleted'));
49 function PMD_return_upd($b,$ret)
51 global $K;
52 header("Content-Type: text/xml; charset=utf-8");
53 header("Cache-Control: no-cache");
54 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');