本文整理汇总了PHP中PMA_checkConfigRw函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_checkConfigRw函数的具体用法?PHP PMA_checkConfigRw怎么用?PHP PMA_checkConfigRw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_checkConfigRw函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_versionCheck
//
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: testPMACheckConfigRw
/**
* 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');
}
}