Add category tabs to preferences page
Setup script refactoring
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,6 +19,7 @@ phpmyadmin.wpj
|
|||||||
.settings
|
.settings
|
||||||
.buildpath
|
.buildpath
|
||||||
.cache
|
.cache
|
||||||
|
.idea
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
# Locales
|
# Locales
|
||||||
locale
|
locale
|
||||||
|
@@ -3,10 +3,10 @@ General
|
|||||||
DefaultLang (just persist main page settings?)
|
DefaultLang (just persist main page settings?)
|
||||||
DefaultConnectionCollation (just persist main page settings?)
|
DefaultConnectionCollation (just persist main page settings?)
|
||||||
ThemeDefault (if ThemeManager == true)
|
ThemeDefault (if ThemeManager == true)
|
||||||
NaturalOrder
|
NaturalOrder [s-]
|
||||||
InitialSlidersState
|
InitialSlidersState [s-]
|
||||||
ErrorIconic
|
ErrorIconic [s-]
|
||||||
ReplaceHelpImg
|
ReplaceHelpImg [s-]
|
||||||
Text fields
|
Text fields
|
||||||
CharEditing [s]
|
CharEditing [s]
|
||||||
CharTextareaCols [s]
|
CharTextareaCols [s]
|
||||||
@@ -14,7 +14,6 @@ Text fields
|
|||||||
TextareaCols [s-]
|
TextareaCols [s-]
|
||||||
TextareaRows [s-]
|
TextareaRows [s-]
|
||||||
LongtextDoubleTextarea [s-]
|
LongtextDoubleTextarea [s-]
|
||||||
|
|
||||||
SQL Queries
|
SQL Queries
|
||||||
ShowSQL [s]
|
ShowSQL [s]
|
||||||
Confirm [s]
|
Confirm [s]
|
||||||
@@ -90,14 +89,13 @@ In edit mode...
|
|||||||
ForeignKeyMaxLimit [s]
|
ForeignKeyMaxLimit [s]
|
||||||
CtrlArrowsMoving [s]
|
CtrlArrowsMoving [s]
|
||||||
DefaultPropDisplay [s-]
|
DefaultPropDisplay [s-]
|
||||||
|
|
||||||
|
|
||||||
Tabs display settings
|
Tabs display settings
|
||||||
LightTabs [s]
|
LightTabs [s]
|
||||||
PropertiesIconic [s]
|
PropertiesIconic [s]
|
||||||
DefaultTabServer [s]
|
DefaultTabServer [s]
|
||||||
DefaultTabDatabase [s]
|
DefaultTabDatabase [s]
|
||||||
DefaultTabTable [s]
|
DefaultTabTable [s]
|
||||||
|
|
||||||
SQL Query Box
|
SQL Query Box
|
||||||
Edit [s]
|
Edit [s]
|
||||||
Explain [s]
|
Explain [s]
|
||||||
|
@@ -1637,7 +1637,7 @@ function PMA_generate_html_tab($tab, $url_params = array())
|
|||||||
$defaults = array(
|
$defaults = array(
|
||||||
'text' => '',
|
'text' => '',
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'active' => false,
|
'active' => null,
|
||||||
'link' => '',
|
'link' => '',
|
||||||
'sep' => '?',
|
'sep' => '?',
|
||||||
'attr' => '',
|
'attr' => '',
|
||||||
@@ -1656,7 +1656,7 @@ function PMA_generate_html_tab($tab, $url_params = array())
|
|||||||
} elseif (! empty($tab['active'])
|
} elseif (! empty($tab['active'])
|
||||||
|| PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])) {
|
|| PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])) {
|
||||||
$tab['class'] = 'active';
|
$tab['class'] = 'active';
|
||||||
} elseif (empty($GLOBALS['active_page'])
|
} elseif (is_null($tab['active']) && empty($GLOBALS['active_page'])
|
||||||
&& basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']
|
&& basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']
|
||||||
&& empty($tab['warning'])) {
|
&& empty($tab['warning'])) {
|
||||||
$tab['class'] = 'active';
|
$tab['class'] = 'active';
|
||||||
|
85
libraries/config.values.php
Normal file
85
libraries/config.values.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
|
/**
|
||||||
|
* Database with allowed values for configuration stored in the $cfg array,
|
||||||
|
* used by setup script and user preferences to generate forms.
|
||||||
|
*
|
||||||
|
* @package phpMyAdmin
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value meaning:
|
||||||
|
* o array - select field, array contains allowed values
|
||||||
|
* o string - type override
|
||||||
|
*
|
||||||
|
* Use normal array, paths won't be expanded
|
||||||
|
*/
|
||||||
|
$cfg_db = array();
|
||||||
|
|
||||||
|
$cfg_db['Servers'] = array(1 => array(
|
||||||
|
'port' => 'integer',
|
||||||
|
'connect_type' => array('tcp', 'socket'),
|
||||||
|
'extension' => array('mysql', 'mysqli'),
|
||||||
|
'auth_type' => array('config', 'http', 'signon', 'cookie'),
|
||||||
|
'AllowDeny' => array(
|
||||||
|
'order' => array('', 'deny,allow', 'allow,deny', 'explicit')),
|
||||||
|
'only_db' => 'array'));
|
||||||
|
$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode');
|
||||||
|
$cfg_db['DefaultCharset'] = $GLOBALS['cfg']['AvailableCharsets'];
|
||||||
|
$cfg_db['OBGzip'] = array('auto', true, false);
|
||||||
|
$cfg_db['ShowTooltipAliasTB'] = array('nested', true, false);
|
||||||
|
$cfg_db['DisplayDatabasesList'] = array('auto', true, false);
|
||||||
|
$cfg_db['LeftLogoLinkWindow'] = array('main', 'new');
|
||||||
|
$cfg_db['LeftDefaultTabTable'] = array(
|
||||||
|
'tbl_structure.php', // fields list
|
||||||
|
'tbl_sql.php', // SQL form
|
||||||
|
'tbl_select.php', // search page
|
||||||
|
'tbl_change.php', // insert row page
|
||||||
|
'sql.php'); // browse page
|
||||||
|
$cfg_db['NavigationBarIconic'] = array(true, false, 'both');
|
||||||
|
$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
|
||||||
|
$cfg_db['ProtectBinary'] = array(false, 'blob', 'all');
|
||||||
|
$cfg_db['CharEditing'] = array('input', 'textarea');
|
||||||
|
$cfg_db['PropertiesIconic'] = array(true, false, 'both');
|
||||||
|
$cfg_db['DefaultTabServer'] = array(
|
||||||
|
'main.php', // the welcome page (recommended for multiuser setups)
|
||||||
|
'server_databases.php', // list of databases
|
||||||
|
'server_status.php', // runtime information
|
||||||
|
'server_variables.php', // MySQL server variables
|
||||||
|
'server_privileges.php', // user management
|
||||||
|
'server_processlist.php'); // process list
|
||||||
|
$cfg_db['DefaultTabDatabase'] = array(
|
||||||
|
'db_structure.php', // tables list
|
||||||
|
'db_sql.php', // SQL form
|
||||||
|
'db_search.php', // search query
|
||||||
|
'db_operations.php'); // operations on database
|
||||||
|
$cfg_db['DefaultTabTable'] = array(
|
||||||
|
'tbl_structure.php', // fields list
|
||||||
|
'tbl_sql.php', // SQL form
|
||||||
|
'tbl_select.php', // search page
|
||||||
|
'tbl_change.php', // insert row page
|
||||||
|
'sql.php'); // browse page
|
||||||
|
$cfg_db['QueryWindowDefTab'] = array(
|
||||||
|
'sql', // SQL
|
||||||
|
'files', // Import files
|
||||||
|
'history', // SQL history
|
||||||
|
'full'); // All (SQL and SQL history)
|
||||||
|
$cfg_db['Import']['format'] = array(
|
||||||
|
'csv', // CSV
|
||||||
|
'docsql', // DocSQL
|
||||||
|
'ldi', // CSV using LOAD DATA
|
||||||
|
'sql'); // SQL
|
||||||
|
$cfg_db['Import']['sql_compatibility'] = array(
|
||||||
|
'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', 'MYSQL40', 'MSSQL', 'ORACLE',
|
||||||
|
// removed; in MySQL 5.0.33, this produces exports that
|
||||||
|
// can't be read by POSTGRESQL (see our bug #1596328)
|
||||||
|
//'POSTGRESQL',
|
||||||
|
'TRADITIONAL');
|
||||||
|
$cfg_db['Import']['ldi_local_option'] = array('auto', true, false);
|
||||||
|
$cfg_db['Export']['format'] = array('codegen', 'csv', 'excel', 'htmlexcel',
|
||||||
|
'htmlword', 'latex', 'ods', 'odt', 'pdf', 'sql', 'texytext', 'xls', 'xml',
|
||||||
|
'yaml');
|
||||||
|
$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
|
||||||
|
$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
|
||||||
|
|
||||||
|
?>
|
@@ -2,9 +2,8 @@
|
|||||||
/**
|
/**
|
||||||
* Form handling code.
|
* Form handling code.
|
||||||
*
|
*
|
||||||
* @package phpMyAdmin-setup
|
* @package phpMyAdmin
|
||||||
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
|
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
105
libraries/user_preferences.lib.php
Normal file
105
libraries/user_preferences.lib.php
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
|
/**
|
||||||
|
* Functions for displaying user preferences pages
|
||||||
|
*
|
||||||
|
* @package phpMyAdmin
|
||||||
|
*/
|
||||||
|
|
||||||
|
$forms = array();
|
||||||
|
$forms['Features']['General'] = array(
|
||||||
|
'DefaultLang',
|
||||||
|
'DefaultConnectionCollation',
|
||||||
|
'ThemeDefault',
|
||||||
|
'NaturalOrder',
|
||||||
|
'InitialSlidersState',
|
||||||
|
'ErrorIconic',
|
||||||
|
'ReplaceHelpImg');
|
||||||
|
$forms['Features']['Text_fields'] = array(
|
||||||
|
'CharEditing',
|
||||||
|
'CharTextareaCols',
|
||||||
|
'CharTextareaRows',
|
||||||
|
'TextareaCols',// [s-]
|
||||||
|
'TextareaRows',// [s-]
|
||||||
|
'LongtextDoubleTextarea');// [s-]
|
||||||
|
$forms['Sql_queries']['Sql_queries'] = array(
|
||||||
|
'ShowSQL',
|
||||||
|
'Confirm',
|
||||||
|
'IgnoreMultiSubmitErrors',
|
||||||
|
'VerboseMultiSubmit',
|
||||||
|
'MaxCharactersInDisplayedSQL',// [s-]
|
||||||
|
'SQLQuery/Edit',// [s-]
|
||||||
|
'SQLQuery/Explain',// [s-]
|
||||||
|
'SQLQuery/ShowAsPHP',// [s-]
|
||||||
|
'SQLQuery/Validate',// [false or no override]
|
||||||
|
'SQLQuery/Refresh',// [s-]
|
||||||
|
'EditInWindow',// [s-]
|
||||||
|
'QueryWindowWidth',// [s-]
|
||||||
|
'QueryWindowHeight',// [s-]
|
||||||
|
'QueryWindowDefTab');// [s-]
|
||||||
|
$forms['Sql_queries']['Sql_box'] = array(
|
||||||
|
'Edit',
|
||||||
|
'Explain',
|
||||||
|
'ShowAsPHP',
|
||||||
|
'Validate',// (false or no override)
|
||||||
|
'Refresh');
|
||||||
|
$forms['Features']['Page_titles'] = array(
|
||||||
|
'TitleTable',// [s-]
|
||||||
|
'TitleDatabase',// [s-]
|
||||||
|
'TitleServer',// [s-]
|
||||||
|
'TitleDefault');// [s-]
|
||||||
|
$forms['Left_frame']['Left_frame'] = array(
|
||||||
|
'LeftFrameLight',
|
||||||
|
'LeftDisplayLogo',
|
||||||
|
'LeftLogoLink',
|
||||||
|
'LeftLogoLinkWindow',
|
||||||
|
'LeftPointerEnable');
|
||||||
|
$forms['Left_frame']['Left_servers'] = array(
|
||||||
|
'LeftDisplayServers',
|
||||||
|
'DisplayServersList');
|
||||||
|
$forms['Left_frame']['Left_databases'] = array(
|
||||||
|
'DisplayDatabasesList',
|
||||||
|
'LeftFrameDBTree',
|
||||||
|
'LeftFrameDBSeparator',
|
||||||
|
'LeftFrameTableLevel',
|
||||||
|
'ShowTooltipAliasDB');
|
||||||
|
$forms['Left_frame']['Left_tables'] = array(
|
||||||
|
'LeftDefaultTabTable',
|
||||||
|
'LeftFrameTableSeparator',
|
||||||
|
'LeftFrameTableLevel',
|
||||||
|
'ShowTooltip',
|
||||||
|
'ShowTooltipAliasTB');
|
||||||
|
$forms['Main_frame']['Startup'] = array(
|
||||||
|
'MainPageIconic',
|
||||||
|
'SuggestDBName');
|
||||||
|
$forms['Main_frame']['Browse'] = array(
|
||||||
|
'NavigationBarIconic',
|
||||||
|
'ShowAll',
|
||||||
|
'MaxRows',
|
||||||
|
'Order',
|
||||||
|
'DisplayBinaryAsHex',
|
||||||
|
'BrowsePointerEnable',
|
||||||
|
'BrowseMarkerEnable',
|
||||||
|
'RepeatCells',// [s-]
|
||||||
|
'LimitChars',// [s-]
|
||||||
|
'ModifyDeleteAtLeft',// [s-]
|
||||||
|
'ModifyDeleteAtRight',// [s-]
|
||||||
|
'DefaultDisplay');// [s-]
|
||||||
|
$forms['Main_frame']['Edit'] = array(
|
||||||
|
'ProtectBinary',
|
||||||
|
'ShowFunctionFields',
|
||||||
|
'ShowFieldTypesInDataEditView',// [s-]
|
||||||
|
'InsertRows',
|
||||||
|
'ForeignKeyDropdownOrder',// [s, ? custom text value]
|
||||||
|
'ForeignKeyMaxLimit',
|
||||||
|
'CtrlArrowsMoving',
|
||||||
|
'DefaultPropDisplay');// [s-]
|
||||||
|
$forms['Main_frame']['Tabs'] = array(
|
||||||
|
'LightTabs',
|
||||||
|
'PropertiesIconic',
|
||||||
|
'DefaultTabServer',
|
||||||
|
'DefaultTabDatabase',
|
||||||
|
'DefaultTabTable');
|
||||||
|
$forms['Import']['Import_defaults'] = array();
|
||||||
|
$forms['Export']['Export_defaults'] = array();
|
||||||
|
?>
|
@@ -11,7 +11,7 @@
|
|||||||
* Core libraries.
|
* Core libraries.
|
||||||
*/
|
*/
|
||||||
require './lib/common.inc.php';
|
require './lib/common.inc.php';
|
||||||
require_once './setup/lib/Form.class.php';
|
require_once './libraries/config/Form.class.php';
|
||||||
require_once './setup/lib/FormDisplay.class.php';
|
require_once './setup/lib/FormDisplay.class.php';
|
||||||
|
|
||||||
$form_display = new FormDisplay();
|
$form_display = new FormDisplay();
|
||||||
|
@@ -14,7 +14,7 @@ if (!defined('PHPMYADMIN')) {
|
|||||||
/**
|
/**
|
||||||
* Core libraries.
|
* Core libraries.
|
||||||
*/
|
*/
|
||||||
require_once './setup/lib/Form.class.php';
|
require_once './libraries/config/Form.class.php';
|
||||||
require_once './setup/lib/FormDisplay.class.php';
|
require_once './setup/lib/FormDisplay.class.php';
|
||||||
require_once './setup/lib/form_processing.lib.php';
|
require_once './setup/lib/form_processing.lib.php';
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ if (!defined('PHPMYADMIN')) {
|
|||||||
/**
|
/**
|
||||||
* Core libraries.
|
* Core libraries.
|
||||||
*/
|
*/
|
||||||
require_once './setup/lib/Form.class.php';
|
require_once './libraries/config/Form.class.php';
|
||||||
require_once './setup/lib/FormDisplay.class.php';
|
require_once './setup/lib/FormDisplay.class.php';
|
||||||
require_once './setup/lib/form_processing.lib.php';
|
require_once './setup/lib/form_processing.lib.php';
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ class ConfigFile
|
|||||||
// apply default values overrides
|
// apply default values overrides
|
||||||
if (count($cfg_db['_overrides'])) {
|
if (count($cfg_db['_overrides'])) {
|
||||||
foreach ($cfg_db['_overrides'] as $path => $value) {
|
foreach ($cfg_db['_overrides'] as $path => $value) {
|
||||||
array_write($path, $cfg, $value);
|
PMA_array_write($path, $cfg, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ class ConfigFile
|
|||||||
$default_value = $this->getDefault($canonical_path);
|
$default_value = $this->getDefault($canonical_path);
|
||||||
if (!isset($this->persistKeys[$canonical_path])
|
if (!isset($this->persistKeys[$canonical_path])
|
||||||
&& (($value == $default_value) || (empty($value) && empty($default_value)))) {
|
&& (($value == $default_value) || (empty($value) && empty($default_value)))) {
|
||||||
array_remove($path, $_SESSION['ConfigFile']);
|
PMA_array_remove($path, $_SESSION['ConfigFile']);
|
||||||
} else {
|
} else {
|
||||||
array_write($path, $_SESSION['ConfigFile'], $value);
|
PMA_array_write($path, $_SESSION['ConfigFile'], $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ class ConfigFile
|
|||||||
*/
|
*/
|
||||||
public function get($path, $default = null)
|
public function get($path, $default = null)
|
||||||
{
|
{
|
||||||
return array_read($path, $_SESSION['ConfigFile'], $default);
|
return PMA_array_read($path, $_SESSION['ConfigFile'], $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +121,7 @@ class ConfigFile
|
|||||||
*/
|
*/
|
||||||
public function getDefault($canonical_path, $default = null)
|
public function getDefault($canonical_path, $default = null)
|
||||||
{
|
{
|
||||||
return array_read($canonical_path, $this->cfg, $default);
|
return PMA_array_read($canonical_path, $this->cfg, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,7 +134,7 @@ class ConfigFile
|
|||||||
*/
|
*/
|
||||||
public function getValue($path, $default = null)
|
public function getValue($path, $default = null)
|
||||||
{
|
{
|
||||||
$v = array_read($path, $_SESSION['ConfigFile'], null);
|
$v = PMA_array_read($path, $_SESSION['ConfigFile'], null);
|
||||||
if ($v !== null) {
|
if ($v !== null) {
|
||||||
return $v;
|
return $v;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ class ConfigFile
|
|||||||
*/
|
*/
|
||||||
public function getDbEntry($path, $default = null)
|
public function getDbEntry($path, $default = null)
|
||||||
{
|
{
|
||||||
return array_read($path, $this->cfgDb, $default);
|
return PMA_array_read($path, $this->cfgDb, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,13 +252,18 @@ class ConfigFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns config file path
|
* Returns config file path, relative to phpMyAdmin's root path
|
||||||
*
|
*
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
public function getFilePath()
|
public function getFilePath()
|
||||||
{
|
{
|
||||||
return $this->getDbEntry('_config_file_path');
|
// Load paths
|
||||||
|
if (!defined('SETUP_CONFIG_FILE')) {
|
||||||
|
require_once './libraries/vendor_config.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
return SETUP_CONFIG_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
*
|
*
|
||||||
* @package phpMyAdmin-setup
|
* @package phpMyAdmin-setup
|
||||||
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
|
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,8 +19,9 @@ if (!file_exists('./libraries/common.inc.php')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_once './libraries/common.inc.php';
|
require_once './libraries/common.inc.php';
|
||||||
|
require_once './libraries/config/config_functions.lib.php';
|
||||||
|
require_once './libraries/config/messages.inc.php';
|
||||||
require_once './libraries/url_generating.lib.php';
|
require_once './libraries/url_generating.lib.php';
|
||||||
require_once './setup/lib/messages.inc.php';
|
|
||||||
require_once './setup/lib/ConfigFile.class.php';
|
require_once './setup/lib/ConfigFile.class.php';
|
||||||
|
|
||||||
// use default error handler
|
// use default error handler
|
||||||
@@ -37,194 +37,4 @@ if (!isset($_SESSION['ConfigFile'])) {
|
|||||||
// allows for redirection even after sending some data
|
// allows for redirection even after sending some data
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
/**
|
?>
|
||||||
* Returns value of an element in $array given by $path.
|
|
||||||
* $path is a string describing position of an element in an associative array,
|
|
||||||
* eg. Servers/1/host refers to $array[Servers][1][host]
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param array $array
|
|
||||||
* @param mixed $default
|
|
||||||
* @return mixed array element or $default
|
|
||||||
*/
|
|
||||||
function array_read($path, $array, $default = null)
|
|
||||||
{
|
|
||||||
$keys = explode('/', $path);
|
|
||||||
$value =& $array;
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
if (!isset($value[$key])) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
$value =& $value[$key];
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores value in an array
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param array &$array
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
function array_write($path, &$array, $value)
|
|
||||||
{
|
|
||||||
$keys = explode('/', $path);
|
|
||||||
$last_key = array_pop($keys);
|
|
||||||
$a =& $array;
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
if (!isset($a[$key])) {
|
|
||||||
$a[$key] = array();
|
|
||||||
}
|
|
||||||
$a =& $a[$key];
|
|
||||||
}
|
|
||||||
$a[$last_key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes value from an array
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param array &$array
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
function array_remove($path, &$array)
|
|
||||||
{
|
|
||||||
$keys = explode('/', $path);
|
|
||||||
$keys_last = array_pop($keys);
|
|
||||||
$path = array();
|
|
||||||
$depth = 0;
|
|
||||||
|
|
||||||
$path[0] =& $array;
|
|
||||||
$found = true;
|
|
||||||
// go as deep as required or possible
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
if (!isset($path[$depth][$key])) {
|
|
||||||
$found = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$depth++;
|
|
||||||
$path[$depth] =& $path[$depth-1][$key];
|
|
||||||
}
|
|
||||||
// if element found, remove it
|
|
||||||
if ($found) {
|
|
||||||
unset($path[$depth][$keys_last]);
|
|
||||||
$depth--;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove empty nested arrays
|
|
||||||
for (; $depth >= 0; $depth--) {
|
|
||||||
if (!isset($path[$depth+1]) || count($path[$depth+1]) == 0) {
|
|
||||||
unset($path[$depth][$keys[$depth]]);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns sanitized language string, taking into account our special codes
|
|
||||||
* for formatting. Takes variable number of arguments.
|
|
||||||
* Based on PMA_sanitize from sanitize.lib.php.
|
|
||||||
*
|
|
||||||
* @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix
|
|
||||||
* @param mixed $args arguments for sprintf
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function PMA_lang($lang_key)
|
|
||||||
{
|
|
||||||
static $search, $replace;
|
|
||||||
|
|
||||||
// some quick cache'ing
|
|
||||||
if ($search === null) {
|
|
||||||
$replace_pairs = array(
|
|
||||||
'<' => '<',
|
|
||||||
'>' => '>',
|
|
||||||
'[em]' => '<em>',
|
|
||||||
'[/em]' => '</em>',
|
|
||||||
'[strong]' => '<strong>',
|
|
||||||
'[/strong]' => '</strong>',
|
|
||||||
'[code]' => '<code>',
|
|
||||||
'[/code]' => '</code>',
|
|
||||||
'[kbd]' => '<kbd>',
|
|
||||||
'[/kbd]' => '</kbd>',
|
|
||||||
'[br]' => '<br />',
|
|
||||||
'[sup]' => '<sup>',
|
|
||||||
'[/sup]' => '</sup>');
|
|
||||||
$search = array_keys($replace_pairs);
|
|
||||||
$replace = array_values($replace_pairs);
|
|
||||||
}
|
|
||||||
if (!isset($GLOBALS["strSetup$lang_key"])) {
|
|
||||||
return $lang_key;
|
|
||||||
}
|
|
||||||
$message = str_replace($search, $replace, $GLOBALS["strSetup$lang_key"]);
|
|
||||||
// replace [a@"$1"]$2[/a] with <a href="$1">$2</a>
|
|
||||||
$message = preg_replace('#\[a@("?)([^\]]+)\1\]([^\[]+)\[/a\]#e',
|
|
||||||
"PMA_lang_link_replace('$2', '$3')", $message);
|
|
||||||
|
|
||||||
if (func_num_args() == 1) {
|
|
||||||
return $message;
|
|
||||||
} else {
|
|
||||||
$args = func_get_args();
|
|
||||||
array_shift($args);
|
|
||||||
return vsprintf($message, $args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns translated field name
|
|
||||||
*
|
|
||||||
* @param string $canonical_path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function PMA_lang_name($canonical_path)
|
|
||||||
{
|
|
||||||
$lang_key = str_replace(
|
|
||||||
array('Servers/1/', '/'),
|
|
||||||
array('Servers/', '_'),
|
|
||||||
$canonical_path) . '_name';
|
|
||||||
return isset($GLOBALS["strSetup$lang_key"])
|
|
||||||
? $GLOBALS["strSetup$lang_key"]
|
|
||||||
: $lang_key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns translated field description
|
|
||||||
*
|
|
||||||
* @param string $canonical_path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function PMA_lang_desc($canonical_path)
|
|
||||||
{
|
|
||||||
$lang_key = str_replace(
|
|
||||||
array('Servers/1/', '/'),
|
|
||||||
array('Servers/', '_'),
|
|
||||||
$canonical_path) . '_desc';
|
|
||||||
return isset($GLOBALS["strSetup$lang_key"])
|
|
||||||
? PMA_lang($lang_key)
|
|
||||||
: '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps link in <a> tags and replaces argument separator in internal links
|
|
||||||
* to the one returned by PMA_get_arg_separator()
|
|
||||||
*
|
|
||||||
* @param string $link
|
|
||||||
* @param string $text
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function PMA_lang_link_replace($link, $text)
|
|
||||||
{
|
|
||||||
static $separator;
|
|
||||||
|
|
||||||
if (!isset($separator)) {
|
|
||||||
$separator = PMA_get_arg_separator('html');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match('#^http://#', $link)) {
|
|
||||||
$link = str_replace('&', $separator, $link);
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<a href="' . $link . '">' . $text . '</a>';
|
|
||||||
}
|
|
||||||
?>
|
|
@@ -16,87 +16,9 @@ if (!defined('PHPMYADMIN')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load paths.
|
* Load config value database ($cfg_db)
|
||||||
*/
|
*/
|
||||||
require_once('./libraries/vendor_config.php');
|
require './libraries/config.values.php';
|
||||||
|
|
||||||
$cfg_db = array();
|
|
||||||
|
|
||||||
// path to config file, relative to phpMyAdmin's root path
|
|
||||||
$cfg_db['_config_file_path'] = SETUP_CONFIG_FILE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value meaning:
|
|
||||||
* o array - select field, array contains allowed values
|
|
||||||
* o string - type override
|
|
||||||
*
|
|
||||||
* Use normal array, paths won't be expanded
|
|
||||||
*/
|
|
||||||
$cfg_db['Servers'] = array(1 => array(
|
|
||||||
'port' => 'integer',
|
|
||||||
'connect_type' => array('tcp', 'socket'),
|
|
||||||
'extension' => array('mysql', 'mysqli'),
|
|
||||||
'auth_type' => array('config', 'http', 'signon', 'cookie'),
|
|
||||||
'AllowDeny' => array(
|
|
||||||
'order' => array('', 'deny,allow', 'allow,deny', 'explicit')),
|
|
||||||
'only_db' => 'array'));
|
|
||||||
$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode');
|
|
||||||
$cfg_db['DefaultCharset'] = $GLOBALS['cfg']['AvailableCharsets'];
|
|
||||||
$cfg_db['OBGzip'] = array('auto', true, false);
|
|
||||||
$cfg_db['ShowTooltipAliasTB'] = array('nested', true, false);
|
|
||||||
$cfg_db['DisplayDatabasesList'] = array('auto', true, false);
|
|
||||||
$cfg_db['LeftLogoLinkWindow'] = array('main', 'new');
|
|
||||||
$cfg_db['LeftDefaultTabTable'] = array(
|
|
||||||
'tbl_structure.php', // fields list
|
|
||||||
'tbl_sql.php', // SQL form
|
|
||||||
'tbl_select.php', // search page
|
|
||||||
'tbl_change.php', // insert row page
|
|
||||||
'sql.php'); // browse page
|
|
||||||
$cfg_db['NavigationBarIconic'] = array(true, false, 'both');
|
|
||||||
$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
|
|
||||||
$cfg_db['ProtectBinary'] = array(false, 'blob', 'all');
|
|
||||||
$cfg_db['CharEditing'] = array('input', 'textarea');
|
|
||||||
$cfg_db['PropertiesIconic'] = array(true, false, 'both');
|
|
||||||
$cfg_db['DefaultTabServer'] = array(
|
|
||||||
'main.php', // the welcome page (recommended for multiuser setups)
|
|
||||||
'server_databases.php', // list of databases
|
|
||||||
'server_status.php', // runtime information
|
|
||||||
'server_variables.php', // MySQL server variables
|
|
||||||
'server_privileges.php', // user management
|
|
||||||
'server_processlist.php'); // process list
|
|
||||||
$cfg_db['DefaultTabDatabase'] = array(
|
|
||||||
'db_structure.php', // tables list
|
|
||||||
'db_sql.php', // SQL form
|
|
||||||
'db_search.php', // search query
|
|
||||||
'db_operations.php'); // operations on database
|
|
||||||
$cfg_db['DefaultTabTable'] = array(
|
|
||||||
'tbl_structure.php', // fields list
|
|
||||||
'tbl_sql.php', // SQL form
|
|
||||||
'tbl_select.php', // search page
|
|
||||||
'tbl_change.php', // insert row page
|
|
||||||
'sql.php'); // browse page
|
|
||||||
$cfg_db['QueryWindowDefTab'] = array(
|
|
||||||
'sql', // SQL
|
|
||||||
'files', // Import files
|
|
||||||
'history', // SQL history
|
|
||||||
'full'); // All (SQL and SQL history)
|
|
||||||
$cfg_db['Import']['format'] = array(
|
|
||||||
'csv', // CSV
|
|
||||||
'docsql', // DocSQL
|
|
||||||
'ldi', // CSV using LOAD DATA
|
|
||||||
'sql'); // SQL
|
|
||||||
$cfg_db['Import']['sql_compatibility'] = array(
|
|
||||||
'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', 'MYSQL40', 'MSSQL', 'ORACLE',
|
|
||||||
// removed; in MySQL 5.0.33, this produces exports that
|
|
||||||
// can't be read by POSTGRESQL (see our bug #1596328)
|
|
||||||
//'POSTGRESQL',
|
|
||||||
'TRADITIONAL');
|
|
||||||
$cfg_db['Import']['ldi_local_option'] = array('auto', true, false);
|
|
||||||
$cfg_db['Export']['format'] = array('codegen', 'csv', 'excel', 'htmlexcel',
|
|
||||||
'htmlword', 'latex', 'ods', 'odt', 'pdf', 'sql', 'texytext', 'xls', 'xml',
|
|
||||||
'yaml');
|
|
||||||
$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
|
|
||||||
$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config options which will be placed in config file even if they are set
|
* Config options which will be placed in config file even if they are set
|
||||||
|
45
user_preferences.php
Normal file
45
user_preferences.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
|
/**
|
||||||
|
* User preferences 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/messages.inc.php';
|
||||||
|
|
||||||
|
$GLOBALS['js_include'][] = 'js/settings_forms.js';
|
||||||
|
|
||||||
|
require_once './libraries/header.inc.php';
|
||||||
|
|
||||||
|
// Any message to display?
|
||||||
|
if (! empty($message)) {
|
||||||
|
PMA_showMessage($message);
|
||||||
|
unset($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
$common_url_query = PMA_generate_common_url('', '');
|
||||||
|
|
||||||
|
$tabs = array();
|
||||||
|
foreach (array_keys($forms) as $form) {
|
||||||
|
$tabs[] = array(
|
||||||
|
'link' => 'user_preferences.php',
|
||||||
|
'text' => PMA_ifSetOr($GLOBALS['strSetupForm_' . $form], $form), // TODO: remove ifSetOr
|
||||||
|
'active' => $form == PMA_ifSetOr($_GET['form'], ''),
|
||||||
|
'url_params' => array('form' => $form)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo PMA_generate_html_tabs($tabs, array());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the footer
|
||||||
|
*/
|
||||||
|
require_once './libraries/footer.inc.php';
|
||||||
|
?>
|
Reference in New Issue
Block a user