コード例 #1
0
 /**
  * Constructor
  *
  * @param string $formGroupName The name of config form group to display
  * @param string $elemId        Id of the div containing settings
  */
 public function __construct($formGroupName, $elemId = null)
 {
     global $forms;
     if (empty($forms[$formGroupName])) {
         return;
     }
     if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
         return;
     }
     if (!empty($elemId)) {
         $this->_elemId = $elemId;
     }
     $this->_groupName = $formGroupName;
     $cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
     PMA_userprefsPageInit($cf);
     $form_display = new FormDisplay($cf);
     foreach ($forms[$formGroupName] as $form_name => $form) {
         // skip Developer form if no setting is available
         if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
             continue;
         }
         $form_display->registerForm($form_name, $form, 1);
     }
     // Process form
     $error = null;
     if (isset($_POST['submit_save']) && $_POST['submit_save'] == $formGroupName) {
         $this->_processPageSettings($form_display, $cf, $error);
     }
     // Display forms
     $this->_HTML = $this->_getPageSettingsDisplay($form_display, $error);
 }
コード例 #2
0
    /**
     * Test for PMA_userprefsPageInit
     *
     * @return void
     */
    public function testUserPrefPageInit()
    {
        $GLOBALS['cfg'] = array(
            'Server/hide_db' => 'testval123',
            'Server/only_db' => 'test213'
        );
        $GLOBALS['cfg']['AvailableCharsets'] = array();
        $GLOBALS['forms'] = array(
            'form1' => array(
                array('Servers/1/hide_db', 'bar'),
                array('test' => 'val')
            )
        );

        PMA_userprefsPageInit(new ConfigFile());

        $this->assertEquals(
            array(
                'Servers' => array(
                    1 => array(
                        'hide_db' => 'testval123'
                    )
                )
            ),
            $_SESSION['ConfigFile' . $GLOBALS['server']]
        );
    }
コード例 #3
0
use PMA\libraries\config\ConfigFile;
use PMA\libraries\config\FormDisplay;
use PMA\libraries\Message;
use PMA\libraries\Response;
use PMA\libraries\PMA_String;
use PMA\libraries\Util;
/**
 * Gets some core libraries and displays a top message if required
 */
require_once 'libraries/common.inc.php';
require_once 'libraries/user_preferences.lib.php';
require_once 'libraries/config/config_functions.lib.php';
require_once 'libraries/config/messages.inc.php';
require 'libraries/config/user_preferences.forms.php';
$cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
PMA_userprefsPageInit($cf);
$error = '';
if (isset($_POST['submit_export']) && isset($_POST['export_type']) && $_POST['export_type'] == 'text_file') {
    // export to JSON file
    PMA\libraries\Response::getInstance()->disable();
    $filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
    PMA_downloadHeader($filename, 'application/json');
    $settings = PMA_loadUserprefs();
    echo json_encode($settings['config_data'], JSON_PRETTY_PRINT);
    exit;
} else {
    if (isset($_POST['submit_get_json'])) {
        $settings = PMA_loadUserprefs();
        $response = PMA\libraries\Response::getInstance();
        $response->addJSON('prefs', json_encode($settings['config_data']));
        $response->addJSON('mtime', $settings['mtime']);
コード例 #4
0
ファイル: prefs_manage.php プロジェクト: yxwzaxns/sakura
 * User preferences management page
 *
 * @package PhpMyAdmin
 */
/**
 * Gets some core libraries and displays a top message if required
 */
require_once 'libraries/common.inc.php';
require_once 'libraries/user_preferences.lib.php';
require_once 'libraries/config/config_functions.lib.php';
require_once 'libraries/config/messages.inc.php';
require_once 'libraries/config/ConfigFile.class.php';
require_once 'libraries/config/Form.class.php';
require_once 'libraries/config/FormDisplay.class.php';
require 'libraries/config/user_preferences.forms.php';
PMA_userprefsPageInit();
$error = '';
if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == 'text_file') {
    // export to JSON file
    PMA_Response::getInstance()->disable();
    $filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
    PMA_downloadHeader($filename, 'application/json');
    $settings = PMA_loadUserprefs();
    echo json_encode($settings['config_data']);
    exit;
} else {
    if (isset($_POST['submit_get_json'])) {
        $settings = PMA_loadUserprefs();
        $response = PMA_Response::getInstance();
        $response->addJSON('prefs', json_encode($settings['config_data']));
        $response->addJSON('mtime', $settings['mtime']);