コード例 #1
0
ファイル: index.inc.php プロジェクト: nobodypb/phpmyadmin
//
if (isset($_GET['version_check'])) {
    PMA_versionCheck();
}
//
// Perform various security, compatibility and consistency checks
//
$configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']);
$configChecker->performConfigChecks();
//
// Check whether we can read/write configuration
//
$config_readable = false;
$config_writable = false;
$config_exists = false;
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
if (!$config_writable || !$config_readable) {
    PMA_messagesSet('error', 'config_rw', __('Cannot load or save configuration'), PMA_sanitize(__('Please create web server writable folder [em]config[/em] in ' . 'phpMyAdmin top level directory as described in ' . '[doc@setup_script]documentation[/doc]. Otherwise you will be ' . 'only able to download or display it.')));
}
//
// Check https connection
//
$is_https = !empty($_SERVER['HTTPS']) && mb_strtolower($_SERVER['HTTPS']) == 'on';
if (!$is_https) {
    $text = __('You are not using a secure connection; all data (including potentially ' . 'sensitive information, like passwords) is transferred unencrypted!');
    if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
        $link = htmlspecialchars('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        $text .= ' ';
        $text .= PMA_sanitize(sprintf(__('If your server is also configured to accept HTTPS requests ' . 'follow [a@%s]this link[/a] to use a secure connection.'), $link));
    }
    PMA_messagesSet('notice', 'no_https', __('Insecure connection'), $text);
コード例 #2
0
 /**
  * Test for PMA_checkConfigRw
  *
  * @return void
  */
 public function testPMACheckConfigRw()
 {
     if (!PMA_HAS_RUNKIT) {
         $this->markTestSkipped('Cannot redefine constant');
     }
     $redefine = null;
     $GLOBALS['cfg']['AvailableCharsets'] = array();
     $GLOBALS['server'] = 0;
     $GLOBALS['ConfigFile'] = new ConfigFile();
     if (!defined('SETUP_CONFIG_FILE')) {
         define('SETUP_CONFIG_FILE', 'test/test_data/configfile');
     } else {
         $redefine = 'SETUP_CONFIG_FILE';
         runkit_constant_redefine('SETUP_CONFIG_FILE', 'test/test_data/configfile');
     }
     $is_readable = false;
     $is_writable = false;
     $file_exists = false;
     PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
     $this->assertTrue($is_readable);
     $this->assertTrue($is_writable);
     $this->assertFalse($file_exists);
     runkit_constant_redefine('SETUP_CONFIG_FILE', 'test/test_data/test.file');
     PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
     $this->assertTrue($is_readable);
     $this->assertTrue($is_writable);
     $this->assertTrue($file_exists);
     if ($redefine !== null) {
         runkit_constant_redefine('SETUP_CONFIG_FILE', $redefine);
     } else {
         runkit_constant_remove('SETUP_CONFIG_FILE');
     }
 }