lib.inc.php3

* added a magic feature to append a slash at the end of $cfgPmaAbsoluteUri if required
* displays a space character if a field is empty to ensure the cell format is used with NS
* defines $server_port & $server_socket only once
This commit is contained in:
Loïc Chapeaux
2001-08-22 22:58:30 +00:00
parent eeae9f08b5
commit 59bedbe291
2 changed files with 30 additions and 26 deletions

View File

@@ -9,8 +9,8 @@ $Source$
* config.inc.php3: $cfgServers[1]['connect_type'] preferred connection type
* lib.inc.php3 - line 285: $cfgServer['connect_type'] implemented
* Documentation.html
- documented $cfgServers[n]['connect_type']
- two minor fixes for typo's that i noticed
- documented $cfgServers[n]['connect_type']
- two minor fixes for typo's that i noticed
2001-08-22 Olivier M<>ller <om@omnis.ch>
* main.php3: relooked the start page with the help of Lo<4C>c.
@@ -30,6 +30,11 @@ $Source$
option has been checked.
- split_sql_file(): fix a bug when a backquoted table/field name ends
with a backslash.
- lines 96-100: added a magic feature to append a slash at the end of
$cfgPmaAbsoluteUri if required.
- display_table(): displays a space character if a field is empty to
ensure the cell format is used with NS.
- defines $server_port & $server_socket only once.
* main.php3: XHTML1.0 fixes.
* footer.inc.php3, lines 9-10; lib.inc.php3, line 162: the "</body>" html
tag was lacking.

View File

@@ -93,6 +93,11 @@ if (!defined('__LIB_INC__')){
if (!isset($cfgTextareaRows)) {
$cfgTextareaRows = 7;
}
// Adds a trailing slash et the end of the phpMyAdmin uri if it does not
// exist
if (substr($cfgPmaAbsoluteUri, -1) != '/') {
$cfgPmaAbsoluteUri .= '/';
}
include('./defines.inc.php3');
@@ -214,6 +219,17 @@ if (!defined('__LIB_INC__')){
else if (isset($cfgServers[$server])) {
$cfgServer = $cfgServers[$server];
// Check how the config says to connect to the server
$server_port = (empty($cfgServer['port']))
? ''
: ':' . $cfgServer['port'];
if (strtolower($cfgServer['connect_type']) == 'tcp') {
$cfgServer['socket'] = '';
}
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
? ''
: ':' . $cfgServer['socket'];
// The user can work with only some databases
if (isset($cfgServer['only_db']) && !empty($cfgServer['only_db'])) {
if (is_array($cfgServer['only_db'])) {
@@ -281,22 +297,11 @@ if (!defined('__LIB_INC__')){
}
}
// Check how the config says to connect to the server
if (strtolower($cfgServer['connect_type']) == 'tcp') {
$cfgServer['socket'] = '';
}
// Calls the authentication window or validates user's login
if ($do_auth) {
auth();
} else {
$server_port = (empty($cfgServer['port']))
? ''
: ':' . $cfgServer['port'];
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
? ''
: ':' . $cfgServer['socket'];
$dbh = @$connect_func(
$dbh = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['stduser'],
$cfgServer['stdpass']
@@ -395,13 +400,7 @@ if (!defined('__LIB_INC__')){
} // end Advanced authentication
// Do connect to the user's database
$server_port = (empty($cfgServer['port']))
? ''
: ':' . $cfgServer['port'];
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
? ''
: ':' . $cfgServer['socket'];
$link = @$connect_func(
$link = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['user'],
$cfgServer['password']
@@ -1203,7 +1202,7 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
}
$primary = mysql_fetch_field($dt_result, $i);
if ($primary->numeric == 1) {
echo ' <td align="right">' . $row[$i] . '&nbsp;</td>' . "\n";
echo ' <td align="right">' . $row[$i] . '</td>' . "\n";
} else if ($GLOBALS['cfgShowBlob'] == FALSE && eregi('BLOB', $primary->type)) {
// loic1 : mysql_fetch_fields returns BLOB in place of TEXT
// fields type, however TEXT fields must be displayed even
@@ -1219,15 +1218,15 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
$row[$i] = substr($row[$i], 0, $GLOBALS['cfgLimitChars']) . '...';
}
// loic1 : displays <cr>/<lf>
// echo ' <td>' . htmlspecialchars($row[$i]) . '&nbsp;</td>' . "\n";
// echo ' <td>' . htmlspecialchars($row[$i]) . '</td>' . "\n";
$row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$i]));
echo ' <td>' . $row[$i] . '&nbsp;</td>' . "\n";
echo ' <td>' . $row[$i] . '</td>' . "\n";
}
} else {
// loic1 : displays <cr>/<lf>
// echo ' <td>' . htmlspecialchars($row[$i]) . '&nbsp;</td>' . "\n";
// echo ' <td>' . htmlspecialchars($row[$i]) . '</td>' . "\n";
$row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$i]));
echo ' <td>' . $row[$i] . '&nbsp;</td>' . "\n";
echo ' <td>' . $row[$i] . '</td>' . "\n";
}
} // end for
// Possibility to have the modify/delete button on the left added