From b7b7b056ad44e259865aab3a7d3a44c61602c24f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 6 Nov 2002 13:51:49 +0000 Subject: [PATCH] Loic cleanup --- ChangeLog | 3 + db_datadict.php3 | 303 +++++++++++++++++++++++---------------------- tbl_printview.php3 | 72 ++++++----- 3 files changed, 201 insertions(+), 177 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a0d3d0ba..fc6833fc5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-11-06 Loïc Chapeaux + * db_datadict.php3, tbl_printview.php3: code cleanup + 2002-11-06 Marc Delisle * lang/ukrainian: update, thanks to Markijan Baran diff --git a/db_datadict.php3 b/db_datadict.php3 index f6892d8a1..497d78573 100644 --- a/db_datadict.php3 +++ b/db_datadict.php3 @@ -1,6 +1,7 @@ = 32303) { - $myfieldname="Tables_in_".$db; + $myfieldname = 'Tables_in_' . $db; } else { - $myfieldname="Tables in ".$db; + $myfieldname = 'Tables in ' . $db; } - $table=$row[$myfieldname]; + $table = $row[$myfieldname]; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['commwork']) { $comments = PMA_getComments($db, $table); } - if ($count!=0){ - echo "

"; + if ($count != 0) { + echo '

' . "\n"; } echo '

' . $table . '

' . "\n"; - /** - * Gets table informations - */ - // The 'show table' statement works correct since 3.23.03 + /** + * Gets table informations + */ + // The 'show table' statement works correct since 3.23.03 if (PMA_MYSQL_INT_VERSION >= 32303) { $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); @@ -77,9 +83,9 @@ while ($row=mysql_fetch_array($rowset)) { } - /** - * Gets table keys and retains them - */ + /** + * Gets table keys and retains them + */ $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table); $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $primary = ''; @@ -88,14 +94,14 @@ while ($row=mysql_fetch_array($rowset)) { $indexes_info = array(); $indexes_data = array(); $pk_array = array(); // will be use to emphasis prim. keys in the table - // view + // view while ($row = PMA_mysql_fetch_array($result)) { - // Backups the list of primary keys + // Backups the list of primary keys if ($row['Key_name'] == 'PRIMARY') { - $primary .= $row['Column_name'] . ', '; + $primary .= $row['Column_name'] . ', '; $pk_array[$row['Column_name']] = 1; } - // Retains keys informations + // Retains keys informations if ($row['Key_name'] != $lastIndex ){ $indexes[] = $row['Key_name']; $lastIndex = $row['Key_name']; @@ -105,8 +111,8 @@ while ($row=mysql_fetch_array($rowset)) { if (isset($row['Cardinality'])) { $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; } - // I don't know what does following column mean.... - // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; + // I don't know what does following column mean.... + // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; @@ -120,17 +126,17 @@ while ($row=mysql_fetch_array($rowset)) { } - /** - * Gets fields properties - */ + /** + * Gets fields properties + */ $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table); $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $fields_cnt = mysql_num_rows($result); - // Check if we can use Relations (Mike Beck) + // Check if we can use Relations (Mike Beck) if (!empty($cfgRelation['relation'])) { - // Find which tables are related with the current one and write it in - // an array + // Find which tables are related with the current one and write it in + // an array $res_rel = PMA_getForeigners($db, $table); if (count($res_rel) > 0) { @@ -144,146 +150,153 @@ while ($row=mysql_fetch_array($rowset)) { } // end if - /** - * Displays the comments of the table if MySQL >= 3.23 - */ + /** + * Displays the comments of the table if MySQL >= 3.23 + */ if (!empty($show_comment)) { echo $strTableComments . ' : ' . $show_comment . '

'; } - /** - * Displays the table structure - */ - ?> + /** + * Displays the table structure + */ + ?> - - - - - - - - - - ' . ucfirst($strLinksTo) . '' . "\n"; - } - if ($cfgRelation['commwork']) { - echo ' ' . "\n"; - } - ?> - + +
' . ucfirst($strComments) . '
+ + + + + + + + ' . ucfirst($strLinksTo) . '' . "\n"; + } + if ($cfgRelation['commwork']) { + echo ' ' . "\n"; + } + ?> + - NULL'; - } - } else { - $row['Default'] = htmlspecialchars($row['Default']); - } - $field_name = htmlspecialchars($row['Field']); - echo "\n"; - ?> - - - - - - - - '; - if (isset($res_rel[$field_name])) { - echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); - } - echo ' ' . "\n"; - } - if ($cfgRelation['commwork']) { - echo ' ' . "\n"; - } - ?> - - NULL'; + } + } else { + $row['Default'] = htmlspecialchars($row['Default']); + } + $field_name = htmlspecialchars($row['Field']); + echo "\n"; + ?> + + + + + + + + '; + if (isset($res_rel[$field_name])) { + echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']); + } + echo ' ' . "\n"; + } + if ($cfgRelation['commwork']) { + echo ' ' . "\n"; + } + ?> + + -
' . ucfirst($strComments) . '
- ' . $field_name . ' ' . "\n"; - } else { - echo ' ' . $field_name . ' ' . "\n"; - } - ?> - >  '; - if (isset($comments[$field_name])) { - echo htmlspecialchars($comments[$field_name]); - } - echo ' 
+ ' . $field_name . ' ' . "\n"; + } else { + echo ' ' . $field_name . ' ' . "\n"; + } + ?> + >  '; + if (isset($comments[$field_name])) { + echo htmlspecialchars($comments[$field_name]); + } + echo ' 
- ' . "\n"; + echo "\n"; + ?> + + + ' . "\n"; + + $count++; +} //ends main while - $count++; -}//ends main while /** * Displays the footer */ echo "\n"; -echo '

 '; -require('./footer.inc.php3'); ?> +
 ' . "\n"; + +require('./footer.inc.php3'); +?> diff --git a/tbl_printview.php3 b/tbl_printview.php3 index e2a6c3c34..b80d20a4e 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -1,5 +1,4 @@ ' . "\n"; + echo '' . "\n"; echo '

