diff options
author | Michal Čihař <michal@cihar.com> | 2016-05-23 17:34:02 +0300 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-05-23 17:35:03 +0300 |
commit | a15a847adedcddb298418407e5642c1a562b0d14 (patch) | |
tree | e427bd5003292288e1c34104fa635805d0d353fa /prefs_manage.php | |
parent | 183259e9e9b06cd6013635b1afb4f67cb787aed3 (diff) |
Add support for export user settings as config.inc.php snippet
Fixes #6274
Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'prefs_manage.php')
-rw-r--r-- | prefs_manage.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/prefs_manage.php b/prefs_manage.php index 2f6ef2cf18..575346ed53 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -38,6 +38,22 @@ if (isset($_POST['submit_export']) $settings = PMA_loadUserprefs(); echo json_encode($settings['config_data'], JSON_PRETTY_PRINT); exit; +} elseif (isset($_POST['submit_export']) + && isset($_POST['export_type']) + && $_POST['export_type'] == 'php_file' +) { + // export to JSON file + PMA\libraries\Response::getInstance()->disable(); + $filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.php'; + PMA_downloadHeader($filename, 'application/php'); + $settings = PMA_loadUserprefs(); + echo '/* ' . _('phpMyAdmin configuration snippet') . " */\n\n"; + echo '/* ' . _('Paste it to your config.inc.php') . " */\n\n"; + foreach ($settings['config_data'] as $key => $val) { + echo '$cfg[\'' . str_replace('/', '\'][\'', $key) . '\'] = '; + echo var_export($val, true) . ";\n"; + } + exit; } else if (isset($_POST['submit_get_json'])) { $settings = PMA_loadUserprefs(); $response = PMA\libraries\Response::getInstance(); @@ -320,6 +336,11 @@ if (file_exists('setup/index.php')) { <label for="export_text_file"> <?php echo __('Save as file'); ?> </label><br /> + <input type="radio" id="export_php_file" name="export_type" + value="php_file" /> + <label for="export_php_file"> + <?php echo __('Save as PHP file'); ?> + </label><br /> <input type="radio" id="export_local_storage" name="export_type" value="local_storage" disabled="disabled" /> <label for="export_local_storage"> |