【php开源代码栏目提醒】:网学会员,鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“config_import.lib.php”一文,供大家参考学习!
<?php
/* $Id: config_import.lib.php,v 2.50 2005/08/22 21:41:20 nijel Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* This file provides support for older config files.
*/
/**
* U S A G E
*
* After having added a new directive to the config.inc.php file, you need to
* put some backwards compatibility code into this file.
*
* This usually looks like this:
*
* if (!isset($myNewDirective)) {
* $myNewDirective = 'my default value';
* }
*
* If the new directive is meant as a replacement for an old one, please use the
* following layout:
*
* if (!isset($myNewDirective)) {
* if (isset($myOldDirective)) {
* $myNewDirective = $myOldDirective;
* unset($myOldDirective);
* } else {
* $myNewDirective = '';
* }
* }
*
* In order to make this file readable for other developers, please try to use
* the same order of directives here as you do in config.inc.php.
*
* After having done all this, search libraries/common.lib.php for the
* following paragraph (x and y are integers):
*
* if ($cfg['FileRevision'][0] < x || $cfg['FileRevision'][1] < y) {
* require_once('./libraries/config_import.lib.php');
* }
*
* Finally, set x and y to the _new_ revision number of config.inc.php and
* you're done! x would be the major version, y the minor version number of the
* new revision, e.g. 2.34 becomes: x = 2, y = 34
*/
if (!isset($cfg['PmaAbsoluteUri'])) {
if (isset($cfgPmaAbsoluteUri)) {
$cfg['PmaAbsoluteUri'] = $cfgPmaAbsoluteUri;
unset($cfgPmaAbsoluteUri);
} else {
$cfg['PmaAbsoluteUri'] = '';
}
}
if (!isset($cfg['PmaAbsoluteUri_DisableWarning'])) {
$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE;
}
if (!isset($cfg['PmaNoRelation_DisableWarning'])) {
$cfg['PmaNoRelation_DisableWarning'] = FALSE;
}
// do not set a default value here!
if (!isset($cfg['blowfish_secret'])) {
$cfg['blowfish_secret'] = '';
}
if (!isset($cfg['Servers'])) {
if (isset($cfgServers)) {
$cfg['Servers'] = $cfgServers;
unset($cfgServers);
} else {
$server = 0;
}
}
if (isset($cfg['Servers'])) {
for ($i=1; (!empty($cfg['Servers'][$i]['host']) || (isset($cfg['Servers'][$i]['connect_type']) && $cfg['Servers'][$i]['connect_type'] == 'socket')); $i++) {
if (!isset($cfg['Servers'][$i]['host'])) {
$cfg['Servers'][$i]['host'] = '';
}
if (!isset($cfg['Servers'][$i]['port'])) {
$cfg['Servers'][$i]['port'] = '';
}
if (!isset($cfg['Servers'][$i]['socket'])) {
$cfg['Servers'][$i]['socket'] = '';
}
if (!isset($cfg['Servers'][$i]['connect_type'])) {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
}
if (!isset($cfg['Servers'][$i]['extension'])) {
$cfg['Servers'][$i]['extension'] = '
mysql';
}
if (!isset($cfg['Servers'][$i]['controluser']) && isset($cfg['Servers'][$i]['stduser'])) {
$cfg['Servers'][$i]['controluser'] = $cfg['Servers'][$i]['stduser'];
$cfg['Servers'][$i]['controlpass'] = $cfg['Servers'][$i]['stdpass'];
unset($cfg['Servers'][$i]['stduser'], $cfg['Servers'][$i]['stdpass']);
} else if (!isset($cfg['Servers'][$i]['controluser'])) {
$cfg['Servers'][$i]['controluser'] = $cfg['Servers'][$i]['controlpass'] = '';
}
if (!isset($cfg['Servers'][$i]['auth_type'])) {
$cfg['Servers'][$i]['auth_type'] = (isset($cfg['Servers'][$i]['adv_auth']) && $cfg['Servers'][$i]['adv_auth'])
? 'http'
: 'config';
unset($cfg['Servers'][$i]['adv_auth']);
}
// for users who use the "first" blowfish mechanism
if (isset($cfg['Servers'][$i]['blowfish_secret'])) {
if (empty($cfg['blowfish_secret'])) {
$cfg['blowfish_secret'] = $cfg['Servers'][$i]['blowfish_secret'];
}
unset($cfg['Servers'][$i]['blowfish_secret']);
}
if (!isset($cfg['Servers'][$i]['compress'])) {
$cfg['Servers'][$i]['compress'] = FALSE;
}
if (!isset($cfg['Servers'][$i]['user'])) {
$cfg['Servers'][$i]['user'] = 'root';
}
if (!isset($cfg['Servers'][$i]['password'])) {
$cfg['Servers'][$i]['pass
word'] = '';
}
if (!isset($cfg['Servers'][$i]['only_db'])) {
$cfg['Servers'][$i]['only_db'] = '';
}
if (!isset($cfg['Servers'][$i]['verbose'])) {
$cfg['Servers'][$i]['verbose'] = '';
}
if (!isset($cfg['Servers'][$i]['pmadb'])) {
if (isset($cfg['Servers'][$i]['bookmarkdb'])) {
$cfg['Servers'][$i]['pmadb'] = $cfg['Servers'][$i]['bookmarkdb'];
unset($cfg['Servers'][$i]['bookmarkdb']);
} else {
$cfg['Servers'][$i]['pmadb'] = '';
}
}
if (!isset($cfg['Servers'][$i]['bo