/**
  * Test for ConfigGenerator::getConfigFile
  *
  * @return void
  * @group medium
  */
 public function testGetConfigFile()
 {
     $GLOBALS['cfg']['AvailableCharsets'] = array();
     unset($_SESSION['eol']);
     $GLOBALS['PMA_Config'] = new PMA_Config();
     $GLOBALS['server'] = 0;
     $cf = new ConfigFile();
     $_SESSION['ConfigFile0'] = array('a', 'b', 'c');
     $_SESSION['ConfigFile0']['Servers'] = array(array(1, 2, 3));
     $cf->setPersistKeys(array("1/", 2));
     $date = date(DATE_RFC1123);
     $result = ConfigGenerator::getConfigFile($cf);
     $this->assertContains("<?php\n" . "/*\n" . " * Generated configuration file\n" . " * Generated by: phpMyAdmin " . $GLOBALS['PMA_Config']->get('PMA_VERSION') . " setup script\n" . " * Date: " . $date . "\n" . " */\n\n", $result);
     $this->assertContains("/* Servers configuration */\n" . '$i = 0;' . "\n\n" . "/* Server: localhost [0] */\n" . '$i++;' . "\n" . '$cfg[\'Servers\'][$i][\'0\'] = 1;' . "\n" . '$cfg[\'Servers\'][$i][\'1\'] = 2;' . "\n" . '$cfg[\'Servers\'][$i][\'2\'] = 3;' . "\n\n" . "/* End of servers configuration */\n\n", $result);
     $this->assertContains('?>', $result);
 }
Пример #2
0
?>
</h2>
<?php 
display_form_top('config.php');
?>
<input type="hidden" name="eol" value="<?php 
echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix'));
?>
" />
<?php 
display_fieldset_top('', '', null, array('class' => 'simple'));
?>
<tr>
    <td>
        <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php 
echo htmlspecialchars(ConfigGenerator::getConfigFile());
?>
</textarea>
    </td>
</tr>
<tr>
    <td class="lastrow" style="text-align: left">
        <input type="submit" name="submit_download" value="<?php 
echo __('Download');
?>
" class="green" />
        <input type="submit" name="submit_save" value="<?php 
echo __('Save');
?>
"<?php 
if (!$config_writable) {
Пример #3
0
    // drop post data
    header('HTTP/1.1 303 See Other');
    header('Location: index.php');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
    //
    // Output generated config file
    //
    PMA_downloadHeader('config.inc.php', 'text/plain');
    echo ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']);
    exit;
} elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
    //
    // Save generated config file on the server
    //
    file_put_contents($config_file_path, ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']));
    header('HTTP/1.1 303 See Other');
    header('Location: index.php' . PMA_URL_getCommon() . '&action_done=config_saved');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
    //
    // Load config file from the server
    //
    $cfg = array();
    include_once $config_file_path;
    $GLOBALS['ConfigFile']->setConfigData($cfg);
    header('HTTP/1.1 303 See Other');
    header('Location: index.php');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
    //
Пример #4
0
 */
require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/index.lib.php';
require_once './setup/lib/ConfigGenerator.class.php';
$config_readable = false;
$config_writable = false;
$config_exists = false;
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
echo '<h2>' . __('Configuration file') . '</h2>';
PMA_displayFormTop('config.php');
echo '<input type="hidden" name="eol" value="' . htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) . '" />';
PMA_displayFieldsetTop('config.inc.php', '', null, array('class' => 'simple'));
echo '<tr>';
echo '<td>';
echo '<textarea cols="50" rows="20" name="textconfig" ' . 'id="textconfig" spellcheck="false">';
echo htmlspecialchars(ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']));
echo '</textarea>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="lastrow" style="text-align: left">';
echo '<input type="submit" name="submit_download" value="' . __('Download') . '" class="green" />';
echo '<input type="submit" name="submit_save" value="' . __('Save') . '"';
if (!$config_writable) {
    echo ' disabled="disabled"';
}
echo '/>';
echo '</td>';
echo '</tr>';
PMA_displayFieldsetBottomSimple();
PMA_displayFormBottom();
Пример #5
0
    // drop post data
    header('HTTP/1.1 303 See Other');
    header('Location: index.php');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
    //
    // Output generated config file
    //
    PMA_downloadHeader('config.inc.php', 'text/plain');
    echo ConfigGenerator::getConfigFile();
    exit;
} elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
    //
    // Save generated config file on the server
    //
    file_put_contents($config_file_path, ConfigGenerator::getConfigFile());
    header('HTTP/1.1 303 See Other');
    header('Location: index.php?action_done=config_saved');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
    //
    // Load config file from the server
    //
    $cfg = array();
    include_once $config_file_path;
    ConfigFile::getInstance()->setConfigData($cfg);
    header('HTTP/1.1 303 See Other');
    header('Location: index.php');
    exit;
} elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
    //