libraries/*: $cfg system changes.

This commit is contained in:
Alexander M. Turek
2002-04-24 18:38:28 +00:00
parent a80446dd11
commit 04b272c39c
9 changed files with 147 additions and 209 deletions

View File

@@ -5,7 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-04-24 Robin Johnson <robbat2@users.sourceforge.net>
2002-04-24 Alexander M. Turek <rabus@bugfixes.info>
* libraries/*: $cfg system changes.
2002-04-24 Robin Johnson <robbat2@users.sourceforge.net>
* *.php3 NOT tbl_*.php, Documentation.*: $cfg system changes.
2002-04-23 Marc Delisle <lem9@users.sourceforge.net>

View File

@@ -68,7 +68,7 @@ if (!defined('PMA_CONFIG_AUTH_INCLUDED')) {
function PMA_auth_fails()
{
global $php_errormsg;
global $connect_func, $server_port, $server_socket, $cfgServer;
global $connect_func, $server_port, $server_socket, $cfg;
global $right_font_family, $font_size, $font_bigger;
if (mysql_error()) {
@@ -79,9 +79,9 @@ if (!defined('PMA_CONFIG_AUTH_INCLUDED')) {
$conn_error = 'Cannot connect: invalid settings.';
}
$local_query = $connect_func . '('
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['user'] . ', '
. $cfgServer['password'] . ')';
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
. $cfg['Server']['user'] . ', '
. $cfg['Server']['password'] . ')';
// Defines the charset to be used
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
@@ -100,7 +100,7 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
</style>
</head>
<body bgcolor="<?php echo $GLOBALS['cfgRightBgColor']; ?>">
<body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
<br /><br />
<center>
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>

View File

@@ -14,7 +14,7 @@ if (!defined('PMA_COOKIE_AUTH_INCLUDED')) {
// Gets the default font sizes
PMA_setFontSizes();
// Defines the cookie path and whether the server is using https or not
$pma_uri_parts = parse_url($cfgPmaAbsoluteUri);
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
$cookie_path = substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/'));
$is_https = ($pma_uri_parts['scheme'] == 'https') ? 1 : 0;
@@ -55,14 +55,14 @@ if (!defined('PMA_COOKIE_AUTH_INCLUDED')) {
function PMA_auth()
{
global $right_font_family, $font_size, $font_bigger;
global $cfgServers, $available_languages;
global $cfg, $available_languages;
global $lang, $server;
global $HTTP_COOKIE_VARS;
// Tries to get the username from cookie whatever are the values of the
// 'register_globals' and the 'variables_order' directives if last login
// should be recalled, else skip the IE autocomplete feature.
if ($GLOBALS['cfgLoginCookieRecall']) {
if ($cfg['LoginCookieRecall']) {
if (!empty($GLOBALS['pma_cookie_username'])) {
$default_user = $GLOBALS['pma_cookie_username'];
}
@@ -104,14 +104,14 @@ input.textfield {font-family: <?php echo $right_font_family; ?>; font-size: <?ph
</style>
</head>
<body bgcolor="<?php echo $GLOBALS['cfgRightBgColor']; ?>">
<body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
<center>
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION . ' - ' . $GLOBALS['strLogin']); ?></h1>
<br />
<?php
// Displays the languages form
if (empty($cfgLang)) {
if (empty($cfg['Lang'])) {
echo "\n";
?>
<!-- Language selection -->
@@ -165,7 +165,7 @@ input.textfield {font-family: <?php echo $right_font_family; ?>; font-size: <?ph
</td>
</tr>
<?php
if (count($cfgServers) > 1) {
if (count($cfg['Servers']) > 1) {
echo "\n";
?>
<tr>
@@ -175,8 +175,8 @@ input.textfield {font-family: <?php echo $right_font_family; ?>; font-size: <?ph
<?php
echo "\n";
// Displays the MySQL servers choice
reset($cfgServers);
while (list($key, $val) = each($cfgServers)) {
reset($cfg['Servers']);
while (list($key, $val) = each($cfg['Servers'])) {
if (!empty($val['host'])) {
echo ' <option value="' . $key . '"';
if (!empty($server) && ($server == $key)) {
@@ -219,7 +219,7 @@ input.textfield {font-family: <?php echo $right_font_family; ?>; font-size: <?ph
<tr>
<td colspan="2" align="center">
<?php
if (count($cfgServers) == 1) {
if (count($cfg['Servers']) == 1) {
echo ' <input type="hidden" name="server" value="' . $server . '" />';
}
echo "\n";
@@ -347,37 +347,37 @@ if (uname.value == '') {
*/
function PMA_auth_set_user()
{
global $cfgServers, $server, $cfgServer;
global $cfg, $server;
global $PHP_AUTH_USER, $PHP_AUTH_PW;
global $from_cookie;
// Ensures the valid 'only_db' setting is used
if ($cfgServer['user'] != $PHP_AUTH_USER) {
$servers_cnt = count($cfgServers);
if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
$servers_cnt = count($cfg['Servers']);
for ($i = 1; $i <= $servers_cnt; $i++) {
if (isset($cfgServers[$i])
&& ($cfgServers[$i]['host'] == $cfgServer['host'] && $cfgServers[$i]['user'] == $PHP_AUTH_USER)) {
if (isset($cfg['Servers'][$i])
&& ($cfg['Servers'][$i]['host'] == $cfg['Server']['host'] && $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)) {
$server = $i;
$cfgServer = $cfgServers[$i];
$cfg['Server'] = $cfg['Servers'][$i];
break;
}
} // end for
} // end if
$cfgServer['user'] = $PHP_AUTH_USER;
$cfgServer['password'] = $PHP_AUTH_PW;
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['password'] = $PHP_AUTH_PW;
// Set cookies if required (once per session)
if (!$from_cookie) {
// Duration = one month for username
setcookie('pma_cookie_username',
$cfgServer['user'],
$cfg['Server']['user'],
time() + (60 * 60 * 24 * 30),
$GLOBALS['cookie_path'], '' ,
$GLOBALS['is_https']);
// Duration = till the browser is closed for password
setcookie('pma_cookie_password',
$cfgServer['password'],
$cfg['Server']['password'],
0,
$GLOBALS['cookie_path'], '',
$GLOBALS['is_https']);

View File

@@ -25,7 +25,7 @@ if (!defined('PMA_HTTP_AUTH_INCLUDED')) {
{
global $right_font_family, $font_size, $font_bigger;
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfgServer']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfgServer']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfgServer']['verbose']))) . '"');
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"');
header('HTTP/1.0 401 Unauthorized');
header('status: 401 Unauthorized');
@@ -46,7 +46,7 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
</style>
</head>
<body bgcolor="<?php echo $GLOBALS['cfgRightBgColor']; ?>">
<body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor']; ?>">
<br /><br />
<center>
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
@@ -220,24 +220,24 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
*/
function PMA_auth_set_user()
{
global $cfgServers, $server, $cfgServer;
global $cfg, $server;
global $PHP_AUTH_USER, $PHP_AUTH_PW;
// Ensures the valid 'only_db' setting is used
if ($cfgServer['user'] != $PHP_AUTH_USER) {
$servers_cnt = count($cfgServers);
if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
$servers_cnt = count($cfg['Servers']);
for ($i = 1; $i <= $servers_cnt; $i++) {
if (isset($cfgServers[$i])
&& ($cfgServers[$i]['host'] == $cfgServer['host'] && $cfgServers[$i]['user'] == $PHP_AUTH_USER)) {
if (isset($cfg['Servers'][$i])
&& ($cfg['Servers'][$i]['host'] == $cfg['Server']['host'] && $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)) {
$server = $i;
$cfgServer = $cfgServers[$i];
$cfg['Server'] = $cfg['Servers'][$i];
break;
}
} // end for
} // end if
$cfgServer['user'] = $PHP_AUTH_USER;
$cfgServer['password'] = $PHP_AUTH_PW;
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['password'] = $PHP_AUTH_PW;
return TRUE;
} // end of the 'PMA_auth_set_user()' function

View File

@@ -23,7 +23,6 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){
*/
function PMA_getBookmarksParam()
{
global $cfgServer;
global $server;
$cfgBookmark = '';
@@ -33,9 +32,9 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){
return '';
}
$cfgBookmark['user'] = $cfgServer['user'];
$cfgBookmark['db'] = $cfgServer['bookmarkdb'];
$cfgBookmark['table'] = $cfgServer['bookmarktable'];
$cfgBookmark['user'] = $GLOBALS['cfg']['Server']['user'];
$cfgBookmark['db'] = $GLOBALS['cfg']['Server']['bookmarkdb'];
$cfgBookmark['table'] = $GLOBALS['cfg']['Server']['bookmarktable'];
return $cfgBookmark;
} // end of the 'PMA_getBookmarksParam()' function
@@ -151,7 +150,7 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){
/**
* Bookmark Support
*/
$cfgBookmark = PMA_getBookmarksParam();
$cfg['Bookmark'] = PMA_getBookmarksParam();
} // $__PMA_BOOKMARK_LIB__

View File

@@ -208,7 +208,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
$replace = array('\0', '\n', '\r', '\Z');
$current_row = 0;
@set_time_limit($GLOBALS['cfgExecTimeLimit']);
@set_time_limit($GLOBALS['cfg']['ExecTimeLimit']);
// loic1: send a fake header to bypass browser timeout if data
// are bufferized - part 1
@@ -309,7 +309,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
$fields_cnt = mysql_num_fields($result);
$rows_cnt = mysql_num_rows($result);
@set_time_limit($GLOBALS['cfgExecTimeLimit']); // HaRa
@set_time_limit($GLOBALS['cfg']['ExecTimeLimit']); // HaRa
// loic1: send a fake header to bypass browser timeout if data
// are bufferized - part 1
@@ -510,7 +510,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
$fields_cnt = mysql_num_fields($result);
@set_time_limit($GLOBALS['cfgExecTimeLimit']);
@set_time_limit($GLOBALS['cfg']['ExecTimeLimit']);
// Format the data
$i = 0;

View File

@@ -71,79 +71,15 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
include('./config.inc.php3');
// For compatibility with old config.inc.php3
if (!isset($cfgExecTimeLimit)) {
$cfgExecTimeLimit = 300; // 5 minutes
}
if (!isset($cfgShowStats)) {
$cfgShowStats = TRUE;
}
if (!isset($cfgLoginCookieRecall)) {
$cfgLoginCookieRecall = TRUE;
}
if (!isset($cfgShowTooltip)) {
$cfgShowTooltip = TRUE;
}
if (!isset($cfgShowMysqlInfo)) {
$cfgShowMysqlInfo = FALSE;
}
if (!isset($cfgShowMysqlVars)) {
$cfgShowMysqlVars = FALSE;
}
if (!isset($cfgShowPhpInfo)) {
$cfgShowPhpInfo = FALSE;
}
if (!isset($cfgShowAll)) {
$cfgShowAll = FALSE;
}
if (!isset($cfgNavigationBarIconic)) {
$cfgNavigationBarIconic = TRUE;
}
if (!isset($cfgProtectBinary)) {
if (isset($cfgProtectBlob)) {
$cfgProtectBinary = ($cfgProtectBlob ? 'blob' : FALSE);
unset($cfgProtectBlob);
} else {
$cfgProtectBinary = 'blob';
if (!isset($cfg)) {
if (empty($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
echo '<p class="warning">Your config file version is not supported any longer!</p>' . "\n";
include('./footer.inc.php3');
exit();
}
if (!isset($cfgShowFunctionFields)) {
$cfgShowFunctionFields = TRUE;
}
if (!isset($cfgZipDump)) {
$cfgZipDump = (isset($cfgGZipDump) ? $cfgGZipDump : TRUE);
}
if (!isset($cfgLeftBgColor)) {
$cfgLeftBgColor = '#D0DCE0';
}
if (!isset($cfgLeftPointerColor)) {
$cfgLeftPointerColor = '';
}
if (!isset($cfgRightBgColor)) {
$cfgRightBgColor = '#F5F5F5';
}
if (!isset($cfgBrowsePointerColor)) {
$cfgBrowsePointerColor = '';
}
if (!isset($cfgBrowseMarkerColor)) {
$cfgBrowseMarkerColor = (!empty($cfgBrowsePointerColor) && !empty($cfgBrowseMarkRow))
? '#FFCC99'
: '';
}
if (!isset($cfgTextareaCols)) {
$cfgTextareaCols = 40;
}
if (!isset($cfgTextareaRows)) {
$cfgTextareaRows = 7;
}
if (!isset($cfgDefaultDisplay)) {
$cfgDefaultDisplay = 'horizontal';
}
if (!isset($cfgRepeatCells)) {
$cfgRepeatCells = 100;
}
if (!isset($cfgLeftFrameLight)) {
$cfgLeftFrameLight = TRUE;
}
// rabus: The new backwards compatibility code will follow soon...
/**
* Gets constants that defines the PHP, MySQL... releases.
@@ -373,11 +309,11 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
/**
* $cfgPmaAbsoluteUri is a required directive else cookies won't be set
* properly and, depending on browsers, inserting or updating a record
* $cfg['PmaAbsoluteUri'] is a required directive else cookies won't be
* set properly and, depending on browsers, inserting or updating a
* record might fail
*/
if (empty($cfgPmaAbsoluteUri)) {
if (empty($cfg['PmaAbsoluteUri'])) {
if (empty($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
@@ -387,78 +323,78 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
}
// Adds a trailing slash et the end of the phpMyAdmin uri if it does not
// exist
else if (substr($cfgPmaAbsoluteUri, -1) != '/') {
$cfgPmaAbsoluteUri .= '/';
else if (substr($cfg['PmaAbsoluteUri'], -1) != '/') {
$cfg['PmaAbsoluteUri'] .= '/';
}
/**
* Use mysql_connect() or mysql_pconnect()?
*/
$connect_func = ($cfgPersistentConnections) ? 'mysql_pconnect' : 'mysql_connect';
$connect_func = ($cfg['PersistentConnections']) ? 'mysql_pconnect' : 'mysql_connect';
$dblist = array();
/**
* Gets the valid servers list and parameters
*/
reset($cfgServers);
while (list($key, $val) = each($cfgServers)) {
reset($cfg['Servers']);
while (list($key, $val) = each($cfg['Servers'])) {
// Don't use servers with no hostname
if (empty($val['host'])) {
unset($cfgServers[$key]);
unset($cfg['Servers'][$key]);
}
}
if (empty($server) || !isset($cfgServers[$server]) || !is_array($cfgServers[$server])) {
$server = $cfgServerDefault;
if (empty($server) || !isset($cfg['Servers'][$server]) || !is_array($cfg['Servers'][$server])) {
$server = $cfg['ServerDefault'];
}
/**
* If no server is selected, make sure that $cfgServer is empty (so that
* nothing will work), and skip server authentication.
* If no server is selected, make sure that $cfg['Server'] is empty (so
* that nothing will work), and skip server authentication.
* We do NOT exit here, but continue on without logging into any server.
* This way, the welcome page will still come up (with no server info) and
* present a choice of servers in the case that there are multiple servers
* and '$cfgServerDefault = 0' is set.
* and '$cfg['ServerDefault'] = 0' is set.
*/
if ($server == 0) {
$cfgServer = array();
$cfg['Server'] = array();
}
/**
* Otherwise, set up $cfgServer and do the usual login stuff.
* Otherwise, set up $cfg['Server'] and do the usual login stuff.
*/
else if (isset($cfgServers[$server])) {
$cfgServer = $cfgServers[$server];
else if (isset($cfg['Servers'][$server])) {
$cfgServer = $cfg['Servers'][$server];
// Check how the config says to connect to the server
$server_port = (empty($cfgServer['port']))
$server_port = (empty($cfg['Server']['port']))
? ''
: ':' . $cfgServer['port'];
if (strtolower($cfgServer['connect_type']) == 'tcp') {
$cfgServer['socket'] = '';
: ':' . $cfg['Server']['port'];
if (strtolower($cfg['Server']['connect_type']) == 'tcp') {
$cfg['Server']['socket'] = '';
}
$server_socket = (empty($cfgServer['socket']) || PMA_PHP_INT_VERSION < 30010)
$server_socket = (empty($cfg['Server']['socket']) || PMA_PHP_INT_VERSION < 30010)
? ''
: ':' . $cfgServer['socket'];
: ':' . $cfg['Server']['socket'];
// Ensures compatibility with old config files
if (!isset($cfgServer['auth_type'])) {
$cfgServer['auth_type'] = (isset($cfgServer['adv_auth']) && $cfgServer['adv_auth'])
if (!isset($cfg['Server']['auth_type'])) {
$cfg['Server']['auth_type'] = (isset($cfg['Server']['adv_auth']) && $cfg['Server']['adv_auth'])
? 'http'
: 'config';
}
if (isset($cfgServer['stduser'])) {
$cfgServer['controluser'] = $cfgServer['stduser'];
$cfgServer['controlpass'] = $cfgServer['stdpass'];
if (isset($cfg['Server']['stduser'])) {
$cfg['Server']['controluser'] = $cfg['Server']['stduser'];
$cfg['Server']['controlpass'] = $cfg['Server']['stdpass'];
}
// Gets the authentication library that fits the cfgServer settings
// Gets the authentication library that fits the $cfg['Server'] settings
// and run authentication
include('./libraries/auth/' . $cfgServer['auth_type'] . '.auth.lib.php3');
include('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php3');
if (!PMA_auth_check()) {
PMA_auth();
} else {
@@ -466,11 +402,11 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
}
// The user can work with only some databases
if (isset($cfgServer['only_db']) && $cfgServer['only_db'] != '') {
if (is_array($cfgServer['only_db'])) {
$dblist = $cfgServer['only_db'];
if (isset($cfg['Server']['only_db']) && $cfg['Server']['only_db'] != '') {
if (is_array($cfg['Server']['only_db'])) {
$dblist = $cfg['Server']['only_db'];
} else {
$dblist[] = $cfgServer['only_db'];
$dblist[] = $cfg['Server']['only_db'];
}
} // end if
@@ -482,11 +418,11 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
// get the privileges list for the current user but the true user link
// must be open after this one so it would be default one for all the
// scripts)
if ($cfgServer['controluser'] != '') {
if ($cfg['Server']['controluser'] != '') {
$dbh = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['controluser'],
$cfgServer['controlpass']
$cfg['Server']['host'] . $server_port . $server_socket,
$cfg['Server']['controluser'],
$cfg['Server']['controlpass']
);
if ($dbh == FALSE) {
if (mysql_error()) {
@@ -497,18 +433,18 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
$conn_error = 'Cannot connect: invalid settings.';
}
$local_query = $connect_func . '('
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['controluser'] . ', '
. $cfgServer['stdpass'] . ')';
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
. $cfg['Server']['controluser'] . ', '
. $cfg['Server']['stdpass'] . ')';
PMA_mysqlDie($conn_error, $local_query, FALSE);
} // end if
} // end if
// Connects to the server (validates user's login)
$userlink = @$connect_func(
$cfgServer['host'] . $server_port . $server_socket,
$cfgServer['user'],
$cfgServer['password']
$cfg['Server']['host'] . $server_port . $server_socket,
$cfg['Server']['user'],
$cfg['Server']['password']
);
if ($userlink == FALSE) {
PMA_auth_fails();
@@ -520,7 +456,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
// If controluser isn't defined, use the current user settings to get
// his rights
if ($cfgServer['controluser'] == '') {
if ($cfg['Server']['controluser'] == '') {
$dbh = $userlink;
}
@@ -587,7 +523,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
if (!$dblist_cnt) {
$auth_query = 'SELECT User, Select_priv '
. 'FROM mysql.user '
. 'WHERE User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\'';
. 'WHERE User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\'';
$rs = mysql_query($auth_query, $dbh); // Debug: or PMA_mysqlDie('', $auth_query, FALSE);
} // end
} // end if (!$dblist_cnt)
@@ -611,7 +547,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
// 1. get allowed dbs from the "mysql.db" table
// lem9: User can be blank (anonymous user)
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\' OR User = \'\')';
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\' OR User = \'\')';
$rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if (@mysql_numrows($rs)) {
// Will use as associative array of the following 2 code
@@ -672,7 +608,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
} // end if
// 2. get allowed dbs from the "mysql.tables_priv" table
$local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\'';
$local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\'';
$rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if (@mysql_numrows($rs)) {
while ($row = mysql_fetch_array($rs)) {
@@ -891,18 +827,18 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
echo "\n";
?>
<div align="<?php echo $GLOBALS['cell_align_left']; ?>">
<table border="<?php echo $GLOBALS['cfgBorder']; ?>" cellpadding="5">
<table border="<?php echo $GLOBALS['cfg']['Border']; ?>" cellpadding="5">
<tr>
<td bgcolor="<?php echo $GLOBALS['cfgThBgcolor']; ?>">
<td bgcolor="<?php echo $GLOBALS['cfg']['ThBgcolor']; ?>">
<b><?php echo (get_magic_quotes_gpc()) ? stripslashes($message) : $message; ?></b><br />
</td>
</tr>
<?php
if ($GLOBALS['cfgShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) {
if ($GLOBALS['cfg']['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) {
echo "\n";
?>
<tr>
<td bgcolor="<?php echo $GLOBALS['cfgBgcolorOne']; ?>">
<td bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
<?php
echo "\n";
// The nl2br function isn't used because its result isn't a valid
@@ -960,8 +896,8 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
*/
function PMA_showDocuShort($link)
{
if (!empty($GLOBALS['cfgManualBaseShort'])) {
return '[<a href="' . $GLOBALS['cfgManualBaseShort'] . '/' . $link .'" target="mysql_doc">' . $GLOBALS['strDocu'] . '</a>]';
if (!empty($GLOBALS['cfg']['ManualBaseShort'])) {
return '[<a href="' . $GLOBALS['cfg']['ManualBaseShort'] . '/' . $link .'" target="mysql_doc">' . $GLOBALS['strDocu'] . '</a>]';
}
} // end of the 'PMA_showDocuShort()' function

View File

@@ -206,7 +206,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// Move to the beginning or to the previous page
if ($pos > 0 && $session_max_rows != 'all') {
// loic1: patch #474210 from Gosha Sakovich - part 1
if ($GLOBALS['cfgNavigationBarIconic']) {
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$caption1 = '&lt;&lt;';
$caption2 = '&nbsp;&lt;&nbsp;';
$title1 = ' title="' . $GLOBALS['strPos1'] . '"';
@@ -268,7 +268,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="dontlimitchars" value="<?php echo $dontlimitchars; ?>" />
<input type="submit" name="navig" value="<?php echo $GLOBALS['strShow']; ?>&nbsp;:" />
<input type="text" name="session_max_rows" size="3" value="<?php echo (($session_max_rows != 'all') ? $session_max_rows : $GLOBALS['cfgMaxRows']); ?>" class="textfield" onfocus="this.select()" />
<input type="text" name="session_max_rows" size="3" value="<?php echo (($session_max_rows != 'all') ? $session_max_rows : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
<?php echo $GLOBALS['strRowsFrom'] . "\n"; ?>
<input type="text" name="pos" size="3" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
<br />
@@ -293,7 +293,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
if (($pos + $session_max_rows < $unlim_num_rows) && $num_rows >= $session_max_rows
&& $session_max_rows != 'all') {
// loic1: patch #474210 from Gosha Sakovich - part 2
if ($GLOBALS['cfgNavigationBarIconic']) {
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$caption3 = '&nbsp;&gt;&nbsp;';
$caption4 = '&gt;&gt;';
$title3 = ' title="' . $GLOBALS['strNext'] . '"';
@@ -343,7 +343,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end move toward
// Show all the records if allowed
if ($GLOBALS['cfgShowAll'] && ($num_rows < $unlim_num_rows)) {
if ($GLOBALS['cfg']['ShowAll'] && ($num_rows < $unlim_num_rows)) {
echo "\n";
?>
<td>
@@ -479,7 +479,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// ... at the left column of the result table header if possible
// and required
else if ($GLOBALS['cfgModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
else if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
$vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
if ($disp_direction == 'horizontal') {
echo "\n";
@@ -499,7 +499,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
}
// ... else if no button, displays empty(ies) col(s) if required
else if ($GLOBALS['cfgModifyDeleteAtLeft']
else if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
$vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
if ($disp_direction == 'horizontal') {
@@ -562,11 +562,11 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// 2.1.4 Do define the sorting url
if (!$is_in_sort) {
// loic1: patch #455484 ("Smart" order)
$cfgOrder = strtoupper($GLOBALS['cfgOrder']);
if ($cfgOrder == 'SMART') {
$cfgOrder = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
$cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']);
if ($cfg['Order'] == 'SMART') {
$cfg['Order'] = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
}
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfgOrder;
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfg['Order'];
$order_img = '';
}
else if (substr($sql_order, -3) == 'ASC' && $is_in_sort) {
@@ -627,7 +627,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// 3. Displays the full/partial text button (part 2) at the right
// column of the result table header if possible and required...
if ($GLOBALS['cfgModifyDeleteAtRight']
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')
&& $is_display['text_btn'] == '1') {
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
@@ -649,7 +649,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
}
// ... else if no button, displays empty cols if required
else if ($GLOBALS['cfgModifyDeleteAtRight']
else if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')) {
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 2 : 1;
if ($disp_direction == 'horizontal') {
@@ -764,17 +764,17 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
echo '</tr>' . "\n";
} // end if
$bgcolor = ($foo % 2) ? $GLOBALS['cfgBgcolorOne'] : $GLOBALS['cfgBgcolorTwo'];
$bgcolor = ($foo % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo'];
if ($disp_direction == 'horizontal') {
// loic1: pointer code part
$on_mouse = '';
if ($GLOBALS['cfgBrowsePointerColor'] != '') {
$on_mouse = ' onmouseover="setPointer(this, \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"'
. ' onmouseout="setPointer(this, \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"';
if ($GLOBALS['cfg']['BrowsePointerColor'] != '') {
$on_mouse = ' onmouseover="setPointer(this, \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"'
. ' onmouseout="setPointer(this, \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"';
}
if ($GLOBALS['cfgBrowseMarkerColor'] != '') {
$on_mouse .= ' onmousedown="setPointer(this, \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"';
if ($GLOBALS['cfg']['BrowseMarkerColor'] != '') {
$on_mouse .= ' onmousedown="setPointer(this, \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"';
}
?>
<tr<?php echo $on_mouse; ?>>
@@ -883,7 +883,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end if (1.2.2)
// 1.3 Displays the links at left if required
if ($GLOBALS['cfgModifyDeleteAtLeft']
if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($disp_direction == 'horizontal')) {
if (!empty($edit_url)) {
?>
@@ -936,10 +936,10 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} else {
$vertical_display['data'][$foo][$i] = ' <td align="right" valign="top" bgcolor="' . $bgcolor . '">&nbsp;</td>' . "\n";
}
} else if ($GLOBALS['cfgShowBlob'] == FALSE && eregi('BLOB', $meta->type)) {
} else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && eregi('BLOB', $meta->type)) {
// loic1 : mysql_fetch_fields returns BLOB in place of TEXT
// fields type, however TEXT fields must be displayed even
// if $cfgShowBlob is false -> get the true type of the
// if $cfg['ShowBlob'] is false -> get the true type of the
// fields.
$field_flags = mysql_field_flags($dt_result, $i);
if (eregi('BINARY', $field_flags)) {
@@ -949,8 +949,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
|| (function_exists('is_null') && is_null($row[$pointer]))) {
$vertical_display['data'][$foo][$i] = ' <td valign="top" bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
} else if ($row[$pointer] != '') {
if (strlen($row[$pointer]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) {
$row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfgLimitChars']) . '...';
if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
$row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
// loic1: displays all space characters, 4 space
// characters for tabulations and <cr>/<lf>
@@ -970,10 +970,10 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// loic1: support blanks in the key
$relation_id = $row[$pointer];
// loic1: Cut text/blob fields even if $cfgShowBlob is true
// loic1: Cut text/blob fields even if $cfg['ShowBlob'] is true
if (eregi('BLOB', $meta->type)) {
if (strlen($row[$pointer]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) {
$row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfgLimitChars']) . '...';
if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
$row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
}
// loic1: displays special characters from binaries
@@ -1022,7 +1022,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end for (2)
// 3. Displays the modify/delete links on the right if required
if ($GLOBALS['cfgModifyDeleteAtRight']
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($disp_direction == 'horizontal')) {
if (!empty($edit_url)) {
?>
@@ -1105,7 +1105,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
reset($vertical_display);
// Displays "edit" link at top if required
if ($GLOBALS['cfgModifyDeleteAtLeft'] && is_array($vertical_display['edit'])) {
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
reset($vertical_display['edit']);
@@ -1122,7 +1122,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end if
// Displays "delete" link at top if required
if ($GLOBALS['cfgModifyDeleteAtLeft'] && is_array($vertical_display['delete'])) {
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete'])) {
echo '<tr>' . "\n";
if (!is_array($vertical_display['edit'])) {
echo $vertical_display['textbtn'];
@@ -1160,7 +1160,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end while
// Displays "edit" link at bottom if required
if ($GLOBALS['cfgModifyDeleteAtRight'] && is_array($vertical_display['edit'])) {
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
reset($vertical_display['edit']);
@@ -1177,7 +1177,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
} // end if
// Displays "delete" link at bottom if required
if ($GLOBALS['cfgModifyDeleteAtRight'] && is_array($vertical_display['delete'])) {
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete'])) {
echo '<tr>' . "\n";
if (!is_array($vertical_display['edit'])) {
echo $vertical_display['textbtn'];
@@ -1236,7 +1236,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
*/
function PMA_displayTable(&$dt_result, &$the_disp_mode)
{
global $lang, $server, $cfgServer, $db, $table;
global $lang, $server, $cfg, $db, $table;
global $goto;
global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt;
global $vertical_display, $disp_direction, $repeat_cells;
@@ -1261,8 +1261,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
$pos_next = 0;
$pos_prev = 0;
} else {
$pos_next = $pos + $GLOBALS['cfgMaxRows'];
$pos_prev = $pos - $GLOBALS['cfgMaxRows'];
$pos_next = $pos + $GLOBALS['cfg']['MaxRows'];
$pos_prev = $pos - $GLOBALS['cfg']['MaxRows'];
if ($pos_prev < 0) {
$pos_prev = 0;
}
@@ -1313,7 +1313,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// init map
$map = array();
if (!empty($cfgServer['relation'])) {
if (!empty($cfg['Server']['relation'])) {
// find tables
// $tabs = '(\'' . join('\',\'', spliti('`? *((on [^,]+)?,|(NATURAL )?(inner|left|right)( outer)? join) *`?',
// eregi_replace('^.*FROM +`?|`? *(on [^,]+)?(WHERE.*)?$', '', $sql_query))) . '\')';
@@ -1322,7 +1322,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
$tabs = '(\'' . join('\',\'', split($pattern, $target)) . '\')';
$local_query = 'SELECT src_column, dest_table, dest_column'
. ' FROM ' . $cfgServer['relation']
. ' FROM ' . $cfg['Server']['relation']
. ' WHERE src_table IN ' . $tabs;
$result = @mysql_query($local_query);
if ($result) {
@@ -1335,7 +1335,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
// 3. ----- Displays the results table -----
?>
<!-- Results table -->
<table border="<?php echo $GLOBALS['cfgBorder']; ?>" cellpadding="5">
<table border="<?php echo $GLOBALS['cfg']['Border']; ?>" cellpadding="5">
<?php
echo "\n";
PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt);

View File

@@ -164,8 +164,8 @@ if (!isset($lang)) {
* Do the work!
*/
// Lang forced
if (!empty($cfgLang)) {
$lang = $cfgLang;
if (!empty($cfg['Lang'])) {
$lang = $cfg['Lang'];
}
// If '$lang' is defined, ensure this is a valid translation
@@ -191,7 +191,7 @@ if (empty($lang) && !empty($HTTP_USER_AGENT)) {
// 3. Didn't catch any valid lang : we use the default settings
if (empty($lang)) {
$lang = $cfgDefaultLang;
$lang = $cfg['DefaultLang'];
}
// 4. Defines the associated filename and load the translation