Beautified generated XHTML code

This commit is contained in:
Alexander M. Turek
2003-01-08 15:21:11 +00:00
parent 14e6e85747
commit f28b61e1cb
3 changed files with 25 additions and 13 deletions

View File

@@ -19,6 +19,10 @@ $Source$
2003-01-08 Alexander M. Turek <rabus@users.sourceforge.net> 2003-01-08 Alexander M. Turek <rabus@users.sourceforge.net>
* lang/english-*.inc.php3: Fixed a typo. * lang/english-*.inc.php3: Fixed a typo.
* server_privileges.php3, libraries/url_generating.lib.php3:
- Beautified generated XHTML code;
- Coding standards;
- Added a missing @param comment.
2003-01-07 Michal Cihar <nijel@users.sourceforge.net> 2003-01-07 Michal Cihar <nijel@users.sourceforge.net>
* lang/czech: Updated. * lang/czech: Updated.

View File

@@ -16,6 +16,7 @@ if (!defined('PMA_URL_GENERATION_LIB_INCLUDED')){
* *
* @param string optional database name * @param string optional database name
* @param string optional table name * @param string optional table name
* @param int indenting level
* *
* @return string string with input fields * @return string string with input fields
* *
@@ -29,27 +30,34 @@ if (!defined('PMA_URL_GENERATION_LIB_INCLUDED')){
* *
* @author nijel * @author nijel
*/ */
function PMA_generate_common_hidden_inputs ($db = '', $table = '') function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0)
{ {
global $lang, $convcharset, $server; global $lang, $convcharset, $server;
global $cfg, $allow_recoding; global $cfg, $allow_recoding;
$result = '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n" . $spaces = '';
'<input type="hidden" name="server" value="' . $server . '" />' . "\n"; for ($i = 0; $i < $indent; $i++) {
$spaces .= ' ';
}
$result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
. $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
$result .= '<input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n"; $result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n";
if (!empty($db)) if (!empty($db))
$result .= '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />'; $result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
if (!empty($table)) if (!empty($table))
$result .= '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />'; $result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
return $result; return $result;
} }
/** /**
* Generates text with URL parameters. * Generates text with URL parameters.
* *
* @param string optional database name * @param string optional database name
* @param string optional table name * @param string optional table name
* @param string character to use instead of '&amp;' for deviding
* multiple URL parameters from each other
* *
* @return string string with URL parameters * @return string string with URL parameters
* *

View File

@@ -591,7 +591,7 @@ if (empty($adduser)) {
. '</div><br />' . "\n"; . '</div><br />' . "\n";
} }
echo '<form name="usersForm" action="server_privileges.php3" method="post" />' . "\n"; echo '<form name="usersForm" action="server_privileges.php3" method="post" />' . "\n";
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs('', '', 1);
echo ' <table border="0">' . "\n" echo ' <table border="0">' . "\n"
. ' <tr>' . "\n" . ' <tr>' . "\n"
. ' <th></th>' . "\n" . ' <th></th>' . "\n"
@@ -687,7 +687,7 @@ if (empty($adduser)) {
echo '<ul>' . "\n" echo '<ul>' . "\n"
. ' <li>' . "\n" . ' <li>' . "\n"
. ' <form action="server_privileges.php3" method="post">' . "\n"; . ' <form action="server_privileges.php3" method="post">' . "\n";
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs('', '', 3);
echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"; echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n";
if ($hostname != '%') { if ($hostname != '%') {
echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
@@ -800,7 +800,7 @@ if (empty($adduser)) {
echo ' <tr>' . "\n" echo ' <tr>' . "\n"
. ' <td colspan="' .(PMA_MYSQL_INT_VERSION >= 32211 ? '5' : '4') . '">' . "\n" . ' <td colspan="' .(PMA_MYSQL_INT_VERSION >= 32211 ? '5' : '4') . '">' . "\n"
. ' <form action="server_privileges.php3" method="post">' . "\n"; . ' <form action="server_privileges.php3" method="post">' . "\n";
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs('', '', 6);
echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"; echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n";
if ($hostname != '%') { if ($hostname != '%') {
echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
@@ -823,7 +823,7 @@ if (empty($adduser)) {
if (empty($dbname)) { if (empty($dbname)) {
echo ' <li>' . "\n" echo ' <li>' . "\n"
. ' <form action="server_privileges.php3" method="post" onsubmit="checkPassword(this);">' . "\n"; . ' <form action="server_privileges.php3" method="post" onsubmit="checkPassword(this);">' . "\n";
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs('', '', 3);
echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"; echo ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n";
if ($hostname != '%') { if ($hostname != '%') {
echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; echo ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
@@ -863,7 +863,7 @@ if (empty($adduser)) {
. ' ' . $strAddUser . "\n" . ' ' . $strAddUser . "\n"
. '</h2>' . "\n" . '</h2>' . "\n"
. '<form action="server_privileges.php3" method="post" onsubmit="return checkAddUser(this);">' . "\n"; . '<form action="server_privileges.php3" method="post" onsubmit="return checkAddUser(this);">' . "\n";
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs('', '', 1);
echo ' <table border="0">' . "\n" echo ' <table border="0">' . "\n"
. ' <tr>' . "\n" . ' <tr>' . "\n"
. ' <th colspan="3">' . "\n" . ' <th colspan="3">' . "\n"
@@ -964,4 +964,4 @@ if (empty($adduser)) {
*/ */
require('./footer.inc.php3'); require('./footer.inc.php3');
?> ?>