Merge branch 'forms'

This commit is contained in:
Michal Čihař 2017-09-06 12:03:57 +02:00
commit 403b7ab72b
61 changed files with 1265 additions and 940 deletions

View File

@ -16,8 +16,6 @@ use PhpMyAdmin\Util;
* Gets some core libraries
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Export');

View File

@ -10,8 +10,6 @@ use PhpMyAdmin\Response;
use PhpMyAdmin\Config\PageSettings;
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Import');

View File

@ -12,10 +12,8 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Sql_queries');
PageSettings::showGroup('Sql');
/**
* Runs common work

View File

@ -3152,7 +3152,7 @@ Various display setting
Contains names of configuration options (keys in ``$cfg`` array) that
users can't set through user preferences. For possible values, refer
to :file:`libraries/config/user_preferences.forms.php`.
to clases under :file:`libraries/classes/Config/Forms/User/`.
.. config:option:: $cfg['UserprefsDeveloperTab']

View File

@ -450,20 +450,14 @@ class Descriptions
return __('Edit mode');
case 'Form_Edit_desc':
return __('Customize edit mode.');
case 'Form_Export_name':
return __('Export');
case 'Form_Export_defaults_name':
return __('Export defaults');
case 'Form_Export_defaults_desc':
return __('Customize default export options.');
case 'Form_Features_name':
return __('Features');
case 'Form_General_name':
return __('General');
case 'Form_General_desc':
return __('Set some commonly used options.');
case 'Form_Import_name':
return __('Import');
case 'Form_Import_defaults_name':
return __('Import defaults');
case 'Form_Import_defaults_desc':
@ -555,18 +549,6 @@ class Descriptions
'Tracking of changes made in database. Requires the phpMyAdmin configuration '
. 'storage.'
);
case 'Formset_Export_name':
return __('Customize export options');
case 'Formset_Features_name':
return __('Features');
case 'Formset_Import_name':
return __('Customize import defaults');
case 'Formset_Navi_panel_name':
return __('Customize navigation panel');
case 'Formset_Main_panel_name':
return __('Customize main panel');
case 'Formset_Sql_queries_name':
return __('SQL queries');
case 'Form_Sql_name':
return __('SQL');
case 'Form_Sql_box_name':

View File

@ -136,7 +136,7 @@ class Form
/**
* array_walk callback function, reads path of form fields from
* array (see file comment in setup.forms.php or user_preferences.forms.inc)
* array (see docs for \PhpMyAdmin\Config\Forms\BaseForm::getForms)
*
* @param mixed $value Value
* @param mixed $key Key

View File

@ -17,6 +17,7 @@ namespace PhpMyAdmin\Config;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Descriptions;
use PhpMyAdmin\Config\Form;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Config\Validator;
use PhpMyAdmin\Sanitize;
use PhpMyAdmin\Util;
@ -781,7 +782,7 @@ class FormDisplay
return;
}
$this->_userprefsKeys = array_flip(PMA_readUserprefsFieldNames());
$this->_userprefsKeys = array_flip(UserFormList::getFields());
// read real config for user preferences display
$userprefs_disallow = $GLOBALS['PMA_Config']->get('is_setup')
? $this->_configFile->get('UserprefsDisallow', array())

View File

@ -0,0 +1,85 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Base class for preferences.
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\FormDisplay;
/**
* Base form for user preferences
*/
abstract class BaseForm extends FormDisplay
{
/**
* Constructor
*
* @param ConfigFile $cf Config file instance
* @param int|null $server_id 0 if new server, validation; >= 1 if editing a server
*/
public function __construct(ConfigFile $cf, $server_id = null)
{
parent::__construct($cf);
foreach (static::getForms() as $form_name => $form) {
$this->registerForm($form_name, $form, $server_id);
}
}
/**
* List of available forms, each form is described as an array of fields to display.
* Fields MUST have their counterparts in the $cfg array.
*
* To define form field, use the notation below:
* $forms['Form group']['Form name'] = array('Option/path');
*
* You can assign default values set by special button ("set value: ..."), eg.:
* 'Servers/1/pmadb' => 'phpmyadmin'
*
* To group options, use:
* ':group:' . __('group name') // just define a group
* or
* 'option' => ':group' // group starting from this option
* End group blocks with:
* ':group:end'
*
* @todo This should be abstract, but that does not work in PHP 5
*
* @return array
*/
public static function getForms()
{
return array();
}
/**
* Returns list of fields used in the form.
*
* @return string[]
*/
public static function getFields()
{
$names = [];
foreach (static::getForms() as $form) {
foreach ($form as $k => $v) {
$names[] = is_int($k) ? $v : $k;
}
}
return $names;
}
/**
* Returns name of the form
*
* @todo This should be abstract, but that does not work in PHP 5
*
* @return string
*/
public static function getName()
{
return '';
}
}

View File

@ -0,0 +1,127 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms;
use PhpMyAdmin\Config\ConfigFile;
class BaseFormList
{
/**
* List of all forms
*/
protected static $all = array();
protected static $ns = 'PhpMyAdmin\\Config\\Forms\\';
private $_forms;
public static function getAll()
{
return static::$all;
}
public static function isValid($name)
{
return in_array($name, static::$all);
}
public static function get($name)
{
if (static::isValid($name)) {
return static::$ns . $name . 'Form';
}
return null;
}
/**
* Constructor
*
* @param ConfigFile $cf Config file instance
*/
public function __construct(ConfigFile $cf)
{
$this->_forms = array();
foreach (static::$all as $form) {
$class = static::get($form);
$this->_forms[] = new $class($cf);
}
}
/**
* Processes forms, returns true on successful save
*
* @param bool $allow_partial_save allows for partial form saving
* on failed validation
* @param bool $check_form_submit whether check for $_POST['submit_save']
*
* @return boolean whether processing was successful
*/
public function process($allow_partial_save = true, $check_form_submit = true)
{
$ret = true;
foreach ($this->_forms as $form) {
$ret = $ret && $form->process($allow_partial_save, $check_form_submit);
}
return $ret;
}
/**
* Displays errors
*
* @return string HTML for errors
*/
public function displayErrors()
{
$ret = '';
foreach ($this->_forms as $form) {
$ret .= $form->displayErrors();
}
return $ret;
}
/**
* Reverts erroneous fields to their default values
*
* @return void
*/
public function fixErrors()
{
foreach ($this->_forms as $form) {
$form->fixErrors();
}
}
/**
* Tells whether form validation failed
*
* @return boolean
*/
public function hasErrors()
{
$ret = false;
foreach ($this->_forms as $form) {
$ret = $ret || $form->hasErrors();
}
return $ret;
}
/**
* Returns list of fields used in the form.
*
* @return string[]
*/
public static function getFields()
{
$names = [];
foreach (static::$all as $form) {
$class = static::get($form);
$names = array_merge($names, $class::getFields());
}
return $names;
}
}

View File

@ -0,0 +1,21 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
use PhpMyAdmin\Config\Forms\BaseForm;
use PhpMyAdmin\Config\Forms\User\MainForm;
class BrowseForm extends BaseForm
{
public static function getForms()
{
return [
'Browse' => MainForm::getForms()['Browse']
];
}
}

View File

@ -0,0 +1,22 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
use PhpMyAdmin\Config\Forms\BaseForm;
use PhpMyAdmin\Config\Forms\User\MainForm;
class DbStructureForm extends BaseForm
{
public static function getForms()
{
return [
'DbStructure' => MainForm::getForms()['DbStructure']
];
}
}

View File

