Rewritten (PEAR coding standards + XHTML1.0) an fixed bad case in documentation links' anchors

This commit is contained in:
Loïc Chapeaux
2001-06-23 11:01:23 +00:00
parent 1a6e1c0d6f
commit c41eed2b52

296
main.php3
View File

@@ -2,19 +2,22 @@
/* $Id$ */ /* $Id$ */
require("./grab_globals.inc.php3");
/**
if (!isset($message)) { * Gets some core libraries and diplays a top message if required
include("./header.inc.php3"); * TODO: The included script aren't yet xhtml1.0 compliant
} else { */
include("./header.inc.php3"); require('./grab_globals.inc.php3');
include("./lib.inc.php3"); require('./header.inc.php3');
if (isset($message)) {
include('./lib.inc.php3');
show_message($message); show_message($message);
} }
?>
<?php
/**
* Displays language selection boxes
*/
if (empty($cfgLang)) { if (empty($cfgLang)) {
echo '<p>'; echo '<p>';
reset($available_languages); reset($available_languages);
@@ -27,172 +30,243 @@ if (empty($cfgLang)) {
} }
echo "\n<p><br />\n"; echo "\n<p><br />\n";
} }
/**
* Displays the welcome message and the server informations
*/
?> ?>
<h1><?php echo $strWelcome ?> phpMyAdmin 2.3.0alpha-20010604 (unofficial devel-branch)</h1> <h1><?php echo $strWelcome ?> phpMyAdmin 2.3.0alpha-20010604 (unofficial devel-branch)</h1>
<?php <?php
if ($server > 0) {
// Don't display server info if $server == 0 (no server selected) // Don't display server info if $server == 0 (no server selected)
$res_version = mysql_query("SELECT Version() as version") or mysql_die(); if ($server > 0) {
$res_version = mysql_query('SELECT Version() as version') or mysql_die();
$row_version = mysql_fetch_array($res_version); $row_version = mysql_fetch_array($res_version);
echo '<p><b>MySQL ' . $row_version['version'] . ' ' . $strRunning . ' ' . $cfgServer['host'];
echo "<b>MySQL $row_version[version] $strRunning " . $cfgServer['host'];
if (!empty($cfgServer['port'])) { if (!empty($cfgServer['port'])) {
echo ":" . $cfgServer['port']; echo ':' . $cfgServer['port'];
} }
echo "</b><br>\n"; echo "</b></p>\n";
} }
?>
<div align="left">
<?php
if (($server > 0) && isset($mode) && ($mode == "reload"))
{ /**
$result = mysql_query("FLUSH PRIVILEGES"); * Reload mysql (flush privileges)
*/
if (($server > 0) && isset($mode) && ($mode == 'reload')) {
$result = mysql_query('FLUSH PRIVILEGES');
echo '<p><b>';
if ($result != 0) { if ($result != 0) {
echo "<b>$strMySQLReloaded</b>"; echo $strMySQLReloaded;
} else { } else {
echo "<b>$strReloadFailed</b>"; echo $strReloadFailed;
} }
echo '</b></p>' . "\n";
} }
/**
* Displays the servers choice form and/or the server-related links
*/
?> ?>
<ul> <ul>
<?php <?php
// 1. The servers choice form
if (count($cfgServers) > 1) if (count($cfgServers) > 1)
{ {
echo "<li>"; ?>
echo '<form action="index.php3" target="_top"><select name="server">'; <li>
<form action="index.php3" target="_top">
reset($cfgServers); <select name="server">
while(list($key, $val) = each($cfgServers)) { <?php
if(!empty($val['host'])) {
echo "<option value=\"$key\"";
if(!empty($server) && ($server == $key)) {
echo " selected";
}
echo ">";
print(!empty($val['verbose']) ? $val['verbose'] : $val['host']);
if(!empty($val['port'])) {
echo ":" . $val['port'];
}
if(!empty($val['only_db']))
echo " - ".$val['only_db'];
echo "\n"; echo "\n";
reset($cfgServers);
while (list($key, $val) = each($cfgServers))
{
if (!empty($val['host']))
{
echo ' <option value="' . $key . '"';
if (!empty($server) && ($server == $key)) {
echo ' selected';
} }
echo '>';
print((!empty($val['verbose'])) ? $val['verbose'] : $val['host']);
if (!empty($val['port'])) {
echo ':' . $val['port'];
} }
echo '</select><input type="hidden" name="lang" value="'.$lang.'">'; if (!empty($val['only_db'])) {
echo '<input type="submit" value="'.$strGo.'"></form>'; echo ' - ' . $val['only_db'];
} }
echo '</option>' . "\n";
} // end if (!empty($val['host']))
} // end while
?>
</select>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="submit" value="<?php echo $strGo; ?>" />
</form>
</li>
<?php
} // end of the servers choice form
if($server > 0) {
// Don't display server-related links if $server==0 (no server selected) // 2. The server-related links if $server > 0 (a server selected)
if(empty($cfgServer['only_db'])) { if ($server > 0
&& empty($cfgServer['only_db']))
{
// 2.1. With authentification
if ($cfgServer['adv_auth']) if ($cfgServer['adv_auth'])
{ {
// Get user's rights
if (empty($cfgServer['port'])) { if (empty($cfgServer['port'])) {
$dbh = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']); $dbh = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
} else { } else {
$dbh = mysql_connect($cfgServer['host'].":".$cfgServer['port'],$cfgServer['stduser'],$cfgServer['stdpass']); $dbh = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
} }
$rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $dbh);
$rs_usr=mysql_query("select * from mysql.user where User=\"".$cfgServer['user']."\"",$dbh);
$result_usr = mysql_fetch_array($rs_usr); $result_usr = mysql_fetch_array($rs_usr);
$rs_db=mysql_query("select * from mysql.db where User=\"".$cfgServer['user']."\"",$dbh); $create = ($result_usr['Create_priv'] == 'Y');
if(mysql_num_rows($rs_db)>0) { // The user is allowed the create a db
$result_db=mysql_fetch_array($rs_db); if ($create) {
} echo "\n";
if($result_usr['Create_priv']=='Y') {
$CREATE=TRUE;
// BEGIN
// 2001-05-04, Lem9: The create_priv on a single database does not allow
// to create a database
// } elseif(!empty($result_db) && $result_db['Create_priv']=='Y') {
// $CREATE=TRUE;
// END
} else {
$CREATE=FALSE;
}
if($CREATE) {
?> ?>
<!-- db creation form -->
<li> <li>
<form method="post" action="db_create.php3"> <form method="post" action="db_create.php3">
<?php echo $strCreateNewDatabase;?> <?php print show_docu("manual_Reference.html#Create_database");?><br><input type="Hidden" name="server" value="<?php echo $server; ?>"><input type="hidden" name="lang" value="<?php echo $lang;?>"><input type="hidden" name="reload" value="true"><input type="text" name="db"><input type="submit" value="<?php echo $strCreate; ?>"> <?php echo $strCreateNewDatabase . '&nbsp;' . show_docu('manual_Reference.html#CREATE_DATABASE'); ?><br />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="reload" value="true" />
<input type="text" name="db" />
<input type="submit" value="<?php echo $strCreate; ?>" />
</form> </form>
</li>
<?php <?php
} echo "\n";
} // end create db form
// Server related links
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");?>&display=simple"> <!-- server-related links -->
<?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 STATUS'); ?>&display=simple">
<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 $strMySQLShowStatus; ?></a>&nbsp;<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
<?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance"); </li>
<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>&nbsp;<?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
</li>
<?php
echo "\n";
} }
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");?>&display=simple"> <li>
<?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show"); <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>&nbsp;<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
</li>
<?php
echo "\n";
} }
if ($result_usr['Reload_priv'] == 'Y') { if ($result_usr['Reload_priv'] == 'Y') {
?> ?>
<li> <li>
<a href="main.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&mode=reload"><?php echo $strReloadMySQL; ?></a> <?php print show_docu("manual_Reference.html#Flush"); <a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
} <?php echo $strReloadMySQL; ?></a>&nbsp;<?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
?> </li>
<?php <?php
$result = mysql_query("SELECT * FROM mysql.user"); echo "\n";
}
$result = mysql_query('SELECT * FROM mysql.user');
$rows = @mysql_num_rows($result); $rows = @mysql_num_rows($result);
if (isset($rows)) { if (!empty($rows)) {
echo "<li><a href=\"user_details.php3?server=$server&lang=$lang&db=mysql&table=user\">";
echo "$strUsers</a> ";
print show_docu("manual_Privilege_system.html#Privilege_system");
}
?> ?>
<li><a href="index.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&old_usr=<?php echo $PHP_AUTH_USER;?>" target="_top"><b><?php echo $strLogout; ?></b></a> <li>
<a href="user_details.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&table=user">
<?php echo $strUsers; ?></a>&nbsp;<?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
</li>
<?php <?php
echo "\n";
} }
else
{ //No AdvAuth
?> ?>
<li>
<a href="index.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&old_usr=<?php echo $PHP_AUTH_USER; ?>" target="_top">
<b><?php echo $strLogout; ?></b></a>
</li>
<br /><br />
<?php
echo "\n";
} // end of 2.1 (AdvAuth case)
// 2.2. No authentification
else
{
?>
<!-- db creation form -->
<li> <li>
<form method="post" action="db_create.php3"> <form method="post" action="db_create.php3">
<?php echo $strCreateNewDatabase;?> <?php print show_docu("manual_Reference.html#Create_database");?><br><input type="Hidden" name="server" value="<?php echo $server; ?>"><input type="hidden" name="lang" value="<?php echo $lang;?>"><input type="hidden" name="reload" value="true"><input type="text" name="db"><input type="submit" value="<?php echo $strCreate; ?>"> <?php echo $strCreateNewDatabase . '&nbsp;' . show_docu('manual_Reference.html#CREATE_DATABASE'); ?><br />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="reload" value="true" />
<input type="text" name="db" />
<input type="submit" value="<?php echo $strCreate; ?>" />
</form> </form>
<li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW STATUS");?>"> </li>
<?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");?>"> <!-- server-related links -->
<?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance");?>
<li><a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=mysql&sql_query=<?php echo urlencode("SHOW PROCESSLIST");?>">
<?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show");?>
<li> <li>
<a href="main.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&mode=reload"><?php echo $strReloadMySQL; ?></a> <?php print show_docu("manual_Reference.html#Flush"); <a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>">
} <?php echo $strMySQLShowStatus; ?></a>&nbsp;<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
} </li>
?>
<br><br>
<?php
}
?>
<li> <li>
<a href="http://phpmyadmin.sourceforge.net/" target="_top"><?php print $strHomepageSourceforge; ?> </a> (sourceforge) <a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>">
&nbsp;&nbsp;&nbsp;&nbsp; [ <a href="ChangeLog" target="_top">ChangeLog</a> ] <?php echo $strMySQLShowVars; ?></a>&nbsp;<?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
</li>
<li> <li>
<a href="http://phpwizard.net/projects/phpMyAdmin/" target="_top"><?php print $strHomepageOfficial; ?> </a> <a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>">
<?php echo $strMySQLShowProcess; ?></a>&nbsp;<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
</li>
<li> <li>
<a href="Documentation.html" target="_top">phpMyAdmin <?php print $strDocu;?></a> <a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
<?php echo $strReloadMySQL; ?></a>&nbsp;<?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
</li>
<br /><br />
<?php
} // end of 2.2 (no AdvAuth case)
} // end of 2: if ($server > 0)
?>
<!-- documentation -->
<li>
<a href="http://phpmyadmin.sourceforge.net/" target="_top">
<?php echo $strHomepageSourceforge; ?></a>&nbsp;(SourceForge)&nbsp;&nbsp;&nbsp;&nbsp;[&nbsp;<a href="ChangeLog">ChangeLog</a>&nbsp;]
</li>
<li>
<a href="http://phpwizard.net/projects/phpMyAdmin/" target="_top"><?php echo $strHomepageOfficial; ?></a>
</li>
<li>
<a href="Documentation.html" target="_top">phpMyAdmin <?php echo $strDocu; ?></a>
</li>
</ul> </ul>
</div>
<?php <?php
require("./footer.inc.php3"); /**
* Displays the footer
* TODO: The included script aren't yet xhtml1.0 compliant
*/
require('./footer.inc.php3');
?> ?>
</body>
</html>