check config file also on wakeup (bug #1376522)
This commit is contained in:
@@ -6,7 +6,9 @@ $Id$
|
|||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
2005-12-14 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
2005-12-14 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* libraries/Config.class.php: added check is_readable for user config file
|
* libraries/Config.class.php:
|
||||||
|
- added check is_readable for user config file
|
||||||
|
- check config file also on wakeup (bug #1376522)
|
||||||
|
|
||||||
2005-12-14 Michal Čihař <michal@cihar.com>
|
2005-12-14 Michal Čihař <michal@cihar.com>
|
||||||
* libraries/config.default.php, Documentation.html: Transliterate invalid
|
* libraries/config.default.php, Documentation.html: Transliterate invalid
|
||||||
|
@@ -56,7 +56,7 @@ class PMA_Config
|
|||||||
*
|
*
|
||||||
* @param string source to read config from
|
* @param string source to read config from
|
||||||
*/
|
*/
|
||||||
function __construct($source = NULL)
|
function __construct($source = null)
|
||||||
{
|
{
|
||||||
$this->settings = array();
|
$this->settings = array();
|
||||||
|
|
||||||
@@ -308,6 +308,9 @@ class PMA_Config
|
|||||||
unset( $cfg['Servers'] );
|
unset( $cfg['Servers'] );
|
||||||
|
|
||||||
$this->settings = PMA_array_merge_recursive($this->settings, $cfg);
|
$this->settings = PMA_array_merge_recursive($this->settings, $cfg);
|
||||||
|
|
||||||
|
$this->error_config_default_file = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,11 +321,15 @@ class PMA_Config
|
|||||||
*
|
*
|
||||||
* @param string $source config file
|
* @param string $source config file
|
||||||
*/
|
*/
|
||||||
function load($source = NULL)
|
function load($source = null)
|
||||||
{
|
{
|
||||||
$this->loadDefaults();
|
$this->loadDefaults();
|
||||||
|
|
||||||
if ( ! $source || ! $this->setSource($source) ) {
|
if ( null !== $source ) {
|
||||||
|
$this->setSource($source);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $this->checkConfigSource() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +378,28 @@ class PMA_Config
|
|||||||
*/
|
*/
|
||||||
function setSource($source)
|
function setSource($source)
|
||||||
{
|
{
|
||||||
if ( ! file_exists($source) ) {
|
$this->source = trim($source);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if the config folder still exists and terminates app if true
|
||||||
|
*/
|
||||||
|
function checkConfigFolder()
|
||||||
|
{
|
||||||
|
// Refuse to work while there still might be some world writable dir:
|
||||||
|
if (is_dir('./config')) {
|
||||||
|
die('Remove "./config" directory before using phpMyAdmin!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check config source
|
||||||
|
*
|
||||||
|
* @return boolean wether source is valid or not
|
||||||
|
*/
|
||||||
|
function checkConfigSource()
|
||||||
|
{
|
||||||
|
if ( ! file_exists($this->getSource()) ) {
|
||||||
// do not trigger error here
|
// do not trigger error here
|
||||||
// https://sf.net/tracker/?func=detail&aid=1370269&group_id=23067&atid=377408
|
// https://sf.net/tracker/?func=detail&aid=1370269&group_id=23067&atid=377408
|
||||||
/*
|
/*
|
||||||
@@ -379,25 +407,22 @@ class PMA_Config
|
|||||||
'phpMyAdmin-ERROR: unkown configuration source: ' . $source,
|
'phpMyAdmin-ERROR: unkown configuration source: ' . $source,
|
||||||
E_USER_WARNING);
|
E_USER_WARNING);
|
||||||
*/
|
*/
|
||||||
|
$this->source_mtime = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_readable($source) ) {
|
if ( ! is_readable($this->getSource()) ) {
|
||||||
die('Existing configuration file (' . $source . ') is not readable.');
|
$this->source_mtime = 0;
|
||||||
|
die('Existing configuration file (' . $this->getSource() . ') is not readable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for permissions (on platforms that support it):
|
// Check for permissions (on platforms that support it):
|
||||||
$perms = @stat($source);
|
$perms = @stat($this->getSource());
|
||||||
if (!($perms === FALSE) && ($perms['mode'] & 2)) {
|
if (!($perms === false) && ($perms['mode'] & 2)) {
|
||||||
|
$this->source_mtime = 0;
|
||||||
die('Wrong permissions on configuration file, should not be world writable!');
|
die('Wrong permissions on configuration file, should not be world writable!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refuse to work while there still might be some world writable dir:
|
|
||||||
if (is_dir('./config')) {
|
|
||||||
die('Remove "./config" directory before using phpMyAdmin!');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->source = trim($source);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +436,7 @@ class PMA_Config
|
|||||||
if ( isset( $this->settings[$setting] ) ) {
|
if ( isset( $this->settings[$setting] ) ) {
|
||||||
return $this->settings[$setting];
|
return $this->settings[$setting];
|
||||||
}
|
}
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -628,9 +653,9 @@ class PMA_Config
|
|||||||
*/
|
*/
|
||||||
function isHttps()
|
function isHttps()
|
||||||
{
|
{
|
||||||
static $is_https = NULL;
|
static $is_https = null;
|
||||||
|
|
||||||
if ( NULL !== $is_https ) {
|
if ( null !== $is_https ) {
|
||||||
return $is_https;
|
return $is_https;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,9 +703,9 @@ class PMA_Config
|
|||||||
*/
|
*/
|
||||||
function getCookiePath()
|
function getCookiePath()
|
||||||
{
|
{
|
||||||
static $cookie_path = NULL;
|
static $cookie_path = null;
|
||||||
|
|
||||||
if ( NULL !== $cookie_path ) {
|
if ( null !== $cookie_path ) {
|
||||||
return $cookie_path;
|
return $cookie_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user