Options displayed with the results of a query depends now on its type (bug #425888)

This commit is contained in:
Loïc Chapeaux
2001-05-28 22:10:33 +00:00
parent 541da39b13
commit f65f873b29
5 changed files with 60 additions and 32 deletions

View File

@@ -5,8 +5,13 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2001-05-28 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lib.inc.php3, line 5: fixed a warning
* lib.inc.php3, main.php3, sql.php3, tbl_properties: options displayed with
the results of a query depends now on its type (bug #425888)
2001-05-27 Marc Delisle <lem9@users.sourceforge.net> 2001-05-27 Marc Delisle <lem9@users.sourceforge.net>
* bug #426357: mysql_db_query deprecated * bug #426357: mysql_db_query deprecated
2001-05-24 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2001-05-24 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lib.inc.php3, line 131+: fixed the authentification failure with advanced * lib.inc.php3, line 131+: fixed the authentification failure with advanced

View File

@@ -2,7 +2,9 @@
/* $Id$ */ /* $Id$ */
require("./config.inc.php3"); require("./config.inc.php3");
mysql_select_db($db); if (isset($db)) {
mysql_select_db($db);
}
if(!defined("__LIB_INC__")) { if(!defined("__LIB_INC__")) {
define("__LIB_INC__", 1); define("__LIB_INC__", 1);
@@ -285,7 +287,7 @@ if($server == 0) {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
function display_table ($dt_result) { function display_table ($dt_result, $is_simple = false) {
global $cfgBorder, $cfgBgcolorOne, $cfgBgcolorTwo, $cfgMaxRows, $pos; global $cfgBorder, $cfgBgcolorOne, $cfgBgcolorTwo, $cfgMaxRows, $pos;
global $server, $lang, $db, $table, $sql_query, $sql_order, $cfgOrder, $cfgShowBlob; global $server, $lang, $db, $table, $sql_query, $sql_order, $cfgOrder, $cfgShowBlob;
global $goto, $strShowingRecords, $strSelectNumRows, $SelectNumRows; global $goto, $strShowingRecords, $strSelectNumRows, $SelectNumRows;
@@ -299,20 +301,22 @@ function display_table ($dt_result) {
load_javascript(); load_javascript();
$primary = false; $primary = false;
if(!empty($table) && !empty($db)) { if(!$is_simple && !empty($table) && !empty($db)) {
$result = mysql_query("SELECT COUNT(*) as total FROM $db.$table") or mysql_die(); $result = mysql_query("SELECT COUNT(*) as total FROM $db.$table") or mysql_die();
$row = mysql_fetch_array($result); $row = mysql_fetch_array($result);
$total = $row["total"]; $total = $row["total"];
} }
if(!isset($pos)) if (!$is_simple) {
$pos = 0; if(!isset($pos)) {
$pos_next = $pos + $cfgMaxRows; $pos = 0;
$pos_prev = $pos - $cfgMaxRows; }
$pos_next = $pos + $cfgMaxRows;
if ($pos_prev < 0) { $pos_prev = $pos - $cfgMaxRows;
$pos_prev = 0; if ($pos_prev < 0) {
} $pos_prev = 0;
}
}
if(isset($total) && $total>1) { if(isset($total) && $total>1) {
if(isset($SelectNumRows) && $SelectNumRows!=$total) if(isset($SelectNumRows) && $SelectNumRows!=$total)
@@ -332,26 +336,28 @@ function display_table ($dt_result) {
$field = mysql_fetch_field($dt_result); $field = mysql_fetch_field($dt_result);
$table = $field->table; $table = $field->table;
mysql_field_seek($dt_result, 0); mysql_field_seek($dt_result, 0);
show_table_navigation($pos_next, $pos_prev, $dt_result); if (!$is_simple) {
show_table_navigation($pos_next, $pos_prev, $dt_result);
} else {
echo '<p></p><p></p>';
}
?> ?>
<table border="<?php echo $cfgBorder;?>"> <table border="<?php echo $cfgBorder;?>">
<tr> <tr>
<?php <?php
if($cfgModifyDeleteAtLeft) { if($cfgModifyDeleteAtLeft && !$is_simple) {
echo "<td></td><td></td>\n"; echo "<td></td><td></td>\n";
} }
while($field = mysql_fetch_field($dt_result)) while($field = mysql_fetch_field($dt_result))
{ {
if(@mysql_num_rows($dt_result)>1) if(@mysql_num_rows($dt_result)>1 && !$is_simple)
{ {
$sort_order=urlencode(" order by $field->name $cfgOrder"); $sort_order=urlencode(" order by $field->name $cfgOrder");
echo "<th>"; echo "<th>";
if(!eregi("SHOW VARIABLES|SHOW PROCESSLIST|SHOW STATUS", $sql_query))
echo "<A HREF=\"sql.php3?server=$server&lang=$lang&db=$db&pos=$pos&sql_query=".urlencode($sql_query)."&sql_order=$sort_order&table=$table\">"; echo "<A HREF=\"sql.php3?server=$server&lang=$lang&db=$db&pos=$pos&sql_query=".urlencode($sql_query)."&sql_order=$sort_order&table=$table\">";
echo $field->name; echo $field->name;
if(!eregi("SHOW VARIABLES|SHOW PROCESSLIST|SHOW STATUS", $sql_query))
echo "</a>"; echo "</a>";
echo "</th>\n"; echo "</th>\n";
} }
@@ -423,7 +429,7 @@ function display_table ($dt_result) {
$delete_url .= "?sql_query=".urlencode("DELETE FROM $table WHERE ").$uva_condition; $delete_url .= "?sql_query=".urlencode("DELETE FROM $table WHERE ").$uva_condition;
$delete_url .= "&$query"; $delete_url .= "&$query";
$delete_url .= "&goto=sql.php3".urlencode("?$query&goto=tbl_properties.php3&sql_query=".urlencode($sql_query)."&zero_rows=".urlencode($strDeleted)); $delete_url .= "&goto=sql.php3".urlencode("?$query&goto=tbl_properties.php3&sql_query=".urlencode($sql_query)."&zero_rows=".urlencode($strDeleted));
if($cfgModifyDeleteAtLeft) { if($cfgModifyDeleteAtLeft && !$is_simple) {
echo "<td><a href=\"$edit_url\">".$strEdit."</a></td>"; echo "<td><a href=\"$edit_url\">".$strEdit."</a></td>";
echo "<td><a href=\"$delete_url\">".$strDelete."</a></td>"; echo "<td><a href=\"$delete_url\">".$strDelete."</a></td>";
} }
@@ -447,7 +453,7 @@ function display_table ($dt_result) {
echo "<td>&nbsp;".htmlspecialchars($row[$i])."&nbsp;</td>\n"; echo "<td>&nbsp;".htmlspecialchars($row[$i])."&nbsp;</td>\n";
} }
} }
if($cfgModifyDeleteAtRight) { if($cfgModifyDeleteAtRight && !$is_simple) {
echo "<td><a href=\"$edit_url\">".$strEdit."</a></td>"; echo "<td><a href=\"$edit_url\">".$strEdit."</a></td>";
echo "<td><a href=\"$delete_url\">".$strDelete."</a></td>"; echo "<td><a href=\"$delete_url\">".$strDelete."</a></td>";
} }
@@ -457,7 +463,9 @@ function display_table ($dt_result) {
} }
echo "</table>\n"; echo "</table>\n";
show_table_navigation($pos_next, $pos_prev, $dt_result); if (!$is_simple) {
show_table_navigation($pos_next, $pos_prev, $dt_result);
}
}//display_table }//display_table
// Return $table's CREATE definition // Return $table's CREATE definition

View File

@@ -112,16 +112,16 @@ if($server > 0) {
if($result_usr['References_priv']=='Y') { if($result_usr['References_priv']=='Y') {
?> ?>
<li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW STATUS");?>"> <li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW STATUS");?>&display=simple">
<?php echo $strMySQLShowStatus;?></a> <?php print show_docu("manual_Reference.html#Show");?> <?php echo $strMySQLShowStatus;?></a> <?php print show_docu("manual_Reference.html#Show");?>
<li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW VARIABLES");?>"> <li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW VARIABLES");?>&display=simple">
<?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance"); <?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance");
} }
if($result_usr['Process_priv']=='Y') { if($result_usr['Process_priv']=='Y') {
?> ?>
<li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW PROCESSLIST");?>"> <li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW PROCESSLIST");?>&display=simple">
<?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show"); <?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show");
} }

View File

@@ -107,17 +107,32 @@ else {
else else
{ {
include("./header.inc.php3"); include("./header.inc.php3");
display_table($result); // Define the display mode if it wasn't passed by url
if(!eregi("SHOW VARIABLES|SHOW PROCESSLIST|SHOW STATUS", $sql_query)) if (!isset($display)) {
$display = eregi('^((SHOW (VARIABLES|PROCESSLIST|STATUS))|((CHECK|ANALYZE|REPAIR|OPTIMIZE) TABLE ))', $sql_query, $which);
if (!empty($which[2]) && !empty($which[3])) {
$display = 'simple';
} else if (!empty($which[4]) && !empty($which[5])) {
$display = 'bkmOnly';
}
}
display_table($result, ($display == 'simple' || $display == 'bkmOnly'));
if ($display != 'simple')
{ {
echo "<p><a href=\"tbl_change.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&goto=$goto&sql_query=".urlencode($sql_query)."\"> $strInsertNewRow</a></p>"; if ($display != 'bkmOnly') {
echo "<p><a href=\"tbl_change.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&goto=$goto&sql_query=".urlencode($sql_query)."\"> $strInsertNewRow</a></p>";
}
// Bookmark Support // Bookmark Support
if($cfgBookmark['db'] && $cfgBookmark['table'] && $db!=$cfgBookmark['db'] && empty($id_bookmark)) if($cfgBookmark['db'] && $cfgBookmark['table'] && $db!=$cfgBookmark['db'] && empty($id_bookmark))
{ {
echo "<form method=\"post\" action=\"tbl_replace.php3\">\n"; echo "<form method=\"post\" action=\"tbl_replace.php3\">\n";
echo "<i>$strOr</i><br><br>\n"; if ($display != 'bkmOnly') {
echo "<i>$strOr</i>";
}
echo "<br><br>\n";
echo $strBookmarkLabel.":\n"; echo $strBookmarkLabel.":\n";
$goto="sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&id_bookmark=1&sql_query=".urlencode($sql_query); $goto="sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&id_bookmark=1&sql_query=".urlencode($sql_query);
?> ?>

View File

@@ -230,10 +230,10 @@ if($cfgBookmark['db'] && $cfgBookmark['table'])
<input type="submit" name="SQL" value="<?php echo $strGo; ?>"> <input type="submit" name="SQL" value="<?php echo $strGo; ?>">
</form> </form>
<li><a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table");?>&pos=0&<?php echo $query;?>"><?php echo $strBrowse; ?></a></li> <li><a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table");?>&pos=0&<?php echo $query;?>"><?php echo $strBrowse; ?></a></li>
<li><a href="sql.php3?sql_query=<?php echo urlencode("CHECK TABLE $table");?>&pos=0&<?php echo $query;?>"><?php echo $strCheckTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#CHECK_TABLE"); ?></li> <li><a href="sql.php3?sql_query=<?php echo urlencode("CHECK TABLE $table");?>&display=bkmOnly&<?php echo $query;?>"><?php echo $strCheckTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#CHECK_TABLE"); ?></li>
<li><a href="sql.php3?sql_query=<?php echo urlencode("ANALYZE TABLE $table");?>&pos=0&<?php echo $query;?>"><?php echo $strAnalyzeTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#ANALYZE_TABLE"); ?></li> <li><a href="sql.php3?sql_query=<?php echo urlencode("ANALYZE TABLE $table");?>&display=bkmOnly&<?php echo $query;?>"><?php echo $strAnalyzeTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#ANALYZE_TABLE"); ?></li>
<li><a href="sql.php3?sql_query=<?php echo urlencode("REPAIR TABLE $table");?>&pos=0&<?php echo $query;?>"><?php echo $strRepairTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#REPAIR_TABLE"); ?></li> <li><a href="sql.php3?sql_query=<?php echo urlencode("REPAIR TABLE $table");?>&display=bkmOnly&<?php echo $query;?>"><?php echo $strRepairTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#REPAIR_TABLE"); ?></li>
<li><a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table");?>&pos=0&<?php echo $query;?>"><?php echo $strOptimizeTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#OPTIMIZE_TABLE"); ?></li> <li><a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table");?>&display=bkmOnly&<?php echo $query;?>"><?php echo $strOptimizeTable; ?></a>&nbsp;<?php echo show_docu("manual_Reference.html#OPTIMIZE_TABLE"); ?></li>
<li><a href="tbl_select.php3?<?php echo $query;?>"><?php echo $strSelect; ?></a></li> <li><a href="tbl_select.php3?<?php echo $query;?>"><?php echo $strSelect; ?></a></li>
<li><a href="tbl_change.php3?<?php echo $query;?>"><?php echo $strInsert; ?></a></li> <li><a href="tbl_change.php3?<?php echo $query;?>"><?php echo $strInsert; ?></a></li>
<li><form method="post" action="tbl_addfield.php3"> <input type="hidden" name="server" value="<?php echo $server;?>"> <li><form method="post" action="tbl_addfield.php3"> <input type="hidden" name="server" value="<?php echo $server;?>">