merge Loic's version

This commit is contained in:
Marc Delisle
2001-07-30 21:21:19 +00:00
parent 5e29b9ec10
commit 0ab0ad63b1
37 changed files with 5108 additions and 3655 deletions

View File

@@ -2,147 +2,145 @@
/* $Id$ */
require("./grab_globals.inc.php3");
if(!isset($message))
{
include("./header.inc.php3");
}
else
{
/**
* Gets the variables sent or posted to this script, then displays headers
*/
require('./grab_globals.inc.php3');
if (!isset($message)) {
include('./header.inc.php3');
} else {
show_message($message);
}
unset($sql_query);
/**
* Selects the database
*/
mysql_select_db($db);
if(MYSQL_MAJOR_VERSION == "3.23")
{
$result = mysql_query("SHOW TABLE STATUS LIKE '$table'") or mysql_die();
$row = mysql_fetch_array($result);
if(!empty($row["Comment"]))
{
echo "$strTableComments: " . $row['Comment'];
/**
* Displays the comments of the table is MySQL >= 3.23
*/
if (MYSQL_MAJOR_VERSION >= 3.23) {
$result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die();
$row = mysql_fetch_array($result);
if (!empty($row['Comment'])) {
echo $strTableComments . ' : ' . $row['Comment'];
}
}
} // end display comments
$result = mysql_query("SHOW KEYS FROM $table") or mysql_die();
$primary = "";
while($row = mysql_fetch_array($result))
if ($row["Key_name"] == "PRIMARY")
$primary .= "$row[Column_name], ";
$result = mysql_query("SHOW FIELDS FROM $table") or mysql_die();
/**
* Displays the table structure
*/
// Gets fields properties
$result = mysql_query('SHOW FIELDS FROM ' . backquote($table)) or mysql_die();
?>
<table border=<?php echo $cfgBorder;?>>
<TR>
<TH><?php echo $strField; ?></TH>
<TH><?php echo $strType; ?></TH>
<TH><?php echo $strAttr; ?></TH>
<TH><?php echo $strNull; ?></TH>
<TH><?php echo $strDefault; ?></TH>
<TH><?php echo $strExtra; ?></TH>
</TR>
<!-- TABLE INFORMATIONS -->
<table border="<?php echo $cfgBorder; ?>">
<tr>
<th><?php echo ucfirst($strField); ?></th>
<th><?php echo ucfirst($strType); ?></th>
<th><?php echo ucfirst($strAttr); ?></th>
<th><?php echo ucfirst($strNull); ?></th>
<th><?php echo ucfirst($strDefault); ?></th>
<th><?php echo ucfirst($strExtra); ?></th>
</tr>
<?php
$i=0;
while($row= mysql_fetch_array($result))
{
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
$bgcolor = $cfgBgcolorOne;
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
$i = 0;
while ($row = mysql_fetch_array($result)) {
$bgcolor = ($i % 2) ?$cfgBgcolorOne : $cfgBgcolorTwo;
$i++;
?>
<tr bgcolor="<?php echo $bgcolor;?>">
<td><?php echo $row["Field"];?>&nbsp;</td>
<td>
<?php
if(get_magic_quotes_gpc()) {
$Type = stripslashes($row["Type"]);
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
$shorttype = substr($type, 0, 3);
if ($shorttype == 'set' || $shorttype == 'enu') {
$type = eregi_replace(',', ', ', $type);
$type_nowrap = '';
} else {
$Type = $row["Type"];
$type_nowrap = ' nowrap="nowrap"';
}
// reformat mysql query output - staybyte - 9. June 2001
$shorttype=substr($Type,0,3);
if ($shorttype=="set" || $shorttype=="enu"){
$Type=eregi_replace (",",", ",$Type);
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
if (empty($type)) {
$type = '&nbsp;';
}
$Type = eregi_replace("BINARY", "", $Type);
$Type = eregi_replace("ZEROFILL", "", $Type);
$Type = eregi_replace("UNSIGNED", "", $Type);
if (!empty($Type)) echo $Type;
else echo "&nbsp;";
?></td><td>
<?php
$binary = eregi("BINARY", $row["Type"], $test);
$unsigned = eregi("UNSIGNED", $row["Type"], $test);
$zerofill = eregi("ZEROFILL", $row["Type"], $test);
$strAttribute="";
if ($binary)
$strAttribute="BINARY";
if ($unsigned)
$strAttribute="UNSIGNED";
if ($zerofill)
$strAttribute="UNSIGNED ZEROFILL";
if (!empty($strAttribute)) echo $strAttribute;
else echo "&nbsp;";
$strAttribute="";
?></td>
<td><?php if ($row["Null"] == "") { echo $strNo;} else {echo $strYes;}?>&nbsp;</td>
<td><?php if(isset($row["Default"])) echo $row["Default"];?>&nbsp;</td>
<td><?php echo $row["Extra"];?>&nbsp;</td>
</tr>
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
$strAttribute = '&nbsp;';
if ($binary) {
$strAttribute = 'BINARY';
}
if ($unsigned) {
$strAttribute = 'UNSIGNED';
}
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
echo "\n";
?>
<tr bgcolor="<?php echo $bgcolor; ?>">
<td nowrap="nowrap"><?php echo htmlspecialchars($row['Field']); ?>&nbsp;</td>
<td<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
<td nowrap="nowrap"><?php echo $strAttribute; ?></td>
<td><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo htmlspecialchars($row['Default']); ?>&nbsp;</td>
<td nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
</tr>
<?php
}
} // end while
echo "\n";
?>
</table>
<?php
$result = mysql_query("SHOW KEYS FROM ".$table) or mysql_die();
if(mysql_num_rows($result)>0)
{
/**
* Displays indexes
*/
$result = mysql_query('SHOW KEYS FROM ' . backquote($table)) or mysql_die();
if (mysql_num_rows($result) > 0) {
?>
<br>
<table border=<?php echo $cfgBorder;?>>
<tr>
<th><?php echo $strKeyname; ?></th>
<th><?php echo $strUnique; ?></th>
<th><?php echo $strField; ?></th>
</tr>
<?php
for($i=0 ; $i<mysql_num_rows($result); $i++)
{
$row = mysql_fetch_array($result);
echo "<tr>";
if($row["Key_name"] == "PRIMARY")
{
$sql_query = urlencode("ALTER TABLE ".$table." DROP PRIMARY KEY");
$zero_rows = urlencode($strPrimaryKey." ".$strHasBeenDropped);
}
else
{
$sql_query = urlencode("ALTER TABLE ".$table." DROP INDEX ".$row["Key_name"]);
$zero_rows = urlencode($strIndex." ".$row["Key_name"]." ".$strHasBeenDropped);
}
?>
<td><?php echo $row["Key_name"];?></td>
<td><?php
if($row["Non_unique"]=="0")
echo $strYes;
else
echo $strNo;
?></td>
<td><?php echo $row["Column_name"];?></td>
<?php
echo "</tr>";
}
print "</table>\n";
}
require("./footer.inc.php3");
<!-- Indexes -->
<br />
<?php echo $strIndexes . '&nbsp;:' . "\n"; ?>
<table border="<?php echo $cfgBorder; ?>">
<tr>
<th><?php echo $strKeyname; ?></th>
<th><?php echo $strUnique; ?></th>
<th><?php echo $strField; ?></th>
</tr>
<?php
for ($i = 0 ; $i < mysql_num_rows($result); $i++) {
$row = mysql_fetch_array($result);
echo "\n";
?>
<tr>
<td><?php echo htmlspecialchars($row['Key_name']) . "\n"; ?></td>
<td><?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?></td>
<td><?php echo htmlspecialchars($row['Column_name']) . "\n"; ?></td>
</tr>
<?php
} // end for
echo "\n";
?>
</table>
<?php
} // end if
/**
* Displays the footer
*/
echo "\n";
require('./footer.inc.php3');
?>