diff --git a/ChangeLog b/ChangeLog index f8032e993..229edbb62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog $Id$ $HeadURL$ +2006-11-22 Marc Delisle + * Designer: get rid of pmd_config.php + 2006-11-21 Marc Delisle * pmd_general.php, lang/*: added $strHelp diff --git a/pmd_config.php b/pmd_config.php deleted file mode 100644 index b0dbe52ce..000000000 --- a/pmd_config.php +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/pmd_get_info.php b/pmd_get_info.php deleted file mode 100644 index 72d17a3e4..000000000 --- a/pmd_get_info.php +++ /dev/null @@ -1,184 +0,0 @@ - $value) { - $con['C_NAME'][$i] = ''; - $con['DTN'][$i] = $db . "." . $val[0]; - $con['DCN'][$i] = $field; - $con['STN'][$i] = $value['foreign_db'] . "." . $value['foreign_table']; - $con['SCN'][$i] = $value['foreign_field']; - $i++; - } - } - $row = PMA_getForeigners($db,$val[0],'','innodb'); - if ($row !== false) { - foreach ($row as $field => $value) { - $con['C_NAME'][$i] = ''; - $con['DTN'][$i] = $db.".".$val[0]; - $con['DCN'][$i] = $field; - $con['STN'][$i] = $value['foreign_db'].".".$value['foreign_table']; - $con['SCN'][$i] = $value['foreign_field']; - $i++; - } - } - } - - $ti = 0; - $script_contr = ""; - return $script_contr; -} - -function get_pk_or_unique_keys() { - global $db; - require_once('./libraries/tbl_indexes.lib.php'); - - PMA_DBI_select_db($db); - $tables_pk_or_unique_keys = array(); - - for( $I=0; $I $one_index) { - $column_name = $one_index[1]['Column_name']; - if (isset($indexes_info[$key_name]) && $indexes_info[$key_name]['Non_unique'] == 0) { - $tables_pk_or_unique_keys[$GLOBALS['PMD']['OWNER'][$I] . '.' .$GLOBALS['PMD']['TABLE_NAME_SMALL'][$I] . '.' . $column_name] = 1; - } - } - } - } - return $tables_pk_or_unique_keys; -} - -function get_all_keys() { - global $db; - require_once('./libraries/tbl_indexes.lib.php'); - - PMA_DBI_select_db($db); - $tables_all_keys = array(); - - for( $I=0; $I diff --git a/pmd_pdf.php b/pmd_pdf.php index 218388aff..b1129ac8a 100644 --- a/pmd_pdf.php +++ b/pmd_pdf.php @@ -8,7 +8,6 @@ if ( ! isset($scale)) { include_once 'pmd_save_pos.php'; } require_once './libraries/relation.lib.php'; -require_once 'pmd_config.php'; if (isset($scale)) { if (empty($pdf_page_number)) { diff --git a/pmd_session.php b/pmd_session.php index b01617c18..7a5be9eeb 100644 --- a/pmd_session.php +++ b/pmd_session.php @@ -7,7 +7,183 @@ */ require_once './libraries/common.lib.php'; -require_once 'pmd_config.php'; -require_once 'pmd_get_info.php'; +$GLOBALS['PMD']['STYLE'] = 'default'; + +require_once './libraries/relation.lib.php'; +function get_tabs() // PMA_DBI +{ + global $db; + $GLOBALS['PMD']['TABLE_NAME'] = array();// that foreach no error + $GLOBALS['PMD']['OWNER'] = array(); + $GLOBALS['PMD']['TABLE_NAME_SMALL'] = array(); + + $tables = PMA_DBI_get_tables_full($db); + // seems to be needed later + PMA_DBI_select_db($db); + $i = 0; + foreach ($tables as $one_table) { + $GLOBALS['PMD']['TABLE_NAME'][$i] = $db . "." . $one_table['TABLE_NAME']; + $GLOBALS['PMD']['OWNER'][$i] = $db; + $GLOBALS['PMD']['TABLE_NAME_SMALL'][$i] = $one_table['TABLE_NAME']; + $GLOBALS['PMD']['TABLE_TYPE'][$i] = strtoupper($one_table['ENGINE']); + $i++; + } + // return $GLOBALS['PMD']; // many bases // not use ?????? +} + +function get_tab_info() // PMA_DBI //PMA_backquote +{ + global $db; + PMA_DBI_select_db($db); + $tab_column = array(); + for ( $i=0; $i < sizeof( $GLOBALS['PMD']["TABLE_NAME"] ); $i++ ) { + PMA_DBI_select_db($db); + $fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM '.PMA_backquote($GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]), NULL, PMA_DBI_QUERY_STORE); + $fields_cnt = PMA_DBI_num_rows($fields_rs); + $j=0; + while ($row = PMA_DBI_fetch_assoc($fields_rs)) { + $tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_ID'][$j] = $j; + $tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_NAME'][$j] = $row['Field']; + $tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['TYPE'][$j] = $row['Type']; + $tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['NULLABLE'][$j] = $row['Null']; + $j++; + } + } +return $tab_column; +} +//-------------------------------------CONTR----------------------------------------------- +function get_script_contr() { + global $db; + PMA_DBI_select_db($db); + $con["C_NAME"] = array(); + PMA_getRelationsParam(); + $i = 0; + $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db), NULL, PMA_DBI_QUERY_STORE); + while ($val = @PMA_DBI_fetch_row($alltab_rs)) { + $row = PMA_getForeigners($db,$val[0],'','internal'); + if ($row !== false) { + foreach ($row as $field => $value) { + $con['C_NAME'][$i] = ''; + $con['DTN'][$i] = $db . "." . $val[0]; + $con['DCN'][$i] = $field; + $con['STN'][$i] = $value['foreign_db'] . "." . $value['foreign_table']; + $con['SCN'][$i] = $value['foreign_field']; + $i++; + } + } + $row = PMA_getForeigners($db,$val[0],'','innodb'); + if ($row !== false) { + foreach ($row as $field => $value) { + $con['C_NAME'][$i] = ''; + $con['DTN'][$i] = $db.".".$val[0]; + $con['DCN'][$i] = $field; + $con['STN'][$i] = $value['foreign_db'].".".$value['foreign_table']; + $con['SCN'][$i] = $value['foreign_field']; + $i++; + } + } + } + + $ti = 0; + $script_contr = ""; + return $script_contr; +} + +function get_pk_or_unique_keys() { + global $db; + require_once('./libraries/tbl_indexes.lib.php'); + + PMA_DBI_select_db($db); + $tables_pk_or_unique_keys = array(); + + for( $I=0; $I $one_index) { + $column_name = $one_index[1]['Column_name']; + if (isset($indexes_info[$key_name]) && $indexes_info[$key_name]['Non_unique'] == 0) { + $tables_pk_or_unique_keys[$GLOBALS['PMD']['OWNER'][$I] . '.' .$GLOBALS['PMD']['TABLE_NAME_SMALL'][$I] . '.' . $column_name] = 1; + } + } + } + } + return $tables_pk_or_unique_keys; +} + +function get_all_keys() { + global $db; + require_once('./libraries/tbl_indexes.lib.php'); + + PMA_DBI_select_db($db); + $tables_all_keys = array(); + + for( $I=0; $I