' . $table . '

' . "\n"; - + /** * Gets table informations */ @@ -165,8 +165,7 @@ while (list($key, $table) = each($the_tables)) { } else { $have_rel = FALSE; - } - // end if + } // end if /** @@ -175,28 +174,28 @@ while (list($key, $table) = each($the_tables)) { if (!empty($show_comment)) { echo $strTableComments . ' : ' . $show_comment . '

'; } - + /** * Displays the table structure */ ?> - +
- - - - - - + + + + + + ' . ucfirst($strLinksTo) . '' . "\n"; + echo ' ' . "\n"; } if ($cfgRelation['commwork']) { - echo ' ' . "\n"; + echo ' ' . "\n"; } ?> @@ -248,7 +247,7 @@ while (list($key, $table) = each($the_tables)) { echo "\n"; ?> - - - - - - + + + + + '; + echo ' ' . "\n"; } if ($cfgRelation['commwork']) { - echo '
' . ucfirst($strLinksTo) . '' . ucfirst($strComments) . '' . ucfirst($strComments) . '
+ ' . $field_name . ' ' . "\n"; @@ -257,22 +256,22 @@ while (list($key, $table) = each($the_tables)) { } ?> >  >   '; if (isset($res_rel[$field_name])) { echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); } echo ' '; + echo ' '; $comments = PMA_getComments($db, $table); if (isset($comments[$field_name])) { echo htmlspecialchars($comments[$field_name]); @@ -304,7 +303,7 @@ while (list($key, $table) = each($the_tables)) {   - +
@@ -409,7 +408,7 @@ while (list($key, $table) = each($the_tables)) {
  - +
@@ -465,7 +464,7 @@ while (list($key, $table) = each($the_tables)) {
  - +
@@ -570,13 +569,22 @@ while (list($key, $table) = each($the_tables)) { * Displays the footer */ echo "\n"; -echo "

 "; -require('./footer.inc.php3'); -?> +
 ' . "\n"; + +require('./footer.inc.php3'); +?>