@ -0,0 +1,23 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
use PhpMyAdmin\Config\Forms\BaseForm;
use PhpMyAdmin\Config\Forms\User\MainForm;
use PhpMyAdmin\Config\Forms\User\FeaturesForm;
class EditForm extends BaseForm
{
public static function getForms()
{
return [
'Edit' => MainForm::getForms()['Edit'],
'Text_fields' => FeaturesForm::getForms()['Text_fields'],
];
}
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
class ExportForm extends \PhpMyAdmin\Config\Forms\User\ExportForm
{
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
class ImportForm extends \PhpMyAdmin\Config\Forms\User\ImportForm
{
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
class NaviForm extends \PhpMyAdmin\Config\Forms\User\NaviForm
{
}

View File

@ -0,0 +1,25 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Page preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
use PhpMyAdmin\Config\Forms\BaseFormList;
class PageFormList extends BaseFormList
{
protected static $all = array(
'Browse',
'DbStructure',
'Edit',
'Export',
'Import',
'Navi',
'Sql',
'TableStructure',
);
protected static $ns = '\\PhpMyAdmin\\Config\\Forms\\Page\\';
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
class SqlForm extends \PhpMyAdmin\Config\Forms\User\SqlForm
{
}

View File

@ -0,0 +1,22 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Page;
use PhpMyAdmin\Config\Forms\BaseForm;
use PhpMyAdmin\Config\Forms\User\MainForm;
class TableStructureForm extends BaseForm
{
public static function getForms()
{
return [
'TableStructure' => MainForm::getForms()['TableStructure']
];
}
}

View File

@ -0,0 +1,23 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
use PhpMyAdmin\Config\Forms\BaseForm;
class ConfigForm extends BaseForm
{
public static function getForms()
{
return array(
'Config' => array(
'DefaultLang',
'ServerDefault'
),
);
}
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class ExportForm extends \PhpMyAdmin\Config\Forms\User\ExportForm
{
}

View File

@ -0,0 +1,63 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
{
public static function getForms()
{
$result = parent::getForms();
/* Remove only_db/hide_db, we have proper Server form in setup */
$result['Databases'] = array_diff(
$result['Databases'],
['Servers/1/only_db', 'Servers/1/hide_db']
);
/* Following are not available to user */
$result['Import_export'] = array(
'UploadDir',
'SaveDir',
'RecodingEngine' => ':group',
'IconvExtraParams',
':group:end',
'ZipDump',
'GZipDump',
'BZipDump',
'CompressOnFly'
);
$result['Security'] = array(
'blowfish_secret',
'CheckConfigurationPermissions',
'TrustedProxies',
'AllowUserDropDatabase',
'AllowArbitraryServer',
'ArbitraryServerRegexp',
'LoginCookieRecall',
'LoginCookieStore',
'LoginCookieDeleteAll',
'CaptchaLoginPublicKey',
'CaptchaLoginPrivateKey'
);
$result['Developer'] = array(
'UserprefsDeveloperTab',
'DBG/sql',
);
$result['Other_core_settings'] = array(
'OBGzip',
'PersistentConnections',
'ExecTimeLimit',
'MemoryLimit',
'UseDbSearch',
'ProxyUrl',
'ProxyUser',
'ProxyPass',
'AllowThirdPartyFraming',
'ZeroConf',
);
return $result;
}
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class ImportForm extends \PhpMyAdmin\Config\Forms\User\ImportForm
{
}

View File

@ -0,0 +1,20 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class MainForm extends \PhpMyAdmin\Config\Forms\User\MainForm
{
public static function getForms()
{
$result = parent::getForms();
/* Following are not available to user */
$result['Startup'][] = 'ShowPhpInfo';
$result['Startup'][] = 'ShowChgPassword';
return $result;
}
}

View File

@ -0,0 +1,12 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class NaviForm extends \PhpMyAdmin\Config\Forms\User\NaviForm
{
}

View File

@ -0,0 +1,81 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
use PhpMyAdmin\Config\Forms\BaseForm;
class ServersForm extends BaseForm
{
public static function getForms()
{
return array(
'Server' => array('Servers' => array(1 => array(
'verbose',
'host',
'port',
'socket',
'ssl',
'compress'))),
'Server_auth' => array('Servers' => array(1 => array(
'auth_type',
':group:' . __('Config authentication'),
'user',
'password',
':group:end',
':group:' . __('HTTP authentication'),
'auth_http_realm',
':group:end',
':group:' . __('Signon authentication'),
'SignonSession',
'SignonURL',
'LogoutURL'))),
'Server_config' => array('Servers' => array(1 => array(
'only_db',
'hide_db',
'AllowRoot',
'AllowNoPassword',
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'SessionTimeZone'))),
'Server_pmadb' => array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',
'relation' => 'pma__relation',
'userconfig' => 'pma__userconfig',
'users' => 'pma__users',
'usergroups' => 'pma__usergroups',
'navigationhiding' => 'pma__navigationhiding',
'table_info' => 'pma__table_info',
'column_info' => 'pma__column_info',
'history' => 'pma__history',
'recent' => 'pma__recent',
'favorite' => 'pma__favorite',
'table_uiprefs' => 'pma__table_uiprefs',
'tracking' => 'pma__tracking',
'table_coords' => 'pma__table_coords',
'pdf_pages' => 'pma__pdf_pages',
'savedsearches' => 'pma__savedsearches',
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100))),
'Server_tracking' => array('Servers' => array(1 => array(
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
))),
);
}
}

View File

@ -0,0 +1,25 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Setup preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
use PhpMyAdmin\Config\Forms\BaseFormList;
class SetupFormList extends BaseFormList
{
protected static $all = array(
'Config',
'Export',
'Features',
'Import',
'Main',
'Navi',
'Servers',
'Sql',
);
protected static $ns = '\\PhpMyAdmin\\Config\\Forms\\Setup\\';
}

View File

@ -0,0 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\Setup;
class SqlForm extends \PhpMyAdmin\Config\Forms\User\SqlForm
{
public static function getForms()
{
$result = parent::getForms();
/* Following are not available to user */
$result['Sql_queries'][] = 'QueryHistoryDB';
return $result;
}
}

View File

@ -0,0 +1,142 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class ExportForm extends BaseForm
{
public static function getForms()
{
return array(
'Export_defaults' => array(
'Export/method',
':group:' . __('Quick'),
'Export/quick_export_onserver',
'Export/quick_export_onserver_overwrite',
':group:end',
':group:' . __('Custom'),
'Export/format',
'Export/compression',
'Export/charset',
'Export/lock_tables',
'Export/as_separate_files',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
':group:end',
'Export/file_template_table',
'Export/file_template_database',
'Export/file_template_server'
),
'Sql' => array(
'Export/sql_include_comments' => ':group',
'Export/sql_dates',
'Export/sql_relation',
'Export/sql_mime',
':group:end',
'Export/sql_use_transaction',
'Export/sql_disable_fk',
'Export/sql_views_as_tables',
'Export/sql_metadata',
'Export/sql_compatibility',
'Export/sql_structure_or_data',
':group:' . __('Structure'),
'Export/sql_drop_database',
'Export/sql_create_database',
'Export/sql_drop_table',
'Export/sql_create_table' => ':group',
'Export/sql_if_not_exists',
'Export/sql_auto_increment',
':group:end',
'Export/sql_create_view',
'Export/sql_procedure_function',
'Export/sql_create_trigger',
'Export/sql_backquotes',
':group:end',
':group:' . __('Data'),
'Export/sql_delayed',
'Export/sql_ignore',
'Export/sql_type',
'Export/sql_insert_syntax',
'Export/sql_max_query_size',
'Export/sql_hex_for_binary',
'Export/sql_utc_time'
),
'CodeGen' => array(
'Export/codegen_format'
),
'Csv' => array(
':group:' . __('CSV'),
'Export/csv_separator',
'Export/csv_enclosed',
'Export/csv_escaped',
'Export/csv_terminated',
'Export/csv_null',
'Export/csv_removeCRLF',
'Export/csv_columns',
':group:end',
':group:' . __('CSV for MS Excel'),
'Export/excel_null',
'Export/excel_removeCRLF',
'Export/excel_columns',
'Export/excel_edition'
),
'Latex' => array(
'Export/latex_caption',
'Export/latex_structure_or_data',
':group:' . __('Structure'),
'Export/latex_structure_caption',
'Export/latex_structure_continued_caption',
'Export/latex_structure_label',
'Export/latex_relation',
'Export/latex_comments',
'Export/latex_mime',
':group:end',
':group:' . __('Data'),
'Export/latex_columns',
'Export/latex_data_caption',
'Export/latex_data_continued_caption',
'Export/latex_data_label',
'Export/latex_null'
),
'Microsoft_Office' => array(
':group:' . __('Microsoft Word 2000'),
'Export/htmlword_structure_or_data',
'Export/htmlword_null',
'Export/htmlword_columns'),
'Open_Document' => array(
':group:' . __('OpenDocument Spreadsheet'),
'Export/ods_columns',
'Export/ods_null',
':group:end',
':group:' . __('OpenDocument Text'),
'Export/odt_structure_or_data',
':group:' . __('Structure'),
'Export/odt_relation',
'Export/odt_comments',
'Export/odt_mime',
':group:end',
':group:' . __('Data'),
'Export/odt_columns',
'Export/odt_null'
),
'Texy' => array(
'Export/texytext_structure_or_data',
':group:' . __('Data'),
'Export/texytext_null',
'Export/texytext_columns'
),
);
}
public static function getName()
{
return __('Export');
}
}

View File

@ -0,0 +1,70 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class FeaturesForm extends BaseForm
{
public static function getForms()
{
$result = array(
'General' => array(
'VersionCheck',
'NaturalOrder',
'InitialSlidersState',
'SkipLockedTables',
'DisableMultiTableMaintenance',
'ShowHint',
'SendErrorReports',
'ConsoleEnterExecutes',
'DisableShortcutKeys',
),
'Databases' => array(
'Servers/1/only_db', // saves to Server/only_db
'Servers/1/hide_db', // saves to Server/hide_db
'MaxDbList',
'MaxTableList',
),
'Text_fields' => array(
'CharEditing',
'MinSizeForInputField',
'MaxSizeForInputField',
'CharTextareaCols',
'CharTextareaRows',
'TextareaCols',
'TextareaRows',
'LongtextDoubleTextarea'
),
'Page_titles' => array(
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer'
),
'Warnings' => array(
'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning',
'LoginCookieValidityDisableWarning',
'ReservedWordDisableWarning'
),
);
// skip Developer form if no setting is available
if ($GLOBALS['cfg']['UserprefsDeveloperTab']) {
$result['Developer'] = array(
'DBG/sql'
);
}
return $result;
}
public static function getName()
{
return __('Features');
}
}

View File

@ -0,0 +1,60 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class ImportForm extends BaseForm
{
public static function getForms()
{
return array(
'Import_defaults' => array(
'Import/format',
'Import/charset',
'Import/allow_interrupt',
'Import/skip_queries'
),
'Sql' => array(
'Import/sql_compatibility',
'Import/sql_no_auto_value_on_zero',
'Import/sql_read_as_multibytes'
),
'Csv' => array(
':group:' . __('CSV'),
'Import/csv_replace',
'Import/csv_ignore',
'Import/csv_terminated',
'Import/csv_enclosed',
'Import/csv_escaped',
'Import/csv_col_names',
':group:end',
':group:' . __('CSV using LOAD DATA'),
'Import/ldi_replace',
'Import/ldi_ignore',
'Import/ldi_terminated',
'Import/ldi_enclosed',
'Import/ldi_escaped',
'Import/ldi_local_option'
),
'Open_Document' => array(
':group:' . __('OpenDocument Spreadsheet'),
'Import/ods_col_names',
'Import/ods_empty_rows',
'Import/ods_recognize_percentages',
'Import/ods_recognize_currency'
),
);
}
public static function getName()
{
return __('Import');
}
}

View File

@ -0,0 +1,86 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class MainForm extends BaseForm
{
public static function getForms()
{
return array(
'Startup' => array(
'ShowCreateDb',
'ShowStats',
'ShowServerInfo'
),
'DbStructure' => array(
'ShowDbStructureCharset',
'ShowDbStructureComment',
'ShowDbStructureCreation',
'ShowDbStructureLastUpdate',
'ShowDbStructureLastCheck'
),
'TableStructure' => array(
'HideStructureActions',
'ShowColumnComments',
':group:' . __('Default transformations'),
'DefaultTransformations/Hex',
'DefaultTransformations/Substring',
'DefaultTransformations/Bool2Text',
'DefaultTransformations/External',
'DefaultTransformations/PreApPend',
'DefaultTransformations/DateFormat',
'DefaultTransformations/Inline',
'DefaultTransformations/TextImageLink',
'DefaultTransformations/TextLink',
':group:end'
),
'Browse' => array(
'TableNavigationLinksMode',
'ActionLinksMode',
'ShowAll',
'MaxRows',
'Order',
'BrowsePointerEnable',
'BrowseMarkerEnable',
'GridEditing',
'SaveCellsAtOnce',
'RepeatCells',
'LimitChars',
'RowActionLinks',
'RowActionLinksWithoutUnique',
'TablePrimaryKeyOrder',
'RememberSorting',
'RelationalDisplay'
),
'Edit' => array(
'ProtectBinary',
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
'InsertRows',
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit'
),
'Tabs' => array(
'TabsMode',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable'
),
'DisplayRelationalSchema' => array(
'PDFDefaultPageSize'
),
);
}
public static function getName()
{
return __('Main panel');
}
}

View File

@ -0,0 +1,60 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class NaviForm extends BaseForm
{
public static function getForms()
{
return array(
'Navi_panel' => array(
'ShowDatabasesNavigationAsTree',
'NavigationLinkWithMainPanel',
'NavigationDisplayLogo',
'NavigationLogoLink',
'NavigationLogoLinkWindow',
'NavigationTreePointerEnable',
'FirstLevelNavigationItems',
'NavigationTreeDisplayItemFilterMinimum',
'NumRecentTables',
'NumFavoriteTables'
),
'Navi_tree' => array(
'MaxNavigationItems',
'NavigationTreeEnableGrouping',
'NavigationTreeEnableExpansion',
'NavigationTreeShowTables',
'NavigationTreeShowViews',
'NavigationTreeShowFunctions',
'NavigationTreeShowProcedures',
'NavigationTreeShowEvents'
),
'Navi_servers' => array(
'NavigationDisplayServers',
'DisplayServersList',
),
'Navi_databases' => array(
'NavigationTreeDisplayDbFilterMinimum',
'NavigationTreeDbSeparator'
),
'Navi_tables' => array(
'NavigationTreeDefaultTabTable',
'NavigationTreeDefaultTabTable2',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
),
);
}
public static function getName()
{
return __('Navigation panel');
}
}

View File

@ -0,0 +1,42 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseForm;
class SqlForm extends BaseForm
{
public static function getForms()
{
return array(
'Sql_queries' => array(
'ShowSQL',
'Confirm',
'QueryHistoryMax',
'IgnoreMultiSubmitErrors',
'MaxCharactersInDisplayedSQL',
'RetainQueryBox',
'CodemirrorEnable',
'LintEnable',
'EnableAutocompleteForTablesAndColumns',
'DefaultForeignKeyChecks',
),
'Sql_box' => array(
'SQLQuery/Edit',
'SQLQuery/Explain',
'SQLQuery/ShowAsPHP',
'SQLQuery/Refresh',
),
);
}
public static function getName()
{
return __('SQL queries');
}
}

View File

@ -0,0 +1,23 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* User preferences form
*
* @package PhpMyAdmin
*/
namespace PhpMyAdmin\Config\Forms\User;
use PhpMyAdmin\Config\Forms\BaseFormList;
class UserFormList extends BaseFormList
{
protected static $all = array(
'Features',
'Sql',
'Navi',
'Main',
'Import',
'Export',
);
protected static $ns = '\\PhpMyAdmin\\Config\\Forms\\User\\';
}

View File

@ -9,13 +9,12 @@ namespace PhpMyAdmin\Config;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Config\Forms\Page\PageFormList;
use PhpMyAdmin\Core;
use PhpMyAdmin\Message;
use PhpMyAdmin\Response;
require_once 'libraries/user_preferences.lib.php';
require 'libraries/config/user_preferences.forms.php';
require 'libraries/config/page_settings.forms.php';
/**
* Page-related settings
@ -57,8 +56,8 @@ class PageSettings
*/
public function __construct($formGroupName, $elemId = null)
{
global $forms;
if (empty($forms[$formGroupName])) {
$form_class = PageFormList::get($formGroupName);
if (is_null($form_class)) {
return;
}
@ -74,16 +73,7 @@ class PageSettings
$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);
}
$form_display = new $form_class($cf);
// Process form
$error = null;
@ -226,7 +216,7 @@ class PageSettings
*/
public static function getNaviSettings()
{
$object = new PageSettings('Navi_panel', 'pma_navigation_settings');
$object = new PageSettings('Navi', 'pma_navigation_settings');
$response = Response::getInstance();
$response->addHTML($object->getErrorHTML());

View File

@ -24,8 +24,6 @@ use PhpMyAdmin\Util;
use PhpMyAdmin\Url;
require_once 'libraries/display_create_table.lib.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
/**
* Handles database structure logic

View File

@ -25,9 +25,6 @@ use PhpMyAdmin\Transformations;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
/**
* Handles table structure logic
*

View File

@ -899,8 +899,3 @@ if (! defined('PMA_MINIMUM_COMMON')
}
}
}
if (! defined('PMA_MINIMUM_COMMON')) {
include 'libraries/config/user_preferences.forms.php';
include_once 'libraries/config/page_settings.forms.php';
}

View File

@ -1,29 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Used for page-related settings
*
* Extends groups defined in user_preferences.forms.php
* specific to page-related settings
*
* See more info in user_preferences.forms.php
*
* @package PhpMyAdmin
*/
if (!is_array($forms)) {
$forms = array();
}
$forms['Browse'] = array();
$forms['Browse']['Browse'] = $forms['Main_panel']['Browse'];
$forms['DbStructure'] = array();
$forms['DbStructure']['DbStructure'] = $forms['Main_panel']['DbStructure'];
$forms['Edit'] = array();
$forms['Edit']['Edit'] = $forms['Main_panel']['Edit'];
$forms['Edit']['Text_fields'] = $forms['Features']['Text_fields'];
$forms['TableStructure'] = array();
$forms['TableStructure']['TableStructure'] = $forms['Main_panel']['TableStructure'];

View File

@ -1,395 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* List of available forms, each form is described as an array of fields to display.
* Fields MUST have their counterparts in the $cfg array.
*
* There are two possible notations:
* $forms['Form group']['Form name'] = array('Servers' => array(1 => array('host')));
* can be written as
* $forms['Form group']['Form name'] = array('Servers/1/host');
*
* You can assign default values set by special button ("set value: ..."), eg.:
* 'Servers/1/pmadb' => 'phpmyadmin'
*
* To group options, use:
* ':group:' . __('group name') // just define a group
* or
* 'option' => ':group' // group starting from this option
* End group blocks with:
* ':group:end'
*
* @package PhpMyAdmin-Setup
*/
$forms = array();
$forms['_config.php'] = array(
'DefaultLang',
'ServerDefault');
$forms['Servers']['Server'] = array('Servers' => array(1 => array(
'verbose',
'host',
'port',
'socket',
'ssl',
'compress')));
$forms['Servers']['Server_auth'] = array('Servers' => array(1 => array(
'auth_type',
':group:' . __('Config authentication'),
'user',
'password',
':group:end',
':group:' . __('HTTP authentication'),
'auth_http_realm',
':group:end',
':group:' . __('Signon authentication'),
'SignonSession',
'SignonURL',
'LogoutURL')));
$forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
'only_db',
'hide_db',
'AllowRoot',
'AllowNoPassword',
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'SessionTimeZone')));
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',
'controlport',
'controluser',
'controlpass',
'bookmarktable' => 'pma__bookmark',
'relation' => 'pma__relation',
'userconfig' => 'pma__userconfig',
'users' => 'pma__users',
'usergroups' => 'pma__usergroups',
'navigationhiding' => 'pma__navigationhiding',
'table_info' => 'pma__table_info',
'column_info' => 'pma__column_info',
'history' => 'pma__history',
'recent' => 'pma__recent',
'favorite' => 'pma__favorite',
'table_uiprefs' => 'pma__table_uiprefs',
'tracking' => 'pma__tracking',
'table_coords' => 'pma__table_coords',
'pdf_pages' => 'pma__pdf_pages',
'savedsearches' => 'pma__savedsearches',
'central_columns' => 'pma__central_columns',
'designer_settings' => 'pma__designer_settings',
'export_templates' => 'pma__export_templates',
'MaxTableUiprefs' => 100)));
$forms['Servers']['Server_tracking'] = array('Servers' => array(1 => array(
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
)));
$forms['Features']['Import_export'] = array(
'UploadDir',
'SaveDir',
'RecodingEngine' => ':group',
'IconvExtraParams',
':group:end',
'ZipDump',
'GZipDump',
'BZipDump',
'CompressOnFly');
$forms['Features']['Security'] = array(
'blowfish_secret',
'CheckConfigurationPermissions',
'TrustedProxies',
'AllowUserDropDatabase',
'AllowArbitraryServer',
'ArbitraryServerRegexp',
'LoginCookieRecall',
'LoginCookieValidity',
'LoginCookieStore',
'LoginCookieDeleteAll',
'CaptchaLoginPublicKey',
'CaptchaLoginPrivateKey');
$forms['Features']['Page_titles'] = array(
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer');
$forms['Features']['Warnings'] = array(
'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning',
'LoginCookieValidityDisableWarning');
$forms['Features']['Developer'] = array(
'UserprefsDeveloperTab',
'DBG/sql');
$forms['Features']['Other_core_settings'] = array(
'NaturalOrder',
'InitialSlidersState',
'MaxDbList',
'MaxTableList',
'NumFavoriteTables',
'ShowHint',
'OBGzip',
'PersistentConnections',
'ExecTimeLimit',
'MemoryLimit',
'SkipLockedTables',
'DisableMultiTableMaintenance',
'UseDbSearch',
'VersionCheck',
'SendErrorReports',
'ConsoleEnterExecutes',
'ProxyUrl',
'ProxyUser',
'ProxyPass',
'AllowThirdPartyFraming',
'ZeroConf',
'DisableShortcutKeys'
);
$forms['Sql_queries']['Sql_queries'] = array(
'ShowSQL',
'Confirm',
'QueryHistoryDB',
'QueryHistoryMax',
'IgnoreMultiSubmitErrors',
'MaxCharactersInDisplayedSQL',
'RetainQueryBox',
'CodemirrorEnable',
'LintEnable',
'EnableAutocompleteForTablesAndColumns',
'DefaultForeignKeyChecks');
$forms['Sql_queries']['Sql_box'] = array('SQLQuery' => array(
'Edit',
'Explain',
'ShowAsPHP',
'Refresh'));
$forms['Navi_panel']['Navi_panel'] = array(
'ShowDatabasesNavigationAsTree',
'NavigationLinkWithMainPanel',
'NavigationDisplayLogo',
'NavigationLogoLink',
'NavigationLogoLinkWindow',
'NavigationTreePointerEnable',
'FirstLevelNavigationItems',
'NavigationTreeDisplayItemFilterMinimum',
'NumRecentTables',
'NumFavoriteTables'
);
$forms['Navi_panel']['Navi_tree'] = array(
'MaxNavigationItems',
'NavigationTreeEnableGrouping',
'NavigationTreeEnableExpansion',
'NavigationTreeShowTables',
'NavigationTreeShowViews',
'NavigationTreeShowFunctions',
'NavigationTreeShowProcedures',
'NavigationTreeShowEvents'
);
$forms['Navi_panel']['Navi_servers'] = array(
'NavigationDisplayServers',
'DisplayServersList');
$forms['Navi_panel']['Navi_databases'] = array(
'NavigationTreeDbSeparator');
$forms['Navi_panel']['Navi_tables'] = array(
'NavigationTreeDefaultTabTable',
'NavigationTreeDefaultTabTable2',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
);
$forms['Main_panel']['Startup'] = array(
'ShowCreateDb',
'ShowStats',
'ShowServerInfo',
'ShowPhpInfo',
'ShowChgPassword');
$forms['Main_panel']['DbStructure'] = array(
'ShowDbStructureCharset',
'ShowDbStructureComment',
'ShowDbStructureCreation',
'ShowDbStructureLastUpdate',
'ShowDbStructureLastCheck');
$forms['Main_panel']['TableStructure'] = array(
'HideStructureActions',
'ShowColumnComments');
$forms['Main_panel']['Browse'] = array(
'TableNavigationLinksMode',
'ShowAll',
'MaxRows',
'Order',
'BrowsePointerEnable',
'BrowseMarkerEnable',
'GridEditing',
'SaveCellsAtOnce',
'RepeatCells',
'LimitChars',
'RowActionLinks',
'RowActionLinksWithoutUnique',
'TablePrimaryKeyOrder',
'RememberSorting',
'RelationalDisplay');
$forms['Main_panel']['Edit'] = array(
'ProtectBinary',
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
'CharEditing',
'MinSizeForInputField',
'MaxSizeForInputField',
'CharTextareaCols',
'CharTextareaRows',
'TextareaCols',
'TextareaRows',
'LongtextDoubleTextarea',
'InsertRows',
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit');
$forms['Main_panel']['Tabs'] = array(
'TabsMode',
'ActionLinksMode',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable'
);
$forms['Import']['Import_defaults'] = array('Import' => array(
'format',
'charset',
'allow_interrupt',
'skip_queries'));
$forms['Import']['Sql'] = array('Import' => array(
'sql_compatibility',
'sql_no_auto_value_on_zero'));
$forms['Import']['Csv'] = array('Import' => array(
':group:' . __('CSV'),
'csv_replace',
'csv_ignore',
'csv_terminated',
'csv_enclosed',
'csv_escaped',
'csv_col_names',
':group:end',
':group:' . __('CSV using LOAD DATA'),
'ldi_replace',
'ldi_ignore',
'ldi_terminated',
'ldi_enclosed',
'ldi_escaped',
'ldi_local_option',
':group:end'));
$forms['Import']['Open_Document'] = array('Import' => array(
':group:' . __('OpenDocument Spreadsheet'),
'ods_col_names',
'ods_empty_rows',
'ods_recognize_percentages',
'ods_recognize_currency'));
$forms['Export']['Export_defaults'] = array('Export' => array(
'method',
':group:' . __('Quick'),
'quick_export_onserver',
'quick_export_onserver_overwrite',
':group:end',
':group:' . __('Custom'),
'format',
'compression',
'charset',
'lock_tables',
'as_separate_files',
'asfile' => ':group',
'onserver',
'onserver_overwrite',
':group:end',
'remember_file_template',
'file_template_table',
'file_template_database',
'file_template_server'));
$forms['Export']['Sql'] = array('Export' => array(
'sql_include_comments' => ':group',
'sql_dates',
'sql_relation',
'sql_mime',
':group:end',
'sql_use_transaction',
'sql_disable_fk',
'sql_views_as_tables',
'sql_metadata',
'sql_compatibility',
'sql_structure_or_data',
':group:' . __('Structure'),
'sql_drop_database',
'sql_create_database',
'sql_drop_table',
'sql_procedure_function',
'sql_create_table' => ':group',
'sql_if_not_exists',
'sql_auto_increment',
':group:end',
'sql_create_view',
'sql_create_trigger',
'sql_backquotes',
':group:end',
':group:' . __('Data'),
'sql_delayed',
'sql_ignore',
'sql_type',
'sql_insert_syntax',
'sql_max_query_size',
'sql_hex_for_binary',
'sql_utc_time'));
$forms['Export']['CodeGen'] = array('Export' => array(
'codegen_format'));
$forms['Export']['Csv'] = array('Export' => array(
':group:' . __('CSV'),
'csv_separator',
'csv_enclosed',
'csv_escaped',
'csv_terminated',
'csv_null',
'csv_removeCRLF',
'csv_columns',
':group:end',
':group:' . __('CSV for MS Excel'),
'excel_null',
'excel_removeCRLF',
'excel_columns',
'excel_edition'));
$forms['Export']['Latex'] = array('Export' => array(
'latex_caption',
'latex_structure_or_data',
':group:' . __('Structure'),
'latex_structure_caption',
'latex_structure_continued_caption',
'latex_structure_label',
'latex_relation',
'latex_comments',
'latex_mime',
':group:end',
':group:' . __('Data'),
'latex_columns',
'latex_data_caption',
'latex_data_continued_caption',
'latex_data_label',
'latex_null'));
$forms['Export']['Microsoft_Office'] = array('Export' => array(
':group:' . __('Microsoft Word 2000'),
'htmlword_structure_or_data',
'htmlword_null',
'htmlword_columns'));
$forms['Export']['Open_Document'] = array('Export' => array(
':group:' . __('OpenDocument Spreadsheet'),
'ods_columns',
'ods_null',
':group:end',
':group:' . __('OpenDocument Text'),
'odt_structure_or_data',
':group:' . __('Structure'),
'odt_relation',
'odt_comments',
'odt_mime',
':group:end',
':group:' . __('Data'),
'odt_columns',
'odt_null'));
$forms['Export']['Texy'] = array('Export' => array(
'texytext_structure_or_data',
':group:' . __('Data'),
'texytext_null',
'texytext_columns'));

View File

@ -1,310 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* List of available forms, each form is described as an array of fields to display.
* Fields MUST have their counterparts in the $cfg array.
*
* To define form field, use the notation below:
* $forms['Form group']['Form name'] = array('Option/path');
*
* You can assign default values set by special button ("set value: ..."), eg.:
* 'Servers/1/pmadb' => 'phpmyadmin'
*
* To group options, use:
* ':group:' . __('group name') // just define a group
* or
* 'option' => ':group' // group starting from this option
* End group blocks with:
* ':group:end'
*
* @package PhpMyAdmin
*/
$forms = array();
$forms['Features']['General'] = array(
'VersionCheck',
'NaturalOrder',
'InitialSlidersState',
'LoginCookieValidity',
'SkipLockedTables',
'DisableMultiTableMaintenance',
'MaxTableList',
'ShowHint',
'SendErrorReports',
'ConsoleEnterExecutes'
);
$forms['Features']['Databases'] = array(
'Servers/1/only_db', // saves to Server/only_db
'Servers/1/hide_db', // saves to Server/hide_db
'MaxDbList'
);
$forms['Features']['Text_fields'] = array(
'CharEditing',
'MinSizeForInputField',
'MaxSizeForInputField',
'CharTextareaCols',
'CharTextareaRows',
'TextareaCols',
'TextareaRows',
'LongtextDoubleTextarea');
$forms['Features']['Page_titles'] = array(
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer');
$forms['Features']['Warnings'] = array(
'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning',
'LoginCookieValidityDisableWarning',
'ReservedWordDisableWarning');
// settings from this form are treated specially,
// see prefs_forms.php and user_preferences.lib.php
$forms['Features']['Developer'] = array(
'DBG/sql');
$forms['Sql_queries']['Sql_queries'] = array(
'ShowSQL',
'Confirm',
'QueryHistoryMax',
'IgnoreMultiSubmitErrors',
'MaxCharactersInDisplayedSQL',
'RetainQueryBox',
'CodemirrorEnable',
'LintEnable',
'EnableAutocompleteForTablesAndColumns',
'DefaultForeignKeyChecks');
$forms['Sql_queries']['Sql_box'] = array(
'SQLQuery/Edit',
'SQLQuery/Explain',
'SQLQuery/ShowAsPHP',
'SQLQuery/Refresh');
$forms['Navi_panel']['Navi_panel'] = array(
'ShowDatabasesNavigationAsTree',
'NavigationLinkWithMainPanel',
'NavigationDisplayLogo',
'NavigationLogoLink',
'NavigationLogoLinkWindow',
'NavigationTreePointerEnable',
'FirstLevelNavigationItems',
'NavigationTreeDisplayItemFilterMinimum',
'NumRecentTables',
'NumFavoriteTables'
);
$forms['Navi_panel']['Navi_tree'] = array(
'MaxNavigationItems',
'NavigationTreeEnableGrouping',
'NavigationTreeEnableExpansion',
'NavigationTreeShowTables',
'NavigationTreeShowViews',
'NavigationTreeShowFunctions',
'NavigationTreeShowProcedures',
'NavigationTreeShowEvents'
);
$forms['Navi_panel']['Navi_databases'] = array(
'NavigationTreeDisplayDbFilterMinimum',
'NavigationTreeDbSeparator');
$forms['Navi_panel']['Navi_tables'] = array(
'NavigationTreeDefaultTabTable',
'NavigationTreeDefaultTabTable2',
'NavigationTreeTableSeparator',
'NavigationTreeTableLevel',
);
$forms['Main_panel']['Startup'] = array(
'ShowCreateDb',
'ShowStats',
'ShowServerInfo');
$forms['Main_panel']['DbStructure'] = array(
'ShowDbStructureCharset',
'ShowDbStructureComment',
'ShowDbStructureCreation',
'ShowDbStructureLastUpdate',
'ShowDbStructureLastCheck');
$forms['Main_panel']['TableStructure'] = array(
'HideStructureActions',
'ShowColumnComments',
':group:' . __('Default transformations'),
'DefaultTransformations/Hex',
'DefaultTransformations/Substring',
'DefaultTransformations/Bool2Text',
'DefaultTransformations/External',
'DefaultTransformations/PreApPend',
'DefaultTransformations/DateFormat',
'DefaultTransformations/Inline',
'DefaultTransformations/TextImageLink',
'DefaultTransformations/TextLink',
':group:end'
);
$forms['Main_panel']['Browse'] = array(
'TableNavigationLinksMode',
'ActionLinksMode',
'ShowAll',
'MaxRows',
'Order',
'BrowsePointerEnable',
'BrowseMarkerEnable',
'GridEditing',
'SaveCellsAtOnce',
'RepeatCells',
'LimitChars',
'RowActionLinks',
'RowActionLinksWithoutUnique',
'TablePrimaryKeyOrder',
'RememberSorting',
'RelationalDisplay');
$forms['Main_panel']['Edit'] = array(
'ProtectBinary',
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
'InsertRows',
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit');
$forms['Main_panel']['Tabs'] = array(
'TabsMode',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable');
$forms['Main_panel']['DisplayRelationalSchema'] = array(
'PDFDefaultPageSize');
$forms['Import']['Import_defaults'] = array(
'Import/format',
'Import/charset',
'Import/allow_interrupt',
'Import/skip_queries'
);
$forms['Import']['Sql'] = array(
'Import/sql_compatibility',
'Import/sql_no_auto_value_on_zero',
'Import/sql_read_as_multibytes');
$forms['Import']['Csv'] = array(
':group:' . __('CSV'),
'Import/csv_replace',
'Import/csv_ignore',
'Import/csv_terminated',
'Import/csv_enclosed',
'Import/csv_escaped',
'Import/csv_col_names',
':group:end',
':group:' . __('CSV using LOAD DATA'),
'Import/ldi_replace',
'Import/ldi_ignore',
'Import/ldi_terminated',
'Import/ldi_enclosed',
'Import/ldi_escaped',
'Import/ldi_local_option');
$forms['Import']['Open_Document'] = array(
':group:' . __('OpenDocument Spreadsheet'),
'Import/ods_col_names',
'Import/ods_empty_rows',
'Import/ods_recognize_percentages',
'Import/ods_recognize_currency');
$forms['Export']['Export_defaults'] = array(
'Export/method',
':group:' . __('Quick'),
'Export/quick_export_onserver',
'Export/quick_export_onserver_overwrite',
':group:end',
':group:' . __('Custom'),
'Export/format',
'Export/compression',
'Export/charset',
'Export/lock_tables',
'Export/as_separate_files',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
':group:end',
'Export/file_template_table',
'Export/file_template_database',
'Export/file_template_server');
$forms['Export']['Sql'] = array(
'Export/sql_include_comments' => ':group',
'Export/sql_dates',
'Export/sql_relation',
'Export/sql_mime',
':group:end',
'Export/sql_use_transaction',
'Export/sql_disable_fk',
'Export/sql_views_as_tables',
'Export/sql_metadata',
'Export/sql_compatibility',
'Export/sql_structure_or_data',
':group:' . __('Structure'),
'Export/sql_drop_database',
'Export/sql_create_database',
'Export/sql_drop_table',
'Export/sql_create_table' => ':group',
'Export/sql_if_not_exists',
'Export/sql_auto_increment',
':group:end',
'Export/sql_create_view',
'Export/sql_procedure_function',
'Export/sql_create_trigger',
'Export/sql_backquotes',
':group:end',
':group:' . __('Data'),
'Export/sql_delayed',
'Export/sql_ignore',
'Export/sql_type',
'Export/sql_insert_syntax',
'Export/sql_max_query_size',
'Export/sql_hex_for_binary',
'Export/sql_utc_time');
$forms['Export']['CodeGen'] = array(
'Export/codegen_format');
$forms['Export']['Csv'] = array(
':group:' . __('CSV'),
'Export/csv_separator',
'Export/csv_enclosed',
'Export/csv_escaped',
'Export/csv_terminated',
'Export/csv_null',
'Export/csv_removeCRLF',
'Export/csv_columns',
':group:end',
':group:' . __('CSV for MS Excel'),
'Export/excel_null',
'Export/excel_removeCRLF',
'Export/excel_columns',
'Export/excel_edition');
$forms['Export']['Latex'] = array(
'Export/latex_caption',
'Export/latex_structure_or_data',
':group:' . __('Structure'),
'Export/latex_structure_caption',
'Export/latex_structure_continued_caption',
'Export/latex_structure_label',
'Export/latex_relation',
'Export/latex_comments',
'Export/latex_mime',
':group:end',
':group:' . __('Data'),
'Export/latex_columns',
'Export/latex_data_caption',
'Export/latex_data_continued_caption',
'Export/latex_data_label',
'Export/latex_null');
$forms['Export']['Microsoft_Office'] = array(
':group:' . __('Microsoft Word 2000'),
'Export/htmlword_structure_or_data',
'Export/htmlword_null',
'Export/htmlword_columns');
$forms['Export']['Open_Document'] = array(
':group:' . __('OpenDocument Spreadsheet'),
'Export/ods_columns',
'Export/ods_null',
':group:end',
':group:' . __('OpenDocument Text'),
'Export/odt_structure_or_data',
':group:' . __('Structure'),
'Export/odt_relation',
'Export/odt_comments',
'Export/odt_mime',
':group:end',
':group:' . __('Data'),
'Export/odt_columns',
'Export/odt_null');
$forms['Export']['Texy'] = array(
'Export/texytext_structure_or_data',
':group:' . __('Data'),
'Export/texytext_null',
'Export/texytext_columns');

View File

@ -5,7 +5,7 @@
*
* @package PhpMyAdmin
*/
use PhpMyAdmin\Config\Descriptions;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Message;
use PhpMyAdmin\Relation;
use PhpMyAdmin\Sanitize;
@ -16,15 +16,11 @@ if (!defined('PHPMYADMIN')) {
// build user preferences menu
$form_param = isset($_GET['form']) ? $_GET['form'] : null;
if (! isset($forms[$form_param])) {
$forms_keys = array_keys($forms);
$form_param = array_shift($forms_keys);
}
$tabs_icons = array(
'Features' => 'b_tblops.png',
'Sql_queries' => 'b_sql.png',
'Navi_panel' => 'b_select.png',
'Main_panel' => 'b_props.png',
'Sql' => 'b_sql.png',
'Navi' => 'b_select.png',
'Main' => 'b_props.png',
'Import' => 'b_import.png',
'Export' => 'b_export.png');
@ -35,10 +31,11 @@ $content = PhpMyAdmin\Util::getHtmlTab(
)
) . "\n";
$script_name = basename($GLOBALS['PMA_PHP_SELF']);
foreach (array_keys($forms) as $formset) {
foreach (UserFormList::getAll() as $formset) {
$formset_class = UserFormList::get($formset);
$tab = array(
'link' => 'prefs_forms.php',
'text' => Descriptions::get('Form_' . $formset),
'text' => $formset_class::getName(),
'icon' => $tabs_icons[$formset],
'active' => ($script_name == 'prefs_forms.php' && $formset == $form_param));
$content .= PhpMyAdmin\Util::getHtmlTab($tab, array('form' => $formset))

View File

@ -6,6 +6,7 @@
* @package PhpMyAdmin
*/
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Core;
use PhpMyAdmin\Message;
use PhpMyAdmin\Relation;
@ -24,7 +25,7 @@ if (! defined('PHPMYADMIN')) {
*/
function PMA_userprefsPageInit(ConfigFile $cf)
{
$forms_all_keys = PMA_readUserprefsFieldNames($GLOBALS['forms']);
$forms_all_keys = UserFormList::getFields();
$cf->resetConfigData(); // start with a clean instance
$cf->setAllowedKeys($forms_all_keys);
$cf->setCfgUpdateReadMapping(
@ -157,11 +158,7 @@ function PMA_applyUserprefs(array $config_data)
{
$cfg = array();
$blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']);
if (!$GLOBALS['cfg']['UserprefsDeveloperTab']) {
// disallow everything in the Developers tab
$blacklist['DBG/sql'] = true;
}
$whitelist = array_flip(PMA_readUserprefsFieldNames());
$whitelist = array_flip(UserFormList::getFields());
// whitelist some additional fields which are custom handled
$whitelist['ThemeDefault'] = true;
$whitelist['fontsize'] = true;
@ -178,40 +175,6 @@ function PMA_applyUserprefs(array $config_data)
return $cfg;
}
/**
* Reads user preferences field names
*
* @param array|null $forms Forms
*
* @return array
*/
function PMA_readUserprefsFieldNames(array $forms = null)
{
static $names;
if (defined('TESTSUITE')) {
$names = null;
}
// return cached results
if ($names !== null) {
return $names;
}
if (is_null($forms)) {
$forms = array();
include 'libraries/config/user_preferences.forms.php';
}
$names = array();
foreach ($forms as $formset) {
foreach ($formset as $form) {
foreach ($form as $k => $v) {
$names[] = is_int($k) ? $v : $k;
}
}
}
return $names;
}
/**
* Updates one user preferences option (loads and saves to database).
*

View File

@ -6,7 +6,7 @@
* @package PhpMyAdmin
*/
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Core;
use PhpMyAdmin\Response;
use PhpMyAdmin\Url;
@ -16,7 +16,6 @@ use PhpMyAdmin\Url;
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/user_preferences.lib.php';
require 'libraries/config/user_preferences.forms.php';
$cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
PMA_userprefsPageInit($cf);
@ -24,19 +23,12 @@ PMA_userprefsPageInit($cf);
// handle form processing
$form_param = isset($_GET['form']) ? $_GET['form'] : null;
if (! isset($forms[$form_param])) {
$forms_keys = array_keys($forms);
$form_param = array_shift($forms_keys);
$form_class = UserFormList::get($form_param);
if (is_null($form_class)) {
Core::fatalError(__('Incorrect form specified!'));
}
$form_display = new FormDisplay($cf);
foreach ($forms[$form_param] 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);
}
$form_display = new $form_class($cf, 1);
if (isset($_POST['revert'])) {
// revert erroneous fields to their default values

View File

@ -6,7 +6,7 @@
* @package PhpMyAdmin
*/
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Core;
use PhpMyAdmin\File;
use PhpMyAdmin\Message;
@ -21,7 +21,6 @@ use PhpMyAdmin\ThemeManager;
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/user_preferences.lib.php';
require 'libraries/config/user_preferences.forms.php';
$cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
PMA_userprefsPageInit($cf);
@ -94,12 +93,7 @@ if (isset($_POST['submit_export'])
} else {
// sanitize input values: treat them as though
// they came from HTTP POST request
$form_display = new FormDisplay($cf);
foreach ($forms as $formset_id => $formset) {
foreach ($formset as $form_name => $form) {
$form_display->registerForm($formset_id . ': ' . $form_name, $form);
}
}
$form_display = new UserFormList($cf);
$new_config = $cf->getFlatDefaultConfig();
if (!empty($_POST['import_merge'])) {
$new_config = array_merge($new_config, $cf->getConfigArray());

View File

@ -13,8 +13,6 @@ use PhpMyAdmin\Response;
* Does the common work
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
require_once 'libraries/server_common.inc.php';
PageSettings::showGroup('Export');

View File

@ -12,8 +12,6 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Import');

View File

@ -12,10 +12,8 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Sql_queries');
PageSettings::showGroup('Sql');
/**
* Does the common work

View File

@ -5,8 +5,8 @@
*
* @package PhpMyAdmin-Setup
*/
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Setup\ConfigGenerator;
use PhpMyAdmin\Config\Forms\Setup\ConfigForm;
use PhpMyAdmin\Core;
use PhpMyAdmin\Url;
use PhpMyAdmin\Response;
@ -16,11 +16,8 @@ use PhpMyAdmin\Response;
*/
require './lib/common.inc.php';
require './libraries/config/setup.forms.php';
$form_display = new FormDisplay($GLOBALS['ConfigFile']);
$form_display->registerForm('_config.php', $forms['_config.php']);
$form_display->save('_config.php');
$form_display = new ConfigForm($GLOBALS['ConfigFile']);
$form_display->save('Config');
$response = Response::getInstance();

View File

@ -6,8 +6,7 @@
* @package PhpMyAdmin-Setup
*/
use PhpMyAdmin\Config\Descriptions;
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
use PhpMyAdmin\Core;
if (!defined('PHPMYADMIN')) {
@ -19,20 +18,12 @@ if (!defined('PHPMYADMIN')) {
*/
require_once './setup/lib/form_processing.lib.php';
require './libraries/config/setup.forms.php';
$formset_id = Core::isValid($_GET['formset'], 'scalar') ? $_GET['formset'] : null;
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
if (! isset($forms[$formset_id]) || substr($formset_id, 0, 1) === '_') {
Core::fatalError(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php!'));
}
$form_title = Descriptions::get('Formset_' . $formset_id);
if (! is_null($form_title)) {
echo '<h2>' , $form_title , '</h2>';
}
$form_display = new FormDisplay($GLOBALS['ConfigFile']);
foreach ($forms[$formset_id] as $form_name => $form) {
$form_display->registerForm($form_name, $form);
$form_class = SetupFormList::get($formset_id);
if (is_null($form_class)) {
Core::fatalError(__('Incorrect form specified!'));
}
echo '<h2>' , $form_class::getName() , '</h2>';
$form_display = new $form_class($GLOBALS['ConfigFile']);
PMA_Process_formset($form_display);

View File

@ -6,6 +6,7 @@
* @package PhpMyAdmin-Setup
*/
use PhpMyAdmin\Url;
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
if (!defined('PHPMYADMIN')) {
exit;
@ -18,19 +19,15 @@ echo '<li><a href="index.php' , Url::getCommon() , '"'
, ($formset_id === null ? ' class="active' : '')
, '">' , __('Overview') , '</a></li>';
$formsets = array(
'Features' => __('Features'),
'Sql_queries' => __('SQL queries'),
'Navi_panel' => __('Navigation panel'),
'Main_panel' => __('Main panel'),
'Import' => __('Import'),
'Export' => __('Export')
);
foreach ($formsets as $formset => $label) {
$ignored = array('Config', 'Servers');
foreach (SetupFormList::getAll() as $formset) {
if (in_array($formset, $ignored)) {
continue;
}
$form_class = SetupFormList::get($formset);
echo '<li><a href="index.php' , Url::getCommon(array('page' => 'form', 'formset' => $formset)) , '" '
, ($formset_id === $formset ? ' class="active' : '')
, '">' , $label , '</a></li>';
, '">' , $form_class::getName() , '</a></li>';
}
echo '</ul>';

View File

@ -7,7 +7,7 @@
*/
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\FormDisplay;
use PhpMyAdmin\Config\Forms\Setup\ServersForm;
use PhpMyAdmin\Core;
use PhpMyAdmin\Url;
@ -20,8 +20,6 @@ if (!defined('PHPMYADMIN')) {
*/
require_once './setup/lib/form_processing.lib.php';
require './libraries/config/setup.forms.php';
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
$id = Core::isValid($_GET['id'], 'numeric') ? intval($_GET['id']) : null;
@ -46,8 +44,5 @@ if ($mode == 'edit' && $server_exists) {
if (isset($page_title)) {
echo '<h2>' , $page_title . '</h2>';
}
$form_display = new FormDisplay($cf);
foreach ($forms['Servers'] as $form_name => $form) {
$form_display->registerForm($form_name, $form, $id);
}
$form_display = new ServersForm($cf, $id);
PMA_Process_formset($form_display);

View File

@ -18,8 +18,6 @@ use PhpMyAdmin\Util;
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/check_user_privileges.lib.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Browse');

View File

@ -16,8 +16,6 @@ use PhpMyAdmin\Url;
* Gets the variables sent or posted to this script and displays the header
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Edit');

View File

@ -14,8 +14,6 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Export');

View File

@ -12,8 +12,6 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Import');

View File

@ -12,10 +12,8 @@ use PhpMyAdmin\Response;
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
PageSettings::showGroup('Sql_queries');
PageSettings::showGroup('Sql');
/**
* Runs common work

View File

@ -12,8 +12,6 @@ use PhpMyAdmin\Di\Container;
use PhpMyAdmin\Response;
require_once 'libraries/common.inc.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
$container = Container::getDefaultContainer();
$container->factory('PhpMyAdmin\Controllers\Table\TableStructureController');

View File

@ -0,0 +1,81 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for FormList classes in config folder
*
* @package PhpMyAdmin-test
*/
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Forms\User\UserFormList;
use PhpMyAdmin\Config\Forms\Page\PageFormList;
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
require_once 'test/PMATestCase.php';
/**
* Tests for PMA_FormDisplay class
*
* @package PhpMyAdmin-test
*/
class FormListTest extends PMATestCase
{
public function setUp()
{
$GLOBALS['server'] = 1;
}
/**
* Tests for preferences forms.
*
* @param string $class Class to test
* @param string $prefix Reuturned class prefix
*
* @dataProvider formObjects
*/
public function testForms($class, $prefix)
{
$cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings);
/* Static API */
$this->assertTrue($class::isValid('Export'));
$this->assertEquals(
$prefix . 'ExportForm',
$class::get('Export')
);
foreach ($class::getAll() as $form) {
$form_class = $class::get($form);
$this->assertNotNull($form_class::getName());
}
$this->assertContains(
'Export/texytext_columns',
$class::getFields()
);
/* Instance handling */
$forms = new $class($cf);
$this->assertFalse($forms->process());
$forms->fixErrors();
$this->assertFalse($forms->hasErrors());
$this->assertEquals('', $forms->displayErrors());
}
public function formObjects()
{
return array(
array(
'\\PhpMyAdmin\\Config\\Forms\\User\\UserFormList',
'\\PhpMyAdmin\\Config\\Forms\\User\\',
),
array(
'\\PhpMyAdmin\\Config\\Forms\\Page\\PageFormList',
'\\PhpMyAdmin\\Config\\Forms\\Page\\',
),
array(
'\\PhpMyAdmin\\Config\\Forms\\Setup\\SetupFormList',
'\\PhpMyAdmin\\Config\\Forms\\Setup\\',
),
);
}
}

View File

@ -8,8 +8,6 @@
use PhpMyAdmin\Config\PageSettings;
require_once 'test/PMATestCase.php';
require_once 'libraries/config/user_preferences.forms.php';
require_once 'libraries/config/page_settings.forms.php';
/**
* Tests for PhpMyAdmin\Config\PageSettings
@ -91,7 +89,7 @@ class PageSettingsTest extends PMATestCase
);
$this->assertContains(
'<input type="hidden" name="submit_save" value="Navi_panel" />',
'<input type="hidden" name="submit_save" value="Navi" />',
$html
);
}

View File

@ -43,15 +43,10 @@ class PMA_User_Preferences_Test extends PMATestCase
{
$GLOBALS['cfg'] = array(
'Server/hide_db' => 'testval123',
'Server/only_db' => 'test213'
'Server/port' => '213'
);
$GLOBALS['cfg']['AvailableCharsets'] = array();
$GLOBALS['forms'] = array(
'form1' => array(
array('Servers/1/hide_db', 'bar'),
array('test' => 'val')
)
);
$GLOBALS['cfg']['UserprefsDeveloperTab'] = null;
PMA_userprefsPageInit(new ConfigFile());
@ -301,27 +296,24 @@ class PMA_User_Preferences_Test extends PMATestCase
}
/**
* Test for PMA_readUserprefsFieldNames
* Test for PMA_applyUserprefs
*
* @return void
*/
public function testReadUserprefsFieldNames()
public function testApplyDevelUserprefs()
{
$this->assertGreaterThan(
0,
count(PMA_readUserprefsFieldNames())
);
$forms = array(
'form1' => array(
array('Servers/1/hide_db', 'bar'),
array('test' => 'val')
$GLOBALS['cfg']['UserprefsDeveloperTab'] = true;
$result = PMA_applyUserprefs(
array(
'DBG/sql' => true,
)
);
$this->assertEquals(
array('Servers/1/hide_db', 'bar', 'test'),
PMA_readUserprefsFieldNames($forms)
array(
'DBG' => array('sql' => true),
),
$result
);
}